| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function getUrl($method, array $params = []) |
||
| 46 | { |
||
| 47 | switch ($method) { |
||
| 48 | case 'getBibFond': |
||
| 49 | return [ |
||
| 50 | 'url' => '/1.0/report/form/bibFond', |
||
| 51 | 'method' => 'GET', |
||
| 52 | 'code' => 200 |
||
| 53 | ]; |
||
| 54 | case 'getEBooks': |
||
| 55 | return [ |
||
| 56 | 'url' => '/1.0/report/form/eBooks', |
||
| 57 | 'method' => 'GET', |
||
| 58 | 'code' => 200 |
||
| 59 | ]; |
||
| 60 | case 'getSpecPo': |
||
| 61 | return [ |
||
| 62 | 'url' => '/1.0/report/form/specPo', |
||
| 63 | 'method' => 'GET', |
||
| 64 | 'code' => 200 |
||
| 65 | ]; |
||
| 66 | default: |
||
| 67 | throw new Exception('Route for ' . $method . ' not found'); |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 85 | } |
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: