| Conditions | 10 |
| Paths | 60 |
| Total Lines | 80 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 99 | protected function execute(InputInterface $input, OutputInterface $output): void |
||
| 100 | { |
||
| 101 | $this->io = new SymfonyStyle($input, $output); |
||
| 102 | |||
| 103 | $this->io->writeln([ |
||
| 104 | '<info>Welcome to Shlink!!</info>', |
||
| 105 | 'This tool will guide you through the installation process.', |
||
| 106 | ]); |
||
| 107 | |||
| 108 | // Check if a cached config file exists and drop it if so |
||
| 109 | if ($this->filesystem->exists('data/cache/app_config.php')) { |
||
| 110 | $this->io->write('Deleting old cached config...'); |
||
| 111 | try { |
||
| 112 | $this->filesystem->remove('data/cache/app_config.php'); |
||
| 113 | $this->io->writeln(' <info>Success</info>'); |
||
| 114 | } catch (IOException $e) { |
||
|
|
|||
| 115 | $this->io->error( |
||
| 116 | 'Failed! You will have to manually delete the data/cache/app_config.php file to' |
||
| 117 | . ' get new config applied.' |
||
| 118 | ); |
||
| 119 | if ($this->io->isVerbose()) { |
||
| 120 | $this->getApplication()->renderException($e, $output); |
||
| 121 | } |
||
| 122 | return; |
||
| 123 | } |
||
| 124 | } |
||
| 125 | |||
| 126 | // If running update command, ask the user to import previous config |
||
| 127 | $config = $this->isUpdate ? $this->importConfig() : new CustomizableAppConfig(); |
||
| 128 | |||
| 129 | // Ask for custom config params |
||
| 130 | foreach ([ |
||
| 131 | Plugin\DatabaseConfigCustomizer::class, |
||
| 132 | Plugin\UrlShortenerConfigCustomizer::class, |
||
| 133 | Plugin\LanguageConfigCustomizer::class, |
||
| 134 | Plugin\ApplicationConfigCustomizer::class, |
||
| 135 | ] as $pluginName) { |
||
| 136 | /** @var Plugin\ConfigCustomizerInterface $configCustomizer */ |
||
| 137 | $configCustomizer = $this->configCustomizers->get($pluginName); |
||
| 138 | $configCustomizer->process($this->io, $config); |
||
| 139 | } |
||
| 140 | |||
| 141 | // Generate config params files |
||
| 142 | $this->configWriter->toFile(self::GENERATED_CONFIG_PATH, $config->getArrayCopy(), false); |
||
| 143 | $this->io->writeln(['<info>Custom configuration properly generated!</info>', '']); |
||
| 144 | |||
| 145 | // If current command is not update, generate database |
||
| 146 | if (! $this->isUpdate) { |
||
| 147 | $this->io->write('Initializing database...'); |
||
| 148 | if (! $this->runPhpCommand( |
||
| 149 | 'vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:create', |
||
| 150 | 'Error generating database.', |
||
| 151 | $output |
||
| 152 | )) { |
||
| 153 | return; |
||
| 154 | } |
||
| 155 | } |
||
| 156 | |||
| 157 | // Run database migrations |
||
| 158 | $this->io->write('Updating database...'); |
||
| 159 | if (! $this->runPhpCommand( |
||
| 160 | 'vendor/doctrine/migrations/bin/doctrine-migrations.php migrations:migrate', |
||
| 161 | 'Error updating database.', |
||
| 162 | $output |
||
| 163 | )) { |
||
| 164 | return; |
||
| 165 | } |
||
| 166 | |||
| 167 | // Generate proxies |
||
| 168 | $this->io->write('Generating proxies...'); |
||
| 169 | if (! $this->runPhpCommand( |
||
| 170 | 'vendor/doctrine/orm/bin/doctrine.php orm:generate-proxies', |
||
| 171 | 'Error generating proxies.', |
||
| 172 | $output |
||
| 173 | )) { |
||
| 174 | return; |
||
| 175 | } |
||
| 176 | |||
| 177 | $this->io->success('Installation complete!'); |
||
| 178 | } |
||
| 179 | |||
| 256 |
Scrutinizer analyzes your
composer.json/composer.lockfile if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.