Conditions | 6 |
Paths | 10 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function save() |
||
22 | { |
||
23 | if (!file_exists($this->path)) { |
||
|
|||
24 | FileHelper::mkdir($this->path); |
||
25 | } |
||
26 | |||
27 | foreach ($this->getItems() as $id => $config) { |
||
28 | $type = isset($config['template']) || isset($config['copy']) ? 'File' : 'Directory'; |
||
29 | $defaults = [ |
||
30 | 'class' => "hidev\\components\\$type", |
||
31 | 'path' => $this->path . '/' . $id, |
||
32 | ]; |
||
33 | $config = array_merge($defaults, $config ?: []); |
||
34 | $object = Yii::createObject($config); |
||
35 | $object->save(); |
||
36 | } |
||
37 | |||
38 | $this->modifyFile(); |
||
39 | } |
||
40 | } |
||
41 |
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.