Completed
Push — master ( 1d5010...eee81b )
by Aimeos
15:07
created
controller/frontend/src/Controller/Frontend/Catalog/Standard.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	/**
131 131
 	 * Returns the product item for the given ID if it's available
132 132
 	 *
133
-	 * @param array $ids List of product IDs
133
+	 * @param integer[] $ids List of product IDs
134 134
 	 * @param array $domains Domain names of items that are associated with the products and that should be fetched too
135 135
 	 * @return string[] List of product items implementing \Aimeos\MShop\Product\Item\Iface
136 136
 	 * @throws \Aimeos\Controller\Frontend\Catalog\Exception If product isn't available
@@ -266,6 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
267 267
 	 * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too
268 268
 	 * @param integer &$total Parameter where the total number of found products will be stored in
269
+	 * @param integer $total
269 270
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
270 271
 	 * @since 2015.08
271 272
 	 * @deprecated Use method in index controller instead
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager object
30 30
 	 * @since 2015.08
31 31
 	 */
32
-	public function createManager( $name )
32
+	public function createManager($name)
33 33
 	{
34
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), $name );
34
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), $name);
35 35
 	}
36 36
 
37 37
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function createFilter()
45 45
 	{
46
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( true );
46
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->createSearch(true);
47 47
 	}
48 48
 
49 49
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys
56 56
 	 * @since 2017.03
57 57
 	 */
58
-	public function getPath( $id, array $domains = array( 'text', 'media' ) )
58
+	public function getPath($id, array $domains = array('text', 'media'))
59 59
 	{
60
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains );
60
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getPath($id, $domains);
61 61
 	}
62 62
 
63 63
 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant
73 73
 	 * @since 2017.03
74 74
 	 */
75
-	public function getTree( $id = null, array $domains = array( 'text', 'media' ),
76
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null )
75
+	public function getTree($id = null, array $domains = array('text', 'media'),
76
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null)
77 77
 	{
78
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search );
78
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getTree($id, $domains, $level, $search);
79 79
 	}
80 80
 
81 81
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @since 2015.08
88 88
 	 * @deprecated Use createFilter() instead
89 89
 	 */
90
-	public function createCatalogFilter( $default = true )
90
+	public function createCatalogFilter($default = true)
91 91
 	{
92 92
 		return $this->createFilter();
93 93
 	}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @since 2015.08
103 103
 	 * @deprecated Use getPath() instead
104 104
 	 */
105
-	public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) )
105
+	public function getCatalogPath($id, array $domains = array('text', 'media'))
106 106
 	{
107
-		return $this->getPath( $id, $domains );
107
+		return $this->getPath($id, $domains);
108 108
 	}
109 109
 
110 110
 
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 	 * @since 2015.08
121 121
 	 * @deprecated Use getTree() instead
122 122
 	 */
123
-	public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ),
124
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null )
123
+	public function getCatalogTree($id = null, array $domains = array('text', 'media'),
124
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null)
125 125
 	{
126
-		return $this->getTree( $id, $domains, $level, $search );
126
+		return $this->getTree($id, $domains, $level, $search);
127 127
 	}
128 128
 
129 129
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	 * @since 2015.08
138 138
 	 * @deprecated Use getItems() method in index controller instead
139 139
 	 */
140
-	public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) )
140
+	public function getProductItems(array $ids, array $domains = array('media', 'price', 'text'))
141 141
 	{
142
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
143
-		return $cntl->getItems( $ids, $domains );
142
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
143
+		return $cntl->getItems($ids, $domains);
144 144
 	}
145 145
 
146 146
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 * @since 2015.08
154 154
 	 * @deprecated Use method in index controller instead
155 155
 	 */
156
-	public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key )
156
+	public function aggregateIndex(\Aimeos\MW\Criteria\Iface $filter, $key)
157 157
 	{
158
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
159
-		return $cntl->aggregate( $filter, $key );
158
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
159
+		return $cntl->aggregate($filter, $key);
160 160
 	}
161 161
 
162 162
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @since 2015.08
173 173
 	 * @deprecated Use method in index controller instead
174 174
 	 */
175
-	public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
175
+	public function createIndexFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
176 176
 	{
177
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
178
-		return $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
177
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
178
+		return $cntl->createFilter($sort, $direction, $start, $size, $listtype);
179 179
 	}
180 180
 
181 181
 
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 	 * @since 2015.08
193 193
 	 * @deprecated Use createIndexFilter() and addIndexFilterCategory() instead
194 194
 	 */
195
-	public function createIndexFilterCategory( $catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
195
+	public function createIndexFilterCategory($catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
196 196
 	{
197
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
197
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
198 198
 
199
-		$filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
200
-		$filter = $cntl->addFilterCategory( $filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype );
199
+		$filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype);
200
+		$filter = $cntl->addFilterCategory($filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype);
201 201
 
202 202
 		return $filter;
203 203
 	}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	 * @since 2015.08
217 217
 	 * @deprecated Use createIndexFilter() and addIndexFilterText() instead
218 218
 	 */
219
-	public function createIndexFilterText( $input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
219
+	public function createIndexFilterText($input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
220 220
 	{
221
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
221
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
222 222
 
223
-		$filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
224
-		$filter = $cntl->addFilterText( $filter, $input, $sort, $direction, $listtype );
223
+		$filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype);
224
+		$filter = $cntl->addFilterText($filter, $input, $sort, $direction, $listtype);
225 225
 
226 226
 		return $filter;
227 227
 	}
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	 * @since 2015.08
237 237
 	 * @deprecated Use method in index controller instead
238 238
 	 */
239
-	public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid )
239
+	public function addIndexFilterCategory(\Aimeos\MW\Criteria\Iface $search, $catid)
240 240
 	{
241
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
242
-		return $cntl->addFilterCategory( $search, $catid );
241
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
242
+		return $cntl->addFilterCategory($search, $catid);
243 243
 	}
244 244
 
245 245
 
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 * @since 2015.08
254 254
 	 * @deprecated Use method in index controller instead
255 255
 	 */
256
-	public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' )
256
+	public function addIndexFilterText(\Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default')
257 257
 	{
258
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
259
-		return $cntl->addFilterText( $search, $input, $listtype );
258
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
259
+		return $cntl->addFilterText($search, $input, $listtype);
260 260
 	}
261 261
 
262 262
 
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 	 * @since 2015.08
271 271
 	 * @deprecated Use method in index controller instead
272 272
 	 */
273
-	public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
273
+	public function getIndexItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
274 274
 	{
275
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' );
276
-		return $cntl->searchItems( $filter, $domains, $total );
275
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product');
276
+		return $cntl->searchItems($filter, $domains, $total);
277 277
 	}
278 278
 
279 279
 
@@ -290,37 +290,37 @@  discard block
 block discarded – undo
290 290
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
291 291
 	 * @deprecated Use createFilter() method in index controller instead
292 292
 	 */
293
-	public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' )
293
+	public function createTextFilter($input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name')
294 294
 	{
295 295
 		$locale = $this->getContext()->getLocale();
296 296
 		$langid = $locale->getLanguageId();
297 297
 
298
-		$search = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->createSearch( true );
298
+		$search = \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->createSearch(true);
299 299
 
300 300
 		$expr = array(
301
-			$search->compare( '>', $search->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ), 0 ),
302
-			$search->compare( '>', $search->createFunction( 'index.text.value', array( $listtype, $langid, $type, 'product' ) ), '' ),
301
+			$search->compare('>', $search->createFunction('index.text.relevance', array($listtype, $langid, $input)), 0),
302
+			$search->compare('>', $search->createFunction('index.text.value', array($listtype, $langid, $type, 'product')), ''),
303 303
 		);
304 304
 
305 305
 		$sortations = [];
306 306
 
307
-		switch( $sort )
307
+		switch ($sort)
308 308
 		{
309 309
 			case 'name':
310
-				$cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) );
311
-				$expr[] = $search->compare( '>=', $cmpfunc, '' );
310
+				$cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product'));
311
+				$expr[] = $search->compare('>=', $cmpfunc, '');
312 312
 
313
-				$sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) );
314
-				$sortations[] = $search->sort( $direction, $sortfunc );
313
+				$sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name'));
314
+				$sortations[] = $search->sort($direction, $sortfunc);
315 315
 				break;
