Server IP : 127.0.0.2 / Your IP : 13.59.243.24 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/php/Composer/Repository/ |
Upload File : |
<?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Repository; use Composer\IO\IOInterface; use Composer\Config; use Composer\EventDispatcher\EventDispatcher; use Composer\Package\PackageInterface; use Composer\Util\RemoteFilesystem; /** * Repositories manager. * * @author Jordi Boggiano <j.boggiano@seld.be> * @author Konstantin Kudryashov <ever.zet@gmail.com> * @author François Pluchino <francois.pluchino@opendisplay.com> */ class RepositoryManager { private $localRepository; private $repositories = array(); private $repositoryClasses = array(); private $io; private $config; private $eventDispatcher; private $rfs; public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null) { $this->io = $io; $this->config = $config; $this->eventDispatcher = $eventDispatcher; $this->rfs = $rfs; } /** * Searches for a package by it's name and version in managed repositories. * * @param string $name package name * @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against * * @return PackageInterface|null */ public function findPackage($name, $constraint) { foreach ($this->repositories as $repository) { if ($package = $repository->findPackage($name, $constraint)) { return $package; } } } /** * Searches for all packages matching a name and optionally a version in managed repositories. * * @param string $name package name * @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against * * @return array */ public function findPackages($name, $constraint) { $packages = array(); foreach ($this->repositories as $repository) { $packages = array_merge($packages, $repository->findPackages($name, $constraint)); } return $packages; } /** * Adds repository * * @param RepositoryInterface $repository repository instance */ public function addRepository(RepositoryInterface $repository) { $this->repositories[] = $repository; } /** * Adds a repository to the beginning of the chain * * This is useful when injecting additional repositories that should trump Packagist, e.g. from a plugin. * * @param RepositoryInterface $repository repository instance */ public function prependRepository(RepositoryInterface $repository) { array_unshift($this->repositories, $repository); } /** * Returns a new repository for a specific installation type. * * @param string $type repository type * @param array $config repository configuration * @throws \InvalidArgumentException if repository for provided type is not registered * @return RepositoryInterface */ public function createRepository($type, $config) { if (!isset($this->repositoryClasses[$type])) { throw new \InvalidArgumentException('Repository type is not registered: '.$type); } $class = $this->repositoryClasses[$type]; $reflMethod = new \ReflectionMethod($class, '__construct'); $params = $reflMethod->getParameters(); if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') { return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs); } return new $class($config, $this->io, $this->config, $this->eventDispatcher); } /** * Stores repository class for a specific installation type. * * @param string $type installation type * @param string $class class name of the repo implementation */ public function setRepositoryClass($type, $class) { $this->repositoryClasses[$type] = $class; } /** * Returns all repositories, except local one. * * @return array */ public function getRepositories() { return $this->repositories; } /** * Sets local repository for the project. * * @param WritableRepositoryInterface $repository repository instance */ public function setLocalRepository(WritableRepositoryInterface $repository) { $this->localRepository = $repository; } /** * Returns local repository for the project. * * @return WritableRepositoryInterface */ public function getLocalRepository() { return $this->localRepository; } }