| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function getMockResponse($path, $code = 200) |
||
| 39 | { |
||
| 40 | $ref = new ReflectionObject($this); |
||
| 41 | $dir = \dirname($ref->getFileName()); |
||
| 42 | |||
| 43 | if (!file_exists($dir . '/mock/'. $path) && file_exists($dir . '/../mock/' . $path)) { |
||
| 44 | return new Response( |
||
| 45 | $code, |
||
| 46 | [ |
||
| 47 | 'Content-Type' => 'application/json' |
||
| 48 | ], |
||
| 49 | file_get_contents($dir . '/../mock/' . $path) |
||
| 50 | ); |
||
| 51 | } |
||
| 52 | |||
| 53 | return new Response($code, [], file_get_contents($dir . '/mock/' . $path)); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |