Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
17 | public function __invoke(string $classDir, string $className, string $content): string |
||
18 | { |
||
19 | if (!is_dir($classDir) && $this->createDir($classDir)) { |
||
20 | throw new RuntimeException(sprintf('Directory "%s" was not created', $classDir)); |
||
21 | } |
||
22 | |||
23 | $realFilePath = $classDir . DIRECTORY_SEPARATOR . $className . '.php'; |
||
24 | if (file_exists($realFilePath)) { |
||
25 | throw new RuntimeException(sprintf('File %s already exist.', $realFilePath)); |
||
26 | } |
||
27 | file_put_contents($realFilePath, $content); |
||
28 | |||
29 | return $realFilePath; |
||
30 | } |
||
37 |