Sfoglia il codice sorgente

Output the size of the pool after dependency resolution for users

Nils Adermann 9 anni fa
parent
commit
07e1d227c9
2 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 9 1
      src/Composer/DependencyResolver/Pool.php
  2. 4 0
      src/Composer/Installer.php

+ 9 - 1
src/Composer/DependencyResolver/Pool.php

@@ -31,7 +31,7 @@ use Composer\Package\PackageInterface;
  * @author Nils Adermann <naderman@naderman.de>
  * @author Jordi Boggiano <j.boggiano@seld.be>
  */
-class Pool
+class Pool implements \Countable
 {
     const MATCH_NAME = -1;
     const MATCH_NONE = 0;
@@ -160,6 +160,14 @@ class Pool
         return $this->packages[$id - 1];
     }
 
+    /**
+     * Returns how many packages have been loaded into the pool
+     */
+    public function count()
+    {
+        return count($this->packages);
+    }
+
     /**
      * Searches all packages providing the given package name and match the constraint
      *

+ 4 - 0
src/Composer/Installer.php

@@ -511,6 +511,10 @@ class Installer
             return max(1, $e->getCode());
         }
 
+        if ($this->io->isVerbose()) {
+            $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies");
+        }
+
         // force dev packages to be updated if we update or install from a (potentially new) lock
         $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, 'force-updates', $operations);