Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
ServiceMetadata Class Reference

Public Member Functions

 __construct (\Magento\Webapi\Model\Config $webapiConfig, \Magento\WebapiAsync\Model\ServiceConfig $serviceConfig, \Magento\Framework\Webapi\Rest\Request $request, AsynchronousSchemaRequestProcessor $asynchronousSchemaRequestProcessor, \Magento\Framework\Reflection\TypeProcessor $typeProcessor)
 
 afterGetServicesConfig (\Magento\Webapi\Model\ServiceMetadata $subject, array $result)
 

Detailed Description

Definition at line 16 of file ServiceMetadata.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Webapi\Model\Config  $webapiConfig,
\Magento\WebapiAsync\Model\ServiceConfig  $serviceConfig,
\Magento\Framework\Webapi\Rest\Request  $request,
AsynchronousSchemaRequestProcessor  $asynchronousSchemaRequestProcessor,
\Magento\Framework\Reflection\TypeProcessor  $typeProcessor 
)

ServiceMetadata constructor.

Parameters
\Magento\Webapi\Model\Config$webapiConfig
\Magento\WebapiAsync\Model\ServiceConfig$serviceConfig
AsynchronousSchemaRequestProcessor$asynchronousSchemaRequestProcessor

Definition at line 56 of file ServiceMetadata.php.

62  {
63  $this->webapiConfig = $webapiConfig;
64  $this->serviceConfig = $serviceConfig;
65  $this->request = $request;
66  $this->asynchronousSchemaRequestProcessor = $asynchronousSchemaRequestProcessor;
67  $this->typeProcessor = $typeProcessor;
68  }

Member Function Documentation

◆ afterGetServicesConfig()

afterGetServicesConfig ( \Magento\Webapi\Model\ServiceMetadata  $subject,
array  $result 
)
Parameters
\Magento\Webapi\Model\ServiceMetadata$subject
array$result
Returns
array @SuppressWarnings(PHPMD.UnusedLocalVariable)

Definition at line 76 of file ServiceMetadata.php.

77  {
78  if ($this->asynchronousSchemaRequestProcessor->canProcess($this->request)) {
79  $synchronousOnlyServiceMethods = $this->getSynchronousOnlyServiceMethods($subject);
80  // Replace all results with the async response schema
81  foreach ($result as $serviceName => $serviceData) {
82  // Check all of the methods on the service
83  foreach ($serviceData[WebapiConverter::KEY_METHODS] as $methodName => $methodData) {
84  // Exclude service methods that are marked as synchronous only
85  if ($this->isServiceMethodSynchronousOnly(
86  $serviceName,
87  $methodName,
88  $synchronousOnlyServiceMethods
89  )) {
90  $this->removeServiceMethodDefinition($result, $serviceName, $methodName);
91  } else {
92  $this->replaceResponseDefinition($result, $serviceName, $methodName);
93  }
94  }
95  }
96  }
97 
98  return $result;
99  }

The documentation for this class was generated from the following file: