示例#1
0
 public function __construct(array $packages = array(), array $overrides = array())
 {
     foreach ($overrides as $name => $version) {
         $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
     }
     parent::__construct($packages);
 }
示例#2
0
 /**
  * Initializes filesystem repository.
  *
  * @param array $config package definition
  */
 public function __construct(array $config)
 {
     parent::__construct();
     $this->config = $config['package'];
     // make sure we have an array of package definitions
     if (!is_numeric(key($this->config))) {
         $this->config = array($this->config);
     }
 }
示例#3
0
 /**
  * Initializes path repository.
  *
  * @param array $repoConfig
  * @param IOInterface $io
  * @param Config $config
  */
 public function __construct(array $repoConfig, IOInterface $io, Config $config)
 {
     if (!isset($repoConfig['url'])) {
         throw new \RuntimeException('You must specify the `url` configuration for the path repository');
     }
     $this->loader = new ArrayLoader();
     $this->url = $repoConfig['url'];
     $this->process = new ProcessExecutor($io);
     $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
     parent::__construct();
 }
 public function __construct(array $repoConfig, IOInterface $io)
 {
     parent::__construct();
     if (!extension_loaded('zip')) {
         throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
     }
     $this->loader = new ArrayLoader();
     $this->lookup = $repoConfig['url'];
     $this->io = $io;
     $this->repoConfig = $repoConfig;
 }
示例#5
0
 public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
 {
     parent::__construct();
     $this->drivers = $drivers ?: array('github' => 'Composer\\Repository\\Vcs\\GitHubDriver', 'gitlab' => 'Composer\\Repository\\Vcs\\GitLabDriver', 'git-bitbucket' => 'Composer\\Repository\\Vcs\\GitBitbucketDriver', 'git' => 'Composer\\Repository\\Vcs\\GitDriver', 'hg-bitbucket' => 'Composer\\Repository\\Vcs\\HgBitbucketDriver', 'hg' => 'Composer\\Repository\\Vcs\\HgDriver', 'perforce' => 'Composer\\Repository\\Vcs\\PerforceDriver', 'fossil' => 'Composer\\Repository\\Vcs\\FossilDriver', 'svn' => 'Composer\\Repository\\Vcs\\SvnDriver');
     $this->url = $repoConfig['url'];
     $this->io = $io;
     $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
     $this->verbose = $io->isVeryVerbose();
     $this->config = $config;
     $this->repoConfig = $repoConfig;
 }
示例#6
0
 public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
 {
     parent::__construct();
     if (!preg_match('{^https?://}', $repoConfig['url'])) {
         $repoConfig['url'] = 'http://' . $repoConfig['url'];
     }
     $urlBits = parse_url($repoConfig['url']);
     if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
         throw new \UnexpectedValueException('Invalid url given for PEAR repository: ' . $repoConfig['url']);
     }
     $this->url = rtrim($repoConfig['url'], '/');
     $this->io = $io;
     $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
     $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
     $this->versionParser = new VersionParser();
     $this->repoConfig = $repoConfig;
 }
示例#7
0
 public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
 {
     parent::__construct();
     if (!preg_match('{^[\\w.]+\\??://}', $repoConfig['url'])) {
         // assume http as the default protocol
         $repoConfig['url'] = 'http://' . $repoConfig['url'];
     }
     $repoConfig['url'] = rtrim($repoConfig['url'], '/');
     if ('https?' === substr($repoConfig['url'], 0, 6)) {
         $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
     }
     $urlBits = parse_url($repoConfig['url']);
     if ($urlBits === false || empty($urlBits['scheme'])) {
         throw new \UnexpectedValueException('Invalid url given for Composer repository: ' . $repoConfig['url']);
     }
     if (!isset($repoConfig['options'])) {
         $repoConfig['options'] = array();
     }
     if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
         $this->allowSslDowngrade = true;
     }
     $this->config = $config;
     $this->options = $repoConfig['options'];
     $this->url = $repoConfig['url'];
     $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\\.json)?(?:[?#].*)?$}', '', $this->url), '/');
     $this->io = $io;
     $this->cache = new Cache($io, $config->get('cache-repo-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
     $this->loader = new ArrayLoader();
     if ($rfs && $this->options) {
         $rfs = clone $rfs;
         $rfs->setOptions($this->options);
     }
     $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
     $this->eventDispatcher = $eventDispatcher;
     $this->repoConfig = $repoConfig;
 }