1
0
Fork 0

Added comments to Composer/Factory class in order to make it IDE friendlier.

pull/665/head
Paul Seiffert 2012-05-08 23:04:58 +02:00
parent c438120c69
commit 16941adb49
1 changed files with 43 additions and 6 deletions

View File

@ -27,6 +27,10 @@ use Composer\Util\RemoteFilesystem;
*/ */
class Factory class Factory
{ {
/**
* @static
* @return Config
*/
public static function createConfig() public static function createConfig()
{ {
// load main Composer configuration // load main Composer configuration
@ -62,9 +66,11 @@ class Factory
/** /**
* Creates a Composer instance * Creates a Composer instance
* *
* @param IOInterface $io IO instance * @param IOInterface $io IO instance
* @param mixed $localConfig either a configuration array or a filename to read from, if null it will read from the default filename * @param array|null $localConfig either a configuration array or a filename to read from, if null it will
* @return Composer * read from the default filename
* @throws \InvalidArgumentException
* @return Composer
*/ */
public function createComposer(IOInterface $io, $localConfig = null) public function createComposer(IOInterface $io, $localConfig = null)
{ {
@ -143,6 +149,11 @@ class Factory
return $composer; return $composer;
} }
/**
* @param IO\IOInterface $io
* @param Config $config
* @return Repository\RepositoryManager
*/
protected function createRepositoryManager(IOInterface $io, Config $config) protected function createRepositoryManager(IOInterface $io, Config $config)
{ {
$rm = new RepositoryManager($io, $config); $rm = new RepositoryManager($io, $config);
@ -157,6 +168,10 @@ class Factory
return $rm; return $rm;
} }
/**
* @param Repository\RepositoryManager $rm
* @param $vendorDir
*/
protected function addLocalRepository(RepositoryManager $rm, $vendorDir) protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
{ {
// TODO BC feature, remove after May 30th // TODO BC feature, remove after May 30th
@ -180,6 +195,10 @@ class Factory
$rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed_dev.json'))); $rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed_dev.json')));
} }
/**
* @param array $localConfig
* @return array
*/
protected function addPackagistRepository(array $localConfig) protected function addPackagistRepository(array $localConfig)
{ {
$loadPackagist = true; $loadPackagist = true;
@ -210,6 +229,10 @@ class Factory
return $localConfig; return $localConfig;
} }
/**
* @param IO\IOInterface $io
* @return Downloader\DownloadManager
*/
public function createDownloadManager(IOInterface $io) public function createDownloadManager(IOInterface $io)
{ {
$dm = new Downloader\DownloadManager(); $dm = new Downloader\DownloadManager();
@ -225,6 +248,14 @@ class Factory
return $dm; return $dm;
} }
/**
* @param Repository\RepositoryManager $rm
* @param Downloader\DownloadManager $dm
* @param string $vendorDir
* @param string $binDir
* @param IO\IOInterface $io
* @return Installer\InstallationManager
*/
protected function createInstallationManager(Repository\RepositoryManager $rm, Downloader\DownloadManager $dm, $vendorDir, $binDir, IOInterface $io) protected function createInstallationManager(Repository\RepositoryManager $rm, Downloader\DownloadManager $dm, $vendorDir, $binDir, IOInterface $io)
{ {
$im = new Installer\InstallationManager($vendorDir); $im = new Installer\InstallationManager($vendorDir);
@ -235,9 +266,14 @@ class Factory
return $im; return $im;
} }
/**
* @param Repository\RepositoryManager $rm
* @param Installer\InstallationManager $im
*/
protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im) protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
{ {
foreach ($rm->getLocalRepositories() as $repo) { foreach ($rm->getLocalRepositories() as $repo) {
/* @var $repo Repository\RepositoryInterface */
foreach ($repo->getPackages() as $package) { foreach ($repo->getPackages() as $package) {
if (!$im->isPackageInstalled($repo, $package)) { if (!$im->isPackageInstalled($repo, $package)) {
$repo->removePackage($package); $repo->removePackage($package);
@ -247,9 +283,10 @@ class Factory
} }
/** /**
* @param IOInterface $io IO instance * @param IOInterface $io IO instance
* @param mixed $config either a configuration array or a filename to read from, if null it will read from the default filename * @param mixed $config either a configuration array or a filename to read from, if null it will read from
* @return Composer * the default filename
* @return Composer
*/ */
static public function create(IOInterface $io, $config = null) static public function create(IOInterface $io, $config = null)
{ {