| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class GeneratorPath |
||
| 6 | { |
||
| 7 | private $path; |
||
| 8 | private $generate; |
||
| 9 | private $namespace; |
||
| 10 | |||
| 11 | public function __construct($config) |
||
| 12 | { |
||
| 13 | if (is_array($config)) { |
||
| 14 | $this->path = $config['path']; |
||
| 15 | $this->generate = $config['generate']; |
||
| 16 | $this->namespace = $config['namespace'] ?? $this->convertPathToNamespace($config['path']); |
||
| 17 | |||
| 18 | return; |
||
| 19 | } |
||
| 20 | $this->path = $config; |
||
| 21 | $this->generate = (bool) $config; |
||
| 22 | $this->namespace = $config; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function getPath() |
||
| 26 | { |
||
| 27 | return $this->path; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function generate(): bool |
||
| 31 | { |
||
| 32 | return $this->generate; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function getNamespace() |
||
| 36 | { |
||
| 37 | return $this->namespace; |
||
| 38 | } |
||
| 39 | |||
| 40 | private function convertPathToNamespace($path) |
||
| 43 | } |
||
| 44 | } |
||
| 45 |