Completed
Push — master ( f216c1...319e95 )
by Aimeos
02:34
created
controller/frontend/src/Controller/Frontend/Locale/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	public function createFilter()
32 32
 	{
33 33
 		$context = $this->getContext();
34
-		$filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true );
34
+		$filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true);
35 35
 
36 36
 		$expr = array(
37
-			$filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ),
37
+			$filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()),
38 38
 			$filter->getConditions(),
39 39
 		);
40 40
 
41
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
42
-		$filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) );
41
+		$filter->setConditions($filter->combine('&&', $expr));
42
+		$filter->setSortations(array($filter->sort('+', 'locale.position')));
43 43
 
44 44
 		return $filter;
45 45
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
54 54
 	 * @since 2017.03
55 55
 	 */
56
-	public function getItem( $id, array $domains = [] )
56
+	public function getItem($id, array $domains = [])
57 57
 	{
58
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id, $domains, true );
58
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id, $domains, true);
59 59
 	}
60 60
 
61 61
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
69 69
 	 * @since 2017.03
70 70
 	 */
71
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null )
71
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null)
72 72
 	{
73
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, $domains, $total );
73
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, $domains, $total);
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Factory.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface)
31 31
 	 * @param string $path Path describing the controller to clear, e.g. "basket"
32 32
 	 */
33
-	static public function clear( $id = null, $path = null )
33
+	static public function clear($id = null, $path = null)
34 34
 	{
35
-		if( $id !== null )
35
+		if ($id !== null)
36 36
 		{
37
-			if( $path !== null ) {
37
+			if ($path !== null) {
38 38
 				self::$controllers[$id][$path] = null;
39 39
 			} else {
40 40
 				self::$controllers[$id] = [];
@@ -62,37 +62,37 @@  discard block
 block discarded – undo
62 62
 	 * @return \Aimeos\Controller\Frontend\Iface New frontend controller
63 63
 	 * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found
64 64
 	 */
65
-	static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path )
65
+	static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path)
66 66
 	{
67
-		if( empty( $path ) ) {
68
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) );
67
+		if (empty($path)) {
68
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty'));
69 69
 		}
70 70
 
71 71
 		$id = (string) $context;
72 72
 
73
-		if( self::$cache === false || !isset( self::$controllers[$id][$path] ) )
73
+		if (self::$cache === false || !isset(self::$controllers[$id][$path]))
74 74
 		{
75
-			$parts = explode( '/', $path );
75
+			$parts = explode('/', $path);
76 76
 
77
-			foreach( $parts as $key => $part )
77
+			foreach ($parts as $key => $part)
78 78
 			{
79
-				if( ctype_alnum( $part ) === false ) {
80
-					throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) );
79
+				if (ctype_alnum($part) === false) {
80
+					throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path));
81 81
 				}
82 82
 
83
-				$parts[$key] = ucwords( $part );
83
+				$parts[$key] = ucwords($part);
84 84
 			}
85 85
 
86
-			$factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory';
86
+			$factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory';
87 87
 
88
-			if( class_exists( $factory ) === false ) {
89
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) );
88
+			if (class_exists($factory) === false) {
89
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory));
90 90
 			}
91 91
 
92
-			$manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) );
92
+			$manager = call_user_func_array(array($factory, 'createController'), array($context));
93 93
 
94
-			if( $manager === false ) {
95
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) );
94
+			if ($manager === false) {
95
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory));
96 96
 			}
97 97
 
98 98
 			self::$controllers[$id][$path] = $manager;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param boolean $value True to enable caching, false to disable it.
109 109
 	 * @return boolean Previous cache setting
110 110
 	 */
111
-	static public function setCache( $value )
111
+	static public function setCache($value)
112 112
 	{
113 113
 		$old = self::$cache;
114 114
 		self::$cache = (boolean) $value;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Customer/Standard.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
29 29
 	 * @since 2017.04
30 30
 	 */
31
-	public function addItem( array $values )
31
+	public function addItem(array $values)
32 32
 	{
33
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
33
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
34 34
 
35 35
 		$item = $manager->createItem();
36
-		$item->fromArray( $values );
37
-		$manager->saveItem( $item );
36
+		$item->fromArray($values);
37
+		$manager->saveItem($item);
38 38
 
39 39
 		return $item;
40 40
 	}
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
47 47
 	 */
48
-	public function createItem( array $values = [] )
48
+	public function createItem(array $values = [])
49 49
 	{
50
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
50
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
51 51
 
52 52
 		$item = $manager->createItem();
53
-		$item->fromArray( $values );
54
-		$item->setStatus( 1 );
53
+		$item->fromArray($values);
54
+		$item->setStatus(1);
55 55
 
56 56
 		return $item;
57 57
 	}
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 	 * @param string $id Unique customer ID
64 64
 	 * @since 2017.04
65 65
 	 */
66
-	public function deleteItem( $id )
66
+	public function deleteItem($id)
67 67
 	{
68
-		$this->checkUser( $id );
68
+		$this->checkUser($id);
69 69
 
70
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
71
-		$manager->deleteItem( $id );
70
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
71
+		$manager->deleteItem($id);
72 72
 	}
73 73
 
74 74
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
81 81
 	 * @since 2017.04
82 82
 	 */
83
-	public function editItem( $id, array $values )
83
+	public function editItem($id, array $values)
84 84
 	{
85
-		$this->checkUser( $id );
85
+		$this->checkUser($id);
86 86
 
87
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
87
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
88 88
 
89
-		$item = $manager->getItem( $id, [], true );
90
-		$item->fromArray( $values );
91
-		$manager->saveItem( $item );
89
+		$item = $manager->getItem($id, [], true);
90
+		$item->fromArray($values);
91
+		$manager->saveItem($item);
92 92
 
93 93
 		return $item;
94 94
 	}
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
103 103
 	 * @since 2017.04
104 104
 	 */
105
-	public function getItem( $id = null, array $domains = [] )
105
+	public function getItem($id = null, array $domains = [])
106 106
 	{
107
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
107
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
108 108
 
109
-		if( $id == null ) {
110
-			return $manager->getItem( $this->getContext()->getUserId(), $domains, true );
109
+		if ($id == null) {
110
+			return $manager->getItem($this->getContext()->getUserId(), $domains, true);
111 111
 		}
112 112
 
113
-		$this->checkUser( $id );
113
+		$this->checkUser($id);
114 114
 
115
-		return $manager->getItem( $id, $domains, true );
115
+		return $manager->getItem($id, $domains, true);
116 116
 	}
117 117
 
118 118
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
127 127
 	 * @since 2017.04
128 128
 	 */
129
-	public function findItem( $code, array $domains = [] )
129
+	public function findItem($code, array $domains = [])
130 130
 	{
131
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains );
131
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains);
132 132
 	}
133 133
 
134 134
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @param \Aimeos\MShop\Customer\Item\Iface Customer item
139 139
 	 */
140
-	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item )
140
+	public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item)
141 141
 	{
142
-		\Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item );
142
+		\Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item);
143 143
 	}
144 144
 
145 145
 
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
151 151
 	 * @since 2017.04
152 152
 	 */
153
-	public function addAddressItem( array $values )
153
+	public function addAddressItem(array $values)
154 154
 	{
155 155
 		$context = $this->getContext();
156
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' );
156
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address');
157 157
 
158 158
 		$item = $manager->createItem();
159
-		$item->fromArray( $values );
160
-		$item->setParentId( $context->getUserId() );
161
-		$manager->saveItem( $item );
159
+		$item->fromArray($values);
160
+		$item->setParentId($context->getUserId());
161
+		$manager->saveItem($item);
162 162
 
163 163
 		return $item;
164 164
 	}
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
171 171
 	 */
172
-	public function createAddressItem( array $values = [] )
172
+	public function createAddressItem(array $values = [])
173 173
 	{
174 174
 		$context = $this->getContext();
175
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' );
175
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address');
176 176
 
177 177
 		$item = $manager->createItem();
178
-		$item->fromArray( $values );
179
-		$item->setParentId( $context->getUserId() );
178
+		$item->fromArray($values);
179
+		$item->setParentId($context->getUserId());
180 180
 
181 181
 		return $item;
182 182
 	}
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	 * @param string $id Unique customer address ID
189 189
 	 * @since 2017.04
190 190
 	 */
191
-	public function deleteAddressItem( $id )
191
+	public function deleteAddressItem($id)
192 192
 	{
193
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
193
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
194 194
 
195
-		$this->checkUser( $manager->getItem( $id, [], true )->getParentId() );
195
+		$this->checkUser($manager->getItem($id, [], true)->getParentId());
196 196
 
197
-		$manager->deleteItem( $id );
197
+		$manager->deleteItem($id);
198 198
 	}
199 199
 
200 200
 
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
207 207
 	 * @since 2017.04
208 208
 	 */
209
-	public function editAddressItem( $id, array $values )
209
+	public function editAddressItem($id, array $values)
210 210
 	{
211
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
211
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
212 212
 
213
-		$item = $manager->getItem( $id, [], true );
214
-		$this->checkUser( $item->getParentId() );
213
+		$item = $manager->getItem($id, [], true);
214
+		$this->checkUser($item->getParentId());
215 215
 
216
-		$item->fromArray( $values );
217
-		$manager->saveItem( $item );
216
+		$item->fromArray($values);
217
+		$manager->saveItem($item);
218 218
 
219 219
 		return $item;
220 220
 	}
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
228 228
 	 * @since 2017.04
229 229
 	 */
230
-	public function getAddressItem( $id )
230
+	public function getAddressItem($id)
231 231
 	{
232
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
233
-		$item = $manager->getItem( $id );
232
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
233
+		$item = $manager->getItem($id);
234 234
 
235
-		$this->checkUser( $item->getParentId() );
235
+		$this->checkUser($item->getParentId());
236 236
 
237 237
 		return $item;
238 238
 	}
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
245 245
 	 */
246
-	public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item )
246
+	public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item)
247 247
 	{
248
-		\Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item );
248
+		\Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item);
249 249
 	}
250 250
 
251 251
 
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 	 * @param string $id Unique customer ID
256 256
 	 * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed
257 257
 	 */
258
-	protected function checkUser( $id )
258
+	protected function checkUser($id)
259 259
 	{
260
-		if( $id != $this->getContext()->getUserId() )
260
+		if ($id != $this->getContext()->getUserId())
261 261
 		{
262
-			$msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id );
263
-			throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg );
262
+			$msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id);
263
+			throw new \Aimeos\Controller\Frontend\Customer\Exception($msg);
264 264
 		}
265 265
 	}
266 266
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  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
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' );
34
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order');
35 35
 
36
-		$item = $manager->createItem()->setBaseId( $baseId )->setType( $type );
37
-		$manager->saveItem( $item );
36
+		$item = $manager->createItem()->setBaseId($baseId)->setType($type);
37
+		$manager->saveItem($item);
38 38
 
39 39
 		return $item;
40 40
 	}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function createFilter()
49 49
 	{
50
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true );
50
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true);
51 51
 	}
52 52
 
53 53
 
@@ -57,26 +57,26 @@  discard block
 block discarded – undo
57 57
 	 * @param string $id Unique order ID
58 58
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
59 59
 	 */
60
-	public function getItem( $id )
60
+	public function getItem($id)
61 61
 	{
62 62
 		$context = $this->getContext();
63
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
63
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
64 64
 
65
-		$search = $manager->createSearch( true );
65
+		$search = $manager->createSearch(true);
66 66
 		$expr = [
67
-			$search->compare( '==', 'order.id', $id ),
68
-			$search->compare( '==', 'order.base.customerid', (string) $context->getUserId() ),
67
+			$search->compare('==', 'order.id', $id),
68
+			$search->compare('==', 'order.base.customerid', (string) $context->getUserId()),
69 69
 			$search->getConditions(),
70 70
 		];
71
-		$search->setConditions( $search->combine( '&&', $expr ) );
71
+		$search->setConditions($search->combine('&&', $expr));
72 72
 
73
-		$items = $manager->searchItems( $search );
73
+		$items = $manager->searchItems($search);
74 74
 
75
-		if( ( $item = reset( $items ) ) !== false ) {
75
+		if (($item = reset($items)) !== false) {
76 76
 			return $item;
77 77
 		}
78 78
 
79
-		throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) );
79
+		throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id));
80 80
 	}
81 81
 
82 82
 
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	 * @param integer|null &$total Variable that will contain the total number of available items
88 88
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
89 89
 	 */
90
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
90
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
91 91
 	{
92 92
 		$context = $this->getContext();
93
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
93
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
94 94
 
95 95
 		$expr = [
96 96
 			$filter->getConditions(),
97
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
97
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
98 98
 		];
99
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
99
+		$filter->setConditions($filter->combine('&&', $expr));
100 100
 
101
-		return $manager->searchItems( $filter, [], $total );
101
+		return $manager->searchItems($filter, [], $total);
102 102
 	}
103 103
 
104 104
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
122 122
 	 */
123
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
123
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
124 124
 	{
125
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
125
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
126 126
 	}
127 127
 
128 128
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
146 146
 	 */
147
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
147
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
148 148
 	{
149
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
149
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
150 150
 	}
151 151
 
152 152
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
166 166
 	 */
