Beispiel #1
0
 /**
  * Sync list of available for install versions for packages
  *
  * @return array
  * @throws \RuntimeException
  */
 public function getPackagesForInstall()
 {
     $actualInstallackages = [];
     $installPackagesInfo = $this->syncPackagesForInstall();
     try {
         $installPackages = $installPackagesInfo['packages'];
         $availablePackageNames = array_column($this->composerInformation->getInstalledMagentoPackages(), 'name');
         $metaPackageByPackage = $this->getMetaPackageForPackage($installPackages);
         foreach ($installPackages as $package) {
             if (!in_array($package['name'], $availablePackageNames) && in_array($package['type'], $this->composerInformation->getPackagesTypes()) && strpos($package['name'], 'magento/product-') === false && strpos($package['name'], 'magento/project-') === false) {
                 $package['metapackage'] = isset($metaPackageByPackage[$package['name']]) ? $metaPackageByPackage[$package['name']] : '';
                 $actualInstallackages[$package['name']] = $package;
                 $actualInstallackages[$package['name']]['version'] = $package['versions'][0];
             }
         }
         $installPackagesInfo['packages'] = $actualInstallackages;
         return $installPackagesInfo;
     } catch (\Exception $e) {
         throw new \RuntimeException('Error in getting new packages to install');
     }
 }