/** * Return the URI path for a given service and operation * * @param Service $service * @param Operation $operation * @return string */ public function __invoke(Service $service) { $route = $service->getRoute(); $routeIdentifier = $service->getRouteIdentifierName(); if (empty($routeIdentifier)) { return $route; } return preg_replace('#\\[/?:' . preg_quote($routeIdentifier) . '\\]#', '', $route); }
/** * Return the URI path for a given service and operation * * @param Service $service * @param Operation $operation * @return string */ public function __invoke(Service $service, Operation $operation) { $route = $service->getRoute(); $routeIdentifier = $service->getRouteIdentifierName(); $entityOps = $service->getEntityOperations(); if (empty($routeIdentifier) || empty($entityOps)) { return $route; } return preg_replace('#\\[/?:' . preg_quote($routeIdentifier) . '\\]#', '', $route); }
/** * @return string */ private function getEntityUri() { return str_replace(['[', ']', '{/', '{:'], ['{', '}', '/{', '{'], $this->service->getRoute()); }