@@ -40,25 +40,25 @@ discard block |
||
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 | $services = $order->getServices(); |
47 | 47 | |
48 | - krsort( $services ); |
|
48 | + krsort($services); |
|
49 | 49 | |
50 | - foreach( $services as $list ) |
|
50 | + foreach ($services as $list) |
|
51 | 51 | { |
52 | - foreach( $list as $item ) |
|
52 | + foreach ($list as $item) |
|
53 | 53 | { |
54 | 54 | $data = []; |
55 | 55 | $list = $item->toArray(); |
56 | 56 | |
57 | - foreach( $item->getAttributeItems() as $attrItem ) |
|
57 | + foreach ($item->getAttributeItems() as $attrItem) |
|
58 | 58 | { |
59 | - foreach( $attrItem->toArray() as $key => $value ) |
|
59 | + foreach ($attrItem->toArray() as $key => $value) |
|
60 | 60 | { |
61 | - if( isset( $list[$key] ) ) { |
|
61 | + if (isset($list[$key])) { |
|
62 | 62 | $list[$key] .= "\n" . $value; |
63 | 63 | } else { |
64 | 64 | $list[$key] = $value; |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - foreach( $this->getMapping() as $pos => $key ) |
|
69 | + foreach ($this->getMapping() as $pos => $key) |
|
70 | 70 | { |
71 | - if( array_key_exists( $key, $list ) ) { |
|
71 | + if (array_key_exists($key, $list)) { |
|
72 | 72 | $data[$pos] = $list[$key]; |
73 | 73 | } else { |
74 | 74 | $data[$pos] = ''; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - ksort( $data ); |
|
78 | + ksort($data); |
|
79 | 79 | $result[] = $data; |
80 | 80 | } |
81 | 81 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Process order delivery services', $this->object->getName() ); |
|
35 | + $this->assertEquals('Process order delivery services', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | 41 | $text = 'Sends paid orders to the ERP system or logistic partner'; |
42 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
42 | + $this->assertEquals($text, $this->object->getDescription()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,47 +50,47 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
53 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
54 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
53 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
54 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
55 | 55 | |
56 | 56 | |
57 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
58 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
59 | - ->setConstructorArgs( array( $context ) ) |
|
57 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
58 | + ->setMethods(array('getProvider', 'searchItems')) |
|
59 | + ->setConstructorArgs(array($context)) |
|
60 | 60 | ->getMock(); |
61 | 61 | |
62 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
63 | - ->setMethods( array( 'saveItems', 'searchItems' ) ) |
|
64 | - ->setConstructorArgs( array( $context ) ) |
|
62 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
63 | + ->setMethods(array('saveItems', 'searchItems')) |
|
64 | + ->setConstructorArgs(array($context)) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
68 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
67 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
68 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | $serviceItem = $serviceManagerStub->createItem(); |
72 | 72 | $orderItem = $orderManagerStub->createItem(); |
73 | 73 | |
74 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
75 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
74 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
75 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
76 | 76 | ->getMock(); |
77 | 77 | |
78 | 78 | |
79 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
80 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
79 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
80 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
81 | 81 | |
82 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
83 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
82 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
83 | + ->will($this->returnValue($serviceProviderStub)); |
|
84 | 84 | |
85 | - $orderManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
86 | - ->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) ); |
|
85 | + $orderManagerStub->expects($this->once())->method('searchItems') |
|
86 | + ->will($this->onConsecutiveCalls(array($orderItem), [])); |
|
87 | 87 | |
88 | - $serviceProviderStub->expects( $this->once() )->method( 'processBatch' ); |
|
88 | + $serviceProviderStub->expects($this->once())->method('processBatch'); |
|
89 | 89 | |
90 | - $orderManagerStub->expects( $this->once() )->method( 'saveItems' ); |
|
90 | + $orderManagerStub->expects($this->once())->method('saveItems'); |
|
91 | 91 | |
92 | 92 | |
93 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
93 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
94 | 94 | $object->run(); |
95 | 95 | } |
96 | 96 | |
@@ -102,48 +102,48 @@ discard block |
||
102 | 102 | |
103 | 103 | |
104 | 104 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
105 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
106 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
105 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
106 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
107 | 107 | |
108 | 108 | |
109 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
110 | - ->setMethods( array( 'saveItems', 'searchItems' ) ) |
|
111 | - ->setConstructorArgs( array( $context ) ) |
|
109 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
110 | + ->setMethods(array('saveItems', 'searchItems')) |
|
111 | + ->setConstructorArgs(array($context)) |
|
112 | 112 | ->getMock(); |
113 | 113 | |
114 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
115 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
116 | - ->setConstructorArgs( array( $context ) ) |
|
114 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
115 | + ->setMethods(array('getProvider', 'searchItems')) |
|
116 | + ->setConstructorArgs(array($context)) |
|
117 | 117 | ->getMock(); |
118 | 118 | |
119 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
120 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
119 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
120 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | $serviceItem = $serviceManagerStub->createItem(); |
124 | 124 | $orderItem = $orderManagerStub->createItem(); |
125 | 125 | |
126 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
127 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
126 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
127 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
128 | 128 | ->getMock(); |
129 | 129 | |
130 | 130 | |
131 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
132 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
131 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
132 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
133 | 133 | |
134 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
135 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
134 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
135 | + ->will($this->returnValue($serviceProviderStub)); |
|
136 | 136 | |
137 | - $orderManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
138 | - ->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) ); |
|
137 | + $orderManagerStub->expects($this->once())->method('searchItems') |
|
138 | + ->will($this->onConsecutiveCalls(array($orderItem), [])); |
|
139 | 139 | |
140 | - $serviceProviderStub->expects( $this->once() )->method( 'processBatch' ) |
|
141 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test order service delivery: process' ) ) ); |
|
140 | + $serviceProviderStub->expects($this->once())->method('processBatch') |
|
141 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception('test order service delivery: process'))); |
|
142 | 142 | |
143 | - $orderManagerStub->expects( $this->never() )->method( 'saveItems' ); |
|
143 | + $orderManagerStub->expects($this->never())->method('saveItems'); |
|
144 | 144 | |
145 | 145 | |
146 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
146 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
147 | 147 | $object->run(); |
148 | 148 | } |
149 | 149 | |
@@ -155,36 +155,36 @@ discard block |
||
155 | 155 | |
156 | 156 | |
157 | 157 | $name = 'ControllerJobsServiceDeliveryProcessDefaultRun'; |
158 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
159 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
158 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
159 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
160 | 160 | |
161 | 161 | |
162 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
163 | - ->setMethods( array( 'saveItem', 'searchItems' ) ) |
|
164 | - ->setConstructorArgs( array( $context ) ) |
|
162 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
163 | + ->setMethods(array('saveItem', 'searchItems')) |
|
164 | + ->setConstructorArgs(array($context)) |
|
165 | 165 | ->getMock(); |
166 | 166 | |
167 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
168 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
169 | - ->setConstructorArgs( array( $context ) ) |
|
167 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
168 | + ->setMethods(array('getProvider', 'searchItems')) |
|
169 | + ->setConstructorArgs(array($context)) |
|
170 | 170 | ->getMock(); |
171 | 171 | |
172 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
173 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
172 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
173 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
174 | 174 | |
175 | 175 | |
176 | 176 | $serviceItem = $serviceManagerStub->createItem(); |
177 | 177 | |
178 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
179 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
178 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
179 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
180 | 180 | |
181 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
182 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test sorder service delivery: getProvider' ) ) ); |
|
181 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
182 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception('test sorder service delivery: getProvider'))); |
|
183 | 183 | |
184 | - $orderManagerStub->expects( $this->never() )->method( 'searchItems' ); |
|
184 | + $orderManagerStub->expects($this->never())->method('searchItems'); |
|
185 | 185 | |
186 | 186 | |
187 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos ); |
|
187 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos); |
|
188 | 188 | $object->run(); |
189 | 189 | } |
190 | 190 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $context = \TestHelperJobs::getContext(); |
21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testGetName() |
34 | 34 | { |
35 | - $this->assertEquals( 'Batch update of payment/delivery status', $this->object->getName() ); |
|
35 | + $this->assertEquals('Batch update of payment/delivery status', $this->object->getName()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetDescription() |
40 | 40 | { |
41 | 41 | $text = 'Executes payment or delivery service providers that uses batch updates'; |
42 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
42 | + $this->assertEquals($text, $this->object->getDescription()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $name = 'ControllerJobsServiceAsyncProcessDefaultRun'; |
53 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
53 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
54 | 54 | |
55 | 55 | |
56 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
57 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
58 | - ->setConstructorArgs( array( $context ) ) |
|
56 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
57 | + ->setMethods(array('getProvider', 'searchItems')) |
|
58 | + ->setConstructorArgs(array($context)) |
|
59 | 59 | ->getMock(); |
60 | 60 | |
61 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
61 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
62 | 62 | |
63 | 63 | |
64 | 64 | $serviceItem = $serviceManagerStub->createItem(); |
65 | 65 | |
66 | - $serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
67 | - ->setConstructorArgs( array( $context, $serviceItem ) ) |
|
66 | + $serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
67 | + ->setConstructorArgs(array($context, $serviceItem)) |
|
68 | 68 | ->getMock(); |
69 | 69 | |
70 | 70 | |
71 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
72 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
71 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
72 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
73 | 73 | |
74 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
75 | - ->will( $this->returnValue( $serviceProviderStub ) ); |
|
74 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
75 | + ->will($this->returnValue($serviceProviderStub)); |
|
76 | 76 | |
77 | - $serviceProviderStub->expects( $this->once() )->method( 'updateAsync' ); |
|
77 | + $serviceProviderStub->expects($this->once())->method('updateAsync'); |
|
78 | 78 | |
79 | 79 | |
80 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
80 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
81 | 81 | $object->run(); |
82 | 82 | } |
83 | 83 | |
@@ -89,27 +89,27 @@ discard block |
||
89 | 89 | |
90 | 90 | |
91 | 91 | $name = 'ControllerJobsServiceAsyncProcessDefaultRun'; |
92 | - $context->getConfig()->set( 'mshop/service/manager/name', $name ); |
|
92 | + $context->getConfig()->set('mshop/service/manager/name', $name); |
|
93 | 93 | |
94 | 94 | |
95 | - $serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
96 | - ->setMethods( array( 'getProvider', 'searchItems' ) ) |
|
97 | - ->setConstructorArgs( array( $context ) ) |
|
95 | + $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
96 | + ->setMethods(array('getProvider', 'searchItems')) |
|
97 | + ->setConstructorArgs(array($context)) |
|
98 | 98 | ->getMock(); |
99 | 99 | |
100 | - \Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub ); |
|
100 | + \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | $serviceItem = $serviceManagerStub->createItem(); |
104 | 104 | |
105 | - $serviceManagerStub->expects( $this->once() )->method( 'searchItems' ) |
|
106 | - ->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) ); |
|
105 | + $serviceManagerStub->expects($this->once())->method('searchItems') |
|
106 | + ->will($this->onConsecutiveCalls(array($serviceItem), [])); |
|
107 | 107 | |
108 | - $serviceManagerStub->expects( $this->once() )->method( 'getProvider' ) |
|
109 | - ->will( $this->throwException( new \Aimeos\MShop\Service\Exception() ) ); |
|
108 | + $serviceManagerStub->expects($this->once())->method('getProvider') |
|
109 | + ->will($this->throwException(new \Aimeos\MShop\Service\Exception())); |
|
110 | 110 | |
111 | 111 | |
112 | - $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard( $context, $aimeos ); |
|
112 | + $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos); |
|
113 | 113 | $object->run(); |
114 | 114 | } |
115 | 115 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | $enc = $this->encoder(); |
9 | 9 | |
10 | -$detailTarget = $this->config( 'client/html/catalog/detail/url/target' ); |
|
11 | -$detailCntl = $this->config( 'client/html/catalog/detail/url/controller', 'catalog' ); |
|
12 | -$detailAction = $this->config( 'client/html/catalog/detail/url/action', 'detail' ); |
|
13 | -$detailConfig = $this->config( 'client/html/catalog/detail/url/config', [] ); |
|
10 | +$detailTarget = $this->config('client/html/catalog/detail/url/target'); |
|
11 | +$detailCntl = $this->config('client/html/catalog/detail/url/controller', 'catalog'); |
|
12 | +$detailAction = $this->config('client/html/catalog/detail/url/action', 'detail'); |
|
13 | +$detailConfig = $this->config('client/html/catalog/detail/url/config', []); |
|
14 | 14 | |
15 | -$freq = $enc->xml( $this->get( 'siteFreq', 'daily' ) ); |
|
15 | +$freq = $enc->xml($this->get('siteFreq', 'daily')); |
|
16 | 16 | |
17 | 17 | ?> |
18 | -<?php foreach( $this->get( 'siteItems', [] ) as $id => $item ) : ?> |
|
18 | +<?php foreach ($this->get('siteItems', []) as $id => $item) : ?> |
|
19 | 19 | <?php |
20 | - $date = str_replace( ' ', 'T', $item->getTimeModified() ) . date( 'P' ); |
|
21 | - $params = array( 'd_name' => $item->getName( 'url' ), 'd_prodid' => $id ); |
|
22 | - $url = $this->url( $detailTarget, $detailCntl, $detailAction, $params, [], $detailConfig ); |
|
20 | + $date = str_replace(' ', 'T', $item->getTimeModified()) . date('P'); |
|
21 | + $params = array('d_name' => $item->getName('url'), 'd_prodid' => $id); |
|
22 | + $url = $this->url($detailTarget, $detailCntl, $detailAction, $params, [], $detailConfig); |
|
23 | 23 | ?> |
24 | - <url><loc><?php echo $enc->xml( $url ); ?></loc><lastmod><?php echo $date; ?></lastmod><changefreq><?php echo $freq; ?></changefreq></url> |
|
24 | + <url><loc><?php echo $enc->xml($url); ?></loc><lastmod><?php echo $date; ?></lastmod><changefreq><?php echo $freq; ?></changefreq></url> |
|
25 | 25 | <?php endforeach; ?> |
@@ -6,16 +6,16 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | $enc = $this->encoder(); |
9 | -$date = date( 'c' ); |
|
9 | +$date = date('c'); |
|
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> |
13 | 13 | |
14 | 14 | |
15 | 15 | <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
16 | -<?php foreach( $this->get( 'siteFiles', [] ) as $name ) : ?> |
|
16 | +<?php foreach ($this->get('siteFiles', []) as $name) : ?> |
|
17 | 17 | <sitemap> |
18 | - <loc><?php echo $enc->xml( basename( $name ) ); ?></loc> |
|
18 | + <loc><?php echo $enc->xml(basename($name)); ?></loc> |
|
19 | 19 | <lastmod><?php echo $date; ?></lastmod> |
20 | 20 | </sitemap> |
21 | 21 | <?php endforeach; ?> |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @param array $data Associative list of catalog codes and lists of CSV field indexes and their data |
28 | 28 | * @return array Associative list of CSV field indexes and their converted data |
29 | 29 | */ |
30 | - protected function convertData( array $convlist, array $data ) |
|
30 | + protected function convertData(array $convlist, array $data) |
|
31 | 31 | { |
32 | - foreach( $convlist as $idx => $converter ) |
|
32 | + foreach ($convlist as $idx => $converter) |
|
33 | 33 | { |
34 | - foreach( $data as $code => $list ) |
|
34 | + foreach ($data as $code => $list) |
|
35 | 35 | { |
36 | - if( isset( $list[$idx] ) ) { |
|
37 | - $data[$code][$idx] = $converter->translate( $list[$idx] ); |
|
36 | + if (isset($list[$idx])) { |
|
37 | + $data[$code][$idx] = $converter->translate($list[$idx]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -50,36 +50,36 @@ discard block |
||
50 | 50 | * @param string|null Name of the cache implementation |
51 | 51 | * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Cache\Iface Cache object |
52 | 52 | */ |
53 | - protected function getCache( $type, $name = null ) |
|
53 | + protected function getCache($type, $name = null) |
|
54 | 54 | { |
55 | 55 | $context = $this->getContext(); |
56 | 56 | $config = $context->getConfig(); |
57 | 57 | |
58 | - if( ctype_alnum( $type ) === false ) |
|
58 | + if (ctype_alnum($type) === false) |
|
59 | 59 | { |
60 | 60 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type : '<not a string>'; |
61 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
61 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
62 | 62 | } |
63 | 63 | |
64 | - if( $name === null ) { |
|
65 | - $name = $config->get( 'controller/common/catalog/import/csv/cache/' . $type . '/name', 'Standard' ); |
|
64 | + if ($name === null) { |
|
65 | + $name = $config->get('controller/common/catalog/import/csv/cache/' . $type . '/name', 'Standard'); |
|
66 | 66 | } |
67 | 67 | |
68 | - if( ctype_alnum( $name ) === false ) |
|
68 | + if (ctype_alnum($name) === false) |
|
69 | 69 | { |
70 | 70 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; |
71 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
71 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
72 | 72 | } |
73 | 73 | |
74 | - $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; |
|
74 | + $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name; |
|
75 | 75 | |
76 | - if( class_exists( $classname ) === false ) { |
|
77 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
76 | + if (class_exists($classname) === false) { |
|
77 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
78 | 78 | } |
79 | 79 | |
80 | - $object = new $classname( $context ); |
|
80 | + $object = new $classname($context); |
|
81 | 81 | |
82 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object ); |
|
82 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object); |
|
83 | 83 | |
84 | 84 | return $object; |
85 | 85 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | * @param array $convmap List of converter names for the values at the position in the CSV file |
92 | 92 | * @return array Associative list of positions and converter objects |
93 | 93 | */ |
94 | - protected function getConverterList( array $convmap ) |
|
94 | + protected function getConverterList(array $convmap) |
|
95 | 95 | { |
96 | 96 | $convlist = []; |
97 | 97 | |
98 | - foreach( $convmap as $idx => $name ) { |
|
99 | - $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); |
|
98 | + foreach ($convmap as $idx => $name) { |
|
99 | + $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $convlist; |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param integer $codePos Column position which contains the unique catalog code (starting from 0) |
112 | 112 | * @return array List of arrays with catalog codes as keys and list of values from the CSV file |
113 | 113 | */ |
114 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) |
|
114 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) |
|
115 | 115 | { |
116 | 116 | $count = 0; |
117 | 117 | $data = []; |
118 | 118 | |
119 | - while( $content->valid() && $count++ < $maxcnt ) |
|
119 | + while ($content->valid() && $count++ < $maxcnt) |
|
120 | 120 | { |
121 | 121 | $row = $content->current(); |
122 | - $data[ $row[$codePos] ] = $row; |
|
122 | + $data[$row[$codePos]] = $row; |
|
123 | 123 | $content->next(); |
124 | 124 | } |
125 | 125 | |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | * @param array $mapping List of domain item keys with the CSV field position as key |
176 | 176 | * @return array List of associative arrays containing the chunked properties |
177 | 177 | */ |
178 | - protected function getMappedChunk( array &$data, array $mapping ) |
|
178 | + protected function getMappedChunk(array &$data, array $mapping) |
|
179 | 179 | { |
180 | 180 | $idx = 0; |
181 | 181 | $map = []; |
182 | 182 | |
183 | - foreach( $mapping as $pos => $key ) |
|
183 | + foreach ($mapping as $pos => $key) |
|
184 | 184 | { |
185 | - if( isset( $map[$idx][$key] ) ) { |
|
185 | + if (isset($map[$idx][$key])) { |
|
186 | 186 | $idx++; |
187 | 187 | } |
188 | 188 | |
189 | - if( isset( $data[$pos] ) ) |
|
189 | + if (isset($data[$pos])) |
|
190 | 190 | { |
191 | 191 | $map[$idx][$key] = $data[$pos]; |
192 | - unset( $data[$pos] ); |
|
192 | + unset($data[$pos]); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values |
204 | 204 | * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface Processor object |
205 | 205 | */ |
206 | - protected function getProcessors( array $mappings ) |
|
206 | + protected function getProcessors(array $mappings) |
|
207 | 207 | { |
208 | 208 | $context = $this->getContext(); |
209 | 209 | $config = $context->getConfig(); |
210 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $context, [] ); |
|
210 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($context, []); |
|
211 | 211 | |
212 | - foreach( $mappings as $type => $mapping ) |
|
212 | + foreach ($mappings as $type => $mapping) |
|
213 | 213 | { |
214 | - if( ctype_alnum( $type ) === false ) |
|
214 | + if (ctype_alnum($type) === false) |
|
215 | 215 | { |
216 | 216 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type : '<not a string>'; |
217 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
217 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
218 | 218 | } |
219 | 219 | |
220 | - $name = $config->get( 'controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard' ); |
|
220 | + $name = $config->get('controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard'); |
|
221 | 221 | |
222 | - if( ctype_alnum( $name ) === false ) |
|
222 | + if (ctype_alnum($name) === false) |
|
223 | 223 | { |
224 | 224 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
225 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
225 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
226 | 226 | } |
227 | 227 | |
228 | - $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
228 | + $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
229 | 229 | |
230 | - if( class_exists( $classname ) === false ) { |
|
231 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
230 | + if (class_exists($classname) === false) { |
|
231 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
232 | 232 | } |
233 | 233 | |
234 | - $object = new $classname( $context, $mapping, $object ); |
|
234 | + $object = new $classname($context, $mapping, $object); |
|
235 | 235 | |
236 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object ); |
|
236 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return $object; |
@@ -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\Product\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\Product\Import\Csv\Processor\Iface $object = null ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->mapping = $mapping; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @param integer $pos Computed position of the list item in the associated list of items |
49 | 49 | * @return array Given associative list enriched by default values if they were not already set |
50 | 50 | */ |
51 | - protected function addListItemDefaults( array $list, $pos ) |
|
51 | + protected function addListItemDefaults(array $list, $pos) |
|
52 | 52 | { |
53 | - if( !isset( $list['product.lists.position'] ) ) { |
|
53 | + if (!isset($list['product.lists.position'])) { |
|
54 | 54 | $list['product.lists.position'] = $pos; |
55 | 55 | } |
56 | 56 | |
57 | - if( !isset( $list['product.lists.status'] ) ) { |
|
57 | + if (!isset($list['product.lists.status'])) { |
|
58 | 58 | $list['product.lists.status'] = 1; |
59 | 59 | } |
60 | 60 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getObject() |
94 | 94 | { |
95 | - if( $this->object === null ) { |
|
96 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
95 | + if ($this->object === null) { |
|
96 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->object; |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | |
10 | 10 | ?> |
11 | 11 | <productlist> |
12 | - <?php foreach( $this->get( 'exportItems', [] ) as $id => $item ) : ?> |
|
12 | + <?php foreach ($this->get('exportItems', []) as $id => $item) : ?> |
|
13 | 13 | |
14 | - <product-content id="<?php echo $enc->attr( $id ); ?>" > |
|
15 | - <productitem id="<?php echo $enc->attr( $id ); ?>" siteid="<?php echo $enc->attr( $item->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $item->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $item->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $item->getEditor() ); ?>"> |
|
14 | + <product-content id="<?php echo $enc->attr($id); ?>" > |
|
15 | + <productitem id="<?php echo $enc->attr($id); ?>" siteid="<?php echo $enc->attr($item->getSiteId()); ?>" ctime="<?php echo $enc->attr($item->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($item->getTimeModified()); ?>" editor="<?php echo $enc->attr($item->getEditor()); ?>"> |
|
16 | 16 | <type><![CDATA[<?php echo $item->getType(); ?>]]></type> |
17 | 17 | <code><![CDATA[<?php echo $item->getCode(); ?>]]></code> |
18 | 18 | <label><![CDATA[<?php echo $item->getCode(); ?>]]></label> |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | </productitem> |
23 | 23 | <list> |
24 | 24 | <text> |
25 | - <?php foreach( $item->getListItems( 'text' ) as $listItem ) : ?> |
|
25 | + <?php foreach ($item->getListItems('text') as $listItem) : ?> |
|
26 | 26 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
27 | 27 | |
28 | - <textitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.domain="<?php echo $enc->attr( $listItem->getDomain() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
28 | + <textitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.domain="<?php echo $enc->attr($listItem->getDomain()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
29 | 29 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
30 | 30 | <languageid><![CDATA[<?php echo $refItem->getLanguageId(); ?>]]></languageid> |
31 | 31 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | </text> |
39 | 39 | <media> |
40 | - <?php foreach( $item->getListItems( 'media' ) as $listItem ) : ?> |
|
40 | + <?php foreach ($item->getListItems('media') as $listItem) : ?> |
|
41 | 41 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
42 | 42 | |
43 | - <mediaitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
43 | + <mediaitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
44 | 44 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
45 | 45 | <languageid><![CDATA[<?php echo $refItem->getLanguageId(); ?>]]></languageid> |
46 | 46 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | </media> |
56 | 56 | <price> |
57 | - <?php foreach( $item->getListItems( 'price' ) as $listItem ) : ?> |
|
57 | + <?php foreach ($item->getListItems('price') as $listItem) : ?> |
|
58 | 58 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
59 | 59 | |
60 | - <priceitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
60 | + <priceitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
61 | 61 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
62 | 62 | <currencyid><![CDATA[<?php echo $refItem->getCurrencyId(); ?>]]></currencyid> |
63 | 63 | <quantity><![CDATA[<?php echo $refItem->getQuantity(); ?>]]></quantity> |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | |
74 | 74 | </price> |
75 | 75 | <attribute> |
76 | - <?php foreach( $item->getListItems( 'attribute' ) as $listItem ) : ?> |
|
76 | + <?php foreach ($item->getListItems('attribute') as $listItem) : ?> |
|
77 | 77 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
78 | 78 | |
79 | - <attributeitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
79 | + <attributeitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
80 | 80 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
81 | 81 | <code><![CDATA[<?php echo $refItem->getCode(); ?>]]></code> |
82 | 82 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | </attribute> |
90 | 90 | <product> |
91 | - <?php foreach( $item->getListItems( 'product' ) as $listItem ) : ?> |
|
91 | + <?php foreach ($item->getListItems('product') as $listItem) : ?> |
|
92 | 92 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
93 | 93 | |
94 | - <productitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
94 | + <productitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
95 | 95 | <type><![CDATA[<?php echo $item->getType(); ?>]]></type> |
96 | 96 | <code><![CDATA[<?php echo $item->getCode(); ?>]]></code> |
97 | 97 | <label><![CDATA[<?php echo $item->getCode(); ?>]]></label> |
@@ -87,8 +87,7 @@ |
||
87 | 87 | foreach( $manager->searchItems( $search ) as $item ) { |
88 | 88 | $this->listTypes[$item->getCode()] = $item->getCode(); |
89 | 89 | } |
90 | - } |
|
91 | - else |
|
90 | + } else |
|
92 | 91 | { |
93 | 92 | $this->listTypes = array_flip( $this->listTypes ); |
94 | 93 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
44 | 44 | * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object Decorated processor |
45 | 45 | */ |
46 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | - \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null ) |
|
46 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null) |
|
48 | 48 | { |
49 | - parent::__construct( $context, $mapping, $object ); |
|
49 | + parent::__construct($context, $mapping, $object); |
|
50 | 50 | |
51 | 51 | /** controller/common/product/import/csv/processor/product/listtypes |
52 | 52 | * Names of the product list types that are updated or removed |
@@ -74,26 +74,26 @@ discard block |
||
74 | 74 | * @see controller/common/product/import/csv/processor/text/listtypes |
75 | 75 | */ |
76 | 76 | $key = 'controller/common/product/import/csv/processor/product/listtypes'; |
77 | - $this->listTypes = $context->getConfig()->get( $key, ['default', 'suggestion'] ); |
|
77 | + $this->listTypes = $context->getConfig()->get($key, ['default', 'suggestion']); |
|
78 | 78 | |
79 | - if( $this->listTypes === null ) |
|
79 | + if ($this->listTypes === null) |
|
80 | 80 | { |
81 | 81 | $this->listTypes = []; |
82 | - $manager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
82 | + $manager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
83 | 83 | |
84 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
85 | - $search->setConditions( $search->compare( '==', 'product.lists.type.domain', 'product' ) ); |
|
84 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
85 | + $search->setConditions($search->compare('==', 'product.lists.type.domain', 'product')); |
|
86 | 86 | |
87 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
87 | + foreach ($manager->searchItems($search) as $item) { |
|
88 | 88 | $this->listTypes[$item->getCode()] = $item->getCode(); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
93 | - $this->listTypes = array_flip( $this->listTypes ); |
|
93 | + $this->listTypes = array_flip($this->listTypes); |
|
94 | 94 | } |
95 | 95 | |
96 | - $this->cache = $this->getCache( 'product' ); |
|
96 | + $this->cache = $this->getCache('product'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -104,47 +104,47 @@ discard block |
||
104 | 104 | * @param array $data List of CSV fields with position as key and data as value |
105 | 105 | * @return array List of data which has not been imported |
106 | 106 | */ |
107 | - public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) |
|
107 | + public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data) |
|
108 | 108 | { |
109 | 109 | $context = $this->getContext(); |
110 | - $manager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
111 | - $separator = $context->getConfig()->get( 'controller/common/product/import/csv/separator', "\n" ); |
|
110 | + $manager = \Aimeos\MShop::create($context, 'product/lists'); |
|
111 | + $separator = $context->getConfig()->get('controller/common/product/import/csv/separator', "\n"); |
|
112 | 112 | |
113 | - $listItems = $product->getListItems( 'product', null, null, false ); |
|
114 | - $this->cache->set( $product ); |
|
113 | + $listItems = $product->getListItems('product', null, null, false); |
|
114 | + $this->cache->set($product); |
|
115 | 115 | |
116 | - foreach( $this->getMappedChunk( $data, $this->getMapping() ) as $list ) |
|
116 | + foreach ($this->getMappedChunk($data, $this->getMapping()) as $list) |
|
117 | 117 | { |
118 | - if( $this->checkEntry( $list ) === false ) { |
|
118 | + if ($this->checkEntry($list) === false) { |
|
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | |
122 | - $listtype = $this->getValue( $list, 'product.lists.type', 'default' ); |
|
122 | + $listtype = $this->getValue($list, 'product.lists.type', 'default'); |
|
123 | 123 | |
124 | - foreach( explode( $separator, $this->getValue( $list, 'product.code', '' ) ) as $code ) |
|
124 | + foreach (explode($separator, $this->getValue($list, 'product.code', '')) as $code) |
|
125 | 125 | { |
126 | - $code = trim( $code ); |
|
126 | + $code = trim($code); |
|
127 | 127 | |
128 | - if( ( $prodid = $this->cache->get( $code ) ) === null ) |
|
128 | + if (($prodid = $this->cache->get($code)) === null) |
|
129 | 129 | { |
130 | 130 | $msg = 'No product for code "%1$s" available when importing product with code "%2$s"'; |
131 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( $msg, $code, $product->getCode() ) ); |
|
131 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf($msg, $code, $product->getCode())); |
|
132 | 132 | } |
133 | 133 | |
134 | - if( ( $listItem = $product->getListItem( 'product', $listtype, $prodid ) ) === null ) { |
|
135 | - $listItem = $manager->createItem()->setType( $listtype ); |
|
134 | + if (($listItem = $product->getListItem('product', $listtype, $prodid)) === null) { |
|
135 | + $listItem = $manager->createItem()->setType($listtype); |
|
136 | 136 | } else { |
137 | - unset( $listItems[$listItem->getId()] ); |
|
137 | + unset($listItems[$listItem->getId()]); |
|
138 | 138 | } |
139 | 139 | |
140 | - $listItem = $listItem->fromArray( $list )->setRefId( $prodid ); |
|
141 | - $product->addListItem( 'product', $listItem ); |
|
140 | + $listItem = $listItem->fromArray($list)->setRefId($prodid); |
|
141 | + $product->addListItem('product', $listItem); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - $product->deleteListItems( $listItems ); |
|
145 | + $product->deleteListItems($listItems); |
|
146 | 146 | |
147 | - return $this->getObject()->process( $product, $data ); |
|
147 | + return $this->getObject()->process($product, $data); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | * @param array $list Associative list of key/value pairs from the mapping |
155 | 155 | * @return boolean True if valid, false if not |
156 | 156 | */ |
157 | - protected function checkEntry( array $list ) |
|
157 | + protected function checkEntry(array $list) |
|
158 | 158 | { |
159 | - if( $this->getValue( $list, 'product.code' ) === null ) { |
|
159 | + if ($this->getValue($list, 'product.code') === null) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - if( ( $type = $this->getValue( $list, 'product.lists.type' ) ) && !isset( $this->listTypes[$type] ) ) |
|
163 | + if (($type = $this->getValue($list, 'product.lists.type')) && !isset($this->listTypes[$type])) |
|
164 | 164 | { |
165 | - $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'product list' ); |
|
166 | - throw new \Aimeos\Controller\Common\Exception( $msg ); |
|
165 | + $msg = sprintf('Invalid type "%1$s" (%2$s)', $type, 'product list'); |
|
166 | + throw new \Aimeos\Controller\Common\Exception($msg); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return true; |