Completed
Push — master ( 521882...b49ab8 )
by Aimeos
04:07
created
admin/jqadm/src/Admin/JQAdm/Subscription/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface Filter part 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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
32
+	public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
33 33
 	{
34 34
 		/** admin/jqadm/subscription/name
35 35
 		 * Class name of the used account favorite client implementation
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 		 * @since 2018.04
65 65
 		 * @category Developer
66 66
 		 */
67
-		if( $name === null ) {
68
-			$name = $context->getConfig()->get( 'admin/jqadm/subscription/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $context->getConfig()->get('admin/jqadm/subscription/name', 'Standard');
69 69
 		}
70 70
 
71
-		if( ctype_alnum( $name ) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Subscription\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
73
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Subscription\\' . $name : '<not a string>';
74
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Iface';
78 78
 		$classname = '\\Aimeos\\Admin\\JQAdm\\Subscription\\' . $name;
79 79
 
80
-		$client = self::createAdmin( $context, $classname, $iface );
80
+		$client = self::createAdmin($context, $classname, $iface);
81 81
 
82
-		return self::addClientDecorators( $context, $client, 'subscription' );
82
+		return self::addClientDecorators($context, $client, 'subscription');
83 83
 	}
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Plugin/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface Filter part 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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
32
+	public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
33 33
 	{
34 34
 		/** admin/jqadm/plugin/name
35 35
 		 * Class name of the used account favorite client implementation
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 		 * @since 2017.07
65 65
 		 * @category Developer
66 66
 		 */
67
-		if( $name === null ) {
68
-			$name = $context->getConfig()->get( 'admin/jqadm/plugin/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $context->getConfig()->get('admin/jqadm/plugin/name', 'Standard');
69 69
 		}
70 70
 
71
-		if( ctype_alnum( $name ) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Plugin\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
73
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Plugin\\' . $name : '<not a string>';
74
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Iface';
78 78
 		$classname = '\\Aimeos\\Admin\\JQAdm\\Plugin\\' . $name;
79 79
 
80
-		$client = self::createAdmin( $context, $classname, $iface );
80
+		$client = self::createAdmin($context, $classname, $iface);
81 81
 
82
-		return self::addClientDecorators( $context, $client, 'plugin' );
82
+		return self::addClientDecorators($context, $client, 'plugin');
83 83
 	}
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Group/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface Filter part 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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
32
+	public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
33 33
 	{
34 34
 		/** admin/jqadm/group/name
35 35
 		 * Class name of the used account favorite client implementation
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 		 * @since 2018.07
65 65
 		 * @category Developer
66 66
 		 */
67
-		if( $name === null ) {
68
-			$name = $context->getConfig()->get( 'admin/jqadm/group/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $context->getConfig()->get('admin/jqadm/group/name', 'Standard');
69 69
 		}
70 70
 
71
-		if( ctype_alnum( $name ) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
73
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name : '<not a string>';
74
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Iface';
78 78
 		$classname = '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name;
79 79
 
80
-		$client = self::createAdmin( $context, $classname, $iface );
80
+		$client = self::createAdmin($context, $classname, $iface);
81 81
 
82
-		return self::addClientDecorators( $context, $client, 'group' );
82
+		return self::addClientDecorators($context, $client, 'group');
83 83
 	}
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Order/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface Filter part 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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
32
+	public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
33 33
 	{
34 34
 		/** admin/jqadm/order/name
35 35
 		 * Class name of the used account favorite client implementation
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 		 * @since 2016.01
65 65
 		 * @category Developer
66 66
 		 */
67
-		if( $name === null ) {
68
-			$name = $context->getConfig()->get( 'admin/jqadm/order/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $context->getConfig()->get('admin/jqadm/order/name', 'Standard');
69 69
 		}
70 70
 
71
-		if( ctype_alnum( $name ) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Order\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
73
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Order\\' . $name : '<not a string>';
74
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Iface';
78 78
 		$classname = '\\Aimeos\\Admin\\JQAdm\\Order\\' . $name;
79 79
 
80
-		$client = self::createAdmin( $context, $classname, $iface );
80
+		$client = self::createAdmin($context, $classname, $iface);
81 81
 
82
-		return self::addClientDecorators( $context, $client, 'order' );
82
+		return self::addClientDecorators($context, $client, 'order');
83 83
 	}
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Media/Property/Standard.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Aimeos\Admin\JQAdm\Product\Media\Property;
12 12
 
13
-sprintf( 'property' ); // for translation
13
+sprintf('property'); // for translation
14 14
 
15 15
 
16 16
 /**
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function copy()
44 44
 	{
45
-		$view = $this->addViewData( $this->getView() );
45
+		$view = $this->addViewData($this->getView());
46 46
 
47
-		$view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ), true );
47
+		$view->mediaData = $this->toArray($view->item, $view->get('mediaData', []), true);
48 48
 		$view->propertyBody = '';
49 49
 
50
-		foreach( $this->getSubClients() as $client ) {
50
+		foreach ($this->getSubClients() as $client) {
51 51
 			$view->propertyBody .= $client->copy();
52 52
 		}
53 53
 
54
-		return $this->render( $view );
54
+		return $this->render($view);
55 55
 	}
56 56
 
57 57
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function create()
64 64
 	{
65
-		$view = $this->addViewData( $this->getView() );
65
+		$view = $this->addViewData($this->getView());
66 66
 		$siteid = $this->getContext()->getLocale()->getSiteId();
67
-		$data = $view->get( 'mediaData', [] );
67
+		$data = $view->get('mediaData', []);
68 68
 
69
-		foreach( $data as $index => $entry )
69
+		foreach ($data as $index => $entry)
70 70
 		{
71
-			foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) {
71
+			foreach ($view->value($entry, 'property', []) as $idx => $y) {
72 72
 				$data[$index]['property'][$idx]['product.lists.siteid'] = $siteid;
73 73
 			}
74 74
 		}
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		$view->propertyData = $data;
77 77
 		$view->propertyBody = '';
78 78
 
79
-		foreach( $this->getSubClients() as $client ) {
79
+		foreach ($this->getSubClients() as $client) {
80 80
 			$view->propertyBody .= $client->create();
81 81
 		}
82 82
 
83
-		return $this->render( $view );
83
+		return $this->render($view);
84 84
 	}
85 85
 
86 86
 
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get()
93 93
 	{
94
-		$view = $this->addViewData( $this->getView() );
94
+		$view = $this->addViewData($this->getView());
95 95
 
96
-		$view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ) );
96
+		$view->mediaData = $this->toArray($view->item, $view->get('mediaData', []));
97 97
 		$view->propertyBody = '';
98 98
 
99
-		foreach( $this->getSubClients() as $client ) {
99
+		foreach ($this->getSubClients() as $client) {
100 100
 			$view->propertyBody .= $client->get();
101 101
 		}
102 102
 
103
-		return $this->render( $view );
103
+		return $this->render($view);
104 104
 	}
105 105
 
106 106
 
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	{
112 112
 		$view = $this->getView();
113 113
 
114
-		$view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) );
114
+		$view->item = $this->fromArray($view->item, $view->param('media', []));
115 115
 		$view->propertyBody = '';
116 116
 
117
-		foreach( $this->getSubClients() as $client ) {
117
+		foreach ($this->getSubClients() as $client) {
118 118
 			$view->propertyBody .= $client->save();
119 119
 		}
120 120
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string|null $name Name of the sub-client (Default if null)
128 128
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
129 129
 	 */
130
-	public function getSubClient( $type, $name = null )
130
+	public function getSubClient($type, $name = null)
131 131
 	{
132 132
 		/** admin/jqadm/product/media/property/decorators/excludes
133 133
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		 * @see admin/jqadm/product/media/property/decorators/excludes
203 203
 		 * @see admin/jqadm/product/media/property/decorators/global
204 204
 		 */
205
-		return $this->createSubClient( 'product/media/property/' . $type, $name );
205
+		return $this->createSubClient('product/media/property/' . $type, $name);
206 206
 	}
207 207
 
208 208
 
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 	 * @param \Aimeos\MW\View\Iface $view View object
213 213
 	 * @return \Aimeos\MW\View\Iface View object with assigned parameters
214 214
 	 */
215
-	protected function addViewData( \Aimeos\MW\View\Iface $view )
215
+	protected function addViewData(\Aimeos\MW\View\Iface $view)
216 216
 	{
217
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'media/property/type' );
217
+		$manager = \Aimeos\MShop::create($this->getContext(), 'media/property/type');
218 218
 
219 219
 		$search = $manager->createSearch();
220
-		$search->setConditions( $search->compare( '==', 'media.property.type.domain', 'product' ) );
221
-		$search->setSlice( 0, 0x7fffffff );
220
+		$search->setConditions($search->compare('==', 'media.property.type.domain', 'product'));
221
+		$search->setSlice(0, 0x7fffffff);
222 222
 
223
-		$view->propertyTypes = $manager->searchItems( $search );
223
+		$view->propertyTypes = $manager->searchItems($search);
224 224
 
225 225
 		return $view;
226 226
 	}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		 * @since 2018.01
267 267
 		 * @category Developer
268 268
 		 */
269
-		return $this->getContext()->getConfig()->get( 'admin/jqadm/product/media/property/standard/subparts', [] );
269
+		return $this->getContext()->getConfig()->get('admin/jqadm/product/media/property/standard/subparts', []);
270 270
 	}
271 271
 
272 272
 
@@ -276,32 +276,32 @@  discard block
 block discarded – undo
276 276
 	 * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items
277 277
 	 * @param string[] $data Data array
278 278
 	 */
279
-	protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
279
+	protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data)
280 280
 	{
281
-		$propManager = \Aimeos\MShop::create( $this->getContext(), 'media/property' );
281
+		$propManager = \Aimeos\MShop::create($this->getContext(), 'media/property');
282 282
 		$index = 0;
283 283
 
284
-		foreach( $item->getRefItems( 'media', null, null, false ) as $refItem )
284
+		foreach ($item->getRefItems('media', null, null, false) as $refItem)
285 285
 		{
286
-			$propItems = $refItem->getPropertyItems( null, false );
286
+			$propItems = $refItem->getPropertyItems(null, false);
287 287
 
288
-			foreach( (array) $this->getValue( $data, $index . '/property', [] ) as $entry )
288
+			foreach ((array) $this->getValue($data, $index . '/property', []) as $entry)
289 289
 			{
290
-				if( isset( $propItems[$entry['media.property.id']] ) )
290
+				if (isset($propItems[$entry['media.property.id']]))
291 291
 				{
292 292
 					$propItem = $propItems[$entry['media.property.id']];
293
-					unset( $propItems[$entry['media.property.id']] );
293
+					unset($propItems[$entry['media.property.id']]);
294 294
 				}
295 295
 				else
296 296
 				{
297 297
 					$propItem = $propManager->createItem();
298 298
 				}
299 299
 
300
-				$propItem->fromArray( $entry );
301
-				$refItem->addPropertyItem( $propItem );
300
+				$propItem->fromArray($entry);
301
+				$refItem->addPropertyItem($propItem);
302 302
 			}
303 303
 
304
-			$refItem->deletePropertyItems( $propItems );
304
+			$refItem->deletePropertyItems($propItems);
305 305
 			$index++;
306 306
 		}
307 307
 
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 	 * @param boolean $copy True if items should be copied, false if not
318 318
 	 * @return string[] Multi-dimensional associative list of item data
319 319
 	 */
320
-	protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, array $data, $copy = false )
320
+	protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, array $data, $copy = false)
321 321
 	{
322 322
 		$idx = 0;
323 323
 		$siteId = $this->getContext()->getLocale()->getSiteId();
324 324
 
325
-		foreach( $item->getRefItems( 'media', null, null, false ) as $mediaItem )
325
+		foreach ($item->getRefItems('media', null, null, false) as $mediaItem)
326 326
 		{
327
-			foreach( $mediaItem->getPropertyItems( null, false )  as $propItem )
327
+			foreach ($mediaItem->getPropertyItems(null, false)  as $propItem)
328 328
 			{
329
-				$list = $propItem->toArray( true );
329
+				$list = $propItem->toArray(true);
330 330
 
331
-				if( $copy === true )
331
+				if ($copy === true)
332 332
 				{
333 333
 					$list['media.property.siteid'] = $siteId;
334 334
 					$list['media.property.id'] = '';
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
351 351
 	 * @return string HTML output
352 352
 	 */
353
-	protected function render( \Aimeos\MW\View\Iface $view )
353
+	protected function render(\Aimeos\MW\View\Iface $view)
354 354
 	{
355 355
 		/** admin/jqadm/product/media/property/template-item
356 356
 		 * Relative path to the HTML body template of the media subpart for products.
@@ -374,6 +374,6 @@  discard block
 block discarded – undo
374 374
 		$tplconf = 'admin/jqadm/product/media/property/template-item';
375 375
 		$default = 'product/item-media-property-standard';
376 376
 
377
-		return $view->render( $view->config( $tplconf, $default ) );
377
+		return $view->render($view->config($tplconf, $default));
378 378
 	}
379 379
 }
380 380
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -291,8 +291,7 @@
 block discarded – undo
291 291
 				{
292 292
 					$propItem = $propItems[$entry['media.property.id']];
293 293
 					unset( $propItems[$entry['media.property.id']] );
294
-				}
295
-				else
294
+				} else
296 295
 				{
297 296
 					$propItem = $propManager->createItem();
298 297
 				}
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Media/Standard.php 2 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Aimeos\Admin\JQAdm\Product\Media;
12 12
 
13
-sprintf( 'media' ); // for translation
13
+sprintf('media'); // for translation
14 14
 
15 15
 
16 16
 /**
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function copy()
44 44
 	{
45
-		$view = $this->addViewData( $this->getView() );
45
+		$view = $this->addViewData($this->getView());
46 46
 
47
-		$view->mediaData = $this->toArray( $view->item, true );
47
+		$view->mediaData = $this->toArray($view->item, true);
48 48
 		$view->mediaBody = '';
49 49
 
50
-		foreach( $this->getSubClients() as $client ) {
50
+		foreach ($this->getSubClients() as $client) {
51 51
 			$view->mediaBody .= $client->copy();
52 52
 		}
53 53
 
54
-		return $this->render( $view );
54
+		return $this->render($view);
55 55
 	}
56 56
 
57 57
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function create()
64 64
 	{
65
-		$view = $this->addViewData( $this->getView() );
65
+		$view = $this->addViewData($this->getView());
66 66
 		$siteid = $this->getContext()->getLocale()->getSiteId();
67 67
 
68
-		$itemData = $this->toArray( $view->item );
69
-		$data = array_replace_recursive( $itemData, $view->param( 'media', [] ) );
68
+		$itemData = $this->toArray($view->item);
69
+		$data = array_replace_recursive($itemData, $view->param('media', []));
70 70
 
71
-		foreach( $data as $idx => $entry )
71
+		foreach ($data as $idx => $entry)
72 72
 		{
73 73
 			$data[$idx]['media.siteid'] = $siteid;
74 74
 			$data[$idx]['media.url'] = $itemData[$idx]['media.url'];
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		$view->mediaData = $data;
80 80
 		$view->mediaBody = '';
81 81
 
82
-		foreach( $this->getSubClients() as $client ) {
82
+		foreach ($this->getSubClients() as $client) {
83 83
 			$view->mediaBody .= $client->create();
84 84
 		}
85 85
 
86
-		return $this->render( $view );
86
+		return $this->render($view);
87 87
 	}
88 88
 
89 89
 
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 		parent::delete();
96 96
 
97 97
 		$item = $this->getView()->item;
98
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() );
98
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext());
99 99
 
100
-		foreach( $item->getListItems( 'media', null, null, false ) as $listItem )
100
+		foreach ($item->getListItems('media', null, null, false) as $listItem)
101 101
 		{
102
-			if( ( $refItem = $listItem->getRefItem() ) !== null ) {
103
-				$cntl->delete( $refItem );
102
+			if (($refItem = $listItem->getRefItem()) !== null) {
103
+				$cntl->delete($refItem);
104 104
 			}
105 105
 
106
-			$item->deleteListItem( 'media', $listItem, $refItem );
106
+			$item->deleteListItem('media', $listItem, $refItem);
107 107
 		}
108 108
 	}
109 109
 
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function get()
117 117
 	{
118
-		$view = $this->addViewData( $this->getView() );
118
+		$view = $this->addViewData($this->getView());
119 119
 
120
-		$view->mediaData = $this->toArray( $view->item );
120
+		$view->mediaData = $this->toArray($view->item);
121 121
 		$view->mediaBody = '';
122 122
 
123
-		foreach( $this->getSubClients() as $client ) {
123
+		foreach ($this->getSubClients() as $client) {
124 124
 			$view->mediaBody .= $client->get();
125 125
 		}
126 126
 
127
-		return $this->render( $view );
127
+		return $this->render($view);
128 128
 	}
129 129
 
130 130
 
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
 
138 138
 		try
139 139
 		{
140
-			$view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) );
140
+			$view->item = $this->fromArray($view->item, $view->param('media', []));
141 141
 			$view->mediaBody = '';
142 142
 
143
-			foreach( $this->getSubClients() as $client ) {
143
+			foreach ($this->getSubClients() as $client) {
144 144
 				$view->mediaBody .= $client->save();
145 145
 			}
146 146
 
147 147
 			return;
148 148
 		}
149
-		catch( \Aimeos\MShop\Exception $e )
149
+		catch (\Aimeos\MShop\Exception $e)
150 150
 		{
151
-			$error = array( 'product-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
152
-			$view->errors = $view->get( 'errors', [] ) + $error;
153
-			$this->logException( $e );
151
+			$error = array('product-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
152
+			$view->errors = $view->get('errors', []) + $error;
153
+			$this->logException($e);
154 154
 		}
155
-		catch( \Exception $e )
155
+		catch (\Exception $e)
156 156
 		{
157
-			$error = array( 'product-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
158
-			$view->errors = $view->get( 'errors', [] ) + $error;
159
-			$this->logException( $e );
157
+			$error = array('product-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine());
158
+			$view->errors = $view->get('errors', []) + $error;
159
+			$this->logException($e);
160 160
 		}
161 161
 
162 162
 		throw new \Aimeos\Admin\JQAdm\Exception();
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param string|null $name Name of the sub-client (Default if null)
171 171
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
172 172
 	 */
173
-	public function getSubClient( $type, $name = null )
173
+	public function getSubClient($type, $name = null)
174 174
 	{
175 175
 		/** admin/jqadm/product/media/decorators/excludes
176 176
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 * @see admin/jqadm/product/media/decorators/excludes
246 246
 		 * @see admin/jqadm/product/media/decorators/global
247 247
 		 */
248
-		return $this->createSubClient( 'product/media/' . $type, $name );
248
+		return $this->createSubClient('product/media/' . $type, $name);
249 249
 	}
250 250
 
251 251
 
@@ -257,24 +257,24 @@  discard block
 block discarded – undo
257 257
 	 * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $attrListItems Product list items referencing variant attributes
258 258
 	 * @return \Aimeos\MShop\Media\Item\Iface Modified media item
259 259
 	 */
260
-	protected function addMediaAttributes( \Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems )
260
+	protected function addMediaAttributes(\Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems)
261 261
 	{
262
-		$listManager = \Aimeos\MShop::create( $this->getContext(), 'media/lists' );
263
-		$listItems = $mediaItem->getListItems( 'attribute', 'variant', null, false );
262
+		$listManager = \Aimeos\MShop::create($this->getContext(), 'media/lists');
263
+		$listItems = $mediaItem->getListItems('attribute', 'variant', null, false);
264 264
 
265
-		foreach( $attrListItems as $listItem )
265
+		foreach ($attrListItems as $listItem)
266 266
 		{
267
-			if( ( $litem = $mediaItem->getListItem( 'attribute', 'variant', $listItem->getRefId(), false ) ) !== null )
267
+			if (($litem = $mediaItem->getListItem('attribute', 'variant', $listItem->getRefId(), false)) !== null)
268 268
 			{
269
-				unset( $listItems[$litem->getId()] );
269
+				unset($listItems[$litem->getId()]);
270 270
 				continue;
271 271
 			}
272 272
 
273
-			$litem = $listManager->createItem()->setType( 'variant' )->setRefId( $listItem->getRefId() );
274
-			$mediaItem->addListItem( 'attribute', $litem );
273
+			$litem = $listManager->createItem()->setType('variant')->setRefId($listItem->getRefId());
274
+			$mediaItem->addListItem('attribute', $litem);
275 275
 		}
276 276
 
277
-		return $mediaItem->deleteListItems( $listItems );
277
+		return $mediaItem->deleteListItems($listItems);
278 278
 	}
279 279
 
280 280
 
@@ -284,23 +284,23 @@  discard block
 block discarded – undo
284 284
 	 * @param \Aimeos\MW\View\Iface $view View object
285 285
 	 * @return \Aimeos\MW\View\Iface View object with assigned parameters
286 286
 	 */
287
-	protected function addViewData( \Aimeos\MW\View\Iface $view )
287
+	protected function addViewData(\Aimeos\MW\View\Iface $view)
288 288
 	{
289 289
 		$context = $this->getContext();
290 290
 
291
-		$typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' );
292
-		$listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists/type' );
291
+		$typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type');
292
+		$listTypeManager = \Aimeos\MShop::create($this->getContext(), 'product/lists/type');
293 293
 
294
-		$search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff );
295
-		$search->setConditions( $search->compare( '==', 'media.type.domain', 'product' ) );
296
-		$search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) );
294
+		$search = $typeManager->createSearch()->setSlice(0, 0x7fffffff);
295
+		$search->setConditions($search->compare('==', 'media.type.domain', 'product'));
296
+		$search->setSortations(array($search->sort('+', 'media.type.label')));
297 297
 
298
-		$listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff );
299
-		$listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'media' ) );
300
-		$listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.label' ) ) );
298
+		$listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff);
299
+		$listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'media'));
300
+		$listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.label')));
301 301
 
302
-		$view->mediaListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) );
303
-		$view->mediaTypes = $typeManager->searchItems( $search );
302
+		$view->mediaListTypes = $this->sortType($listTypeManager->searchItems($listSearch));
303
+		$view->mediaTypes = $typeManager->searchItems($search);
304 304
 
305 305
 		return $view;
306 306
 	}
@@ -313,25 +313,25 @@  discard block
 block discarded – undo
313 313
 	 * @param array $listItems Media list items to be removed
314 314
 	 * @return \Aimeos\MShop\Product\Item\Iface Modified product item
315 315
 	 */
316
-	protected function deleteMediaItems( \Aimeos\MShop\Product\Item\Iface $item, array $listItems )
316
+	protected function deleteMediaItems(\Aimeos\MShop\Product\Item\Iface $item, array $listItems)
317 317
 	{
318 318
 		$context = $this->getContext();
319
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $context );
320
-		$manager = \Aimeos\MShop::create( $context, 'product' );
319
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($context);
320
+		$manager = \Aimeos\MShop::create($context, 'product');
321 321
 		$search = $manager->createSearch();
322 322
 
323
-		foreach( $listItems as $listItem )
323
+		foreach ($listItems as $listItem)
324 324
 		{
325
-			$func = $search->createFunction( 'product:has', ['media', $listItem->getType(), $listItem->getRefId()] );
326
-			$search->setConditions( $search->compare( '!=', $func, null ) );
327
-			$items = $manager->searchItems( $search );
325
+			$func = $search->createFunction('product:has', ['media', $listItem->getType(), $listItem->getRefId()]);
326
+			$search->setConditions($search->compare('!=', $func, null));
327
+			$items = $manager->searchItems($search);
328 328
 			$refItem = null;
329 329
 
330
-			if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) {
331
-				$cntl->delete( $refItem );
330
+			if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) {
331
+				$cntl->delete($refItem);
332 332
 			}
333 333
 
334
-			$item->deleteListItem( 'media', $listItem, $refItem );
334
+			$item->deleteListItem('media', $listItem, $refItem);
335 335
 		}
336 336
 
337 337
 		return $item;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		 * @since 2017.07
379 379
 		 * @category Developer
380 380
 		 */
381
-		return $this->getContext()->getConfig()->get( 'admin/jqadm/product/media/standard/subparts', [] );
381
+		return $this->getContext()->getConfig()->get('admin/jqadm/product/media/standard/subparts', []);
382 382
 	}
383 383
 
384 384
 
@@ -388,58 +388,58 @@  discard block
 block discarded – undo
388 388
 	 * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items
389 389
 	 * @param string[] $data Data array
390 390
 	 */
391
-	protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
391
+	protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data)
392 392
 	{
393 393
 		$context = $this->getContext();
394 394
 
395
-		$mediaManager = \Aimeos\MShop::create( $context, 'media' );
396
-		$listManager = \Aimeos\MShop::create( $context, 'product/lists' );
397
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $context );
395
+		$mediaManager = \Aimeos\MShop::create($context, 'media');
396
+		$listManager = \Aimeos\MShop::create($context, 'product/lists');
397
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($context);
398 398
 
399
-		$listItems = $item->getListItems( 'media', null, null, false );
399
+		$listItems = $item->getListItems('media', null, null, false);
400 400
 		$files = (array) $this->getView()->request()->getUploadedFiles();
401 401
 
402
-		foreach( $data as $idx => $entry )
402
+		foreach ($data as $idx => $entry)
403 403
 		{
404 404
 			$listType = $entry['product.lists.type'];
405 405
 
406
-			if( ( $listItem = $item->getListItem( 'media', $listType, $entry['media.id'], false ) ) === null ) {
406
+			if (($listItem = $item->getListItem('media', $listType, $entry['media.id'], false)) === null) {
407 407
 				$listItem = $listManager->createItem();
408 408
 			}
409 409
 
410
-			if( ( $refItem = $listItem->getRefItem() ) === null ) {
410
+			if (($refItem = $listItem->getRefItem()) === null) {
411 411
 				$refItem = $mediaManager->createItem();
412 412
 			}
413 413
 
414
-			$refItem->fromArray( $entry );
414
+			$refItem->fromArray($entry);
415 415
 
416
-			if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE )
416
+			if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE)
417 417
 			{
418
-				$refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media
419
-				$cntl->add( $refItem, $file );
418
+				$refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media
419
+				$cntl->add($refItem, $file);
420 420
 			}
421 421
 
422 422
 			$conf = [];
423 423
 
424
-			foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key )
424
+			foreach ((array) $this->getValue($entry, 'config/key') as $num => $key)
425 425
 			{
426
-				if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) {
427
-					$conf[$key] = trim( $val );
426
+				if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) {
427
+					$conf[$key] = trim($val);
428 428
 				}
429 429
 			}
430 430
 
431
-			$listItem->fromArray( $entry );
432
-			$listItem->setPosition( $idx );
433
-			$listItem->setConfig( $conf );
431
+			$listItem->fromArray($entry);
432
+			$listItem->setPosition($idx);
433
+			$listItem->setConfig($conf);
434 434
 
435
-			$attrListItems = $item->getListItems( 'attribute', 'variant', null, false );
436
-			$refItem = $this->addMediaAttributes( $refItem, $attrListItems );
437
-			$item->addListItem( 'media', $listItem, $refItem );
435
+			$attrListItems = $item->getListItems('attribute', 'variant', null, false);
436
+			$refItem = $this->addMediaAttributes($refItem, $attrListItems);
437
+			$item->addListItem('media', $listItem, $refItem);
438 438
 
439
-			unset( $listItems[$listItem->getId()] );
439
+			unset($listItems[$listItem->getId()]);
440 440
 		}
441 441
 
442
-		return $this->deleteMediaItems( $item, $listItems );
442
+		return $this->deleteMediaItems($item, $listItems);
443 443
 	}
444 444
 
445 445
 
@@ -450,20 +450,20 @@  discard block
 block discarded – undo
450 450
 	 * @param boolean $copy True if items should be copied, false if not
451 451
 	 * @return string[] Multi-dimensional associative list of item data
452 452
 	 */
453
-	protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false )
453
+	protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false)
454 454
 	{
455 455
 		$data = [];
456 456
 		$siteId = $this->getContext()->getLocale()->getSiteId();
457 457
 
458
-		foreach( $item->getListItems( 'media', null, null, false ) as $listItem )
458
+		foreach ($item->getListItems('media', null, null, false) as $listItem)
459 459
 		{
460
-			if( ( $refItem = $listItem->getRefItem() ) === null ) {
460
+			if (($refItem = $listItem->getRefItem()) === null) {
461 461
 				continue;
462 462
 			}
463 463
 
464
-			$list = $listItem->toArray( true ) + $refItem->toArray( true );
464
+			$list = $listItem->toArray(true) + $refItem->toArray(true);
465 465
 
466
-			if( $copy === true )
466
+			if ($copy === true)
467 467
 			{
468 468
 				$list['product.lists.siteid'] = $siteId;
469 469
 				$list['product.lists.id'] = '';
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
 				$list['media.id'] = null;
472 472
 			}
473 473
 
474
-			$list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] );
475
-			$list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] );
474
+			$list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']);
475
+			$list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']);
476 476
 
477
-			foreach( $list['product.lists.config'] as $key => $val )
477
+			foreach ($list['product.lists.config'] as $key => $val)
478 478
 			{
479 479
 				$list['config']['key'][] = $key;
480 480
 				$list['config']['val'][] = $val;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
494 494
 	 * @return string HTML output
495 495
 	 */
496
-	protected function render( \Aimeos\MW\View\Iface $view )
496
+	protected function render(\Aimeos\MW\View\Iface $view)
497 497
 	{
498 498
 		/** admin/jqadm/product/media/template-item
499 499
 		 * Relative path to the HTML body template of the media subpart for products.
@@ -517,6 +517,6 @@  discard block
 block discarded – undo
517 517
 		$tplconf = 'admin/jqadm/product/media/template-item';
518 518
 		$default = 'product/item-media-standard';
519 519
 
520
-		return $view->render( $view->config( $tplconf, $default ) );
520
+		return $view->render($view->config($tplconf, $default));
521 521
 	}
522 522
 }
523 523
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -145,14 +145,12 @@
 block discarded – undo
145 145
 			}
146 146
 
147 147
 			return;
148
-		}
149
-		catch( \Aimeos\MShop\Exception $e )
148
+		} catch( \Aimeos\MShop\Exception $e )
150 149
 		{
151 150
 			$error = array( 'product-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
152 151
 			$view->errors = $view->get( 'errors', [] ) + $error;
153 152
 			$this->logException( $e );
154
-		}
155
-		catch( \Exception $e )
153
+		} catch( \Exception $e )
156 154
 		{
157 155
 			$error = array( 'product-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
158 156
 			$view->errors = $view->get( 'errors', [] ) + $error;
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface Filter part 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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
32
+	public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
33 33
 	{
34 34
 		/** admin/jqadm/product/name
35 35
 		 * Class name of the used account favorite client implementation
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 		 * @since 2016.01
65 65
 		 * @category Developer
66 66
 		 */
67
-		if( $name === null ) {
68
-			$name = $context->getConfig()->get( 'admin/jqadm/product/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $context->getConfig()->get('admin/jqadm/product/name', 'Standard');
69 69
 		}
70 70
 
71
-		if( ctype_alnum( $name ) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
73
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>';
74
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Admin\\JQAdm\\Iface';
78 78
 		$classname = '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name;
79 79
 
80
-		$client = self::createAdmin( $context, $classname, $iface );
80
+		$client = self::createAdmin($context, $classname, $iface);
81 81
 
82
-		return self::addClientDecorators( $context, $client, 'product' );
82
+		return self::addClientDecorators($context, $client, 'product');
83 83
 	}
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Attribute/Media/Property/Standard.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Aimeos\Admin\JQAdm\Attribute\Media\Property;
12 12
 
13
-sprintf( 'property' ); // for translation
13
+sprintf('property'); // for translation
14 14
 
15 15
 
16 16
 /**
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function copy()
44 44
 	{
45
-		$view = $this->addViewData( $this->getView() );
45
+		$view = $this->addViewData($this->getView());
46 46
 
47
-		$view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ), true );
47
+		$view->mediaData = $this->toArray($view->item, $view->get('mediaData', []), true);
48 48
 		$view->propertyBody = '';
49 49
 
50
-		foreach( $this->getSubClients() as $client ) {
50
+		foreach ($this->getSubClients() as $client) {
51 51
 			$view->propertyBody .= $client->copy();
52 52
 		}
53 53
 
54
-		return $this->render( $view );
54
+		return $this->render($view);
55 55
 	}
56 56
 
57 57
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function create()
64 64
 	{
65
-		$view = $this->addViewData( $this->getView() );
65
+		$view = $this->addViewData($this->getView());
66 66
 		$siteid = $this->getContext()->getLocale()->getSiteId();
67
-		$data = $view->get( 'mediaData', [] );
67
+		$data = $view->get('mediaData', []);
68 68
 
69
-		foreach( $data as $index => $entry )
69
+		foreach ($data as $index => $entry)
70 70
 		{
71
-			foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) {
71
+			foreach ($view->value($entry, 'property', []) as $idx => $y) {
72 72
 				$data[$index]['property'][$idx]['attribute.lists.siteid'] = $siteid;
73 73
 			}
74 74
 		}
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		$view->propertyData = $data;
77 77
 		$view->propertyBody = '';
78 78
 
79
-		foreach( $this->getSubClients() as $client ) {
79
+		foreach ($this->getSubClients() as $client) {
80 80
 			$view->propertyBody .= $client->create();
81 81
 		}
82 82
 
83
-		return $this->render( $view );
83
+		return $this->render($view);
84 84
 	}
85 85
 
86 86
 
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get()
93 93
 	{
94
-		$view = $this->addViewData( $this->getView() );
94
+		$view = $this->addViewData($this->getView());
95 95
 
96
-		$view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ) );
96
+		$view->mediaData = $this->toArray($view->item, $view->get('mediaData', []));
97 97
 		$view->propertyBody = '';
98 98
 
99
-		foreach( $this->getSubClients() as $client ) {
99
+		foreach ($this->getSubClients() as $client) {
100 100
 			$view->propertyBody .= $client->get();
101 101
 		}
102 102
 
103
-		return $this->render( $view );
103
+		return $this->render($view);
104 104
 	}
105 105
 
106 106
 
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	{
112 112
 		$view = $this->getView();
113 113
 
114
-		$view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) );
114
+		$view->item = $this->fromArray($view->item, $view->param('media', []));
115 115
 		$view->propertyBody = '';
116 116
 
117
-		foreach( $this->getSubClients() as $client ) {
117
+		foreach ($this->getSubClients() as $client) {
118 118
 			$view->propertyBody .= $client->save();
119 119
 		}
120 120
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string|null $name Name of the sub-client (Default if null)
128 128
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
129 129
 	 */
130
-	public function getSubClient( $type, $name = null )
130
+	public function getSubClient($type, $name = null)
131 131
 	{
132 132
 		/** admin/jqadm/attribute/media/property/decorators/excludes
133 133
 		 * Excludes decorators added by the "common" option from the attribute JQAdm client
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		 * @see admin/jqadm/attribute/media/property/decorators/excludes
203 203
 		 * @see admin/jqadm/attribute/media/property/decorators/global
204 204
 		 */
205
-		return $this->createSubClient( 'attribute/media/property/' . $type, $name );
205
+		return $this->createSubClient('attribute/media/property/' . $type, $name);
206 206
 	}
207 207
 
208 208
 
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 	 * @param \Aimeos\MW\View\Iface $view View object
213 213
 	 * @return \Aimeos\MW\View\Iface View object with assigned parameters
214 214
 	 */
215
-	protected function addViewData( \Aimeos\MW\View\Iface $view )
215
+	protected function addViewData(\Aimeos\MW\View\Iface $view)
216 216
 	{
217
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'media/property/type' );
217
+		$manager = \Aimeos\MShop::create($this->getContext(), 'media/property/type');
218 218
 
219 219
 		$search = $manager->createSearch();
220
-		$search->setConditions( $search->compare( '==', 'media.property.type.domain', 'attribute' ) );
221
-		$search->setSlice( 0, 0x7fffffff );
220
+		$search->setConditions($search->compare('==', 'media.property.type.domain', 'attribute'));
221
+		$search->setSlice(0, 0x7fffffff);
222 222
 
223
-		$view->propertyTypes = $manager->searchItems( $search );
223
+		$view->propertyTypes = $manager->searchItems($search);
224 224
 
225 225
 		return $view;
226 226
 	}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		 * @since 2018.01
267 267
 		 * @category Developer
268 268
 		 */
269
-		return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/media/property/standard/subparts', [] );
269
+		return $this->getContext()->getConfig()->get('admin/jqadm/attribute/media/property/standard/subparts', []);
270 270
 	}
271 271
 
272 272
 
@@ -276,32 +276,32 @@  discard block
 block discarded – undo
276 276
 	 * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items
277 277
 	 * @param string[] $data Data array
278 278
 	 */
279
-	protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data )
279
+	protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data)
280 280
 	{
281
-		$propManager = \Aimeos\MShop::create( $this->getContext(), 'media/property' );
281
+		$propManager = \Aimeos\MShop::create($this->getContext(), 'media/property');
282 282
 		$index = 0;
283 283
 
284
-		foreach( $item->getRefItems( 'media', null, null, false ) as $refItem )
284
+		foreach ($item->getRefItems('media', null, null, false) as $refItem)
285 285
 		{
286
-			$propItems = $refItem->getPropertyItems( null, false );
286
+			$propItems = $refItem->getPropertyItems(null, false);
287 287
 
288
-			foreach( (array) $this->getValue( $data, $index . '/property', [] ) as $entry )
288
+			foreach ((array) $this->getValue($data, $index . '/property', []) as $entry)
289 289
 			{
290
-				if( isset( $propItems[$entry['media.property.id']] ) )
290
+				if (isset($propItems[$entry['media.property.id']]))
291 291
 				{
292 292
 					$propItem = $propItems[$entry['media.property.id']];
293
-					unset( $propItems[$entry['media.property.id']] );
293
+					unset($propItems[$entry['media.property.id']]);
294 294
 				}
295 295
 				else
296 296
 				{
297 297
 					$propItem = $propManager->createItem();
298 298
 				}
299 299
 
300
-				$propItem->fromArray( $entry );
301
-				$refItem->addPropertyItem( $propItem );
300
+				$propItem->fromArray($entry);
301
+				$refItem->addPropertyItem($propItem);
302 302
 			}
303 303
 
304
-			$refItem->deletePropertyItems( $propItems );
304
+			$refItem->deletePropertyItems($propItems);
305 305
 			$index++;
306 306
 		}
307 307
 
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 	 * @param boolean $copy True if items should be copied, false if not
318 318
 	 * @return string[] Multi-dimensional associative list of item data
319 319
 	 */
320
-	protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data, $copy = false )
320
+	protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data, $copy = false)
321 321
 	{
322 322
 		$idx = 0;
323 323
 		$siteId = $this->getContext()->getLocale()->getSiteId();
324 324
 
325
-		foreach( $item->getRefItems( 'media', null, null, false ) as $mediaItem )
325
+		foreach ($item->getRefItems('media', null, null, false) as $mediaItem)
326 326
 		{
327
-			foreach( $mediaItem->getPropertyItems( null, false )  as $propItem )
327
+			foreach ($mediaItem->getPropertyItems(null, false)  as $propItem)
328 328
 			{
329
-				$list = $propItem->toArray( true );
329
+				$list = $propItem->toArray(true);
330 330
 
331
-				if( $copy === true )
331
+				if ($copy === true)
332 332
 				{
333 333
 					$list['media.property.siteid'] = $siteId;
334 334
 					$list['media.property.id'] = '';
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
351 351
 	 * @return string HTML output
352 352
 	 */
353
-	protected function render( \Aimeos\MW\View\Iface $view )
353
+	protected function render(\Aimeos\MW\View\Iface $view)
354 354
 	{
355 355
 		/** admin/jqadm/attribute/media/property/template-item
356 356
 		 * Relative path to the HTML body template of the media subpart for attributes.
@@ -374,6 +374,6 @@  discard block
 block discarded – undo
374 374
 		$tplconf = 'admin/jqadm/attribute/media/property/template-item';
375 375
 		$default = 'attribute/item-media-property-standard';
376 376
 
377
-		return $view->render( $view->config( $tplconf, $default ) );
377
+		return $view->render($view->config($tplconf, $default));
378 378
 	}
379 379
 }
380 380
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -291,8 +291,7 @@
 block discarded – undo
291 291
 				{
292 292
 					$propItem = $propItems[$entry['media.property.id']];
293 293
 					unset( $propItems[$entry['media.property.id']] );
294
-				}
295
-				else
294
+				} else
296 295
 				{
297 296
 					$propItem = $propManager->createItem();
298 297
 				}
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Attribute/Media/Standard.php 2 patches
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 namespace Aimeos\Admin\JQAdm\Attribute\Media;
12 12
 
13
-sprintf( 'media' ); // for translation
13
+sprintf('media'); // for translation
14 14
 
15 15
 
16 16
 /**
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function copy()
44 44
 	{
45
-		$view = $this->addViewData( $this->getView() );
45
+		$view = $this->addViewData($this->getView());
46 46
 
47
-		$view->mediaData = $this->toArray( $view->item, true );
47
+		$view->mediaData = $this->toArray($view->item, true);
48 48
 		$view->mediaBody = '';
49 49
 
50
-		foreach( $this->getSubClients() as $client ) {
50
+		foreach ($this->getSubClients() as $client) {
51 51
 			$view->mediaBody .= $client->copy();
52 52
 		}
53 53
 
54
-		return $this->render( $view );
54
+		return $this->render($view);
55 55
 	}
56 56
 
57 57
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function create()
64 64
 	{
65
-		$view = $this->addViewData( $this->getView() );
65
+		$view = $this->addViewData($this->getView());
66 66
 		$siteid = $this->getContext()->getLocale()->getSiteId();
67 67
 
68
-		$itemData = $this->toArray( $view->item );
69
-		$data = array_replace_recursive( $itemData, $view->param( 'media', [] ) );
68
+		$itemData = $this->toArray($view->item);
69
+		$data = array_replace_recursive($itemData, $view->param('media', []));
70 70
 
71
-		foreach( $data as $idx => $entry )
71
+		foreach ($data as $idx => $entry)
72 72
 		{
73 73
 			$data[$idx]['media.siteid'] = $siteid;
74 74
 			$data[$idx]['media.url'] = $itemData[$idx]['media.url'];
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		$view->mediaData = $data;
80 80
 		$view->mediaBody = '';
81 81
 
82
-		foreach( $this->getSubClients() as $client ) {
82
+		foreach ($this->getSubClients() as $client) {
83 83
 			$view->mediaBody .= $client->create();
84 84
 		}
85 85
 
86
-		return $this->render( $view );
86
+		return $this->render($view);
87 87
 	}
88 88
 
89 89
 
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 		parent::delete();
96 96
 
97 97
 		$item = $this->getView()->item;
98
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() );
98
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext());
99 99
 
100
-		foreach( $item->getListItems( 'media', null, null, false ) as $listItem )
100
+		foreach ($item->getListItems('media', null, null, false) as $listItem)
101 101
 		{
102
-			if( ( $refItem = $listItem->getRefItem() ) !== null ) {
103
-				$cntl->delete( $refItem );
102
+			if (($refItem = $listItem->getRefItem()) !== null) {
103
+				$cntl->delete($refItem);
104 104
 			}
105 105
 
106
-			$item->deleteListItem( 'media', $listItem, $refItem );
106
+			$item->deleteListItem('media', $listItem, $refItem);
107 107
 		}
108 108
 	}
109 109
 
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function get()
117 117
 	{
118
-		$view = $this->addViewData( $this->getView() );
118
+		$view = $this->addViewData($this->getView());
119 119
 
120
-		$view->mediaData = $this->toArray( $view->item );
120
+		$view->mediaData = $this->toArray($view->item);
121 121
 		$view->mediaBody = '';
122 122
 
123
-		foreach( $this->getSubClients() as $client ) {
123
+		foreach ($this->getSubClients() as $client) {
124 124
 			$view->mediaBody .= $client->get();
125 125
 		}
126 126
 
127
-		return $this->render( $view );
127
+		return $this->render($view);
128 128
 	}
129 129
 
130 130
 
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
 
138 138
 		try
139 139
 		{
140
-			$view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) );
140
+			$view->item = $this->fromArray($view->item, $view->param('media', []));
141 141
 			$view->mediaBody = '';
142 142
 
143
-			foreach( $this->getSubClients() as $client ) {
143
+			foreach ($this->getSubClients() as $client) {
144 144
 				$view->mediaBody .= $client->save();
145 145
 			}
146 146
 
147 147
 			return;
148 148
 		}
149
-		catch( \Aimeos\MShop\Exception $e )
149
+		catch (\Aimeos\MShop\Exception $e)
150 150
 		{
151
-			$error = array( 'attribute-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
152
-			$view->errors = $view->get( 'errors', [] ) + $error;
153
-			$this->logException( $e );
151
+			$error = array('attribute-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
152
+			$view->errors = $view->get('errors', []) + $error;
153
+			$this->logException($e);
154 154
 		}
155
-		catch( \Exception $e )
155
+		catch (\Exception $e)
156 156
 		{
157
-			$error = array( 'attribute-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
158
-			$view->errors = $view->get( 'errors', [] ) + $error;
159
-			$this->logException( $e );
157
+			$error = array('attribute-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine());
158
+			$view->errors = $view->get('errors', []) + $error;
159
+			$this->logException($e);
160 160
 		}
161 161
 
162 162
 		throw new \Aimeos\Admin\JQAdm\Exception();
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param string|null $name Name of the sub-client (Default if null)
171 171
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
172 172
 	 */
173
-	public function getSubClient( $type, $name = null )
173
+	public function getSubClient($type, $name = null)
174 174
 	{
175 175
 		/** admin/jqadm/attribute/media/decorators/excludes
176 176
 		 * Excludes decorators added by the "common" option from the attribute JQAdm client
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 * @see admin/jqadm/attribute/media/decorators/excludes
246 246
 		 * @see admin/jqadm/attribute/media/decorators/global
247 247
 		 */
248
-		return $this->createSubClient( 'attribute/media/' . $type, $name );
248
+		return $this->createSubClient('attribute/media/' . $type, $name);
249 249
 	}
250 250
 
251 251
 
@@ -255,23 +255,23 @@  discard block
 block discarded – undo
255 255
 	 * @param \Aimeos\MW\View\Iface $view View object
256 256
 	 * @return \Aimeos\MW\View\Iface View object with assigned parameters
257 257
 	 */
258
-	protected function addViewData( \Aimeos\MW\View\Iface $view )
258
+	protected function addViewData(\Aimeos\MW\View\Iface $view)
259 259
 	{
260 260
 		$context = $this->getContext();
261 261
 
262
-		$typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' );
263
-		$listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'attribute/lists/type' );
262
+		$typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type');
263
+		$listTypeManager = \Aimeos\MShop::create($this->getContext(), 'attribute/lists/type');
264 264
 
265
-		$search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff );
266
-		$search->setConditions( $search->compare( '==', 'media.type.domain', 'attribute' ) );
267
-		$search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) );
265
+		$search = $typeManager->createSearch()->setSlice(0, 0x7fffffff);
266
+		$search->setConditions($search->compare('==', 'media.type.domain', 'attribute'));
267
+		$search->setSortations(array($search->sort('+', 'media.type.label')));
268 268
 
269
-		$listSearch = $listTypeManager->createSearch()->setSlice( 0, 0x7fffffff );
270
-		$listSearch->setConditions( $listSearch->compare( '==', 'attribute.lists.type.domain', 'media' ) );
271
-		$listSearch->setSortations( array( $listSearch->sort( '+', 'attribute.lists.type.label' ) ) );
269
+		$listSearch = $listTypeManager->createSearch()->setSlice(0, 0x7fffffff);
270
+		$listSearch->setConditions($listSearch->compare('==', 'attribute.lists.type.domain', 'media'));
271
+		$listSearch->setSortations(array($listSearch->sort('+', 'attribute.lists.type.label')));
272 272
 
273
-		$view->mediaListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) );
274
-		$view->mediaTypes = $typeManager->searchItems( $search );
273
+		$view->mediaListTypes = $this->sortType($listTypeManager->searchItems($listSearch));
274
+		$view->mediaTypes = $typeManager->searchItems($search);
275 275
 
