Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
38 | 4 | private function createFile($file) |
|
39 | { |
||
40 | 4 | if (\file_exists($file)) { |
|
41 | 1 | $this->output->writeln(\sprintf('The file already exists: <comment>%s</comment>', $file)); |
|
42 | |||
43 | 1 | return; |
|
44 | } |
||
45 | |||
46 | 4 | $templateFile = __DIR__ . '/../../templates/' . $file; |
|
47 | |||
48 | 4 | if (!\file_exists($templateFile)) { |
|
49 | 1 | throw new \InvalidArgumentException(\sprintf('The template file not found: "%s".', $templateFile)); |
|
50 | } |
||
51 | |||
52 | 3 | $this->output->writeln(\sprintf('Creating <comment>%s</comment>', $file)); |
|
53 | |||
54 | 3 | \file_put_contents($file, \file_get_contents($templateFile)); |
|
55 | } |
||
56 | } |
||
57 |