hiqdev /
hidev
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * Task runner, code generator and build tool for easier continuos integration |
||
| 5 | * |
||
| 6 | * @link https://github.com/hiqdev/hidev |
||
| 7 | * @package hidev |
||
| 8 | * @license BSD-3-Clause |
||
| 9 | * @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/) |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace hidev\components; |
||
| 13 | |||
| 14 | use hidev\base\File; |
||
| 15 | use hidev\helpers\Helper; |
||
| 16 | use Yii; |
||
| 17 | use yii\base\BootstrapInterface; |
||
| 18 | use yii\base\InvalidParamException; |
||
| 19 | use yii\helpers\ArrayHelper; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * The Config. Keeps config and Goals. |
||
| 23 | */ |
||
| 24 | class Config extends \hiqdev\yii2\collection\Object |
||
| 25 | { |
||
| 26 | public $file = '.hidev/config.yml'; |
||
| 27 | |||
| 28 | protected $_included = []; |
||
| 29 | |||
| 30 | public function hasGoal($id) |
||
| 31 | { |
||
| 32 | return $this->hasItem($id); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function getItemConfig($id = null, array $config = []) |
||
|
0 ignored issues
–
show
|
|||
| 36 | { |
||
| 37 | return ArrayHelper::merge([ |
||
| 38 | 'class' => 'hidev\controllers\CommonController', |
||
| 39 | ], $config); |
||
| 40 | } |
||
| 41 | |||
| 42 | protected function createItem($id, $config = []) |
||
| 43 | { |
||
| 44 | return Yii::createObject($this->getItemConfig($id, $config), [$id, Yii::$app]); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getItem($id) |
||
| 48 | { |
||
| 49 | $item = &$this->_items[$id]; |
||
| 50 | if (is_array($item)) { |
||
| 51 | $item = $this->createItem($id, $item); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $item; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Include config file, unique only. |
||
| 59 | * @param string|array $path |
||
| 60 | * @return bool true if the path was unique and loaded |
||
| 61 | */ |
||
| 62 | public function includeConfig($path) |
||
| 63 | { |
||
| 64 | $file = File::create($path); |
||
| 65 | $path = $file->getPath(); |
||
| 66 | if (!isset($this->_included[$path])) { |
||
| 67 | $this->_included[$path] = $path; |
||
| 68 | $this->mergeItems($file->load()); |
||
| 69 | return true; |
||
| 70 | } |
||
| 71 | |||
| 72 | return false; |
||
| 73 | } |
||
| 74 | |||
| 75 | public function getGoal($id) |
||
| 76 | { |
||
| 77 | return Yii::$app->createControllerById($id); |
||
| 78 | } |
||
| 79 | |||
| 80 | public function getVcs() |
||
| 81 | { |
||
| 82 | /// TODO determine VCS |
||
| 83 | return $this->getGoal('git'); |
||
| 84 | } |
||
| 85 | } |
||
| 86 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.