276 276
 		return $view;
277 277
 	}
@@ -284,29 +284,29 @@  discard block
 block discarded – undo
284 284
 	 * @param array $listItems Media list items to be removed
285 285
 	 * @return \Aimeos\MShop\Attribute\Item\Iface Modified attribute item
286 286
 	 */
287
-	protected function deleteMediaItems( \Aimeos\MShop\Attribute\Item\Iface $item, array $listItems )
287
+	protected function deleteMediaItems(\Aimeos\MShop\Attribute\Item\Iface $item, array $listItems)
288 288
 	{
289 289
 		$context = $this->getContext();
290
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $context );
291
-		$manager = \Aimeos\MShop::create( $context, 'attribute' );
290
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($context);
291
+		$manager = \Aimeos\MShop::create($context, 'attribute');
292 292
 		$search = $manager->createSearch();
293 293
 
294
-		foreach( $listItems as $listItem )
294
+		foreach ($listItems as $listItem)
295 295
 		{
296 296
 			$expr = [
297
-				$search->compare( '==', 'attribute.lists.domain', 'media' ),
298
-				$search->compare( '==', 'attribute.lists.type', $listItem->getType() ),
299
-				$search->compare( '==', 'attribute.lists.refid', $listItem->getRefId() ),
297
+				$search->compare('==', 'attribute.lists.domain', 'media'),
298
+				$search->compare('==', 'attribute.lists.type', $listItem->getType()),
299
+				$search->compare('==', 'attribute.lists.refid', $listItem->getRefId()),
300 300
 			];
301
-			$search->setConditions( $search->combine( '&&', $expr ) );
302
-			$items = $manager->searchItems( $search );
301
+			$search->setConditions($search->combine('&&', $expr));
302
+			$items = $manager->searchItems($search);
303 303
 			$refItem = null;
304 304
 
305
-			if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) {
306
-				$cntl->delete( $refItem );
305
+			if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) {
306
+				$cntl->delete($refItem);
307 307
 			}
