Conditions | 6 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function save() |
||
22 | { |
||
23 | FileHelper::mkdir($this->_path); |
||
24 | |||
25 | foreach ($this->getItems() as $id => $config) { |
||
26 | $type = 'Directory'; |
||
27 | if (isset($config['template']) || isset($config['copy'])) { |
||
28 | $type = 'File'; |
||
29 | } elseif (isset($config['symlink'])) { |
||
30 | $type = 'Symlink'; |
||
31 | } |
||
32 | $defaults = [ |
||
33 | 'class' => "hidev\\components\\$type", |
||
34 | 'path' => $this->_path . '/' . $id, |
||
35 | ]; |
||
36 | $config = array_merge($defaults, $config ?: []); |
||
37 | $object = Yii::createObject($config); |
||
38 | $object->save(); |
||
39 | } |
||
40 | |||
41 | $this->modifyFile(); |
||
42 | } |
||
48 |