getLicense() public méthode

Get the entered license.
public getLicense ( ) : string
Résultat string
Exemple #1
0
 /**
  * Generate composer file.
  *
  * @param \JonathanTorres\Construct\Helpers\Git $git The git helper.
  *
  * @return void
  */
 protected function composer(Git $git)
 {
     $file = $this->file->get(__DIR__ . '/stubs/composer.txt');
     $user = $git->getUser();
     $stubs = ['{project_upper}', '{project_lower}', '{vendor_lower}', '{vendor_upper}', '{testing}', '{testing_version}', '{namespace}', '{license}', '{author_name}', '{author_email}', '{keywords}'];
     $values = [$this->projectUpper, $this->projectLower, $this->vendorLower, $this->vendorUpper, $this->settings->getTestingFramework(), $this->testingVersion, $this->createNamespace(true), $this->settings->getLicense(), $user['name'], $user['email'], $this->str->toQuotedKeywords($this->settings->getComposerKeywords())];
     $content = str_replace($stubs, $values, $file);
     $this->file->put($this->projectLower . '/' . 'composer.json', $content);
 }
 /**
  * Show warning if a license that is not supported is specified.
  *
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return string
  */
 private function supportedLicenseWarning($output)
 {
     $license = $this->settings->getLicense();
     if (!in_array($license, $this->defaults->licenses)) {
         $warning = '<error>Warning: "' . $license . '" is not a supported license. ' . 'Using ' . Defaults::LICENSE . '.</error>';
         $output->writeln($warning);
         $license = Defaults::LICENSE;
     }
     return $license;
 }
Exemple #3
0
 /**
  * Generate composer file.
  *
  * @param \JonathanTorres\Construct\Helpers\Git $git The git helper.
  *
  * @return void
  */
 protected function composer(Git $git)
 {
     $composerFile = 'composer.' . $this->settings->getTestingFramework();
     $file = $this->file->get(__DIR__ . '/stubs/composer/' . $composerFile . '.stub');
     $user = $git->getUser();
     $stubs = ['{project_upper}', '{project_lower}', '{vendor_lower}', '{vendor_upper}', '{testing}', '{testing_version}', '{namespace}', '{license}', '{author_name}', '{author_email}', '{keywords}', '{php_version}'];
     $values = [$this->projectUpper, $this->projectLower, $this->vendorLower, $this->vendorUpper, $this->settings->getTestingFramework(), $this->testingVersion, $this->createNamespace(true), $this->settings->getLicense(), $user['name'], $user['email'], $this->str->toQuotedKeywords($this->settings->getComposerKeywords()), $this->settings->getPhpVersion()];
     $content = str_replace($stubs, $values, $file);
     if ($this->settings->withEnvironmentFiles()) {
         $composer = json_decode($content, true);
         $composer['require-dev']['vlucas/phpdotenv'] = '~2.1';
         $content = json_encode($composer, JSON_PRETTY_PRINT);
         $content .= PHP_EOL;
     }
     $this->file->put($this->projectLower . '/' . 'composer.json', $content);
 }
 /**
  * Generate composer file.
  *
  * @param \JonathanTorres\Construct\Helpers\Git $git The git helper.
  *
  * @return void
  */
 protected function composer(Git $git)
 {
     $composerFile = 'composer.' . $this->settings->getTestingFramework();
     $file = $this->file->get(__DIR__ . '/stubs/composer/' . $composerFile . '.stub');
     $user = $git->getUser();
     $stubs = ['{project_upper}', '{project_lower}', '{vendor_lower}', '{vendor_upper}', '{testing}', '{namespace}', '{license}', '{author_name}', '{author_email}', '{keywords}', '{php_version}'];
     $values = [$this->projectUpper, $this->projectLower, $this->vendorLower, $this->vendorUpper, $this->settings->getTestingFramework(), $this->createNamespace(true), $this->settings->getLicense(), $user['name'], $user['email'], $this->str->toQuotedKeywords($this->settings->getComposerKeywords()), $this->settings->getPhpVersion()];
     $content = str_replace($stubs, $values, $file);
     if ($this->settings->withPhpcsConfiguration() && !$this->str->isWindows()) {
         $composer = json_decode($content, true);
         $composer['scripts']['cs-fix'] = 'php-cs-fixer fix . -vv || true';
         $composer['scripts']['cs-lint'] = 'php-cs-fixer fix --diff --verbose --dry-run';
         $content = json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
         $content .= PHP_EOL;
     }
     $this->file->put($this->projectLower . '/' . 'composer.json', $content);
 }