/**
  * Retrieve list of unknown packages
  *
  * @param string[] $themePaths
  * @return string[]
  */
 protected function getUnknownPackages($themePaths)
 {
     $installedPackages = $this->composer->getRootRequiredPackages();
     $result = [];
     foreach ($themePaths as $themePath) {
         if (array_search($this->themePackageInfo->getPackageName($themePath), $installedPackages) === false) {
             $result[] = $themePath;
         }
     }
     return $result;
 }
 /**
  * Validate list of modules against installed composer packages and return error messages
  *
  * @param string[] $modules
  * @return string[]
  */
 protected function validate(array $modules)
 {
     $messages = [];
     $unknownPackages = [];
     $unknownModules = [];
     $installedPackages = $this->composer->getRootRequiredPackages();
     foreach ($modules as $module) {
         if (array_search($this->packageInfo->getPackageName($module), $installedPackages) === false) {
             $unknownPackages[] = $module;
         }
         if (!$this->fullModuleList->has($module)) {
             $unknownModules[] = $module;
         }
     }
     $unknownPackages = array_diff($unknownPackages, $unknownModules);
     if (!empty($unknownPackages)) {
         $text = count($unknownPackages) > 1 ? ' are not installed composer packages' : ' is not an installed composer package';
         $messages[] = '<error>' . implode(', ', $unknownPackages) . $text . '</error>';
     }
     if (!empty($unknownModules)) {
         $messages[] = '<error>Unknown module(s): ' . implode(', ', $unknownModules) . '</error>';
     }
     return $messages;
 }
 /**
  * Validate given full theme paths
  *
  * @param string[] $themePaths
  * @return string[]
  */
 private function validate($themePaths)
 {
     $messages = [];
     $unknownPackages = [];
     $unknownThemes = [];
     $installedPackages = $this->composer->getRootRequiredPackages();
     foreach ($themePaths as $themePath) {
         if (array_search($this->getPackageName($themePath), $installedPackages) === false) {
             $unknownPackages[] = $themePath;
         }
         if (!$this->themeCollection->hasTheme($this->themeCollection->getThemeByFullPath($themePath))) {
             $unknownThemes[] = $themePath;
         }
     }
     $unknownPackages = array_diff($unknownPackages, $unknownThemes);
     if (!empty($unknownPackages)) {
         $text = count($unknownPackages) > 1 ? ' are not installed Composer packages' : ' is not an installed Composer package';
         $messages[] = '<error>' . implode(', ', $unknownPackages) . $text . '</error>';
     }
     if (!empty($unknownThemes)) {
         $messages[] = '<error>Unknown theme(s): ' . implode(', ', $unknownThemes) . '</error>';
     }
     return $messages;
 }