1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2016-2025 |
6
|
|
|
* @package Controller |
7
|
|
|
* @subpackage Frontend |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Controller\Frontend\Service\Decorator; |
12
|
|
|
|
13
|
|
|
use \Psr\Http\Message\ServerRequestInterface; |
|
|
|
|
14
|
|
|
use \Psr\Http\Message\ResponseInterface; |
|
|
|
|
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Base for service frontend controller decorators |
19
|
|
|
* |
20
|
|
|
* @package Controller |
21
|
|
|
* @subpackage Frontend |
22
|
|
|
*/ |
23
|
|
|
abstract class Base |
24
|
|
|
extends \Aimeos\Controller\Frontend\Base |
25
|
|
|
implements \Aimeos\Controller\Frontend\Common\Decorator\Iface, \Aimeos\Controller\Frontend\Service\Iface |
26
|
|
|
{ |
27
|
|
|
use \Aimeos\Controller\Frontend\Common\Decorator\Traits; |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
private \Aimeos\Controller\Frontend\Service\Iface $controller; |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Initializes the controller decorator. |
35
|
|
|
* |
36
|
|
|
* @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
37
|
|
|
* @param \Aimeos\MShop\ContextIface $context Context object with required objects |
38
|
|
|
*/ |
39
|
|
|
public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\ContextIface $context ) |
40
|
|
|
{ |
41
|
|
|
parent::__construct( $context ); |
42
|
|
|
|
43
|
|
|
$this->controller = $controller; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Passes unknown methods to wrapped objects. |
49
|
|
|
* |
50
|
|
|
* @param string $name Name of the method |
51
|
|
|
* @param array $param List of method parameter |
52
|
|
|
* @return mixed Returns the value of the called method |
53
|
|
|
* @throws \Aimeos\Controller\Frontend\Exception If method call failed |
54
|
|
|
*/ |
55
|
|
|
public function __call( string $name, array $param ) |
56
|
|
|
{ |
57
|
|
|
return @call_user_func_array( array( $this->controller, $name ), $param ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Adds generic condition for filtering services |
63
|
|
|
* |
64
|
|
|
* @param string $operator Comparison operator, e.g. "==", "!=", "<", "<=", ">=", ">", "=~", "~=" |
65
|
|
|
* @param string $key Search key defined by the service manager, e.g. "service.status" |
66
|
|
|
* @param array|string $value Value or list of values to compare to |
67
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
68
|
|
|
* @since 2019.04 |
69
|
|
|
*/ |
70
|
|
|
public function compare( string $operator, string $key, $value ) : \Aimeos\Controller\Frontend\Service\Iface |
71
|
|
|
{ |
72
|
|
|
$this->controller->compare( $operator, $key, $value ); |
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Sets the global configuration for the service providers |
79
|
|
|
* |
80
|
|
|
* @param array $conf Associative list of global provider configuration options |
81
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
82
|
|
|
* @since 2024.10 |
83
|
|
|
*/ |
84
|
|
|
public function config( array $conf ) : \Aimeos\Controller\Frontend\Service\Iface |
85
|
|
|
{ |
86
|
|
|
$this->controller->config( $conf ); |
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Returns the service for the given code |
93
|
|
|
* |
94
|
|
|
* @param string $code Unique service code |
95
|
|
|
* @return \Aimeos\MShop\Service\Item\Iface Service item including the referenced domains items |
96
|
|
|
* @since 2019.04 |
97
|
|
|
*/ |
98
|
|
|
public function find( string $code ) : \Aimeos\MShop\Service\Item\Iface |
99
|
|
|
{ |
100
|
|
|
return $this->controller->find( $code ); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Creates a search function string for the given name and parameters |
106
|
|
|
* |
107
|
|
|
* @param string $name Name of the search function without parenthesis, e.g. "service:has" |
108
|
|
|
* @param array $params List of parameters for the search function with numeric keys starting at 0 |
109
|
|
|
* @return string Search function string that can be used in compare() |
110
|
|
|
*/ |
111
|
|
|
public function function( string $name, array $params ) : string |
112
|
|
|
{ |
113
|
|
|
return $this->controller->function( $name, $params ); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Returns the service for the given ID |
119
|
|
|
* |
120
|
|
|
* @param string $id Unique service ID |
121
|
|
|
* @return \Aimeos\MShop\Service\Item\Iface Service item including the referenced domains items |
122
|
|
|
* @since 2019.04 |
123
|
|
|
*/ |
124
|
|
|
public function get( string $id ) : \Aimeos\MShop\Service\Item\Iface |
125
|
|
|
{ |
126
|
|
|
return $this->controller->get( $id ); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Returns the service item for the given ID |
132
|
|
|
* |
133
|
|
|
* @param string $serviceId Unique service ID |
134
|
|
|
* @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
135
|
|
|
*/ |
136
|
|
|
public function getProvider( string $serviceId ) : \Aimeos\MShop\Service\Provider\Iface |
137
|
|
|
{ |
138
|
|
|
return $this->controller->getProvider( $serviceId ); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Returns the service providers for the given type |
144
|
|
|
* |
145
|
|
|
* @return \Aimeos\Map List of service IDs as keys and service provider objects as values |
146
|
|
|
*/ |
147
|
|
|
public function getProviders() : \Aimeos\Map |
148
|
|
|
{ |
149
|
|
|
return $this->controller->getProviders(); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Parses the given array and adds the conditions to the list of conditions |
155
|
|
|
* |
156
|
|
|
* @param array $conditions List of conditions, e.g. ['&&' => [['>' => ['service.status' => 0]], ['==' => ['service.type' => 'default']]]] |
157
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
158
|
|
|
* @since 2019.04 |
159
|
|
|
*/ |
160
|
|
|
public function parse( array $conditions ) : \Aimeos\Controller\Frontend\Service\Iface |
161
|
|
|
{ |
162
|
|
|
$this->controller->parse( $conditions ); |
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Processes the payment service for the given order |
169
|
|
|
* |
170
|
|
|
* @param \Aimeos\MShop\Order\Item\Iface $orderItem Order which should be processed |
171
|
|
|
* @param string $serviceId Unique service item ID |
172
|
|
|
* @param array $urls Associative list of keys and the corresponding URLs |
173
|
|
|
* (keys are payment.url-self, payment.url-success, payment.url-update) |
174
|
|
|
* @param array $params Request parameters and order service attributes |
175
|
|
|
* @return \Aimeos\MShop\Common\Helper\Form\Iface|null Form object with URL, parameters, etc. |
176
|
|
|
* or null if no form data is required |
177
|
|
|
*/ |
178
|
|
|
public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, string $serviceId, |
179
|
|
|
array $urls, array $params ) : ?\Aimeos\MShop\Common\Helper\Form\Iface |
180
|
|
|
{ |
181
|
|
|
return $this->controller->process( $orderItem, $serviceId, $urls, $params ); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Returns the services filtered by the previously assigned conditions |
186
|
|
|
* |
187
|
|
|
* @param int &$total Parameter where the total number of found services will be stored in |
188
|
|
|
* @return \Aimeos\Map Ordered list of items implementing \Aimeos\MShop\Service\Item\Iface |
189
|
|
|
* @since 2019.04 |
190
|
|
|
*/ |
191
|
|
|
public function search( ?int &$total = null ) : \Aimeos\Map |
192
|
|
|
{ |
193
|
|
|
return $this->controller->search( $total ); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Sets the start value and the number of returned services for slicing the list of found services |
199
|
|
|
* |
200
|
|
|
* @param int $start Start value of the first attribute in the list |
201
|
|
|
* @param int $limit Number of returned services |
202
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
203
|
|
|
* @since 2019.04 |
204
|
|
|
*/ |
205
|
|
|
public function slice( int $start, int $limit ) : \Aimeos\Controller\Frontend\Service\Iface |
206
|
|
|
{ |
207
|
|
|
$this->controller->slice( $start, $limit ); |
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Sets the sorting of the result list |
214
|
|
|
* |
215
|
|
|
* @param string|null $key Sorting of the result list like "position", null for no sorting |
216
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
217
|
|
|
* @since 2019.04 |
218
|
|
|
*/ |
219
|
|
|
public function sort( ?string $key = null ) : \Aimeos\Controller\Frontend\Service\Iface |
220
|
|
|
{ |
221
|
|
|
$this->controller->sort( $key ); |
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Adds attribute types for filtering |
228
|
|
|
* |
229
|
|
|
* @param array|string $code Service type or list of types |
230
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
231
|
|
|
* @since 2019.04 |
232
|
|
|
*/ |
233
|
|
|
public function type( $code ) : \Aimeos\Controller\Frontend\Service\Iface |
234
|
|
|
{ |
235
|
|
|
$this->controller->type( $code ); |
236
|
|
|
return $this; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Updates the order status sent by payment gateway notifications |
242
|
|
|
* |
243
|
|
|
* @param ServerRequestInterface $request Request object |
244
|
|
|
* @param ResponseInterface $response Response object that will contain HTTP status and response body |
245
|
|
|
* @param string $code Unique code of the service used for the current order |
246
|
|
|
* @return \Psr\Http\Message\ResponseInterface Response object |
247
|
|
|
*/ |
248
|
|
|
public function updatePush( ServerRequestInterface $request, ResponseInterface $response, string $code ) : \Psr\Http\Message\ResponseInterface |
249
|
|
|
{ |
250
|
|
|
return $this->controller->updatePush( $request, $response, $code ); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Updates the payment or delivery status for the given request |
256
|
|
|
* |
257
|
|
|
* @param ServerRequestInterface $request Request object with parameters and request body |
258
|
|
|
* @param string $code Unique code of the service used for the current order |
259
|
|
|
* @param string $orderid ID of the order whose payment status should be updated |
260
|
|
|
* @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
261
|
|
|
*/ |
262
|
|
|
public function updateSync( ServerRequestInterface $request, string $code, string $orderid ) : \Aimeos\MShop\Order\Item\Iface |
263
|
|
|
{ |
264
|
|
|
return $this->controller->updateSync( $request, $code, $orderid ); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Sets the referenced domains that will be fetched too when retrieving items |
270
|
|
|
* |
271
|
|
|
* @param array $domains Domain names of the referenced items that should be fetched too |
272
|
|
|
* @return \Aimeos\Controller\Frontend\Service\Iface Service controller for fluent interface |
273
|
|
|
* @since 2019.04 |
274
|
|
|
*/ |
275
|
|
|
public function uses( array $domains ) : \Aimeos\Controller\Frontend\Service\Iface |
276
|
|
|
{ |
277
|
|
|
$this->controller->uses( $domains ); |
278
|
|
|
|
279
|
|
|
return $this; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* Injects the reference of the outmost object |
285
|
|
|
* |
286
|
|
|
* @param \Aimeos\Controller\Frontend\Iface $object Reference to the outmost controller or decorator |
287
|
|
|
* @return \Aimeos\Controller\Frontend\Iface Controller object for chaining method calls |
288
|
|
|
*/ |
289
|
|
|
public function setObject( \Aimeos\Controller\Frontend\Iface $object ) : \Aimeos\Controller\Frontend\Iface |
290
|
|
|
{ |
291
|
|
|
parent::setObject( $object ); |
292
|
|
|
|
293
|
|
|
$this->controller->setObject( $object ); |
|
|
|
|
294
|
|
|
|
295
|
|
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Returns the frontend controller |
301
|
|
|
* |
302
|
|
|
* @return \Aimeos\Controller\Frontend\Iface Frontend controller object |
303
|
|
|
*/ |
304
|
|
|
protected function getController() : \Aimeos\Controller\Frontend\Iface |
305
|
|
|
{ |
306
|
|
|
return $this->controller; |
307
|
|
|
} |
308
|
|
|
} |
309
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths