1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
3
+ * Copyright 2025 Adobe
4
+ * All rights reserved.
4
5
* See COPYING.txt for license details.
5
6
*/
6
7
9
10
namespace Magento \WebapiAsync \Controller \Rest ;
10
11
11
12
use Magento \Framework \Exception \BulkException ;
13
+ use Magento \Framework \Exception \InputException ;
14
+ use Magento \Framework \Exception \LocalizedException ;
15
+ use Magento \Framework \Webapi \Exception ;
16
+ use Magento \Framework \Webapi \Rest \Request ;
12
17
use Magento \Webapi \Controller \Rest \RequestProcessorInterface ;
13
18
use Magento \Framework \Webapi \Rest \Response as RestResponse ;
14
19
use Magento \WebapiAsync \Controller \Rest \Asynchronous \InputParamsResolver ;
25
30
*/
26
31
class AsynchronousRequestProcessor implements RequestProcessorInterface
27
32
{
28
- const PROCESSOR_PATH = "/^ \\/async( \\/V.+)/ " ;
29
- const BULK_PROCESSOR_PATH = "/^ \\/async\/bulk( \\/V.+)/ " ;
33
+ private const PROCESSOR_PATH = "/^ \\/async( \\/V.+)/ " ;
34
+ private const BULK_PROCESSOR_PATH = "/^ \\/async\/bulk( \\/V.+)/ " ;
30
35
31
36
/**
32
37
* @var \Magento\Framework\Webapi\Rest\Response
@@ -87,9 +92,9 @@ public function __construct(
87
92
}
88
93
89
94
/**
90
- * { @inheritdoc}
95
+ * @inheritdoc
91
96
*/
92
- public function process (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
97
+ public function process (Request $ request )
93
98
{
94
99
$ path = $ request ->getPathInfo ();
95
100
$ path = preg_replace ($ this ->processorPath , "$1 " , $ path );
@@ -119,10 +124,15 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
119
124
}
120
125
121
126
/**
122
- * @param \Magento\Framework\Webapi\Rest\Request $request
127
+ * Get Topic Name
128
+ *
129
+ * @param Request $request
123
130
* @return string
131
+ * @throws InputException
132
+ * @throws LocalizedException
133
+ * @throws Exception
124
134
*/
125
- private function getTopicName ($ request )
135
+ private function getTopicName (Request $ request ): string
126
136
{
127
137
$ route = $ this ->inputParamsResolver ->getRoute ();
128
138
@@ -133,11 +143,11 @@ private function getTopicName($request)
133
143
}
134
144
135
145
/**
136
- * { @inheritdoc}
146
+ * @inheritdoc
137
147
*/
138
- public function canProcess (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
148
+ public function canProcess (Request $ request )
139
149
{
140
- if ($ request ->getHttpMethod () === \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_GET ) {
150
+ if ($ request ->getHttpMethod () === Request::HTTP_METHOD_GET ) {
141
151
return false ;
142
152
}
143
153
@@ -148,10 +158,12 @@ public function canProcess(\Magento\Framework\Webapi\Rest\Request $request)
148
158
}
149
159
150
160
/**
151
- * @param \Magento\Framework\Webapi\Rest\Request $request
161
+ * To check if it is bulk
162
+ *
163
+ * @param Request $request
152
164
* @return bool
153
165
*/
154
- public function isBulk (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
166
+ public function isBulk (Request $ request ): bool
155
167
{
156
168
if (preg_match (self ::BULK_PROCESSOR_PATH , $ request ->getPathInfo ()) === 1 ) {
157
169
return true ;
0 commit comments