| Conditions | 5 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | private function extractAttributes(Request $request) |
||
| 35 | { |
||
| 36 | $resourceClass = $request->attributes->get('_resource_class'); |
||
| 37 | |||
| 38 | if (!$resourceClass) { |
||
| 39 | throw new RuntimeException('The request attribute "_resource_class" must be defined.'); |
||
| 40 | } |
||
| 41 | |||
| 42 | $collectionOperation = $request->attributes->get('_collection_operation_name'); |
||
| 43 | $itemOperation = $request->attributes->get('_item_operation_name'); |
||
| 44 | |||
| 45 | if (!$itemOperation && !$collectionOperation) { |
||
| 46 | throw new RuntimeException('One of the request attribute "_item_operation_name" or "_collection_operation_name" must be defined.'); |
||
| 47 | } |
||
| 48 | |||
| 49 | $format = $request->attributes->get('_api_format'); |
||
| 50 | if (!$format) { |
||
| 51 | throw new RuntimeException('The request attribute "_api_format" must be defined.'); |
||
| 52 | } |
||
| 53 | |||
| 54 | return [$resourceClass, $collectionOperation, $itemOperation, $format]; |
||
| 55 | } |
||
| 56 | } |
||
| 57 |