/** * Shows warnings and sets a new settings which overwrites * invalid settings with default values. * * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ private function warnAndOverwriteInvalidSettingsWithDefaults($output) { $this->projectNameContainsPhpWarning($output); $license = $this->supportedLicenseWarning($output); $testFramework = $this->testFrameworkWarning($output); $phpVersion = $this->phpVersionWarning($output); $this->settings = new Settings($this->settings->getProjectName(), $testFramework, $license, $this->settings->getNamespace(), $this->settings->withGitInit(), $this->settings->withPhpcsConfiguration(), $this->settings->getComposerKeywords(), $this->settings->withVagrantfile(), $this->settings->withEditorConfig(), $phpVersion, $this->settings->withEnvironmentFiles(), $this->settings->withLgtmConfiguration(), $this->settings->withGithubTemplates(), $this->settings->withCodeOfConduct(), $this->settings->withGithubDocs()); }
/** * Generate README.md file. * * @return void */ protected function readme() { if ($this->settings->withCodeOfConduct() === false && $this->settings->withGithubTemplates() === false) { $readme = $this->file->get(__DIR__ . '/stubs/README.stub'); } elseif ($this->settings->withCodeOfConduct() === false && $this->settings->withGithubTemplates() === true) { $readme = $this->file->get(__DIR__ . '/stubs/README.GITHUB.TEMPLATES.stub'); } elseif ($this->settings->withCodeOfConduct() === true && $this->settings->withGithubTemplates() === false) { $readme = $this->file->get(__DIR__ . '/stubs/README.CONDUCT.stub'); } else { $readme = $this->file->get(__DIR__ . '/stubs/README.CONDUCT.GITHUB.TEMPLATES.stub'); } $stubs = ['{project_upper}', '{license}', '{vendor_lower}', '{project_lower}']; $values = [$this->projectUpper, $this->settings->getLicense(), $this->vendorLower, $this->projectLower]; $content = str_replace($stubs, $values, $readme); $this->file->put($this->projectLower . '/' . 'README.md', $content); $this->exportIgnores[] = 'README.md'; }