1 | <?php |
||
29 | final class OperationMethodResolver implements OperationMethodResolverInterface |
||
30 | { |
||
31 | private $router; |
||
32 | private $resourceMetadataFactory; |
||
33 | |||
34 | public function __construct(RouterInterface $router, ResourceMetadataFactoryInterface $resourceMetadataFactory) |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function getCollectionOperationMethod(string $resourceClass, string $operationName): string |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getItemOperationMethod(string $resourceClass, string $operationName): string |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function getCollectionOperationRoute(string $resourceClass, string $operationName): Route |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function getItemOperationRoute(string $resourceClass, string $operationName): Route |
||
71 | |||
72 | /** |
||
73 | * @param string $resourceClass |
||
74 | * @param string $operationName |
||
75 | * @param string $operationType |
||
76 | * |
||
77 | * @throws RuntimeException |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | private function getOperationMethod(string $resourceClass, string $operationName, string $operationType): string |
||
108 | |||
109 | /** |
||
110 | * Gets the route related to the given operation. |
||
111 | * |
||
112 | * @param string $resourceClass |
||
113 | * @param string $operationName |
||
114 | * @param string $operationType |
||
115 | * |
||
116 | * @throws RuntimeException |
||
117 | * |
||
118 | * @return Route |
||
119 | */ |
||
120 | private function getOperationRoute(string $resourceClass, string $operationName, string $operationType): Route |
||
140 | |||
141 | /** |
||
142 | * Gets the route name or null if not defined. |
||
143 | * |
||
144 | * @param ResourceMetadata $resourceMetadata |
||
145 | * @param string $operationName |
||
146 | * @param string $operationType |
||
147 | * |
||
148 | * @return string|null |
||
149 | */ |
||
150 | private function getRouteName(ResourceMetadata $resourceMetadata, string $operationName, string $operationType) |
||
158 | |||
159 | /** |
||
160 | * Gets the route with the given name. |
||
161 | * |
||
162 | * @param string $routeName |
||
163 | * |
||
164 | * @throws RuntimeException |
||
165 | * |
||
166 | * @return Route |
||
167 | */ |
||
168 | private function getRoute(string $routeName): Route |
||
178 | } |
||
179 |