| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 4.125 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | 1 | public function getUrl($method, array $params = []) |
|
| 46 | { |
||
| 47 | switch ($method) { |
||
| 48 | 1 | case 'getSecretKey': |
|
| 49 | return [ |
||
| 50 | 1 | 'url' => '/1.0/security/secretKey', |
|
| 51 | 'method' => 'GET', |
||
| 52 | 'code' => 200 |
||
| 53 | ]; |
||
| 54 | case 'getDemoUrl': |
||
| 55 | return [ |
||
| 56 | 'url' => '/1.0/security/demoUrl', |
||
| 57 | 'method' => 'GET', |
||
| 58 | 'code' => 200 |
||
| 59 | ]; |
||
| 60 | default: |
||
| 61 | throw new Exception('Route for ' . $method . ' not found'); |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 69 | } |
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: