コード例 #1
0
ファイル: PublisherHandler.php プロジェクト: dubpub/publisher
 private function handlePackage($packageName)
 {
     $this->output->writeln("<info>Handling package: </info>{$packageName}");
     /** @var string $packagePath Path to package directory*/
     $packagePath = $this->vendorPath . DIRECTORY_SEPARATOR . $packageName;
     // skipping if package is not locatable
     if (!$this->handler->packageExists($packageName)) {
         $this->output->writeln("<comment>  [Skipped] Unable to locate \"{$packageName}\" in .publisher file.</comment>");
         return;
     }
     // retrieving group/fileList as groupName => fileList
     /** @var array $groupCollection */
     $groupCollection = $this->handler->getGroupsByPackageName($packageName);
     // if group argument is *, we leave collection as it is,
     // otherwise we take only specified key => value pairs
     if ($this->groupList != ['*']) {
         $groupCollection = array_only($groupCollection, $this->groupList);
         foreach (array_diff($this->groupList, array_keys($groupCollection)) as $ignored) {
             $this->output->writeln("<comment>  [Skipped] Group \"{$ignored}\" not found in \"{$packageName}\".</comment>");
         }
     }
     // iterating through groups
     foreach ($groupCollection as $groupName => $fileList) {
         $this->handlePackageGroup($packagePath, $groupName, $fileList);
     }
 }
コード例 #2
0
 /**
  * @param IPublisherHandler $handler
  * @return $this
  */
 public function merge(IPublisherHandler $handler)
 {
     $newData = $handler->getGroupsByPackageName($newComposerName = $handler->getComposerName());
     $this->setPackageGroups($newComposerName, $newData);
     return $this;
 }