1 | <?php |
||
21 | class Config extends \hiqdev\yii2\collection\Object |
||
22 | { |
||
23 | protected $_included = []; |
||
24 | |||
25 | 5 | public function hasGoal($id) |
|
29 | |||
30 | 5 | public function getItemConfig($id = null, array $config = []) |
|
|
|||
31 | { |
||
32 | 5 | if (isset($config['class']) && $this->hasItem($config['class'])) { |
|
33 | $config = array_merge($config, $this->_items[$config['class']]); |
||
34 | } |
||
35 | 5 | return ArrayHelper::merge([ |
|
36 | 5 | 'class' => 'hidev\controllers\CommonController', |
|
37 | 5 | ], $config); |
|
38 | } |
||
39 | |||
40 | 5 | public function createItem($id, $config = []) |
|
44 | |||
45 | 5 | public function getItem($id) |
|
46 | { |
||
47 | 5 | $item = &$this->_items[$id]; |
|
48 | 5 | if (is_array($item)) { |
|
49 | 5 | if (count($item) === 1 && key($item) === 'alias') { |
|
50 | $item = $this->getItem($item['alias']); |
||
51 | } else { |
||
52 | 5 | $item = $this->createItem($id, $item); |
|
53 | } |
||
54 | 5 | } |
|
55 | |||
56 | 5 | return $item; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * Include config file, unique only. |
||
61 | * @param string|array $path |
||
62 | * @return bool true if the path was unique and loaded |
||
63 | */ |
||
64 | 2 | public function includeConfig($path, $force = false) |
|
65 | { |
||
66 | 2 | $file = File::create($path); |
|
67 | 2 | $path = $file->getPath(); |
|
68 | 2 | if (!isset($this->_included[$path]) || $force) { |
|
69 | 2 | $this->_included[$path] = $path; |
|
70 | 2 | $this->mergeItems($file->load()); |
|
71 | 2 | return true; |
|
72 | } |
||
73 | |||
74 | return false; |
||
75 | } |
||
76 | |||
77 | 4 | public function getGoal($id) |
|
81 | |||
82 | 2 | public function getVcs() |
|
87 | } |
||
88 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.