From 16941adb49cc21f3347a3474769fd816e0f72795 Mon Sep 17 00:00:00 2001 From: Paul Seiffert Date: Tue, 8 May 2012 23:04:58 +0200 Subject: [PATCH] Added comments to Composer/Factory class in order to make it IDE friendlier. --- src/Composer/Factory.php | 49 +++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 4cad60d97..7872b8d0c 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -27,6 +27,10 @@ use Composer\Util\RemoteFilesystem; */ class Factory { + /** + * @static + * @return Config + */ public static function createConfig() { // load main Composer configuration @@ -62,9 +66,11 @@ class Factory /** * Creates a Composer 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 - * @return Composer + * @param IOInterface $io IO instance + * @param array|null $localConfig either a configuration array or a filename to read from, if null it will + * read from the default filename + * @throws \InvalidArgumentException + * @return Composer */ public function createComposer(IOInterface $io, $localConfig = null) { @@ -143,6 +149,11 @@ class Factory return $composer; } + /** + * @param IO\IOInterface $io + * @param Config $config + * @return Repository\RepositoryManager + */ protected function createRepositoryManager(IOInterface $io, Config $config) { $rm = new RepositoryManager($io, $config); @@ -157,6 +168,10 @@ class Factory return $rm; } + /** + * @param Repository\RepositoryManager $rm + * @param $vendorDir + */ protected function addLocalRepository(RepositoryManager $rm, $vendorDir) { // 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'))); } + /** + * @param array $localConfig + * @return array + */ protected function addPackagistRepository(array $localConfig) { $loadPackagist = true; @@ -210,6 +229,10 @@ class Factory return $localConfig; } + /** + * @param IO\IOInterface $io + * @return Downloader\DownloadManager + */ public function createDownloadManager(IOInterface $io) { $dm = new Downloader\DownloadManager(); @@ -225,6 +248,14 @@ class Factory 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) { $im = new Installer\InstallationManager($vendorDir); @@ -235,9 +266,14 @@ class Factory return $im; } + /** + * @param Repository\RepositoryManager $rm + * @param Installer\InstallationManager $im + */ protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im) { foreach ($rm->getLocalRepositories() as $repo) { + /* @var $repo Repository\RepositoryInterface */ foreach ($repo->getPackages() as $package) { if (!$im->isPackageInstalled($repo, $package)) { $repo->removePackage($package); @@ -247,9 +283,10 @@ class Factory } /** - * @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 - * @return Composer + * @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 + * @return Composer */ static public function create(IOInterface $io, $config = null) {