Completed
Push — master ( b98343...f157ac )
by Aimeos
03:37
created
admin/jqadm/tests/Admin/JQAdm/FactoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,42 +17,42 @@
 block discarded – undo
17 17
 	{
18 18
 		$this->templatePaths = \TestHelperJqadm::getTemplatePaths();
19 19
 		$this->context = \TestHelperJqadm::getContext();
20
-		$this->context->setView( \TestHelperJqadm::getView() );
20
+		$this->context->setView(\TestHelperJqadm::getView());
21 21
 	}
22 22
 
23 23
 
24 24
 	public function testCreateClient()
25 25
 	{
26
-		$client = \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'product' );
27
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
26
+		$client = \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'product');
27
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client);
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testCreateClientName()
32 32
 	{
33
-		$client = \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'product', 'Standard' );
34
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client );
33
+		$client = \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'product', 'Standard');
34
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testCreateClientNameEmpty()
39 39
 	{
40
-		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
41
-		\Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, '' );
40
+		$this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception');
41
+		\Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, '');
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testCreateClientNameInvalid()
46 46
 	{
47
-		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
48
-		\Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, '%product' );
47
+		$this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception');
48
+		\Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, '%product');
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testCreateClientNameNotFound()
53 53
 	{
54
-		$this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' );
55
-		\Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'prod' );
54
+		$this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception');
55
+		\Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'prod');
56 56
 	}
57 57
 
58 58
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Product/Category/Decorator/CacheTest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,45 +19,45 @@
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		$this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' )
23
-			->setMethods( array( 'deleteByTags' ) )
22
+		$this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None')
23
+			->setMethods(array('deleteByTags'))
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Category\Standard' )
28
-			->setMethods( array( 'save' ) )
27
+		$this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Category\Standard')
28
+			->setMethods(array('save'))
29 29
 			->disableOriginalConstructor()
30 30
 			->getMock();
31 31
 
32 32
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
33 33
 		$this->context = \TestHelperJqadm::getContext();
34
-		$this->context->setCache( $this->cache );
34
+		$this->context->setCache($this->cache);
35 35
 
36
-		$this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache( $this->mock, $this->context, $templatePaths );
36
+		$this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache($this->mock, $this->context, $templatePaths);
37 37
 	}
38 38
 
39 39
 
40 40
 	protected function tearDown()
41 41
 	{
42
-		unset( $this->object, $this->mock, $this->context, $this->cache );
42
+		unset($this->object, $this->mock, $this->context, $this->cache);
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testSave()
47 47
 	{
48 48
 		$view = \TestHelperJqadm::getView();
49
-		$tags = array( 'catalog', 'catalog-1', 'catalog-2' );
49
+		$tags = array('catalog', 'catalog-1', 'catalog-2');
50 50
 
51
-		$param = array( 'category' => array( 'catalog.id' => array( '1', '2' ) ) );
52
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
53
-		$view->addHelper( 'param', $helper );
51
+		$param = array('category' => array('catalog.id' => array('1', '2')));
52
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
53
+		$view->addHelper('param', $helper);
54 54
 
55
-		$this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) );
56
-		$this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) );
55
+		$this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags));
56
+		$this->mock->expects($this->once())->method('save')->will($this->returnValue('test'));
57 57
 
58
-		$this->object->setView( $view );
58
+		$this->object->setView($view);
59 59
 		$result = $this->object->save();
60 60
 
61
-		$this->assertEquals( 'test', $result );
61
+		$this->assertEquals('test', $result);
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Common/Decorator/CacheTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,44 +19,44 @@
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		$this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' )
23
-			->setMethods( array( 'deleteByTags' ) )
22
+		$this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None')
23
+			->setMethods(array('deleteByTags'))
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' )
28
-			->setMethods( array( 'save' ) )
27
+		$this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard')
28
+			->setMethods(array('save'))
29 29
 			->disableOriginalConstructor()
30 30
 			->getMock();
31 31
 
32 32
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
33 33
 		$this->context = \TestHelperJqadm::getContext();
34
-		$this->context->setCache( $this->cache );
34
+		$this->context->setCache($this->cache);
35 35
 
36
-		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache( $this->mock, $this->context, $templatePaths );
36
+		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache($this->mock, $this->context, $templatePaths);
37 37
 	}
38 38
 
39 39
 
40 40
 	protected function tearDown()
41 41
 	{
42
-		unset( $this->object, $this->mock, $this->context, $this->cache );
42
+		unset($this->object, $this->mock, $this->context, $this->cache);
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testSave()
47 47
 	{
48
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
48
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
49 49
 
50
-		$tags = array( 'product', 'product-' . $item->getId() );
50
+		$tags = array('product', 'product-' . $item->getId());
51 51
 		$view = \TestHelperJqadm::getView();
52 52
 		$view->item = $item;
53 53
 
54
-		$this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) );
55
-		$this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) );
54
+		$this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags));
55
+		$this->mock->expects($this->once())->method('save')->will($this->returnValue('test'));
56 56
 
57
-		$this->object->setView( $view );
57
+		$this->object->setView($view);
58 58
 		$result = $this->object->save();
59 59
 
60
-		$this->assertEquals( 'test', $result );
60
+		$this->assertEquals('test', $result);
61 61
 	}
62 62
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Common/Decorator/PageTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 		$this->context = \TestHelperJqadm::getContext();
21 21
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
22 22
 
23
-		$client = new \Aimeos\Admin\JQAdm\Product\Standard( $this->context, $templatePaths );
24
-		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $client, $this->context, $templatePaths );
23
+		$client = new \Aimeos\Admin\JQAdm\Product\Standard($this->context, $templatePaths);
24
+		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($client, $this->context, $templatePaths);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object, $this->context );
30
+		unset($this->object, $this->context);
31 31
 	}
32 32
 
33 33
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		$view = \TestHelperJqadm::getView();
37 37
 
38
-		$this->object->setView( $view );
38
+		$this->object->setView($view);
39 39
 
40
-		$this->assertInternalType( 'array', $view->pageSites );
41
-		$this->assertInternalType( 'array', $view->pageLanguages );
40
+		$this->assertInternalType('array', $view->pageSites);
41
+		$this->assertInternalType('array', $view->pageLanguages);
42 42
 	}
43 43
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Common/Decorator/IndexTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,31 +21,31 @@
 block discarded – undo
21 21
 		$this->context = \TestHelperJqadm::getContext();
22 22
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
23 23
 
24
-		$this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' )
25
-			->setMethods( array( 'save' ) )
24
+		$this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard')
25
+			->setMethods(array('save'))
26 26
 			->disableOriginalConstructor()
27 27
 			->getMock();
28 28
 
29
-		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index( $this->mock, $this->context, $templatePaths );
29
+		$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index($this->mock, $this->context, $templatePaths);
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->object, $this->mock, $this->context );
35
+		unset($this->object, $this->mock, $this->context);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testSave()
40 40
 	{
41 41
 		$view = \TestHelperJqadm::getView();
42
-		$view->item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
42
+		$view->item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
43 43
 
44
-		$this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) );
45
-		$this->object->setView( $view );
44
+		$this->mock->expects($this->once())->method('save')->will($this->returnValue('test'));
45
+		$this->object->setView($view);
46 46
 
47 47
 		$result = $this->object->save();
48 48
 
49
-		$this->assertEquals( 'test', $result );
49
+		$this->assertEquals('test', $result);
50 50
 	}
51 51
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/bootstrap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
  * Set error reporting to maximum
12 12
  */
13 13
 error_reporting( -1 );
14
-ini_set( 'display_errors', '1' );
14
+ini_set('display_errors', '1');
15 15
 
16
-date_default_timezone_set( 'UTC' );
16
+date_default_timezone_set('UTC');
17 17
 
18 18
 /*
19 19
  * Set locale settings to reasonable defaults
20 20
  */
21
-setlocale( LC_ALL, 'en_US.UTF-8' );
22
-setlocale( LC_NUMERIC, 'POSIX' );
23
-setlocale( LC_CTYPE, 'en_US.UTF-8' );
24
-setlocale( LC_TIME, 'POSIX' );
21
+setlocale(LC_ALL, 'en_US.UTF-8');
22
+setlocale(LC_NUMERIC, 'POSIX');
23
+setlocale(LC_CTYPE, 'en_US.UTF-8');
24
+setlocale(LC_TIME, 'POSIX');
25 25
 
26 26
 
27 27
 require_once 'TestHelperJqadm.php';
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Characteristic/Attribute/Standard.php 2 patches
Spacing   +53 added lines, -53 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->attributeBody = '';
72 72
 
73
-		foreach( $this->getSubClients() as $client ) {
73
+		foreach ($this->getSubClients() as $client) {
74 74
 			$view->attributeBody .= $client->copy();
75 75
 		}
76 76
 
77 77
 		$tplconf = 'admin/jqadm/product/characteristic/attribute/template-item';
78 78
 		$default = 'product/item-characteristic-attribute-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->attributeBody = '';
95 95
 
96
-		foreach( $this->getSubClients() as $client ) {
96
+		foreach ($this->getSubClients() as $client) {
97 97
 			$view->attributeBody .= $client->create();
98 98
 		}
99 99
 
100 100
 		$tplconf = 'admin/jqadm/product/characteristic/attribute/template-item';
101 101
 		$default = 'product/item-characteristic-attribute-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
 
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 	{
114 114
 		$view = $this->getView();
115 115
 
116
-		$this->setData( $view );
116
+		$this->setData($view);
117 117
 		$view->attributeBody = '';
118 118
 
119
-		foreach( $this->getSubClients() as $client ) {
119
+		foreach ($this->getSubClients() as $client) {
120 120
 			$view->attributeBody .= $client->get();
121 121
 		}
122 122
 
123 123
 		$tplconf = 'admin/jqadm/product/characteristic/attribute/template-item';
124 124
 		$default = 'product/item-characteristic-attribute-default.php';
125 125
 
126
-		return $view->render( $view->config( $tplconf, $default ) );
126
+		return $view->render($view->config($tplconf, $default));
127 127
 	}
128 128
 
129 129
 
@@ -137,32 +137,32 @@  discard block
 block discarded – undo
137 137
 		$view = $this->getView();
138 138
 		$context = $this->getContext();
139 139
 
140
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
140
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
141 141
 		$manager->begin();
142 142
 
143 143
 		try
144 144
 		{
145
-			$this->updateItems( $view );
145
+			$this->updateItems($view);
146 146
 			$view->attributeBody = '';
147 147
 
148
-			foreach( $this->getSubClients() as $client ) {
148
+			foreach ($this->getSubClients() as $client) {
149 149
 				$view->attributeBody .= $client->save();
150 150
 			}
151 151
 
152 152
 			$manager->commit();
153 153
 			return;
154 154
 		}
155
-		catch( \Aimeos\MShop\Exception $e )
155
+		catch (\Aimeos\MShop\Exception $e)
156 156
 		{
157
-			$error = array( 'product-item-characteristic-attribute' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
158
-			$view->errors = $view->get( 'errors', array() ) + $error;
157
+			$error = array('product-item-characteristic-attribute' => $context->getI18n()->dt('mshop', $e->getMessage()));
158
+			$view->errors = $view->get('errors', array()) + $error;
159 159
 			$manager->rollback();
160 160
 		}
161
-		catch( \Exception $e )
161
+		catch (\Exception $e)
162 162
 		{
163
-			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
164
-			$error = array( 'product-item-characteristic-attribute' => $e->getMessage() );
165
-			$view->errors = $view->get( 'errors', array() ) + $error;
163
+			$context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString());
164
+			$error = array('product-item-characteristic-attribute' => $e->getMessage());
165
+			$view->errors = $view->get('errors', array()) + $error;
166 166
 			$manager->rollback();
167 167
 		}
168 168
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param string|null $name Name of the sub-client (Default if null)
178 178
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
179 179
 	 */
180
-	public function getSubClient( $type, $name = null )
180
+	public function getSubClient($type, $name = null)
181 181
 	{
182 182
 		/** admin/jqadm/product/characteristic/attribute/decorators/excludes
183 183
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		 * @see admin/jqadm/product/characteristic/attribute/decorators/excludes
253 253
 		 * @see admin/jqadm/product/characteristic/attribute/decorators/global
254 254
 		 */
255
-		return $this->createSubClient( 'product/characteristic/attribute/' . $type, $name );
255
+		return $this->createSubClient('product/characteristic/attribute/' . $type, $name);
256 256
 	}
257 257
 
258 258
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	protected function getSubClientNames()
265 265
 	{
266
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
266
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
267 267
 	}
268 268
 
269 269
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	 * @param string $prodid Unique product ID
274 274
 	 * @return array Associative list of attribute product IDs as keys and list items as values
275 275
 	 */
276
-	protected function getListItems( $prodid )
276
+	protected function getListItems($prodid)
277 277
 	{
278
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
278
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
279 279
 
280 280
 		$search = $manager->createSearch();
281 281
 		$expr = array(
282
-			$search->compare( '==', 'product.lists.parentid', $prodid ),
283
-			$search->compare( '==', 'product.lists.domain', 'attribute' ),
284
-			$search->compare( '==', 'product.lists.type.domain', 'attribute' ),
285
-			$search->compare( '==', 'product.lists.type.code', 'default' ),
282
+			$search->compare('==', 'product.lists.parentid', $prodid),
283
+			$search->compare('==', 'product.lists.domain', 'attribute'),
284
+			$search->compare('==', 'product.lists.type.domain', 'attribute'),
285
+			$search->compare('==', 'product.lists.type.code', 'default'),
286 286
 		);
287
-		$search->setConditions( $search->combine( '&&', $expr ) );
287
+		$search->setConditions($search->combine('&&', $expr));
288 288
 
289
-		return $manager->searchItems( $search );
289
+		return $manager->searchItems($search);
290 290
 	}
291 291
 
292 292
 
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
297 297
 	 */
298
-	protected function setData( \Aimeos\MW\View\Iface $view )
298
+	protected function setData(\Aimeos\MW\View\Iface $view)
299 299
 	{
300
-		$data = (array) $view->param( 'characteristic/attribute', array() );
300
+		$data = (array) $view->param('characteristic/attribute', array());
301 301
 
302
-		if( empty( $data ) )
302
+		if (empty($data))
303 303
 		{
304
-			foreach( $view->item->getListItems( 'attribute', 'default' ) as $listItem )
304
+			foreach ($view->item->getListItems('attribute', 'default') as $listItem)
305 305
 			{
306 306
 				$refItem = $listItem->getRefItem();
307
-				$data['attribute.label'][] = ( $refItem ? $refItem->getLabel() : '' );
307
+				$data['attribute.label'][] = ($refItem ? $refItem->getLabel() : '');
308 308
 
309
-				foreach( $listItem->toArray() as $key => $value ) {
309
+				foreach ($listItem->toArray() as $key => $value) {
310 310
 					$data[$key][] = $value;
311 311
 				}
312 312
 			}
@@ -321,39 +321,39 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
323 323
 	 */
324
-	protected function updateItems( \Aimeos\MW\View\Iface $view )
324
+	protected function updateItems(\Aimeos\MW\View\Iface $view)
325 325
 	{
326 326
 		$context = $this->getContext();
327
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
328
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
327
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
328
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
329 329
 
330 330
 		$id = $view->item->getId();
331
-		$map = $this->getListItems( $id );
332
-		$listIds = (array) $view->param( 'characteristic/attribute/product.lists.id', array() );
331
+		$map = $this->getListItems($id);
332
+		$listIds = (array) $view->param('characteristic/attribute/product.lists.id', array());
333 333
 
334 334
 
335
-		foreach( $listIds as $pos => $listid )
335
+		foreach ($listIds as $pos => $listid)
336 336
 		{
337
-			if( isset( $map[$listid] ) ) {
338
-				unset( $map[$listid], $listIds[$pos] );
337
+			if (isset($map[$listid])) {
338
+				unset($map[$listid], $listIds[$pos]);
339 339
 			}
340 340
 		}
341 341
 
342
-		$manager->deleteItems( array_keys( $map ) );
342
+		$manager->deleteItems(array_keys($map));
343 343
 
344 344
 
345 345
 		$item = $manager->createItem();
346
-		$item->setTypeId( $typeManager->findItem( 'default', array(), 'attribute' )->getId() );
347
-		$item->setDomain( 'attribute' );
348
-		$item->setParentId( $id );
346
+		$item->setTypeId($typeManager->findItem('default', array(), 'attribute')->getId());
347
+		$item->setDomain('attribute');
348
+		$item->setParentId($id);
349 349
 
350
-		foreach( $listIds as $pos => $listid )
350
+		foreach ($listIds as $pos => $listid)
351 351
 		{
352
-			$item->setId( null );
353
-			$item->setRefId( $view->param( 'characteristic/attribute/product.lists.refid/' . $pos ) );
354
-			$item->setPosition( $pos );
352
+			$item->setId(null);
353
+			$item->setRefId($view->param('characteristic/attribute/product.lists.refid/' . $pos));
354
+			$item->setPosition($pos);
355 355
 
356
-			$manager->saveItem( $item, false );
356
+			$manager->saveItem($item, false);
357 357
 		}
358 358
 	}
359 359
 }
360 360
\ 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
@@ -151,14 +151,12 @@
 block discarded – undo
151 151
 
152 152
 			$manager->commit();
153 153
 			return;
154
-		}
155
-		catch( \Aimeos\MShop\Exception $e )
154
+		} catch( \Aimeos\MShop\Exception $e )
156 155
 		{
157 156
 			$error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
158 157
 			$view->errors = $view->get( 'errors', array() ) + $error;
159 158
 			$manager->rollback();
160
-		}
161
-		catch( \Exception $e )
159
+		} catch( \Exception $e )
162 160
 		{
163 161
 			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
164 162
 			$error = array( 'product-item-category' => $e->getMessage() );
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Characteristic/Property/Standard.php 2 patches
Spacing   +55 added lines, -55 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->propertyBody = '';
72 72
 
73
-		foreach( $this->getSubClients() as $client ) {
73
+		foreach ($this->getSubClients() as $client) {
74 74
 			$view->propertyBody .= $client->copy();
75 75
 		}
76 76
 
77 77
 		$tplconf = 'admin/jqadm/product/characteristic/property/template-item';
78 78
 		$default = 'product/item-characteristic-property-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->propertyBody = '';
95 95
 
96
-		foreach( $this->getSubClients() as $client ) {
96
+		foreach ($this->getSubClients() as $client) {
97 97
 			$view->propertyBody .= $client->create();
98 98
 		}
99 99
 
100 100
 		$tplconf = 'admin/jqadm/product/characteristic/property/template-item';
101 101
 		$default = 'product/item-characteristic-property-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
 
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 	{
114 114
 		$view = $this->getView();
115 115
 
116
-		$this->setData( $view );
116
+		$this->setData($view);
117 117
 		$view->propertyBody = '';
118 118
 
119
-		foreach( $this->getSubClients() as $client ) {
119
+		foreach ($this->getSubClients() as $client) {
120 120
 			$view->propertyBody .= $client->get();
121 121
 		}
122 122
 
123 123
 		$tplconf = 'admin/jqadm/product/characteristic/property/template-item';
124 124
 		$default = 'product/item-characteristic-property-default.php';
125 125
 
126
-		return $view->render( $view->config( $tplconf, $default ) );
126
+		return $view->render($view->config($tplconf, $default));
127 127
 	}
128 128
 
129 129
 
@@ -137,32 +137,32 @@  discard block
 block discarded – undo
137 137
 		$view = $this->getView();
138 138
 		$context = $this->getContext();
139 139
 
140
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
140
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
141 141
 		$manager->begin();
142 142
 
143 143
 		try
144 144
 		{
145
-			$this->updateItems( $view );
145
+			$this->updateItems($view);
146 146
 			$view->propertyBody = '';
147 147
 
148
-			foreach( $this->getSubClients() as $client ) {
148
+			foreach ($this->getSubClients() as $client) {
149 149
 				$view->propertyBody .= $client->save();
150 150
 			}
151 151
 
152 152
 			$manager->commit();
153 153
 			return;
154 154
 		}
155
-		catch( \Aimeos\MShop\Exception $e )
155
+		catch (\Aimeos\MShop\Exception $e)
156 156
 		{
157
-			$error = array( 'product-item-characteristic-property' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
158
-			$view->errors = $view->get( 'errors', array() ) + $error;
157
+			$error = array('product-item-characteristic-property' => $context->getI18n()->dt('mshop', $e->getMessage()));
158
+			$view->errors = $view->get('errors', array()) + $error;
159 159
 			$manager->rollback();
160 160
 		}
161
-		catch( \Exception $e )
161
+		catch (\Exception $e)
162 162
 		{
163
-			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
164
-			$error = array( 'product-item-characteristic-property' => $e->getMessage() );
165
-			$view->errors = $view->get( 'errors', array() ) + $error;
163
+			$context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString());
164
+			$error = array('product-item-characteristic-property' => $e->getMessage());
165
+			$view->errors = $view->get('errors', array()) + $error;
166 166
 			$manager->rollback();
167 167
 		}
168 168
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param string|null $name Name of the sub-client (Default if null)
178 178
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
179 179
 	 */
180
-	public function getSubClient( $type, $name = null )
180
+	public function getSubClient($type, $name = null)
181 181
 	{
182 182
 		/** admin/jqadm/product/characteristic/property/decorators/excludes
183 183
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		 * @see admin/jqadm/product/characteristic/property/decorators/excludes
253 253
 		 * @see admin/jqadm/product/characteristic/property/decorators/global
254 254
 		 */
255
-		return $this->createSubClient( 'product/characteristic/property/' . $type, $name );
255
+		return $this->createSubClient('product/characteristic/property/' . $type, $name);
256 256
 	}
257 257
 
258 258
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	protected function getSubClientNames()
265 265
 	{
266
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
266
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
267 267
 	}
268 268
 
269 269
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	 * @param string $prodid Unique product ID
274 274
 	 * @return array Associative list of property IDs as keys and property items as values
275 275
 	 */
276
-	protected function getProperties( $prodid )
276
+	protected function getProperties($prodid)
277 277
 	{
278
-		$excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' );
279
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' );
278
+		$excludes = array('package-length', 'package-height', 'package-width', 'package-weight');
279
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property');
280 280
 
281 281
 		$search = $manager->createSearch();
282 282
 		$expr = array(
283
-			$search->compare( '==', 'product.property.parentid', $prodid ),
284
-			$search->compare( '!=', 'product.property.type.code', $excludes ),
283
+			$search->compare('==', 'product.property.parentid', $prodid),
284
+			$search->compare('!=', 'product.property.type.code', $excludes),
285 285
 		);
286
-		$search->setConditions( $search->combine( '&&', $expr ) );
287
-		$search->setSlice( 0, 0x7fffffff );
286
+		$search->setConditions($search->combine('&&', $expr));
287
+		$search->setSlice(0, 0x7fffffff);
288 288
 
289
-		return $manager->searchItems( $search );
289
+		return $manager->searchItems($search);
290 290
 	}
291 291
 
292 292
 
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	protected function getPropertyTypes()
299 299
 	{
300
-		$excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' );
301
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property/type' );
300
+		$excludes = array('package-length', 'package-height', 'package-width', 'package-weight');
301
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property/type');
302 302
 
303 303
 		$search = $manager->createSearch();
304
-		$search->setConditions( $search->compare( '!=', 'product.property.type.code', $excludes ) );
305
-		$search->setSlice( 0, 0x7fffffff );
304
+		$search->setConditions($search->compare('!=', 'product.property.type.code', $excludes));
305
+		$search->setSlice(0, 0x7fffffff);
306 306
 
307
-		return $manager->searchItems( $search );
307
+		return $manager->searchItems($search);
308 308
 	}
309 309
 
310 310
 
@@ -313,15 +313,15 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
315 315
 	 */
316
-	protected function setData( \Aimeos\MW\View\Iface $view )
316
+	protected function setData(\Aimeos\MW\View\Iface $view)
317 317
 	{
318
-		$data = (array) $view->param( 'characteristic/property', array() );
318
+		$data = (array) $view->param('characteristic/property', array());
319 319
 
320
-		if( empty( $data ) )
320
+		if (empty($data))
321 321
 		{
322
-			foreach( $this->getProperties( $view->item->getId() ) as $item )
322
+			foreach ($this->getProperties($view->item->getId()) as $item)
323 323
 			{
324
-				foreach( $item->toArray() as $key => $value ) {
324
+				foreach ($item->toArray() as $key => $value) {
325 325
 					$data[$key][] = $value;
326 326
 				}
327 327
 			}
@@ -337,38 +337,38 @@  discard block
 block discarded – undo
337 337
 	 *
338 338
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
339 339
 	 */
340
-	protected function updateItems( \Aimeos\MW\View\Iface $view )
340
+	protected function updateItems(\Aimeos\MW\View\Iface $view)
341 341
 	{
342
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' );
342
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property');
343 343
 
344 344
 		$id = $view->item->getId();
345
-		$map = $this->getProperties( $id );
346
-		$ids = (array) $view->param( 'characteristic/property/product.property.id', array() );
345
+		$map = $this->getProperties($id);
346
+		$ids = (array) $view->param('characteristic/property/product.property.id', array());
347 347
 
348 348
 		$item = $manager->createItem();
349 349
 
350
-		foreach( $ids as $pos => $propertyId )
350
+		foreach ($ids as $pos => $propertyId)
351 351
 		{
352
-			if( isset( $map[$propertyId] ) )
352
+			if (isset($map[$propertyId]))
353 353
 			{
354 354
 				$item = $map[$propertyId];
355
-				unset( $map[$propertyId] );
355
+				unset($map[$propertyId]);
356 356
 			}
357 357
 			else
358 358
 			{
359
-				$item->setId( null );
360
-				$item->setParentId( $id );
359
+				$item->setId(null);
360
+				$item->setParentId($id);
361 361
 			}
362 362
 
363
-			$lang = $view->param( 'characteristic/property/product.property.languageid/' . $pos, null );
363
+			$lang = $view->param('characteristic/property/product.property.languageid/' . $pos, null);
364 364
 
365
-			$item->setLanguageId( ( $lang ? $lang : null ) );
366
-			$item->setTypeId( $view->param( 'characteristic/property/product.property.typeid/' . $pos, null ) );
367
-			$item->setValue( $view->param( 'characteristic/property/product.property.value/' . $pos, '' ) );
365
+			$item->setLanguageId(($lang ? $lang : null));
366
+			$item->setTypeId($view->param('characteristic/property/product.property.typeid/' . $pos, null));
367
+			$item->setValue($view->param('characteristic/property/product.property.value/' . $pos, ''));
368 368
 
369
-			$manager->saveItem( $item, false );
369
+			$manager->saveItem($item, false);
370 370
 		}
371 371
 
372
-		$manager->deleteItems( array_keys( $map ) );
372
+		$manager->deleteItems(array_keys($map));
373 373
 	}
374 374
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -155,16 +155,14 @@  discard block
 block discarded – undo
155 155
 			$textManager->commit();
156 156
 			$manager->commit();
157 157
 			return;
158
-		}
159
-		catch( \Aimeos\MShop\Exception $e )
158
+		} catch( \Aimeos\MShop\Exception $e )
160 159
 		{
161 160
 			$error = array( 'product-item-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
162 161
 			$view->errors = $view->get( 'errors', array() ) + $error;
163 162
 
164 163
 			$textManager->rollback();
165 164
 			$manager->rollback();
166
-		}
167
-		catch( \Exception $e )
165
+		} catch( \Exception $e )
168 166
 		{
169 167
 			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
170 168
 			$error = array( 'product-item-price' => $e->getMessage() );
@@ -365,8 +363,7 @@  discard block
 block discarded – undo
365 363
 
366 364
 				$item = $priceItem;
367 365
 				$item->setId( null );
368
-			}
369
-			else
366
+			} else
370 367
 			{
371 368
 				$litem = $listItems[$listid];
372 369
 				$item = $litem->getRefItem();
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Characteristic/Standard.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @category Developer
56 56
 	 */
57 57
 	private $subPartPath = 'admin/jqadm/product/characteristic/standard/subparts';
58
-	private $subPartNames = array( 'attribute', 'property' );
58
+	private $subPartNames = array('attribute', 'property');
59 59
 
60 60
 
61 61
 	/**
@@ -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->characteristicBody = '';
72 72
 
73
-		foreach( $this->getSubClients() as $client ) {
73
+		foreach ($this->getSubClients() as $client) {
74 74
 			$view->characteristicBody .= $client->copy();
75 75
 		}
76 76
 
77 77
 		$tplconf = 'admin/jqadm/product/characteristic/template-item';
78 78
 		$default = 'product/item-characteristic-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->characteristicBody = '';
95 95
 
96
-		foreach( $this->getSubClients() as $client ) {
96
+		foreach ($this->getSubClients() as $client) {
97 97
 			$view->characteristicBody .= $client->create();
98 98
 		}
99 99
 
100 100
 		$tplconf = 'admin/jqadm/product/characteristic/template-item';
101 101
 		$default = 'product/item-characteristic-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
 
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 	{
114 114
 		$view = $this->getView();
115 115
 
116
-		$this->setData( $view );
116
+		$this->setData($view);
117 117
 		$view->characteristicBody = '';
118 118
 
119
-		foreach( $this->getSubClients() as $client ) {
119
+		foreach ($this->getSubClients() as $client) {
120 120
 			$view->characteristicBody .= $client->get();
121 121
 		}
122 122
 
123 123
 		$tplconf = 'admin/jqadm/product/characteristic/template-item';
124 124
 		$default = 'product/item-characteristic-default.php';
125 125
 
126
-		return $view->render( $view->config( $tplconf, $default ) );
126
+		return $view->render($view->config($tplconf, $default));
127 127
 	}
128 128
 
129 129
 
@@ -137,31 +137,31 @@  discard block
 block discarded – undo
137 137
 		$view = $this->getView();
138 138
 		$context = $this->getContext();
139 139
 
140
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
140
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
141 141
 		$manager->begin();
142 142
 
143 143
 		try
144 144
 		{
145 145
 			$view->characteristicBody = '';
146 146
 
147
-			foreach( $this->getSubClients() as $client ) {
147
+			foreach ($this->getSubClients() as $client) {
148 148
 				$view->characteristicBody .= $client->save();
149 149
 			}
150 150
 
151 151
 			$manager->commit();
152 152
 			return;
153 153
 		}
154
-		catch( \Aimeos\MShop\Exception $e )
154
+		catch (\Aimeos\MShop\Exception $e)
155 155
 		{
156
-			$error = array( 'product-item-characteristic' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
157
-			$view->errors = $view->get( 'errors', array() ) + $error;
156
+			$error = array('product-item-characteristic' => $context->getI18n()->dt('mshop', $e->getMessage()));
157
+			$view->errors = $view->get('errors', array()) + $error;
158 158
 			$manager->rollback();
159 159
 		}
160
-		catch( \Exception $e )
160
+		catch (\Exception $e)
161 161
 		{
162
-			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
163
-			$error = array( 'product-item-characteristic' => $e->getMessage() );
164
-			$view->errors = $view->get( 'errors', array() ) + $error;
162
+			$context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString());
163
+			$error = array('product-item-characteristic' => $e->getMessage());
164
+			$view->errors = $view->get('errors', array()) + $error;
165 165
 			$manager->rollback();
166 166
 		}
167 167
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param string|null $name Name of the sub-client (Default if null)
177 177
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
178 178
 	 */
179
-	public function getSubClient( $type, $name = null )
179
+	public function getSubClient($type, $name = null)
180 180
 	{
181 181
 		/** admin/jqadm/product/characteristic/decorators/excludes
182 182
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		 * @see admin/jqadm/product/characteristic/decorators/excludes
252 252
 		 * @see admin/jqadm/product/characteristic/decorators/global
253 253
 		 */
254
-		return $this->createSubClient( 'product/characteristic/' . $type, $name );
254
+		return $this->createSubClient('product/characteristic/' . $type, $name);
255 255
 	}
256 256
 
257 257
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getSubClientNames()
264 264
 	{
265
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
265
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
266 266
 	}
267 267
 
268 268
 
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
273 273
 	 */
274
-	protected function setData( \Aimeos\MW\View\Iface $view )
274
+	protected function setData(\Aimeos\MW\View\Iface $view)
275 275
 	{
276
-		$view->characteristicData = (array) $view->param( 'characteristic', array() );;
276
+		$view->characteristicData = (array) $view->param('characteristic', array()); ;
277 277
 	}
278 278
 }
279 279
\ 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
@@ -151,14 +151,12 @@
 block discarded – undo
151 151
 
152 152
 			$manager->commit();
153 153
 			return;
154
-		}
155
-		catch( \Aimeos\MShop\Exception $e )
154
+		} catch( \Aimeos\MShop\Exception $e )
156 155
 		{
157 156
 			$error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
158 157
 			$view->errors = $view->get( 'errors', array() ) + $error;
159 158
 			$manager->rollback();
160
-		}
161
-		catch( \Exception $e )
159
+		} catch( \Exception $e )
162 160
 		{
163 161
 			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
164 162
 			$error = array( 'product-item-category' => $e->getMessage() );
Please login to merge, or discard this patch.