@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
31 | 31 | */ |
32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
33 | 33 | { |
34 | 34 | /** controller/jobs/order/export/csv/name |
35 | 35 | * Class name of the used order suggestions scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2015.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if ( $name === null ) { |
|
67 | + if ($name === null) { |
|
68 | 68 | $name = $context->getConfig()->get('controller/jobs/order/export/csv/name', 'Standard'); |
69 | 69 | } |
70 | 70 | |
71 | - if ( ctype_alnum($name) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | 73 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Export\\Csv\\' . $name : '<not a string>'; |
74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Export\\Csv\\' . $name; |
79 | 79 | |
80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
81 | 81 | |
82 | 82 | /** controller/jobs/order/export/csv/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the order export CSV job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/order/export/csv/decorators/excludes |
155 | 155 | * @see controller/jobs/order/export/csv/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/export/csv' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/export/csv'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -18,37 +18,37 @@ |
||
18 | 18 | ); |
19 | 19 | |
20 | 20 | |
21 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard( $context, $mapping ); |
|
21 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Coupon\Standard($context, $mapping); |
|
22 | 22 | |
23 | - $invoice = $this->getInvoice( $context ); |
|
24 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
23 | + $invoice = $this->getInvoice($context); |
|
24 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
25 | 25 | |
26 | - $data = $object->process( $invoice, $order ); |
|
26 | + $data = $object->process($invoice, $order); |
|
27 | 27 | |
28 | 28 | |
29 | - $this->assertEquals( 2, count( $data ) ); |
|
29 | + $this->assertEquals(2, count($data)); |
|
30 | 30 | |
31 | - $this->assertEquals( 1, count( $data[0] ) ); |
|
32 | - $this->assertEquals( '5678', $data[0][0] ); |
|
31 | + $this->assertEquals(1, count($data[0])); |
|
32 | + $this->assertEquals('5678', $data[0][0]); |
|
33 | 33 | |
34 | - $this->assertEquals( 1, count( $data[1] ) ); |
|
35 | - $this->assertEquals( 'OPQR', $data[1][0] ); |
|
34 | + $this->assertEquals(1, count($data[1])); |
|
35 | + $this->assertEquals('OPQR', $data[1][0]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | - protected function getInvoice( $context ) |
|
39 | + protected function getInvoice($context) |
|
40 | 40 | { |
41 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
41 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
42 | 42 | |
43 | 43 | $search = $manager->createSearch(); |
44 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
44 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
45 | 45 | |
46 | - $items = $manager->searchItems( $search ); |
|
46 | + $items = $manager->searchItems($search); |
|
47 | 47 | |
48 | - if( ( $item = reset( $items ) ) !== false ) { |
|
48 | + if (($item = reset($items)) !== false) { |
|
49 | 49 | return $item; |
50 | 50 | } |
51 | 51 | |
52 | - throw new \Exception( 'No order item found' ); |
|
52 | + throw new \Exception('No order item found'); |
|
53 | 53 | } |
54 | 54 | } |
@@ -38,77 +38,77 @@ |
||
38 | 38 | ); |
39 | 39 | |
40 | 40 | |
41 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard( $context, $mapping ); |
|
42 | - |
|
43 | - $invoice = $this->getInvoice( $context ); |
|
44 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
45 | - |
|
46 | - $data = $object->process( $invoice, $order ); |
|
47 | - |
|
48 | - |
|
49 | - $this->assertEquals( 2, count( $data ) ); |
|
50 | - |
|
51 | - $this->assertEquals( 21, count( $data[0] ) ); |
|
52 | - $this->assertEquals( 'payment', $data[0][0] ); |
|
53 | - $this->assertEquals( 'mr', $data[0][1] ); |
|
54 | - $this->assertEquals( '', $data[0][2] ); |
|
55 | - $this->assertEquals( '', $data[0][3] ); |
|
56 | - $this->assertEquals( '', $data[0][4] ); |
|
57 | - $this->assertEquals( 'Our', $data[0][5] ); |
|
58 | - $this->assertEquals( 'Unittest', $data[0][6] ); |
|
59 | - $this->assertEquals( 'Durchschnitt', $data[0][7] ); |
|
60 | - $this->assertEquals( '1', $data[0][8] ); |
|
61 | - $this->assertEquals( '', $data[0][9] ); |
|
62 | - $this->assertEquals( '20146', $data[0][10] ); |
|
63 | - $this->assertEquals( 'Hamburg', $data[0][11] ); |
|
64 | - $this->assertEquals( 'Hamburg', $data[0][12] ); |
|
65 | - $this->assertEquals( 'DE', $data[0][13] ); |
|
66 | - $this->assertEquals( 'de', $data[0][14] ); |
|
67 | - $this->assertEquals( '055544332211', $data[0][15] ); |
|
68 | - $this->assertEquals( '055544332213', $data[0][16] ); |
|
69 | - $this->assertEquals( '[email protected]', $data[0][17] ); |
|
70 | - $this->assertEquals( 'www.metaways.net', $data[0][18] ); |
|
71 | - $this->assertEquals( '11.000000', $data[0][19] ); |
|
72 | - $this->assertEquals( '52.000000', $data[0][20] ); |
|
73 | - |
|
74 | - $this->assertEquals( 21, count( $data[1] ) ); |
|
75 | - $this->assertEquals( 'delivery', $data[1][0] ); |
|
76 | - $this->assertEquals( 'mr', $data[1][1] ); |
|
77 | - $this->assertEquals( 'Example company', $data[1][2] ); |
|
78 | - $this->assertEquals( 'DE999999999', $data[1][3] ); |
|
79 | - $this->assertEquals( 'Dr.', $data[1][4] ); |
|
80 | - $this->assertEquals( 'Our', $data[1][5] ); |
|
81 | - $this->assertEquals( 'Unittest', $data[1][6] ); |
|
82 | - $this->assertEquals( 'Pickhuben', $data[1][7] ); |
|
83 | - $this->assertEquals( '2-4', $data[1][8] ); |
|
84 | - $this->assertEquals( '', $data[1][9] ); |
|
85 | - $this->assertEquals( '20457', $data[1][10] ); |
|
86 | - $this->assertEquals( 'Hamburg', $data[1][11] ); |
|
87 | - $this->assertEquals( 'Hamburg', $data[1][12] ); |
|
88 | - $this->assertEquals( 'DE', $data[1][13] ); |
|
89 | - $this->assertEquals( 'de', $data[1][14] ); |
|
90 | - $this->assertEquals( '055544332211', $data[1][15] ); |
|
91 | - $this->assertEquals( '055544332212', $data[1][16] ); |
|
92 | - $this->assertEquals( '[email protected]', $data[1][17] ); |
|
93 | - $this->assertEquals( 'www.example.com', $data[1][18] ); |
|
94 | - $this->assertEquals( '10.000000', $data[1][19] ); |
|
95 | - $this->assertEquals( '50.000000', $data[1][20] ); |
|
41 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Address\Standard($context, $mapping); |
|
42 | + |
|
43 | + $invoice = $this->getInvoice($context); |
|
44 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
45 | + |
|
46 | + $data = $object->process($invoice, $order); |
|
47 | + |
|
48 | + |
|
49 | + $this->assertEquals(2, count($data)); |
|
50 | + |
|
51 | + $this->assertEquals(21, count($data[0])); |
|
52 | + $this->assertEquals('payment', $data[0][0]); |
|
53 | + $this->assertEquals('mr', $data[0][1]); |
|
54 | + $this->assertEquals('', $data[0][2]); |
|
55 | + $this->assertEquals('', $data[0][3]); |
|
56 | + $this->assertEquals('', $data[0][4]); |
|
57 | + $this->assertEquals('Our', $data[0][5]); |
|
58 | + $this->assertEquals('Unittest', $data[0][6]); |
|
59 | + $this->assertEquals('Durchschnitt', $data[0][7]); |
|
60 | + $this->assertEquals('1', $data[0][8]); |
|
61 | + $this->assertEquals('', $data[0][9]); |
|
62 | + $this->assertEquals('20146', $data[0][10]); |
|
63 | + $this->assertEquals('Hamburg', $data[0][11]); |
|
64 | + $this->assertEquals('Hamburg', $data[0][12]); |
|
65 | + $this->assertEquals('DE', $data[0][13]); |
|
66 | + $this->assertEquals('de', $data[0][14]); |
|
67 | + $this->assertEquals('055544332211', $data[0][15]); |
|
68 | + $this->assertEquals('055544332213', $data[0][16]); |
|
69 | + $this->assertEquals('[email protected]', $data[0][17]); |
|
70 | + $this->assertEquals('www.metaways.net', $data[0][18]); |
|
71 | + $this->assertEquals('11.000000', $data[0][19]); |
|
72 | + $this->assertEquals('52.000000', $data[0][20]); |
|
73 | + |
|
74 | + $this->assertEquals(21, count($data[1])); |
|
75 | + $this->assertEquals('delivery', $data[1][0]); |
|
76 | + $this->assertEquals('mr', $data[1][1]); |
|
77 | + $this->assertEquals('Example company', $data[1][2]); |
|
78 | + $this->assertEquals('DE999999999', $data[1][3]); |
|
79 | + $this->assertEquals('Dr.', $data[1][4]); |
|
80 | + $this->assertEquals('Our', $data[1][5]); |
|
81 | + $this->assertEquals('Unittest', $data[1][6]); |
|
82 | + $this->assertEquals('Pickhuben', $data[1][7]); |
|
83 | + $this->assertEquals('2-4', $data[1][8]); |
|
84 | + $this->assertEquals('', $data[1][9]); |
|
85 | + $this->assertEquals('20457', $data[1][10]); |
|
86 | + $this->assertEquals('Hamburg', $data[1][11]); |
|
87 | + $this->assertEquals('Hamburg', $data[1][12]); |
|
88 | + $this->assertEquals('DE', $data[1][13]); |
|
89 | + $this->assertEquals('de', $data[1][14]); |
|
90 | + $this->assertEquals('055544332211', $data[1][15]); |
|
91 | + $this->assertEquals('055544332212', $data[1][16]); |
|
92 | + $this->assertEquals('[email protected]', $data[1][17]); |
|
93 | + $this->assertEquals('www.example.com', $data[1][18]); |
|
94 | + $this->assertEquals('10.000000', $data[1][19]); |
|
95 | + $this->assertEquals('50.000000', $data[1][20]); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | - protected function getInvoice( $context ) |
|
99 | + protected function getInvoice($context) |
|
100 | 100 | { |
101 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
101 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
102 | 102 | |
103 | 103 | $search = $manager->createSearch(); |
104 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
104 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
105 | 105 | |
106 | - $items = $manager->searchItems( $search ); |
|
106 | + $items = $manager->searchItems($search); |
|
107 | 107 | |
108 | - if( ( $item = reset( $items ) ) !== false ) { |
|
108 | + if (($item = reset($items)) !== false) { |
|
109 | 109 | return $item; |
110 | 110 | } |
111 | 111 | |
112 | - throw new \Exception( 'No order item found' ); |
|
112 | + throw new \Exception('No order item found'); |
|
113 | 113 | } |
114 | 114 | } |
@@ -40,17 +40,17 @@ |
||
40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
44 | 44 | { |
45 | 45 | $result = []; |
46 | 46 | |
47 | - foreach( $order->getCoupons() as $code => $products ) |
|
47 | + foreach ($order->getCoupons() as $code => $products) |
|
48 | 48 | { |
49 | 49 | $data = []; |
50 | 50 | |
51 | - foreach( $this->getMapping() as $pos => $key ) |
|
51 | + foreach ($this->getMapping() as $pos => $key) |
|
52 | 52 | { |
53 | - if( $key === 'order.base.coupon.code' ) { |
|
53 | + if ($key === 'order.base.coupon.code') { |
|
54 | 54 | $data[$pos] = $code; |
55 | 55 | } else { |
56 | 56 | $data[$pos] = ''; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
30 | 30 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
31 | 31 | */ |
32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping ) |
|
32 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping) |
|
33 | 33 | { |
34 | 34 | $this->context = $context; |
35 | 35 | $this->mapping = $mapping; |
@@ -40,28 +40,28 @@ |
||
40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
44 | 44 | { |
45 | 45 | $result = []; |
46 | 46 | $addresses = $order->getAddresses(); |
47 | 47 | |
48 | - krsort( $addresses ); |
|
48 | + krsort($addresses); |
|
49 | 49 | |
50 | - foreach( $addresses as $item ) |
|
50 | + foreach ($addresses as $item) |
|
51 | 51 | { |
52 | 52 | $data = []; |
53 | 53 | $list = $item->toArray(); |
54 | 54 | |
55 | - foreach( $this->getMapping() as $pos => $key ) |
|
55 | + foreach ($this->getMapping() as $pos => $key) |
|
56 | 56 | { |
57 | - if( array_key_exists( $key, $list ) ) { |
|
57 | + if (array_key_exists($key, $list)) { |
|
58 | 58 | $data[$pos] = $list[$key]; |
59 | 59 | } else { |
60 | 60 | $data[$pos] = ''; |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - ksort( $data ); |
|
64 | + ksort($data); |
|
65 | 65 | $result[] = $data; |
66 | 66 | } |
67 | 67 |
@@ -40,21 +40,21 @@ |
||
40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
44 | 44 | { |
45 | 45 | $result = []; |
46 | 46 | $list = $invoice->toArray() + $order->toArray(); |
47 | 47 | |
48 | - foreach( $this->getMapping() as $pos => $key ) |
|
48 | + foreach ($this->getMapping() as $pos => $key) |
|
49 | 49 | { |
50 | - if( array_key_exists( $key, $list ) ) { |
|
50 | + if (array_key_exists($key, $list)) { |
|
51 | 51 | $result[$pos] = $list[$key]; |
52 | 52 | } else { |
53 | 53 | $result[$pos] = ''; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - ksort( $result ); |
|
57 | + ksort($result); |
|
58 | 58 | |
59 | 59 | return [$result]; |
60 | 60 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
26 | 26 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
27 | 27 | */ |
28 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping ); |
|
28 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -35,5 +35,5 @@ discard block |
||
35 | 35 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
36 | 36 | * @return array Two dimensional associative list of order data representing the lines in CSV |
37 | 37 | */ |
38 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ); |
|
38 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order); |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * Initializes the object |
30 | 30 | * |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
32 | - * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
|
32 | + * @param string[] $mapping Associative list of field position in CSV as key and domain item key as value |
|
33 | 33 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
34 | 34 | */ |
35 | 35 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
33 | 33 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->mapping = $mapping; |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function getObject() |
73 | 73 | { |
74 | - if( $this->object === null ) { |
|
75 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
74 | + if ($this->object === null) { |
|
75 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | return $this->object; |