Conditions | 9 |
Paths | 18 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 90 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | public function save() |
||
23 | { |
||
24 | if (!file_exists($this->path)) { |
||
|
|||
25 | FileHelper::mrkdir($this->path); |
||
26 | } |
||
27 | foreach ($this->getItems() as $id => $config) { |
||
28 | $defaults = [ |
||
29 | 'class' => isset($config['template']) || isset($config['copy']) ? 'template' : 'directory', |
||
30 | 'file' => $this->path . '/' . $id, |
||
31 | ]; |
||
32 | if ($this->recursive) { |
||
33 | $defaults['recursive'] = $this->recursive; |
||
34 | foreach ((array) $this->recursive as $key) { |
||
35 | if ($this->{$key}) { |
||
36 | $defaults[$key] = $this->{$key}; |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 | $goal = $this->takeConfig()->createItem($id, array_merge($defaults, $config ?: [])); |
||
41 | $goal->perform(); |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 |
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@property
annotation 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.