| Conditions | 8 |
| Paths | 10 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 72 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | public function actionSave() |
||
| 37 | { |
||
| 38 | if (!file_exists($this->path)) { |
||
|
|
|||
| 39 | $this->mkdir($this->path); |
||
| 40 | } |
||
| 41 | foreach ($this->getItems() as $id => $config) { |
||
| 42 | $defaults = [ |
||
| 43 | 'class' => isset($config['template']) ? 'template' : 'directory', |
||
| 44 | 'file' => $this->path . '/' . $id, |
||
| 45 | ]; |
||
| 46 | if ($this->recursive) { |
||
| 47 | $defaults['recursive'] = $this->recursive; |
||
| 48 | foreach ((array) $this->recursive as $key) { |
||
| 49 | if ($this->{$key}) { |
||
| 50 | $defaults[$key] = $this->{$key}; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | } |
||
| 54 | $goal = $this->takeConfig()->createItem($id, array_merge($defaults, $config ?: [])); |
||
| 55 | $goal->perform(); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 65 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.