当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository\InstalledRepositoryInterface类代码示例

本文整理汇总了PHP中Composer\Repository\InstalledRepositoryInterface的典型用法代码示例。如果您正苦于以下问题:PHP InstalledRepositoryInterface类的具体用法?PHP InstalledRepositoryInterface怎么用?PHP InstalledRepositoryInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InstalledRepositoryInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isPackageInstalled

 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package instanceof AliasPackage) {
         return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
     }
     return $this->getInstaller($package->getType())->isInstalled($repo, $package);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:InstallationManager.php

示例2: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:NoopInstaller.php

示例3: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         return;
     }
     $this->removeBinaries($package);
     $repo->removePackage($package);
 }
开发者ID:itscaro,项目名称:composer-global-installer,代码行数:11,代码来源:GlobalInstaller.php

示例4: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:12,代码来源:NoopInstaller.php

示例5: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
     $installPath = $this->getInstallPath($package);
     $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:9,代码来源:Installer.php

示例6: isSymfonyPackagePresent

 private function isSymfonyPackagePresent(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     foreach ($repo->getPackages() as $installedPackage) {
         /* @var PackageInterface $installedPackage */
         if ($installedPackage->getName() == 'symfony/symfony') {
             return true;
         }
     }
     return false;
 }
开发者ID:modera,项目名称:composer-symfony-web-asset-installer-plugin,代码行数:10,代码来源:Installer.php

示例7: updateCode

 public function updateCode(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $initial);
     }
     if ($initial->getInstallationSource() == 'source' && $initial->getSourceType() == 'git' && $target->getSourceType() == 'git') {
         $this->downloadManager->update($initial, $target, $this->getInstallPath($target));
     } else {
         $this->installCode($target);
     }
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
开发者ID:claromentis,项目名称:installer-composer-plugin,代码行数:15,代码来源:BaseInstaller.php

示例8: install

 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // Debug
     $this->debug = $this->isDebug($package);
     // Composer stuff
     $this->initializeVendorDir();
     $downloadPath = $this->getInstallPath($package);
     if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
         $this->removeBinaries($package);
     }
     if (!$repo->hasPackage($package)) {
         $repo->addPackage(clone $package);
     }
     $this->downloadAndExtractFile($package);
 }
开发者ID:azt3k,项目名称:non-destructive-archive-installer,代码行数:18,代码来源:NonDestructiveArchiveInstallerInstaller.php

示例9: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     $downloadPath = $this->getPackageBasePath($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
             @rmdir($packageVendorDir);
         }
     }
 }
开发者ID:VicDeo,项目名称:poc,代码行数:16,代码来源:LibraryInstaller.php

示例10: dump

    public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
    {
        if ($this->classMapAuthoritative) {
            // Force scanPsr0Packages when classmap is authoritative
            $scanPsr0Packages = true;
        }
        $filesystem = new Filesystem();
        $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
        $cwd = getcwd();
        $basePath = $filesystem->normalizePath($cwd);
        $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
        $targetDir = $vendorPath . '/' . $targetDir;
        $filesystem->ensureDirectoryExists($targetDir);
        $useGlobalIncludePath = (bool) $config->get('use-include-path');
        $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
        $classMapAuthoritative = $config->get('classmap-authoritative');
        $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
        $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
        $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
        $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
        // add 5.2 compat
        $vendorPathCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
        $vendorPathToTargetDirCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathToTargetDirCode);
        $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
        $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
        // add custom psr-0 autoloading if the root package has a target dir
        $targetDirLoader = null;
        $mainAutoload = $mainPackage->getAutoload();
        if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
            $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
            $prefixes = implode(', ', array_map(function ($prefix) {
                return var_export($prefix, true);
            }, array_keys($mainAutoload['psr-0'])));
            $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
            $targetDirLoader = <<<EOF

