Ver código fonte

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

Paul Seiffert 13 anos atrás
pai
commit
16941adb49
1 arquivos alterados com 43 adições e 6 exclusões
  1. 43 6
      src/Composer/Factory.php

+ 43 - 6
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)
     {