| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 12.9353 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 5 | public function getParams() |
|
|
|
|||
| 35 | { |
||
| 36 | 5 | if (!isset($this->_args)) { |
|
| 37 | if (isset($_SERVER['argv'])) { |
||
| 38 | $args = $_SERVER['argv']; |
||
| 39 | $this->_self = array_shift($args); |
||
| 40 | $command = $args[0]; |
||
| 41 | $alias = Yii::$app->config->aliases->get($command); |
||
| 42 | if ($alias) { |
||
| 43 | array_shift($args); |
||
| 44 | $args = array_merge($alias, $args); |
||
| 45 | } |
||
| 46 | $this->_args = $args; |
||
| 47 | } else { |
||
| 48 | $this->_args = []; |
||
| 49 | } |
||
| 50 | $this->setParams($this->_args); |
||
| 51 | } |
||
| 52 | |||
| 53 | 5 | return $this->_args; |
|
| 54 | } |
||
| 55 | |||
| 62 |
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: