Completed
Push — master ( 0c1242...d48b9a )
by Aimeos
01:59
created
controller/frontend/tests/Controller/Frontend/Catalog/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Catalog\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
28
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
28
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Attribute/Decorator/BaseTest.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,117 +20,117 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
43
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testAddFilterTypes()
69 69
 	{
70
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
70
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'addFilterTypes' )
73
-			->will( $this->returnArgument( 0 ) );
72
+		$this->stub->expects($this->once())->method('addFilterTypes')
73
+			->will($this->returnArgument(0));
74 74
 
75
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterTypes( $search, [] ) );
75
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterTypes($search, []));
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testCreateFilter()
80 80
 	{
81
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
81
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
82 82
 
83
-		$this->stub->expects( $this->once() )->method( 'createFilter' )
84
-			->will( $this->returnValue( $search ) );
83
+		$this->stub->expects($this->once())->method('createFilter')
84
+			->will($this->returnValue($search));
85 85
 
86
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
86
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testGetItem()
91 91
 	{
92
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createItem();
92
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createItem();
93 93
 
94
-		$this->stub->expects( $this->once() )->method( 'getItem' )
95
-			->will( $this->returnValue( $item ) );
94
+		$this->stub->expects($this->once())->method('getItem')
95
+			->will($this->returnValue($item));
96 96
 
97
-		$this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $this->object->getItem( -1 ) );
97
+		$this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $this->object->getItem( -1 ));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testGetItems()
102 102
 	{
103
-		$this->stub->expects( $this->once() )->method( 'getItems' )
104
-			->will( $this->returnValue( [] ) );
103
+		$this->stub->expects($this->once())->method('getItems')
104
+			->will($this->returnValue([]));
105 105
 
106
-		$this->assertEquals( [], $this->object->getItems( [-1], ['media'] ) );
106
+		$this->assertEquals([], $this->object->getItems([-1], ['media']));
107 107
 	}
108 108
 
109 109
 
110 110
 	public function testSearchItems()
111 111
 	{
112
-		$filter = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
112
+		$filter = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
113 113
 
114
-		$this->stub->expects( $this->once() )->method( 'searchItems' )
115
-			->will( $this->returnValue( [] ) );
114
+		$this->stub->expects($this->once())->method('searchItems')
115
+			->will($this->returnValue([]));
116 116
 
117
-		$this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) );
117
+		$this->assertEquals([], $this->object->searchItems($filter, ['media']));
118 118
 	}
119 119
 
120 120
 
121 121
 	public function testGetController()
122 122
 	{
123
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
123
+		$result = $this->access('getController')->invokeArgs($this->object, []);
124 124
 
125
-		$this->assertSame( $this->stub, $result );
125
+		$this->assertSame($this->stub, $result);
126 126
 	}
127 127
 
128 128
 
129
-	protected function access( $name )
129
+	protected function access($name)
130 130
 	{
131
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' );
132
-		$method = $class->getMethod( $name );
133
-		$method->setAccessible( true );
131
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Attribute\Decorator\Base');
132
+		$method = $class->getMethod($name);
133
+		$method->setAccessible(true);
134 134
 
135 135
 		return $method;
136 136
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Attribute/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Attribute\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
29
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
29
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/Decorator/BaseTest.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,54 +20,54 @@  discard block
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
43
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testClear()
69 69
 	{
70
-		$this->stub->expects( $this->once() )->method( 'clear' );
70
+		$this->stub->expects($this->once())->method('clear');
71 71
 
72 72
 		$this->object->clear();
73 73
 	}
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 	public function testGet()
77 77
 	{
78 78
 		$context = \TestHelperFrontend::getContext();
79
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->createItem();
79
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem();
80 80
 
81
-		$this->stub->expects( $this->once() )->method( 'get' )
82
-			->will( $this->returnValue( $order ) );
81
+		$this->stub->expects($this->once())->method('get')
82
+			->will($this->returnValue($order));
83 83
 
84
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() );
84
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get());
85 85
 	}
86 86
 
87 87
 
88 88
 	public function testSave()
89 89
 	{
90
-		$this->stub->expects( $this->once() )->method( 'save' );
90
+		$this->stub->expects($this->once())->method('save');
91 91
 
92 92
 		$this->object->save();
93 93
 	}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 
96 96
 	public function testSetType()
97 97
 	{
98
-		$this->stub->expects( $this->once() )->method( 'setType' );
98
+		$this->stub->expects($this->once())->method('setType');
99 99
 
100
-		$this->object->setType( 'test' );
100
+		$this->object->setType('test');
101 101
 	}
102 102
 
103 103
 
104 104
 	public function testStore()
105 105
 	{
106
-		$this->stub->expects( $this->once() )->method( 'store' );
106
+		$this->stub->expects($this->once())->method('store');
107 107
 
108 108
 		$this->object->store();
109 109
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 	public function testLoad()
113 113
 	{
114
-		$this->stub->expects( $this->once() )->method( 'load' );
114
+		$this->stub->expects($this->once())->method('load');
115 115
 
116 116
 		$this->object->load( -1 );
117 117
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	public function testAddProduct()
121 121
 	{
122
-		$this->stub->expects( $this->once() )->method( 'addProduct' );
122
+		$this->stub->expects($this->once())->method('addProduct');
123 123
 
124 124
 		$this->object->addProduct( -1 );
125 125
 	}
@@ -127,73 +127,73 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function testDeleteProduct()
129 129
 	{
130
-		$this->stub->expects( $this->once() )->method( 'deleteProduct' );
130
+		$this->stub->expects($this->once())->method('deleteProduct');
131 131
 
132
-		$this->object->deleteProduct( 0 );
132
+		$this->object->deleteProduct(0);
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testEditProduct()
137 137
 	{
138
-		$this->stub->expects( $this->once() )->method( 'editProduct' );
138
+		$this->stub->expects($this->once())->method('editProduct');
139 139
 
140
-		$this->object->editProduct( 0, 1 );
140
+		$this->object->editProduct(0, 1);
141 141
 	}
142 142
 
143 143
 
144 144
 	public function testAddCoupon()
145 145
 	{
146
-		$this->stub->expects( $this->once() )->method( 'addCoupon' );
146
+		$this->stub->expects($this->once())->method('addCoupon');
147 147
 
148
-		$this->object->addCoupon( 'test' );
148
+		$this->object->addCoupon('test');
149 149
 	}
150 150
 
151 151
 
152 152
 	public function testDeleteCoupon()
153 153
 	{
154
-		$this->stub->expects( $this->once() )->method( 'deleteCoupon' );
154
+		$this->stub->expects($this->once())->method('deleteCoupon');
155 155
 
156
-		$this->object->deleteCoupon( 'test' );
156
+		$this->object->deleteCoupon('test');
157 157
 	}
158 158
 
159 159
 
160 160
 	public function testSetAddress()
161 161
 	{
162
-		$this->stub->expects( $this->once() )->method( 'setAddress' );
162
+		$this->stub->expects($this->once())->method('setAddress');
163 163
 
164
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
164
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
165 165
 	}
166 166
 
167 167
 
168 168
 	public function testAddService()
169 169
 	{
170
-		$this->stub->expects( $this->once() )->method( 'addService' );
170
+		$this->stub->expects($this->once())->method('addService');
171 171
 
172
-		$this->object->addService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1 );
172
+		$this->object->addService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1);
173 173
 	}
174 174
 
175 175
 
176 176
 	public function testDeleteService()
177 177
 	{
178
-		$this->stub->expects( $this->once() )->method( 'deleteService' );
178
+		$this->stub->expects($this->once())->method('deleteService');
179 179
 
180
-		$this->object->deleteService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT );
180
+		$this->object->deleteService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT);
181 181
 	}
182 182
 
183 183
 
184 184
 	public function testGetController()
185 185
 	{
186
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
186
+		$result = $this->access('getController')->invokeArgs($this->object, []);
187 187
 
188
-		$this->assertSame( $this->stub, $result );
188
+		$this->assertSame($this->stub, $result);
189 189
 	}
190 190
 
191 191
 
192
-	protected function access( $name )
192
+	protected function access($name)
193 193
 	{
194
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' );
195
-		$method = $class->getMethod( $name );
196
-		$method->setAccessible( true );
194
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Decorator\Base');
195
+		$method = $class->getMethod($name);
196
+		$method->setAccessible(true);
197 197
 
198 198
 		return $method;
199 199
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
28
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
28
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Standard.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 * @param string $id Unique subscription ID
28 28
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
29 29
 	 */
30
-	public function cancel( $id )
30
+	public function cancel($id)
31 31
 	{
32
-		$item = $this->getItem( $id );
33
-		$item->setDateEnd( $item->getDateNext() );
34
-		$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL );
32
+		$item = $this->getItem($id);
33
+		$item->setDateEnd($item->getDateNext());
34
+		$item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL);
35 35
 
36
-		return $this->saveItem( $item );
36
+		return $this->saveItem($item);
37 37
 	}
38 38
 
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function createFilter()
46 46
 	{
47
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch();
47
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch();
48 48
 	}
49 49
 
50 50
 
@@ -54,25 +54,25 @@  discard block
 block discarded – undo
54 54
 	 * @param string $id Unique subscription ID
55 55
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
56 56
 	 */
57
-	public function getItem( $id )
57
+	public function getItem($id)
58 58
 	{
59 59
 		$context = $this->getContext();
60
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
60
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
61 61
 
62 62
 		$filter = $manager->createSearch();
63 63
 		$expr = [
64
-			$filter->compare( '==', 'subscription.id', $id ),
65
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
64
+			$filter->compare('==', 'subscription.id', $id),
65
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
66 66
 			$filter->getConditions(),
67 67
 		];
68
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
68
+		$filter->setConditions($filter->combine('&&', $expr));
69 69
 
70
-		$items = $this->searchItems( $filter );
70
+		$items = $this->searchItems($filter);
71 71
 
72
-		if( ( $item = reset( $items ) ) === false )
72
+		if (($item = reset($items)) === false)
73 73
 		{
74 74
 			$msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"';
75
-			throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) );
75
+			throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId()));
76 76
 		}
77 77
 
78 78
 		return $item;
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	public function getIntervals()
88 88
 	{
89 89
 		$intervals = [];
90
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
90
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
91 91
 
92
-		$search = $manager->createSearch( true );
92
+		$search = $manager->createSearch(true);
93 93
 		$expr = array(
94 94
 			$search->getConditions(),
95
-			$search->compare( '==', 'attribute.domain', 'product' ),
96
-			$search->compare( '==', 'attribute.type.code', 'interval' ),
95
+			$search->compare('==', 'attribute.domain', 'product'),
96
+			$search->compare('==', 'attribute.type.code', 'interval'),
97 97
 		);
98
-		$search->setConditions( $search->combine( '&&', $expr ) );
99
-		$search->setSlice( 0, 0x7fffffff );
98
+		$search->setConditions($search->combine('&&', $expr));
99
+		$search->setSlice(0, 0x7fffffff);
100 100
 
101
-		foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) {
101
+		foreach ($manager->searchItems($search, ['text']) as $attrItem) {
102 102
 			$intervals[$attrItem->getCode()] = $attrItem;
103 103
 		}
104 104
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
112 112
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
113 113
 	 */
114
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item )
114
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item)
115 115
 	{
116
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item );
116
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item);
117 117
 	}
118 118
 
119 119
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 * @param integer &$total|null Variable that will contain the total number of available items
125 125
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
128 128
 	{
129 129
 		$context = $this->getContext();
130
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
130
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
131 131
 
132 132
 		$expr = [
133
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
133
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
134 134
 			$filter->getConditions(),
135 135
 		];
136
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
136
+		$filter->setConditions($filter->combine('&&', $expr));
137 137
 
138
-		return $manager->searchItems( $filter, [], $total );
138
+		return $manager->searchItems($filter, [], $total);
139 139
 	}
140 140
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Base.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -31,52 +31,52 @@  discard block
 block discarded – undo
31 31
 	 * @param integer $quantity New product quantity
32 32
 	 * @return \Aimeos\MShop\Price\Item\Iface Price item with calculated price
33 33
 	 */
34
-	protected function calcPrice( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity )
34
+	protected function calcPrice(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity)
35 35
 	{
36 36
 		$context = $this->getContext();
37 37
 
38
-		if( empty( $prices ) )
38
+		if (empty($prices))
39 39
 		{
40
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
41
-			$prices = $manager->getItem( $product->getProductId(), array( 'price' ) )->getRefItems( 'price', 'default' );
40
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
41
+			$prices = $manager->getItem($product->getProductId(), array('price'))->getRefItems('price', 'default');
42 42
 		}
43 43
 
44 44
 
45
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
46
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
45
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
46
+		$price = $priceManager->getLowestPrice($prices, $quantity);
47 47
 
48 48
 		// customers can pay what they would like to pay
49
-		if( ( $attr = $product->getAttributeItem( 'price', 'custom' ) ) !== null )
49
+		if (($attr = $product->getAttributeItem('price', 'custom')) !== null)
50 50
 		{
51 51
 			$amount = $attr->getValue();
52 52
 
53
-			if( preg_match( '/^[0-9]*(\.[0-9]+)?$/', $amount ) !== 1 || ((double) $amount) < 0.01 )
53
+			if (preg_match('/^[0-9]*(\.[0-9]+)?$/', $amount) !== 1 || ((double) $amount) < 0.01)
54 54
 			{
55
-				$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid price value "%1$s"' );
56
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $amount ) );
55
+				$msg = $context->getI18n()->dt('controller/frontend', 'Invalid price value "%1$s"');
56
+				throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $amount));
57 57
 			}
58 58
 
59
-			$price->setValue( $amount );
59
+			$price->setValue($amount);
60 60
 		}
61 61
 
62 62
 		$orderAttributes = $product->getAttributes();
63
-		$attrItems = $this->getAttributeItems( $orderAttributes );
63
+		$attrItems = $this->getAttributeItems($orderAttributes);
64 64
 
65 65
 		// add prices of (optional) attributes
66
-		foreach( $orderAttributes as $orderAttrItem )
66
+		foreach ($orderAttributes as $orderAttrItem)
67 67
 		{
68 68
 			$attrId = $orderAttrItem->getAttributeId();
69 69
 
70
-			if( isset( $attrItems[$attrId] )
71
-				&& ( $prices = $attrItems[$attrId]->getRefItems( 'price', 'default' ) ) !== []
70
+			if (isset($attrItems[$attrId])
71
+				&& ($prices = $attrItems[$attrId]->getRefItems('price', 'default')) !== []
72 72
 			) {
73
-				$attrPrice = $priceManager->getLowestPrice( $prices, $orderAttrItem->getQuantity() );
74
-				$price->addItem( $attrPrice, $orderAttrItem->getQuantity() );
73
+				$attrPrice = $priceManager->getLowestPrice($prices, $orderAttrItem->getQuantity());
74
+				$price->addItem($attrPrice, $orderAttrItem->getQuantity());
75 75
 			}
76 76
 		}
77 77
 
78 78
 		// remove product rebate of original price in favor to rebates granted for the order
79
-		$price->setRebate( '0.00' );
79
+		$price->setRebate('0.00');
80 80
 
81 81
 		return $price;
82 82
 	}
@@ -90,43 +90,43 @@  discard block
 block discarded – undo
90 90
 	 * @param array $refMap Associative list of list type codes as keys and lists of reference IDs as values
91 91
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated
92 92
 	 */
93
-	protected function checkListRef( $prodId, $domain, array $refMap )
93
+	protected function checkListRef($prodId, $domain, array $refMap)
94 94
 	{
95
-		if( empty( $refMap ) ) {
95
+		if (empty($refMap)) {
96 96
 			return;
97 97
 		}
98 98
 
99 99
 		$context = $this->getContext();
100
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
101
-		$search = $productManager->createSearch( true );
100
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
101
+		$search = $productManager->createSearch(true);
102 102
 
103 103
 		$expr = array(
104
-			$search->compare( '==', 'product.id', $prodId ),
104
+			$search->compare('==', 'product.id', $prodId),
105 105
 			$search->getConditions(),
106 106
 		);
107 107
 
108
-		foreach( $refMap as $listType => $refIds )
108
+		foreach ($refMap as $listType => $refIds)
109 109
 		{
110
-			if( empty( $refIds ) ) {
110
+			if (empty($refIds)) {
111 111
 				continue;
112 112
 			}
113 113
 
114
-			foreach( $refIds as $key => $refId ) {
114
+			foreach ($refIds as $key => $refId) {
115 115
 				$refIds[$key] = (string) $refId;
116 116
 			}
117 117
 
118
-			$param = array( $domain, $this->getProductListTypeItem( $domain, $listType )->getId(), $refIds );
119
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
118
+			$param = array($domain, $this->getProductListTypeItem($domain, $listType)->getId(), $refIds);
119
+			$cmpfunc = $search->createFunction('product.contains', $param);
120 120
 
121
-			$expr[] = $search->compare( '==', $cmpfunc, count( $refIds ) );
121
+			$expr[] = $search->compare('==', $cmpfunc, count($refIds));
122 122
 		}
123 123
 
124
-		$search->setConditions( $search->combine( '&&', $expr ) );
124
+		$search->setConditions($search->combine('&&', $expr));
125 125
 
126
-		if( count( $productManager->searchItems( $search, [] ) ) === 0 )
126
+		if (count($productManager->searchItems($search, [])) === 0)
127 127
 		{
128
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' );
129
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) );
128
+			$msg = $context->getI18n()->dt('controller/frontend', 'Invalid "%1$s" references for product with ID %2$s');
129
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, json_encode($prodId)));
130 130
 		}
131 131
 	}
132 132
 
@@ -137,40 +137,40 @@  discard block
 block discarded – undo
137 137
 	 * @param \Aimeos\MShop\Locale\Item\Iface $locale Locale object from current basket
138 138
 	 * @param string $type Basket type
139 139
 	 */
140
-	protected function checkLocale( \Aimeos\MShop\Locale\Item\Iface $locale, $type )
140
+	protected function checkLocale(\Aimeos\MShop\Locale\Item\Iface $locale, $type)
141 141
 	{
142 142
 		$errors = [];
143 143
 		$context = $this->getContext();
144 144
 		$session = $context->getSession();
145 145
 
146
-		$localeStr = $session->get( 'aimeos/basket/locale' );
146
+		$localeStr = $session->get('aimeos/basket/locale');
147 147
 		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();
148 148
 
149
-		if( $localeStr !== null && $localeStr !== $localeKey )
149
+		if ($localeStr !== null && $localeStr !== $localeKey)
150 150
 		{
151
-			$locParts = explode( '|', $localeStr );
152
-			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
153
-			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
154
-			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );
151
+			$locParts = explode('|', $localeStr);
152
+			$locSite = (isset($locParts[0]) ? $locParts[0] : '');
153
+			$locLanguage = (isset($locParts[1]) ? $locParts[1] : '');
154
+			$locCurrency = (isset($locParts[2]) ? $locParts[2] : '');
155 155
 
156
-			$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
157
-			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );
156
+			$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
157
+			$locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false);
158 158
 
159 159
 			$context = clone $context;
160
-			$context->setLocale( $locale );
160
+			$context->setLocale($locale);
161 161
 
162
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
163
-			$basket = $manager->getSession( $type );
162
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
163
+			$basket = $manager->getSession($type);
164 164
 
165
-			$this->copyAddresses( $basket, $errors, $localeKey );
166
-			$this->copyServices( $basket, $errors );
167
-			$this->copyProducts( $basket, $errors, $localeKey );
168
-			$this->copyCoupons( $basket, $errors, $localeKey );
165
+			$this->copyAddresses($basket, $errors, $localeKey);
166
+			$this->copyServices($basket, $errors);
167
+			$this->copyProducts($basket, $errors, $localeKey);
168
+			$this->copyCoupons($basket, $errors, $localeKey);
169 169
 
170
-			$manager->setSession( $basket, $type );
170
+			$manager->setSession($basket, $type);
171 171
 		}
172 172
 
173
-		$session->set( 'aimeos/basket/locale', $localeKey );
173
+		$session->set('aimeos/basket/locale', $localeKey);
174 174
 	}
175 175
 
176 176
 
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 	 * @param string $localeKey Unique identifier of the site, language and currency
183 183
 	 * @return array Associative list of errors occured
184 184
 	 */
185
-	protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
185
+	protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
186 186
 	{
187
-		foreach( $basket->getAddresses() as $type => $item )
187
+		foreach ($basket->getAddresses() as $type => $item)
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->setAddress( $type, $item->toArray() );
192
-				$basket->deleteAddress( $type );
191
+				$this->setAddress($type, $item->toArray());
192
+				$basket->deleteAddress($type);
193 193
 			}
194
-			catch( \Exception $e )
194
+			catch (\Exception $e)
195 195
 			{
196 196
 				$logger = $this->getContext()->getLogger();
197 197
 				$errors['address'][$type] = $e->getMessage();
198 198
 
199 199
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
200
-				$logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
200
+				$logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
201 201
 			}
202 202
 		}
203 203
 
@@ -213,22 +213,22 @@  discard block
 block discarded – undo
213 213
 	 * @param string $localeKey Unique identifier of the site, language and currency
214 214
 	 * @return array Associative list of errors occured
215 215
 	 */
216
-	protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
216
+	protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
217 217
 	{
218
-		foreach( $basket->getCoupons() as $code => $list )
218
+		foreach ($basket->getCoupons() as $code => $list)
219 219
 		{
220 220
 			try
221 221
 			{
222
-				$this->addCoupon( $code );
223
-				$basket->deleteCoupon( $code, true );
222
+				$this->addCoupon($code);
223
+				$basket->deleteCoupon($code, true);
224 224
 			}
225
-			catch( \Exception $e )
225
+			catch (\Exception $e)
226 226
 			{
227 227
 				$logger = $this->getContext()->getLogger();
228 228
 				$errors['coupon'][$code] = $e->getMessage();
229 229
 
230 230
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
231
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
231
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
232 232
 			}
233 233
 		}
234 234
 
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 * @param string $localeKey Unique identifier of the site, language and currency
245 245
 	 * @return array Associative list of errors occured
246 246
 	 */
247
-	protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
247
+	protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
248 248
 	{
249
-		foreach( $basket->getProducts() as $pos => $product )
249
+		foreach ($basket->getProducts() as $pos => $product)
250 250
 		{
251
-			if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) {
251
+			if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) {
252 252
 				continue;
253 253
 			}
254 254
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			{
257 257
 				$variantIds = $configIds = $customIds = [];
258 258
 
259
-				foreach( $product->getAttributeItems() as $attrItem )
259
+				foreach ($product->getAttributeItems() as $attrItem)
260 260
 				{
261
-					switch( $attrItem->getType() )
261
+					switch ($attrItem->getType())
262 262
 					{
263 263
 						case 'variant': $variantIds[] = $attrItem->getAttributeId(); break;
264 264
 						case 'config': $configIds[$attrItem->getAttributeId()] = $attrItem->getQuantity(); break;
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
 					$variantIds, $configIds, [], $customIds
272 272
 				);
273 273
 
274
-				$basket->deleteProduct( $pos );
274
+				$basket->deleteProduct($pos);
275 275
 			}
276
-			catch( \Exception $e )
276
+			catch (\Exception $e)
277 277
 			{
278 278
 				$code = $product->getProductCode();
279 279
 				$logger = $this->getContext()->getLogger();
280 280
 				$errors['product'][$pos] = $e->getMessage();
281 281
 
282 282
 				$str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s';
283
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
283
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
284 284
 			}
285 285
 		}
286 286
 
@@ -295,24 +295,24 @@  discard block
 block discarded – undo
295 295
 	 * @param array $errors Associative list of previous errors
296 296
 	 * @return array Associative list of errors occured
297 297
 	 */
298
-	protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors )
298
+	protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors)
299 299
 	{
300
-		foreach( $basket->getServices() as $type => $list )
300
+		foreach ($basket->getServices() as $type => $list)
301 301
 		{
302
-			foreach( $list as $item )
302
+			foreach ($list as $item)
303 303
 			{
304 304
 				try
305 305
 				{
306 306
 					$attributes = [];
307 307
 
308
-					foreach( $item->getAttributes() as $attrItem ) {
308
+					foreach ($item->getAttributes() as $attrItem) {
309 309
 						$attributes[$attrItem->getCode()] = $attrItem->getValue();
310 310
 					}
311 311
 
312
-					$this->addService( $type, $item->getServiceId(), $attributes );
313
-					$basket->deleteService( $type );
312
+					$this->addService($type, $item->getServiceId(), $attributes);
313
+					$basket->deleteService($type);
314 314
 				}
315
-				catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
315
+				catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically
316 316
 			}
317 317
 		}
318 318
 
@@ -325,28 +325,28 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
327 327
 	 */
328
-	protected function createSubscriptions( \Aimeos\MShop\Order\Item\Base\Iface $basket )
328
+	protected function createSubscriptions(\Aimeos\MShop\Order\Item\Base\Iface $basket)
329 329
 	{
330
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' );
330
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription');
331 331
 
332
-		foreach( $basket->getProducts() as $orderProduct )
332
+		foreach ($basket->getProducts() as $orderProduct)
333 333
 		{
334
-			if( ( $interval = $orderProduct->getAttribute( 'interval', 'config' ) ) !== null )
334
+			if (($interval = $orderProduct->getAttribute('interval', 'config')) !== null)
335 335
 			{
336 336
 				$item = $manager->createItem();
337
-				$item->setOrderBaseId( $basket->getId() );
338
-				$item->setOrderProductId( $orderProduct->getId() );
339
-				$item->setInterval( $interval );
340
-				$item->setStatus( 1 );
341
-
342
-				if( ( $end = $orderProduct->getAttribute( 'intervalend', 'custom' ) ) !== null
343
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'config' ) ) !== null
344
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'hidden' ) ) !== null
337
+				$item->setOrderBaseId($basket->getId());
338
+				$item->setOrderProductId($orderProduct->getId());
339
+				$item->setInterval($interval);
340
+				$item->setStatus(1);
341
+
342
+				if (($end = $orderProduct->getAttribute('intervalend', 'custom')) !== null
343
+					|| ($end = $orderProduct->getAttribute('intervalend', 'config')) !== null
344
+					|| ($end = $orderProduct->getAttribute('intervalend', 'hidden')) !== null
345 345
 				) {
346
-					$item->setDateEnd( $end );
346
+					$item->setDateEnd($end);
347 347
 				}
348 348
 
349
-				$manager->saveItem( $item, false );
349
+				$manager->saveItem($item, false);
350 350
 			}
351 351
 		}
352 352
 	}
@@ -360,32 +360,32 @@  discard block
 block discarded – undo
360 360
 	 * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface
361 361
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one
362 362
 	 */
363
-	protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) )
363
+	protected function getAttributes(array $attributeIds, array $domains = array('price', 'text'))
364 364
 	{
365
-		if( empty( $attributeIds ) ) {
365
+		if (empty($attributeIds)) {
366 366
 			return [];
367 367
 		}
368 368
 
369
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
369
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
370 370
 
371
-		$search = $attributeManager->createSearch( true );
371
+		$search = $attributeManager->createSearch(true);
372 372
 		$expr = array(
373
-			$search->compare( '==', 'attribute.id', $attributeIds ),
373
+			$search->compare('==', 'attribute.id', $attributeIds),
374 374
 			$search->getConditions(),
375 375
 		);
376
-		$search->setConditions( $search->combine( '&&', $expr ) );
377
-		$search->setSlice( 0, 0x7fffffff );
376
+		$search->setConditions($search->combine('&&', $expr));
377
+		$search->setSlice(0, 0x7fffffff);
378 378
 
379
-		$attrItems = $attributeManager->searchItems( $search, $domains );
379
+		$attrItems = $attributeManager->searchItems($search, $domains);
380 380
 
381
-		if( count( $attrItems ) !== count( $attributeIds ) )
381
+		if (count($attrItems) !== count($attributeIds))
382 382
 		{
383 383
 			$i18n = $this->getContext()->getI18n();
384
-			$expected = implode( ',', $attributeIds );
385
-			$actual = implode( ',', array_keys( $attrItems ) );
386
-			$msg = $i18n->dt( 'controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"' );
384
+			$expected = implode(',', $attributeIds);
385
+			$actual = implode(',', array_keys($attrItems));
386
+			$msg = $i18n->dt('controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"');
387 387
 
388
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $actual, $expected ) );
388
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $actual, $expected));
389 389
 		}
390 390
 
391 391
 		return $attrItems;
@@ -398,31 +398,31 @@  discard block
 block discarded – undo
398 398
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items
399 399
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values
400 400
 	 */
401
-	protected function getAttributeItems( array $orderAttributes )
401
+	protected function getAttributeItems(array $orderAttributes)
402 402
 	{
403
-		if( empty( $orderAttributes ) ) {
403
+		if (empty($orderAttributes)) {
404 404
 			return [];
405 405
 		}
406 406
 
407
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
408
-		$search = $attributeManager->createSearch( true );
407
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
408
+		$search = $attributeManager->createSearch(true);
409 409
 		$expr = [];
410 410
 
411
-		foreach( $orderAttributes as $item )
411
+		foreach ($orderAttributes as $item)
412 412
 		{
413 413
 			$tmp = array(
414
-				$search->compare( '==', 'attribute.domain', 'product' ),
415
-				$search->compare( '==', 'attribute.code', $item->getValue() ),
416
-				$search->compare( '==', 'attribute.type.domain', 'product' ),
417
-				$search->compare( '==', 'attribute.type.code', $item->getCode() ),
418
-				$search->compare( '>', 'attribute.type.status', 0 ),
414
+				$search->compare('==', 'attribute.domain', 'product'),
415
+				$search->compare('==', 'attribute.code', $item->getValue()),
416
+				$search->compare('==', 'attribute.type.domain', 'product'),
417
+				$search->compare('==', 'attribute.type.code', $item->getCode()),
418
+				$search->compare('>', 'attribute.type.status', 0),
419 419
 				$search->getConditions(),
420 420
 			);
421
-			$expr[] = $search->combine( '&&', $tmp );
421
+			$expr[] = $search->combine('&&', $tmp);
422 422
 		}
423 423
 
424
-		$search->setConditions( $search->combine( '||', $expr ) );
425
-		return $attributeManager->searchItems( $search, array( 'price' ) );
424
+		$search->setConditions($search->combine('||', $expr));
425
+		return $attributeManager->searchItems($search, array('price'));
426 426
 	}
427 427
 
428 428
 
@@ -435,24 +435,24 @@  discard block
 block discarded – undo
435 435
 	 * @param array $quantities Associative list of attribute IDs as keys and their quantities as values
436 436
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
437 437
 	 */
438
-	protected function getOrderProductAttributes( $type, array $ids, array $values = [], array $quantities = [] )
438
+	protected function getOrderProductAttributes($type, array $ids, array $values = [], array $quantities = [])
439 439
 	{
440
-		if( empty( $ids ) ) {
440
+		if (empty($ids)) {
441 441
 			return [];
442 442
 		}
443 443
 
444 444
 		$list = [];
445
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
445
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
446 446
 
447
-		foreach( $this->getAttributes( $ids ) as $id => $attrItem )
447
+		foreach ($this->getAttributes($ids) as $id => $attrItem)
448 448
 		{
449 449
 			$item = $manager->createItem();
450
-			$item->copyFrom( $attrItem );
451
-			$item->setType( $type );
452
-			$item->setQuantity( isset( $quantities[$id] ) ? $quantities[$id] : 1 );
450
+			$item->copyFrom($attrItem);
451
+			$item->setType($type);
452
+			$item->setQuantity(isset($quantities[$id]) ? $quantities[$id] : 1);
453 453
 
454
-			if( isset( $values[$id] ) ) {
455
-				$item->setValue( $values[$id] );
454
+			if (isset($values[$id])) {
455
+				$item->setValue($values[$id]);
456 456
 			}
457 457
 
458 458
 			$list[] = $item;
@@ -469,23 +469,23 @@  discard block
 block discarded – undo
469 469
 	 * @param string $code Code of the list type
470 470
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface List type item
471 471
 	 */
472
-	protected function getProductListTypeItem( $domain, $code )
472
+	protected function getProductListTypeItem($domain, $code)
473 473
 	{
474 474
 		$context = $this->getContext();
475 475
 
476
-		if( empty( $this->listTypeItems ) )
476
+		if (empty($this->listTypeItems))
477 477
 		{
478
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
478
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
479 479
 
480
-			foreach( $manager->searchItems( $manager->createSearch( true ) ) as $item ) {
481
-				$this->listTypeItems[ $item->getDomain() ][ $item->getCode() ] = $item;
480
+			foreach ($manager->searchItems($manager->createSearch(true)) as $item) {
481
+				$this->listTypeItems[$item->getDomain()][$item->getCode()] = $item;
482 482
 			}
483 483
 		}
484 484
 
485
-		if( !isset( $this->listTypeItems[$domain][$code] ) )
485
+		if (!isset($this->listTypeItems[$domain][$code]))
486 486
 		{
487
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found' );
488
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, $code ) );
487
+			$msg = $context->getI18n()->dt('controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found');
488
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, $code));
489 489
 		}
490 490
 
491 491
 		return $this->listTypeItems[$domain][$code];
@@ -500,43 +500,43 @@  discard block
 block discarded – undo
500 500
 	 * @param array $domains Names of the domain items that should be fetched too
501 501
 	 * @return array List of products matching the given attributes
502 502
 	 */
503
-	protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
504
-			array $domains = array( 'attribute', 'media', 'price', 'text' ) )
503
+	protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
504
+			array $domains = array('attribute', 'media', 'price', 'text'))
505 505
 	{
506 506
 		$subProductIds = [];
507
-		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
507
+		foreach ($productItem->getRefItems('product', 'default', 'default') as $item) {
508 508
 			$subProductIds[] = $item->getId();
509 509
 		}
510 510
 
511
-		if( count( $subProductIds ) === 0 ) {
511
+		if (count($subProductIds) === 0) {
512 512
 			return [];
513 513
 		}
514 514
 
515
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
516
-		$search = $productManager->createSearch( true );
515
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
516
+		$search = $productManager->createSearch(true);
517 517
 
518 518
 		$expr = array(
519
-			$search->compare( '==', 'product.id', $subProductIds ),
519
+			$search->compare('==', 'product.id', $subProductIds),
520 520
 			$search->getConditions(),
521 521
 		);
522 522
 
523
-		if( count( $variantAttributeIds ) > 0 )
523
+		if (count($variantAttributeIds) > 0)
524 524
 		{
525
-			foreach( $variantAttributeIds as $key => $id ) {
525
+			foreach ($variantAttributeIds as $key => $id) {
526 526
 				$variantAttributeIds[$key] = (string) $id;
527 527
 			}
528 528
 
529
-			$listTypeItem = $this->getProductListTypeItem( 'attribute', 'variant' );
529
+			$listTypeItem = $this->getProductListTypeItem('attribute', 'variant');
530 530
 
531
-			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
532
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
531
+			$param = array('attribute', $listTypeItem->getId(), $variantAttributeIds);
532
+			$cmpfunc = $search->createFunction('product.contains', $param);
533 533
 
534
-			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
534
+			$expr[] = $search->compare('==', $cmpfunc, count($variantAttributeIds));
535 535
 		}
536 536
 
537
-		$search->setConditions( $search->combine( '&&', $expr ) );
537
+		$search->setConditions($search->combine('&&', $expr));
538 538
 
539
-		return $productManager->searchItems( $search, $domains );
539
+		return $productManager->searchItems($search, $domains);
540 540
 	}
541 541
 
542 542
 
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @param mixed $default Default value if no value is available for the given name
549 549
 	 * @return mixed Value from the array or default value
550 550
 	 */
551
-	protected function getValue( array $values, $name, $default = null )
551
+	protected function getValue(array $values, $name, $default = null)
552 552
 	{
553
-		if( isset( $values[$name] ) ) {
553
+		if (isset($values[$name])) {
554 554
 			return $values[$name];
555 555
 		}
556 556
 
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Supplier/StandardTest.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,34 +30,34 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 0, $filter->getSliceStart() );
35
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(0, $filter->getSliceStart());
35
+		$this->assertEquals(100, $filter->getSliceSize());
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetItem()
40 40
 	{
41 41
 		$context = \TestHelperFrontend::getContext();
42
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' );
43
-		$id = $manager->findItem( 'unitCode001' )->getId();
42
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'supplier');
43
+		$id = $manager->findItem('unitCode001')->getId();
44 44
 
45
-		$result = $this->object->getItem( $id );
45
+		$result = $this->object->getItem($id);
46 46
 
47
-		$this->assertInstanceOf( '\Aimeos\MShop\Supplier\Item\Iface', $result );
47
+		$this->assertInstanceOf('\Aimeos\MShop\Supplier\Item\Iface', $result);
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testGetItems()
52 52
 	{
53 53
 		$context = \TestHelperFrontend::getContext();
54
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' );
55
-		$id = $manager->findItem( 'unitCode001' )->getId();
54
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'supplier');
55
+		$id = $manager->findItem('unitCode001')->getId();
56 56
 
57
-		$result = $this->object->getItems( [$id] );
57
+		$result = $this->object->getItems([$id]);
58 58
 
59
-		$this->assertInternalType( 'array', $result );
60
-		$this->assertEquals( 1, count( $result ) );
59
+		$this->assertInternalType('array', $result);
60
+		$this->assertEquals(1, count($result));
61 61
 	}
62 62
 
63 63
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 		$filter = $this->object->createFilter();
67 67
 
68 68
 		$total = 0;
69
-		$results = $this->object->searchItems( $filter, [], $total );
69
+		$results = $this->object->searchItems($filter, [], $total);
70 70
 
71
-		$this->assertGreaterThanOrEqual( 2, $total );
72
-		$this->assertGreaterThanOrEqual( 2, count( $results ) );
71
+		$this->assertGreaterThanOrEqual(2, $total);
72
+		$this->assertGreaterThanOrEqual(2, count($results));
73 73
 	}
74 74
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Product/Standard.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
32 32
 	 * @since 2017.03
33 33
 	 */
34
-	public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds )
34
+	public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds)
35 35
 	{
36
-		if( ( $attrIds = $this->validateIds( $attrIds ) ) !== [] )
36
+		if (($attrIds = $this->validateIds($attrIds)) !== [])
37 37
 		{
38
-			$func = $filter->createFunction( 'index.attribute.all', [$attrIds] );
38
+			$func = $filter->createFunction('index.attribute.all', [$attrIds]);
39 39
 			$expr = array(
40
-				$filter->compare( '==', $func, count( $attrIds ) ),
40
+				$filter->compare('==', $func, count($attrIds)),
41 41
 				$filter->getConditions(),
42 42
 			);
43
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
43
+			$filter->setConditions($filter->combine('&&', $expr));
44 44
 		}
45 45
 
46
-		if( ( $optIds = $this->validateIds( $optIds ) ) !== [] )
46
+		if (($optIds = $this->validateIds($optIds)) !== [])
47 47
 		{
48 48
 			$expr = array(
49
-				$filter->compare( '==', 'index.attribute.id', $optIds ),
49
+				$filter->compare('==', 'index.attribute.id', $optIds),
50 50
 				$filter->getConditions(),
51 51
 			);
52
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
52
+			$filter->setConditions($filter->combine('&&', $expr));
53 53
 		}
54 54
 
55
-		foreach( $oneIds as $type => $list )
55
+		foreach ($oneIds as $type => $list)
56 56
 		{
57
-			if( ( $list = $this->validateIds( (array) $list ) ) !== [] )
57
+			if (($list = $this->validateIds((array) $list)) !== [])
58 58
 			{
59 59
 				$expr = array(
60
-					$filter->compare( '==', 'index.attribute.id', $list ),
60
+					$filter->compare('==', 'index.attribute.id', $list),
61 61
 					$filter->getConditions(),
62 62
 				);
63
-				$filter->setConditions( $filter->combine( '&&', $expr ) );
63
+				$filter->setConditions($filter->combine('&&', $expr));
64 64
 			}
65 65
 		}
66 66
 
@@ -80,38 +80,38 @@  discard block
 block discarded – undo
80 80
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
81 81
 	 * @since 2017.03
82 82
 	 */
83
-	public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId,
84
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' )
83
+	public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId,
84
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default')
85 85
 	{
86
-		$catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId );
86
+		$catIds = (!is_array($catId) ? explode(',', $catId) : $catId);
87 87
 
88
-		if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
88
+		if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
89 89
 		{
90 90
 			$list = [];
91
-			$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
91
+			$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
92 92
 
93
-			foreach( $catIds as $catId )
93
+			foreach ($catIds as $catId)
94 94
 			{
95
-				$tree = $cntl->getTree( $catId, [], $level );
96
-				$list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) );
95
+				$tree = $cntl->getTree($catId, [], $level);
96
+				$list = array_merge($list, $this->getCatalogIdsFromTree($tree));
97 97
 			}
98 98
 
99 99
 			$catIds = $list;
100 100
 		}
101 101
 
102
-		$expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) );
102
+		$expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds)));
103 103
 		$expr[] = $filter->getConditions();
104 104
 
105
-		if( $sort === 'relevance' )
105
+		if ($sort === 'relevance')
106 106
 		{
107
-			$cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) );
108
-			$expr[] = $filter->compare( '>=', $cmpfunc, 0 );
107
+			$cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds));
108
+			$expr[] = $filter->compare('>=', $cmpfunc, 0);
109 109
 
110
-			$sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) );
111
-			$filter->setSortations( [$filter->sort( $direction, $sortfunc ), $filter->sort( '+', 'product.id' )] );
110
+			$sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds));
111
+			$filter->setSortations([$filter->sort($direction, $sortfunc), $filter->sort('+', 'product.id')]);
112 112
 		}
113 113
 
114
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
114
+		$filter->setConditions($filter->combine('&&', $expr));
115 115
 
116 116
 		return $filter;
117 117
 	}
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
126 126
 	 * @since 2018.07
127 127
 	 */
128
-	public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds )
128
+	public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds)
129 129
 	{
130
-		if( !empty( $supIds ) )
130
+		if (!empty($supIds))
131 131
 		{
132
-			$supIds = $this->validateIds( $supIds );
132
+			$supIds = $this->validateIds($supIds);
133 133
 			$expr = array(
134
-				$filter->compare( '==', 'index.supplier.id', $supIds ),
134
+				$filter->compare('==', 'index.supplier.id', $supIds),
135 135
 				$filter->getConditions(),
136 136
 			);
137
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
137
+			$filter->setConditions($filter->combine('&&', $expr));
138 138
 		}
139 139
 
140 140
 		return $filter;
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
153 153
 	 * @since 2017.03
154 154
 	 */
155
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' )
155
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default')
156 156
 	{
157 157
 		$langid = $this->getContext()->getLocale()->getLanguageId();
158
-		$cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) );
159
-		$expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() );
158
+		$cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input));
159
+		$expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions());
160 160
 
161
-		return $filter->setConditions( $filter->combine( '&&', $expr ) );
161
+		return $filter->setConditions($filter->combine('&&', $expr));
162 162
 	}
163 163
 
164 164
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 * @return array Associative list of key values as key and the product count for this key as value
171 171
 	 * @since 2017.03
172 172
 	 */
173
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key )
173
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key)
174 174
 	{
175
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key );
175
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key);
176 176
 	}
177 177
 
178 178
 
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
188 188
 	 * @since 2017.03
189 189
 	 */
190
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
190
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
191 191
 	{
192 192
 		$sortations = [];
193 193
 		$context = $this->getContext();
194
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'index' );
194
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'index');
195 195
 
196 196
 
197 197
 		/** controller/frontend/product/ignore-dates
@@ -206,55 +206,55 @@  discard block
 block discarded – undo
206 206
 		 * @since 2017.10
207 207
 		 * @category Developer
208 208
 		 */
