| Total Complexity | 53 |
| Total Lines | 551 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Complex classes like Base often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Base, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | abstract class Base |
||
| 22 | implements Iface, \Aimeos\MW\Macro\Iface |
||
| 23 | { |
||
| 24 | use \Aimeos\MW\Macro\Traits; |
||
| 25 | |||
| 26 | private $object; |
||
| 27 | private $context; |
||
| 28 | private $serviceItem; |
||
| 29 | private $beGlobalConfig; |
||
| 30 | private static $methods = []; |
||
|
|
|||
| 31 | |||
| 32 | |||
| 33 | /** |
||
| 34 | * Initializes the service provider object. |
||
| 35 | * |
||
| 36 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
||
| 37 | * @param \Aimeos\MShop\Service\Item\Iface $serviceItem Service item with configuration for the provider |
||
| 38 | */ |
||
| 39 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Service\Item\Iface $serviceItem ) |
||
| 40 | { |
||
| 41 | $this->context = $context; |
||
| 42 | $this->serviceItem = $serviceItem; |
||
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * Returns the price when using the provider. |
||
| 48 | * Usually, this is the lowest price that is available in the service item but can also be a calculated based on |
||
| 49 | * the basket content, e.g. 2% of the value as transaction cost. |
||
| 50 | * |
||
| 51 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
||
| 52 | * @return \Aimeos\MShop\Price\Item\Iface Price item containing the price, shipping, rebate |
||
| 53 | */ |
||
| 54 | public function calcPrice( \Aimeos\MShop\Order\Item\Base\Iface $basket ) : \Aimeos\MShop\Price\Item\Iface |
||
| 55 | { |
||
| 56 | $manager = \Aimeos\MShop::create( $this->context, 'price' ); |
||
| 57 | $prices = $this->serviceItem->getRefItems( 'price', 'default', 'default' ); |
||
| 58 | |||
| 59 | return $prices->isEmpty() ? $manager->create() : $manager->getLowestPrice( $prices, 1 ); |
||
| 60 | } |
||
| 61 | |||
| 62 | |||
| 63 | /** |
||
| 64 | * Checks the backend configuration attributes for validity. |
||
| 65 | * |
||
| 66 | * @param array $attributes Attributes added by the shop owner in the administraton interface |
||
| 67 | * @return array An array with the attribute keys as key and an error message as values for all attributes that are |
||
| 68 | * known by the provider but aren't valid resp. null for attributes whose values are OK |
||
| 69 | */ |
||
| 70 | public function checkConfigBE( array $attributes ) : array |
||
| 71 | { |
||
| 72 | return []; |
||
| 73 | } |
||
| 74 | |||
| 75 | |||
| 76 | /** |
||
| 77 | * Checks the frontend configuration attributes for validity. |
||
| 78 | * |
||
| 79 | * @param array $attributes Attributes entered by the customer during the checkout process |
||
| 80 | * @return array An array with the attribute keys as key and an error message as values for all attributes that are |
||
| 81 | * known by the provider but aren't valid resp. null for attributes whose values are OK |
||
| 82 | */ |
||
| 83 | public function checkConfigFE( array $attributes ) : array |
||
| 84 | { |
||
| 85 | return []; |
||
| 86 | } |
||
| 87 | |||
| 88 | |||
| 89 | /** |
||
| 90 | * Returns the configuration attribute definitions of the provider to generate a list of available fields and |
||
| 91 | * rules for the value of each field in the administration interface. |
||
| 92 | * |
||
| 93 | * @return array List of attribute definitions implementing \Aimeos\MW\Common\Critera\Attribute\Iface |
||
| 94 | */ |
||
| 95 | public function getConfigBE() : array |
||
| 96 | { |
||
| 97 | return []; |
||
| 98 | } |
||
| 99 | |||
| 100 | |||
| 101 | /** |
||
| 102 | * Returns the configuration attribute definitions of the provider to generate a list of available fields and |
||
| 103 | * rules for the value of each field in the frontend. |
||
| 104 | * |
||
| 105 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
||
| 106 | * @return array List of attribute definitions implementing \Aimeos\MW\Common\Critera\Attribute\Iface |
||
| 107 | */ |
||
| 108 | public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket ) : array |
||
| 109 | { |
||
| 110 | return []; |
||
| 111 | } |
||
| 112 | |||
| 113 | |||
| 114 | /** |
||
| 115 | * Returns the service item which also includes the configuration for the service provider. |
||
| 116 | * |
||
| 117 | * @return \Aimeos\MShop\Service\Item\Iface Service item |
||
| 118 | */ |
||
| 119 | public function getServiceItem() : \Aimeos\MShop\Service\Item\Iface |
||
| 120 | { |
||
| 121 | return $this->serviceItem; |
||
| 122 | } |
||
| 123 | |||
| 124 | |||
| 125 | /** |
||
| 126 | * Injects additional global configuration for the backend. |
||
| 127 | * |
||
| 128 | * It's used for adding additional backend configuration from the application |
||
| 129 | * like the URLs to redirect to. |
||
| 130 | * |
||
| 131 | * Supported redirect URLs are: |
||
| 132 | * - payment.url-success |
||
| 133 | * - payment.url-failure |
||
| 134 | * - payment.url-cancel |
||
| 135 | * - payment.url-update |
||
| 136 | * |
||
| 137 | * @param array $config Associative list of config keys and their value |
||
| 138 | * @return \Aimeos\MShop\Service\Provider\Iface Provider object for chaining method calls |
||
| 139 | */ |
||
| 140 | public function injectGlobalConfigBE( array $config ) : \Aimeos\MShop\Service\Provider\Iface |
||
| 141 | { |
||
| 142 | $this->beGlobalConfig = $config; |
||
| 143 | return $this; |
||
| 144 | } |
||
| 145 | |||
| 146 | |||
| 147 | /** |
||
| 148 | * Checks if payment provider can be used based on the basket content. |
||
| 149 | * Checks for country, currency, address, RMS, etc. -> in separate decorators |
||
| 150 | * |
||
| 151 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
||
| 152 | * @return bool True if payment provider can be used, false if not |
||
| 153 | */ |
||
| 154 | public function isAvailable( \Aimeos\MShop\Order\Item\Base\Iface $basket ) : bool |
||
| 155 | { |
||
| 156 | return true; |
||
| 157 | } |
||
| 158 | |||
| 159 | |||
| 160 | /** |
||
| 161 | * Checks what features the payment provider implements. |
||
| 162 | * |
||
| 163 | * @param int $what Constant from abstract class |
||
| 164 | * @return bool True if feature is available in the payment provider, false if not |
||
| 165 | */ |
||
| 166 | public function isImplemented( int $what ) : bool |
||
| 167 | { |
||
| 168 | return false; |
||
| 169 | } |
||
| 170 | |||
| 171 | |||
| 172 | /** |
||
| 173 | * Queries for status updates for the given order if supported. |
||
| 174 | * |
||
| 175 | * @param \Aimeos\MShop\Order\Item\Iface $order Order invoice object |
||
| 176 | * @return \Aimeos\MShop\Order\Item\Iface Updated order item object |
||
| 177 | */ |
||
| 178 | public function query( \Aimeos\MShop\Order\Item\Iface $order ) : \Aimeos\MShop\Order\Item\Iface |
||
| 179 | { |
||
| 180 | $msg = $this->context->translate( 'mshop', 'Method "%1$s" for provider not available' ); |
||
| 181 | throw new \Aimeos\MShop\Service\Exception( sprintf( $msg, 'query' ) ); |
||
| 182 | } |
||
| 183 | |||
| 184 | |||
| 185 | /** |
||
| 186 | * Injects the outer object into the decorator stack |
||
| 187 | * |
||
| 188 | * @param \Aimeos\MShop\Service\Provider\Iface $object First object of the decorator stack |
||
| 189 | * @return \Aimeos\MShop\Service\Provider\Iface Service object for chaining method calls |
||
| 190 | */ |
||
| 191 | public function setObject( \Aimeos\MShop\Service\Provider\Iface $object ) : \Aimeos\MShop\Service\Provider\Iface |
||
| 192 | { |
||
| 193 | $this->object = $object; |
||
| 194 | return $this; |
||
| 195 | } |
||
| 196 | |||
| 197 | |||
| 198 | /** |
||
| 199 | * Looks for new update files and updates the orders for which status updates were received. |
||
| 200 | * If batch processing of files isn't supported, this method can be empty. |
||
| 201 | * |
||
| 202 | * @return bool True if the update was successful, false if async updates are not supported |
||
| 203 | * @throws \Aimeos\MShop\Service\Exception If updating one of the orders failed |
||
| 204 | */ |
||
| 205 | public function updateAsync() : bool |
||
| 206 | { |
||
| 207 | return false; |
||
| 208 | } |
||
| 209 | |||
| 210 | |||
| 211 | /** |
||
| 212 | * Updates the order status sent by payment gateway notifications |
||
| 213 | * |
||
| 214 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
| 215 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
| 216 | * @return \Psr\Http\Message\ResponseInterface Response object |
||
| 217 | */ |
||
| 218 | public function updatePush( \Psr\Http\Message\ServerRequestInterface $request, |
||
| 219 | \Psr\Http\Message\ResponseInterface $response ) : \Psr\Http\Message\ResponseInterface |
||
| 220 | { |
||
| 221 | return $response->withStatus( 501, 'Not implemented' ); |
||
| 222 | } |
||
| 223 | |||
| 224 | |||
| 225 | /** |
||
| 226 | * Updates the orders for whose status updates have been received by the confirmation page |
||
| 227 | * |
||
| 228 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object with parameters and request body |
||
| 229 | * @param \Aimeos\MShop\Order\Item\Iface $order Order item that should be updated |
||
| 230 | * @return \Aimeos\MShop\Order\Item\Iface Updated order item |
||
| 231 | * @throws \Aimeos\MShop\Service\Exception If updating the orders failed |
||
| 232 | */ |
||
| 233 | public function updateSync( \Psr\Http\Message\ServerRequestInterface $request, |
||
| 237 | } |
||
| 238 | |||
| 239 | |||
| 240 | /** |
||
| 241 | * Checks required fields and the types of the given data map |
||
| 242 | * |
||
| 243 | * @param array $criteria Multi-dimensional associative list of criteria configuration |
||
| 244 | * @param array $map Values to check agains the criteria |
||
| 245 | * @return array An array with the attribute keys as key and an error message as values for all attributes that are |
||
| 246 | * known by the provider but aren't valid resp. null for attributes whose values are OK |
||
| 247 | */ |
||
| 248 | protected function checkConfig( array $criteria, array $map ) : array |
||
| 249 | { |
||
| 250 | $helper = new \Aimeos\MShop\Common\Helper\Config\Standard( $this->getConfigItems( $criteria ) ); |
||
| 251 | return $helper->check( $map ); |
||
| 252 | } |
||
| 253 | |||
| 254 | |||
| 255 | /** |
||
| 256 | * Returns the criteria attribute items for the backend configuration |
||
| 257 | * |
||
| 258 | * @return \Aimeos\MW\Criteria\Attribute\Iface[] List of criteria attribute items |
||
| 259 | */ |
||
| 260 | protected function getConfigItems( array $configList ) : array |
||
| 261 | { |
||
| 262 | $list = []; |
||
| 263 | |||
| 264 | foreach( $configList as $key => $config ) { |
||
| 265 | $list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( $config ); |
||
| 266 | } |
||
| 267 | |||
| 268 | return $list; |
||
| 269 | } |
||
| 270 | |||
| 271 | |||
| 272 | /** |
||
| 273 | * Returns the configuration value that matches one of the given keys. |
||
| 274 | * |
||
| 275 | * The config of the service item and (optionally) the global config |
||
| 276 | * is tested in the order of the keys. The first one that matches will |
||
| 277 | * be returned. |
||
| 278 | * |
||
| 279 | * @param array|string $keys Key name or list of key names that should be tested for in the order to test |
||
| 280 | * @param mixed $default Returned value if the key wasn't was found |
||
| 281 | * @return mixed Value of the first key that matches or null if none was found |
||
| 282 | */ |
||
| 283 | protected function getConfigValue( $keys, $default = null ) |
||
| 284 | { |
||
| 285 | foreach( (array) $keys as $key ) |
||
| 286 | { |
||
| 287 | if( ( $value = $this->getServiceItem()->getConfigValue( $key ) ) !== null ) { |
||
| 288 | return $value; |
||
| 289 | } |
||
| 290 | |||
| 291 | if( isset( $this->beGlobalConfig[$key] ) ) { |
||
| 292 | return $this->beGlobalConfig[$key]; |
||
| 293 | } |
||
| 294 | } |
||
| 295 | |||
| 296 | return $default; |
||
| 297 | } |
||
| 298 | |||
| 299 | |||
| 300 | /** |
||
| 301 | * Returns the context item. |
||
| 302 | * |
||
| 303 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
||
| 304 | */ |
||
| 305 | protected function getContext() : \Aimeos\MShop\Context\Item\Iface |
||
| 306 | { |
||
| 307 | return $this->context; |
||
| 308 | } |
||
| 309 | |||
| 310 | |||
| 311 | /** |
||
| 312 | * Returns the calculated amount of the price item |
||
| 313 | * |
||
| 314 | * @param \Aimeos\MShop\Price\Item\Iface $price Price item |
||
| 315 | * @param bool $costs Include costs per item |
||
| 316 | * @param bool $tax Include tax |
||
| 317 | * @param int $precision Number for decimal digits |
||
| 318 | * @return string Formatted money amount |
||
| 319 | */ |
||
| 320 | protected function getAmount( \Aimeos\MShop\Price\Item\Iface $price, bool $costs = true, bool $tax = true, |
||
| 321 | int $precision = null ) : string |
||
| 322 | { |
||
| 323 | $amount = $price->getValue(); |
||
| 324 | |||
| 325 | if( $costs === true ) { |
||
| 326 | $amount += $price->getCosts(); |
||
| 327 | } |
||
| 328 | |||
| 329 | if( $tax === true && $price->getTaxFlag() === false ) |
||
| 330 | { |
||
| 331 | $tmp = clone $price; |
||
| 332 | |||
| 333 | if( $costs === false ) |
||
| 334 | { |
||
| 335 | $tmp->clear(); |
||
| 336 | $tmp->setValue( $price->getValue() ); |
||
| 337 | $tmp->setTaxRate( $price->getTaxRate() ); |
||
| 338 | $tmp->setQuantity( $price->getQuantity() ); |
||
| 339 | } |
||
| 340 | |||
| 341 | $amount += $tmp->getTaxValue(); |
||
| 342 | } |
||
| 343 | |||
| 344 | return number_format( $amount, $precision !== null ? $precision : $price->getPrecision(), '.', '' ); |
||
| 345 | } |
||
| 346 | |||
| 347 | |||
| 348 | /** |
||
| 349 | * Returns the order service matching the given code from the basket |
||
| 350 | * |
||
| 351 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
||
| 352 | * @param string $type Service type constant from \Aimeos\MShop\Order\Item\Service\Base |
||
| 353 | * @param string $code Code of the service item that should be returned |
||
| 354 | * @return \Aimeos\MShop\Order\Item\Base\Service\Iface Order service item |
||
| 355 | * @throws \Aimeos\MShop\Order\Exception If no service for the given type and code is found |
||
| 356 | */ |
||
| 357 | protected function getBasketService( \Aimeos\MShop\Order\Item\Base\Iface $basket, string $type, |
||
| 358 | string $code ) : \Aimeos\MShop\Order\Item\Base\Service\Iface |
||
| 359 | { |
||
| 360 | foreach( $basket->getService( $type ) as $service ) |
||
| 361 | { |
||
| 362 | if( $service->getCode() === $code ) { |
||
| 363 | return $service; |
||
| 364 | } |
||
| 365 | } |
||
| 366 | |||
| 367 | $msg = $this->context->translate( 'mshop', 'Service not available' ); |
||
| 368 | throw new \Aimeos\MShop\Service\Exception( $msg ); |
||
| 369 | } |
||
| 370 | |||
| 371 | |||
| 372 | /** |
||
| 373 | * Returns the first object of the decorator stack |
||
| 374 | * |
||
| 375 | * @return \Aimeos\MShop\Service\Provider\Iface First object of the decorator stack |
||
| 376 | */ |
||
| 377 | protected function getObject() : \Aimeos\MShop\Service\Provider\Iface |
||
| 384 | } |
||
| 385 | |||
| 386 | |||
| 387 | /** |
||
| 388 | * Returns the order item for the given ID. |
||
| 389 | * |
||
| 390 | * @param string $id Unique order ID |
||
| 391 | * @return \Aimeos\MShop\Order\Item\Iface $item Order object |
||
| 392 | */ |
||
| 393 | protected function getOrder( string $id ) : \Aimeos\MShop\Order\Item\Iface |
||
| 394 | { |
||
| 395 | $manager = \Aimeos\MShop::create( $this->context, 'order' ); |
||
| 396 | |||
| 397 | $search = $manager->filter(); |
||
| 398 | $expr = [ |
||
| 399 | $search->compare( '==', 'order.id', $id ), |
||
| 400 | $search->compare( '==', 'order.base.service.code', $this->serviceItem->getCode() ), |
||
| 401 | ]; |
||
| 402 | $search->setConditions( $search->and( $expr ) ); |
||
| 403 | |||
| 404 | if( ( $item = $manager->search( $search )->first() ) === null ) |
||
| 405 | { |
||
| 406 | $msg = $this->context->translate( 'mshop', 'No order for ID "%1$s" found' ); |
||
| 407 | throw new \Aimeos\MShop\Service\Exception( sprintf( $msg, $id ) ); |
||
| 408 | } |
||
| 409 | |||
| 410 | return $item; |
||
| 411 | } |
||
| 412 | |||
| 413 | |||
| 414 | /** |
||
| 415 | * Returns the base order which is equivalent to the basket. |
||
| 416 | * |
||
| 417 | * @param string $baseId Order base ID stored in the order item |
||
| 418 | * @param int $parts Bitmap of the basket parts that should be loaded |
||
| 419 | * @return \Aimeos\MShop\Order\Item\Base\Iface Basket, optional with addresses, products, services and coupons |
||
| 420 | */ |
||
| 421 | protected function getOrderBase( string $baseId, |
||
| 422 | int $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_SERVICE ) : \Aimeos\MShop\Order\Item\Base\Iface |
||
| 423 | { |
||
| 424 | return \Aimeos\MShop::create( $this->context, 'order/base' )->load( $baseId, $parts ); |
||
| 425 | } |
||
| 426 | |||
| 427 | |||
| 428 | /** |
||
| 429 | * Logs the given message with the passed log level |
||
| 430 | * |
||
| 431 | * @param mixed $msg Message or object |
||
| 432 | * @param int $level Log level (default: ERR) |
||
| 433 | * @return self Same object for fluid method calls |
||
| 434 | */ |
||
| 435 | protected function log( $msg, int $level = \Aimeos\MW\Logger\Base::ERR ) : self |
||
| 436 | { |
||
| 437 | $facility = basename( str_replace( '\\', '/', get_class( $this ) ) ); |
||
| 438 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 ); |
||
| 439 | $trace = array_pop( $trace ) ?: []; |
||
| 440 | $name = ( $trace['class'] ?? '' ) . '::' . ( $trace['function'] ?? '' ); |
||
| 441 | |||
| 442 | if( !is_scalar( $msg ) ) { |
||
| 443 | $msg = print_r( $msg, true ); |
||
| 444 | } |
||
| 445 | |||
| 446 | $this->context->logger()->log( $name . ': ' . $msg, $level, 'core/service/' . $facility ); |
||
| 447 | return $this; |
||
| 448 | } |
||
| 449 | |||
| 450 | |||
| 451 | /** |
||
| 452 | * Saves the order item. |
||
| 453 | * |
||
| 454 | * @param \Aimeos\MShop\Order\Item\Iface $item Order object |
||
| 455 | * @return \Aimeos\MShop\Order\Item\Iface Order object including the generated ID |
||
| 456 | */ |
||
| 457 | protected function saveOrder( \Aimeos\MShop\Order\Item\Iface $item ) : \Aimeos\MShop\Order\Item\Iface |
||
| 458 | { |
||
| 459 | return \Aimeos\MShop::create( $this->context, 'order' )->save( $item ); |
||
| 460 | } |
||
| 461 | |||
| 462 | |||
| 463 | /** |
||
| 464 | * Returns the service related data from the customer account if available |
||
| 465 | * |
||
| 466 | * @param string $customerId Unique customer ID the service token belongs to |
||
| 467 | * @param string $type Type of the value that should be returned |
||
| 468 | * @return array|string|null Service data or null if none is available |
||
| 469 | */ |
||
| 470 | protected function getCustomerData( string $customerId, string $type ) |
||
| 471 | { |
||
| 472 | if( $customerId != null ) |
||
| 473 | { |
||
| 474 | $manager = \Aimeos\MShop::create( $this->context, 'customer' ); |
||
| 475 | $item = $manager->get( $customerId, ['service'] ); |
||
| 476 | $serviceId = $this->getServiceItem()->getId(); |
||
| 477 | |||
| 478 | if( ( $listItem = $item->getListItem( 'service', 'default', $serviceId ) ) !== null ) { |
||
| 479 | return $listItem->getConfigValue( $type ); |
||
| 480 | } |
||
| 481 | } |
||
| 482 | |||
| 483 | return null; |
||
| 484 | } |
||
| 485 | |||
| 486 | |||
| 487 | /** |
||
| 488 | * Saves the base order which is equivalent to the basket and its dependent objects. |
||
| 489 | * |
||
| 490 | * @param \Aimeos\MShop\Order\Item\Base\Iface $base Order base object with associated items |
||
| 491 | * @param int $parts Bitmap of the basket parts that should be stored |
||
| 492 | * @return \Aimeos\MShop\Order\Item\Base\Iface Stored order base item |
||
| 493 | */ |
||
| 494 | protected function saveOrderBase( \Aimeos\MShop\Order\Item\Base\Iface $base, |
||
| 495 | int $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_SERVICE ) : \Aimeos\MShop\Order\Item\Base\Iface |
||
| 496 | { |
||
| 497 | return \Aimeos\MShop::create( $this->context, 'order/base' )->store( $base, $parts ); |
||
| 498 | } |
||
| 499 | |||
| 500 | |||
| 501 | /** |
||
| 502 | * Sets the attributes in the given service item. |
||
| 503 | * |
||
| 504 | * @param \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem Order service item that will be added to the basket |
||
| 505 | * @param array $attributes Attribute key/value pairs entered by the customer during the checkout process |
||
| 506 | * @param string $type Type of the configuration values (delivery or payment) |
||
| 507 | * @return \Aimeos\MShop\Order\Item\Base\Service\Iface Modified order service item |
||
| 508 | */ |
||
| 509 | protected function setAttributes( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem, array $attributes, |
||
| 525 | } |
||
| 526 | |||
| 527 | |||
| 528 | /** |
||
| 529 | * Adds the service data to the customer account if available |
||
| 530 | * |
||
| 531 | * @param string $customerId Unique customer ID the service token belongs to |
||
| 532 | * @param string $type Type of the value that should be added |
||
| 533 | * @param string|array $data Service data to store |
||
| 534 | * @param \Aimeos\MShop\Service\Provider\Iface Provider object for chaining method calls |
||
| 535 | */ |
||
| 536 | protected function setCustomerData( string $customerId, string $type, $data ) : \Aimeos\MShop\Service\Provider\Iface |
||
| 555 | } |
||
| 556 | |||
| 557 | |||
| 558 | /** |
||
| 559 | * Throws an exception with the given message |
||
| 560 | * |
||
| 561 | * @param string $msg Message |
||
| 562 | * @param string|null $domain Translation domain |
||
| 563 | * @param int $code Custom error code |
||
| 564 | */ |
||
| 565 | protected function throw( string $msg, string $domain = null, int $code = 0 ) |
||
| 572 | } |
||
| 573 | } |
||
| 574 |