Example #1
0
 /**
  * Executes the command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return mixed
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $license = $input->getArgument('license');
     try {
         $licenseHeader = $this->licenseHeaderFactory->createFromLicenseName($license, array('owners' => $input->getOption('owners')));
     } catch (\InvalidArgumentException $e) {
         $licenseHeader = file_get_contents($license);
     }
     $this->licenser->setLicenseHeader($licenseHeader);
     $this->licenser->setOutputStream($output);
     $sources = $input->getArgument('sources');
     if ($input->getOption('check')) {
         $this->licenser->check($sources);
     } else {
         $this->licenser->process($sources, (bool) $input->getOption('remove-existing'));
     }
 }
 /**
  * Initializes the Licenser instance with license information
  *
  * @param InputInterface  $input  An input stream
  * @param OutputInterface $output An output stream
  */
 protected function initializeLicenser(InputInterface $input, OutputInterface $output)
 {
     $license = $input->getArgument('license');
     try {
         $licenseHeader = $this->licenseHeaderFactory->createFromLicenseName($license, ['owners' => $input->getOption('owners')]);
     } catch (\InvalidArgumentException $e) {
         $licenseHeader = file_get_contents($license);
     }
     $this->licenser->setLicenseHeader($licenseHeader);
     $this->licenser->setOutputStream($output);
 }