Passed
Push — master ( 92f5b0...9dda59 )
by Aimeos
06:23
created

Base::processBatch()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
4
/**
5
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
6
 * @copyright Metaways Infosystems GmbH, 2011
7
 * @copyright Aimeos (aimeos.org), 2015-2022
8
 * @package MShop
9
 * @subpackage Service
10
 */
11
12
13
namespace Aimeos\MShop\Service\Provider\Delivery;
14
15
16
/**
17
 * Abstract class for all delivery provider implementations.
18
 *
19
 * @package MShop
20
 * @subpackage Service
21
 */
22
abstract class Base extends \Aimeos\MShop\Service\Provider\Base implements Iface
23
{
24
	/**
25
	 * Feature constant if querying for status updates for an order is supported.
26
	 */
27
	const FEAT_QUERY = 1;
28
29
30
	/**
31
	 * Sends the details of all orders to the ERP system for further processing
32
	 *
33
	 * @param \Aimeos\MShop\Order\Item\Iface[] $orders List of order invoice objects
34
	 * @return \Aimeos\Map Updated order items
35
	 */
36
	public function processBatch( iterable $orders ) : \Aimeos\Map
37
	{
38
		foreach( $orders as $key => $order ) {
39
			$orders[$key] = $this->object()->process( $order );
40
		}
41
42
		return map( $orders );
43
	}
44
45
46
	/**
47
	 * Sets the delivery attributes in the given service.
48
	 *
49
	 * @param \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem Order service item that will be added to the basket
50
	 * @param array $attributes Attribute key/value pairs entered by the customer during the checkout process
51
	 * @return \Aimeos\MShop\Order\Item\Base\Service\Iface Order service item with attributes added
52
	 */
53
	public function setConfigFE( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem,
54
		array $attributes ) : \Aimeos\MShop\Order\Item\Base\Service\Iface
55
	{
56
		return $this->setAttributes( $orderServiceItem, $attributes, 'delivery' );
57
	}
58
}
59