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


PHP RepositoryManager::createRepository方法代码示例

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


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

示例1: testRepoCreation

    /**
     * @dataProvider creationCases
     */
    public function testRepoCreation($type, $options, $exception = null)
    {
        if ($exception) {
            $this->setExpectedException($exception);
        }

        $rm = new RepositoryManager(
            $this->getMock('Composer\IO\IOInterface'),
            $config = $this->getMock('Composer\Config', array('get')),
            $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock()
        );

        $tmpdir = $this->tmpdir;
        $config
            ->expects($this->any())
            ->method('get')
            ->will($this->returnCallback(function ($arg) use ($tmpdir) {
                return 'cache-repo-dir' === $arg ? $tmpdir : null;
            }))
        ;

        $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
        $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
        $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
        $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
        $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
        $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
        $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
        $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
        $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');

        $rm->createRepository('composer', array('url' => 'http://example.org'));
        $rm->createRepository($type, $options);
    }
开发者ID:Rudloff,项目名称:composer,代码行数:37,代码来源:RepositoryManagerTest.php

示例2: testRepoCreation

 /**
  * @dataProvider creationCases
  */
 public function testRepoCreation($type, $config)
 {
     $rm = new RepositoryManager($this->getMock('Composer\\IO\\IOInterface'), $this->getMock('Composer\\Config'), $this->getMockBuilder('Composer\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock());
     $rm->setRepositoryClass('composer', 'Composer\\Repository\\ComposerRepository');
     $rm->setRepositoryClass('vcs', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('package', 'Composer\\Repository\\PackageRepository');
     $rm->setRepositoryClass('pear', 'Composer\\Repository\\PearRepository');
     $rm->setRepositoryClass('git', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('svn', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('perforce', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('hg', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('artifact', 'Composer\\Repository\\ArtifactRepository');
     $rm->createRepository('composer', array('url' => 'http://example.org'));
     $rm->createRepository('composer', array('url' => 'http://example.org'));
     $rm->createRepository('composer', array('url' => 'http://example.org'));
 }
开发者ID:Flesh192,项目名称:magento,代码行数:19,代码来源:RepositoryManagerTest.php

示例3: addRegistryRepositories

 /**
  * Adds asset registry repositories.
  *
  * @param RepositoryManager $rm
  * @param VcsPackageFilter  $filter
  * @param array             $extra
  */
 public static function addRegistryRepositories(RepositoryManager $rm, VcsPackageFilter $filter, array $extra)
 {
     $opts = array_key_exists('asset-registry-options', $extra) ? $extra['asset-registry-options'] : array();
     foreach (Assets::getRegistries() as $assetType => $registryClass) {
         $config = array('repository-manager' => $rm, 'vcs-package-filter' => $filter, 'asset-options' => static::createAssetOptions($opts, $assetType));
         $rm->setRepositoryClass($assetType, $registryClass);
         $rm->addRepository($rm->createRepository($assetType, $config));
     }
 }
开发者ID:cychenyin,项目名称:postmill,代码行数:16,代码来源:AssetPlugin.php

示例4: addRepository

 /**
  * Add a repository to collection of repositories.
  *
  * @param  \Composer\Repository\RepositoryManager  $repoManager
  * @param  array                                   $repositories
  * @param  array                                   $repoJson
  */
 private function addRepository(RepositoryManager $repoManager, array &$repositories, $repoJson)
 {
     if (isset($repoJson['type'])) {
         $this->getLogger()->info("Prepending {$repoJson['type']} repository");
         $repository = $repoManager->createRepository($repoJson['type'], $repoJson);
         $repoManager->prependRepository($repository);
         $repositories[] = $repository;
     }
 }
开发者ID:arcanedev,项目名称:composer,代码行数:16,代码来源:RepositoriesTrait.php

示例5: addRepository

    /**
     * @param RepositoryManager $rm         The repository mamanger
     * @param array             $repos      The list of already repository added (passed by reference)
     * @param string            $name       The name of the new repository
     * @param array             $repoConfig The config of the new repository
     * @param Pool|null         $pool       The pool
     */
    public static function addRepository(RepositoryManager $rm, array &$repos, $name, array $repoConfig, Pool $pool = null)
    {
        if (!isset($repos[$name])) {
            $repo = $rm->createRepository($repoConfig['type'], $repoConfig);
            $repos[$name] = $repo;
            $rm->addRepository($repo);

            if (null !== $pool) {
                $pool->addRepository($repo);
            }
        }
    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:19,代码来源:Util.php

示例6: createRepos

 /**
  * @return RepositoryInterface[]
  */
 private static function createRepos(RepositoryManager $rm, array $repoConfigs)
 {
     $repos = array();
     foreach ($repoConfigs as $index => $repo) {
         if (is_string($repo)) {
             throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
         }
         if (!is_array($repo)) {
             throw new \UnexpectedValueException('Repository "' . $index . '" (' . json_encode($repo) . ') should be an array, ' . gettype($repo) . ' given');
         }
         if (!isset($repo['type'])) {
             throw new \UnexpectedValueException('Repository "' . $index . '" (' . json_encode($repo) . ') must have a type defined');
         }
         $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
         while (isset($repos[$name])) {
             $name .= '2';
         }
         if ($repo['type'] === 'filesystem') {
             $repos[$name] = new FilesystemRepository($repo['json']);
         } else {
             $repos[$name] = $rm->createRepository($repo['type'], $repo);
         }
     }
     return $repos;
 }
开发者ID:dazzle-libraries,项目名称:composer,代码行数:28,代码来源:RepositoryFactory.php

示例7: __construct

 public function __construct()
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $this->config = new Config();
     $this->repositoryManager = $rm = new RepositoryManager(new NullIO(), $this->config);
     $rm->setRepositoryClass('composer', 'Composer\\Repository\\ComposerRepository');
     $rm->setRepositoryClass('vcs', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('package', 'Composer\\Repository\\PackageRepository');
     $rm->setRepositoryClass('pear', 'Composer\\Repository\\PearRepository');
     $rm->setRepositoryClass('git', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('svn', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('perforce', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('hg', 'Composer\\Repository\\VcsRepository');
     $rm->setRepositoryClass('artifact', 'Composer\\Repository\\ArtifactRepository');
     $home = $this->getHomeDir();
     $cache = $this->getCacheDir($home);
     $this->config->merge(array('config' => array('home' => $home, 'cache-dir' => $cache)));
     foreach ($this->config->getRepositories() as $index => $repo) {
         if (!is_array($repo)) {
             throw new \UnexpectedValueException('Repository ' . $index . ' (' . json_encode($repo) . ') should be an array, ' . gettype($repo) . ' given');
         }
         if (!isset($repo['type'])) {
             throw new \UnexpectedValueException('Repository ' . $index . ' (' . json_encode($repo) . ') must have a type defined');
         }
         $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
         while (isset($repos[$name])) {
             $name .= '2';
         }
         $repo_object = $rm->createRepository($repo['type'], $repo);
         $rm->addRepository($repo_object);
     }
 }
开发者ID:rmccue,项目名称:Courier,代码行数:32,代码来源:class-manager.php

示例8: addRepository

 /**
  * Add repository config.
  *
  * @param IOInterface       $io         The IO instance
  * @param RepositoryManager $rm         The repository mamanger
  * @param array             $repos      The list of already repository added (passed by reference)
  * @param string            $name       The name of the new repository
  * @param array             $repoConfig The config of the new repository
  * @param Pool|null         $pool       The pool
  */
 public static function addRepository(IOInterface $io, RepositoryManager $rm, array &$repos, $name, array $repoConfig, Pool $pool = null)
 {
     $repo = $rm->createRepository($repoConfig['type'], $repoConfig);
     static::addRepositoryInstance($io, $rm, $repos, $name, $repo, $pool);
 }
开发者ID:MvegaR,项目名称:ingSotfware,代码行数:15,代码来源:Util.php

示例9: buildRegistry

 /**
  * @param string $type
  * @param RepositoryManager $rm
  * @return mixed
  */
 protected static function buildRegistry($type, $rm)
 {
     $config = ['repository-manager' => $rm, 'asset-options' => []];
     $rm->setRepositoryClass($type, static::$classes[$type]);
     return $rm->createRepository($type, $config);
 }
开发者ID:hiqdev,项目名称:asset-packagist,代码行数:11,代码来源:RegistryFactory.php


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