Completed
Push — master ( bba6c0...902cec )
by Aimeos
02:50
created
controller/frontend/tests/Controller/Frontend/Customer/StandardTest.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -18,121 +18,121 @@  discard block
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context );
21
+		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context);
22 22
 	}
23 23
 
24 24
 
25 25
 	protected function tearDown()
26 26
 	{
27
-		unset( $this->context, $this->object );
27
+		unset($this->context, $this->object);
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testAddEditSaveDeleteItem()
32 32
 	{
33
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
34
-		$id = $manager->findItem( 'UTC001' )->getId();
33
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
34
+		$id = $manager->findItem('UTC001')->getId();
35 35
 
36
-		$this->context->setUserId( $id );
37
-		$item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] );
38
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
36
+		$this->context->setUserId($id);
37
+		$item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]);
38
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
39 39
 
40
-		$this->context->setUserId( $item->getId() );
41
-		$item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] );
42
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
40
+		$this->context->setUserId($item->getId());
41
+		$item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']);
42
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
43 43
 
44
-		$item->setStatus( 0 );
45
-		$item = $this->object->saveItem( $item );
46
-		$this->assertEquals( 0, $item->getStatus() );
44
+		$item->setStatus(0);
45
+		$item = $this->object->saveItem($item);
46
+		$this->assertEquals(0, $item->getStatus());
47 47
 
48
-		$this->object->deleteItem( $item->getId() );
48
+		$this->object->deleteItem($item->getId());
49 49
 
50
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
51
-		$manager->findItem( 'unittest-ctnl' );
50
+		$this->setExpectedException('\Aimeos\MShop\Exception');
51
+		$manager->findItem('unittest-ctnl');
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testAddExistingItem()
56 56
 	{
57
-		$item = $this->object->addItem( ['customer.code' => 'UTC001'] );
58
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
57
+		$item = $this->object->addItem(['customer.code' => 'UTC001']);
58
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testCreateItem()
63 63
 	{
64 64
 		$result = $this->object->createItem();
65
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
65
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testGetItem()
70 70
 	{
71
-		$id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId();
72
-		$this->context->setUserId( $id );
71
+		$id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId();
72
+		$this->context->setUserId($id);
73 73
 
74
-		$result = $this->object->getItem( $id, ['customer/address', 'text'] );
74
+		$result = $this->object->getItem($id, ['customer/address', 'text']);
75 75
 
76
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
77
-		$this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) );
78
-		$this->assertEquals( 1, count( $result->getAddressItems() ) );
76
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
77
+		$this->assertEquals(1, count($result->getRefItems('text')));
78
+		$this->assertEquals(1, count($result->getAddressItems()));
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testFindItem()
83 83
 	{
84
-		$result = $this->object->findItem( 'UTC001' );
85
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
84
+		$result = $this->object->findItem('UTC001');
85
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testAddEditSaveDeleteAddressItem()
90 90
 	{
91
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
92
-		$this->context->setUserId( $customer->getId() );
91
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
92
+		$this->context->setUserId($customer->getId());
93 93
 
94
-		$item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] );
95
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
94
+		$item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']);
95
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
96 96
 
97
-		$item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] );
98
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
97
+		$item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']);
98
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
99 99
 
100
-		$item->setLastName( 'test' );
101
-		$this->object->saveAddressItem( $item );
102
-		$this->assertEquals( 'test', $item->getLastName() );
100
+		$item->setLastName('test');
101
+		$this->object->saveAddressItem($item);
102
+		$this->assertEquals('test', $item->getLastName());
103 103
 
104
-		$this->object->deleteAddressItem( $item->getId() );
104
+		$this->object->deleteAddressItem($item->getId());
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testCreateAddressItem()
109 109
 	{
110 110
 		$result = $this->object->createAddressItem();
111
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
111
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testGetAddressItem()
116 116
 	{
117
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' );
117
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address');
118 118
 		$search = $manager->createSearch();
119
-		$search->setSlice( 0, 1 );
120
-		$result = $manager->searchItems( $search );
119
+		$search->setSlice(0, 1);
120
+		$result = $manager->searchItems($search);
121 121
 
122
-		if( ( $item = reset( $result ) ) === false ) {
123
-			throw new \RuntimeException( 'No customer address available' );
122
+		if (($item = reset($result)) === false) {
123
+			throw new \RuntimeException('No customer address available');
124 124
 		}
125 125
 
126
-		$this->context->setUserId( $item->getParentId() );
127
-		$result = $this->object->getAddressItem( $item->getId() );
128
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
126
+		$this->context->setUserId($item->getParentId());
127
+		$result = $this->object->getAddressItem($item->getId());
128
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
129 129
 	}
130 130
 
131 131
 
132 132
 	public function testAddEditDeleteListItem()
133 133
 	{
134
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
135
-		$this->context->setUserId( $customer->getId() );
134
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
135
+		$this->context->setUserId($customer->getId());
136 136
 
137 137
 		$values = [
138 138
 			'customer.lists.type' => 'favorite',
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 			'customer.lists.refid' => '-1'
141 141
 		];
142 142
 
143
-		$item = $this->object->addListItem( $values );
144
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
143
+		$item = $this->object->addListItem($values);
144
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
145 145
 
146 146
 		$values = [
147 147
 			'customer.lists.type' => 'favorite',
@@ -149,46 +149,46 @@  discard block
 block discarded – undo
149 149
 			'customer.lists.refid' => '-2'
150 150
 		];
151 151
 
152
-		$item = $this->object->editListItem( $item->getId(), $values );
153
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
152
+		$item = $this->object->editListItem($item->getId(), $values);
153
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
154 154
 
155
-		$this->object->deleteListItem( $item->getId() );
155
+		$this->object->deleteListItem($item->getId());
156 156
 
157
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
158
-		$this->object->getListItem( $item->getId() );
157
+		$this->setExpectedException('\Aimeos\MShop\Exception');
158
+		$this->object->getListItem($item->getId());
159 159
 	}
160 160
 
161 161
 
162 162
 	public function testGetListItem()
163 163
 	{
164
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' );
164
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists');
165 165
 		$search = $manager->createSearch();
166
-		$search->setSlice( 0, 1 );
167
-		$result = $manager->searchItems( $search );
166
+		$search->setSlice(0, 1);
167
+		$result = $manager->searchItems($search);
168 168
 
169
-		if( ( $item = reset( $result ) ) === false ) {
170
-			throw new \RuntimeException( 'No customer lists item available' );
169
+		if (($item = reset($result)) === false) {
170
+			throw new \RuntimeException('No customer lists item available');
171 171
 		}
172 172
 
173
-		$this->context->setUserId( $item->getParentId() );
174
-		$result = $this->object->getListItem( $item->getId() );
175
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result );
173
+		$this->context->setUserId($item->getParentId());
174
+		$result = $this->object->getListItem($item->getId());
175
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result);
176 176
 	}
177 177
 
178 178
 
179 179
 	public function testSearchListItem()
180 180
 	{
181
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
182
-		$customer = $manager->findItem( 'UTC001' );
183
-		$this->context->setUserId( $customer->getId() );
181
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
182
+		$customer = $manager->findItem('UTC001');
183
+		$this->context->setUserId($customer->getId());
184 184
 
185 185
 		$filter = $this->object->createListsFilter();
186
-		$result = $this->object->searchListItems( $filter );
186
+		$result = $this->object->searchListItems($filter);
187 187
 
188
-		foreach( $result as $item )
188
+		foreach ($result as $item)
189 189
 		{
190
-			$this->assertEquals( $customer->getId(), $item->getParentId() );
191
-			$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
190
+			$this->assertEquals($customer->getId(), $item->getParentId());
191
+			$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
192 192
 		}
193 193
 	}
194 194
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Product/Standard.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@  discard block
 block discarded – undo
180 180
 		{
181 181
 			$search = $manager->createSearch();
182 182
 			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
183
-		}
184
-		else
183
+		} else
185 184
 		{
186 185
 			$search = $manager->createSearch( true );
187 186
 		}
@@ -275,8 +274,7 @@  discard block
 block discarded – undo
275 274
 		{
276 275
 			$search = $manager->createSearch();
277 276
 			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
278
-		}
279
-		else
277
+		} else
280 278
 		{
281 279
 			$search = $manager->createSearch( true );
282 280
 		}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * Returns the given search filter with the conditions attached for filtering by suppliers.
124 124
 	 *
125 125
 	 * @param \Aimeos\MW\Criteria\Iface $filter Criteria object used for product search
126
-	 * @param array $supIds List of supplier IDs for faceted search
126
+	 * @param integer[] $supIds List of supplier IDs for faceted search
127 127
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
128 128
 	 * @since 2018.07
129 129
 	 */
@@ -334,6 +334,7 @@  discard block
 block discarded – undo
334 334
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
335 335
 	 * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too
336 336
 	 * @param integer &$total Parameter where the total number of found products will be stored in
337
+	 * @param integer $total
337 338
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
338 339
 	 * @since 2017.03
339 340
 	 */
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 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, null ),
40
+				$filter->compare('!=', $func, null),
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,24 +305,24 @@  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->setSlice( 0, count( $productIds ) );
322
+		$search->setConditions($search->combine('&&', $expr));
323
+		$search->setSlice(0, count($productIds));
324 324
 
325
-		return $manager->searchItems( $search, $domains );
325
+		return $manager->searchItems($search, $domains);
326 326
 	}
327 327
 
328 328
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
336 336
 	 * @since 2017.03
337 337
 	 */
338
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
338
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
339 339
 	{
340
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
340
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
341 341
 	}
342 342
 
343 343
 
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
348 348
 	 * @return array List of catalog IDs
349 349
 	 */
