Completed
Push — master ( 340b46...4b7a1c )
by Aimeos
02:58
created
admin/jqadm/tests/Admin/JQAdm/Product/Text/StandardTest.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,38 +22,38 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard( $this->context, $templatePaths );
26
-		$this->object->setView( $this->view );
25
+		$this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard($this->context, $templatePaths);
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		unset( $this->object );
32
+		unset($this->object);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testCreate()
37 37
 	{
38
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
38
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
39 39
 
40 40
 		$this->view->item = $manager->createItem();
41 41
 		$result = $this->object->create();
42 42
 
43
-		$this->assertContains( 'Texts', $result );
44
-		$this->assertNull( $this->view->get( 'errors' ) );
43
+		$this->assertContains('Texts', $result);
44
+		$this->assertNull($this->view->get('errors'));
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testCopy()
49 49
 	{
50
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
50
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
51 51
 
52
-		$this->view->item = $manager->findItem( 'ABCD', array( 'text' ) );
52
+		$this->view->item = $manager->findItem('ABCD', array('text'));
53 53
 		$result = $this->object->copy();
54 54
 
55
-		$this->assertNull( $this->view->get( 'errors' ) );
56
-		$this->assertContains( 'value="Unterproduct 1"', $result );
55
+		$this->assertNull($this->view->get('errors'));
56
+		$this->assertContains('value="Unterproduct 1"', $result);
57 57
 	}
58 58
 
59 59
 
@@ -61,72 +61,72 @@  discard block
 block discarded – undo
61 61
 	{
62 62
 		$result = $this->object->delete();
63 63
 
64
-		$this->assertNull( $this->view->get( 'errors' ) );
65
-		$this->assertNull( $result );
64
+		$this->assertNull($this->view->get('errors'));
65
+		$this->assertNull($result);
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testGet()
70 70
 	{
71
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
71
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
72 72
 
73
-		$this->view->item = $manager->findItem( 'ABCD', array( 'text' ) );
73
+		$this->view->item = $manager->findItem('ABCD', array('text'));
74 74
 		$result = $this->object->get();
75 75
 
76
-		$this->assertNull( $this->view->get( 'errors' ) );
77
-		$this->assertContains( 'value="Unterproduct 1"', $result );
76
+		$this->assertNull($this->view->get('errors'));
77
+		$this->assertContains('value="Unterproduct 1"', $result);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testSave()
82 82
 	{
83
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
83
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
84 84
 
85
-		$item = $manager->findItem( 'CNC' );
86
-		$item->setCode( 'jqadm-test-save' );
87
-		$item->setId( null );
85
+		$item = $manager->findItem('CNC');
86
+		$item->setCode('jqadm-test-save');
87
+		$item->setId(null);
88 88
 
89
-		$manager->saveItem( $item );
89
+		$manager->saveItem($item);
90 90
 
91 91
 
92 92
 		$param = array(
93 93
 			'text' => array(
94
-				'langid' => array( 'de' ),
95
-				'name' => array( 'listid' => '', 'content' => 'test name' ),
96
-				'short' => array( 'listid' => '', 'content' => 'short desc' ),
97
-				'long' => array( 'listid' => '', 'content' => 'long desc' ),
98
-				'url' => array( 'listid' => '', 'content' => 'url segment' ),
99
-				'meta-keyword' => array( 'listid' => '', 'content' => 'meta keywords' ),
100
-				'meta-description' => array( 'listid' => '', 'content' => 'meta desc' ),
94
+				'langid' => array('de'),
95
+				'name' => array('listid' => '', 'content' => 'test name'),
96
+				'short' => array('listid' => '', 'content' => 'short desc'),
97
+				'long' => array('listid' => '', 'content' => 'long desc'),
98
+				'url' => array('listid' => '', 'content' => 'url segment'),
99
+				'meta-keyword' => array('listid' => '', 'content' => 'meta keywords'),
100
+				'meta-description' => array('listid' => '', 'content' => 'meta desc'),
101 101
 			),
102 102
 		);
103 103
 
104
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
105
-		$this->view->addHelper( 'param', $helper );
104
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
105
+		$this->view->addHelper('param', $helper);
106 106
 		$this->view->item = $item;
107 107
 
108 108
 		$result = $this->object->save();
109 109
 
110
-		$item = $manager->getItem( $item->getId(), array( 'text' ) );
111
-		$manager->deleteItem( $item->getId() );
110
+		$item = $manager->getItem($item->getId(), array('text'));
111
+		$manager->deleteItem($item->getId());
112 112
 
113
-		$this->assertNull( $this->view->get( 'errors' ) );
114
-		$this->assertNull( $result );
115
-		$this->assertEquals( 6, count( $item->getListItems() ) );
113
+		$this->assertNull($this->view->get('errors'));
114
+		$this->assertNull($result);
115
+		$this->assertEquals(6, count($item->getListItems()));
116 116
 
117
-		foreach( $item->getListItems( 'text' ) as $listItem )
117
+		foreach ($item->getListItems('text') as $listItem)
118 118
 		{
119
-			$this->assertEquals( 'text', $listItem->getDomain() );
120
-			$this->assertEquals( 'default', $listItem->getType() );
119
+			$this->assertEquals('text', $listItem->getDomain());
120
+			$this->assertEquals('default', $listItem->getType());
121 121
 
122 122
 			$refItem = $listItem->getRefItem();
123
-			$this->assertEquals( 'de', $refItem->getLanguageId() );
123
+			$this->assertEquals('de', $refItem->getLanguageId());
124 124
 		}
125 125
 	}
126 126
 
127 127
 
128 128
 	public function testSearch()
129 129
 	{
130
-		$this->assertNull( $this->object->search() );
130
+		$this->assertNull($this->object->search());
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/TestHelperJqadm.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
 	public static function bootstrap()
14 14
 	{
15 15
 		self::getAimeos();
16
-		\Aimeos\MShop\Factory::setCache( false );
16
+		\Aimeos\MShop\Factory::setCache(false);
17 17
 	}
18 18
 
19 19
 
20
-	public static function getContext( $site = 'unittest' )
20
+	public static function getContext($site = 'unittest')
21 21
 	{
22
-		if( !isset( self::$context[$site] ) ) {
23
-			self::$context[$site] = self::createContext( $site );
22
+		if (!isset(self::$context[$site])) {
23
+			self::$context[$site] = self::createContext($site);
24 24
 		}
25 25
 
26 26
 		return clone self::$context[$site];
27 27
 	}
28 28
 
29 29
 
30
-	public static function getView( $site = 'unittest', \Aimeos\MW\Config\Iface $config = null )
30
+	public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null)
31 31
 	{
32
-		if( $config === null ) {
33
-			$config = self::getContext( $site )->getConfig();
32
+		if ($config === null) {
33
+			$config = self::getContext($site)->getConfig();
34 34
 		}
35 35
 
36
-		$view = new \Aimeos\MW\View\Standard( self::getTemplatePaths() );
36
+		$view = new \Aimeos\MW\View\Standard(self::getTemplatePaths());
37 37
 
38
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
39
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
40
-		$view->addHelper( 'translate', $helper );
38
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
39
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
40
+		$view->addHelper('translate', $helper);
41 41
 
42
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
43
-		$view->addHelper( 'url', $helper );
42
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
43
+		$view->addHelper('url', $helper);
44 44
 
45
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
46
-		$view->addHelper( 'number', $helper );
45
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
46
+		$view->addHelper('number', $helper);
47 47
 
48
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
49
-		$view->addHelper( 'date', $helper );
48
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
49
+		$view->addHelper('date', $helper);
50 50
 
51
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin', 'client/html', 'controller/jsonadm' ) );
52
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
53
-		$view->addHelper( 'config', $helper );
51
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm'));
52
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
53
+		$view->addHelper('config', $helper);
54 54
 
55
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_csrf_token', '_csrf_value' );
56
-		$view->addHelper( 'csrf', $helper );
55
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value');
56
+		$view->addHelper('csrf', $helper);
57 57
 
58 58
 		return $view;
59 59
 	}
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 
62 62
 	public static function getTemplatePaths()
63 63
 	{
64
-		return self::getAimeos()->getCustomPaths( 'admin/jqadm/templates' );
64
+		return self::getAimeos()->getCustomPaths('admin/jqadm/templates');
65 65
 	}
66 66
 
67 67
 
68 68
 	private static function getAimeos()
69 69
 	{
70
-		if( !isset( self::$aimeos ) )
70
+		if (!isset(self::$aimeos))
71 71
 		{
72 72
 			require_once 'Bootstrap.php';
73
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
73
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
74 74
 
75
-			$extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
76
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
75
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
76
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
77 77
 		}
78 78
 
79 79
 		return self::$aimeos;
@@ -83,53 +83,53 @@  discard block
 block discarded – undo
83 83
 	/**
84 84
 	 * @param string $site
85 85
 	 */
86
-	private static function createContext( $site )
86
+	private static function createContext($site)
87 87
 	{
88 88
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
89 89
 		$aimeos = self::getAimeos();
90 90
 
91 91
 
92
-		$paths = $aimeos->getConfigPaths( 'mysql' );
92
+		$paths = $aimeos->getConfigPaths('mysql');
93 93
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
94 94
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
95
-		$local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) );
95
+		$local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp')));
96 96
 
97
-		$conf = new \Aimeos\MW\Config\PHPArray( $local, $paths );
98
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
99
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
100
-		$ctx->setConfig( $conf );
97
+		$conf = new \Aimeos\MW\Config\PHPArray($local, $paths);
98
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
99
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
100
+		$ctx->setConfig($conf);
101 101
 
102 102
 
103
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
104
-		$ctx->setDatabaseManager( $dbm );
103
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
104
+		$ctx->setDatabaseManager($dbm);
105 105
 
106 106
 
107
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf );
108
-		$ctx->setFilesystemManager( $fs );
107
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
108
+		$ctx->setFilesystemManager($fs);
109 109
 
110 110
 
111
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
112
-		$ctx->setLogger( $logger );
111
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
112
+		$ctx->setLogger($logger);
113 113
 
114 114
 
115 115
 		$cache = new \Aimeos\MW\Cache\None();
116
-		$ctx->setCache( $cache );
116
+		$ctx->setCache($cache);
117 117
 
118 118
 
119
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
120
-		$ctx->setI18n( array( 'de' => $i18n ) );
119
+		$i18n = new \Aimeos\MW\Translation\None('de');
120
+		$ctx->setI18n(array('de' => $i18n));
121 121
 
122 122
 
123 123
 		$session = new \Aimeos\MW\Session\None();
124
-		$ctx->setSession( $session );
124
+		$ctx->setSession($session);
125 125
 
126 126
 
127
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
128
-		$locale = $localeManager->bootstrap( $site, '', '', false );
129
-		$ctx->setLocale( $locale );
127
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
128
+		$locale = $localeManager->bootstrap($site, '', '', false);
129
+		$ctx->setLocale($locale);
130 130
 
131 131
 
132
-		$ctx->setEditor( 'core:admin/jqadm' );
132
+		$ctx->setEditor('core:admin/jqadm');
133 133
 
134 134
 		return $ctx;
135 135
 	}
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Product/Download/Standard.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$view = $this->getView();
69 69
 
70
-		$this->setData( $view );
70
+		$this->setData($view);
71 71
 		$view->downloadBody = '';
72 72
 
73
-		foreach( $this->getSubClients() as $client ) {
73
+		foreach ($this->getSubClients() as $client) {
74 74
 			$view->downloadBody .= $client->copy();
75 75
 		}
76 76
 
77 77
 		$tplconf = 'admin/jqadm/product/download/template-item';
78 78
 		$default = 'product/item-download-default.php';
79 79
 
80
-		return $view->render( $view->config( $tplconf, $default ) );
80
+		return $view->render($view->config($tplconf, $default));
81 81
 	}
82 82
 
83 83
 
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$view = $this->getView();
92 92
 
93
-		$this->setData( $view );
93
+		$this->setData($view);
94 94
 		$view->downloadBody = '';
95 95
 
96
-		foreach( $this->getSubClients() as $client ) {
96
+		foreach ($this->getSubClients() as $client) {
97 97
 			$view->downloadBody .= $client->create();
98 98
 		}
99 99
 
100 100
 		$tplconf = 'admin/jqadm/product/download/template-item';
101 101
 		$default = 'product/item-download-default.php';
102 102
 
103
-		return $view->render( $view->config( $tplconf, $default ) );
103
+		return $view->render($view->config($tplconf, $default));
104 104
 	}
105 105
 
106 106
 
@@ -112,35 +112,35 @@  discard block
 block discarded – undo
112 112
 	public function delete()
113 113
 	{
114 114
 		$view = $this->getView();
115
-		$listManager = \Aimeos\MShop\Factory::createManager( $context = $this->getContext(), 'product/lists' );
115
+		$listManager = \Aimeos\MShop\Factory::createManager($context = $this->getContext(), 'product/lists');
116 116
 		$search = $listManager->createSearch();
117 117
 
118
-		foreach( (array) $view->param( 'id' ) as $id )
118
+		foreach ((array) $view->param('id') as $id)
119 119
 		{
120
-			$listItems = $this->getListItems( $id );
121
-			$items = $this->getAttributeItems( $listItems );
120
+			$listItems = $this->getListItems($id);
121
+			$items = $this->getAttributeItems($listItems);
122 122
 
123
-			foreach( $listItems as $listid => $listItem )
123
+			foreach ($listItems as $listid => $listItem)
124 124
 			{
125 125
 				$refId = $listItem->getRefId();
126 126
 
127 127
 				$expr = array(
128
-					$search->compare( '==', 'product.lists.refid', $refId ),
129
-					$search->compare( '==', 'product.lists.domain', 'attribute' ),
130
-					$search->compare( '==', 'product.lists.type.code', 'hidden' ),
131
-					$search->compare( '==', 'product.lists.type.domain', 'attribute' ),
128
+					$search->compare('==', 'product.lists.refid', $refId),
129
+					$search->compare('==', 'product.lists.domain', 'attribute'),
130
+					$search->compare('==', 'product.lists.type.code', 'hidden'),
131
+					$search->compare('==', 'product.lists.type.domain', 'attribute'),
132 132
 				);
133
-				$search->setConditions( $search->combine( '&&', $expr ) );
134
-				$result = $listManager->aggregate( $search, 'product.lists.refid' );
133
+				$search->setConditions($search->combine('&&', $expr));
134
+				$result = $listManager->aggregate($search, 'product.lists.refid');
135 135
 
136
-				if( isset( $items[$refId] ) && $result[$refId] == 1 ) {
137
-					$listItem->setRefItem( $items[$refId] );
136
+				if (isset($items[$refId]) && $result[$refId] == 1) {
137
+					$listItem->setRefItem($items[$refId]);
138 138
 				} else {
139
-					unset( $listItems[$id] );
139
+					unset($listItems[$id]);
140 140
 				}
141 141
 			}
142 142
 
143
-			$this->cleanupItems( $listItems, array() );
143
+			$this->cleanupItems($listItems, array());
144 144
 		}
145 145
 	}
146 146
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		$view = $this->getView();
156 156
 
157
-		$this->setData( $view );
157
+		$this->setData($view);
158 158
 		$view->downloadBody = '';
159 159
 
160
-		foreach( $this->getSubClients() as $client ) {
160
+		foreach ($this->getSubClients() as $client) {
161 161
 			$view->downloadBody .= $client->get();
162 162
 		}
163 163
 
164 164
 		$tplconf = 'admin/jqadm/product/download/template-item';
165 165
 		$default = 'product/item-download-default.php';
166 166
 
167
-		return $view->render( $view->config( $tplconf, $default ) );
167
+		return $view->render($view->config($tplconf, $default));
168 168
 	}
169 169
 
170 170
 
@@ -178,18 +178,18 @@  discard block
 block discarded – undo
178 178
 		$view = $this->getView();
179 179
 		$context = $this->getContext();
180 180
 
181
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
182
-		$attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
181
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
182
+		$attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
183 183
 
184 184
 		$manager->begin();
185 185
 		$attrManager->begin();
186 186
 
187 187
 		try
188 188
 		{
189
-			$this->updateItems( $view );
189
+			$this->updateItems($view);
190 190
 			$view->downloadBody = '';
191 191
 
192
-			foreach( $this->getSubClients() as $client ) {
192
+			foreach ($this->getSubClients() as $client) {
193 193
 				$view->downloadBody .= $client->save();
194 194
 			}
195 195
 
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
 			$manager->commit();
198 198
 			return;
199 199
 		}
200
-		catch( \Aimeos\MShop\Exception $e )
200
+		catch (\Aimeos\MShop\Exception $e)
201 201
 		{
202
-			$error = array( 'product-item-download' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
203
-			$view->errors = $view->get( 'errors', array() ) + $error;
202
+			$error = array('product-item-download' => $context->getI18n()->dt('mshop', $e->getMessage()));
203
+			$view->errors = $view->get('errors', array()) + $error;
204 204
 
205 205
 			$attrManager->rollback();
206 206
 			$manager->rollback();
207 207
 		}
208
-		catch( \Exception $e )
208
+		catch (\Exception $e)
209 209
 		{
210
-			$context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() );
211
-			$error = array( 'product-item-download' => $e->getMessage() );
212
-			$view->errors = $view->get( 'errors', array() ) + $error;
210
+			$context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString());
211
+			$error = array('product-item-download' => $e->getMessage());
212
+			$view->errors = $view->get('errors', array()) + $error;
213 213
 
214 214
 			$attrManager->rollback();
215 215
 			$manager->rollback();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @param string|null $name Name of the sub-client (Default if null)
227 227
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
228 228
 	 */
229
-	public function getSubClient( $type, $name = null )
229
+	public function getSubClient($type, $name = null)
230 230
 	{
231 231
 		/** admin/jqadm/product/download/decorators/excludes
232 232
 		 * Excludes decorators added by the "common" option from the product JQAdm client
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 * @see admin/jqadm/product/download/decorators/excludes
302 302
 		 * @see admin/jqadm/product/download/decorators/global
303 303
 		 */
304
-		return $this->createSubClient( 'product/download/' . $type, $name );
304
+		return $this->createSubClient('product/download/' . $type, $name);
305 305
 	}
306 306
 
307 307
 
@@ -311,29 +311,29 @@  discard block
 block discarded – undo
311 311
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
312 312
 	 * @param array $listIds List of IDs of the still used list items
313 313
 	 */
314
-	protected function cleanupItems( array $listItems, array $listIds )
314
+	protected function cleanupItems(array $listItems, array $listIds)
315 315
 	{
316 316
 		$context = $this->getContext();
317
-		$fs = $context->getFilesystemManager()->get( 'fs-secure' );
318
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
319
-		$listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
317
+		$fs = $context->getFilesystemManager()->get('fs-secure');
318
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
319
+		$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
320 320
 
321 321
 		$rmItems = array();
322
-		$rmListIds = array_diff( array_keys( $listItems ), $listIds );
322
+		$rmListIds = array_diff(array_keys($listItems), $listIds);
323 323
 
324
-		foreach( $rmListIds as $rmListId )
324
+		foreach ($rmListIds as $rmListId)
325 325
 		{
326
-			if( ( $item = $listItems[$rmListId]->getRefItem() ) !== null )
326
+			if (($item = $listItems[$rmListId]->getRefItem()) !== null)
327 327
 			{
328
-				if( $item->getCode() != '' && $fs->has( $item->getCode() ) ) {
329
-					$fs->rm( $item->getCode() );
328
+				if ($item->getCode() != '' && $fs->has($item->getCode())) {
329
+					$fs->rm($item->getCode());
330 330
 				}
331 331
 				$rmItems[] = $item->getId();
332 332
 			}
333 333
 		}
334 334
 
335
-		$listManager->deleteItems( $rmListIds  );
336
-		$manager->deleteItems( $rmItems  );
335
+		$listManager->deleteItems($rmListIds);
336
+		$manager->deleteItems($rmItems);
337 337
 	}
338 338
 
339 339
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	protected function createItem()
346 346
 	{
347 347
 		$context = $this->getContext();
348
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
349
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/type' );
348
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
349
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/type');
350 350
 
351 351
 		$item = $manager->createItem();
352
-		$item->setTypeId( $typeManager->findItem( 'download', array(), 'product' )->getId() );
353
-		$item->setDomain( 'product' );
354
-		$item->setStatus( 1 );
352
+		$item->setTypeId($typeManager->findItem('download', array(), 'product')->getId());
353
+		$item->setDomain('product');
354
+		$item->setStatus(1);
355 355
 
356 356
 		return $item;
357 357
 	}
@@ -363,17 +363,17 @@  discard block
 block discarded – undo
363 363
 	 * @param string $id Parent ID for the new list item
364 364
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface New list item object
365 365
 	 */
366
-	protected function createListItem( $id )
366
+	protected function createListItem($id)
367 367
 	{
368 368
 		$context = $this->getContext();
369
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
370
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
369
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
370
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
371 371
 
372 372
 		$item = $manager->createItem();
373
-		$item->setTypeId( $typeManager->findItem( 'hidden', array(), 'attribute' )->getId() );
374
-		$item->setDomain( 'attribute' );
375
-		$item->setParentId( $id );
376
-		$item->setStatus( 1 );
373
+		$item->setTypeId($typeManager->findItem('hidden', array(), 'attribute')->getId());
374
+		$item->setDomain('attribute');
375
+		$item->setParentId($id);
376
+		$item->setStatus(1);
377 377
 
378 378
 		return $item;
379 379
 	}
@@ -385,27 +385,27 @@  discard block
 block discarded – undo
385 385
 	 * @param array $listItems List of list items with IDs as key and items implementing \Aimeos\MShop\Common\Item\List\Iface as values
386 386
 	 * @return array List of attribute items with ID as key and items implementing \Aimeos\MShop\Attribute\Item\Iface as values
387 387
 	 */
388
-	protected function getAttributeItems( array $listItems )
388
+	protected function getAttributeItems(array $listItems)
389 389
 	{
390 390
 		$refIds = array();
391 391
 
392
-		foreach( $listItems as $item ) {
392
+		foreach ($listItems as $item) {
393 393
 			$refIds[] = $item->getRefId();
394 394
 		}
395 395
 
396
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
396
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
397 397
 
398 398
 		$search = $manager->createSearch();
399 399
 		$expr = array(
400
-			$search->compare( '==', 'attribute.id', $refIds ),
401
-			$search->compare( '==', 'attribute.domain', 'product' ),
402
-			$search->compare( '==', 'attribute.type.domain', 'product' ),
403
-			$search->compare( '==', 'attribute.type.code', 'download' ),
400
+			$search->compare('==', 'attribute.id', $refIds),
401
+			$search->compare('==', 'attribute.domain', 'product'),
402
+			$search->compare('==', 'attribute.type.domain', 'product'),
403
+			$search->compare('==', 'attribute.type.code', 'download'),
404 404
 		);
405
-		$search->setConditions( $search->combine( '&&', $expr ) );
406
-		$search->setSlice( 0, 0x7fffffff );
405
+		$search->setConditions($search->combine('&&', $expr));
406
+		$search->setSlice(0, 0x7fffffff);
407 407
 
408
-		return $manager->searchItems( $search );
408
+		return $manager->searchItems($search);
409 409
 	}
410 410
 
411 411
 
@@ -415,20 +415,20 @@  discard block
 block discarded – undo
415 415
 	 * @param string $prodid Unique product ID
416 416
 	 * @return array Associative list of bundle product IDs as keys and list items as values
417 417
 	 */
418
-	protected function getListItems( $prodid )
418
+	protected function getListItems($prodid)
419 419
 	{
420
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
420
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
421 421
 
422 422
 		$search = $manager->createSearch();
423 423
 		$expr = array(
424
-			$search->compare( '==', 'product.lists.parentid', $prodid ),
425
-			$search->compare( '==', 'product.lists.domain', 'attribute' ),
426
-			$search->compare( '==', 'product.lists.type.domain', 'attribute' ),
427
-			$search->compare( '==', 'product.lists.type.code', 'hidden' ),
424
+			$search->compare('==', 'product.lists.parentid', $prodid),
425
+			$search->compare('==', 'product.lists.domain', 'attribute'),
426
+			$search->compare('==', 'product.lists.type.domain', 'attribute'),
427
+			$search->compare('==', 'product.lists.type.code', 'hidden'),
428 428
 		);
429
-		$search->setConditions( $search->combine( '&&', $expr ) );
429
+		$search->setConditions($search->combine('&&', $expr));
430 430
 
431
-		return $manager->searchItems( $search );
431
+		return $manager->searchItems($search);
432 432
 	}
433 433
 
434 434
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	protected function getSubClientNames()
441 441
 	{
442
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
442
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
443 443
 	}
444 444
 
445 445
 
@@ -448,29 +448,29 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
450 450
 	 */
451
-	protected function setData( \Aimeos\MW\View\Iface $view )
451
+	protected function setData(\Aimeos\MW\View\Iface $view)
452 452
 	{
453
-		$view->downloadData = (array) $view->param( 'download', array() );
453
+		$view->downloadData = (array) $view->param('download', array());
454 454
 
455
-		if( !empty( $view->downloadData ) ) {
455
+		if (!empty($view->downloadData)) {
456 456
 			return;
457 457
 		}
458 458
 
459 459
 		$data = array();
460
-		$listItems = $this->getListItems( $view->item->getId() );
461
-		$attrItems = $this->getAttributeItems( $listItems );
460
+		$listItems = $this->getListItems($view->item->getId());
461
+		$attrItems = $this->getAttributeItems($listItems);
462 462
 
463
-		foreach( $listItems as $listItem )
463
+		foreach ($listItems as $listItem)
464 464
 		{
465
-			if( !isset( $attrItems[$listItem->getRefId()] ) ) {
465
+			if (!isset($attrItems[$listItem->getRefId()])) {
466 466
 				continue;
467 467
 			}
468 468
 
469
-			foreach( $listItem->toArray() as $key => $value ) {
469
+			foreach ($listItem->toArray() as $key => $value) {
470 470
 				$data[$key] = $value;
471 471
 			}
472 472
 
473
-			foreach( $attrItems[$listItem->getRefId()]->toArray() as $key => $value ) {
473
+			foreach ($attrItems[$listItem->getRefId()]->toArray() as $key => $value) {
474 474
 				$data[$key] = $value;
475 475
 			}
476 476
 
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 
479 479
 			try
480 480
 			{
481
-				$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
481
+				$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
482 482
 
483
-				$data['time'] = $fs->time( $data['path'] );
484
-				$data['size'] = $fs->size( $data['path'] );
483
+				$data['time'] = $fs->time($data['path']);
484
+				$data['size'] = $fs->size($data['path']);
485 485
 			}
486
-			catch( \Exception $e ) { ; }
486
+			catch (\Exception $e) {; }
487 487
 		}
488 488
 
489 489
 		$view->downloadData = $data;
@@ -497,22 +497,22 @@  discard block
 block discarded – undo
497 497
 	 * @param string $path Path the file should be stored at
498 498
 	 * @return string Path to the uploaded file
499 499
 	 */
500
-	protected function storeFile( \Psr\Http\Message\UploadedFileInterface $file, $path )
500
+	protected function storeFile(\Psr\Http\Message\UploadedFileInterface $file, $path)
501 501
 	{
502
-		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
502
+		$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
503 503
 
504
-		if( $path == null )
504
+		if ($path == null)
505 505
 		{
506
-			$ext = pathinfo( $file->getClientFilename(), PATHINFO_EXTENSION );
507
-			$hash = md5( $file->getClientFilename() . microtime( true ) );
508
-			$path = sprintf( '%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext );
506
+			$ext = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
507
+			$hash = md5($file->getClientFilename() . microtime(true));
508
+			$path = sprintf('%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext);
509 509
 
510
-			if( !$fs->isdir( $hash[0] . '/' . $hash[1] ) ) {
511
-				$fs->mkdir( $hash[0] . '/' . $hash[1] );
510
+			if (!$fs->isdir($hash[0] . '/' . $hash[1])) {
511
+				$fs->mkdir($hash[0] . '/' . $hash[1]);
512 512
 			}
513 513
 		}
514 514
 
515
-		$fs->writes( $path, $file->getStream()->detach() );
515
+		$fs->writes($path, $file->getStream()->detach());
516 516
 
517 517
 		return $path;
518 518
 	}
@@ -523,47 +523,47 @@  discard block
 block discarded – undo
523 523
 	 *
524 524
 	 * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
525 525
 	 */
526
-	protected function updateItems( \Aimeos\MW\View\Iface $view )
526
+	protected function updateItems(\Aimeos\MW\View\Iface $view)
527 527
 	{
528 528
 		$id = $view->item->getId();
529 529
 		$context = $this->getContext();
530 530
 
531
-		$attrManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' );
532
-		$listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
531
+		$attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
532
+		$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
533 533
 
534
-		$listItems = $this->getListItems( $id );
535
-		$listId = $view->param( 'download/product.lists.id' );
534
+		$listItems = $this->getListItems($id);
535
+		$listId = $view->param('download/product.lists.id');
536 536
 
537
-		if( isset( $listItems[$listId] ) ) {
537
+		if (isset($listItems[$listId])) {
538 538
 			$litem = $listItems[$listId];
539 539
 		} else {
540
-			$litem = $this->createListItem( $id );
540
+			$litem = $this->createListItem($id);
541 541
 		}
542 542
 
543
-		if( ( $attrId = $view->param( 'download/attribute.id' ) ) != '' ) {
544
-			$item = $attrManager->getItem( $attrId );
543
+		if (($attrId = $view->param('download/attribute.id')) != '') {
544
+			$item = $attrManager->getItem($attrId);
545 545
 		} else {
546 546
 			$item = $this->createItem();
547 547
 		}
548 548
 
549
-		if( ( $file = $view->value( (array) $view->request()->getUploadedFiles(), 'download/file' ) ) !== null
549
+		if (($file = $view->value((array) $view->request()->getUploadedFiles(), 'download/file')) !== null
550 550
 			&& $file->getError() === UPLOAD_ERR_OK
551 551
 		) {
552
-			$path = ( $view->param( 'download/overwrite' ) == 1 ? $item->getCode() : null );
553
-			$item->setCode( $this->storeFile( $file, $path ) );
552
+			$path = ($view->param('download/overwrite') == 1 ? $item->getCode() : null);
553
+			$item->setCode($this->storeFile($file, $path));
554 554
 		}
555 555
 
556
-		if( ( $label = $view->param( 'download/attribute.label' ) ) != '' )
556
+		if (($label = $view->param('download/attribute.label')) != '')
557 557
 		{
558
-			$item->setLabel( $label );
559
-			$attrManager->saveItem( $item );
558
+			$item->setLabel($label);
559
+			$attrManager->saveItem($item);
560 560
 
561
-			$litem->setPosition( 0 );
562
-			$litem->setRefId( $item->getId() );
563
-			$litem->setStatus( $view->param( 'download/product.lists.status' ) );
564
-			$listManager->saveItem( $litem );
561
+			$litem->setPosition(0);
562
+			$litem->setRefId($item->getId());
563
+			$litem->setStatus($view->param('download/product.lists.status'));
564
+			$listManager->saveItem($litem);
565 565
 		}
566 566
 
567
-		$this->cleanupItems( $listItems, array( $listId ) );
567
+		$this->cleanupItems($listItems, array($listId));
568 568
 	}
569 569
 }
570 570
\ No newline at end of file
Please login to merge, or discard this patch.