| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 23 | public function get($scope, $name) |
||
|
|
|||
| 24 | { |
||
| 25 | if ($scope === 'params') { |
||
| 26 | return Yii::$app->params[$name]; |
||
| 27 | } elseif ($scope === '_ENV') { |
||
| 28 | return $_ENV[$name]; |
||
| 29 | } elseif ($scope === 'config') { |
||
| 30 | return $this->getConfig($name); |
||
| 31 | } else { |
||
| 32 | return "\$${scope}['$name']"; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 43 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: