| Conditions | 5 |
| Paths | 8 |
| Total Lines | 27 |
| Code Lines | 10 |
| Lines | 19 |
| Ratio | 70.37 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function write() |
||
| 23 | { |
||
| 24 | // Create module cache folder if not exists |
||
| 25 | if (!file_exists($this->path)) { |
||
| 26 | @mkdir($path, 0777, true); |
||
| 27 | } |
||
| 28 | |||
| 29 | View Code Duplication | foreach ($this->analyzers as $analyzerClass => $analyzer) { |
|
| 30 | // Analyze database structure and get entities metadata |
||
| 31 | foreach ($analyzer->analyze() as $metadata) { |
||
| 32 | // Iterate all generators for analyzer |
||
| 33 | foreach ($this->generators[$analyzerClass] as $generator) { |
||
| 34 | /** @var Generic $generator Create class generator */ |
||
| 35 | $generator = new $generator($this->codeGenerator->defNamespace($this->namespace), $metadata); |
||
| 36 | |||
| 37 | // Create entity generated class names |
||
| 38 | $file = $this->path . $generator->className . '.php'; |
||
| 39 | |||
| 40 | // Create entity query class files |
||
| 41 | file_put_contents($file, '<?php' . $generator->generate()); |
||
| 42 | |||
| 43 | // Require files |
||
| 44 | require($file); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 51 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.