| Conditions | 5 |
| Paths | 10 |
| Total Lines | 33 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public function install() |
||
| 48 | { |
||
| 49 | $grumPhpFile = $this->destination . '/grumphp.yml'; |
||
| 50 | |||
| 51 | if (file_exists($grumPhpFile)) { |
||
| 52 | unlink($grumPhpFile); |
||
| 53 | $this->io->write( |
||
| 54 | sprintf( |
||
| 55 | '<comment>Removed:</comment> existing GrumPHP config file %s', |
||
| 56 | $grumPhpFile |
||
| 57 | ) |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | |||
| 61 | $definition = $this->file->read(); |
||
| 62 | if (!empty($definition['extra']['grumphp']['config-default-path'])) { |
||
| 63 | return; |
||
| 64 | } |
||
| 65 | |||
| 66 | if (!array_key_exists('extra', $definition)) { |
||
| 67 | $definition['extra'] = []; |
||
| 68 | } |
||
| 69 | |||
| 70 | if (!array_key_exists('grumphp', $definition['extra'])) { |
||
| 71 | $definition['extra']['grumphp'] = []; |
||
| 72 | } |
||
| 73 | |||
| 74 | $definition['extra']['grumphp']['config-default-path'] = |
||
| 75 | 'vendor/mediact/testing-suite/config/default/grumphp.yml'; |
||
| 76 | |||
| 77 | $this->file->write($definition); |
||
| 78 | $this->io->write( |
||
| 79 | '<info>Added:</info> GrumPHP config to composer.json' |
||
| 80 | ); |
||
| 83 |