| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function materialize(string $code, Declaration $declaration): void |
||
| 24 | { |
||
| 25 | if (class_exists($declaration->class->getNamespacesName())) { |
||
| 26 | throw new \RuntimeException("Class `{$declaration->class->getNamespacesName()}` already exists."); |
||
| 27 | } |
||
| 28 | |||
| 29 | $filename = $this->directory . DIRECTORY_SEPARATOR . $this->convertName($declaration); |
||
| 30 | if (file_exists($filename)) { |
||
| 31 | throw new \RuntimeException("Filename `$filename` already exists."); |
||
| 32 | } |
||
| 33 | |||
| 34 | file_put_contents($filename, $code); |
||
| 35 | } |
||
| 36 | |||
| 41 | } |