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);
     }
 }
 public function mergeComposerPackages(IPublisherHandler $handler)
 {
     $extensions = implode(',', array_keys($this->typeHandlers));
     foreach ($files = glob($this->path . '/vendor/**/*') as $packageFolder) {
         $files = glob($packageFolder . '/.publisher.{' . $extensions . '}', GLOB_BRACE);
         if ($files && count($files)) {
             $createType = pathinfo($files[0], PATHINFO_EXTENSION);
             $handlerPackage = $this->makeType($createType);
             $handlerPackage->setPath($packageFolder, $createType);
             if ($handlerPackage->exists()) {
                 $handlerPackage->read();
                 $handler->merge($handlerPackage);
             }
         }
     }
 }
 /**
  * @param IPublisherHandler $handler
  * @return $this
  */
 public function merge(IPublisherHandler $handler)
 {
     $newData = $handler->getGroupsByPackageName($newComposerName = $handler->getComposerName());
     $this->setPackageGroups($newComposerName, $newData);
     return $this;
 }