Completed
Push — master ( 1eda01...8cfae7 )
by Aimeos
02:05
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,41 +80,41 @@  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 107
 			$start = $filter->getSliceStart();
108 108
 			$end = $start + $filter->getSliceSize();
109 109
 
110
-			$cmpfunc = $filter->createFunction( 'index.catalog:position', array( $listtype, $catIds, $start, $end ) );
111
-			$expr[] = $filter->compare( '>=', $cmpfunc, 0 );
110
+			$cmpfunc = $filter->createFunction('index.catalog:position', array($listtype, $catIds, $start, $end));
111
+			$expr[] = $filter->compare('>=', $cmpfunc, 0);
112 112
 
113
-			$sortfunc = $filter->createFunction( 'sort:index.catalog:position', array( $listtype, $catIds, $start, $end ) );
114
-			$filter->setSortations( [$filter->sort( $direction, $sortfunc ), $filter->sort( '+', 'product.id' )] );
113
+			$sortfunc = $filter->createFunction('sort:index.catalog:position', array($listtype, $catIds, $start, $end));
114
+			$filter->setSortations([$filter->sort($direction, $sortfunc), $filter->sort('+', 'product.id')]);
115 115
 		}
116 116
 
117
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
117
+		$filter->setConditions($filter->combine('&&', $expr));
118 118
 
119 119
 		return $filter;
120 120
 	}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
129 129
 	 * @since 2018.07
130 130
 	 */
131
-	public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds )
131
+	public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds)
132 132
 	{
133
-		if( !empty( $supIds ) )
133
+		if (!empty($supIds))
134 134
 		{
135
-			$supIds = $this->validateIds( $supIds );
135
+			$supIds = $this->validateIds($supIds);
136 136
 			$expr = array(
137
-				$filter->compare( '==', 'index.supplier.id', $supIds ),
137
+				$filter->compare('==', 'index.supplier.id', $supIds),
138 138
 				$filter->getConditions(),
139 139
 			);
140
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
140
+			$filter->setConditions($filter->combine('&&', $expr));
141 141
 		}
142 142
 
143 143
 		return $filter;
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
156 156
 	 * @since 2017.03
157 157
 	 */
158
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' )
158
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default')
159 159
 	{
160 160
 		$langid = $this->getContext()->getLocale()->getLanguageId();
161
-		$cmpfunc = $filter->createFunction( 'index.text:relevance', [$langid, $input] );
162
-		$expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() );
161
+		$cmpfunc = $filter->createFunction('index.text:relevance', [$langid, $input]);
162
+		$expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions());
163 163
 
164
-		return $filter->setConditions( $filter->combine( '&&', $expr ) );
164
+		return $filter->setConditions($filter->combine('&&', $expr));
165 165
 	}
166 166
 
167 167
 
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 * @return array Associative list of key values as key and the product count for this key as value
174 174
 	 * @since 2017.03
175 175
 	 */
176
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key )
176
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key)
177 177
 	{
178
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key );
178
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key);
179 179
 	}
180 180
 
181 181
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
191 191
 	 * @since 2017.03
192 192
 	 */
193
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
193
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
194 194
 	{
195 195
 		$sortations = [];
196 196
 		$context = $this->getContext();
197
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'index' );
197
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'index');
198 198
 
199 199
 
200 200
 		/** controller/frontend/product/ignore-dates
@@ -209,55 +209,55 @@  discard block
 block discarded – undo
209 209
 		 * @since 2017.10
210 210
 		 * @category Developer
211 211
 		 */
212
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
212
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
213 213
 		{
214 214
 			$search = $manager->createSearch();
215
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
215
+			$search->setConditions($search->compare('>', 'product.status', 0));
216 216
 		}
217 217
 		else
218 218
 		{
219
-			$search = $manager->createSearch( true );
219
+			$search = $manager->createSearch(true);
220 220
 		}
221 221
 
222 222
 
223
-		$expr = array( $search->compare( '!=', 'index.catalog.id', null ) );
223
+		$expr = array($search->compare('!=', 'index.catalog.id', null));
224 224
 
225
-		switch( $sort )
225
+		switch ($sort)
226 226
 		{
227 227
 			case 'code':
228
-				$sortations[] = $search->sort( $direction, 'product.code' );
228
+				$sortations[] = $search->sort($direction, 'product.code');
229 229
 				break;
230 230
 
231 231
 			case 'ctime':
232
-				$sortations[] = $search->sort( $direction, 'product.ctime' );
232
+				$sortations[] = $search->sort($direction, 'product.ctime');
233 233
 				break;
234 234
 
235 235
 			case 'name':
236 236
 				$langid = $context->getLocale()->getLanguageId();
237 237
 
238
-				$cmpfunc = $search->createFunction( 'index.text:name', [$langid] );
239
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
238
+				$cmpfunc = $search->createFunction('index.text:name', [$langid]);
239
+				$expr[] = $search->compare('!=', $cmpfunc, null);
240 240
 
241
-				$sortfunc = $search->createFunction( 'sort:index.text:name', [$langid] );
242
-				$sortations[] = $search->sort( $direction, $sortfunc );
241
+				$sortfunc = $search->createFunction('sort:index.text:name', [$langid]);
242
+				$sortations[] = $search->sort($direction, $sortfunc);
243 243
 				break;
244 244
 
245 245
 			case 'price':
246 246
 				$currencyid = $context->getLocale()->getCurrencyId();
247 247
 
248
-				$cmpfunc = $search->createFunction( 'index.price:value', array( $listtype, $currencyid, 'default' ) );
249
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
248
+				$cmpfunc = $search->createFunction('index.price:value', array($listtype, $currencyid, 'default'));
249
+				$expr[] = $search->compare('!=', $cmpfunc, null);
250 250
 
251
-				$sortfunc = $search->createFunction( 'sort:index.price:value', array( $listtype, $currencyid, 'default' ) );
252
-				$sortations[] = $search->sort( $direction, $sortfunc );
251
+				$sortfunc = $search->createFunction('sort:index.price:value', array($listtype, $currencyid, 'default'));
252
+				$sortations[] = $search->sort($direction, $sortfunc);
253 253
 				break;
254 254
 		}
255 255
 
256 256
 		$expr[] = $search->getConditions();
257 257
 
258
-		$search->setConditions( $search->combine( '&&', $expr ) );
259
-		$search->setSortations( $sortations );
260
-		$search->setSlice( $start, $size );
258
+		$search->setConditions($search->combine('&&', $expr));
259
+		$search->setSortations($sortations);
260
+		$search->setSlice($start, $size);
261 261
 
262 262
 		return $search;
263 263
 	}
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
272 272
 	 * @since 2017.03
273 273
 	 */
274
-	public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) )
274
+	public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'))
275 275
 	{
276
-		$items = $this->getItems( [$productId], $domains );
276
+		$items = $this->getItems([$productId], $domains);
277 277
 
278
-		if( ( $item = reset( $items ) ) !== false ) {
278
+		if (($item = reset($items)) !== false) {
279 279
 			return $item;
280 280
 		}
281 281
 
282
-		throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) );
282
+		throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId));
283 283
 	}
284 284
 
285 285
 
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 	 * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values
292 292
 	 * @since 2017.03
293 293
 	 */
294
-	public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) )
294
+	public function getItems(array $productIds, array $domains = array('media', 'price', 'text'))
295 295
 	{
296 296
 		$context = $this->getContext();
297
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
297
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
298 298
 
299 299
 		/** controller/frontend/order/ignore-dates
300 300
 		 * Ignore start and end dates of products
@@ -308,24 +308,24 @@  discard block
 block discarded – undo
308 308
 		 * @since 2017.08
309 309
 		 * @category Developer
310 310
 		 */
311
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
311
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
312 312
 		{
313 313
 			$search = $manager->createSearch();
314
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
314
+			$search->setConditions($search->compare('>', 'product.status', 0));
315 315
 		}
316 316
 		else
317 317
 		{
318
-			$search = $manager->createSearch( true );
318
+			$search = $manager->createSearch(true);
319 319
 		}
320 320
 
321 321
 		$expr = array(
322
-			$search->compare( '==', 'product.id', $productIds ),
322
+			$search->compare('==', 'product.id', $productIds),
323 323
 			$search->getConditions(),
324 324
 		);
325
-		$search->setConditions( $search->combine( '&&', $expr ) );
326
-		$search->setSlice( 0, count( $productIds ) );
325
+		$search->setConditions($search->combine('&&', $expr));
326
+		$search->setSlice(0, count($productIds));
327 327
 
328
-		return $manager->searchItems( $search, $domains );
328
+		return $manager->searchItems($search, $domains);
329 329
 	}
330 330
 
331 331
 
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
339 339
 	 * @since 2017.03
340 340
 	 */
341
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
341
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
342 342
 	{
343
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
343
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
344 344
 	}
345 345
 
346 346
 
@@ -350,16 +350,16 @@  discard block
 block discarded – undo
350 350
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
351 351
 	 * @return array List of catalog IDs
352 352
 	 */
353
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
353
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
354 354
 	{
355
-		if( $item->getStatus() < 1 ) {
355
+		if ($item->getStatus() < 1) {
356 356
 			return [];
357 357
 		}
358 358
 
359
-		$list = [ $item->getId() ];
359
+		$list = [$item->getId()];
360 360
 
361
-		foreach( $item->getChildren() as $child ) {
362
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
361
+		foreach ($item->getChildren() as $child) {
362
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
363 363
 		}
364 364
 
365 365
 		return $list;
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @param array $ids List of IDs to validate
373 373
 	 * @return array List of validated IDs
374 374
 	 */
375
-	protected function validateIds( array $ids )
375
+	protected function validateIds(array $ids)
376 376
 	{
377 377
 		$list = [];
378 378
 
379
-		foreach( $ids as $id )
379
+		foreach ($ids as $id)
380 380
 		{
381
-			if( $id != '' ) {
381
+			if ($id != '') {
382 382
 				$list[] = (int) $id;
383 383
 			}
384 384
 		}
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,34 +145,34 @@  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 174
 		$this->save(); // for reusing unpaid orders, might have side effects (!)
175
-		$this->createSubscriptions( $basket );
175
+		$this->createSubscriptions($basket);
176 176
 
177 177
 		return $basket;
178 178
 	}
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param boolean $default True to add default criteria (user logged in), false if not
187 187
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
188 188
 	 */
189
-	public function load( $id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true )
189
+	public function load($id, $parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL, $default = true)
190 190
 	{
191
-		return $this->domainManager->load( $id, $parts, false, $default );
191
+		return $this->domainManager->load($id, $parts, false, $default);
192 192
 	}
193 193
 
194 194
 
@@ -207,34 +207,34 @@  discard block
 block discarded – undo
207 207
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
208 208
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
209 209
 	 */
210
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
211
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
210
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
211
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
212 212
 	{
213 213
 		$attributeMap = [
214
-			'custom' => array_keys( $customAttributeValues ),
215
-			'config' => array_keys( $configAttributeIds ),
214
+			'custom' => array_keys($customAttributeValues),
215
+			'config' => array_keys($configAttributeIds),
216 216
 		];
217
-		$this->checkListRef( $prodid, 'attribute', $attributeMap );
217
+		$this->checkListRef($prodid, 'attribute', $attributeMap);
218 218
 
219 219
 
220 220
 		$context = $this->getContext();
221
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
221
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
222 222
 
223
-		$productItem = $productManager->getItem( $prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true );
224
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
225
-		$hidden = $productItem->getRefItems( 'attribute', null, 'hidden' );
223
+		$productItem = $productManager->getItem($prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true);
224
+		$prices = $productItem->getRefItems('price', 'default', 'default');
225
+		$hidden = $productItem->getRefItems('attribute', null, 'hidden');
226 226
 
227
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
228
-		$orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype );
227
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
228
+		$orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype);
229 229
 
230
-		$custAttr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues );
231
-		$confAttr = $this->getOrderProductAttributes( 'config', array_keys( $configAttributeIds ), [], $configAttributeIds );
232
-		$attr = array_merge( $custAttr, $confAttr, $this->getOrderProductAttributes( 'hidden', array_keys( $hidden ) ) );
230
+		$custAttr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues);
231
+		$confAttr = $this->getOrderProductAttributes('config', array_keys($configAttributeIds), [], $configAttributeIds);
232
+		$attr = array_merge($custAttr, $confAttr, $this->getOrderProductAttributes('hidden', array_keys($hidden)));
233 233
 
234
-		$orderBaseProductItem->setAttributeItems( $attr );
235
-		$orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) );
234
+		$orderBaseProductItem->setAttributeItems($attr);
235
+		$orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity));
236 236
 
237
-		$this->get()->addProduct( $orderBaseProductItem );
237
+		$this->get()->addProduct($orderBaseProductItem);
238 238
 		$this->save();
239 239
 	}
240 240
 
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param integer $position Position number (key) of the order product item
246 246
 	 */
247
-	public function deleteProduct( $position )
247
+	public function deleteProduct($position)
248 248
 	{
249
-		$product = $this->get()->getProduct( $position );
249
+		$product = $this->get()->getProduct($position);
250 250
 
251
-		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
251
+		if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
252 252
 		{
253
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually' );
254
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) );
253
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually');
254
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position));
255 255
 		}
256 256
 
257
-		$this->get()->deleteProduct( $position );
257
+		$this->get()->deleteProduct($position);
258 258
 		$this->save();
259 259
 	}
260 260
 
@@ -266,32 +266,32 @@  discard block
 block discarded – undo
266 266
 	 * @param integer $quantity New quantiy of the product item
267 267
 	 * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED
268 268
 	 */
269
-	public function editProduct( $position, $quantity, array $configAttributeCodes = [] )
269
+	public function editProduct($position, $quantity, array $configAttributeCodes = [])
270 270
 	{
271
-		$product = $this->get()->getProduct( $position );
271
+		$product = $this->get()->getProduct($position);
272 272
 
273
-		if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
273
+		if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
274 274
 		{
275
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be changed' );
276
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) );
275
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be changed');
276
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position));
277 277
 		}
278 278
 
279
-		$product->setQuantity( $quantity );
279
+		$product->setQuantity($quantity);
280 280
 
281 281
 		$attributes = $product->getAttributeItems();
282
-		foreach( $attributes as $key => $attribute )
282
+		foreach ($attributes as $key => $attribute)
283 283
 		{
284
-			if( in_array( $attribute->getCode(), $configAttributeCodes ) ) {
285
-				unset( $attributes[$key] );
284
+			if (in_array($attribute->getCode(), $configAttributeCodes)) {
285
+				unset($attributes[$key]);
286 286
 			}
287 287
 		}
288
-		$product->setAttributeItems( $attributes );
288
+		$product->setAttributeItems($attributes);
289 289
 
290
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
291
-		$productItem = $manager->findItem( $product->getProductCode(), array( 'price', 'text' ), true );
292
-		$product->setPrice( $this->calcPrice( $product, $productItem->getRefItems( 'price', 'default' ), $quantity ) );
290
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
291
+		$productItem = $manager->findItem($product->getProductCode(), array('price', 'text'), true);
292
+		$product->setPrice($this->calcPrice($product, $productItem->getRefItems('price', 'default'), $quantity));
293 293
 
294
-		$this->get()->editProduct( $product, $position );
294
+		$this->get()->editProduct($product, $position);
295 295
 
296 296
 		$this->save();
297 297
 	}
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @param string $code Coupon code entered by the user
304 304
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
305 305
 	 */
306
-	public function addCoupon( $code )
306
+	public function addCoupon($code)
307 307
 	{
308 308
 		$context = $this->getContext();
309 309
 
@@ -323,39 +323,39 @@  discard block
 block discarded – undo
323 323
 		 * @category User
324 324
 		 * @category Developer
325 325
 		 */
326
-		$allowed = $context->getConfig()->get( 'controller/frontend/basket/standard/coupon/allowed', 1 );
326
+		$allowed = $context->getConfig()->get('controller/frontend/basket/standard/coupon/allowed', 1);
327 327
 
328
-		if( $allowed <= count( $this->get()->getCoupons() ) )
328
+		if ($allowed <= count($this->get()->getCoupons()))
329 329
 		{
330
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Number of coupon codes exceeds the limit' );
331
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
330
+			$msg = $context->getI18n()->dt('controller/frontend', 'Number of coupon codes exceeds the limit');
331
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
332 332
 		}
333 333
 
334 334
 
335
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' );
335
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'coupon');
336 336
 
337 337
 		$search = $manager->createSearch();
338
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
339
-		$search->setSlice( 0, 1 );
338
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
339
+		$search->setSlice(0, 1);
340 340
 
341
-		$result = $manager->searchItems( $search );
341
+		$result = $manager->searchItems($search);
342 342
 
343
-		if( ( $item = reset( $result ) ) === false )
343
+		if (($item = reset($result)) === false)
344 344
 		{
345
-			$msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid or not available any more' ), $code );
346
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
345
+			$msg = sprintf($context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid or not available any more'), $code);
346
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
347 347
 		}
348 348
 
349 349
 
350
-		$provider = $manager->getProvider( $item, $code );
350
+		$provider = $manager->getProvider($item, $code);
351 351
 
352
-		if( $provider->isAvailable( $this->get() ) !== true )
352
+		if ($provider->isAvailable($this->get()) !== true)
353 353
 		{
354
-			$msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met' ), $code );
355
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
354
+			$msg = sprintf($context->getI18n()->dt('controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met'), $code);
355
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
356 356
 		}
357 357
 
358
-		$provider->addCoupon( $this->get() );
358
+		$provider->addCoupon($this->get());
359 359
 		$this->save();
360 360
 	}
361 361
 
@@ -366,24 +366,24 @@  discard block
 block discarded – undo
366 366
 	 * @param string $code Coupon code entered by the user
367 367
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
368 368
 	 */
369
-	public function deleteCoupon( $code )
369
+	public function deleteCoupon($code)
370 370
 	{
371 371
 		$context = $this->getContext();
372
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' );
372
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'coupon');
373 373
 
374 374
 		$search = $manager->createSearch();
375
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
376
-		$search->setSlice( 0, 1 );
375
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
376
+		$search->setSlice(0, 1);
377 377
 
378
-		$result = $manager->searchItems( $search );
378
+		$result = $manager->searchItems($search);
379 379
 
380
-		if( ( $item = reset( $result ) ) === false )
380
+		if (($item = reset($result)) === false)
381 381
 		{
382
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid' );
383
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $code ) );
382
+			$msg = $context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid');
383
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $code));
384 384
 		}
385 385
 
386
-		$manager->getProvider( $item, $code )->deleteCoupon( $this->get() );
386
+		$manager->getProvider($item, $code)->deleteCoupon($this->get());
387 387
 		$this->save();
388 388
 	}
389 389
 
@@ -396,30 +396,30 @@  discard block
 block discarded – undo
396 396
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of
397 397
 	 * 	if one of the keys is invalid when using an array with key/value pairs
398 398
 	 */
399
-	public function setAddress( $type, $value )
399
+	public function setAddress($type, $value)
400 400
 	{
401 401
 		$context = $this->getContext();
402
-		$address = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' )->createItem();
403
-		$address->setType( $type );
402
+		$address = \Aimeos\MShop\Factory::createManager($context, 'order/base/address')->createItem();
403
+		$address->setType($type);
404 404
 
405
-		if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface )
405
+		if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface)
406 406
 		{
407
-			$address->copyFrom( $value );
408
-			$this->get()->setAddress( $address, $type );
407
+			$address->copyFrom($value);
408
+			$this->get()->setAddress($address, $type);
409 409
 		}
410
-		else if( is_array( $value ) )
410
+		else if (is_array($value))
411 411
 		{
412
-			$this->setAddressFromArray( $address, $value );
413
-			$this->get()->setAddress( $address, $type );
412
+			$this->setAddressFromArray($address, $value);
413
+			$this->get()->setAddress($address, $type);
414 414
 		}
415
-		else if( $value === null )
415
+		else if ($value === null)
416 416
 		{
417
-			$this->get()->deleteAddress( $type );
417
+			$this->get()->deleteAddress($type);
418 418
 		}
419 419
 		else
420 420
 		{
421
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid value for address type "%1$s"' );
422
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $type ) );
421
+			$msg = $context->getI18n()->dt('controller/frontend', 'Invalid value for address type "%1$s"');
422
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $type));
423 423
 		}
424 424
 
425 425
 		$this->save();
@@ -435,42 +435,42 @@  discard block
 block discarded – undo
435 435
 	 * 	entered by the customer when choosing one of the delivery or payment options
436 436
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
437 437
 	 */
438
-	public function addService( $type, $id, array $attributes = [] )
438
+	public function addService($type, $id, array $attributes = [])
439 439
 	{
440 440
 		$context = $this->getContext();
441 441
 
442
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
443
-		$serviceItem = $serviceManager->getItem( $id, array( 'media', 'price', 'text' ) );
442
+		$serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
443
+		$serviceItem = $serviceManager->getItem($id, array('media', 'price', 'text'));
444 444
 
445
-		$provider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() );
446
-		$result = $provider->checkConfigFE( $attributes );
447
-		$unknown = array_diff_key( $attributes, $result );
445
+		$provider = $serviceManager->getProvider($serviceItem, $serviceItem->getType());
446
+		$result = $provider->checkConfigFE($attributes);
447
+		$unknown = array_diff_key($attributes, $result);
448 448
 
449
-		if( count( $unknown ) > 0 )
449
+		if (count($unknown) > 0)
450 450
 		{
451
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Unknown attributes "%1$s"' );
452
-			$msg = sprintf( $msg, implode( '","', array_keys( $unknown ) ) );
453
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
451
+			$msg = $context->getI18n()->dt('controller/frontend', 'Unknown attributes "%1$s"');
452
+			$msg = sprintf($msg, implode('","', array_keys($unknown)));
453
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
454 454
 		}
455 455
 
456
-		foreach( $result as $key => $value )
456
+		foreach ($result as $key => $value)
457 457
 		{
458
-			if( $value !== null ) {
459
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $value );
458
+			if ($value !== null) {
459
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($value);
460 460
 			}
461 461
 		}
462 462
 
463
-		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' );
463
+		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
464 464
 		$orderServiceItem = $orderBaseServiceManager->createItem();
465
-		$orderServiceItem->copyFrom( $serviceItem );
465
+		$orderServiceItem->copyFrom($serviceItem);
466 466
 
467 467
 		// remove service rebate of original price
468
-		$price = $provider->calcPrice( $this->get() )->setRebate( '0.00' );
469
-		$orderServiceItem->setPrice( $price );
468
+		$price = $provider->calcPrice($this->get())->setRebate('0.00');
469
+		$orderServiceItem->setPrice($price);
470 470
 
471
-		$provider->setConfigFE( $orderServiceItem, $attributes );
471
+		$provider->setConfigFE($orderServiceItem, $attributes);
472 472
 
473
-		$this->get()->addService( $orderServiceItem, $type );
473
+		$this->get()->addService($orderServiceItem, $type);
474 474
 		$this->save();
475 475
 	}
476 476
 
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
 	 *
481 481
 	 * @param string $type Service type code like 'payment' or 'delivery'
482 482
 	 */
483
-	public function deleteService( $type )
483
+	public function deleteService($type)
484 484
 	{
485
-		$this->get()->deleteService( $type );
485
+		$this->get()->deleteService($type);
486 486
 		$this->save();
487 487
 	}
488 488
 
@@ -495,18 +495,18 @@  discard block
 block discarded – undo
495 495
 	 * 	an address item.
496 496
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
497 497
 	 */
498
-	protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map )
498
+	protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map)
499 499
 	{
500
-		foreach( $map as $key => $value ) {
501
-			$map[$key] = strip_tags( $value ); // prevent XSS
500
+		foreach ($map as $key => $value) {
501
+			$map[$key] = strip_tags($value); // prevent XSS
502 502
 		}
503 503
 
504
-		$errors = $address->fromArray( $map );
504
+		$errors = $address->fromArray($map);
505 505
 
506
-		if( count( $errors ) > 0 )
506
+		if (count($errors) > 0)
507 507
 		{
508
-			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Invalid address properties, please check your input' );
509
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors );
508
+			$msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Invalid address properties, please check your input');
509
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
510 510
 		}
511 511
 	}
512 512
 }
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.
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->getAttributeItems();
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->getAttributeItems() as $attrItem ) {
301
+					foreach ($item->getAttributeItems() 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, count( $attributeIds ) );
369
+		$search->setConditions($search->combine('&&', $expr));
370
+		$search->setSlice(0, count($attributeIds));
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.
controller/frontend/src/Controller/Frontend/Service/Iface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
31 31
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
32 32
 	 */
33
-	public function checkAttributes( $serviceId, array $attributes );
33
+	public function checkAttributes($serviceId, array $attributes);
34 34
 
35 35
 	/**
36 36
 	 * Returns the service item for the given ID
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
40 40
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
41 41
 	 */
42
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] );
42
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text']);
43 43
 
44 44
 	/**
45 45
 	 * Returns the service providers for the given type
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
49 49
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
50 50
 	 */
51
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] );
51
+	public function getProviders($type = null, $ref = ['media', 'price', 'text']);
52 52
 
53 53
 	/**
54 54
 	 * Processes the service for the given order, e.g. payment and delivery services
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc.
62 62
 	 * 	or null if no form data is required
63 63
 	 */
64
-	public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params );
64
+	public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params);
65 65
 
66 66
 
67 67
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string $code Unique code of the service used for the current order
73 73
 	 * @return \Psr\Http\Message\ResponseInterface Response object
74 74
 	 */
75
-	public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code );
75
+	public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code);
76 76
 
77 77
 
78 78
 	/**
@@ -83,5 +83,5 @@  discard block
 block discarded – undo
83 83
 	 * @param string $orderid ID of the order whose payment status should be updated
84 84
 	 * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated
85 85
 	 */
86
-	public function updateSync( ServerRequestInterface $request, $code, $orderid );
86
+	public function updateSync(ServerRequestInterface $request, $code, $orderid);
87 87
 }
Please login to merge, or discard this patch.