114 foreach ($serviceVersionData as
$version => $serviceData) {
118 self::KEY_METHOD => $methodName,
125 $reflectedMethodsMetadata = $this->classReflector->reflectClassMethods(
127 $services[$serviceName][self::KEY_SERVICE_METHODS]
130 $services[$serviceName][self::KEY_SERVICE_METHODS],
131 $reflectedMethodsMetadata
149 if (
null === $this->services) {
150 $servicesConfig = $this->cache->load(self::SERVICES_CONFIG_CACHE_ID);
151 $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
152 if ($servicesConfig && is_string($servicesConfig) && $typesData && is_string($typesData)) {
153 $this->services = $this->serializer->unserialize($servicesConfig);
154 $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData));
158 $this->serializer->serialize($this->services),
162 $this->serializer->serialize($this->typeProcessor->getTypesData()),
163 self::REFLECTED_TYPES_CACHE_ID
180 if (!isset($servicesConfig[$serviceName]) || !is_array($servicesConfig[$serviceName])) {
181 throw new \RuntimeException(
__(
'Requested service is not available: "%1"', $serviceName));
183 return $servicesConfig[$serviceName];
205 $apiClassPattern =
"#^(.+?)\\\\(.+?)\\\\Api\\\\(.+?)(Interface)?$#";
206 preg_match($apiClassPattern, $interfaceName, $matches);
209 if (!empty($matches)) {
210 $moduleNamespace = $matches[1];
211 $moduleName = $matches[2];
212 $moduleNamespace = ($moduleNamespace ==
'Magento') ?
'' : $moduleNamespace;
213 if ($matches[4] ===
'Interface') {
214 $matches[4] = $matches[3];
216 $serviceNameParts = explode(
'\\', trim($matches[4],
'\\'));
217 if ($moduleName == $serviceNameParts[0]) {
221 $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts);
222 array_unshift($serviceNameParts, $parentServiceName);
223 if ($preserveVersion) {
227 $moduleNamespace = $matches[1];
228 $moduleName = $matches[2];
229 $moduleNamespace = ($moduleNamespace ==
'Magento') ?
'' : $moduleNamespace;
230 $serviceNameParts = explode(
'\\', trim($matches[3],
'\\'));
231 if ($moduleName == $serviceNameParts[0]) {
235 $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts);
236 array_unshift($serviceNameParts, $parentServiceName);
237 if ($preserveVersion) {
241 throw new \InvalidArgumentException(sprintf(
'The service interface name "%s" is invalid.', $interfaceName));
243 return lcfirst(implode(
'', $serviceNameParts));
256 if (!isset($routesConfig[$serviceName]) || !is_array($routesConfig[$serviceName])) {
257 throw new \RuntimeException(
__(
'Requested service is not available: "%1"', $serviceName));
259 return $routesConfig[$serviceName];
269 if (
null === $this->routes) {
270 $routesConfig = $this->cache->load(self::ROUTES_CONFIG_CACHE_ID);
271 $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
272 if ($routesConfig && is_string($routesConfig) && $typesData && is_string($typesData)) {
273 $this->routes = $this->serializer->unserialize($routesConfig);
274 $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData));
278 $this->serializer->serialize($this->routes),
282 $this->serializer->serialize($this->typeProcessor->getTypesData()),
283 self::REFLECTED_TYPES_CACHE_ID
const SERVICE_CLASS_PATTERN
elseif(isset( $params[ 'redirect_parent']))
const KEY_DATA_PARAMETERS