209
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
209
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
210 210
 		{
211 211
 			$search = $manager->createSearch();
212
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
212
+			$search->setConditions($search->compare('>', 'product.status', 0));
213 213
 		}
214 214
 		else
215 215
 		{
216
-			$search = $manager->createSearch( true );
216
+			$search = $manager->createSearch(true);
217 217
 		}
218 218
 
219 219
 
220
-		$expr = array( $search->compare( '!=', 'index.catalog.id', null ) );
220
+		$expr = array($search->compare('!=', 'index.catalog.id', null));
221 221
 
222
-		switch( $sort )
222
+		switch ($sort)
223 223
 		{
224 224
 			case 'code':
225
-				$sortations[] = $search->sort( $direction, 'product.code' );
225
+				$sortations[] = $search->sort($direction, 'product.code');
226 226
 				break;
227 227
 
228 228
 			case 'ctime':
229
-				$sortations[] = $search->sort( $direction, 'product.ctime' );
229
+				$sortations[] = $search->sort($direction, 'product.ctime');
230 230
 				break;
231 231
 
232 232
 			case 'name':
233 233
 				$langid = $context->getLocale()->getLanguageId();
234 234
 
235
-				$cmpfunc = $search->createFunction( 'index.text.name', [$langid, ''] );
236
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
235
+				$cmpfunc = $search->createFunction('index.text.name', [$langid, '']);
236
+				$expr[] = $search->compare('!=', $cmpfunc, null);
237 237
 
238
-				$sortfunc = $search->createFunction( 'sort:index.text.name', [$langid, ''] );
239
-				$sortations[] = $search->sort( $direction, $sortfunc );
238
+				$sortfunc = $search->createFunction('sort:index.text.name', [$langid, '']);
239
+				$sortations[] = $search->sort($direction, $sortfunc);
240 240
 				break;
241 241
 
242 242
 			case 'price':
243 243
 				$currencyid = $context->getLocale()->getCurrencyId();
244 244
 
245
-				$cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) );
246
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
245
+				$cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default'));
246
+				$expr[] = $search->compare('!=', $cmpfunc, null);
247 247
 
248
-				$sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) );
249
-				$sortations[] = $search->sort( $direction, $sortfunc );
248
+				$sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default'));
249
+				$sortations[] = $search->sort($direction, $sortfunc);
250 250
 				break;
251 251
 		}
252 252
 
253 253
 		$expr[] = $search->getConditions();
254 254
 
255
-		$search->setConditions( $search->combine( '&&', $expr ) );
256
-		$search->setSortations( $sortations );
257
-		$search->setSlice( $start, $size );
255
+		$search->setConditions($search->combine('&&', $expr));
256
+		$search->setSortations($sortations);
257
+		$search->setSlice($start, $size);
258 258
 
259 259
 		return $search;
260 260
 	}
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
269 269
 	 * @since 2017.03
270 270
 	 */
271
-	public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) )
271
+	public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'))
272 272
 	{
273
-		$items = $this->getItems( [$productId], $domains );
273
+		$items = $this->getItems([$productId], $domains);
274 274
 
275
-		if( ( $item = reset( $items ) ) !== false ) {
275
+		if (($item = reset($items)) !== false) {
276 276
 			return $item;
277 277
 		}
278 278
 
279
-		throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) );
279
+		throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId));
280 280
 	}
281 281
 
282 282
 
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 	 * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values
289 289
 	 * @since 2017.03
290 290
 	 */
291
-	public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) )
291
+	public function getItems(array $productIds, array $domains = array('media', 'price', 'text'))
292 292
 	{
293 293
 		$context = $this->getContext();
294
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
294
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
295 295
 
296 296
 		/** controller/frontend/order/ignore-dates
297 297
 		 * Ignore start and end dates of products
@@ -305,25 +305,25 @@  discard block
 block discarded – undo
305 305
 		 * @since 2017.08
306 306
 		 * @category Developer
307 307
 		 */
308
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
308
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
309 309
 		{
310 310
 			$search = $manager->createSearch();
311
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
311
+			$search->setConditions($search->compare('>', 'product.status', 0));
312 312
 		}
313 313
 		else
314 314
 		{
315
-			$search = $manager->createSearch( true );
315
+			$search = $manager->createSearch(true);
316 316
 		}
317 317
 
318 318
 		$expr = array(
319
-			$search->compare( '==', 'product.id', $productIds ),
319
+			$search->compare('==', 'product.id', $productIds),
320 320
 			$search->getConditions(),
321 321
 		);
322
-		$search->setConditions( $search->combine( '&&', $expr ) );
323
-		$search->setSortations( [$search->sort( '+', 'product.type.position' )] );
324
-		$search->setSlice( 0, count( $productIds ) );
322
+		$search->setConditions($search->combine('&&', $expr));
323
+		$search->setSortations([$search->sort('+', 'product.type.position')]);
324
+		$search->setSlice(0, count($productIds));
325 325
 
326
-		return $manager->searchItems( $search, $domains );
326
+		return $manager->searchItems($search, $domains);
327 327
 	}
328 328
 
329 329
 
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
337 337
 	 * @since 2017.03
338 338
 	 */
339
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
339
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
340 340
 	{
341
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
341
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
342 342
 	}
343 343
 
344 344
 
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
349 349
 	 * @return array List of catalog IDs
350 350
 	 */
351
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
351
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
352 352
 	{
353
-		if( $item->getStatus() < 1 ) {
353
+		if ($item->getStatus() < 1) {
354 354
 			return [];
355 355
 		}
356 356
 
357
-		$list = [ $item->getId() ];
357
+		$list = [$item->getId()];
358 358
 
359
-		foreach( $item->getChildren() as $child ) {
360
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
359
+		foreach ($item->getChildren() as $child) {
360
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
361 361
 		}
362 362
 
363 363
 		return $list;
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 	 * @param array $ids List of IDs to validate
371 371
 	 * @return array List of validated IDs
372 372
 	 */
373
-	protected function validateIds( array $ids )
373
+	protected function validateIds(array $ids)
374 374
 	{
375 375
 		$list = [];
376 376
 
377
-		foreach( $ids as $id )
377
+		foreach ($ids as $id)
378 378
 		{
379
-			if( $id != '' ) {
379
+			if ($id != '') {
380 380
 				$list[] = (int) $id;
381 381
 			}
382 382
 		}
Please login to merge, or discard this patch.