\tpublic static function autoload(\$class) {
\t\t\$dir      = {$baseDirFromTargetDirCode}.'/';
\t\t\$prefixes = array({$prefixes});

\t\tforeach (\$prefixes as \$prefix) {
\t\t\tif (0 !== strpos(\$class, \$prefix)) {
\t\t\t\tcontinue;
\t\t\t}

\t\t\t\$path = explode(DIRECTORY_SEPARATOR, self::getClassPath(\$class));
\t\t\t\$path = \$dir.implode('/', array_slice(\$path, {$levels}));

\t\t\tif (!\$path = self::resolveIncludePath(\$path)) {
\t\t\t\treturn false;
\t\t\t}

\t\t\trequire \$path;
\t\t\treturn true;
\t\t}
\t}

EOF;
        }
        $filesCode = "";
        $autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
        foreach ($autoloads['files'] as $functionFile) {
            // don't include file if it is using PHP 5.3+ syntax
            // https://bitbucket.org/xrstf/composer-php52/issue/4
            if ($this->isPHP53($functionFile)) {
                $filesCode .= '//		require ' . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . "; // disabled because of PHP 5.3 syntax\n";
            } else {
                $filesCode .= '		require ' . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ";\n";
            }
        }
        if (!$suffix) {
            $suffix = md5(uniqid('', true));
        }
        $includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode);
        file_put_contents($vendorPath . '/autoload_52.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
        file_put_contents($targetDir . '/autoload_real_52.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
        // use stream_copy_to_stream instead of copy
        // to work around https://bugs.php.net/bug.php?id=64634
        $sourceLoader = fopen(__DIR__ . '/ClassLoader.php', 'r');
        $targetLoader = fopen($targetDir . '/ClassLoader52.php', 'w+');
        stream_copy_to_stream($sourceLoader, $targetLoader);
        fclose($sourceLoader);
        fclose($targetLoader);
        unset($sourceLoader, $targetLoader);
    }
开发者ID:Garth619,项目名称:Femi9,代码行数:85,代码来源:AutoloadGenerator.php

示例11: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $downloadPath = $this->getInstallPath($package);
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && !glob($packageVendorDir . '/*')) {
             @rmdir($packageVendorDir);
         }
     }
 }
开发者ID:nickelc,项目名称:composer,代码行数:21,代码来源:LibraryInstaller.php

示例12: isPackageInstalled

 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     return $repo->hasPackage($package);
 }
开发者ID:alancleaver,项目名称:composer,代码行数:4,代码来源:InstallationManagerMock.php

示例13: update

 /**
  * Updates a package
  *
  * @param \Composer\Repository\InstalledRepositoryInterface $repo
  * @param \Composer\Package\PackageInterface $initial
  * @param \Composer\Package\PackageInterface $target
  * @throws \InvalidArgumentException
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new CoreInstaller\PackageNotInstalledException($initial);
     }
     $this->getDriver()->update($initial, $target);
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
开发者ID:netresearch,项目名称:composer-installers,代码行数:19,代码来源:CoreInstaller.php

示例14: update

 /**
  * @test
  */
 public function update()
 {
     $initial = $this->createPackageMock();
     $target = $this->createPackageMock();
     $this->installer->expects($this->once())->method('update')->with($this->repository, $initial, $target);
     $this->repository->expects($this->once())->method('hasPackage')->with($initial)->willReturn(true);
     $this->createSolver()->update($this->repository, $initial, $target);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:11,代码来源:SharedPackageInstallerSolverSharedTest.php

示例15: mirrorDirectory

 /**
  * @param string $packageName
  * @param string $sourceDirectory
  * @param string $targetDirectory
  */
 protected static function mirrorDirectory($packageName, $sourceDirectory, $targetDirectory)
 {
     $packages = static::$localRepository->findPackages($packageName, null);
     foreach ($packages as $package) {
         if (static::$installationManager->getInstaller($package->getType())->isInstalled(static::$localRepository, $package)) {
             static::getFileSystem()->mirror(static::$installationManager->getInstallPath($package) . '/' . ltrim($sourceDirectory, '/'), $targetDirectory, null, ['copy_on_windows']);
             return;
         }
     }
 }
开发者ID:ichhabrecht,项目名称:git-checker,代码行数:15,代码来源:Installer.php


注:本文中的Composer\Repository\InstalledRepositoryInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。