316 316
 
317 317
 			case 'relevance':
318 318
 				// we don't need to sort by 'sort:index.text.relevance' because it's a boolean match (relevance is either 0 or 1)
319 319
 		}
320 320
 
321
-		$search->setConditions( $search->combine( '&&', $expr ) );
322
-		$search->setSortations( $sortations );
323
-		$search->setSlice( $start, $size );
321
+		$search->setConditions($search->combine('&&', $expr));
322
+		$search->setSortations($sortations);
323
+		$search->setSlice($start, $size);
324 324
 
325 325
 		return $search;
326 326
 	}
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	 * @return array Associative list of the product ID as key and the product text as value
334 334
 	 * @deprecated Use searchItems() method in index controller to retrieve product items instead
335 335
 	 */
336
-	public function getTextList( \Aimeos\MW\Criteria\Iface $filter )
336
+	public function getTextList(\Aimeos\MW\Criteria\Iface $filter)
337 337
 	{
338
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->searchTexts( $filter );
338
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->searchTexts($filter);
339 339
 	}
340 340
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Decorator/Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
 	/**
105 105
 	 * Returns the frontend controller
106 106
 	 *
107
-	 * @return \Aimeos\Controller\Frontend\Locale\Iface Frontend controller object
107
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
108 108
 	 */
109 109
 	protected function getController()
110 110
 	{
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  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 35
 		$iface = '\Aimeos\Controller\Frontend\Locale\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
81 81
 	 * @since 2017.03
82 82
 	 */
83
-	public function getItem( $id, array $domains = [] )
83
+	public function getItem($id, array $domains = [])
84 84
 	{
85
-		return $this->controller->getItem( $id, $domains );
85
+		return $this->controller->getItem($id, $domains);
86 86
 	}
87 87
 
88 88
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
96 96
 	 * @since 2017.03
97 97
 	 */
98
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null )
98
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null)
99 99
 	{
100
-		return $this->controller->searchItems( $filter, $domains, $total );
100
+		return $this->controller->searchItems($filter, $domains, $total);
101 101
 	}
102 102
 
103 103
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string|null $name Name of the controller implementaton (default: "Standard")
29 29
 	 * @return \Aimeos\Controller\Frontend\Locale\Iface Controller object
30 30
 	 */
31
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
31
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
32 32
 	{
33 33
 		/** controller/frontend/locale/name
34 34
 		 * Class name of the used locale frontend controller implementation
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 		 * @since 2014.03
64 64
 		 * @category Developer
65 65
 		 */
66
-		if( $name === null ) {
67
-			$name = $context->getConfig()->get( 'controller/frontend/locale/name', 'Standard' );
66
+		if ($name === null) {
67
+			$name = $context->getConfig()->get('controller/frontend/locale/name', 'Standard');
68 68
 		}
69 69
 
70
-		if( ctype_alnum( $name ) === false )
70
+		if (ctype_alnum($name) === false)
71 71
 		{
72
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name : '<not a string>';
73
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
72
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name : '<not a string>';
73
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
74 74
 		}
75 75
 
76 76
 		$iface = '\\Aimeos\\Controller\\Frontend\\Locale\\Iface';
77 77
 		$classname = '\\Aimeos\\Controller\\Frontend\\Locale\\' . $name;
78 78
 
79
-		$manager = self::createControllerBase( $context, $classname, $iface );
79
+		$manager = self::createControllerBase($context, $classname, $iface);
80 80
 
81 81
 		/** controller/frontend/locale/decorators/excludes
82 82
 		 * Excludes decorators added by the "common" option from the locale frontend controllers
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * @see controller/frontend/locale/decorators/excludes
153 153
 		 * @see controller/frontend/locale/decorators/global
154 154
 		 */
155
-		return self::addControllerDecorators( $context, $manager, 'locale' );
155
+		return self::addControllerDecorators($context, $manager, 'locale');
156 156
 	}
157 157
 
158 158
 }
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
@@ -311,17 +311,14 @@
 block discarded – undo
311 311
 		{
312 312
 			$address->copyFrom( $value );
313 313
 			$this->get()->setAddress( $address, $type );
314
-		}
315
-		else if( is_array( $value ) )
314
+		} else if( is_array( $value ) )
316 315
 		{
317 316
 			$this->setAddressFromArray( $address, $value );
318 317
 			$this->get()->setAddress( $address, $type );
319
-		}
320
-		else if( $value === null )
318
+		} else if( $value === null )
321 319
 		{
322 320
 			$this->get()->deleteAddress( $type );
323
-		}
324
-		else
321
+		} else
325 322
 		{
326 323
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
327 324
 		}
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
 	 * Sets 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   +130 added lines, -130 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->type );
67
+			$this->baskets[$this->type] = $this->domainManager->getSession($this->type);
68
+			$this->checkLocale($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;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		 * @category Developer
127 127
 		 * @see controller/frontend/basket/limit-seconds
128 128
 		 */
129
-		$count = $config->get( 'controller/frontend/basket/limit-count', 5 );
129
+		$count = $config->get('controller/frontend/basket/limit-count', 5);
130 130
 
131 131
 		/** controller/frontend/basket/limit-seconds
132 132
 		 * Order limitation time frame in seconds
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 		 * @category Developer
145 145
 		 * @see controller/frontend/basket/limit-count
146 146
 		 */
147
-		$seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 );
147
+		$seconds = $config->get('controller/frontend/basket/limit-seconds', 300);
148 148
 
149 149
 		$search = $this->domainManager->createSearch();
150 150
 		$expr = [
151
-			$search->compare( '==', 'order.base.editor', $this->getContext()->getEditor() ),
152
-			$search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
151
+			$search->compare('==', 'order.base.editor', $this->getContext()->getEditor()),
152
+			$search->compare('>=', 'order.base.ctime', date('Y-m-d H:i:s', time() - $seconds)),
153 153
 		];
154
-		$search->setConditions( $search->combine( '&&', $expr ) );
155
-		$search->setSlice( 0, 0 );
154
+		$search->setConditions($search->combine('&&', $expr));
155
+		$search->setSlice(0, 0);
156 156
 
157
-		$this->domainManager->searchItems( $search, [], $total );
157
+		$this->domainManager->searchItems($search, [], $total);
158 158
 
159
-		if( $total > $count ) {
160
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary order limit reached' ) );
159
+		if ($total > $count) {
160
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary order limit reached'));
161 161
 		}
162 162
 
163 163
 
164 164
 		$basket = $this->get()->finish();
165 165
 
166 166
 		$this->domainManager->begin();
167
-		$this->domainManager->store( $basket );
167
+		$this->domainManager->store($basket);
168 168
 		$this->domainManager->commit();
169 169
 
170 170
 		return $basket;
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	 * @param boolean $default True to add default criteria (user logged in), false if not
180 180
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
181 181
 	 */
182
-	public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true )
182
+	public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true)
183 183
 	{
184
-		return $this->domainManager->load( $id, $parts, false, $default );
184
+		return $this->domainManager->load($id, $parts, false, $default);
185 185
 	}
186 186
 
187 187
 
@@ -201,36 +201,36 @@  discard block
 block discarded – undo
201 201
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
202 202
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
203 203
 	 */
204
-	public function addProduct( $prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
204
+	public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
205 205
 		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [],
206
-		$stocktype = 'default' )
206
+		$stocktype = 'default')
207 207
 	{
208 208
 		$context = $this->getContext();
209
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
210
-		$productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ), true );
209
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
210
+		$productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'), true);
211 211
 
212
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
213
-		$orderBaseProductItem->copyFrom( $productItem );
214
-		$orderBaseProductItem->setQuantity( $quantity );
215
-		$orderBaseProductItem->setStockType( $stocktype );
212
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
213
+		$orderBaseProductItem->copyFrom($productItem);
214
+		$orderBaseProductItem->setQuantity($quantity);
215
+		$orderBaseProductItem->setStockType($stocktype);
216 216
 
217 217
 		$attr = [];
218
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
218
+		$prices = $productItem->getRefItems('price', 'default', 'default');
219 219
 
220
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
221
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
220
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
221
+		$price = $priceManager->getLowestPrice($prices, $quantity);
222 222
 
223
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) );
224
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) );
225
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
223
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config'));
224
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden'));
225
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
226 226
 
227 227
 		// remove product rebate of original price in favor to rebates granted for the order
228
-		$price->setRebate( '0.00' );
228
+		$price->setRebate('0.00');
229 229
 
230
-		$orderBaseProductItem->setPrice( $price );
231
-		$orderBaseProductItem->setAttributes( $attr );
230
+		$orderBaseProductItem->setPrice($price);
231
+		$orderBaseProductItem->setAttributes($attr);
232 232
 
233
-		$this->get()->addProduct( $orderBaseProductItem );
233
+		$this->get()->addProduct($orderBaseProductItem);
234 234
 		$this->save();
235 235
 	}
236 236
 
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @param integer $position Position number (key) of the order product item
242 242
 	 */
243
-	public function deleteProduct( $position )
243
+	public function deleteProduct($position)
244 244
 	{
245
-		$product = $this->get()->getProduct( $position );
245
+		$product = $this->get()->getProduct($position);
246 246
 
247
-		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
247
+		if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
248 248
 		{
249
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position );
250
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
249
+			$msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position);
250
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
251 251
 		}
252 252
 
253
-		$this->get()->deleteProduct( $position );
253
+		$this->get()->deleteProduct($position);
254 254
 		$this->save();
255 255
 	}
256 256
 
@@ -264,34 +264,34 @@  discard block
 block discarded – undo
264 264
 	 * 	The 'stock'=>false option allows adding products without being in stock.
265 265
 	 * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED
266 266
 	 */
267
-	public function editProduct( $position, $quantity, array $options = [],
268
-		array $configAttributeCodes = [] )
267
+	public function editProduct($position, $quantity, array $options = [],
268
+		array $configAttributeCodes = [])
269 269
 	{
270
-		$product = $this->get()->getProduct( $position );
270
+		$product = $this->get()->getProduct($position);
271 271
 
272
-		if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
272
+		if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
273 273
 		{
274
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position );
275
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
274
+			$msg = sprintf('Basket item at position "%1$d" cannot be changed', $position);
275
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
276 276
 		}
277 277
 
278
-		$product->setQuantity( $quantity );
278
+		$product->setQuantity($quantity);
279 279
 
280 280
 		$attributes = $product->getAttributes();
281
-		foreach( $attributes as $key => $attribute )
281
+		foreach ($attributes as $key => $attribute)
282 282
 		{
283
-			if( in_array( $attribute->getCode(), $configAttributeCodes ) ) {
284
-				unset( $attributes[$key] );
283
+			if (in_array($attribute->getCode(), $configAttributeCodes)) {
284
+				unset($attributes[$key]);
285 285
 			}
286 286
 		}
287
-		$product->setAttributes( $attributes );
287
+		$product->setAttributes($attributes);
288 288
 
289
-		$productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) );
290
-		$prices = $productItem->getRefItems( 'price', 'default' );
291
-		$product->setPrice( $this->calcPrice( $product, $prices, $quantity ) );
289
+		$productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text'));
290
+		$prices = $productItem->getRefItems('price', 'default');
291
+		$product->setPrice($this->calcPrice($product, $prices, $quantity));
292 292
 
