Conditions | 4 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 7.9062 |
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 | case 'getAutologinUrl': |
||
61 | return [ |
||
62 | 'url' => '/1.0/security/autologinUrl', |
||
63 | 'method' => 'GET', |
||
64 | 'code' => 200 |
||
65 | ]; |
||
66 | default: |
||
67 | throw new Exception('Route for ' . $method . ' not found'); |
||
68 | } |
||
69 | } |
||
70 | |||
88 | } |
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: