Completed
Push — master ( 2507d2...3b83d2 )
by Aimeos
03:49
created
admin/jqadm/src/Admin/JQAdm/Common/Factory/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,5 +27,5 @@
 block discarded – undo
27 27
 	 * @param string $name Admin name (from configuration or "Standard" if null)
28 28
 	 * @return \Aimeos\Admin\JQAdm\Iface New client object
29 29
 	 */
30
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null );
30
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null);
31 31
 }
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Base.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * Creates a new resource
75 75
 	 *
76 76
 	 * @return string|null admin output to display or null for redirecting to the list
77
-	*/
77
+	 */
78 78
 	public function create()
79 79
 	{
80 80
 		return $this->client->create();
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * Deletes a resource
86 86
 	 *
87 87
 	 * @return string|null admin output to display or null for redirecting to the list
88
-	*/
88
+	 */
89 89
 	public function delete()
90 90
 	{
91 91
 		return $this->client->delete();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * Returns a single resource
97 97
 	 *
98 98
 	 * @return string|null admin output to display or null for redirecting to the list
99
-	*/
99
+	 */
100 100
 	public function get()
101 101
 	{
102 102
 		return $this->client->get();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * Saves the data
108 108
 	 *
109 109
 	 * @return string|null admin output to display or null for redirecting to the list
110
-	*/
110
+	 */
111 111
 	public function save()
112 112
 	{
113 113
 		return $this->client->save();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * Returns a list of resource according to the conditions
119 119
 	 *
120 120
 	 * @return string admin output to display
121
-	*/
121
+	 */
122 122
 	public function search()
123 123
 	{
124 124
 		return $this->client->search();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	 * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key
33 33
 	 * 	and a list of relative paths inside the core or the extension as values
34 34
 	 */
35
-	public function __construct( \Aimeos\Admin\JQAdm\Iface $client,
36
-		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths )
35
+	public function __construct(\Aimeos\Admin\JQAdm\Iface $client,
36
+		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths)
37 37
 	{
38
-		parent::__construct( $context, $templatePaths );
38
+		parent::__construct($context, $templatePaths);
39 39
 
40 40
 		$this->client = $client;
41 41
 	}
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 * @return mixed Returns the value of the called method
50 50
 	 * @throws \Aimeos\Admin\JQAdm\Exception If method call failed
51 51
 	 */
52
-	public function __call( $name, array $param )
52
+	public function __call($name, array $param)
53 53
 	{
54
-		if( ( $result = @call_user_func_array( array( $this->client, $name ), $param ) ) === false ) {
55
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) );
54
+		if (($result = @call_user_func_array(array($this->client, $name), $param)) === false) {
55
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Unable to call method "%1$s"', $name));
56 56
 		}
57 57
 
58 58
 		return $result;
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	 * @param string|null $name Name of the sub-client (Default if null)
133 133
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
134 134
 	 */
135
-	public function getSubClient( $type, $name = null )
135
+	public function getSubClient($type, $name = null)
136 136
 	{
137
-		return $this->client->getSubClient( $type, $name );
137
+		return $this->client->getSubClient($type, $name);
138 138
 	}
139 139
 
140 140
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
156 156
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
157 157
 	 */
158
-	public function setView( \Aimeos\MW\View\Iface $view )
158
+	public function setView(\Aimeos\MW\View\Iface $view)
159 159
 	{
160
-		$this->client->setView( $view );
160
+		$this->client->setView($view);
161 161
 		return $this;
162 162
 	}
163 163
 
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
 		$result = $this->getClient()->save();
30 30
 		$item = $this->getView()->item;
31 31
 
32
-		if( $item->getId() !== null )
32
+		if ($item->getId() !== null)
33 33
 		{
34 34
 			$idtag = $item->getResourceType() . '-' . $item->getId();
35
-			$this->getContext()->getCache()->deleteByTags( array( $item->getResourceType(), $idtag ) );
35
+			$this->getContext()->getCache()->deleteByTags(array($item->getResourceType(), $idtag));
36 36
 		}
37 37
 
38 38
 		return $result;
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
 		$result = $this->getClient()->save();
30 30
 		$item = $this->getView()->item;
31 31
 
32
-		if( $item->getId() !== null ) {
33
-			\Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->saveItem( $item );
32
+		if ($item->getId() !== null) {
33
+			\Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->saveItem($item);
34 34
 		}
35 35
 
36 36
 		return $result;
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,6 +28,6 @@
 block discarded – undo
28 28
 	 * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key
29 29
 	 * 	and a list of relative paths inside the core or the extension as values
30 30
 	 */
31
-	public function __construct( \Aimeos\Admin\JQAdm\Iface $client,
32
-		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths );
31
+	public function __construct(\Aimeos\Admin\JQAdm\Iface $client,
32
+		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths);
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param string|null $name Name of the sub-client (Default if null)
27 27
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
28 28
 	 */
29
-	public function getSubClient( $type, $name = null );
29
+	public function getSubClient($type, $name = null);
30 30
 
31 31
 	/**
32 32
 	 * Returns the view object that will generate the admin output.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
42 42
 	 * @return \Aimeos\Admin\Html\Iface Reference to this object for fluent calls
43 43
 	 */
44
-	public function setView( \Aimeos\MW\View\Iface $view );
44
+	public function setView(\Aimeos\MW\View\Iface $view);
45 45
 
46 46
 	/**
47 47
 	 * Copies a resource
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Factory.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,29 +29,29 @@
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface admin client implementing \Aimeos\Admin\JQAdm\Iface
30 30
 	 * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails
31 31
 	 */
32
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null )
32
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null)
33 33
 	{
34
-		if( empty( $type ) ) {
35
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Admin JQAdm type is empty' ) );
34
+		if (empty($type)) {
35
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Admin JQAdm type is empty'));
36 36
 		}
37 37
 
38
-		if( ctype_alnum( $type ) === false ) {
39
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $type ) );
38
+		if (ctype_alnum($type) === false) {
39
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $type));
40 40
 		}
41 41
 
42
-		$factory = '\\Aimeos\\Admin\\JQAdm\\' . ucwords( $type ) . '\\Factory';
42
+		$factory = '\\Aimeos\\Admin\\JQAdm\\' . ucwords($type) . '\\Factory';
43 43
 
44
-		if( class_exists( $factory ) === false ) {
45
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $factory ) );
44
+		if (class_exists($factory) === false) {
45
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $factory));
46 46
 		}
47 47
 
48
-		$client = @call_user_func_array( array( $factory, 'createClient' ), array( $context, $templatePaths, $name ) );
48
+		$client = @call_user_func_array(array($factory, 'createClient'), array($context, $templatePaths, $name));
49 49
 
50
-		if( $client === false ) {
51
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) );
50
+		if ($client === false) {
51
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid factory "%1$s"', $factory));
52 52
 		}
53 53
 
54
-		$client->setView( $context->getView() );
54
+		$client->setView($context->getView());
55 55
 
56 56
 		return $client;
57 57
 	}
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Download/Standard.php 2 patches
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$view = $this->getView();
69 69
 
70
-		$this->setData( $view );
70
+		$this->setData($view);
71 71
 		$view->downloadBody = '';
72 72
 
73
-		foreach( $this->getSubClients() as $client ) {
73
+		foreach ($this->getSubClients() as $client) {
74 74
 			$view->downloadBody .= $client->copy();
75 75
 		}
76 76
 
77 77
 		$tplconf = 'admin/jqadm/product/download/template-item';
78 78
 		$default = 'product/item-download-default.php';
79 79
 
80
-		return $view->render( $view->config( $tplconf, $default ) );
80
+		return $view->render($view->config($tplconf, $default));
81 81
 	}
82 82
 
83 83
 
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$view = $this->getView();
92 92
 
93
-		$this->setData( $view );
93
+		$this->setData($view);
94 94
 		$view->downloadBody = '';
95 95
 
96
-		foreach( $this->getSubClients() as $client ) {
96
+		foreach ($this->getSubClients() as $client) {
97 97
 			$view->downloadBody .= $client->create();
98 98
 		}
99 99
 
100 100
 		$tplconf = 'admin/jqadm/product/download/template-item';
101 101
 		$default = 'product/item-download-default.php';
102 102
 
103
-		return $view->render( $view->config( $tplconf, $default ) );
103
+		return $view->render($view->config($tplconf, $default));
104 104
 	}
105 105
 
106 106
 
@@ -112,35 +112,35 @@  discard block
 block discarded – undo
112 112
 	public function delete()
113 113
 	{
114 114
 		$view = $this->getView();
115
-		$listManager = \Aimeos\MShop\Factory::createManager( $context = $this->getContext(), 'product/lists' );
115
+		$listManager = \Aimeos\MShop\Factory::createManager($context = $this->getContext(), 'product/lists');
116 116
 		$search = $listManager->createSearch();
117 117
 
118
-		foreach( (array) $view->param( 'id' ) as $id )
118
+		foreach ((array) $view->param('id') as $id)
119 119
 		{
120
-			$listItems = $this->getListItems( $id );
121
-			$items = $this->getAttributeItems( $listItems );
120
+			$listItems = $this->getListItems($id);
121
+			$items = $this->getAttributeItems($listItems);
122 122
 
123
-			foreach( $listItems as $listid => $listItem )
123
+			foreach ($listItems as $listid => $listItem)
124 124
 			{
125 125
 				$refId = $listItem->getRefId();
126 126
 
127 127
 				$expr = array(
128
-					$search->compare( '==', 'product.lists.refid', $refId ),
129
-					$search->compare( '==', 'product.lists.domain', 'attribute' ),
130
-					$search->compare( '==', 'product.lists.type.code', 'hidden' ),
131
-					$search->compare( '==', 'product.lists.type.domain', 'attribute' ),
128
+					$search->compare('==', 'product.lists.refid', $refId),
129
+					$search->compare('==', 'product.lists.domain', 'attribute'),
130
+					$search->compare('==', 'product.lists.type.code', 'hidden'),
131
+					$search->compare('==', 'product.lists.type.domain', 'attribute'),
132 132
 				);
133
-				$search->setConditions( $search->combine( '&&', $expr ) );
134
-				$result = $listManager->aggregate( $search, 'product.lists.refid' );
133
+				$search->setConditions($search->combine('&&', $expr));
134
+				$result = $listManager->aggregate($search, 'product.lists.refid');
135 135
 
136
-				if( isset( $items[$refId] ) && $result[$refId] == 1 ) {
137
-					$listItem->setRefItem( $items[$refId] );
136
+				if (isset($items[$refId]) && $result[$refId] == 1) {
137
+					$listItem->setRefItem($items[$refId]);
138 138
 				} else {
139
-					unset( $listItems[$id] );
139
+					unset($listItems[$id]);
140 140
 				}
141 141
 			}
142 142
 
143
-			$this->cleanupItems( $listItems, array() );
143
+			$this->cleanupItems($listItems, array());
144 144
 		}
145 145
 	}
146 146
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		$view = $this->getView();
156 156
 
157
-		$this->setData( $view );
157
+		$this->setData($view);
158 158
 		$view->downloadBody = '';
159 159
 
160
-		foreach( $this->getSubClients() as $client ) {
160
+		foreach ($this->getSubClients() as $client) {
161 161
 			$view->downloadBody .= $client->get();
162 162
 		}
163 163
 
164 164
 		$tplconf = 'admin/jqadm/product/download/template-item';
165 165
 		$default = 'product/item-download-default.php';
166 166
 
167
-		return $view->render( $view->config( $tplconf, $default ) );
167
+		return $view->render($view->config($tplconf, $default));
168 168
 	}
169 169
 
170 170
 
@@ -178,18 +178,18 @@  discard block
 block discarded – undo
178 178
 		$view = $this->getView();
179 179
 		$context = $this->getContext();
180 180
 
181
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
182
-		$attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
181
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
182
+		$attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
183 183
 
184 184
 		$manager->begin();
185 185
 		$attrManager->begin();
186 186
 
187 187
 		try
188 188
 		{
189
-			$this->updateItems( $view );
189
+			$this->updateItems($view);
190 190
 			$view->downloadBody = '';
191 191
 
192
-			foreach( $this->getSubClients() as $client ) {
192
+			foreach ($this->getSubClients() as $client) {
193 193
 				$view->downloadBody .= $client->save();
194 194
 			}
195 195
 
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
 			$manager->commit();
198 198
 			return;
199 199
 		}
200
-		catch( \Aimeos\MShop\Exception $e )
200
+		catch (\Aimeos\MShop\Exception $e)
201 201
 		{
202
-			$error = array( 'product-item-download' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
203
-			$view->errors = $view->get( 'errors', array() ) + $error;
202
+			$error = array('product-item-download' => $context->getI18n()->dt('mshop', $e->getMessage()));
203
+			$view->errors = $view->get('errors', array()) + $error;
204 204
 
205 205
 			$attrManager->rollback();
206 206
 			$manager->rollback();
207 207
 		}
208
-		catch( \Exception $e )
208
+		catch (\Exception $e)
209 209
 		{
210
-			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
211
-			$error = array( 'product-item-download' => $e->getMessage() );
212
-			$view->errors = $view->get( 'errors', array() ) + $error;
210
+			$context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString());
211
+			$error = array('product-item-download' => $e->getMessage());
212
+			$view->errors = $view->get('errors', array()) + $error;
213 213
 
214 214
 			$attrManager->rollback();
215 215
 			$manager->rollback();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @param string|null $name Name of the sub-client (Default if null)
227 227
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
228 228
 	 */
229
-	public function getSubClient( $type, $name = null )
229
+	public function getSubClient($type, $name = null)
230 230
 	{
231 231
 		/** admin/jqadm/product/download/decorators/excludes
232 232
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 * @see admin/jqadm/product/download/decorators/excludes
302 302
 		 * @see admin/jqadm/product/download/decorators/global
303 303
 		 */
304
-		return $this->createSubClient( 'product/download/' . $type, $name );
304
+		return $this->createSubClient('product/download/' . $type, $name);
305 305
 	}
306 306
 
307 307
 
@@ -311,29 +311,29 @@  discard block
 block discarded – undo
311 311
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
312 312
 	 * @param array $listIds List of IDs of the still used list items
313 313
 	 */
314
-	protected function cleanupItems( array $listItems, array $listIds )
314
+	protected function cleanupItems(array $listItems, array $listIds)
315 315
 	{
316 316
 		$context = $this->getContext();
317
-		$fs = $context->getFilesystemManager()->get( 'fs-secure' );
318
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
319
-		$listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
317
+		$fs = $context->getFilesystemManager()->get('fs-secure');
318
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
319
+		$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
320 320
 
321 321
 		$rmItems = array();
322
-		$rmListIds = array_diff( array_keys( $listItems ), $listIds );
322
+		$rmListIds = array_diff(array_keys($listItems), $listIds);
323 323
 
324
-		foreach( $rmListIds as $rmListId )
324
+		foreach ($rmListIds as $rmListId)
325 325
 		{
326
-			if( ( $item = $listItems[$rmListId]->getRefItem() ) !== null )
326
+			if (($item = $listItems[$rmListId]->getRefItem()) !== null)
327 327
 			{
328
-				if( $item->getCode() != '' && $fs->has( $item->getCode() ) ) {
329
-					$fs->rm( $item->getCode() );
328
+				if ($item->getCode() != '' && $fs->has($item->getCode())) {
329
+					$fs->rm($item->getCode());
330 330
 				}
331 331
 				$rmItems[] = $item->getId();
332 332
 			}
333 333
 		}
334 334
 
335
-		$listManager->deleteItems( $rmListIds  );
336
-		$manager->deleteItems( $rmItems  );
335
+		$listManager->deleteItems($rmListIds);
336
+		$manager->deleteItems($rmItems);
337 337
 	}
338 338
 
339 339
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	protected function createItem()
346 346
 	{
347 347
 		$context = $this->getContext();
348
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
349
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/type' );
348
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
349
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/type');
350 350
 
351 351
 		$item = $manager->createItem();
352
-		$item->setTypeId( $typeManager->findItem( 'download', array(), 'product' )->getId() );
353
-		$item->setDomain( 'product' );
354
-		$item->setStatus( 1 );
352
+		$item->setTypeId($typeManager->findItem('download', array(), 'product')->getId());
353
+		$item->setDomain('product');
354
+		$item->setStatus(1);
355 355
 
356 356
 		return $item;
357 357
 	}
@@ -363,17 +363,17 @@  discard block
 block discarded – undo
363 363
 	 * @param string $id Parent ID for the new list item
364 364
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface New list item object
365 365
 	 */
366
-	protected function createListItem( $id )
366
+	protected function createListItem($id)
367 367
 	{
368 368
 		$context = $this->getContext();
369
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
370
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
369
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
370
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
371 371
 
372 372
 		$item = $manager->createItem();
373
-		$item->setTypeId( $typeManager->findItem( 'hidden', array(), 'attribute' )->getId() );
374
-		$item->setDomain( 'attribute' );
375
-		$item->setParentId( $id );
376
-		$item->setStatus( 1 );
373
+		$item->setTypeId($typeManager->findItem('hidden', array(), 'attribute')->getId());
374
+		$item->setDomain('attribute');
375
+		$item->setParentId($id);
376
+		$item->setStatus(1);
377 377
 
378 378
 		return $item;
379 379
 	}
@@ -385,27 +385,27 @@  discard block
 block discarded – undo
385 385
 	 * @param array $listItems List of list items with IDs as key and items implementing \Aimeos\MShop\Common\Item\List\Iface as values
386 386
 	 * @return array List of attribute items with ID as key and items implementing \Aimeos\MShop\Attribute\Item\Iface as values
387 387
 	 */
388
-	protected function getAttributeItems( array $listItems )
388
+	protected function getAttributeItems(array $listItems)
389 389
 	{
390 390
 		$refIds = array();
391 391
 
392
-		foreach( $listItems as $item ) {
392
+		foreach ($listItems as $item) {
393 393
 			$refIds[] = $item->getRefId();
394 394
 		}
395 395
 
396
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
396
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
397 397
 
398 398
 		$search = $manager->createSearch();
399 399
 		$expr = array(
400
-			$search->compare( '==', 'attribute.id', $refIds ),
401
-			$search->compare( '==', 'attribute.domain', 'product' ),
402
-			$search->compare( '==', 'attribute.type.domain', 'product' ),
403
-			$search->compare( '==', 'attribute.type.code', 'download' ),
400
+			$search->compare('==', 'attribute.id', $refIds),
401
+			$search->compare('==', 'attribute.domain', 'product'),
402
+			$search->compare('==', 'attribute.type.domain', 'product'),
403
+			$search->compare('==', 'attribute.type.code', 'download'),
404 404
 		);
405
-		$search->setConditions( $search->combine( '&&', $expr ) );
406
-		$search->setSlice( 0, 0x7fffffff );
405
+		$search->setConditions($search->combine('&&', $expr));
406
+		$search->setSlice(0, 0x7fffffff);
407 407
 
408
-		return $manager->searchItems( $search );
408
+		return $manager->searchItems($search);
409 409
 	}
410 410
 
411 411
 
@@ -415,20 +415,20 @@  discard block
 block discarded – undo
415 415
 	 * @param string $prodid Unique product ID
416 416
 	 * @return array Associative list of bundle product IDs as keys and list items as values
417 417
 	 */
418
-	protected function getListItems( $prodid )
418
+	protected function getListItems($prodid)
419 419
 	{
420
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
420
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
421 421
 
422 422
 		$search = $manager->createSearch();
423 423
 		$expr = array(
424
-			$search->compare( '==', 'product.lists.parentid', $prodid ),
425
-			$search->compare( '==', 'product.lists.domain', 'attribute' ),
426
-			$search->compare( '==', 'product.lists.type.domain', 'attribute' ),
427
-			$search->compare( '==', 'product.lists.type.code', 'hidden' ),
424
+			$search->compare('==', 'product.lists.parentid', $prodid),
425
+			$search->compare('==', 'product.lists.domain', 'attribute'),
426
+			$search->compare('==', 'product.lists.type.domain', 'attribute'),
427
+			$search->compare('==', 'product.lists.type.code', 'hidden'),
428 428
 		);
429
-		$search->setConditions( $search->combine( '&&', $expr ) );
429
+		$search->setConditions($search->combine('&&', $expr));
430 430
 
431
-		return $manager->searchItems( $search );
431
+		return $manager->searchItems($search);
432 432
 	}
433 433
 
434 434
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	protected function getSubClientNames()
441 441
 	{
442
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
442
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
443 443
 	}
444 444
 
445 445
 
@@ -448,29 +448,29 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
450 450
 	 */
451
-	protected function setData( \Aimeos\MW\View\Iface $view )
451
+	protected function setData(\Aimeos\MW\View\Iface $view)
452 452
 	{
453
-		$view->downloadData = (array) $view->param( 'download', array() );
453
+		$view->downloadData = (array) $view->param('download', array());
454 454
 
455
-		if( !empty( $view->downloadData ) ) {
455
+		if (!empty($view->downloadData)) {
456 456
 			return;
457 457
 		}
458 458
 
459 459
 		$data = array();
460
-		$listItems = $this->getListItems( $view->item->getId() );
461
-		$attrItems = $this->getAttributeItems( $listItems );
460
+		$listItems = $this->getListItems($view->item->getId());
461
+		$attrItems = $this->getAttributeItems($listItems);
462 462
 
463
-		foreach( $listItems as $listItem )
463
+		foreach ($listItems as $listItem)
464 464
 		{
465
-			if( !isset( $attrItems[$listItem->getRefId()] ) ) {
465
+			if (!isset($attrItems[$listItem->getRefId()])) {
466 466
 				continue;
467 467
 			}
468 468
 
469
-			foreach( $listItem->toArray() as $key => $value ) {
469
+			foreach ($listItem->toArray() as $key => $value) {
470 470
 				$data[$key] = $value;
471 471
 			}
472 472
 
473
-			foreach( $attrItems[$listItem->getRefId()]->toArray() as $key => $value ) {
473
+			foreach ($attrItems[$listItem->getRefId()]->toArray() as $key => $value) {
474 474
 				$data[$key] = $value;
475 475
 			}
476 476
 
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 
479 479
 			try
480 480
 			{
481
-				$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
481
+				$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
482 482
 
483
-				$data['time'] = $fs->time( $data['path'] );
484
-				$data['size'] = $fs->size( $data['path'] );
483
+				$data['time'] = $fs->time($data['path']);
484
+				$data['size'] = $fs->size($data['path']);
485 485
 			}
486
-			catch( \Exception $e ) { ; } // Show product even if file isn't available any more
486
+			catch (\Exception $e) {; } // Show product even if file isn't available any more
487 487
 		}
488 488
 
489 489
 		$view->downloadData = $data;
@@ -497,22 +497,22 @@  discard block
 block discarded – undo
497 497
 	 * @param string $path Path the file should be stored at
498 498
 	 * @return string Path to the uploaded file
499 499
 	 */
500
-	protected function storeFile( \Psr\Http\Message\UploadedFileInterface $file, $path )
500
+	protected function storeFile(\Psr\Http\Message\UploadedFileInterface $file, $path)
501 501
 	{
502
-		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
502
+		$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
503 503
 
504
-		if( $path == null )
504
+		if ($path == null)
505 505
 		{
506
-			$ext = pathinfo( $file->getClientFilename(), PATHINFO_EXTENSION );
507
-			$hash = md5( $file->getClientFilename() . microtime( true ) );
508
-			$path = sprintf( '%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext );
506
+			$ext = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
507
+			$hash = md5($file->getClientFilename() . microtime(true));
508
+			$path = sprintf('%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext);
509 509
 
510
-			if( !$fs->isdir( $hash[0] . '/' . $hash[1] ) ) {
511
-				$fs->mkdir( $hash[0] . '/' . $hash[1] );
510
+			if (!$fs->isdir($hash[0] . '/' . $hash[1])) {
511
+				$fs->mkdir($hash[0] . '/' . $hash[1]);
512 512
 			}
513 513
 		}
514 514
 
515
-		$fs->writes( $path, $file->getStream()->detach() );
515
+		$fs->writes($path, $file->getStream()->detach());
516 516
 
517 517
 		return $path;
518 518
 	}
@@ -523,47 +523,47 @@  discard block
 block discarded – undo
523 523
 	 *
524 524
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
525 525
 	 */
526
-	protected function updateItems( \Aimeos\MW\View\Iface $view )
526
+	protected function updateItems(\Aimeos\MW\View\Iface $view)
527 527
 	{
528 528
 		$id = $view->item->getId();
529 529
 		$context = $this->getContext();
530 530
 
531
-		$attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
532
-		$listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
531
+		$attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
532
+		$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
533 533
 
534
-		$listItems = $this->getListItems( $id );
535
-		$listId = $view->param( 'download/product.lists.id' );
534
+		$listItems = $this->getListItems($id);
535
+		$listId = $view->param('download/product.lists.id');
536 536
 
537
-		if( isset( $listItems[$listId] ) ) {
537
+		if (isset($listItems[$listId])) {
538 538
 			$litem = $listItems[$listId];
539 539
 		} else {
540
-			$litem = $this->createListItem( $id );
540
+			$litem = $this->createListItem($id);
541 541
 		}
542 542
 
543
-		if( ( $attrId = $view->param( 'download/attribute.id' ) ) != '' ) {
544
-			$item = $attrManager->getItem( $attrId );
543
+		if (($attrId = $view->param('download/attribute.id')) != '') {
544
+			$item = $attrManager->getItem($attrId);
545 545
 		} else {
546 546
 			$item = $this->createItem();
547 547
 		}
548 548
 
549
-		if( ( $file = $view->value( (array) $view->request()->getUploadedFiles(), 'download/file' ) ) !== null
549
+		if (($file = $view->value((array) $view->request()->getUploadedFiles(), 'download/file')) !== null
550 550
 			&& $file->getError() === UPLOAD_ERR_OK
551 551
 		) {
552
-			$path = ( $view->param( 'download/overwrite' ) == 1 ? $item->getCode() : null );
553
-			$item->setCode( $this->storeFile( $file, $path ) );
552
+			$path = ($view->param('download/overwrite') == 1 ? $item->getCode() : null);
553
+			$item->setCode($this->storeFile($file, $path));
554 554
 		}
555 555
 
556
-		if( ( $label = $view->param( 'download/attribute.label' ) ) != '' )
556
+		if (($label = $view->param('download/attribute.label')) != '')
557 557
 		{
558
-			$item->setLabel( $label );
559
-			$attrManager->saveItem( $item );
558
+			$item->setLabel($label);
559
+			$attrManager->saveItem($item);
560 560
 
561
-			$litem->setPosition( 0 );
562
-			$litem->setRefId( $item->getId() );
563
-			$litem->setStatus( $view->param( 'download/product.lists.status' ) );
564
-			$listManager->saveItem( $litem );
561
+			$litem->setPosition(0);
562
+			$litem->setRefId($item->getId());
563
+			$litem->setStatus($view->param('download/product.lists.status'));
564
+			$listManager->saveItem($litem);
565 565
 		}
566 566
 
567
-		$this->cleanupItems( $listItems, array( $listId ) );
567
+		$this->cleanupItems($listItems, array($listId));
568 568
 	}
569 569
 }
570 570
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -196,16 +196,14 @@  discard block
 block discarded – undo
196 196
 			$attrManager->commit();
197 197
 			$manager->commit();
198 198
 			return;
199
-		}
200
-		catch( \Aimeos\MShop\Exception $e )
199
+		} catch( \Aimeos\MShop\Exception $e )
201 200
 		{
202 201
 			$error = array( 'product-item-download' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
203 202
 			$view->errors = $view->get( 'errors', array() ) + $error;
204 203
 
205 204
 			$attrManager->rollback();
206 205
 			$manager->rollback();
207
-		}
208
-		catch( \Exception $e )
206
+		} catch( \Exception $e )
209 207
 		{
210 208
 			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
211 209
 			$error = array( 'product-item-download' => $e->getMessage() );
@@ -482,8 +480,7 @@  discard block
 block discarded – undo
482 480
 
483 481
 				$data['time'] = $fs->time( $data['path'] );
484 482
 				$data['size'] = $fs->size( $data['path'] );
485
-			}
486
-			catch( \Exception $e ) { ; } // Show product even if file isn't available any more
483
+			} catch( \Exception $e ) { ; } // Show product even if file isn't available any more
487 484
 		}
488 485
 
489 486
 		$view->downloadData = $data;
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Base.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key
34 34
 	 * 	and a list of relative paths inside the core or the extension as values
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths )
36
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths)
37 37
 	{
38 38
 		$this->context = $context;
39 39
 		$this->templatePaths = $templatePaths;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param array $param List of method parameter
48 48
 	 * @return boolean False for every call
49 49
 	 */
50
-	public function __call( $name, array $param )
50
+	public function __call($name, array $param)
51 51
 	{
52 52
 		return false;
53 53
 	}
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function getView()
62 62
 	{
63
-		if( !isset( $this->view ) ) {
64
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No view available' ) );
63
+		if (!isset($this->view)) {
64
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No view available'));
65 65
 		}
66 66
 
67 67
 		return $this->view;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
75 75
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
76 76
 	 */
77
-	public function setView( \Aimeos\MW\View\Iface $view )
77
+	public function setView(\Aimeos\MW\View\Iface $view)
78 78
 	{
79 79
 		$this->view = $view;
80 80
 		return $this;
@@ -110,29 +110,29 @@  discard block
 block discarded – undo
110 110
 	 * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\"
111 111
 	 * @return \Aimeos\Admin\JQAdm\Iface Admin object
112 112
 	 */
113
-	protected function addDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths,
114
-		array $decorators, $classprefix )
113
+	protected function addDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths,
114
+		array $decorators, $classprefix)
115 115
 	{
116 116
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface';
117 117
 
118
-		foreach( $decorators as $name )
118
+		foreach ($decorators as $name)
119 119
 		{
120
-			if( ctype_alnum( $name ) === false )
120
+			if (ctype_alnum($name) === false)
121 121
 			{
122
-				$classname = is_string( $name ) ? $classprefix . $name : '<not a string>';
123
-				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) );
122
+				$classname = is_string($name) ? $classprefix . $name : '<not a string>';
123
+				throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname));
124 124
 			}
125 125
 
126 126
 			$classname = $classprefix . $name;
127 127
 
128
-			if( class_exists( $classname ) === false ) {
129
-				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
128
+			if (class_exists($classname) === false) {
129
+				throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname));
130 130
 			}
131 131
 
132
-			$client = new $classname( $client, $this->context, $this->templatePaths );
132
+			$client = new $classname($client, $this->context, $this->templatePaths);
133 133
 
134
-			if( !( $client instanceof $iface ) ) {
135
-				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) );
134
+			if (!($client instanceof $iface)) {
135
+				throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface));
136 136
 			}
137 137
 		}
138 138
 
@@ -148,35 +148,35 @@  discard block
 block discarded – undo
148 148
 	 * @param string $path Admin string in lower case, e.g. "catalog/detail/basic"
149 149
 	 * @return \Aimeos\Admin\JQAdm\Iface Admin object
150 150
 	 */
151
-	protected function addClientDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path )
151
+	protected function addClientDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path)
152 152
 	{
153
-		if( !is_string( $path ) || $path === '' ) {
154
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) );
153
+		if (!is_string($path) || $path === '') {
154
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path));
155 155
 		}
156 156
 
157
-		$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) );
157
+		$localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path)));
158 158
 		$config = $this->context->getConfig();
159 159
 
160
-		$decorators = $config->get( 'admin/jqadm/common/decorators/default', array() );
161
-		$excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() );
160
+		$decorators = $config->get('admin/jqadm/common/decorators/default', array());
161
+		$excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array());
162 162
 
163
-		foreach( $decorators as $key => $name )
163
+		foreach ($decorators as $key => $name)
164 164
 		{
165
-			if( in_array( $name, $excludes ) ) {
166
-				unset( $decorators[$key] );
165
+			if (in_array($name, $excludes)) {
166
+				unset($decorators[$key]);
167 167
 			}
168 168
 		}
169 169
 
170 170
 		$classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\';
171
-		$client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix );
171
+		$client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix);
172 172
 
173 173
 		$classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\';
174
-		$decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() );
175
-		$client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix );
174
+		$decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array());
175
+		$client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix);
176 176
 
177 177
 		$classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\';
178
-		$decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() );
179
-		$client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix );
178
+		$decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array());
179
+		$client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix);
180 180
 
181 181
 		return $client;
182 182
 	}
@@ -189,35 +189,35 @@  discard block
 block discarded – undo
189 189
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
190 190
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-part object
191 191
 	 */
192
-	protected function createSubClient( $path, $name )
192
+	protected function createSubClient($path, $name)
193 193
 	{
194
-		$path = strtolower( $path );
194
+		$path = strtolower($path);
195 195
 
196
-		if( $name === null ) {
197
-			$name = $this->context->getConfig()->get( 'admin/jqadm/' . $path . '/name', 'Standard' );
196
+		if ($name === null) {
197
+			$name = $this->context->getConfig()->get('admin/jqadm/' . $path . '/name', 'Standard');
198 198
 		}
199 199
 
200
-		if( empty( $name ) || ctype_alnum( $name ) === false ) {
201
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $name ) );
200
+		if (empty($name) || ctype_alnum($name) === false) {
201
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $name));
202 202
 		}
203 203
 
204
-		$subnames = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) );
204
+		$subnames = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path)));
205 205
 
206 206
 		$classname = '\\Aimeos\\Admin\\JQAdm\\' . $subnames . '\\' . $name;
207 207
 		$interface = '\\Aimeos\\Admin\\JQAdm\\Iface';
208 208
 
209
-		if( class_exists( $classname ) === false ) {
210
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
209
+		if (class_exists($classname) === false) {
210
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname));
211 211
 		}
212 212
 
213
-		$object = new $classname( $this->context, $this->templatePaths );
213
+		$object = new $classname($this->context, $this->templatePaths);
214 214
 
215
-		if( ( $object instanceof $interface ) === false ) {
216
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) );
215
+		if (($object instanceof $interface) === false) {
216
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface));
217 217
 		}
218 218
 
219
-		$object = $this->addClientDecorators( $object, $this->templatePaths, $path );
220
-		$object->setView( $this->view );
219
+		$object = $this->addClientDecorators($object, $this->templatePaths, $path);
220
+		$object->setView($this->view);
221 221
 
222 222
 		return $object;
223 223
 	}
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
 	 * @param array $names List of parameter names
230 230
 	 * @return array Associative list of parameters names as key and their values
231 231
 	 */
232
-	protected function getClientParams( $names = array( 'resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort' ) )
232
+	protected function getClientParams($names = array('resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort'))
233 233
 	{
234 234
 		$list = array();
235 235
 
236
-		foreach( $names as $name )
236
+		foreach ($names as $name)
237 237
 		{
238
-			if( ( $val = $this->view->param( $name ) ) !== null ) {
238
+			if (($val = $this->view->param($name)) !== null) {
239 239
 				$list[$name] = $val;
240 240
 			}
241 241
 		}
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	protected function getSubClients()
272 272
 	{
273
-		if( !isset( $this->subclients ) )
273
+		if (!isset($this->subclients))
274 274
 		{
275 275
 			$this->subclients = array();
276 276
 
277
-			foreach( $this->getSubClientNames() as $name ) {
278
-				$this->subclients[] = $this->getSubClient( $name );
277
+			foreach ($this->getSubClientNames() as $name) {
278
+				$this->subclients[] = $this->getSubClient($name);
279 279
 			}
280 280
 		}
281 281
 
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 * @param array $params List of criteria data with condition, sorting and paging
302 302
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
303 303
 	 */
304
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
304
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
305 305
 	{
306
-		$this->initCriteriaConditions( $criteria, $params );
307
-		$this->initCriteriaSortations( $criteria, $params );
308
-		$this->initCriteriaSlice( $criteria, $params );
306
+		$this->initCriteriaConditions($criteria, $params);
307
+		$this->initCriteriaSortations($criteria, $params);
308
+		$this->initCriteriaSlice($criteria, $params);
309 309
 
310 310
 		return $criteria;
311 311
 	}
@@ -317,24 +317,24 @@  discard block
 block discarded – undo
317 317
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
318 318
 	 * @param array $params List of criteria data with condition, sorting and paging
319 319
 	 */
320
-	private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
320
+	private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
321 321
 	{
322
-		if( isset( $params['filter'] ) && isset( $params['filter']['key'] ) )
322
+		if (isset($params['filter']) && isset($params['filter']['key']))
323 323
 		{
324 324
 			$expr = array();
325 325
 			$existing = $criteria->getConditions();
326 326
 
327
-			foreach( (array) $params['filter']['key'] as $idx => $key )
327
+			foreach ((array) $params['filter']['key'] as $idx => $key)
328 328
 			{
329
-				if( $key != '' && isset( $params['filter']['op'][$idx] ) && $params['filter']['op'][$idx] != ''
330
-					&& isset( $params['filter']['val'][$idx] )
329
+				if ($key != '' && isset($params['filter']['op'][$idx]) && $params['filter']['op'][$idx] != ''
330
+					&& isset($params['filter']['val'][$idx])
331 331
 				) {
332
-					$expr[] = $criteria->compare( $params['filter']['op'][$idx], $key, $params['filter']['val'][$idx] );
332
+					$expr[] = $criteria->compare($params['filter']['op'][$idx], $key, $params['filter']['val'][$idx]);
333 333
 				}
334 334
 			}
335 335
 
336 336
 			$expr[] = $existing;
337
-			$criteria->setConditions( $criteria->combine( '&&', $expr ) );
337
+			$criteria->setConditions($criteria->combine('&&', $expr));
338 338
 		}
339 339
 	}
340 340
 
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
346 346
 	 * @param array $params List of criteria data with condition, sorting and paging
347 347
 	 */
348
-	private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
348
+	private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
349 349
 	{
350
-		$start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 );
351
-		$size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 100 );
350
+		$start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0);
351
+		$size = (isset($params['page']['limit']) ? $params['page']['limit'] : 100);
352 352
 
353
-		$criteria->setSlice( $start, $size );
353
+		$criteria->setSlice($start, $size);
354 354
 	}
355 355
 
356 356
 
@@ -360,23 +360,23 @@  discard block
 block discarded – undo
360 360
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
361 361
 	 * @param array $params List of criteria data with condition, sorting and paging
362 362
 	 */
363
-	private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
363
+	private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
364 364
 	{
365
-		if( !isset( $params['sort'] ) ) {
365
+		if (!isset($params['sort'])) {
366 366
 			return;
367 367
 		}
368 368
 
369 369
 		$sortation = array();
370 370
 
371
-		foreach( (array) $params['sort'] as $sort )
371
+		foreach ((array) $params['sort'] as $sort)
372 372
 		{
373
-			if( $sort[0] === '-' ) {
374
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
373
+			if ($sort[0] === '-') {
374
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
375 375
 			} else {
376
-				$sortation[] = $criteria->sort( '+', $sort ); break;
376
+				$sortation[] = $criteria->sort('+', $sort); break;
377 377
 			}
378 378
 		}
379 379
 
380
-		$criteria->setSortations( $sortation );
380
+		$criteria->setSortations($sortation);
381 381
 	}
382 382
 }
Please login to merge, or discard this patch.