293
-		$this->get()->deleteProduct( $position );
294
-		$this->get()->addProduct( $product, $position );
293
+		$this->get()->deleteProduct($position);
294
+		$this->get()->addProduct($product, $position);
295 295
 
296 296
 		$this->save();
297 297
 	}
@@ -303,49 +303,49 @@  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
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
309
-		$codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' );
308
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
309
+		$codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code');
310 310
 
311 311
 
312
-		$search = $codeManager->createSearch( true );
312
+		$search = $codeManager->createSearch(true);
313 313
 		$expr = array(
314
-			$search->compare( '==', 'coupon.code.code', $code ),
314
+			$search->compare('==', 'coupon.code.code', $code),
315 315
 			$search->getConditions(),
316 316
 		);
317
-		$search->setConditions( $search->combine( '&&', $expr ) );
318
-		$search->setSlice( 0, 1 );
317
+		$search->setConditions($search->combine('&&', $expr));
318
+		$search->setSlice(0, 1);
319 319
 
320
-		$result = $codeManager->searchItems( $search );
320
+		$result = $codeManager->searchItems($search);
321 321
 
322
-		if( ( $codeItem = reset( $result ) ) === false ) {
323
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) );
322
+		if (($codeItem = reset($result)) === false) {
323
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code));
324 324
 		}
325 325
 
326 326
 
327
-		$search = $manager->createSearch( true );
327
+		$search = $manager->createSearch(true);
328 328
 		$expr = array(
329
-			$search->compare( '==', 'coupon.id', $codeItem->getParentId() ),
329
+			$search->compare('==', 'coupon.id', $codeItem->getParentId()),
330 330
 			$search->getConditions(),
331 331
 		);
332
-		$search->setConditions( $search->combine( '&&', $expr ) );
333
-		$search->setSlice( 0, 1 );
332
+		$search->setConditions($search->combine('&&', $expr));
333
+		$search->setSlice(0, 1);
334 334
 
335
-		$result = $manager->searchItems( $search );
335
+		$result = $manager->searchItems($search);
336 336
 
337
-		if( ( $item = reset( $result ) ) === false ) {
338
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) );
337
+		if (($item = reset($result)) === false) {
338
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code));
339 339
 		}
340 340
 
341 341
 
342
-		$provider = $manager->getProvider( $item, $code );
342
+		$provider = $manager->getProvider($item, $code);
343 343
 
344
-		if( $provider->isAvailable( $this->get() ) !== true ) {
345
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) );
344
+		if ($provider->isAvailable($this->get()) !== true) {
345
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code));
346 346
 		}
347 347
 
348
-		$provider->addCoupon( $this->get() );
348
+		$provider->addCoupon($this->get());
349 349
 		$this->save();
350 350
 	}
351 351
 
@@ -356,21 +356,21 @@  discard block
 block discarded – undo
356 356
 	 * @param string $code Coupon code entered by the user
357 357
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
358 358
 	 */
359
-	public function deleteCoupon( $code )
359
+	public function deleteCoupon($code)
360 360
 	{
361
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
361
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
362 362
 
363 363
 		$search = $manager->createSearch();
364
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
365
-		$search->setSlice( 0, 1 );
364
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
365
+		$search->setSlice(0, 1);
366 366
 
367
-		$result = $manager->searchItems( $search );
367
+		$result = $manager->searchItems($search);
368 368
 
369
-		if( ( $item = reset( $result ) ) === false ) {
370
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) );
369
+		if (($item = reset($result)) === false) {
370
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code));
371 371
 		}
372 372
 
373
-		$manager->getProvider( $item, $code )->deleteCoupon( $this->get() );
373
+		$manager->getProvider($item, $code)->deleteCoupon($this->get());
374 374
 		$this->save();
375 375
 	}
376 376
 
@@ -383,28 +383,28 @@  discard block
 block discarded – undo
383 383
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of
384 384
 	 * 	if one of the keys is invalid when using an array with key/value pairs
385 385
 	 */
386
-	public function setAddress( $type, $value )
386
+	public function setAddress($type, $value)
387 387
 	{
388
-		$address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem();
389
-		$address->setType( $type );
388
+		$address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem();
389
+		$address->setType($type);
390 390
 
391
-		if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface )
391
+		if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface)
392 392
 		{
393
-			$address->copyFrom( $value );
394
-			$this->get()->setAddress( $address, $type );
393
+			$address->copyFrom($value);
394
+			$this->get()->setAddress($address, $type);
395 395
 		}
396
-		else if( is_array( $value ) )
396
+		else if (is_array($value))
397 397
 		{
398
-			$this->setAddressFromArray( $address, $value );
399
-			$this->get()->setAddress( $address, $type );
398
+			$this->setAddressFromArray($address, $value);
399
+			$this->get()->setAddress($address, $type);
400 400
 		}
401
-		else if( $value === null )
401
+		else if ($value === null)
402 402
 		{
403
-			$this->get()->deleteAddress( $type );
403
+			$this->get()->deleteAddress($type);
404 404
 		}
405 405
 		else
406 406
 		{
407
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
407
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type));
408 408
 		}
409 409
 
410 410
 		$this->save();
@@ -420,48 +420,48 @@  discard block
 block discarded – undo
420 420
 	 * 	entered by the customer when choosing one of the delivery or payment options
421 421
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
422 422
 	 */
423
-	public function setService( $type, $id, array $attributes = [] )
423
+	public function setService($type, $id, array $attributes = [])
424 424
 	{
425
-		if( $id === null )
425
+		if ($id === null)
426 426
 		{
427
-			$this->get()->deleteService( $type );
427
+			$this->get()->deleteService($type);
428 428
 			$this->save();
429 429
 			return;
430 430
 		}
431 431
 
432 432
 		$context = $this->getContext();
433 433
 
434
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
435
-		$serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) );
434
+		$serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
435
+		$serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text'));
436 436
 
437
-		$provider = $serviceManager->getProvider( $serviceItem );
438
-		$result = $provider->checkConfigFE( $attributes );
439
-		$unknown = array_diff_key( $attributes, $result );
437
+		$provider = $serviceManager->getProvider($serviceItem);
438
+		$result = $provider->checkConfigFE($attributes);
439
+		$unknown = array_diff_key($attributes, $result);
440 440
 
441
-		if( count( $unknown ) > 0 )
441
+		if (count($unknown) > 0)
442 442
 		{
443
-			$msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) );
444
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
443
+			$msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown)));
444
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
445 445
 		}
446 446
 
447
-		foreach( $result as $key => $value )
447
+		foreach ($result as $key => $value)
448 448
 		{
449
-			if( $value !== null ) {
450
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $value );
449
+			if ($value !== null) {
450
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($value);
451 451
 			}
452 452
 		}
453 453
 
454
-		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' );
454
+		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
455 455
 		$orderServiceItem = $orderBaseServiceManager->createItem();
456
-		$orderServiceItem->copyFrom( $serviceItem );
456
+		$orderServiceItem->copyFrom($serviceItem);
457 457
 
458 458
 		// remove service rebate of original price
459
-		$price = $provider->calcPrice( $this->get() )->setRebate( '0.00' );
460
-		$orderServiceItem->setPrice( $price );
459
+		$price = $provider->calcPrice($this->get())->setRebate('0.00');
460
+		$orderServiceItem->setPrice($price);
461 461
 
462
-		$provider->setConfigFE( $orderServiceItem, $attributes );
462
+		$provider->setConfigFE($orderServiceItem, $attributes);
463 463
 
464
-		$this->get()->setService( $orderServiceItem, $type );
464
+		$this->get()->setService($orderServiceItem, $type);
465 465
 		$this->save();
466 466
 	}
467 467
 
@@ -474,18 +474,18 @@  discard block
 block discarded – undo
474 474
 	 * 	an address item.
475 475
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
476 476
 	 */
477
-	protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map )
477
+	protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map)
478 478
 	{
479
-		foreach( $map as $key => $value ) {
480
-			$map[$key] = strip_tags( $value ); // prevent XSS
479
+		foreach ($map as $key => $value) {
480
+			$map[$key] = strip_tags($value); // prevent XSS
481 481
 		}
482 482
 
483
-		$errors = $address->fromArray( $map );
483
+		$errors = $address->fromArray($map);
484 484
 
485
-		if( count( $errors ) > 0 )
485
+		if (count($errors) > 0)
486 486
 		{
487
-			$msg = sprintf( 'Invalid address properties, please check your input' );
488
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors );
487
+			$msg = sprintf('Invalid address properties, please check your input');
488
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
489 489
 		}
490 490
 	}
491 491
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Base.php 2 patches
Doc Comments   +2 added lines, -2 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
 	{
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	/**
248 248
 	 * Returns the frontend controller
249 249
 	 *
250
-	 * @return \Aimeos\Controller\Frontend\Basket\Iface Frontend controller object
250
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
251 251
 	 */
252 252
 	protected function getController()
253 253
 	{
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  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 35
 		$iface = '\Aimeos\Controller\Frontend\Basket\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @param string $type Basket type
98 98
 	 * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object
99 99
 	 */
100
-	public function setType( $type )
100
+	public function setType($type)
101 101
 	{
102
-		$this->controller->setType( $type );
102
+		$this->controller->setType($type);
103 103
 		return $this;
104 104
 	}
105 105
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	 * @param boolean $default True to add default criteria (user logged in), false if not
124 124
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts
125 125
 	 */
126
-	public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true )
126
+	public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true)
127 127
 	{
128
-		return $this->controller->load( $id, $parts, $default );
128
+		return $this->controller->load($id, $parts, $default);
129 129
 	}
130 130
 
131 131
 
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
151 151
 	 * @return void
152 152
 	 */
153
-	public function addProduct( $prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
153
+	public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
154 154
 		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [],
155
-		$stocktype = 'default' )
155
+		$stocktype = 'default')
156 156
 	{
157 157
 		$this->controller->addProduct(
158 158
 			$prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds,
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 * @param integer $position Position number (key) of the order product item
168 168
 	 * @return void
169 169
 	 */
170
-	public function deleteProduct( $position )
170
+	public function deleteProduct($position)
171 171
 	{
172
-		$this->controller->deleteProduct( $position );
172
+		$this->controller->deleteProduct($position);
173 173
 	}
174 174
 
175 175
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @param array $configAttributeCodes Codes of the product config attributes that should be REMOVED
183 183
 	 * @return void
184 184
 	 */
185
-	public function editProduct( $position, $quantity, array $options = [], array $configAttributeCodes = [] )
185
+	public function editProduct($position, $quantity, array $options = [], array $configAttributeCodes = [])
186 186
 	{
187
-		$this->controller->editProduct( $position, $quantity, $options, $configAttributeCodes );
187
+		$this->controller->editProduct($position, $quantity, $options, $configAttributeCodes);
188 188
 	}
189 189
 
190 190
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
196 196
 	 * @return void
197 197
 	 */
198
-	public function addCoupon( $code )
198
+	public function addCoupon($code)
199 199
 	{
200
-		$this->controller->addCoupon( $code );
200
+		$this->controller->addCoupon($code);
201 201
 	}
202 202
 
203 203
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
209 209
 	 * @return void
210 210
 	 */
211
-	public function deleteCoupon( $code )
211
+	public function deleteCoupon($code)
212 212
 	{
213
-		$this->controller->deleteCoupon( $code );
213
+		$this->controller->deleteCoupon($code);
214 214
 	}
215 215
 
216 216
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	 * 	if one of the keys is invalid when using an array with key/value pairs
224 224
 	 * @return void
225 225
 	 */
226
-	public function setAddress( $type, $value )
226
+	public function setAddress($type, $value)
227 227
 	{
228
-		$this->controller->setAddress( $type, $value );
228
+		$this->controller->setAddress($type, $value);
229 229
 	}
230 230
 
231 231
 
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
240 240
 	 * @return void
241 241
 	 */
242
-	public function setService( $type, $id, array $attributes = [] )
242
+	public function setService($type, $id, array $attributes = [])
243 243
 	{
244
-		$this->controller->setService( $type, $id, $attributes );
244
+		$this->controller->setService($type, $id, $attributes);
245 245
 	}
246 246
 
247 247
 
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/BaseTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -276,6 +276,9 @@
 block discarded – undo
276 276
 	}
277 277
 
278 278
 
279
+	/**
280
+	 * @param string $name
281
+	 */
279 282
 	protected function access( $name )
280 283
 	{
281 284
 		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Base' );
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -21,46 +21,46 @@  discard block
 block discarded – undo
21 21
 
22 22
 	protected function tearDown()
23 23
 	{
24
-		$this->context->getSession()->set( 'aimeos', [] );
24
+		$this->context->getSession()->set('aimeos', []);
25 25
 
26
-		unset( $this->context );
26
+		unset($this->context);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testCheckLocale()
31 31
 	{
32
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
33
-			->setConstructorArgs( [$this->context] )
34
-			->setMethods( null )
32
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
33
+			->setConstructorArgs([$this->context])
34
+			->setMethods(null)
35 35
 			->getMock();
36 36
 
37
-		$this->context->getSession()->set( 'aimeos/basket/locale', 'unittest|en|EUR' );
38
-		$this->access( 'checkLocale' )->invokeArgs( $object, ['unittest'] );
37
+		$this->context->getSession()->set('aimeos/basket/locale', 'unittest|en|EUR');
38
+		$this->access('checkLocale')->invokeArgs($object, ['unittest']);
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testCopyAddresses()
43 43
 	{
44
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
44
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
45 45
 		$ordBaseItem = $manager->createItem();
46 46
 
47
-		$address = $this->getAddress( 'Example company' );
48
-		$ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
47
+		$address = $this->getAddress('Example company');
48
+		$ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
49 49
 
50 50
 
51
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
52
-			->setConstructorArgs( [$this->context] )
53
-			->setMethods( null )
51
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
52
+			->setConstructorArgs([$this->context])
53
+			->setMethods(null)
54 54
 			->getMock();
55 55
 
56
-		$result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
56
+		$result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
57 57
 
58 58
 
59
-		$this->assertEquals( ['test'], $result );
60
-		$this->assertEquals( 1, count( $object->get()->getAddresses() ) );
59
+		$this->assertEquals(['test'], $result);
60
+		$this->assertEquals(1, count($object->get()->getAddresses()));
61 61
 
62
-		$addr = $object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
63
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Address\Iface', $addr );
62
+		$addr = $object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
63
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Address\Iface', $addr);
64 64
 
65 65
 		$object->clear();
66 66
 	}
@@ -68,54 +68,54 @@  discard block
 block discarded – undo
68 68
 
69 69
 	public function testCopyAddressesException()
70 70
 	{
71
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
71
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
72 72
 		$ordBaseItem = $manager->createItem();
73 73
 
74
-		$address = $this->getAddress( 'Example company' );
75
-		$ordBaseItem->setAddress( $address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
74
+		$address = $this->getAddress('Example company');
75
+		$ordBaseItem->setAddress($address, \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
76 76
 
77 77
 
78
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
79
-			->setConstructorArgs( [$this->context] )
80
-			->setMethods( ['setAddress'] )
78
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
79
+			->setConstructorArgs([$this->context])
80
+			->setMethods(['setAddress'])
81 81
 			->getMock();
82 82
 
83
-		$object->expects( $this->once() )->method( 'setAddress' )->will( $this->throwException( new \Exception() ) );
83
+		$object->expects($this->once())->method('setAddress')->will($this->throwException(new \Exception()));
84 84
 
85
-		$result = $this->access( 'copyAddresses' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
85
+		$result = $this->access('copyAddresses')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
86 86
 
87
-		$this->assertEquals( 1, count( $result ) );
88
-		$this->assertArrayHasKey( 'address', $result );
87
+		$this->assertEquals(1, count($result));
88
+		$this->assertArrayHasKey('address', $result);
89 89
 	}
90 90
 
91 91
 
92 92
 	public function testCopyCoupon()
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
94
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
95 95
 		$ordBaseItem = $manager->createItem();
96 96
 
97
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC', ['price'] );
98
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
99
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
97
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC', ['price']);
98
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
99
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
100 100
 
101
-		$priceItems = $product->getRefItems( 'price' );
102
-		$ordProdItem->setPrice( reset( $priceItems ) );
101
+		$priceItems = $product->getRefItems('price');
102
+		$ordProdItem->setPrice(reset($priceItems));
103 103
 
104
-		$ordBaseItem->addProduct( $ordProdItem );
105
-		$ordBaseItem->addCoupon( 'OPQR', [] );
104
+		$ordBaseItem->addProduct($ordProdItem);
105
+		$ordBaseItem->addCoupon('OPQR', []);
106 106
 
107 107
 
108
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
109
-			->setConstructorArgs( [$this->context] )
110
-			->setMethods( null )
108
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
109
+			->setConstructorArgs([$this->context])
110
+			->setMethods(null)
111 111
 			->getMock();
112 112
 
113
-		$object->addProduct( $product->getId() );
113
+		$object->addProduct($product->getId());
114 114
 
115
-		$result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
115
+		$result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
116 116
 
117 117
 
118
-		$this->assertEquals( ['test'], $result );
118
+		$this->assertEquals(['test'], $result);
119 119
 
120 120
 		$object->clear();
121 121
 	}
@@ -123,48 +123,48 @@  discard block
 block discarded – undo
123 123
 
124 124
 	public function testCopyCouponException()
125 125
 	{
126
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
126
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
127 127
 		$ordBaseItem = $manager->createItem();
128 128
 
129
-		$ordBaseItem->addCoupon( '90AB', [] );
129
+		$ordBaseItem->addCoupon('90AB', []);
130 130
 
131 131
 
132
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
133
-			->setConstructorArgs( [$this->context] )
134
-			->setMethods( ['addCoupon'] )
132
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
133
+			->setConstructorArgs([$this->context])
134
+			->setMethods(['addCoupon'])
135 135
 			->getMock();
136 136
 
137
-		$object->expects( $this->once() )->method( 'addCoupon' )->will( $this->throwException( new \Exception() ) );
137
+		$object->expects($this->once())->method('addCoupon')->will($this->throwException(new \Exception()));
138 138
 
139
-		$result = $this->access( 'copyCoupons' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
139
+		$result = $this->access('copyCoupons')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
140 140
 
141
-		$this->assertEquals( 1, count( $result ) );
142
-		$this->assertArrayHasKey( 'coupon', $result );
141
+		$this->assertEquals(1, count($result));
142
+		$this->assertArrayHasKey('coupon', $result);
143 143
 	}
144 144
 
145 145
 
146 146
 	public function testCopyProduct()
147 147
 	{
148
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
148
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
149 149
 		$ordBaseItem = $manager->createItem();
150 150
 
151
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
152
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
153
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
154
-		$ordBaseItem->addProduct( $ordProdItem );
151
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
152
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
153
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
154
+		$ordBaseItem->addProduct($ordProdItem);
155 155
 
156 156
 
157
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
158
-			->setConstructorArgs( [$this->context] )
159
-			->setMethods( null )
157
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
158
+			->setConstructorArgs([$this->context])
159
+			->setMethods(null)
160 160
 			->getMock();
161 161
 
162
-		$result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
162
+		$result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
163 163
 
164 164
 
165
-		$this->assertEquals( ['test'], $result );
166
-		$this->assertEquals( 1, count( $object->get()->getProducts() ) );
167
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Product\Iface', $object->get()->getProduct( 0 ) );
165
+		$this->assertEquals(['test'], $result);
166
+		$this->assertEquals(1, count($object->get()->getProducts()));
167
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Product\Iface', $object->get()->getProduct(0));
168 168
 
169 169
 		$object->clear();
170 170
 	}
@@ -172,56 +172,56 @@  discard block
 block discarded – undo
172 172
 
173 173
 	public function testCopyProductException()
174 174
 	{
175
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
175
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
176 176
 		$ordBaseItem = $manager->createItem();
177 177
 
178
-		$product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
179
-		$ordProdManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/product' );
180
-		$ordProdItem = $ordProdManager->createItem()->copyFrom( $product );
181
-		$ordBaseItem->addProduct( $ordProdItem );
178
+		$product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
179
+		$ordProdManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/product');
180
+		$ordProdItem = $ordProdManager->createItem()->copyFrom($product);
181
+		$ordBaseItem->addProduct($ordProdItem);
182 182
 
183 183
 
184
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
185
-			->setConstructorArgs( [$this->context] )
186
-			->setMethods( ['addProduct'] )
184
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
185
+			->setConstructorArgs([$this->context])
186
+			->setMethods(['addProduct'])
187 187
 			->getMock();
188 188
 
189
-		$object->expects( $this->once() )->method( 'addProduct' )->will( $this->throwException( new \Exception() ) );
189
+		$object->expects($this->once())->method('addProduct')->will($this->throwException(new \Exception()));
190 190
 
191
-		$result = $this->access( 'copyProducts' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
191
+		$result = $this->access('copyProducts')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
192 192
 
193
-		$this->assertEquals( 1, count( $result ) );
194
-		$this->assertArrayHasKey( 'product', $result );
193
+		$this->assertEquals(1, count($result));
194
+		$this->assertArrayHasKey('product', $result);
195 195
 	}
196 196
 
197 197
 
198 198
 	public function testCopyServices()
199 199
 	{
200
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
200
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
201 201
 		$ordBaseItem = $manager->createItem();
202 202
 
203
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
204
-		$ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' );
203
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
204
+		$ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service');
205 205
 
206
-		$serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' );
207
-		$ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem );
206
+		$serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery');
207
+		$ordServItem = $ordServManager->createItem()->copyFrom($serviceItem);
208 208
 
209
-		$ordBaseItem->setService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
209
+		$ordBaseItem->setService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
210 210
 
211 211
 
212
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
213
-			->setConstructorArgs( [$this->context] )
214
-			->setMethods( null )
212
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
213
+			->setConstructorArgs([$this->context])
214
+			->setMethods(null)
215 215
 			->getMock();
216 216
 
217
-		$result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, ['test'], 'unittest|en|EUR'] );
217
+		$result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, ['test'], 'unittest|en|EUR']);
218 218
 
219 219
 
220
-		$this->assertEquals( ['test'], $result );
221
-		$this->assertEquals( 1, count( $object->get()->getServices() ) );
220
+		$this->assertEquals(['test'], $result);
221
+		$this->assertEquals(1, count($object->get()->getServices()));
222 222
 
223
-		$service = $object->get()->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
224
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Service\Iface', $service );
223
+		$service = $object->get()->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
224
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Service\Iface', $service);
225 225
 
226 226
 		$object->clear();
227 227
 	}
@@ -229,58 +229,58 @@  discard block
 block discarded – undo
229 229
 
230 230
 	public function testCopyServicesException()
231 231
 	{
232
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base' );
232
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base');
233 233
 		$ordBaseItem = $manager->createItem();
234 234
 
235
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
236
-		$ordServManager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base/service' );
235
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
236
+		$ordServManager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base/service');
237 237
 
238
-		$serviceItem = $serviceManager->findItem( 'unitcode', [], 'service', 'delivery' );
239
-		$ordServItem = $ordServManager->createItem()->copyFrom( $serviceItem );
238
+		$serviceItem = $serviceManager->findItem('unitcode', [], 'service', 'delivery');
239
+		$ordServItem = $ordServManager->createItem()->copyFrom($serviceItem);
240 240
 
241
-		$ordBaseItem->setService( $ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY );
241
+		$ordBaseItem->setService($ordServItem, \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
242 242
 
243 243
 
244
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
245
-			->setConstructorArgs( [$this->context] )
246
-			->setMethods( ['setService'] )
244
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
245
+			->setConstructorArgs([$this->context])
246
+			->setMethods(['setService'])
247 247
 			->getMock();
248 248
 
249
-		$object->expects( $this->once() )->method( 'setService' )->will( $this->throwException( new \Exception() ) );
249
+		$object->expects($this->once())->method('setService')->will($this->throwException(new \Exception()));
250 250
 
251
-		$result = $this->access( 'copyServices' )->invokeArgs( $object, [$ordBaseItem, [], 'unittest|en|EUR'] );
251
+		$result = $this->access('copyServices')->invokeArgs($object, [$ordBaseItem, [], 'unittest|en|EUR']);
252 252
 
253
-		$this->assertEquals( 0, count( $result ) );
253
+		$this->assertEquals(0, count($result));
254 254
 	}
255 255
 
256 256
 
257 257
 	/**
258 258
 	 * @param string $company
259 259
 	 */
260
-	protected function getAddress( $company )
260
+	protected function getAddress($company)
261 261
 	{
262
-		$manager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'customer/address' );
262
+		$manager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'customer/address');
263 263
 
264 264
 		$search = $manager->createSearch();
265
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
266
-		$items = $manager->searchItems( $search );
265
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
266
+		$items = $manager->searchItems($search);
267 267
 
268
-		if( ( $item = reset( $items ) ) === false ) {
269
-			throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) );
268
+		if (($item = reset($items)) === false) {
269
+			throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
270 270
 		}
271 271
 
272
-		$ordAddrManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'order/base/address' );
273
-		$ordAddrItem = $ordAddrManager->createItem()->copyFrom( $item );
272
+		$ordAddrManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'order/base/address');
273
+		$ordAddrItem = $ordAddrManager->createItem()->copyFrom($item);
274 274
 
275 275
 		return $ordAddrItem;
276 276
 	}
277 277
 
278 278
 
279
-	protected function access( $name )
279
+	protected function access($name)
280 280
 	{
281
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Base' );
282
-		$method = $class->getMethod( $name );
283
-		$method->setAccessible( true );
281
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Base');
282
+		$method = $class->getMethod($name);
283
+		$method->setAccessible(true);
284 284
 
285 285
 		return $method;
286 286
 	}
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
 	 * Sets 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   +10 added lines, -10 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\Manager\Base\Base::PARTS_ALL, $default = true );
72
+	public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true);
73 73
 
74 74
 
75 75
 	/**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
90 90
 	 * @return void
91 91
 	 */
92
-	public function addProduct( $prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
92
+	public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [],
93 93
 		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [],
94
-		$stocktype = 'default' );
94
+		$stocktype = 'default');
95 95
 
96 96
 
97 97
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param integer $position Position number (key) of the order product item
101 101
 	 * @return void
102 102
 	 */
103
-	public function deleteProduct( $position );
103
+	public function deleteProduct($position);
104 104
 
105 105
 
106 106
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param array $configAttributeCodes Codes of the product config attributes that should be REMOVED
112 112
 	 * @return void
113 113
 	 */
114
-	public function editProduct( $position, $quantity, array $configAttributeCodes = [] );
114
+	public function editProduct($position, $quantity, array $configAttributeCodes = []);
115 115
 
116 116
 
117 117
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
122 122
 	 * @return void
123 123
 	 */
124
-	public function addCoupon( $code );
124
+	public function addCoupon($code);
125 125
 
126 126
 
127 127
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
132 132
 	 * @return void
133 133
 	 */
134
-	public function deleteCoupon( $code );
134
+	public function deleteCoupon($code);
135 135
 
136 136
 
137 137
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * 	if one of the keys is invalid when using an array with key/value pairs
144 144
 	 * @return void
145 145
 	 */
146
-	public function setAddress( $type, $value );
146
+	public function setAddress($type, $value);
147 147
 
148 148
 
149 149
 	/**
@@ -156,5 +156,5 @@  discard block
 block discarded – undo
156 156
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
157 157
 	 * @return void
158 158
 	 */
159
-	public function setService( $type, $id, array $attributes = [] );
159
+	public function setService($type, $id, array $attributes = []);
160 160
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Stock/Standard.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
30 30
 	 * @since 2017.03
31 31
 	 */
32
-	public function addFilterCodes( \Aimeos\MW\Criteria\Iface $filter, array $codes )
32
+	public function addFilterCodes(\Aimeos\MW\Criteria\Iface $filter, array $codes)
33 33
 	{
34 34
 		$expr = [
35
-			$filter->compare( '==', 'stock.productcode', $codes ),
35
+			$filter->compare('==', 'stock.productcode', $codes),
36 36
 			$filter->getConditions(),
37 37
 		];
38
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
38
+		$filter->setConditions($filter->combine('&&', $expr));
39 39
 
40 40
 		return $filter;
41 41
 	}
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
50 50
 	 * @since 2017.03
51 51
 	 */
52
-	public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes )
52
+	public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes)
53 53
 	{
54
-		if( !empty( $codes ) )
54
+		if (!empty($codes))
55 55
 		{
56 56
 			$expr = [
57
-				$filter->compare( '==', 'stock.type.code', $codes ),
57
+				$filter->compare('==', 'stock.type.code', $codes),
58 58
 				$filter->getConditions(),
59 59
 			];
60
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
60
+			$filter->setConditions($filter->combine('&&', $expr));
61 61
 		}
62 62
 
63 63
 		return $filter;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function createFilter()
75 75
 	{
76
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' )->createSearch( true );
76
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock')->createSearch(true);
77 77
 	}
78 78
 
79 79
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 * @return \Aimeos\MShop\Stock\Item\Iface Stock item including the referenced domains items
85 85
 	 * @since 2017.03
86 86
 	 */
87
-	public function getItem( $id )
87
+	public function getItem($id)
88 88
 	{
89
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' )->getItem( $id, [], true );
89
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock')->getItem($id, [], true);
90 90
 	}
91 91
 
92 92
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @return array Ordered list of stock items implementing \Aimeos\MShop\Stock\Item\Iface
99 99
 	 * @since 2017.03
100 100
 	 */
101
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
101
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
102 102
 	{
103
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' )->searchItems( $filter, [], $total );
103
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock')->searchItems($filter, [], $total);
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Locale/StandardTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Locale\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 1, count( $filter->getSortations() ) );
35
-		$this->assertEquals( 0, $filter->getSliceStart() );
36
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(1, count($filter->getSortations()));
35
+		$this->assertEquals(0, $filter->getSliceStart());
36
+		$this->assertEquals(100, $filter->getSliceSize());
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testGetItem()
41 41
 	{
42
-		$localeManager = \Aimeos\MShop\Factory::createManager( \TestHelperFrontend::getContext(), 'locale' );
43
-		$search = $localeManager->createSearch( true );
44
-		$search->setSortations( [$search->sort( '+', 'locale.position' )] );
45
-		$search->setSlice( 0, 1 );
46
-		$localeItems = $localeManager->searchItems( $search );
47
-
48
-		if( ( $localeItem = reset( $localeItems ) ) === false ) {
49
-			throw new \Exception( 'No locale item found' );
42
+		$localeManager = \Aimeos\MShop\Factory::createManager(\TestHelperFrontend::getContext(), 'locale');
43
+		$search = $localeManager->createSearch(true);
44
+		$search->setSortations([$search->sort('+', 'locale.position')]);
45
+		$search->setSlice(0, 1);
46
+		$localeItems = $localeManager->searchItems($search);
47
+
48
+		if (($localeItem = reset($localeItems)) === false) {
49
+			throw new \Exception('No locale item found');
50 50
 		}
51 51
 
52 52
 
53
-		$result = $this->object->getItem( $localeItem->getId() );
53
+		$result = $this->object->getItem($localeItem->getId());
54 54
 
55
-		$this->assertInstanceOf( '\Aimeos\MShop\Locale\Item\Iface', $result );
55
+		$this->assertInstanceOf('\Aimeos\MShop\Locale\Item\Iface', $result);
56 56
 	}
57 57
 
58 58
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$total = 0;
62 62
 		$filter = $this->object->createFilter();
63
-		$results = $this->object->searchItems( $filter, [], $total );
63
+		$results = $this->object->searchItems($filter, [], $total);
64 64
 
65
-		$this->assertEquals( 1, $total );
66
-		$this->assertEquals( 1, count( $results ) );
65
+		$this->assertEquals(1, $total);
66
+		$this->assertEquals(1, count($results));
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.