Completed
Push — master ( 74c7e2...b60a6e )
by Aimeos
02:37
created
jobs/tests/Controller/Jobs/Subscription/Process/Renew/StandardTest.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -21,62 +21,62 @@  discard block
 block discarded – undo
21 21
 		$this->aimeos = \TestHelperJobs::getAimeos();
22 22
 		$this->context = \TestHelperJobs::getContext();
23 23
 
24
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard( $this->context, $this->aimeos );
24
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard($this->context, $this->aimeos);
25 25
 
26
-		\Aimeos\MShop\Factory::setCache( true );
26
+		\Aimeos\MShop\Factory::setCache(true);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 
35
-		unset( $this->object, $this->context, $this->aimeos );
35
+		unset($this->object, $this->context, $this->aimeos);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetName()
40 40
 	{
41
-		$this->assertEquals( 'Subscription process renew', $this->object->getName() );
41
+		$this->assertEquals('Subscription process renew', $this->object->getName());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetDescription()
46 46
 	{
47
-		$this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() );
47
+		$this->assertEquals('Renews subscriptions at next date', $this->object->getDescription());
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testRun()
52 52
 	{
53
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
53
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
54 54
 		$item = $this->getSubscription();
55 55
 
56
-		$object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' )
57
-			->setConstructorArgs( [$this->context, $this->aimeos] )
58
-			->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] )
56
+		$object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard')
57
+			->setConstructorArgs([$this->context, $this->aimeos])
58
+			->setMethods(['createOrderBase', 'createOrderInvoice', 'createPayment'])
59 59
 			->getMock();
60 60
 
61
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
62
-			->setConstructorArgs( [$this->context] )
63
-			->setMethods( ['searchItems', 'saveItem'] )
61
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
62
+			->setConstructorArgs([$this->context])
63
+			->setMethods(['searchItems', 'saveItem'])
64 64
 			->getMock();
65 65
 
66
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
66
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
67 67
 
68
-		$object->expects( $this->once() )->method( 'createOrderBase' )
69
-			->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) );
68
+		$object->expects($this->once())->method('createOrderBase')
69
+			->will($this->returnValue($this->getOrderBaseItem($item->getOrderBaseId())));
70 70
 
71
-		$object->expects( $this->once() )->method( 'createOrderInvoice' )
72
-			->will( $this->returnValue( $this->getOrderItem() ) );
71
+		$object->expects($this->once())->method('createOrderInvoice')
72
+			->will($this->returnValue($this->getOrderItem()));
73 73
 
74
-		$object->expects( $this->once() )->method( 'createPayment' );
74
+		$object->expects($this->once())->method('createPayment');
75 75
 
76
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
77
-			->will( $this->returnValue( [$item] ) );
76
+		$managerStub->expects($this->once())->method('searchItems')
77
+			->will($this->returnValue([$item]));
78 78
 
79
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
79
+		$managerStub->expects($this->once())->method('saveItem');
80 80
 
81 81
 		$object->run();
82 82
 	}
@@ -84,19 +84,19 @@  discard block
 block discarded – undo
84 84
 
85 85
 	public function testRunException()
86 86
 	{
87
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
87
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
88 88
 
89
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
90
-			->setConstructorArgs( [$this->context] )
91
-			->setMethods( ['searchItems', 'saveItem'] )
89
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
90
+			->setConstructorArgs([$this->context])
91
+			->setMethods(['searchItems', 'saveItem'])
92 92
 			->getMock();
93 93
 
94
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
94
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
95 95
 
96
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
97
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
96
+		$managerStub->expects($this->once())->method('searchItems')
97
+			->will($this->returnValue([$managerStub->createItem()]));
98 98
 
99
-		$managerStub->expects( $this->never() )->method( 'saveItem' );
99
+		$managerStub->expects($this->never())->method('saveItem');
100 100
 
101 101
 		$this->object->run();
102 102
 	}
@@ -106,34 +106,34 @@  discard block
 block discarded – undo
106 106
 	{
107 107
 		$item = $this->getSubscription();
108 108
 
109
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' )
110
-			->setConstructorArgs( [$this->context] )
111
-			->setMethods( ['store'] )
109
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')
110
+			->setConstructorArgs([$this->context])
111
+			->setMethods(['store'])
112 112
 			->getMock();
113 113
 
114
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $managerStub );
114
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $managerStub);
115 115
 
116
-		$managerStub->expects( $this->once() )->method( 'store' );
116
+		$managerStub->expects($this->once())->method('store');
117 117
 
118
-		$this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] );
118
+		$this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]);
119 119
 	}
120 120
 
121 121
 
122 122
 	public function testCreateOrderInvoice()
123 123
 	{
124 124
 		$item = $this->getSubscription();
125
-		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() );
125
+		$baseItem = $this->getOrderBaseItem($item->getOrderBaseId());
126 126
 
127
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
128
-			->setConstructorArgs( [$this->context] )
129
-			->setMethods( ['saveItem'] )
127
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
128
+			->setConstructorArgs([$this->context])
129
+			->setMethods(['saveItem'])
130 130
 			->getMock();
131 131
 
132
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub );
132
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub);
133 133
 
134
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
134
+		$managerStub->expects($this->once())->method('saveItem');
135 135
 
136
-		$this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] );
136
+		$this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]);
137 137
 	}
138 138
 
139 139
 
@@ -141,55 +141,55 @@  discard block
 block discarded – undo
141 141
 	{
142 142
 		$item = $this->getSubscription();
143 143
 		$invoice = $this->getOrderItem();
144
-		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() );
144
+		$baseItem = $this->getOrderBaseItem($item->getOrderBaseId());
145 145
 
146
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
147
-			->setConstructorArgs( [$this->context] )
148
-			->setMethods( ['saveItem'] )
146
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
147
+			->setConstructorArgs([$this->context])
148
+			->setMethods(['saveItem'])
149 149
 			->getMock();
150 150
 
151
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub );
151
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub);
152 152
 
153
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
153
+		$managerStub->expects($this->once())->method('saveItem');
154 154
 
155
-		$this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] );
155
+		$this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]);
156 156
 	}
157 157
 
158 158
 
159 159
 	protected function getOrderItem()
160 160
 	{
161
-		return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
161
+		return \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
162 162
 	}
163 163
 
164 164
 
165
-	protected function getOrderBaseItem( $baseId )
165
+	protected function getOrderBaseItem($baseId)
166 166
 	{
167
-		return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] );
167
+		return \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->getItem($baseId, ['order/base/service']);
168 168
 	}
169 169
 
170 170
 
171 171
 	protected function getSubscription()
172 172
 	{
173
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
173
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
174 174
 
175 175
 		$search = $manager->createSearch();
176
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
176
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
177 177
 
178
-		$items = $manager->searchItems( $search );
178
+		$items = $manager->searchItems($search);
179 179
 
180
-		if( ( $item = reset( $items ) ) !== false ) {
180
+		if (($item = reset($items)) !== false) {
181 181
 			return $item;
182 182
 		}
183 183
 
184
-		throw new \Exception( 'No subscription item found' );
184
+		throw new \Exception('No subscription item found');
185 185
 	}
186 186
 
187 187
 
188
-	protected function access( $name )
188
+	protected function access($name)
189 189
 	{
190
-		$class = new \ReflectionClass( '\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard' );
191
-		$method = $class->getMethod( $name );
192
-		$method->setAccessible( true );
190
+		$class = new \ReflectionClass('\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard');
191
+		$method = $class->getMethod($name);
192
+		$method->setAccessible(true);
193 193
 
194 194
 		return $method;
195 195
 	}
Please login to merge, or discard this patch.
tests/Controller/Common/Order/Export/Csv/Processor/Product/StandardTest.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -35,51 +35,51 @@
 block discarded – undo
35 35
 		);
36 36
 
37 37
 
38
-		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Product\Standard( $context, $mapping );
39
-
40
-		$invoice = $this->getInvoice( $context );
41
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() );
42
-
43
-		$data = $object->process( $invoice, $order );
44
-
45
-
46
-		$this->assertEquals( 4, count( $data ) );
47
-
48
-		$this->assertEquals( 18, count( $data[0] ) );
49
-		$this->assertEquals( 'default', $data[0][0] );
50
-		$this->assertEquals( 'unit_type1', $data[0][1] );
51
-		$this->assertEquals( 'unitsupplier', $data[0][2] );
52
-		$this->assertEquals( 'CNE', $data[0][3] );
53
-		$this->assertGreaterThan( 0, $data[0][4] );
54
-		$this->assertEquals( '9', $data[0][5] );
55
-		$this->assertEquals( 'Cafe Noire Expresso', $data[0][6] );
56
-		$this->assertEquals( 'somewhere/thump1.jpg', $data[0][7] );
57
-		$this->assertEquals( '4.50', $data[0][8] );
58
-		$this->assertEquals( '0.00', $data[0][9] );
59
-		$this->assertEquals( '0.00', $data[0][10] );
60
-		$this->assertEquals( '0.0000', $data[0][11] );
61
-		$this->assertEquals( '1', $data[0][12] );
62
-		$this->assertEquals( '1', $data[0][13] );
63
-		$this->assertEquals( "default\ndefault\nconfig", $data[0][14] );
64
-		$this->assertEquals( "width\nlength\ninterval", $data[0][15] );
65
-		$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][16] );
66
-		$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][17] );
38
+		$object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Product\Standard($context, $mapping);
39
+
40
+		$invoice = $this->getInvoice($context);
41
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId());
42
+
43
+		$data = $object->process($invoice, $order);
44
+
45
+
46
+		$this->assertEquals(4, count($data));
47
+
48
+		$this->assertEquals(18, count($data[0]));
49
+		$this->assertEquals('default', $data[0][0]);
50
+		$this->assertEquals('unit_type1', $data[0][1]);
51
+		$this->assertEquals('unitsupplier', $data[0][2]);
52
+		$this->assertEquals('CNE', $data[0][3]);
53
+		$this->assertGreaterThan(0, $data[0][4]);
54
+		$this->assertEquals('9', $data[0][5]);
55
+		$this->assertEquals('Cafe Noire Expresso', $data[0][6]);
56
+		$this->assertEquals('somewhere/thump1.jpg', $data[0][7]);
57
+		$this->assertEquals('4.50', $data[0][8]);
58
+		$this->assertEquals('0.00', $data[0][9]);
59
+		$this->assertEquals('0.00', $data[0][10]);
60
+		$this->assertEquals('0.0000', $data[0][11]);
61
+		$this->assertEquals('1', $data[0][12]);
62
+		$this->assertEquals('1', $data[0][13]);
63
+		$this->assertEquals("default\ndefault\nconfig", $data[0][14]);
64
+		$this->assertEquals("width\nlength\ninterval", $data[0][15]);
65
+		$this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][16]);
66
+		$this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][17]);
67 67
 	}
68 68
 
69 69
 
70
-	protected function getInvoice( $context )
70
+	protected function getInvoice($context)
71 71
 	{
72
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
72
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
73 73
 
74 74
 		$search = $manager->createSearch();
75
-		$search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) );
75
+		$search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56'));
76 76
 
77
-		$items = $manager->searchItems( $search );
77
+		$items = $manager->searchItems($search);
78 78
 
79
-		if( ( $item = reset( $items ) ) !== false ) {
79
+		if (($item = reset($items)) !== false) {
80 80
 			return $item;
81 81
 		}
82 82
 
83
-		throw new \Exception( 'No order item found' );
83
+		throw new \Exception('No order item found');
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.
Common/Subscription/Export/Csv/Processor/Product/StandardTest.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -35,51 +35,51 @@
 block discarded – undo
35 35
 		);
36 36
 
37 37
 
38
-		$object = new \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product\Standard( $context, $mapping );
39
-
40
-		$subscription = $this->getSubscription( $context );
41
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $subscription->getOrderBaseId() );
42
-
43
-		$data = $object->process( $subscription, $order );
44
-
45
-
46
-		$this->assertEquals( 1, count( $data ) );
47
-
48
-		$this->assertEquals( 18, count( $data[0] ) );
49
-		$this->assertEquals( 'default', $data[0][0] );
50
-		$this->assertEquals( 'unit_type1', $data[0][1] );
51
-		$this->assertEquals( 'unitsupplier', $data[0][2] );
52
-		$this->assertEquals( 'CNE', $data[0][3] );
53
-		$this->assertGreaterThan( 0, $data[0][4] );
54
-		$this->assertEquals( '9', $data[0][5] );
55
-		$this->assertEquals( 'Cafe Noire Expresso', $data[0][6] );
56
-		$this->assertEquals( 'somewhere/thump1.jpg', $data[0][7] );
57
-		$this->assertEquals( '4.50', $data[0][8] );
58
-		$this->assertEquals( '0.00', $data[0][9] );
59
-		$this->assertEquals( '0.00', $data[0][10] );
60
-		$this->assertEquals( '0.0000', $data[0][11] );
61
-		$this->assertEquals( '1', $data[0][12] );
62
-		$this->assertEquals( '1', $data[0][13] );
63
-		$this->assertEquals( "default\ndefault\nconfig", $data[0][14] );
64
-		$this->assertEquals( "width\nlength\ninterval", $data[0][15] );
65
-		$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][16] );
66
-		$this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][17] );
38
+		$object = new \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product\Standard($context, $mapping);
39
+
40
+		$subscription = $this->getSubscription($context);
41
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($subscription->getOrderBaseId());
42
+
43
+		$data = $object->process($subscription, $order);
44
+
45
+
46
+		$this->assertEquals(1, count($data));
47
+
48
+		$this->assertEquals(18, count($data[0]));
49
+		$this->assertEquals('default', $data[0][0]);
50
+		$this->assertEquals('unit_type1', $data[0][1]);
51
+		$this->assertEquals('unitsupplier', $data[0][2]);
52
+		$this->assertEquals('CNE', $data[0][3]);
53
+		$this->assertGreaterThan(0, $data[0][4]);
54
+		$this->assertEquals('9', $data[0][5]);
55
+		$this->assertEquals('Cafe Noire Expresso', $data[0][6]);
56
+		$this->assertEquals('somewhere/thump1.jpg', $data[0][7]);
57
+		$this->assertEquals('4.50', $data[0][8]);
58
+		$this->assertEquals('0.00', $data[0][9]);
59
+		$this->assertEquals('0.00', $data[0][10]);
60
+		$this->assertEquals('0.0000', $data[0][11]);
61
+		$this->assertEquals('1', $data[0][12]);
62
+		$this->assertEquals('1', $data[0][13]);
63
+		$this->assertEquals("default\ndefault\nconfig", $data[0][14]);
64
+		$this->assertEquals("width\nlength\ninterval", $data[0][15]);
65
+		$this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][16]);
66
+		$this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][17]);
67 67
 	}
68 68
 
69 69
 
70
-	protected function getSubscription( $context )
70
+	protected function getSubscription($context)
71 71
 	{
72
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
72
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
73 73
 
74 74
 		$search = $manager->createSearch();
75
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
75
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
76 76
 
77
-		$items = $manager->searchItems( $search );
77
+		$items = $manager->searchItems($search);
78 78
 
79
-		if( ( $item = reset( $items ) ) !== false ) {
79
+		if (($item = reset($items)) !== false) {
80 80
 			return $item;
81 81
 		}
82 82
 
83
-		throw new \Exception( 'No subscription item found' );
83
+		throw new \Exception('No subscription item found');
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Media/Scale/Standard.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescale product images' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescale product images');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescales product images to the new sizes' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescales product images to the new sizes');
43 43
 	}
44 44
 
45 45
 
@@ -51,41 +51,41 @@  discard block
 block discarded – undo
51 51
 	public function run()
52 52
 	{
53 53
 		$context = $this->getContext();
54
-		$cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context );
55
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'media' );
54
+		$cntl = \Aimeos\Controller\Common\Media\Factory::createController($context);
55
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'media');
56 56
 
57 57
 		$search = $manager->createSearch();
58 58
 		$expr = array(
59
-			$search->compare( '==', 'media.domain', 'product' ),
60
-			$search->compare( '=~', 'media.mimetype', 'image/' ),
59
+			$search->compare('==', 'media.domain', 'product'),
60
+			$search->compare('=~', 'media.mimetype', 'image/'),
61 61
 		);
62
-		$search->setConditions( $search->combine( '&&', $expr ) );
63
-		$search->setSortations( array( $search->sort( '+', 'media.id' ) ) );
62
+		$search->setConditions($search->combine('&&', $expr));
63
+		$search->setSortations(array($search->sort('+', 'media.id')));
64 64
 
65 65
 		$start = 0;
66 66
 
67 67
 		do
68 68
 		{
69
-			$search->setSlice( $start );
70
-			$items = $manager->searchItems( $search );
69
+			$search->setSlice($start);
70
+			$items = $manager->searchItems($search);
71 71
 
72
-			foreach( $items as $item )
72
+			foreach ($items as $item)
73 73
 			{
74 74
 				try
75 75
 				{
76
-					$cntl->scale( $item, 'fs-media' );
77
-					$manager->saveItem( $item );
76
+					$cntl->scale($item, 'fs-media');
77
+					$manager->saveItem($item);
78 78
 				}
79
-				catch( \Exception $e )
79
+				catch (\Exception $e)
80 80
 				{
81
-					$msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() );
82
-					$context->getLogger()->log( $msg );
81
+					$msg = sprintf('Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage());
82
+					$context->getLogger()->log($msg);
83 83
 				}
84 84
 			}
85 85
 
86
-			$count = count( $items );
86
+			$count = count($items);
87 87
 			$start += $count;
88 88
 		}
89
-		while( $count === $search->getSliceSize() );
89
+		while ($count === $search->getSliceSize());
90 90
 	}
91 91
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@
 block discarded – undo
75 75
 				{
76 76
 					$cntl->scale( $item, 'fs-media' );
77 77
 					$manager->saveItem( $item );
78
-				}
79
-				catch( \Exception $e )
78
+				} catch( \Exception $e )
80 79
 				{
81 80
 					$msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() );
82 81
 					$context->getLogger()->log( $msg );
Please login to merge, or discard this patch.
common/src/Controller/Common/Catalog/Import/Csv/Processor/Text/Standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
 					$listItem = $listMap[$content][$type][$typecode];
112 112
 					$refItem = $listItem->getRefItem();
113 113
 					unset( $listItems[ $listItem->getId() ] );
114
-				}
115
-				else
114
+				} else
116 115
 				{
117 116
 					$listItem = $listManager->createItem();
118 117
 					$refItem = $manager->createItem();
@@ -143,8 +142,7 @@  discard block
 block discarded – undo
143 142
 			$data = $this->getObject()->process( $catalog, $data );
144 143
 
145 144
 			$manager->commit();
146
-		}
147
-		catch( \Exception $e )
145
+		} catch( \Exception $e )
148 146
 		{
149 147
 			$manager->rollback();
150 148
 			throw $e;
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
43 43
 	 * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor
44 44
 	 */
45
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
-			\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null )
45
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
+			\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null)
47 47
 	{
48
-		parent::__construct( $context, $mapping, $object );
48
+		parent::__construct($context, $mapping, $object);
49 49
 
50 50
 		/** controller/common/catalog/import/csv/processor/text/listtypes
51 51
 		 * Names of the catalog list types for texts that are updated or removed
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 * @see controller/common/catalog/import/csv/processor/price/listtypes
67 67
 		 * @see controller/common/catalog/import/csv/processor/catalog/listtypes
68 68
 		 */
69
-		$this->listTypes = $context->getConfig()->get( 'controller/common/catalog/import/csv/processor/text/listtypes' );
69
+		$this->listTypes = $context->getConfig()->get('controller/common/catalog/import/csv/processor/text/listtypes');
70 70
 	}
71 71
 
72 72
 
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 	 * @param array $data List of CSV fields with position as key and data as value
78 78
 	 * @return array List of data which hasn't been imported
79 79
 	 */
80
-	public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data )
80
+	public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data)
81 81
 	{
82
-		$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
83
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text' );
82
+		$listManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
83
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text');
84 84
 		$manager->begin();
85 85
 
86 86
 		try
87 87
 		{
88 88
 			$delete = $listMap = [];
89
-			$map = $this->getMappedChunk( $data, $this->getMapping() );
90
-			$listItems = $catalog->getListItems( 'text', $this->listTypes );
89
+			$map = $this->getMappedChunk($data, $this->getMapping());
90
+			$listItems = $catalog->getListItems('text', $this->listTypes);
91 91
 
92
-			foreach( $listItems as $listItem )
92
+			foreach ($listItems as $listItem)
93 93
 			{
94
-				if( ( $refItem = $listItem->getRefItem() ) !== null ) {
95
-					$listMap[ $refItem->getContent() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem;
94
+				if (($refItem = $listItem->getRefItem()) !== null) {
95
+					$listMap[$refItem->getContent()][$refItem->getType()][$listItem->getType()] = $listItem;
96 96
 				}
97 97
 			}
98 98
 
99
-			foreach( $map as $pos => $list )
99
+			foreach ($map as $pos => $list)
100 100
 			{
101
-				if( $this->checkEntry( $list ) === false ) {
101
+				if ($this->checkEntry($list) === false) {
102 102
 					continue;
103 103
 				}
104 104
 
105
-				$content = trim( $list['text.content'] );
106
-				$type = trim( isset( $list['text.type'] ) ? $list['text.type'] : 'name' );
107
-				$typecode = trim( isset( $list['catalog.lists.type'] ) ? $list['catalog.lists.type'] : 'default' );
105
+				$content = trim($list['text.content']);
106
+				$type = trim(isset($list['text.type']) ? $list['text.type'] : 'name');
107
+				$typecode = trim(isset($list['catalog.lists.type']) ? $list['catalog.lists.type'] : 'default');
108 108
 
109
-				if( isset( $listMap[$content][$type][$typecode] ) )
109
+				if (isset($listMap[$content][$type][$typecode]))
110 110
 				{
111 111
 					$listItem = $listMap[$content][$type][$typecode];
112 112
 					$refItem = $listItem->getRefItem();
113
-					unset( $listItems[ $listItem->getId() ] );
113
+					unset($listItems[$listItem->getId()]);
114 114
 				}
115 115
 				else
116 116
 				{
@@ -118,33 +118,33 @@  discard block
 block discarded – undo
118 118
 					$refItem = $manager->createItem();
119 119
 				}
120 120
 
121
-				$list['text.typeid'] = $this->getTypeId( 'text/type', 'catalog', $type );
121
+				$list['text.typeid'] = $this->getTypeId('text/type', 'catalog', $type);
122 122
 				$list['text.domain'] = 'catalog';
123 123
 
124
-				$refItem->fromArray( $this->addItemDefaults( $list ) );
125
-				$refItem = $manager->saveItem( $refItem );
124
+				$refItem->fromArray($this->addItemDefaults($list));
125
+				$refItem = $manager->saveItem($refItem);
126 126
 
127
-				$list['catalog.lists.typeid'] = $this->getTypeId( 'catalog/lists/type', 'text', $typecode );
127
+				$list['catalog.lists.typeid'] = $this->getTypeId('catalog/lists/type', 'text', $typecode);
128 128
 				$list['catalog.lists.parentid'] = $catalog->getId();
129 129
 				$list['catalog.lists.refid'] = $refItem->getId();
130 130
 				$list['catalog.lists.domain'] = 'text';
131 131
 
132
-				$listItem->fromArray( $this->addListItemDefaults( $list, $pos ) );
133
-				$listManager->saveItem( $listItem, false );
132
+				$listItem->fromArray($this->addListItemDefaults($list, $pos));
133
+				$listManager->saveItem($listItem, false);
134 134
 			}
135 135
 
136
-			foreach( $listItems as $listItem ) {
136
+			foreach ($listItems as $listItem) {
137 137
 				$delete[] = $listItem->getRefId();
138 138
 			}
139 139
 
140
-			$manager->deleteItems( $delete );
141
-			$listManager->deleteItems( array_keys( $listItems ) );
140
+			$manager->deleteItems($delete);
141
+			$listManager->deleteItems(array_keys($listItems));
142 142
 
143
-			$data = $this->getObject()->process( $catalog, $data );
143
+			$data = $this->getObject()->process($catalog, $data);
144 144
 
145 145
 			$manager->commit();
146 146
 		}
147
-		catch( \Exception $e )
147
+		catch (\Exception $e)
148 148
 		{
149 149
 			$manager->rollback();
150 150
 			throw $e;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	 * @param array $list Associative list of domain item keys and their values, e.g. "text.status" => 1
161 161
 	 * @return array Given associative list enriched by default values if they were not already set
162 162
 	 */
163
-	protected function addItemDefaults( array $list )
163
+	protected function addItemDefaults(array $list)
164 164
 	{
165
-		if( !isset( $list['text.label'] ) ) {
166
-			$list['text.label'] = mb_strcut( trim( $list['text.content'] ), 0, 255 );
165
+		if (!isset($list['text.label'])) {
166
+			$list['text.label'] = mb_strcut(trim($list['text.content']), 0, 255);
167 167
 		}
168 168
 
169
-		if( !isset( $list['text.status'] ) ) {
169
+		if (!isset($list['text.status'])) {
170 170
 			$list['text.status'] = 1;
171 171
 		}
172 172
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 * @param array $list Associative list of key/value pairs from the mapping
181 181
 	 * @return boolean True if valid, false if not
182 182
 	 */
183
-	protected function checkEntry( array $list )
183
+	protected function checkEntry(array $list)
184 184
 	{
185
-		if( !isset( $list['text.content'] ) || trim( $list['text.content'] ) === '' || isset( $list['catalog.lists.type'] )
186
-			&& $this->listTypes !== null && !in_array( trim( $list['catalog.lists.type'] ), (array) $this->listTypes )
185
+		if (!isset($list['text.content']) || trim($list['text.content']) === '' || isset($list['catalog.lists.type'])
186
+			&& $this->listTypes !== null && !in_array(trim($list['catalog.lists.type']), (array) $this->listTypes)
187 187
 		) {
188 188
 			return false;
189 189
 		}
Please login to merge, or discard this patch.
common/src/Controller/Common/Product/Import/Csv/Processor/Text/Standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
 					$listItem = $listMap[$content][$type][$typecode];
112 112
 					$refItem = $listItem->getRefItem();
113 113
 					unset( $listItems[ $listItem->getId() ] );
114
-				}
115
-				else
114
+				} else
116 115
 				{
117 116
 					$listItem = $listManager->createItem();
118 117
 					$refItem = $manager->createItem();
@@ -143,8 +142,7 @@  discard block
 block discarded – undo
143 142
 			$data = $this->getObject()->process( $product, $data );
144 143
 
145 144
 			$manager->commit();
146
-		}
147
-		catch( \Exception $e )
145
+		} catch( \Exception $e )
148 146
 		{
149 147
 			$manager->rollback();
150 148
 			throw $e;
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
43 43
 	 * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object Decorated processor
44 44
 	 */
45
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
-			\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null )
45
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
+			\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null)
47 47
 	{
48
-		parent::__construct( $context, $mapping, $object );
48
+		parent::__construct($context, $mapping, $object);
49 49
 
50 50
 		/** controller/common/product/import/csv/processor/text/listtypes
51 51
 		 * Names of the product list types for texts that are updated or removed
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 * @see controller/common/product/import/csv/processor/price/listtypes
67 67
 		 * @see controller/common/product/import/csv/processor/product/listtypes
68 68
 		 */
69
-		$this->listTypes = $context->getConfig()->get( 'controller/common/product/import/csv/processor/text/listtypes' );
69
+		$this->listTypes = $context->getConfig()->get('controller/common/product/import/csv/processor/text/listtypes');
70 70
 	}
71 71
 
72 72
 
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 	 * @param array $data List of CSV fields with position as key and data as value
78 78
 	 * @return array List of data which hasn't been imported
79 79
 	 */
80
-	public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data )
80
+	public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data)
81 81
 	{
82
-		$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
83
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text' );
82
+		$listManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
83
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text');
84 84
 		$manager->begin();
85 85
 
86 86
 		try
87 87
 		{
88 88
 			$delete = $listMap = [];
89
-			$map = $this->getMappedChunk( $data, $this->getMapping() );
90
-			$listItems = $product->getListItems( 'text', $this->listTypes );
89
+			$map = $this->getMappedChunk($data, $this->getMapping());
90
+			$listItems = $product->getListItems('text', $this->listTypes);
91 91
 
92
-			foreach( $listItems as $listItem )
92
+			foreach ($listItems as $listItem)
93 93
 			{
94
-				if( ( $refItem = $listItem->getRefItem() ) !== null ) {
95
-					$listMap[ $refItem->getContent() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem;
94
+				if (($refItem = $listItem->getRefItem()) !== null) {
95
+					$listMap[$refItem->getContent()][$refItem->getType()][$listItem->getType()] = $listItem;
96 96
 				}
97 97
 			}
98 98
 
99
-			foreach( $map as $pos => $list )
99
+			foreach ($map as $pos => $list)
100 100
 			{
101
-				if( $this->checkEntry( $list ) === false ) {
101
+				if ($this->checkEntry($list) === false) {
102 102
 					continue;
103 103
 				}
104 104
 
105
-				$content = trim( $list['text.content'] );
106
-				$type = trim( isset( $list['text.type'] ) ? $list['text.type'] : 'name' );
107
-				$typecode = trim( isset( $list['product.lists.type'] ) ? $list['product.lists.type'] : 'default' );
105
+				$content = trim($list['text.content']);
106
+				$type = trim(isset($list['text.type']) ? $list['text.type'] : 'name');
107
+				$typecode = trim(isset($list['product.lists.type']) ? $list['product.lists.type'] : 'default');
108 108
 
109
-				if( isset( $listMap[$content][$type][$typecode] ) )
109
+				if (isset($listMap[$content][$type][$typecode]))
110 110
 				{
111 111
 					$listItem = $listMap[$content][$type][$typecode];
112 112
 					$refItem = $listItem->getRefItem();
113
-					unset( $listItems[ $listItem->getId() ] );
113
+					unset($listItems[$listItem->getId()]);
114 114
 				}
115 115
 				else
116 116
 				{
@@ -118,33 +118,33 @@  discard block
 block discarded – undo
118 118
 					$refItem = $manager->createItem();
119 119
 				}
120 120
 
121
-				$list['text.typeid'] = $this->getTypeId( 'text/type', 'product', $type );
121
+				$list['text.typeid'] = $this->getTypeId('text/type', 'product', $type);
122 122
 				$list['text.domain'] = 'product';
123 123
 
124
-				$refItem->fromArray( $this->addItemDefaults( $list ) );
125
-				$refItem = $manager->saveItem( $refItem );
124
+				$refItem->fromArray($this->addItemDefaults($list));
125
+				$refItem = $manager->saveItem($refItem);
126 126
 
127
-				$list['product.lists.typeid'] = $this->getTypeId( 'product/lists/type', 'text', $typecode );
127
+				$list['product.lists.typeid'] = $this->getTypeId('product/lists/type', 'text', $typecode);
128 128
 				$list['product.lists.parentid'] = $product->getId();
129 129
 				$list['product.lists.refid'] = $refItem->getId();
130 130
 				$list['product.lists.domain'] = 'text';
131 131
 
132
-				$listItem->fromArray( $this->addListItemDefaults( $list, $pos ) );
133
-				$listManager->saveItem( $listItem, false );
132
+				$listItem->fromArray($this->addListItemDefaults($list, $pos));
133
+				$listManager->saveItem($listItem, false);
134 134
 			}
135 135
 
136
-			foreach( $listItems as $listItem ) {
136
+			foreach ($listItems as $listItem) {
137 137
 				$delete[] = $listItem->getRefId();
138 138
 			}
139 139
 
140
-			$manager->deleteItems( $delete );
141
-			$listManager->deleteItems( array_keys( $listItems ) );
140
+			$manager->deleteItems($delete);
141
+			$listManager->deleteItems(array_keys($listItems));
142 142
 
143
-			$data = $this->getObject()->process( $product, $data );
143
+			$data = $this->getObject()->process($product, $data);
144 144
 
145 145
 			$manager->commit();
146 146
 		}
147
-		catch( \Exception $e )
147
+		catch (\Exception $e)
148 148
 		{
149 149
 			$manager->rollback();
150 150
 			throw $e;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	 * @param array $list Associative list of domain item keys and their values, e.g. "text.status" => 1
161 161
 	 * @return array Given associative list enriched by default values if they were not already set
162 162
 	 */
163
-	protected function addItemDefaults( array $list )
163
+	protected function addItemDefaults(array $list)
164 164
 	{
165
-		if( !isset( $list['text.label'] ) ) {
166
-			$list['text.label'] = mb_strcut( trim( $list['text.content'] ), 0, 255 );
165
+		if (!isset($list['text.label'])) {
166
+			$list['text.label'] = mb_strcut(trim($list['text.content']), 0, 255);
167 167
 		}
168 168
 
169
-		if( !isset( $list['text.status'] ) ) {
169
+		if (!isset($list['text.status'])) {
170 170
 			$list['text.status'] = 1;
171 171
 		}
172 172
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 * @param array $list Associative list of key/value pairs from the mapping
181 181
 	 * @return boolean True if valid, false if not
182 182
 	 */
183
-	protected function checkEntry( array $list )
183
+	protected function checkEntry(array $list)
184 184
 	{
185
-		if( !isset( $list['text.content'] ) || trim( $list['text.content'] ) === '' || isset( $list['product.lists.type'] )
186
-			&& $this->listTypes !== null && !in_array( trim( $list['product.lists.type'] ), (array) $this->listTypes )
185
+		if (!isset($list['text.content']) || trim($list['text.content']) === '' || isset($list['product.lists.type'])
186
+			&& $this->listTypes !== null && !in_array(trim($list['product.lists.type']), (array) $this->listTypes)
187 187
 		) {
188 188
 			return false;
189 189
 		}
Please login to merge, or discard this patch.
src/Controller/Common/Product/Import/Csv/Processor/Property/Standard.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -40,54 +40,54 @@  discard block
 block discarded – undo
40 40
 	 * @param array $data List of CSV fields with position as key and data as value
41 41
 	 * @return array List of data which hasn't been imported
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data )
43
+	public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data)
44 44
 	{
45
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' );
45
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property');
46 46
 		$manager->begin();
47 47
 
48 48
 		try
49 49
 		{
50 50
 			$propMap = [];
51
-			$map = $this->getMappedChunk( $data, $this->getMapping() );
52
-			$items = $this->getPropertyItems( $product->getId() );
51
+			$map = $this->getMappedChunk($data, $this->getMapping());
52
+			$items = $this->getPropertyItems($product->getId());
53 53
 
54
-			foreach( $items as $item ) {
55
-				$propMap[ $item->getValue() ][ $item->getType() ] = $item;
54
+			foreach ($items as $item) {
55
+				$propMap[$item->getValue()][$item->getType()] = $item;
56 56
 			}
57 57
 
58
-			foreach( $map as $list )
58
+			foreach ($map as $list)
59 59
 			{
60
-				$typecode = trim( $list['product.property.type'] );
61
-				$value = trim( $list['product.property.value'] );
60
+				$typecode = trim($list['product.property.type']);
61
+				$value = trim($list['product.property.value']);
62 62
 
63
-				if( $typecode == '' || $value == '' ) {
63
+				if ($typecode == '' || $value == '') {
64 64
 					continue;
65 65
 				}
66 66
 
67
-				$list['product.property.typeid'] = $this->getTypeId( 'product/property/type', 'product', $typecode );
67
+				$list['product.property.typeid'] = $this->getTypeId('product/property/type', 'product', $typecode);
68 68
 				$list['product.property.parentid'] = $product->getId();
69 69
 
70
-				if( isset( $propMap[$value][$typecode] ) )
70
+				if (isset($propMap[$value][$typecode]))
71 71
 				{
72 72
 					$item = $propMap[$value][$typecode];
73
-					unset( $items[ $item->getId() ] );
73
+					unset($items[$item->getId()]);
74 74
 				}
75 75
 				else
76 76
 				{
77 77
 					$item = $manager->createItem();
78 78
 				}
79 79
 
80
-				$item->fromArray( $list );
81
-				$manager->saveItem( $item, false );
80
+				$item->fromArray($list);
81
+				$manager->saveItem($item, false);
82 82
 			}
83 83
 
84
-			$manager->deleteItems( array_keys( $items ) );
84
+			$manager->deleteItems(array_keys($items));
85 85
 
86
-			$data = $this->getObject()->process( $product, $data );
86
+			$data = $this->getObject()->process($product, $data);
87 87
 
88 88
 			$manager->commit();
89 89
 		}
90
-		catch( \Exception $e )
90
+		catch (\Exception $e)
91 91
 		{
92 92
 			$manager->rollback();
93 93
 			throw $e;
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @param string $prodid Unique product ID
104 104
 	 * @return array Associative list of product property items
105 105
 	 */
106
-	protected function getPropertyItems( $prodid )
106
+	protected function getPropertyItems($prodid)
107 107
 	{
108
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' );
108
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property');
109 109
 
110 110
 		$search = $manager->createSearch();
111
-		$search->setConditions( $search->compare( '==', 'product.property.parentid', $prodid ) );
111
+		$search->setConditions($search->compare('==', 'product.property.parentid', $prodid));
112 112
 
113
-		return $manager->searchItems( $search );
113
+		return $manager->searchItems($search);
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
 				{
72 72
 					$item = $propMap[$value][$typecode];
73 73
 					unset( $items[ $item->getId() ] );
74
-				}
75
-				else
74
+				} else
76 75
 				{
77 76
 					$item = $manager->createItem();
78 77
 				}
@@ -86,8 +85,7 @@  discard block
 block discarded – undo
86 85
 			$data = $this->getObject()->process( $product, $data );
87 86
 
88 87
 			$manager->commit();
89
-		}
90
-		catch( \Exception $e )
88
+		} catch( \Exception $e )
91 89
 		{
92 90
 			$manager->rollback();
93 91
 			throw $e;
Please login to merge, or discard this patch.
common/src/Controller/Common/Coupon/Import/Csv/Processor/Code/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,21 +40,21 @@
 block discarded – undo
40 40
 	 * @param array $data List of CSV fields with position as key and data as value
41 41
 	 * @return array List of data which hasn't been imported
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data )
43
+	public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data)
44 44
 	{
45
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' );
46
-		$map = $this->getMappedChunk( $data, $this->getMapping() );
45
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code');
46
+		$map = $this->getMappedChunk($data, $this->getMapping());
47 47
 
48
-		foreach( $map as $list )
48
+		foreach ($map as $list)
49 49
 		{
50
-			if( trim( $list['coupon.code.code'] ) == '' ) {
50
+			if (trim($list['coupon.code.code']) == '') {
51 51
 				continue;
52 52
 			}
53 53
 
54
-			$item->fromArray( $list );
55
-			$manager->saveItem( $item );
54
+			$item->fromArray($list);
55
+			$manager->saveItem($item);
56 56
 		}
57 57
 
58
-		return $this->getObject()->process( $item, $data );
58
+		return $this->getObject()->process($item, $data);
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product site map' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product site map');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Creates a product site map for search engines' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates a product site map for search engines');
43 43
 	}
44 44
 
45 45
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	{
53 53
 		$container = $this->createContainer();
54 54
 
55
-		$files = $this->export( $container );
56
-		$this->createSitemapIndex( $container, $files );
55
+		$files = $this->export($container);
56
+		$this->createSitemapIndex($container, $files);
57 57
 
58 58
 		$container->close();
59 59
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param \Aimeos\MW\Container\Content\Iface $content File content object
66 66
 	 * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items
67 67
 	 */
68
-	protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items )
68
+	protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items)
69 69
 	{
70 70
 		$config = $this->getContext()->getConfig();
71 71
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @see controller/jobs/product/export/sitemap/max-items
97 97
 		 * @see controller/jobs/product/export/sitemap/max-query
98 98
 		 */
99
-		$changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' );
99
+		$changefreq = $config->get('controller/jobs/product/export/sitemap/changefreq', 'daily');
100 100
 
101 101
 		/** controller/jobs/product/export/sitemap/standard/template-items
102 102
 		 * Relative path to the XML items template of the product site map job controller.
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		$view->siteItems = $items;
130 130
 		$view->siteFreq = $changefreq;
131 131
 
132
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
132
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
133 133
 	}
134 134
 
135 135
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		 * @see controller/jobs/product/export/sitemap/max-query
176 176
 		 * @see controller/jobs/product/export/sitemap/changefreq
177 177
 		 */
178
-		$location = $config->get( 'controller/jobs/product/export/sitemap/location' );
178
+		$location = $config->get('controller/jobs/product/export/sitemap/location');
179 179
 
180 180
 		/** controller/jobs/product/export/sitemap/container/options
181 181
 		 * List of file container options for the site map files
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 		 * @see controller/jobs/product/export/sitemap/max-query
197 197
 		 * @see controller/jobs/product/export/sitemap/changefreq
198 198
 		 */
199
-		$default = array( 'gzip-mode' => 'wb' );
200
-		$options = $config->get( 'controller/jobs/product/export/sitemap/container/options', $default );
199
+		$default = array('gzip-mode' => 'wb');
200
+		$options = $config->get('controller/jobs/product/export/sitemap/container/options', $default);
201 201
 
202
-		if( $location === null )
202
+		if ($location === null)
203 203
 		{
204
-			$msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location' );
205
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
204
+			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location');
205
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
206 206
 		}
207 207
 
208
-		return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options );
208
+		return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options);
209 209
 	}
210 210
 
211 211
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param integer $filenum New file number
217 217
 	 * @return \Aimeos\MW\Container\Content\Iface New content object
218 218
 	 */
219
-	protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum )
219
+	protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum)
220 220
 	{
221 221
 		/** controller/jobs/product/export/sitemap/standard/template-header
222 222
 		 * Relative path to the XML site map header template of the product site map job controller.
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		$context = $this->getContext();
247 247
 		$view = $context->getView();
248 248
 
249
-		$content = $container->create( $this->getFilename( $filenum ) );
250
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
251
-		$container->add( $content );
249
+		$content = $container->create($this->getFilename($filenum));
250
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
251
+		$container->add($content);
252 252
 
253 253
 		return $content;
254 254
 	}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @param \Aimeos\MW\Container\Content\Iface $content
261 261
 	 */
262
-	protected function closeContent( \Aimeos\MW\Container\Content\Iface $content )
262
+	protected function closeContent(\Aimeos\MW\Container\Content\Iface $content)
263 263
 	{
264 264
 		/** controller/jobs/product/export/sitemap/standard/template-footer
265 265
 		 * Relative path to the XML site map footer template of the product site map job controller.
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		$context = $this->getContext();
290 290
 		$view = $context->getView();
291 291
 
292
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
292
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
293 293
 	}
294 294
 
295 295
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param \Aimeos\MW\Container\Iface $container File container object
300 300
 	 * @param array $files List of generated site map file names
301 301
 	 */
302
-	protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files )
302
+	protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files)
303 303
 	{
304 304
 		/** controller/jobs/product/export/sitemap/standard/template-index
305 305
 		 * Relative path to the XML site map index template of the product site map job controller.
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 
332 332
 		$view->siteFiles = $files;
333 333
 
334
-		$content = $container->create( 'aimeos-sitemap-index.xml' );
335
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
336
-		$container->add( $content );
334
+		$content = $container->create('aimeos-sitemap-index.xml');
335
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
336
+		$container->add($content);
337 337
 	}
338 338
 
339 339
 
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 	 * @param mixed $default Default value if name is unknown
345 345
 	 * @return mixed Configuration value
346 346
 	 */
347
-	protected function getConfig( $name, $default = null )
347
+	protected function getConfig($name, $default = null)
348 348
 	{
349 349
 		$config = $this->getContext()->getConfig();
350 350
 
351
-		switch( $name )
351
+		switch ($name)
352 352
 		{
353 353
 			case 'domain':
354 354
 				return [];
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				 * @see controller/jobs/product/export/sitemap/max-query
376 376
 				 * @see controller/jobs/product/export/sitemap/changefreq
377 377
 				 */
378
-				return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 );
378
+				return $config->get('controller/jobs/product/export/sitemap/max-items', 50000);
379 379
 
380 380
 			case 'max-query':
381 381
 				/** controller/jobs/product/export/sitemap/max-query
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 				 * @see controller/jobs/product/export/sitemap/max-items
396 396
 				 * @see controller/jobs/product/export/sitemap/changefreq
397 397
 				 */
398
-				return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 );
398
+				return $config->get('controller/jobs/product/export/sitemap/max-query', 1000);
399 399
 		}
400 400
 
401 401
 		return $default;
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	 * @param integer $number Current file number
409 409
 	 * @return string New file name
410 410
 	 */
411
-	protected function getFilename( $number )
411
+	protected function getFilename($number)
412 412
 	{
413
-		return sprintf( 'aimeos-sitemap-%d.xml', $number );
413
+		return sprintf('aimeos-sitemap-%d.xml', $number);
414 414
 	}
415 415
 }
Please login to merge, or discard this patch.