Exemplo n.º 1
0
 /**
  * Get module packs
  *
  * @param   bool $clear (optional)
  *
  * @return  CompletePackage[]
  */
 public function getPackages(bool $clear = false) : array
 {
     if (!$clear && $this->packages !== null) {
         return $this->packages;
     }
     $packages = array();
     $repository = new InstalledFilesystemRepository(new JsonFile($this->info->vendorDir() . '/composer/installed.json'));
     foreach ($repository->getCanonicalPackages() as $package) {
         if (!$package instanceof CompletePackage || $package->getType() !== static::COMPOSER_TYPE) {
             continue;
         }
         $packages[$package->getName()] = $package;
     }
     return $this->packages = $packages;
 }