| Conditions | 3 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function __invoke(Request $request) |
||
| 25 | { |
||
| 26 | $format = $request->getHeaderLine('Accept'); |
||
| 27 | $format = $this->formats[$format] ?? 'html'; |
||
| 28 | $entityName = $request->getAttribute('entity'); |
||
| 29 | |||
| 30 | if ($this->app->hasEntity($entityName) && method_exists($this, $format)) { |
||
| 31 | return $this->$format($request, $entityName); |
||
| 32 | } |
||
| 33 | |||
| 34 | return Factory::createResponse(404); |
||
| 35 | } |
||
| 36 | |||
| 64 |