350
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
350
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
351 351
 	{
352
-		if( $item->getStatus() < 1 ) {
352
+		if ($item->getStatus() < 1) {
353 353
 			return [];
354 354
 		}
355 355
 
356
-		$list = [ $item->getId() ];
356
+		$list = [$item->getId()];
357 357
 
358
-		foreach( $item->getChildren() as $child ) {
359
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
358
+		foreach ($item->getChildren() as $child) {
359
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
360 360
 		}
361 361
 
362 362
 		return $list;
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
 	 * @param array $ids List of IDs to validate
370 370
 	 * @return array List of validated IDs
371 371
 	 */
372
-	protected function validateIds( array $ids )
372
+	protected function validateIds(array $ids)
373 373
 	{
374 374
 		$list = [];
375 375
 
376
-		foreach( $ids as $id )
376
+		foreach ($ids as $id)
377 377
 		{
378
-			if( $id != '' ) {
378
+			if ($id != '') {
379 379
 				$list[] = (int) $id;
380 380
 			}
381 381
 		}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Standard.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -431,17 +431,14 @@
 block discarded – undo
431 431
 		{
432 432
 			$address->copyFrom( $value );
433 433
 			$this->get()->setAddress( $address, $type );
434
-		}
435
-		else if( is_array( $value ) )
434
+		} else if( is_array( $value ) )
436 435
 		{
437 436
 			$this->setAddressFromArray( $address, $value );
438 437
 			$this->get()->setAddress( $address, $type );
439
-		}
440
-		else if( $value === null )
438
+		} else if( $value === null )
441 439
 		{
442 440
 			$this->get()->deleteAddress( $type );
443
-		}
444
-		else
441
+		} else
445 442
 		{
446 443
 			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid value for address type "%1$s"' );
447 444
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $type ) );
Please login to merge, or discard this patch.
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,6 @@
 block discarded – undo
150 150
 	 * Adds the delivery/payment service item based on the service ID.
151 151
 	 *
152 152
 	 * @param string $type Service type code like 'payment' or 'delivery'
153
-	 * @param string $id|null Unique ID of the service item or null to remove it
154 153
 	 * @param array $attributes Associative list of key/value pairs containing the attributes selected or
155 154
 	 * 	entered by the customer when choosing one of the delivery or payment options
156 155
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases
34 34
 	 *  connections, logger, session, etc.
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
36
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
37 37
 	{
38
-		parent::__construct( $context );
38
+		parent::__construct($context);
39 39
 
40
-		$this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
40
+		$this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
41 41
 	}
42 42
 
43 43
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function clear()
50 50
 	{
51 51
 		$this->baskets[$this->type] = $this->domainManager->createItem();
52
-		$this->domainManager->setSession( $this->baskets[$this->type], $this->type );
52
+		$this->domainManager->setSession($this->baskets[$this->type], $this->type);
53 53
 
54 54
 		return $this;
55 55
 	}
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function get()
64 64
 	{
65
-		if( !isset( $this->baskets[$this->type] ) )
65
+		if (!isset($this->baskets[$this->type]))
66 66
 		{
67
-			$this->baskets[$this->type] = $this->domainManager->getSession( $this->type );
68
-			$this->checkLocale( $this->baskets[$this->type]->getLocale(), $this->type );
67
+			$this->baskets[$this->type] = $this->domainManager->getSession($this->type);
68
+			$this->checkLocale($this->baskets[$this->type]->getLocale(), $this->type);
69 69
 		}
70 70
 
71 71
 		return $this->baskets[$this->type];
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function save()
81 81
 	{
82
-		if( isset( $this->baskets[$this->type] ) && $this->baskets[$this->type]->isModified() ) {
83
-			$this->domainManager->setSession( $this->baskets[$this->type], $this->type );
82
+		if (isset($this->baskets[$this->type]) && $this->baskets[$this->type]->isModified()) {
83
+			$this->domainManager->setSession($this->baskets[$this->type], $this->type);
84 84
 		}
85 85
 
86 86
 		return $this;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param string $type Basket type
94 94
 	 * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object
95 95
 	 */
96
-	public function setType( $type )
96
+	public function setType($type)
97 97
 	{
98 98
 		$this->type = $type;
99 99
 		return $this;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		 * @category Developer
128 128
 		 * @see controller/frontend/basket/limit-seconds
129 129
 		 */
130
-		$count = $config->get( 'controller/frontend/basket/limit-count', 5 );
130
+		$count = $config->get('controller/frontend/basket/limit-count', 5);
131 131
 
132 132
 		/** controller/frontend/basket/limit-seconds
133 133
 		 * Order limitation time frame in seconds
@@ -145,33 +145,33 @@  discard block
 block discarded – undo
145 145
 		 * @category Developer
146 146
 		 * @see controller/frontend/basket/limit-count
147 147
 		 */
148
-		$seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 );
148
+		$seconds = $config->get('controller/frontend/basket/limit-seconds', 300);
149 149
 
150 150
 		$search = $this->domainManager->createSearch();
151 151
 		$expr = [
152
-			$search->compare( '==', 'order.base.editor', $context->getEditor() ),
153
-			$search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
152
+			$search->compare('==', 'order.base.editor', $context->getEditor()),
153
+			$search->compare('>=', 'order.base.ctime', date('Y-m-d H:i:s', time() - $seconds)),
154 154
 		];
155
-		$search->setConditions( $search->combine( '&&', $expr ) );
156
-		$search->setSlice( 0, 0 );
155
+		$search->setConditions($search->combine('&&', $expr));
156
+		$search->setSlice(0, 0);
157 157
 
158
-		$this->domainManager->searchItems( $search, [], $total );
158
+		$this->domainManager->searchItems($search, [], $total);
159 159
 
160
-		if( $total > $count )
160
+		if ($total > $count)
161 161
 		{
162
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Temporary order limit reached' );
163
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
162
+			$msg = $context->getI18n()->dt('controller/frontend', 'Temporary order limit reached');
163
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
164 164
 		}
165 165
 
166 166
 
167 167
 		$basket = $this->get()->finish();
168
-		$basket->setCustomerId( (string) $context->getUserId() );
168
+		$basket->setCustomerId((string) $context->getUserId());
169 169
 
170 170
 		$this->domainManager->begin();
171
-		$this->domainManager->store( $basket );
171
+		$this->domainManager->store($basket);
172 172
 		$this->domainManager->commit();
173 173
 
174
-		$this->createSubscriptions( $basket );
174
+		$this->createSubscriptions($basket);
175 175
 
176 176
 		return $basket;
177 177
 	}
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 	 * @param boolean $default True to add default criteria (user logged in), false if not
186 186
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
187 187
 	 */
188
-	public function load( $id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true )
188
+	public function load($id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true)
189 189
 	{
190
-		return $this->domainManager->load( $id, $parts, false, $default );
190
+		return $this->domainManager->load($id, $parts, false, $default);
191 191
 	}
192 192
 
193 193
 
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
207 207
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
208 208
 	 */
209
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
210
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
209
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
210
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
211 211
 	{
212 212
 		$attributeMap = [
213
-			'custom' => array_keys( $customAttributeValues ),
214
-			'config' => array_keys( $configAttributeIds ),
213
+			'custom' => array_keys($customAttributeValues),
214
+			'config' => array_keys($configAttributeIds),
215 215
 		];
216
-		$this->checkListRef( $prodid, 'attribute', $attributeMap );
216
+		$this->checkListRef($prodid, 'attribute', $attributeMap);
217 217
 
218 218
 
219 219
 		$context = $this->getContext();
220
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
220
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
221 221
 
222
-		$productItem = $productManager->getItem( $prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true );
223
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
224
-		$hidden = $productItem->getRefItems( 'attribute', null, 'hidden' );
222
+		$productItem = $productManager->getItem($prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true);
223
+		$prices = $productItem->getRefItems('price', 'default', 'default');
224
+		$hidden = $productItem->getRefItems('attribute', null, 'hidden');
225 225
 
226
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
227
-		$orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype );
226
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
227
+		$orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype);
228 228
 
229
-		$custAttr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues );
230
-		$confAttr = $this->getOrderProductAttributes( 'config', array_keys( $configAttributeIds ), [], $configAttributeIds );
231
-		$attr = array_merge( $custAttr, $confAttr, $this->getOrderProductAttributes( 'hidden', array_keys( $hidden ) ) );
229
+		$custAttr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues);
230
+		$confAttr = $this->getOrderProductAttributes('config', array_keys($configAttributeIds), [], $configAttributeIds);
231
+		$attr = array_merge($custAttr, $confAttr, $this->getOrderProductAttributes('hidden', array_keys($hidden)));
232 232
 
233
-		$orderBaseProductItem->setAttributes( $attr );
234
-		$orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) );
233
+		$orderBaseProductItem->setAttributes($attr);
234
+		$orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity));
235 235
 
236
-		$this->get()->addProduct( $orderBaseProductItem );
236
+		$this->get()->addProduct($orderBaseProductItem);
237 237
 		$this->save();
238 238
 	}
239 239
 
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param integer $position Position number (key) of the order product item
245 245
 	 */
246
-	public function deleteProduct( $position )
246
+	public function deleteProduct($position)
247 247
 	{
248
-		$product = $this->get()->getProduct( $position );
248
+		$product = $this->get()->getProduct($position);
249 249
 
250
-		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
250
+		if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
251 251
 		{
252
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually' );
253
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) );
252
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually');
253
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position));
254 254
 		}
255 255
 
256
-		$this->get()->deleteProduct( $position );
256
+		$this->get()->deleteProduct($position);
257 257
 		$this->save();
258 258
 	}
259 259
 
@@ -265,32 +265,32 @@  discard block
 block discarded – undo
265 265
 	 * @param integer $quantity New quantiy of the product item
266 266
 	 * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED
267 267
 	 */
268
-	public function editProduct( $position, $quantity, array $configAttributeCodes = [] )
268
+	public function editProduct($position, $quantity, array $configAttributeCodes = [])
269 269
 	{
270
-		$product = $this->get()->getProduct( $position );
270
+		$product = $this->get()->getProduct($position);
271 271
 
272
-		if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
272
+		if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
273 273
 		{
274
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be changed' );
275
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) );
274
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be changed');
275
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position));
276 276
 		}
277 277
 
278
-		$product->setQuantity( $quantity );
278
+		$product->setQuantity($quantity);
279 279
 
280 280
 		$attributes = $product->getAttributes();
281
-		foreach( $attributes as $key => $attribute )
281
+		foreach ($attributes as $key => $attribute)
282 282
 		{
283
-			if( in_array( $attribute->getCode(), $configAttributeCodes ) ) {
284
-				unset( $attributes[$key] );
283
+			if (in_array($attribute->getCode(), $configAttributeCodes)) {
284
+				unset($attributes[$key]);
285 285
 			}
286 286
 		}
287
-		$product->setAttributes( $attributes );
287
+		$product->setAttributes($attributes);
288 288
 
289
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
290
-		$productItem = $manager->findItem( $product->getProductCode(), array( 'price', 'text' ), true );
291
-		$product->setPrice( $this->calcPrice( $product, $productItem->getRefItems( 'price', 'default' ), $quantity ) );
289
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
290
+		$productItem = $manager->findItem($product->getProductCode(), array('price', 'text'), true);
291
+		$product->setPrice($this->calcPrice($product, $productItem->getRefItems('price', 'default'), $quantity));
292 292
 
293
-		$this->get()->editProduct( $product, $position );
293
+		$this->get()->editProduct($product, $position);
294 294
 
295 295
 		$this->save();
296 296
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param string $code Coupon code entered by the user
303 303
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
304 304
 	 */
305
-	public function addCoupon( $code )
305
+	public function addCoupon($code)
306 306
 	{
307 307
 		$context = $this->getContext();
308 308
 
@@ -322,39 +322,39 @@  discard block
 block discarded – undo
322 322
 		 * @category User
323 323
 		 * @category Developer
324 324
 		 */
325
-		$allowed = $context->getConfig()->get( 'controller/frontend/basket/standard/coupon/allowed', 1 );
325
+		$allowed = $context->getConfig()->get('controller/frontend/basket/standard/coupon/allowed', 1);
326 326
 
327
-		if( $allowed <= count( $this->get()->getCoupons() ) )
327
+		if ($allowed <= count($this->get()->getCoupons()))
328 328
 		{
329
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Number of coupon codes exceeds the limit' );
330
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
329
+			$msg = $context->getI18n()->dt('controller/frontend', 'Number of coupon codes exceeds the limit');
330
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
331 331
 		}
332 332
 
333 333
 
334
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' );
334
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'coupon');
335 335
 
336 336
 		$search = $manager->createSearch();
337
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
338
-		$search->setSlice( 0, 1 );
337
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
338
+		$search->setSlice(0, 1);
339 339
 
340
-		$result = $manager->searchItems( $search );
340
+		$result = $manager->searchItems($search);
341 341
 
342
-		if( ( $item = reset( $result ) ) === false )
342
+		if (($item = reset($result)) === false)
343 343
 		{
344
-			$msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid or not available any more' ), $code );
345
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
344
+			$msg = sprintf($context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid or not available any more'), $code);
345
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
346 346
 		}
347 347
 
348 348
 
349
-		$provider = $manager->getProvider( $item, $code );
349
+		$provider = $manager->getProvider($item, $code);
350 350
 
351
-		if( $provider->isAvailable( $this->get() ) !== true )
351
+		if ($provider->isAvailable($this->get()) !== true)
352 352
 		{
353
-			$msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met' ), $code );
354
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
353
+			$msg = sprintf($context->getI18n()->dt('controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met'), $code);
354
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
355 355
 		}
356 356
 
357
-		$provider->addCoupon( $this->get() );
357
+		$provider->addCoupon($this->get());
358 358
 		$this->save();
359 359
 	}
360 360
 
@@ -365,24 +365,24 @@  discard block
 block discarded – undo
365 365
 	 * @param string $code Coupon code entered by the user
366 366
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
367 367
 	 */
368
-	public function deleteCoupon( $code )
368
+	public function deleteCoupon($code)
369 369
 	{
370 370
 		$context = $this->getContext();
371
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' );
371
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'coupon');
372 372
 
373 373
 		$search = $manager->createSearch();
374
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
375
-		$search->setSlice( 0, 1 );
374
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
375
+		$search->setSlice(0, 1);
376 376
 
377
-		$result = $manager->searchItems( $search );
377
+		$result = $manager->searchItems($search);
378 378
 
379
-		if( ( $item = reset( $result ) ) === false )
379
+		if (($item = reset($result)) === false)
380 380
 		{
381
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid' );
382
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $code ) );
381
+			$msg = $context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid');
382
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $code));
383 383
 		}
384 384
 
385
-		$manager->getProvider( $item, $code )->deleteCoupon( $this->get() );
385
+		$manager->getProvider($item, $code)->deleteCoupon($this->get());
386 386
 		$this->save();
387 387
 	}
388 388
 
@@ -395,30 +395,30 @@  discard block
 block discarded – undo
395 395
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of
396 396
 	 * 	if one of the keys is invalid when using an array with key/value pairs
397 397
 	 */
398
-	public function setAddress( $type, $value )
398
+	public function setAddress($type, $value)
399 399
 	{
400 400
 		$context = $this->getContext();
401
-		$address = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' )->createItem();
402
-		$address->setType( $type );
401
+		$address = \Aimeos\MShop\Factory::createManager($context, 'order/base/address')->createItem();
402
+		$address->setType($type);
403 403
 
404
-		if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface )
404
+		if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface)
405 405
 		{
406
-			$address->copyFrom( $value );
407
-			$this->get()->setAddress( $address, $type );
406
+			$address->copyFrom($value);
407
+			$this->get()->setAddress($address, $type);
408 408
 		}
409
-		else if( is_array( $value ) )
409
+		else if (is_array($value))
410 410
 		{
411
-			$this->setAddressFromArray( $address, $value );
412
-			$this->get()->setAddress( $address, $type );
411
+			$this->setAddressFromArray($address, $value);
412
+			$this->get()->setAddress($address, $type);
413 413
 		}
414
-		else if( $value === null )
414
+		else if ($value === null)
415 415
 		{
416
-			$this->get()->deleteAddress( $type );
416
+			$this->get()->deleteAddress($type);
417 417
 		}
418 418
 		else
419 419
 		{
420
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid value for address type "%1$s"' );
421
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $type ) );
420
+			$msg = $context->getI18n()->dt('controller/frontend', 'Invalid value for address type "%1$s"');
421
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $type));
422 422
 		}
423 423
 
424 424
 		$this->save();
@@ -434,42 +434,42 @@  discard block
 block discarded – undo
434 434
 	 * 	entered by the customer when choosing one of the delivery or payment options
435 435
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
436 436
 	 */
437
-	public function addService( $type, $id, array $attributes = [] )
437
+	public function addService($type, $id, array $attributes = [])
438 438
 	{
439 439
 		$context = $this->getContext();
440 440
 
441
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
442
-		$serviceItem = $serviceManager->getItem( $id, array( 'media', 'price', 'text' ) );
441
+		$serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
442
+		$serviceItem = $serviceManager->getItem($id, array('media', 'price', 'text'));
443 443
 
444
-		$provider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() );
445
-		$result = $provider->checkConfigFE( $attributes );
446
-		$unknown = array_diff_key( $attributes, $result );
444
+		$provider = $serviceManager->getProvider($serviceItem, $serviceItem->getType());
445
+		$result = $provider->checkConfigFE($attributes);
446
+		$unknown = array_diff_key($attributes, $result);
447 447
 
448
-		if( count( $unknown ) > 0 )
448
+		if (count($unknown) > 0)
449 449
 		{
450
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Unknown attributes "%1$s"' );
451
-			$msg = sprintf( $msg, implode( '","', array_keys( $unknown ) ) );
452
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
450
+			$msg = $context->getI18n()->dt('controller/frontend', 'Unknown attributes "%1$s"');
451
+			$msg = sprintf($msg, implode('","', array_keys($unknown)));
452
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
453 453
 		}
454 454
 
455
-		foreach( $result as $key => $value )
455
+		foreach ($result as $key => $value)
456 456
 		{
457
-			if( $value !== null ) {
458
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $value );
457
+			if ($value !== null) {
458
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($value);
459 459
 			}
460 460
 		}
461 461
 
462
-		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' );
462
+		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
463 463
 		$orderServiceItem = $orderBaseServiceManager->createItem();
464
-		$orderServiceItem->copyFrom( $serviceItem );
464
+		$orderServiceItem->copyFrom($serviceItem);
465 465
 
466 466
 		// remove service rebate of original price
467
-		$price = $provider->calcPrice( $this->get() )->setRebate( '0.00' );
468
-		$orderServiceItem->setPrice( $price );
467
+		$price = $provider->calcPrice($this->get())->setRebate('0.00');
468
+		$orderServiceItem->setPrice($price);
469 469
 
470
-		$provider->setConfigFE( $orderServiceItem, $attributes );
470
+		$provider->setConfigFE($orderServiceItem, $attributes);
471 471
 
472
-		$this->get()->addService( $orderServiceItem, $type );
472
+		$this->get()->addService($orderServiceItem, $type);
473 473
 		$this->save();
474 474
 	}
475 475
 
@@ -479,9 +479,9 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @param string $type Service type code like 'payment' or 'delivery'
481 481
 	 */
482
-	public function deleteService( $type )
482
+	public function deleteService($type)
483 483
 	{
484
-		$this->get()->deleteService( $type );
484
+		$this->get()->deleteService($type);
485 485
 		$this->save();
486 486
 	}
487 487
 
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	 * 	an address item.
495 495
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
496 496
 	 */
497
-	protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map )
497
+	protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map)
498 498
 	{
499
-		foreach( $map as $key => $value ) {
500
-			$map[$key] = strip_tags( $value ); // prevent XSS
499
+		foreach ($map as $key => $value) {
500
+			$map[$key] = strip_tags($value); // prevent XSS
501 501
 		}
502 502
 
503
-		$errors = $address->fromArray( $map );
503
+		$errors = $address->fromArray($map);
504 504
 
505
-		if( count( $errors ) > 0 )
505
+		if (count($errors) > 0)
506 506
 		{
507
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Invalid address properties, please check your input' );
508
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors );
507
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Invalid address properties, please check your input');
508
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
509 509
 		}
510 510
 	}
511 511
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Iface.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,6 @@
 block discarded – undo
150 150
 	 * Adds the delivery/payment service item based on the service ID.
151 151
 	 *
152 152
 	 * @param string $type Service type code like 'payment' or 'delivery'
153
-	 * @param string $id|null Unique ID of the service item or null to remove it
154 153
 	 * @param array $attributes Associative list of key/value pairs containing the attributes selected or
155 154
 	 * 	entered by the customer when choosing one of the delivery or payment options
156 155
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @param string $type Basket type
51 51
 	 * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object
52 52
 	 */
53
-	public function setType( $type );
53
+	public function setType($type);
54 54
 
55 55
 
56 56
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param boolean $default True to add default criteria (user logged in), false if not
70 70
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
71 71
 	 */
72
-	public function load( $id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true );
72
+	public function load($id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true);
73 73
 
74 74
 
75 75
 	/**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
89 89
 	 * @return void
90 90
 	 */
91
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
92
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] );
91
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
92
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = []);
93 93
 
94 94
 
95 95
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param integer $position Position number (key) of the order product item
99 99
 	 * @return void
100 100
 	 */
101
-	public function deleteProduct( $position );
101
+	public function deleteProduct($position);
102 102
 
103 103
 
104 104
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @param array $configAttributeCodes Codes of the product config attributes that should be REMOVED
110 110
 	 * @return void
111 111
 	 */
112
-	public function editProduct( $position, $quantity, array $configAttributeCodes = [] );
112
+	public function editProduct($position, $quantity, array $configAttributeCodes = []);
113 113
 
114 114
 
115 115
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
120 120
 	 * @return void
121 121
 	 */
122
-	public function addCoupon( $code );
122
+	public function addCoupon($code);
123 123
 
124 124
 
125 125
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
130 130
 	 * @return void
131 131
 	 */
132
-	public function deleteCoupon( $code );
132
+	public function deleteCoupon($code);
133 133
 
134 134
 
135 135
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * 	if one of the keys is invalid when using an array with key/value pairs
142 142
 	 * @return void
143 143
 	 */
144
-	public function setAddress( $type, $value );
144
+	public function setAddress($type, $value);
145 145
 
146 146
 
147 147
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * 	entered by the customer when choosing one of the delivery or payment options
154 154
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
155 155
 	 */
156
-	public function addService( $type, $id, array $attributes = [] );
156
+	public function addService($type, $id, array $attributes = []);
157 157
 
158 158
 
159 159
 	/**
@@ -161,5 +161,5 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @param string $type Service type code like 'payment' or 'delivery'
163 163
 	 */
164
-	public function deleteService( $type );
164
+	public function deleteService($type);
165 165
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Base.php 2 patches
Doc Comments   +2 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 	/**
63 63
 	 * Empties the basket and removing all products, addresses, services, etc.
64
-	 * @return void
64
+	 * @return Base
65 65
 	 */
66 66
 	public function clear()
67 67
 	{
@@ -134,11 +134,6 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param string $prodid ID of the base product to add
136 136
 	 * @param integer $quantity Amount of products that should by added
137
-	 * @param array $options Possible options are: 'stock'=>true|false and 'variant'=>true|false
138
-	 * 	The 'stock'=>false option allows adding products without being in stock.
139
-	 * 	The 'variant'=>false option allows adding the selection product to the basket
140
-	 * 	instead of the specific sub-product if the variant-building attribute IDs
141
-	 * 	doesn't match a specific sub-product or if the attribute IDs are missing.
142 137
 	 * @param array $variantAttributeIds List of variant-building attribute IDs that identify a specific product
143 138
 	 * 	in a selection products
144 139
 	 * @param array $configAttributeIds  List of attribute IDs that doesn't identify a specific product in a
@@ -257,7 +252,7 @@  discard block
 block discarded – undo
257 252
 	/**
258 253
 	 * Returns the frontend controller
259 254
 	 *
260
-	 * @return \Aimeos\Controller\Frontend\Basket\Iface Frontend controller object
255
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
261 256
 	 */
262 257
 	protected function getController()
263 258
 	{
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32 32
 	 */
33
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35
-		\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Frontend\\Basket\\Iface', $controller );
35
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Frontend\\Basket\\Iface', $controller);
36 36
 
37 37
 		$this->controller = $controller;
38 38
 
39
-		parent::__construct( $context );
39
+		parent::__construct($context);
40 40
 	}
41 41
 
42 42
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @return mixed Returns the value of the called method
49 49
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
50 50
 	 */
51
-	public function __call( $name, array $param )
51
+	public function __call($name, array $param)
52 52
 	{
53
-		return @call_user_func_array( array( $this->controller, $name ), $param );
53
+		return @call_user_func_array(array($this->controller, $name), $param);
54 54
 	}
55 55
 
56 56
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 * @param string $type Basket type
93 93
 	 * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object
94 94
 	 */
95
-	public function setType( $type )
95
+	public function setType($type)
96 96
 	{
97
-		$this->controller->setType( $type );
97
+		$this->controller->setType($type);
98 98
 		return $this;
99 99
 	}
100 100
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 * @param boolean $default True to add default criteria (user logged in), false if not
119 119
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
120 120
 	 */
121
-	public function load( $id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true )
121
+	public function load($id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true)
122 122
 	{
123
-		return $this->controller->load( $id, $parts, $default );
123
+		return $this->controller->load($id, $parts, $default);
124 124
 	}
125 125
 
126 126
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
146 146
 	 * @return void
147 147
 	 */
148
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
149
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
148
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
149
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
150 150
 	{
151 151
 		$this->controller->addProduct(
152 152
 			$prodid, $quantity, $stocktype, $variantAttributeIds,
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 * @param integer $position Position number (key) of the order product item
162 162
 	 * @return void
163 163
 	 */
164
-	public function deleteProduct( $position )
164
+	public function deleteProduct($position)
165 165
 	{
166
-		$this->controller->deleteProduct( $position );
166
+		$this->controller->deleteProduct($position);
167 167
 	}
168 168
 
169 169
 
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 * @param array $configAttributeCodes Codes of the product config attributes that should be REMOVED
176 176
 	 * @return void
177 177
 	 */
178
-	public function editProduct( $position, $quantity, array $configAttributeCodes = [] )
178
+	public function editProduct($position, $quantity, array $configAttributeCodes = [])
179 179
 	{
180
-		$this->controller->editProduct( $position, $quantity, $configAttributeCodes );
180
+		$this->controller->editProduct($position, $quantity, $configAttributeCodes);
181 181
 	}
182 182
 
183 183
 
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
189 189
 	 * @return void
190 190
 	 */
191
-	public function addCoupon( $code )
191
+	public function addCoupon($code)
192 192
 	{
193
-		$this->controller->addCoupon( $code );
193
+		$this->controller->addCoupon($code);
194 194
 	}
195 195
 
196 196
 
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
202 202
 	 * @return void
203 203
 	 */
204
-	public function deleteCoupon( $code )
204
+	public function deleteCoupon($code)
205 205
 	{
206
-		$this->controller->deleteCoupon( $code );
206
+		$this->controller->deleteCoupon($code);
207 207
 	}
208 208
 
209 209
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 * 	if one of the keys is invalid when using an array with key/value pairs
217 217
 	 * @return void
218 218
 	 */
219
-	public function setAddress( $type, $value )
219
+	public function setAddress($type, $value)
220 220
 	{
221
-		$this->controller->setAddress( $type, $value );
221
+		$this->controller->setAddress($type, $value);
222 222
 	}
223 223
 
224 224
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
233 233
 	 * @return void
234 234
 	 */
235
-	public function addService( $type, $id, array $attributes = [] )
235
+	public function addService($type, $id, array $attributes = [])
236 236
 	{
237
-		$this->controller->addService( $type, $id, $attributes );
237
+		$this->controller->addService($type, $id, $attributes);
238 238
 	}
239 239
 
240 240
 
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param string $type Service type code like 'payment' or 'delivery'
245 245
 	 */
246
-	public function deleteService( $type )
246
+	public function deleteService($type)
247 247
 	{
248
-		$this->controller->deleteService( $type );
248
+		$this->controller->deleteService($type);
249 249
 	}
250 250
 
251 251
 
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/SelectTest.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -19,219 +19,219 @@
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22
-		$this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
22
+		$this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
23 23
 
24
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
25
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select( $object, $this->context );
24
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
25
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Select($object, $this->context);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31 31
 		$this->object->clear();
32
-		$this->context->getSession()->set( 'aimeos', [] );
32
+		$this->context->getSession()->set('aimeos', []);
33 33
 
34
-		unset( $this->object );
34
+		unset($this->object);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddDeleteProduct()
39 39
 	{
40 40
 		$basket = $this->object->get();
41
-		$this->object->addProduct( $this->testItem->getId(), 2 );
41
+		$this->object->addProduct($this->testItem->getId(), 2);
42 42
 
43
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
44
-		$this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() );
45
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
43
+		$this->assertEquals(1, count($basket->getProducts()));
44
+		$this->assertEquals(2, $basket->getProduct(0)->getQuantity());
45
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testAddProductNoSelection()
50 50
 	{
51
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
51
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
52 52
 
53
-		$this->object->addProduct( $item->getId(), 1 );
53
+		$this->object->addProduct($item->getId(), 1);
54 54
 
55
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
56
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
57
-		$this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
55
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
56
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
57
+		$this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts()));
58 58
 	}
59 59
 
60 60
 
61 61
 	public function testAddProductVariant()
62 62
 	{
63
-		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
63
+		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext());
64 64
 
65 65
 		$search = $attributeManager->createSearch();
66
-		$search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) );
66
+		$search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white')));
67 67
 
68
-		$attributes = $attributeManager->searchItems( $search );
68
+		$attributes = $attributeManager->searchItems($search);
69 69
 
70
-		if( count( $attributes ) === 0 ) {
71
-			throw new \RuntimeException( 'Attributes not found' );
70
+		if (count($attributes) === 0) {
71
+			throw new \RuntimeException('Attributes not found');
72 72
 		}
73 73
 
74 74
 
75
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
75
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
76 76
 
77
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ), [], [], [] );
77
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes), [], [], []);
78 78
 
79
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
80
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
79
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
80
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testAddProductVariantIncomplete()
85 85
 	{
86
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
86
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
87 87
 
88 88
 		$search = $attributeManager->createSearch();
89 89
 		$expr = array(
90
-			$search->compare( '==', 'attribute.domain', 'product' ),
91
-			$search->compare( '==', 'attribute.code', '30' ),
92
-			$search->compare( '==', 'attribute.type.code', 'length' ),
90
+			$search->compare('==', 'attribute.domain', 'product'),
91
+			$search->compare('==', 'attribute.code', '30'),
92
+			$search->compare('==', 'attribute.type.code', 'length'),
93 93
 		);
94
-		$search->setConditions( $search->combine( '&&', $expr ) );
94
+		$search->setConditions($search->combine('&&', $expr));
95 95
 
96
-		$attributes = $attributeManager->searchItems( $search );
96
+		$attributes = $attributeManager->searchItems($search);
97 97
 
98
-		if( count( $attributes ) === 0 ) {
99
-			throw new \RuntimeException( 'Attributes not found' );
98
+		if (count($attributes) === 0) {
99
+			throw new \RuntimeException('Attributes not found');
100 100
 		}
101 101
 
102 102
 
103
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
103
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
104 104
 
105
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ) );
105
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes));
106 106
 
107
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
108
-		$this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() );
109
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) );
107
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
108
+		$this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode());
109
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes()));
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testAddProductVariantNonUnique()
114 114
 	{
115
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
115
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
116 116
 
117 117
 		$search = $attributeManager->createSearch();
118 118
 		$expr = array(
119
-			$search->compare( '==', 'attribute.domain', 'product' ),
120
-			$search->compare( '==', 'attribute.code', '30' ),
121
-			$search->compare( '==', 'attribute.type.code', 'width' ),
119
+			$search->compare('==', 'attribute.domain', 'product'),
120
+			$search->compare('==', 'attribute.code', '30'),
121
+			$search->compare('==', 'attribute.type.code', 'width'),
122 122
 		);
123
-		$search->setConditions( $search->combine( '&&', $expr ) );
123
+		$search->setConditions($search->combine('&&', $expr));
124 124
 
125
-		$attributes = $attributeManager->searchItems( $search );
125
+		$attributes = $attributeManager->searchItems($search);
126 126
 
127
-		if( count( $attributes ) === 0 ) {
128
-			throw new \RuntimeException( 'Attributes not found' );
127
+		if (count($attributes) === 0) {
128
+			throw new \RuntimeException('Attributes not found');
129 129
 		}
130 130
 
131 131
 
132
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
132
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
133 133
 
134
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
135
-		$this->object->addProduct( $item->getId(), 1, 'default', array_keys( $attributes ) );
134
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
135
+		$this->object->addProduct($item->getId(), 1, 'default', array_keys($attributes));
136 136
 	}
137 137
 
138 138
 
139 139
 	public function testAddProductVariantNotRequired()
140 140
 	{
141
-		$this->context->getConfig()->set( 'controller/frontend/basket/require-variant', false );
141
+		$this->context->getConfig()->set('controller/frontend/basket/require-variant', false);
142 142
 
143
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
143
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
144 144
 
145 145
 		$search = $attributeManager->createSearch();
146
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
146
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
147 147
 
148
-		$attributes = $attributeManager->searchItems( $search );
148
+		$attributes = $attributeManager->searchItems($search);
149 149
 
150
-		if( count( $attributes ) === 0 ) {
151
-			throw new \RuntimeException( 'Attribute not found' );
150
+		if (count($attributes) === 0) {
151
+			throw new \RuntimeException('Attribute not found');
152 152
 		}
153 153
 
154
-		$options = array( 'variant' => false );
154
+		$options = array('variant' => false);
155 155
 
156
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', array_keys( $attributes ) );
156
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', array_keys($attributes));
157 157
 
158
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
159
-		$this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() );
158
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
159
+		$this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode());
160 160
 	}
161 161
 
162 162
 
163 163
 	public function testAddProductEmptySelectionException()
164 164
 	{
165
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' );
165
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel');
166 166
 
167
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
168
-		$this->object->addProduct( $item->getId(), 1 );
167
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
168
+		$this->object->addProduct($item->getId(), 1);
169 169
 	}
170 170
 
171 171
 
172 172
 	public function testAddProductSelectionWithPricelessItem()
173 173
 	{
174
-		$this->object->addProduct( $this->testItem->getId(), 1 );
174
+		$this->object->addProduct($this->testItem->getId(), 1);
175 175
 
176
-		$this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() );
176
+		$this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode());
177 177
 	}
178 178
 
179 179
 
180 180
 	public function testAddProductConfigAttribute()
181 181
 	{
182
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
182
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
183 183
 
184 184
 		$search = $attributeManager->createSearch();
185
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
185
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
186 186
 
187
-		$attributes = $attributeManager->searchItems( $search );
187
+		$attributes = $attributeManager->searchItems($search);
188 188
 
189
-		if( ( $attribute = reset( $attributes ) ) === false ) {
190
-			throw new \RuntimeException( 'Attribute not found' );
189
+		if (($attribute = reset($attributes)) === false) {
190
+			throw new \RuntimeException('Attribute not found');
191 191
 		}
192 192
 
193
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', [], [$attribute->getId() => 1] );
193
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', [], [$attribute->getId() => 1]);
194 194
 		$basket = $this->object->get();
195 195
 
196
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
197
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
198
-		$this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) );
196
+		$this->assertEquals(1, count($basket->getProducts()));
197
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
198
+		$this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config'));
199 199
 	}
200 200
 
201 201
 
202 202
 	public function testAddProductHiddenAttribute()
203 203
 	{
204
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
204
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
205 205
 
206 206
 		$search = $attributeManager->createSearch();
207 207
 		$expr = array(
208
-			$search->compare( '==', 'attribute.code', '29' ),
209
-			$search->compare( '==', 'attribute.type.code', 'width' ),
208
+			$search->compare('==', 'attribute.code', '29'),
209
+			$search->compare('==', 'attribute.type.code', 'width'),
210 210
 		);
211
-		$search->setConditions( $search->combine( '&&', $expr ) );
211
+		$search->setConditions($search->combine('&&', $expr));
212 212
 
213
-		$attributes = $attributeManager->searchItems( $search );
213
+		$attributes = $attributeManager->searchItems($search);
214 214
 
215
-		if( empty( $attributes ) ) {
216
-			throw new \RuntimeException( 'Attribute not found' );
215
+		if (empty($attributes)) {
216
+			throw new \RuntimeException('Attribute not found');
217 217
 		}
218 218
 
219
-		$this->object->addProduct( $this->testItem->getId(), 1, 'default', [], [], array_keys( $attributes ) );
219
+		$this->object->addProduct($this->testItem->getId(), 1, 'default', [], [], array_keys($attributes));
220 220
 
221 221
 		$basket = $this->object->get();
222
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
222
+		$this->assertEquals(1, count($basket->getProducts()));
223 223
 
224
-		$product = $basket->getProduct( 0 );
225
-		$this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() );
224
+		$product = $basket->getProduct(0);
225
+		$this->assertEquals('U:TESTPSUB01', $product->getProductCode());
226 226
 
227 227
 		$attributes = $product->getAttributes();
228
-		$this->assertEquals( 1, count( $attributes ) );
228
+		$this->assertEquals(1, count($attributes));
229 229
 
230
-		if( ( $attribute = reset( $attributes ) ) === false ) {
231
-			throw new \RuntimeException( 'No attribute' );
230
+		if (($attribute = reset($attributes)) === false) {
231
+			throw new \RuntimeException('No attribute');
232 232
 		}
233 233
 
234
-		$this->assertEquals( 'hidden', $attribute->getType() );
235
-		$this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) );
234
+		$this->assertEquals('hidden', $attribute->getType());
235
+		$this->assertEquals('29', $product->getAttribute('width', 'hidden'));
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Base.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 			{
234 234
 				$this->setAddress( $type, $item->toArray() );
235 235
 				$basket->deleteAddress( $type );
236
-			}
237
-			catch( \Exception $e )
236
+			} catch( \Exception $e )
238 237
 			{
239 238
 				$logger = $this->getContext()->getLogger();
240 239
 				$errors['address'][$type] = $e->getMessage();
@@ -264,8 +263,7 @@  discard block
 block discarded – undo
264 263
 			{
265 264
 				$this->addCoupon( $code );
266 265
 				$basket->deleteCoupon( $code, true );
267
-			}
268
-			catch( \Exception $e )
266
+			} catch( \Exception $e )
269 267
 			{
270 268
 				$logger = $this->getContext()->getLogger();
271 269
 				$errors['coupon'][$code] = $e->getMessage();
@@ -314,8 +312,7 @@  discard block
 block discarded – undo
314 312
 				);
315 313
 
316 314
 				$basket->deleteProduct( $pos );
317
-			}
318
-			catch( \Exception $e )
315
+			} catch( \Exception $e )
319 316
 			{
320 317
 				$code = $product->getProductCode();
321 318
 				$logger = $this->getContext()->getLogger();
@@ -353,8 +350,7 @@  discard block
 block discarded – undo
353 350
 
354 351
 					$this->addService( $type, $item->getServiceId(), $attributes );
355 352
 					$basket->deleteService( $type );
356
-				}
357
-				catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
353
+				} catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
358 354
 			}
359 355
 		}
360 356
 
Please login to merge, or discard this patch.
Spacing   +147 added lines, -147 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,36 +90,36 @@  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
-			foreach( $refIds as $key => $refId )
110
+			foreach ($refIds as $key => $refId)
111 111
 			{
112
-				$cmpfunc = $search->createFunction( 'product:has', [$domain, $listType, (string) $refId] );
113
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
112
+				$cmpfunc = $search->createFunction('product:has', [$domain, $listType, (string) $refId]);
113
+				$expr[] = $search->compare('!=', $cmpfunc, null);
114 114
 			}
115 115
 		}
116 116
 
117
-		$search->setConditions( $search->combine( '&&', $expr ) );
117
+		$search->setConditions($search->combine('&&', $expr));
118 118
 