167
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
167
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
168 168
 	{
169
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
169
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
170 170
 	}
171 171
 
172 172
 
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
182 182
 	 * @deprecated 2017.04 Use store() from basket controller instead
183 183
 	 */
184
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket )
184
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket)
185 185
 	{
186 186
 		$context = $this->getContext();
187 187
 
188
-		$orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
189
-		$orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
188
+		$orderManager = \Aimeos\MShop\Factory::createManager($context, 'order');
189
+		$orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
190 190
 
191 191
 
192 192
 		$orderBaseManager->begin();
193
-		$orderBaseManager->store( $basket );
193
+		$orderBaseManager->store($basket);
194 194
 		$orderBaseManager->commit();
195 195
 
196 196
 		$orderItem = $orderManager->createItem();
197
-		$orderItem->setBaseId( $basket->getId() );
198
-		$orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB );
199
-		$orderManager->saveItem( $orderItem );
197
+		$orderItem->setBaseId($basket->getId());
198
+		$orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB);
199
+		$orderManager->saveItem($orderItem);
200 200
 
201 201
 
202 202
 		return $orderItem;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Standard.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
36 36
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
37 37
 	 */
38
-	public function checkAttributes( $serviceId, array $attributes )
38
+	public function checkAttributes($serviceId, array $attributes)
39 39
 	{
40
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
41
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
40
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
41
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
42 42
 
43
-		return array_filter( $provider->checkConfigFE( $attributes ) );
43
+		return array_filter($provider->checkConfigFE($attributes));
44 44
 	}
45 45
 
46 46
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @param string[] $ref List of domain names whose items should be fetched too
52 52
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
53 53
 	 */
54
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
54
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
55 55
 	{
56
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
57
-		return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) );
56
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
57
+		return $manager->getProvider($manager->getItem($serviceId, $ref, true));
58 58
 	}
59 59
 
60 60
 
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 	 * @param string[] $ref List of domain names whose items should be fetched too
66 66
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
67 67
 	 */
68
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
68
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
69 69
 	{
70 70
 		$list = [];
71
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
71
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
72 72
 
73
-		$search = $manager->createSearch( true );
74
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
73
+		$search = $manager->createSearch(true);
74
+		$search->setSortations(array($search->sort('+', 'service.position')));
75 75
 
76
-		if( $type != null )
76
+		if ($type != null)
77 77
 		{
78 78
 			$expr = array(
79 79
 				$search->getConditions(),
80
-				$search->compare( '==', 'service.type.code', $type ),
81
-				$search->compare( '==', 'service.type.domain', 'service' ),
80
+				$search->compare('==', 'service.type.code', $type),
81
+				$search->compare('==', 'service.type.domain', 'service'),
82 82
 			);
83
-			$search->setConditions( $search->combine( '&&', $expr ) );
83
+			$search->setConditions($search->combine('&&', $expr));
84 84
 		}
85 85
 
86
-		foreach( $manager->searchItems( $search, $ref ) as $id => $item ) {
87
-			$list[$id] = $manager->getProvider( $item );
86
+		foreach ($manager->searchItems($search, $ref) as $id => $item) {
87
+			$list[$id] = $manager->getProvider($item);
88 88
 		}
89 89
 
90 90
 		return $list;
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 	 * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc.
103 103
 	 * 	or null if no form data is required
104 104
 	 */
105
-	public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params )
105
+	public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params)
106 106
 	{
107
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
107
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
108 108
 
109
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
110
-		$provider->injectGlobalConfigBE( $urls );
109
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
110
+		$provider->injectGlobalConfigBE($urls);
111 111
 
112
-		return $provider->process( $orderItem, $params );
112
+		return $provider->process($orderItem, $params);
113 113
 	}
114 114
 
115 115
 
@@ -122,34 +122,34 @@  discard block
 block discarded – undo
122 122
 	 * 	(keys are <type>.url-self, <type>.url-success, <type>.url-update where type can be "delivery" or "payment")
123 123
 	 * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated
124 124
 	 */
