Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public static function create(OutputInterface $output) |
||
14 | { |
||
15 | $output->writeln("<info>Creating global configuration...</info>"); |
||
16 | $configFile = self::getConfigFile(); |
||
17 | |||
18 | if (self::exists()) { |
||
19 | $output->writeln("<comment>Global configuration already exists at {$configFile}.</comment>"); |
||
20 | |||
21 | return; |
||
22 | } |
||
23 | |||
24 | // Add configuration from skeleton. |
||
25 | $config = json_encode(self::configSkeleton(), JSON_PRETTY_PRINT); |
||
26 | $config = stripslashes($config); |
||
27 | file_put_contents($configFile, $config); |
||
28 | |||
29 | $output->writeln("<info>Global configuration created at {$configFile}!</info>"); |
||
30 | } |
||
31 | |||
80 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.