| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function resolveOperationPath(string $resourceShortName, array $operation, $operationType/*, string $operationName = null*/): string |
||
| 38 | { |
||
| 39 | if (func_num_args() < 4) { |
||
| 40 | @trigger_error(sprintf('Method %s() will have a 4th `string $operationName` argument in version 3.0. Not defining it is deprecated since 2.1.', __METHOD__), E_USER_DEPRECATED); |
||
|
1 ignored issue
–
show
|
|||
| 41 | } |
||
| 42 | |||
| 43 | $operationType = OperationTypeDeprecationHelper::getOperationType($operationType); |
||
| 44 | |||
| 45 | if (OperationType::SUBRESOURCE === $operationType) { |
||
| 46 | throw new InvalidArgumentException('Subresource operations are not supported by the OperationPathResolver.'); |
||
| 47 | } |
||
| 48 | |||
| 49 | $path = '/'.$this->pathNameGenerator->getPathName($resourceShortName, true); |
||
| 50 | |||
| 51 | if ($operationType === OperationType::ITEM) { |
||
| 52 | $path .= '/{id}'; |
||
| 53 | } |
||
| 54 | |||
| 55 | $path .= '.{_format}'; |
||
| 56 | |||
| 57 | return $path; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |
If you suppress an error, we recommend checking for the error condition explicitly: