11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
3+ * Copyright 2025 Adobe
4+ * All rights reserved.
45 * See COPYING.txt for license details.
56 */
67
910namespace Magento \WebapiAsync \Controller \Rest ;
1011
1112use 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 ;
1217use Magento \Webapi \Controller \Rest \RequestProcessorInterface ;
1318use Magento \Framework \Webapi \Rest \Response as RestResponse ;
1419use Magento \WebapiAsync \Controller \Rest \Asynchronous \InputParamsResolver ;
2530 */
2631class AsynchronousRequestProcessor implements RequestProcessorInterface
2732{
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.+)/ " ;
3035
3136 /**
3237 * @var \Magento\Framework\Webapi\Rest\Response
@@ -87,9 +92,9 @@ public function __construct(
8792 }
8893
8994 /**
90- * { @inheritdoc}
95+ * @inheritdoc
9196 */
92- public function process (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
97+ public function process (Request $ request )
9398 {
9499 $ path = $ request ->getPathInfo ();
95100 $ path = preg_replace ($ this ->processorPath , "$1 " , $ path );
@@ -119,10 +124,15 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
119124 }
120125
121126 /**
122- * @param \Magento\Framework\Webapi\Rest\Request $request
127+ * Get Topic Name
128+ *
129+ * @param Request $request
123130 * @return string
131+ * @throws InputException
132+ * @throws LocalizedException
133+ * @throws Exception
124134 */
125- private function getTopicName ($ request )
135+ private function getTopicName (Request $ request ): string
126136 {
127137 $ route = $ this ->inputParamsResolver ->getRoute ();
128138
@@ -133,11 +143,11 @@ private function getTopicName($request)
133143 }
134144
135145 /**
136- * { @inheritdoc}
146+ * @inheritdoc
137147 */
138- public function canProcess (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
148+ public function canProcess (Request $ request )
139149 {
140- if ($ request ->getHttpMethod () === \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_GET ) {
150+ if ($ request ->getHttpMethod () === Request::HTTP_METHOD_GET ) {
141151 return false ;
142152 }
143153
@@ -148,10 +158,12 @@ public function canProcess(\Magento\Framework\Webapi\Rest\Request $request)
148158 }
149159
150160 /**
151- * @param \Magento\Framework\Webapi\Rest\Request $request
161+ * To check if it is bulk
162+ *
163+ * @param Request $request
152164 * @return bool
153165 */
154- public function isBulk (\ Magento \ Framework \ Webapi \ Rest \ Request $ request )
166+ public function isBulk (Request $ request ): bool
155167 {
156168 if (preg_match (self ::BULK_PROCESSOR_PATH , $ request ->getPathInfo ()) === 1 ) {
157169 return true ;
0 commit comments