本文整理汇总了PHP中Composer\Repository\InstalledRepositoryInterface类的典型用法代码示例。如果您正苦于以下问题:PHP InstalledRepositoryInterface类的具体用法?PHP InstalledRepositoryInterface怎么用?PHP InstalledRepositoryInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InstalledRepositoryInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: uninstall
/**
* Uninstalls specific package.
*
* @param \Composer\Repository\InstalledRepositoryInterface $repo repository in which to check
* @param \Composer\Package\PackageInterface $package package instance
*/
public function uninstall(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed: ' . $package);
}
if ($this->filesystem->someFilesExist($this->symlinks)) {
$this->filesystem->removeSymlinks($this->symlinks);
}
$this->removeCode($package);
$repo->removePackage($package);
}
开发者ID:rengaw83,项目名称:CmsComposerInstallers,代码行数:17,代码来源:CoreInstaller.php
示例15: isInstalled
/**
* @param InstalledRepositoryInterface $repo
* @param PackageInterface $package
*
* @return bool
*/
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
// Just check if the sources folder and the link exist
return $repo->hasPackage($package) && is_readable($this->getInstallPath($package)) && is_link($this->getPackageVendorSymlink($package));
}
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:11,代码来源:SharedPackageInstaller.php
示例16: uninstall
/**
* @param InstalledRepositoryInterface $repo
* @param PackageInterface $package
*
* @throws FilesystemException
*/
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if ($package->isDev()) {
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed : ' . $package->getPrettyName());
}
$this->symlinkInstaller->uninstall($repo, $package);
} else {
$this->defaultInstaller->uninstall($repo, $package);
}
}
开发者ID:JasLin,项目名称:composer-shared-package-plugin,代码行数:17,代码来源:SharedPackageInstallerSolver.php
示例17: 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;
}
$this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array('optimize' => (bool) $scanPsr0Packages));
$filesystem = new Filesystem();
$filesystem->ensureDirectoryExists($config->get('vendor-dir'));
$basePath = $filesystem->normalizePath(realpath(getcwd()));
$vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
$useGlobalIncludePath = (bool) $config->get('use-include-path');
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
$targetDir = $vendorPath . '/' . $targetDir;
$filesystem->ensureDirectoryExists($targetDir);
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
$vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
$namespacesFile = <<<EOF
<?php
// autoload_namespaces.php @generated by Composer
\$vendorDir = {$vendorPathCode52};
\$baseDir = {$appBaseDirCode};
return array(
EOF;
$psr4File = <<<EOF
<?php
// autoload_psr4.php @generated by Composer
\$vendorDir = {$vendorPathCode52};
\$baseDir = {$appBaseDirCode};
return array(
EOF;
// Collect information from all packages.
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
$autoloads = $this->parseAutoloads($packageMap, $mainPackage);
// Process the 'psr-0' base directories.
foreach ($autoloads['psr-0'] as $namespace => $paths) {
$exportedPaths = array();
foreach ($paths as $path) {
$exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
}
$exportedPrefix = var_export($namespace, true);
$namespacesFile .= " {$exportedPrefix} => ";
$namespacesFile .= "array(" . implode(', ', $exportedPaths) . "),\n";
}
$namespacesFile .= ");\n";
// Process the 'psr-4' base directories.
foreach ($autoloads['psr-4'] as $namespace => $paths) {
$exportedPaths = array();
foreach ($paths as $path) {
$exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
}
$exportedPrefix = var_export($namespace, true);
$psr4File .= " {$exportedPrefix} => ";
$psr4File .= "array(" . implode(', ', $exportedPaths) . "),\n";
}
$psr4File .= ");\n";
$classmapFile = <<<EOF
<?php
// autoload_classmap.php @generated by Composer
\$vendorDir = {$vendorPathCode52};
\$baseDir = {$appBaseDirCode};
return array(
EOF;
// 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
public static function autoload(\$class)
{
\$dir = {$baseDirFromTargetDirCode} . '/';
\$prefixes = array({$prefixes});
foreach (\$prefixes as \$prefix) {
if (0 !== strpos(\$class, \$prefix)) {
continue;
}
\$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), {$levels})).'.php';
if (!\$path = stream_resolve_include_path(\$path)) {
return false;
//.........这里部分代码省略.........
开发者ID:neoFaster,项目名称:composer,代码行数:101,代码来源:AutoloadGenerator.php
示例18: uninstall
/**
* Remove symlinks for Contao sources before uninstalling a package.
*
* {@inheritdoc}
*
* @throws \InvalidArgumentException When the requested package is not installed.
*/
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed: ' . $package);
}
$this->logVerbose(sprintf('Removing Contao sources for %s', $package->getName()));
$this->removeSymlinks($package, $this->getContaoRoot(), $this->getSources($package));
parent::uninstall($repo, $package);
$this->logVerbose('');
}
开发者ID:contao-community-alliance,项目名称:composer-plugin,代码行数:17,代码来源:AbstractModuleInstaller.php
示例19: uninstall
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed: ' . $package);
}
if ($package->getType() === MagentoInstaller::MAGENTO_SOURCE) {
$repo->removePackage($package);
$this->_makeBackup($repo, $package);
} else {
$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:staempfli,项目名称:composer-installer,代码行数:14,代码来源:Installer.php
示例20: uninstall
function uninstall(InstalledRepositoryInterface $repo, PackageInterface $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:balbuf,项目名称:composer-wp,代码行数:6,代码来源:WordPressInstaller.php
注:本文中的Composer\Repository\InstalledRepositoryInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论