308 308
 
309
-			$item->deleteListItem( 'media', $listItem, $refItem );
309
+			$item->deleteListItem('media', $listItem, $refItem);
310 310
 		}
311 311
 
312 312
 		return $item;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		 * @since 2017.07
354 354
 		 * @category Developer
355 355
 		 */
356
-		return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/media/standard/subparts', [] );
356
+		return $this->getContext()->getConfig()->get('admin/jqadm/attribute/media/standard/subparts', []);
357 357
 	}
358 358
 
359 359
 
@@ -363,54 +363,54 @@  discard block
 block discarded – undo
363 363
 	 * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items
364 364
 	 * @param string[] $data Data array
365 365
 	 */
366
-	protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data )
366
+	protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data)
367 367
 	{
368 368
 		$context = $this->getContext();
369 369
 
370
-		$mediaManager = \Aimeos\MShop::create( $context, 'media' );
371
-		$listManager = \Aimeos\MShop::create( $context, 'attribute/lists' );
372
-		$cntl = \Aimeos\Controller\Common\Media\Factory::create( $context );
370
+		$mediaManager = \Aimeos\MShop::create($context, 'media');
371
+		$listManager = \Aimeos\MShop::create($context, 'attribute/lists');
372
+		$cntl = \Aimeos\Controller\Common\Media\Factory::create($context);
373 373
 
374
-		$listItems = $item->getListItems( 'media', null, null, false );
374
+		$listItems = $item->getListItems('media', null, null, false);
375 375
 		$files = (array) $this->getView()->request()->getUploadedFiles();
376 376
 
377
-		foreach( $data as $idx => $entry )
377
+		foreach ($data as $idx => $entry)
378 378
 		{
379
-			if( ( $listItem = $item->getListItem( 'media', $entry['attribute.lists.type'], $entry['media.id'], false ) ) === null ) {
379
+			if (($listItem = $item->getListItem('media', $entry['attribute.lists.type'], $entry['media.id'], false)) === null) {
380 380
 				$listItem = $listManager->createItem();
381 381
 			}
382 382
 
383
-			if( ( $refItem = $listItem->getRefItem() ) === null ) {
383
+			if (($refItem = $listItem->getRefItem()) === null) {
384 384
 				$refItem = $mediaManager->createItem();
385 385
 			}
386 386
 
387
-			$refItem->fromArray( $entry );
387
+			$refItem->fromArray($entry);
388 388
 
389
-			if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE )
389
+			if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE)
390 390
 			{
391
-				$refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media
392
-				$cntl->add( $refItem, $file );
391
+				$refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media
392
+				$cntl->add($refItem, $file);
393 393
 			}
394 394
 
395 395
 			$conf = [];
396 396
 
397
-			foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key )
397
+			foreach ((array) $this->getValue($entry, 'config/key') as $num => $key)
398 398
 			{
399
-				if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) {
400
-					$conf[$key] = trim( $val );
399
+				if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) {
400
+					$conf[$key] = trim($val);
401 401
 				}
402 402
 			}
403 403
 
404
-			$listItem->fromArray( $entry );
405
-			$listItem->setPosition( $idx );
406
-			$listItem->setConfig( $conf );
404
+			$listItem->fromArray($entry);
405
+			$listItem->setPosition($idx);
406
+			$listItem->setConfig($conf);
407 407
 
408
-			$item->addListItem( 'media', $listItem, $refItem );
408
+			$item->addListItem('media', $listItem, $refItem);
409 409
 
410
-			unset( $listItems[$listItem->getId()] );
410
+			unset($listItems[$listItem->getId()]);
411 411
 		}
412 412
 
413
-		return $this->deleteMediaItems( $item, $listItems );
413
+		return $this->deleteMediaItems($item, $listItems);
414 414
 	}
415 415
 
416 416
 
@@ -421,20 +421,20 @@  discard block
 block discarded – undo
421 421
 	 * @param boolean $copy True if items should be copied, false if not
422 422
 	 * @return string[] Multi-dimensional associative list of item data
423 423
 	 */
424
-	protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, $copy = false )
424
+	protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, $copy = false)
425 425
 	{
426 426
 		$data = [];
427 427
 		$siteId = $this->getContext()->getLocale()->getSiteId();
428 428
 
429
-		foreach( $item->getListItems( 'media', null, null, false ) as $listItem )
429
+		foreach ($item->getListItems('media', null, null, false) as $listItem)
430 430
 		{
431
-			if( ( $refItem = $listItem->getRefItem() ) === null ) {
431
+			if (($refItem = $listItem->getRefItem()) === null) {
432 432
 				continue;
433 433
 			}
434 434
 
435
-			$list = $listItem->toArray( true ) + $refItem->toArray( true );
435
+			$list = $listItem->toArray(true) + $refItem->toArray(true);
436 436
 
437
-			if( $copy === true )
437
+			if ($copy === true)
438 438
 			{
439 439
 				$list['attribute.lists.siteid'] = $siteId;
440 440
 				$list['attribute.lists.id'] = '';
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 				$list['media.id'] = null;
443 443
 			}
444 444
 
445
-			$list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] );
446
-			$list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] );
445
+			$list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']);
446
+			$list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']);
447 447
 
448
-			foreach( $list['attribute.lists.config'] as $key => $val )
448
+			foreach ($list['attribute.lists.config'] as $key => $val)
449 449
 			{
450 450
 				$list['config']['key'][] = $key;
451 451
 				$list['config']['val'][] = $val;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
465 465
 	 * @return string HTML output
466 466
 	 */
467
-	protected function render( \Aimeos\MW\View\Iface $view )
467
+	protected function render(\Aimeos\MW\View\Iface $view)
468 468
 	{
469 469
 		/** admin/jqadm/attribute/media/template-item
470 470
 		 * Relative path to the HTML body template of the media subpart for attributes.
@@ -488,6 +488,6 @@  discard block
 block discarded – undo
488 488
 		$tplconf = 'admin/jqadm/attribute/media/template-item';
489 489
 		$default = 'attribute/item-media-standard';
490 490
 
491
-		return $view->render( $view->config( $tplconf, $default ) );
491
+		return $view->render($view->config($tplconf, $default));
492 492
 	}
493 493
 }
494 494
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -145,14 +145,12 @@
 block discarded – undo
145 145
 			}
146 146
 
147 147
 			return;
148
-		}
149
-		catch( \Aimeos\MShop\Exception $e )
148
+		} catch( \Aimeos\MShop\Exception $e )
150 149
 		{
151 150
 			$error = array( 'attribute-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
152 151
 			$view->errors = $view->get( 'errors', [] ) + $error;
153 152
 			$this->logException( $e );
154
-		}
155
-		catch( \Exception $e )
153
+		} catch( \Exception $e )
156 154
 		{
157 155
 			$error = array( 'attribute-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
158 156
 			$view->errors = $view->get( 'errors', [] ) + $error;
Please login to merge, or discard this patch.