125
-	public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls )
125
+	public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls)
126 126
 	{
127 127
 		$params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams();
128 128
 
129
-		if( !isset( $params['code'] ) ) {
129
+		if (!isset($params['code'])) {
130 130
 			return;
131 131
 		}
132 132
 
133 133
 		$context = $this->getContext();
134
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
134
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'service');
135 135
 
136
-		$provider = $manager->getProvider( $manager->findItem( $params['code'] ) );
137
-		$provider->injectGlobalConfigBE( $urls );
136
+		$provider = $manager->getProvider($manager->findItem($params['code']));
137
+		$provider->injectGlobalConfigBE($urls);
138 138
 
139 139
 		$body = (string) $request->getBody();
140 140
 		$response = null;
141 141
 		$headers = [];
142 142
 
143
-		if( ( $orderItem = $provider->updateSync( $params, $body, $response, $headers ) ) !== null )
143
+		if (($orderItem = $provider->updateSync($params, $body, $response, $headers)) !== null)
144 144
 		{
145
-			if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED
146
-				&& $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY )
145
+			if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED
146
+				&& $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY)
147 147
 			) {
148
-				$provider->query( $orderItem );
148
+				$provider->query($orderItem);
149 149
 			}
150 150
 
151 151
 			// update stock, coupons, etc.
152
-			\Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem );
152
+			\Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem);
153 153
 		}
154 154
 
155 155
 		return $orderItem;
@@ -166,38 +166,38 @@  discard block
 block discarded – undo
166 166
 	 * @throws \Exception If an error occurs
167 167
 	 * @deprecated Use getProviders() instead
168 168
 	 */
169
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] )
169
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'])
170 170
 	{
171
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
171
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
172 172
 
173
-		$search = $serviceManager->createSearch( true );
173
+		$search = $serviceManager->createSearch(true);
174 174
 		$expr = array(
175 175
 			$search->getConditions(),
176
-			$search->compare( '==', 'service.type.domain', 'service' ),
177
-			$search->compare( '==', 'service.type.code', $type ),
176
+			$search->compare('==', 'service.type.domain', 'service'),
177
+			$search->compare('==', 'service.type.code', $type),
178 178
 		);
179
-		$search->setConditions( $search->combine( '&&', $expr ) );
180
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
179
+		$search->setConditions($search->combine('&&', $expr));
180
+		$search->setSortations(array($search->sort('+', 'service.position')));
181 181
 
182
-		$items = $serviceManager->searchItems( $search, $ref );
182
+		$items = $serviceManager->searchItems($search, $ref);
183 183
 
184 184
 
185
-		foreach( $items as $id => $service )
185
+		foreach ($items as $id => $service)
186 186
 		{
187 187
 			try
188 188
 			{
189
-				$provider = $serviceManager->getProvider( $service );
189
+				$provider = $serviceManager->getProvider($service);
190 190
 
191
-				if( $provider->isAvailable( $basket ) ) {
191
+				if ($provider->isAvailable($basket)) {
192 192
 					$this->providers[$type][$id] = $provider;
193 193
 				} else {
194
-					unset( $items[$id] );
194
+					unset($items[$id]);
195 195
 				}
196 196
 			}
197
-			catch( \Aimeos\MShop\Service\Exception $e )
197
+			catch (\Aimeos\MShop\Service\Exception $e)
198 198
 			{
199
-				$msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id );
200
-				$this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN );
199
+				$msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id);
200
+				$this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN);
201 201
 			}
202 202
 		}
203 203
 
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 	 * @throws \Exception If an error occurs
219 219
 	 * @deprecated Use getProvider() instead
220 220
 	 */
221
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
221
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
222 222
 	{
223
-		if( isset( $this->providers[$type][$serviceId] ) ) {
224
-			return $this->providers[$type][$serviceId]->getConfigFE( $basket );
223
+		if (isset($this->providers[$type][$serviceId])) {
224
+			return $this->providers[$type][$serviceId]->getConfigFE($basket);
225 225
 		}
226 226
 
227
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
228
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
227
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
228
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
229 229
 
230
-		return $serviceManager->getProvider( $item )->getConfigFE( $basket );
230
+		return $serviceManager->getProvider($item)->getConfigFE($basket);
231 231
 	}
232 232
 
233 233
 
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 	 * @throws \Exception If an error occurs
244 244
 	 * @deprecated Use getProvider() instead
245 245
 	 */
246
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
246
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
247 247
 	{
248
-		if( isset( $this->providers[$type][$serviceId] ) ) {
249
-			return $this->providers[$type][$serviceId]->calcPrice( $basket );
248
+		if (isset($this->providers[$type][$serviceId])) {
249
+			return $this->providers[$type][$serviceId]->calcPrice($basket);
250 250
 		}
251 251
 
252
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
253
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
252
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
253
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
254 254
 
255
-		return $serviceManager->getProvider( $item )->calcPrice( $basket );
255
+		return $serviceManager->getProvider($item)->calcPrice($basket);
256 256
 	}
257 257
 
258 258
 
@@ -268,22 +268,22 @@  discard block
 block discarded – undo
268 268
 	 * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available
269 269
 	 * @deprecated Use checkAttributes() instead
270 270
 	 */
271
-	public function checkServiceAttributes( $type, $serviceId, array $attributes )
271
+	public function checkServiceAttributes($type, $serviceId, array $attributes)
272 272
 	{
273
-		if( !isset( $this->providers[$type][$serviceId] ) )
273
+		if (!isset($this->providers[$type][$serviceId]))
274 274
 		{
275
-			$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
276
-			$item = $serviceManager->getItem( $serviceId, ['price'], true );
275
+			$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
276
+			$item = $serviceManager->getItem($serviceId, ['price'], true);
277 277
 
278
-			$this->providers[$type][$serviceId] = $serviceManager->getProvider( $item );
278
+			$this->providers[$type][$serviceId] = $serviceManager->getProvider($item);
279 279
 		}
280 280
 
281
-		$errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes );
281
+		$errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes);
282 282
 
283
-		foreach( $errors as $key => $msg )
283
+		foreach ($errors as $key => $msg)
284 284
 		{
285
-			if( $msg === null ) {
286
-				unset( $errors[$key] );
285
+			if ($msg === null) {
286
+				unset($errors[$key]);
287 287
 			}
288 288
 		}
289 289
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Attribute/Standard.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  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 addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes )
32
+	public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes)
33 33
 	{
34
-		if( !empty( $codes ) )
34
+		if (!empty($codes))
35 35
 		{
36 36
 			$expr = [
37
-				$filter->compare( '==', 'attribute.type.code', $codes ),
37
+				$filter->compare('==', 'attribute.type.code', $codes),
38 38
 				$filter->getConditions(),
39 39
 			];
40
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
40
+			$filter->setConditions($filter->combine('&&', $expr));
41 41
 		}
42 42
 
43 43
 		return $filter;
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function createFilter()
55 55
 	{
56
-		$filter = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->createSearch( true );
56
+		$filter = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->createSearch(true);
57 57
 
58 58
 		$expr = array(
59
-			$filter->compare( '==', 'attribute.domain', 'product' ),
59
+			$filter->compare('==', 'attribute.domain', 'product'),
60 60
 			$filter->getConditions(),
61 61
 		);
62 62
 
63
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
64
-		$filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) );
63
+		$filter->setConditions($filter->combine('&&', $expr));
64
+		$filter->setSortations(array($filter->sort('+', 'attribute.position')));
65 65
 
66 66
 		return $filter;
67 67
 	}
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items
76 76
 	 * @since 2017.03
77 77
 	 */
78
-	public function getItem( $id, array $domains = array( 'media', 'price', 'text' ) )
78
+	public function getItem($id, array $domains = array('media', 'price', 'text'))
79 79
 	{
80
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->getItem( $id, $domains, true );
80
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->getItem($id, $domains, true);
81 81
 	}
82 82
 
83 83
 
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute item including the referenced domains items
90 90
 	 * @since 2017.03
91 91
 	 */
92
-	public function getItems( array $ids, array $domains = array( 'media', 'price', 'text' ) )
92
+	public function getItems(array $ids, array $domains = array('media', 'price', 'text'))
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
94
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
95 95
 
96
-		$filter = $manager->createSearch( true );
96
+		$filter = $manager->createSearch(true);
97 97
 		$expr = [
98
-			$filter->compare( '==', 'attribute.domain', 'product' ),
99
-			$filter->compare( '==', 'attribute.id', $ids ),
98
+			$filter->compare('==', 'attribute.domain', 'product'),
99
+			$filter->compare('==', 'attribute.id', $ids),
100 100
 			$filter->getConditions(),
101 101
 		];
102
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
103
-		$filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) );
102
+		$filter->setConditions($filter->combine('&&', $expr));
103
+		$filter->setSortations(array($filter->sort('+', 'attribute.position')));
104 104
 
105
-		return $manager->searchItems( $filter, $domains );
105
+		return $manager->searchItems($filter, $domains);
106 106
 	}
107 107
 
108 108
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @return array Ordered list of attribute items implementing \Aimeos\MShop\Attribute\Item\Iface
116 116
 	 * @since 2017.03
117 117
 	 */
118
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
118
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
119 119
 	{
120
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->searchItems( $filter, $domains, $total );
120
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->searchItems($filter, $domains, $total);
121 121
 	}
122 122
 }
Please login to merge, or discard this patch.