119
-		if( count( $productManager->searchItems( $search, [] ) ) === 0 )
119
+		if (count($productManager->searchItems($search, [])) === 0)
120 120
 		{
121
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' );
122
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) );
121
+			$msg = $context->getI18n()->dt('controller/frontend', 'Invalid "%1$s" references for product with ID %2$s');
122
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, json_encode($prodId)));
123 123
 		}
124 124
 	}
125 125
 
@@ -130,40 +130,40 @@  discard block
 block discarded – undo
130 130
 	 * @param \Aimeos\MShop\Locale\Item\Iface $locale Locale object from current basket
131 131
 	 * @param string $type Basket type
132 132
 	 */
133
-	protected function checkLocale( \Aimeos\MShop\Locale\Item\Iface $locale, $type )
133
+	protected function checkLocale(\Aimeos\MShop\Locale\Item\Iface $locale, $type)
134 134
 	{
135 135
 		$errors = [];
136 136
 		$context = $this->getContext();
137 137
 		$session = $context->getSession();
138 138
 
139
-		$localeStr = $session->get( 'aimeos/basket/locale' );
139
+		$localeStr = $session->get('aimeos/basket/locale');
140 140
 		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();
141 141
 
142
-		if( $localeStr !== null && $localeStr !== $localeKey )
142
+		if ($localeStr !== null && $localeStr !== $localeKey)
143 143
 		{
144
-			$locParts = explode( '|', $localeStr );
145
-			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
146
-			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
147
-			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );
144
+			$locParts = explode('|', $localeStr);
145
+			$locSite = (isset($locParts[0]) ? $locParts[0] : '');
146
+			$locLanguage = (isset($locParts[1]) ? $locParts[1] : '');
147
+			$locCurrency = (isset($locParts[2]) ? $locParts[2] : '');
148 148
 
149
-			$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
150
-			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );
149
+			$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
150
+			$locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false);
151 151
 
152 152
 			$context = clone $context;
153
-			$context->setLocale( $locale );
153
+			$context->setLocale($locale);
154 154
 
155
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
156
-			$basket = $manager->getSession( $type );
155
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
156
+			$basket = $manager->getSession($type);
157 157
 
158
-			$this->copyAddresses( $basket, $errors, $localeKey );
159
-			$this->copyServices( $basket, $errors );
160
-			$this->copyProducts( $basket, $errors, $localeKey );
161
-			$this->copyCoupons( $basket, $errors, $localeKey );
158
+			$this->copyAddresses($basket, $errors, $localeKey);
159
+			$this->copyServices($basket, $errors);
160
+			$this->copyProducts($basket, $errors, $localeKey);
161
+			$this->copyCoupons($basket, $errors, $localeKey);
162 162
 
163
-			$manager->setSession( $basket, $type );
163
+			$manager->setSession($basket, $type);
164 164
 		}
165 165
 
166
-		$session->set( 'aimeos/basket/locale', $localeKey );
166
+		$session->set('aimeos/basket/locale', $localeKey);
167 167
 	}
168 168
 
169 169
 
@@ -175,22 +175,22 @@  discard block
 block discarded – undo
175 175
 	 * @param string $localeKey Unique identifier of the site, language and currency
176 176
 	 * @return array Associative list of errors occured
177 177
 	 */
178
-	protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
178
+	protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
179 179
 	{
180
-		foreach( $basket->getAddresses() as $type => $item )
180
+		foreach ($basket->getAddresses() as $type => $item)
181 181
 		{
182 182
 			try
183 183
 			{
184
-				$this->setAddress( $type, $item->toArray() );
185
-				$basket->deleteAddress( $type );
184
+				$this->setAddress($type, $item->toArray());
185
+				$basket->deleteAddress($type);
186 186
 			}
187
-			catch( \Exception $e )
187
+			catch (\Exception $e)
188 188
 			{
189 189
 				$logger = $this->getContext()->getLogger();
190 190
 				$errors['address'][$type] = $e->getMessage();
191 191
 
192 192
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
193
-				$logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
193
+				$logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
194 194
 			}
195 195
 		}
196 196
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @param string $localeKey Unique identifier of the site, language and currency
207 207
 	 * @return array Associative list of errors occured
208 208
 	 */
209
-	protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
209
+	protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
210 210
 	{
211
-		foreach( $basket->getCoupons() as $code => $list )
211
+		foreach ($basket->getCoupons() as $code => $list)
212 212
 		{
213 213
 			try
214 214
 			{
215
-				$this->addCoupon( $code );
216
-				$basket->deleteCoupon( $code, true );
215
+				$this->addCoupon($code);
216
+				$basket->deleteCoupon($code, true);
217 217
 			}
218
-			catch( \Exception $e )
218
+			catch (\Exception $e)
219 219
 			{
220 220
 				$logger = $this->getContext()->getLogger();
221 221
 				$errors['coupon'][$code] = $e->getMessage();
222 222
 
223 223
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
224
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
224
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
225 225
 			}
226 226
 		}
227 227
 
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 	 * @param string $localeKey Unique identifier of the site, language and currency
238 238
 	 * @return array Associative list of errors occured
239 239
 	 */
240
-	protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
240
+	protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
241 241
 	{
242
-		foreach( $basket->getProducts() as $pos => $product )
242
+		foreach ($basket->getProducts() as $pos => $product)
243 243
 		{
244
-			if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) {
244
+			if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) {
245 245
 				continue;
246 246
 			}
247 247
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 			{
250 250
 				$variantIds = $configIds = $customIds = [];
251 251
 
252
-				foreach( $product->getAttributeItems() as $attrItem )
252
+				foreach ($product->getAttributeItems() as $attrItem)
253 253
 				{
254
-					switch( $attrItem->getType() )
254
+					switch ($attrItem->getType())
255 255
 					{
256 256
 						case 'variant': $variantIds[] = $attrItem->getAttributeId(); break;
257 257
 						case 'config': $configIds[$attrItem->getAttributeId()] = $attrItem->getQuantity(); break;
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 					$variantIds, $configIds, [], $customIds
265 265
 				);
266 266
 
267
-				$basket->deleteProduct( $pos );
267
+				$basket->deleteProduct($pos);
268 268
 			}
269
-			catch( \Exception $e )
269
+			catch (\Exception $e)
270 270
 			{
271 271
 				$code = $product->getProductCode();
272 272
 				$logger = $this->getContext()->getLogger();
273 273
 				$errors['product'][$pos] = $e->getMessage();
274 274
 
275 275
 				$str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s';
276
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
276
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
277 277
 			}
278 278
 		}
279 279
 
@@ -288,24 +288,24 @@  discard block
 block discarded – undo
288 288
 	 * @param array $errors Associative list of previous errors
289 289
 	 * @return array Associative list of errors occured
290 290
 	 */
291
-	protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors )
291
+	protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors)
292 292
 	{
293
-		foreach( $basket->getServices() as $type => $list )
293
+		foreach ($basket->getServices() as $type => $list)
294 294
 		{
295
-			foreach( $list as $item )
295
+			foreach ($list as $item)
296 296
 			{
297 297
 				try
298 298
 				{
299 299
 					$attributes = [];
300 300
 
301
-					foreach( $item->getAttributes() as $attrItem ) {
301
+					foreach ($item->getAttributes() as $attrItem) {
302 302
 						$attributes[$attrItem->getCode()] = $attrItem->getValue();
303 303
 					}
304 304
 
305
-					$this->addService( $type, $item->getServiceId(), $attributes );
306
-					$basket->deleteService( $type );
305
+					$this->addService($type, $item->getServiceId(), $attributes);
306
+					$basket->deleteService($type);
307 307
 				}
308
-				catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
308
+				catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically
309 309
 			}
310 310
 		}
311 311
 
@@ -318,28 +318,28 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
320 320
 	 */
321
-	protected function createSubscriptions( \Aimeos\MShop\Order\Item\Base\Iface $basket )
321
+	protected function createSubscriptions(\Aimeos\MShop\Order\Item\Base\Iface $basket)
322 322
 	{
323
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' );
323
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription');
324 324
 
325
-		foreach( $basket->getProducts() as $orderProduct )
325
+		foreach ($basket->getProducts() as $orderProduct)
326 326
 		{
327
-			if( ( $interval = $orderProduct->getAttribute( 'interval', 'config' ) ) !== null )
327
+			if (($interval = $orderProduct->getAttribute('interval', 'config')) !== null)
328 328
 			{
329 329
 				$item = $manager->createItem();
330
-				$item->setOrderBaseId( $basket->getId() );
331
-				$item->setOrderProductId( $orderProduct->getId() );
332
-				$item->setInterval( $interval );
333
-				$item->setStatus( 1 );
334
-
335
-				if( ( $end = $orderProduct->getAttribute( 'intervalend', 'custom' ) ) !== null
336
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'config' ) ) !== null
337
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'hidden' ) ) !== null
330
+				$item->setOrderBaseId($basket->getId());
331
+				$item->setOrderProductId($orderProduct->getId());
332
+				$item->setInterval($interval);
333
+				$item->setStatus(1);
334
+
335
+				if (($end = $orderProduct->getAttribute('intervalend', 'custom')) !== null
336
+					|| ($end = $orderProduct->getAttribute('intervalend', 'config')) !== null
337
+					|| ($end = $orderProduct->getAttribute('intervalend', 'hidden')) !== null
338 338
 				) {
339
-					$item->setDateEnd( $end );
339
+					$item->setDateEnd($end);
340 340
 				}
341 341
 
342
-				$manager->saveItem( $item, false );
342
+				$manager->saveItem($item, false);
343 343
 			}
344 344
 		}
345 345
 	}
@@ -353,32 +353,32 @@  discard block
 block discarded – undo
353 353
 	 * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface
354 354
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one
355 355
 	 */
356
-	protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) )
356
+	protected function getAttributes(array $attributeIds, array $domains = array('price', 'text'))
357 357
 	{
358
-		if( empty( $attributeIds ) ) {
358
+		if (empty($attributeIds)) {
359 359
 			return [];
360 360
 		}
361 361
 
362
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
362
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
363 363
 
364
-		$search = $attributeManager->createSearch( true );
364
+		$search = $attributeManager->createSearch(true);
365 365
 		$expr = array(
366
-			$search->compare( '==', 'attribute.id', $attributeIds ),
366
+			$search->compare('==', 'attribute.id', $attributeIds),
367 367
 			$search->getConditions(),
368 368
 		);
369
-		$search->setConditions( $search->combine( '&&', $expr ) );
370
-		$search->setSlice( 0, 0x7fffffff );
369
+		$search->setConditions($search->combine('&&', $expr));
370
+		$search->setSlice(0, 0x7fffffff);
371 371
 
372
-		$attrItems = $attributeManager->searchItems( $search, $domains );
372
+		$attrItems = $attributeManager->searchItems($search, $domains);
373 373
 
374
-		if( count( $attrItems ) !== count( $attributeIds ) )
374
+		if (count($attrItems) !== count($attributeIds))
375 375
 		{
376 376
 			$i18n = $this->getContext()->getI18n();
377
-			$expected = implode( ',', $attributeIds );
378
-			$actual = implode( ',', array_keys( $attrItems ) );
379
-			$msg = $i18n->dt( 'controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"' );
377
+			$expected = implode(',', $attributeIds);
378
+			$actual = implode(',', array_keys($attrItems));
379
+			$msg = $i18n->dt('controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"');
380 380
 
381
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $actual, $expected ) );
381
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $actual, $expected));
382 382
 		}
383 383
 
384 384
 		return $attrItems;
@@ -391,31 +391,31 @@  discard block
 block discarded – undo
391 391
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items
392 392
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values
393 393
 	 */
394
-	protected function getAttributeItems( array $orderAttributes )
394
+	protected function getAttributeItems(array $orderAttributes)
395 395
 	{
396
-		if( empty( $orderAttributes ) ) {
396
+		if (empty($orderAttributes)) {
397 397
 			return [];
398 398
 		}
399 399
 
400
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
401
-		$search = $attributeManager->createSearch( true );
400
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
401
+		$search = $attributeManager->createSearch(true);
402 402
 		$expr = [];
403 403
 
404
-		foreach( $orderAttributes as $item )
404
+		foreach ($orderAttributes as $item)
405 405
 		{
406 406
 			$tmp = array(
407
-				$search->compare( '==', 'attribute.domain', 'product' ),
408
-				$search->compare( '==', 'attribute.code', $item->getValue() ),
409
-				$search->compare( '==', 'attribute.type.domain', 'product' ),
410
-				$search->compare( '==', 'attribute.type.code', $item->getCode() ),
411
-				$search->compare( '>', 'attribute.type.status', 0 ),
407
+				$search->compare('==', 'attribute.domain', 'product'),
408
+				$search->compare('==', 'attribute.code', $item->getValue()),
409
+				$search->compare('==', 'attribute.type.domain', 'product'),
410
+				$search->compare('==', 'attribute.type.code', $item->getCode()),
411
+				$search->compare('>', 'attribute.type.status', 0),
412 412
 				$search->getConditions(),
413 413
 			);
414
-			$expr[] = $search->combine( '&&', $tmp );
414
+			$expr[] = $search->combine('&&', $tmp);
415 415
 		}
416 416
 
417
-		$search->setConditions( $search->combine( '||', $expr ) );
418
-		return $attributeManager->searchItems( $search, array( 'price' ) );
417
+		$search->setConditions($search->combine('||', $expr));
418
+		return $attributeManager->searchItems($search, array('price'));
419 419
 	}
420 420
 
421 421
 
@@ -428,24 +428,24 @@  discard block
 block discarded – undo
428 428
 	 * @param array $quantities Associative list of attribute IDs as keys and their quantities as values
429 429
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
430 430
 	 */
431
-	protected function getOrderProductAttributes( $type, array $ids, array $values = [], array $quantities = [] )
431
+	protected function getOrderProductAttributes($type, array $ids, array $values = [], array $quantities = [])
432 432
 	{
433
-		if( empty( $ids ) ) {
433
+		if (empty($ids)) {
434 434
 			return [];
435 435
 		}
436 436
 
437 437
 		$list = [];
438
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
438
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
439 439
 
440
-		foreach( $this->getAttributes( $ids ) as $id => $attrItem )
440
+		foreach ($this->getAttributes($ids) as $id => $attrItem)
441 441
 		{
442 442
 			$item = $manager->createItem();
443
-			$item->copyFrom( $attrItem );
444
-			$item->setType( $type );
445
-			$item->setQuantity( isset( $quantities[$id] ) ? $quantities[$id] : 1 );
443
+			$item->copyFrom($attrItem);
444
+			$item->setType($type);
445
+			$item->setQuantity(isset($quantities[$id]) ? $quantities[$id] : 1);
446 446
 
447
-			if( isset( $values[$id] ) ) {
448
-				$item->setValue( $values[$id] );
447
+			if (isset($values[$id])) {
448
+				$item->setValue($values[$id]);
449 449
 			}
450 450
 
451 451
 			$list[] = $item;
@@ -462,23 +462,23 @@  discard block
 block discarded – undo
462 462
 	 * @param string $code Code of the list type
463 463
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface List type item
464 464
 	 */
465
-	protected function getProductListTypeItem( $domain, $code )
465
+	protected function getProductListTypeItem($domain, $code)
466 466
 	{
467 467
 		$context = $this->getContext();
468 468
 
469
-		if( empty( $this->listTypeItems ) )
469
+		if (empty($this->listTypeItems))
470 470
 		{
471
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
471
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
472 472
 
473
-			foreach( $manager->searchItems( $manager->createSearch( true ) ) as $item ) {
474
-				$this->listTypeItems[ $item->getDomain() ][ $item->getCode() ] = $item;
473
+			foreach ($manager->searchItems($manager->createSearch(true)) as $item) {
474
+				$this->listTypeItems[$item->getDomain()][$item->getCode()] = $item;
475 475
 			}
476 476
 		}
477 477
 
478
-		if( !isset( $this->listTypeItems[$domain][$code] ) )
478
+		if (!isset($this->listTypeItems[$domain][$code]))
479 479
 		{
480
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found' );
481
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, $code ) );
480
+			$msg = $context->getI18n()->dt('controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found');
481
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, $code));
482 482
 		}
483 483
 
484 484
 		return $this->listTypeItems[$domain][$code];
@@ -493,35 +493,35 @@  discard block
 block discarded – undo
493 493
 	 * @param array $domains Names of the domain items that should be fetched too
494 494
 	 * @return array List of products matching the given attributes
495 495
 	 */
496
-	protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
497
-			array $domains = array( 'attribute', 'media', 'price', 'text' ) )
496
+	protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
497
+			array $domains = array('attribute', 'media', 'price', 'text'))
498 498
 	{
499 499
 		$subProductIds = [];
500
-		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
500
+		foreach ($productItem->getRefItems('product', 'default', 'default') as $item) {
501 501
 			$subProductIds[] = $item->getId();
502 502
 		}
503 503
 
504
-		if( count( $subProductIds ) === 0 ) {
504
+		if (count($subProductIds) === 0) {
505 505
 			return [];
506 506
 		}
507 507
 
508
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
509
-		$search = $productManager->createSearch( true );
508
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
509
+		$search = $productManager->createSearch(true);
510 510
 
511 511
 		$expr = array(
512
-			$search->compare( '==', 'product.id', $subProductIds ),
512
+			$search->compare('==', 'product.id', $subProductIds),
513 513
 			$search->getConditions(),
514 514
 		);
515 515
 
516
-		foreach( $variantAttributeIds as $id )
516
+		foreach ($variantAttributeIds as $id)
517 517
 		{
518
-			$cmpfunc = $search->createFunction( 'product:has', ['attribute', 'variant', (string) $id] );
519
-			$expr[] = $search->compare( '!=', $cmpfunc, null );
518
+			$cmpfunc = $search->createFunction('product:has', ['attribute', 'variant', (string) $id]);
519
+			$expr[] = $search->compare('!=', $cmpfunc, null);
520 520
 		}
521 521
 
522
-		$search->setConditions( $search->combine( '&&', $expr ) );
522
+		$search->setConditions($search->combine('&&', $expr));
523 523
 
524
-		return $productManager->searchItems( $search, $domains );
524
+		return $productManager->searchItems($search, $domains);
525 525
 	}
526 526
 
527 527
 
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
 	 * @param mixed $default Default value if no value is available for the given name
534 534
 	 * @return mixed Value from the array or default value
535 535
 	 */
536
-	protected function getValue( array $values, $name, $default = null )
536
+	protected function getValue(array $values, $name, $default = null)
537 537
 	{
538
-		if( isset( $values[$name] ) ) {
538
+		if (isset($values[$name])) {
539 539
 			return $values[$name];
540 540
 		}
541 541
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	 * @param string $type Arbitrary order type (max. eight chars)
30 30
 	 * @return \Aimeos\MShop\Order\Item\Iface Created order object
31 31
 	 */
32
-	public function addItem( $baseId, $type )
32
+	public function addItem($baseId, $type)
33 33
 	{
34 34
 		$total = 0;
35 35
 		$context = $this->getContext();
36
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
36
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
37 37
 
38 38
 		/** controller/frontend/order/limit-seconds
39 39
 		 * Order limitation time frame in seconds
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
 		 * @see controller/frontend/basket/limit-count
52 52
 		 * @see controller/frontend/basket/limit-seconds
53 53
 		 */
54
-		$seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 );
54
+		$seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300);
55 55
 
56 56
 		$search = $manager->createSearch();
57 57
 		$expr = [
58
-			$search->compare( '==', 'order.baseid', $baseId ),
59
-			$search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
58
+			$search->compare('==', 'order.baseid', $baseId),
59
+			$search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)),
60 60
 		];
61
-		$search->setConditions( $search->combine( '&&', $expr ) );
62
-		$search->setSlice( 0, 0 );
61
+		$search->setConditions($search->combine('&&', $expr));
62
+		$search->setSlice(0, 0);
63 63
 
64
-		$manager->searchItems( $search, [], $total );
64
+		$manager->searchItems($search, [], $total);
65 65
 
66
-		if( $total > 0 ) {
67
-			throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) );
66
+		if ($total > 0) {
67
+			throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created'));
68 68
 		}
