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