69 69
 
70
-		$item = $manager->createItem()->setBaseId( $baseId )->setType( $type );
71
-		return $manager->saveItem( $item );
70
+		$item = $manager->createItem()->setBaseId($baseId)->setType($type);
71
+		return $manager->saveItem($item);
72 72
 	}
73 73
 
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function createFilter()
81 81
 	{
82
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true );
82
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true);
83 83
 	}
84 84
 
85 85
 
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
 	 * @param boolean $default Use default criteria to limit orders
91 91
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
92 92
 	 */
93
-	public function getItem( $id, $default = true )
93
+	public function getItem($id, $default = true)
94 94
 	{
95 95
 		$context = $this->getContext();
96
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
96
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
97 97
 
98
-		$search = $manager->createSearch( true );
98
+		$search = $manager->createSearch(true);
99 99
 		$expr = [
100
-			$search->compare( '==', 'order.id', $id ),
100
+			$search->compare('==', 'order.id', $id),
101 101
 			$search->getConditions(),
102 102
 		];
103 103
 
104
-		if( $default !== false ) {
105
-			$expr[] = $search->compare( '==', 'order.editor', $context->getEditor() );
104
+		if ($default !== false) {
105
+			$expr[] = $search->compare('==', 'order.editor', $context->getEditor());
106 106
 		}
107 107
 
108
-		$search->setConditions( $search->combine( '&&', $expr ) );
108
+		$search->setConditions($search->combine('&&', $expr));
109 109
 
110
-		$items = $manager->searchItems( $search );
110
+		$items = $manager->searchItems($search);
111 111
 
112
-		if( ( $item = reset( $items ) ) !== false ) {
112
+		if (($item = reset($items)) !== false) {
113 113
 			return $item;
114 114
 		}
115 115
 
116
-		throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) );
116
+		throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id));
117 117
 	}
118 118
 
119 119
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	 * @param \Aimeos\MShop\Order\Item\Iface $item Order object
124 124
 	 * @return \Aimeos\MShop\Order\Item\Iface Saved order item
125 125
 	 */
126
-	public function saveItem( \Aimeos\MShop\Order\Item\Iface $item )
126
+	public function saveItem(\Aimeos\MShop\Order\Item\Iface $item)
127 127
 	{
128
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' );
129
-		return $manager->saveItem( $item );
128
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order');
129
+		return $manager->saveItem($item);
130 130
 	}
131 131
 
132 132
 
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	 * @param integer|null &$total Variable that will contain the total number of available items
138 138
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
139 139
 	 */
140
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
140
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
141 141
 	{
142 142
 		$context = $this->getContext();
143
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
143
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
144 144
 
145 145
 		$expr = [
146 146
 			$filter->getConditions(),
147
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
147
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
148 148
 		];
149
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
149
+		$filter->setConditions($filter->combine('&&', $expr));
150 150
 
151
-		return $manager->searchItems( $filter, [], $total );
151
+		return $manager->searchItems($filter, [], $total);
152 152
 	}
153 153
 
154 154
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
172 172
 	 */
173
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
173
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
174 174
 	{
175
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
175
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
176 176
 	}
177 177
 
178 178
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
196 196
 	 */
197
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
197
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
198 198
 	{
199
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
199
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
200 200
 	}
201 201
 
202 202
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
216 216
 	 */
217
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
217
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
218 218
 	{
219
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
219
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
220 220
 	}
221 221
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Order/StandardTest.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -18,165 +18,165 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(true);
22 22
 
23 23
 		$this->context = \TestHelperFrontend::getContext();
24
-		$this->object = new \Aimeos\Controller\Frontend\Order\Standard( $this->context );
24
+		$this->object = new \Aimeos\Controller\Frontend\Order\Standard($this->context);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object, $this->context );
30
+		unset($this->object, $this->context);
31 31
 
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testAddItem()
38 38
 	{
39
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
40
-			->setConstructorArgs( [$this->context] )
41
-			->setMethods( ['saveItem'] )
39
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
40
+			->setConstructorArgs([$this->context])
41
+			->setMethods(['saveItem'])
42 42
 			->getMock();
43 43
 
44
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager );
44
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager);
45 45
 
46
-		$manager->expects( $this->once() )->method( 'saveItem' )
47
-			->will( $this->returnValue( $manager->createItem() ) );
46
+		$manager->expects($this->once())->method('saveItem')
47
+			->will($this->returnValue($manager->createItem()));
48 48
 
49
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) );
49
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ));
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testAddItemLimit()
54 54
 	{
55
-		$this->context->getConfig()->set( 'controller/frontend/order/limit-seconds', 86400 * 365 );
55
+		$this->context->getConfig()->set('controller/frontend/order/limit-seconds', 86400 * 365);
56 56
 
57
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' );
58
-		$result = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) );
57
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base');
58
+		$result = $manager->searchItems($manager->createSearch()->setSlice(0, 1));
59 59
 
60
-		if( ( $item = reset( $result ) ) === false ) {
61
-			throw new \RuntimeException( 'No order item found' );
60
+		if (($item = reset($result)) === false) {
61
+			throw new \RuntimeException('No order item found');
62 62
 		}
63 63
 
64
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
65
-		$this->object->addItem( $item->getId(), 'test' );
64
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
65
+		$this->object->addItem($item->getId(), 'test');
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testCreateFilter()
70 70
 	{
71
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
71
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
72 72
 	}
73 73
 
74 74
 
75 75
 	public function testGetItem()
76 76
 	{
77
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
78
-		$customerItem = $manager->findItem( 'UTC001' );
77
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
78
+		$customerItem = $manager->findItem('UTC001');
79 79
 
80
-		$this->context->setEditor( 'core:unittest' );
80
+		$this->context->setEditor('core:unittest');
81 81
 
82
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' );
83
-		$search = $manager->createSearch()->setSlice( 0, 1 );
84
-		$search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) );
85
-		$result = $manager->searchItems( $search );
82
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order');
83
+		$search = $manager->createSearch()->setSlice(0, 1);
84
+		$search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId()));
85
+		$result = $manager->searchItems($search);
86 86
 
87
-		if( ( $item = reset( $result ) ) === false ) {
88
-			throw new \RuntimeException( 'No order item found' );
87
+		if (($item = reset($result)) === false) {
88
+			throw new \RuntimeException('No order item found');
89 89
 		}
90 90
 
91
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) );
91
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId()));
92 92
 	}
93 93
 
94 94
 
95 95
 	public function testGetItemException()
96 96
 	{
97
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
97
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
98 98
 		$this->object->getItem( -1 );
99 99
 	}
100 100
 
101 101
 
102 102
 	public function testSaveItem()
103 103
 	{
104
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
105
-			->setConstructorArgs( [$this->context] )
106
-			->setMethods( ['saveItem'] )
104
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
105
+			->setConstructorArgs([$this->context])
106
+			->setMethods(['saveItem'])
107 107
 			->getMock();
108 108
 
109
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager );
109
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager);
110 110
 
111
-		$manager->expects( $this->once() )->method( 'saveItem' )
112
-			->will( $this->returnValue( $manager->createItem() ) );
111
+		$manager->expects($this->once())->method('saveItem')
112
+			->will($this->returnValue($manager->createItem()));
113 113
 
114
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->saveItem( $manager->createItem() ) );
114
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->saveItem($manager->createItem()));
115 115
 	}
116 116
 
117 117
 
118 118
 	public function testSearchItems()
119 119
 	{
120
-		$this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) );
120
+		$this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter()));
121 121
 	}
122 122
 
123 123
 
124 124
 	public function testBlock()
125 125
 	{
126 126
 		$name = 'ControllerFrontendOrderBlock';
127
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
127
+		$this->context->getConfig()->set('controller/common/order/name', $name);
128 128
 
129 129
 
130
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
131
-			->setMethods( array( 'block' ) )
132
-			->setConstructorArgs( array( $this->context ) )
130
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
131
+			->setMethods(array('block'))
132
+			->setConstructorArgs(array($this->context))
133 133
 			->getMock();
134 134
 
135
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
135
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
136 136
 
137
-		$orderCntlStub->expects( $this->once() )->method( 'block' );
137
+		$orderCntlStub->expects($this->once())->method('block');
138 138
 
139 139
 
140
-		$this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
140
+		$this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
141 141
 	}
142 142
 
143 143
 
144 144
 	public function testUnblock()
145 145
 	{
146 146
 		$name = 'ControllerFrontendOrderUnblock';
147
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
147
+		$this->context->getConfig()->set('controller/common/order/name', $name);
148 148
 
149 149
 
150
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
151
-			->setMethods( array( 'unblock' ) )
152
-			->setConstructorArgs( array( $this->context ) )
150
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
151
+			->setMethods(array('unblock'))
152
+			->setConstructorArgs(array($this->context))
153 153
 			->getMock();
154 154
 
155
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
155
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
156 156
 
157
-		$orderCntlStub->expects( $this->once() )->method( 'unblock' );
157
+		$orderCntlStub->expects($this->once())->method('unblock');
158 158
 
159 159
 
160
-		$this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
160
+		$this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
161 161
 	}
162 162
 
163 163
 
164 164
 	public function testUpdate()
165 165
 	{
166 166
 		$name = 'ControllerFrontendOrderUpdate';
167
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
167
+		$this->context->getConfig()->set('controller/common/order/name', $name);
168 168
 
169 169
 
170
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
171
-			->setMethods( array( 'update' ) )
172
-			->setConstructorArgs( array( $this->context ) )
170
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
171
+			->setMethods(array('update'))
172
+			->setConstructorArgs(array($this->context))
173 173
 			->getMock();
174 174
 
175
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
175
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
176 176
 
177
-		$orderCntlStub->expects( $this->once() )->method( 'update' );
177
+		$orderCntlStub->expects($this->once())->method('update');
178 178
 
179 179
 
180
-		$this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
180
+		$this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
181 181
 	}
182 182
 }
Please login to merge, or discard this patch.