Completed
Push — master ( b384ce...7658b0 )
by Aimeos
05:56
created
client/html/src/Client/Html/Account/History/Order/Standard.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @since 2015.02
101 101
 	 * @category Developer
102 102
 	 */
103
-	private $subPartNames = array( 'address', 'service', 'coupon', 'detail' );
103
+	private $subPartNames = array('address', 'service', 'coupon', 'detail');
104 104
 
105 105
 	private $cache;
106 106
 
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string HTML code
115 115
 	 */
116
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118 118
 		$view = $this->getView();
119 119
 
120
-		if( $view->param( 'his_action' ) != 'order' ) {
120
+		if ($view->param('his_action') != 'order') {
121 121
 			return '';
122 122
 		}
123 123
 
124
-		$view = $this->setViewParams( $view, $tags, $expire );
124
+		$view = $this->setViewParams($view, $tags, $expire);
125 125
 
126 126
 		$html = '';
127
-		foreach( $this->getSubClients() as $subclient ) {
128
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
127
+		foreach ($this->getSubClients() as $subclient) {
128
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
129 129
 		}
130 130
 		$view->orderBody = $html;
131 131
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		$tplconf = 'client/html/account/history/order/standard/template-body';
153 153
 		$default = 'account/history/order-body-default.php';
154 154
 
155
-		return $view->render( $view->config( $tplconf, $default ) );
155
+		return $view->render($view->config($tplconf, $default));
156 156
 	}
157 157
 
158 158
 
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
165 165
 	 * @return string|null String including HTML tags for the header on error
166 166
 	 */
167
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
167
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
168 168
 	{
169 169
 		$view = $this->getView();
170 170
 
171
-		if( $view->param( 'his_action' ) != 'order' ) {
171
+		if ($view->param('his_action') != 'order') {
172 172
 			return '';
173 173
 		}
174 174
 
175
-		$view = $this->setViewParams( $view, $tags, $expire );
175
+		$view = $this->setViewParams($view, $tags, $expire);
176 176
 
177 177
 		$html = '';
178
-		foreach( $this->getSubClients() as $subclient ) {
179
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
178
+		foreach ($this->getSubClients() as $subclient) {
179
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
180 180
 		}
181 181
 		$view->orderHeader = $html;
182 182
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		$tplconf = 'client/html/account/history/order/standard/template-header';
205 205
 		$default = 'account/history/order-header-default.php';
206 206
 
207
-		return $view->render( $view->config( $tplconf, $default ) );
207
+		return $view->render($view->config($tplconf, $default));
208 208
 	}
209 209
 
210 210
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @param string|null $name Name of the sub-client (Default if null)
216 216
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
217 217
 	 */
218
-	public function getSubClient( $type, $name = null )
218
+	public function getSubClient($type, $name = null)
219 219
 	{
220 220
 		/** client/html/account/history/order/decorators/excludes
221 221
 		 * Excludes decorators added by the "common" option from the account history order html client
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		 * @see client/html/account/history/order/decorators/global
292 292
 		 */
293 293
 
294
-		return $this->createSubClient( 'account/history/order/' . $type, $name );
294
+		return $this->createSubClient('account/history/order/'.$type, $name);
295 295
 	}
296 296
 
297 297
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	protected function getSubClientNames()
304 304
 	{
305
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
305
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
306 306
 	}
307 307
 
308 308
 
@@ -314,35 +314,35 @@  discard block
 block discarded – undo
314 314
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
315 315
 	 * @return \Aimeos\MW\View\Iface Modified view object
316 316
 	 */
317
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
317
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
318 318
 	{
319
-		if( !isset( $this->cache ) )
319
+		if (!isset($this->cache))
320 320
 		{
321 321
 			$context = $this->getContext();
322
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
322
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
323 323
 
324
-			$orderId = $view->param( 'his_id', null );
324
+			$orderId = $view->param('his_id', null);
325 325
 
326
-			if( $orderId !== null )
326
+			if ($orderId !== null)
327 327
 			{
328
-				$search = $manager->createSearch( true );
328
+				$search = $manager->createSearch(true);
329 329
 				$expr = array(
330 330
 					$search->getConditions(),
331
-					$search->compare( '==', 'order.id', $orderId ),
332
-					$search->compare( '==', 'order.base.customerid', $context->getUserId() ),
331
+					$search->compare('==', 'order.id', $orderId),
332
+					$search->compare('==', 'order.base.customerid', $context->getUserId()),
333 333
 				);
334
-				$search->setConditions( $search->combine( '&&', $expr ) );
334
+				$search->setConditions($search->combine('&&', $expr));
335 335
 
336
-				$orderItems = $manager->searchItems( $search );
336
+				$orderItems = $manager->searchItems($search);
337 337
 
338
-				if( ( $orderItem = reset( $orderItems ) ) === false )
338
+				if (($orderItem = reset($orderItems)) === false)
339 339
 				{
340
-					$msg = $view->translate( 'client', 'Order with ID "%1$s" not found' );
341
-					throw new \Aimeos\Client\Html\Exception( sprintf( $msg, $orderId ) );
340
+					$msg = $view->translate('client', 'Order with ID "%1$s" not found');
341
+					throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId));
342 342
 				}
343 343
 
344
-				$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
345
-				$view->summaryBasket = $baseManager->load( $orderItem->getBaseId() );
344
+				$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
345
+				$view->summaryBasket = $baseManager->load($orderItem->getBaseId());
346 346
 				$view->orderItem = $orderItem;
347 347
 			}
348 348
 
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/History/Order/Address/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68 68
 	 * @return string HTML code
69 69
 	*/
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
71 71
 	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
72
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
73 73
 
74 74
 		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
75
+		foreach ($this->getSubClients() as $subclient) {
76
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
77 77
 		}
78 78
 		$view->addressBody = $html;
79 79
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$tplconf = 'client/html/account/history/order/address/standard/template-body';
102 102
 		$default = 'common/summary/address-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
104
+		return $view->render($view->config($tplconf, $default));
105 105
 	}
106 106
 
107 107
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string|null String including HTML tags for the header on error
115 115
 	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
119 119
 
120 120
 		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
121
+		foreach ($this->getSubClients() as $subclient) {
122
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
123 123
 		}
124 124
 		$view->addressHeader = $html;
125 125
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$tplconf = 'client/html/account/history/order/address/standard/template-header';
149 149
 		$default = 'common/summary/address-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
151
+		return $view->render($view->config($tplconf, $default));
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string|null $name Name of the sub-client (Default if null)
160 160
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
161 161
 	 */
162
-	public function getSubClient( $type, $name = null )
162
+	public function getSubClient($type, $name = null)
163 163
 	{
164 164
 		/** client/html/account/history/order/address/decorators/excludes
165 165
 		 * Excludes decorators added by the "common" option from the account history order address html client
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		 * @see client/html/account/history/order/address/decorators/excludes
235 235
 		 * @see client/html/account/history/order/address/decorators/global
236 236
 		 */
237
-		return $this->createSubClient( 'account/history/order/address/' . $type, $name );
237
+		return $this->createSubClient('account/history/order/address/'.$type, $name);
238 238
 	}
239 239
 
240 240
 
@@ -245,6 +245,6 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	protected function getSubClientNames()
247 247
 	{
248
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
249 249
 	}
250 250
 }
251 251
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/History/Factory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32 32
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33 33
 	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
35 35
 	{
36 36
 		/** client/html/account/history/name
37 37
 		 * Class name of the used account history client implementation
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 		 * @since 2014.03
67 67
 		 * @category Developer
68 68
 		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/history/name', 'Standard' );
69
+		if ($name === null) {
70
+			$name = $context->getConfig()->get('client/html/account/history/name', 'Standard');
71 71
 		}
72 72
 
73
-		if( ctype_alnum( $name ) === false )
73
+		if (ctype_alnum($name) === false)
74 74
 		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\History\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
75
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\History\\'.$name : '<not a string>';
76
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
77 77
 		}
78 78
 
79 79
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\History\\' . $name;
80
+		$classname = '\\Aimeos\\Client\\Html\\Account\\History\\'.$name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/history' );
84
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/history');
85 85
 	}
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/History/Standard.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 2015.02
79 79
 	 * @category Developer
80 80
 	 */
81
-	private $subPartNames = array( 'lists', 'order' );
81
+	private $subPartNames = array('lists', 'order');
82 82
 
83 83
 
84 84
 	/**
@@ -89,42 +89,42 @@  discard block
 block discarded – undo
89 89
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
90 90
 	 * @return string HTML code
91 91
 	 */
92
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
92
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
93 93
 	{
94 94
 		$context = $this->getContext();
95 95
 		$view = $this->getView();
96 96
 
97 97
 		try
98 98
 		{
99
-			$view = $this->setViewParams( $view, $tags, $expire );
99
+			$view = $this->setViewParams($view, $tags, $expire);
100 100
 
101 101
 			$html = '';
102
-			foreach( $this->getSubClients() as $subclient ) {
103
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
102
+			foreach ($this->getSubClients() as $subclient) {
103
+				$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
104 104
 			}
105 105
 			$view->historyBody = $html;
106 106
 		}
107
-		catch( \Aimeos\Client\Html\Exception $e )
107
+		catch (\Aimeos\Client\Html\Exception $e)
108 108
 		{
109
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
110
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
109
+			$error = array($this->getContext()->getI18n()->dt('client', $e->getMessage()));
110
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
111 111
 		}
112
-		catch( \Aimeos\Controller\Frontend\Exception $e )
112
+		catch (\Aimeos\Controller\Frontend\Exception $e)
113 113
 		{
114
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
115
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
114
+			$error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage()));
115
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
116 116
 		}
117
-		catch( \Aimeos\MShop\Exception $e )
117
+		catch (\Aimeos\MShop\Exception $e)
118 118
 		{
119
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
120
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
119
+			$error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
120
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
121 121
 		}
122
-		catch( \Exception $e )
122
+		catch (\Exception $e)
123 123
 		{
124
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
124
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
125 125
 
126
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
127
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
126
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
127
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
128 128
 		}
129 129
 
130 130
 		/** client/html/account/history/standard/template-body
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		$tplconf = 'client/html/account/history/standard/template-body';
151 151
 		$default = 'account/history/body-default.php';
152 152
 
153
-		return $view->render( $view->config( $tplconf, $default ) );
153
+		return $view->render($view->config($tplconf, $default));
154 154
 	}
155 155
 
156 156
 
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
163 163
 	 * @return string|null String including HTML tags for the header on error
164 164
 	 */
165
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
165
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
166 166
 	{
167 167
 		try
168 168
 		{
169
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
169
+			$view = $this->setViewParams($this->getView(), $tags, $expire);
170 170
 
171 171
 			$html = '';
172
-			foreach( $this->getSubClients() as $subclient ) {
173
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
172
+			foreach ($this->getSubClients() as $subclient) {
173
+				$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
174 174
 			}
175 175
 			$view->historyHeader = $html;
176 176
 
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 			$tplconf = 'client/html/account/history/standard/template-header';
199 199
 			$default = 'account/history/header-default.php';
200 200
 
201
-			return $view->render( $view->config( $tplconf, $default ) );
201
+			return $view->render($view->config($tplconf, $default));
202 202
 		}
203
-		catch( \Exception $e )
203
+		catch (\Exception $e)
204 204
 		{
205
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
205
+			$this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
206 206
 		}
207 207
 	}
208 208
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @param string|null $name Name of the sub-client (Default if null)
215 215
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
216 216
 	 */
217
-	public function getSubClient( $type, $name = null )
217
+	public function getSubClient($type, $name = null)
218 218
 	{
219 219
 		/** client/html/account/history/decorators/excludes
220 220
 		 * Excludes decorators added by the "common" option from the account history html client
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		 * @see client/html/account/history/decorators/global
291 291
 		 */
292 292
 
293
-		return $this->createSubClient( 'account/history/' . $type, $name );
293
+		return $this->createSubClient('account/history/'.$type, $name);
294 294
 	}
295 295
 
296 296
 
@@ -301,6 +301,6 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	protected function getSubClientNames()
303 303
 	{
304
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
304
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
305 305
 	}
306 306
 }
307 307
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Download/Factory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
31 31
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
32 32
 	 */
33
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
33
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
34 34
 	{
35 35
 		/** client/html/account/download/name
36 36
 		 * Class name of the used account download client implementation
@@ -65,22 +65,22 @@  discard block
 block discarded – undo
65 65
 		 * @since 2014.03
66 66
 		 * @category Developer
67 67
 		 */
68
-		if( $name === null ) {
69
-			$name = $context->getConfig()->get( 'client/html/account/download/name', 'Standard' );
68
+		if ($name === null) {
69
+			$name = $context->getConfig()->get('client/html/account/download/name', 'Standard');
70 70
 		}
71 71
 
72
-		if( ctype_alnum( $name ) === false )
72
+		if (ctype_alnum($name) === false)
73 73
 		{
74
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name : '<not a string>';
75
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\Download\\'.$name : '<not a string>';
75
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
76 76
 		}
77 77
 
78 78
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
79
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name;
79
+		$classname = '\\Aimeos\\Client\\Html\\Account\\Download\\'.$name;
80 80
 
81
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
81
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
82 82
 
83
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/download' );
83
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/download');
84 84
 	}
85 85
 
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Download/Standard.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
67 67
 	 * @return string HTML code
68 68
 	 */
69
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
69
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
70 70
 	{
71 71
 		return '';
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
81 81
 	 * @return string|null String including HTML tags for the header on error
82 82
 	 */
83
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
83
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
84 84
 	{
85 85
 		return '';
86 86
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param string|null $name Name of the sub-client (Default if null)
94 94
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
95 95
 	 */
96
-	public function getSubClient( $type, $name = null )
96
+	public function getSubClient($type, $name = null)
97 97
 	{
98 98
 		/** client/html/account/download/decorators/excludes
99 99
 		 * Excludes decorators added by the "common" option from the account download html client
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		 * @see client/html/account/download/decorators/excludes
169 169
 		 * @see client/html/account/download/decorators/global
170 170
 		 */
171
-		return $this->createSubClient( 'account/download/' . $type, $name );
171
+		return $this->createSubClient('account/download/'.$type, $name);
172 172
 	}
173 173
 
174 174
 
@@ -184,29 +184,29 @@  discard block
 block discarded – undo
184 184
 		try
185 185
 		{
186 186
 			$view = $this->getView();
187
-			$id = $view->param( 'dl_id' );
187
+			$id = $view->param('dl_id');
188 188
 			$customerId = $context->getUserId();
189 189
 
190
-			if( $this->checkAccess( $customerId, $id ) === false )
190
+			if ($this->checkAccess($customerId, $id) === false)
191 191
 			{
192
-				$view->response()->withStatus( 401 );
192
+				$view->response()->withStatus(401);
193 193
 				return;
194 194
 			}
195 195
 
196
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
197
-			$item = $manager->getItem( $id );
196
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute');
197
+			$item = $manager->getItem($id);
198 198
 
199
-			if( $this->checkDownload( $context->getUserId(), $id ) === true ) {
200
-				$this->addDownload( $item );
199
+			if ($this->checkDownload($context->getUserId(), $id) === true) {
200
+				$this->addDownload($item);
201 201
 			} else {
202
-				$view->response()->withStatus( 403 );
202
+				$view->response()->withStatus(403);
203 203
 			}
204 204
 
205 205
 			parent::process();
206 206
 		}
207
-		catch( \Exception $e )
207
+		catch (\Exception $e)
208 208
 		{
209
-			$context->getLogger()->log( $e->getMessage() );
209
+			$context->getLogger()->log($e->getMessage());
210 210
 		}
211 211
 	}
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	protected function getSubClientNames()
220 220
 	{
221
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
221
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
222 222
 	}
223 223
 
224 224
 
@@ -227,40 +227,40 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item Order product attribute item with file reference
229 229
 	 */
230
-	protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
230
+	protected function addDownload(\Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item)
231 231
 	{
232
-		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
232
+		$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
233 233
 		$response = $this->getView()->response();
234 234
 		$value = (string) $item->getValue();
235 235
 
236
-		if( $fs->has( $value ) )
236
+		if ($fs->has($value))
237 237
 		{
238 238
 			$name = $item->getName();
239 239
 
240
-			if( pathinfo( $name, PATHINFO_EXTENSION ) == null
241
-					&& ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
240
+			if (pathinfo($name, PATHINFO_EXTENSION) == null
241
+					&& ($ext = pathinfo($value, PATHINFO_EXTENSION)) != null
242 242
 			) {
243
-				$name .= '.' . $ext;
243
+				$name .= '.'.$ext;
244 244
 			}
245 245
 
246
-			$response->withHeader( 'Content-Description', 'File Transfer' );
247
-			$response->withHeader( 'Content-Type', 'application/octet-stream' );
248
-			$response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
249
-			$response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
250
-			$response->withHeader( 'Cache-Control', 'must-revalidate' );
251
-			$response->withHeader( 'Pragma', 'private' );
252
-			$response->withHeader( 'Expires', '0' );
246
+			$response->withHeader('Content-Description', 'File Transfer');
247
+			$response->withHeader('Content-Type', 'application/octet-stream');
248
+			$response->withHeader('Content-Disposition', 'attachment; filename="'.$name.'"');
249
+			$response->withHeader('Content-Length', (string) $fs->size($value));
250
+			$response->withHeader('Cache-Control', 'must-revalidate');
251
+			$response->withHeader('Pragma', 'private');
252
+			$response->withHeader('Expires', '0');
253 253
 
254
-			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
254
+			$response->withBody($response->createStream($fs->reads($value)));
255 255
 		}
256
-		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
256
+		elseif (filter_var($value, FILTER_VALIDATE_URL) !== false)
257 257
 		{
258
-			$response->withHeader( 'Location', $value );
259
-			$response->withStatus( 303 );
258
+			$response->withHeader('Location', $value);
259
+			$response->withStatus(303);
260 260
 		}
261 261
 		else
262 262
 		{
263
-			$response->withStatus( 404 );
263
+			$response->withStatus(404);
264 264
 		}
265 265
 	}
266 266
 
@@ -272,21 +272,21 @@  discard block
 block discarded – undo
272 272
 	 * @param string $id Unique order base product attribute ID referencing the download file
273 273
 	 * @return boolean True if download is allowed, false if not
274 274
 	 */
275
-	protected function checkAccess( $customerId, $id )
275
+	protected function checkAccess($customerId, $id)
276 276
 	{
277
-		if( $customerId !== null && $id !== null )
277
+		if ($customerId !== null && $id !== null)
278 278
 		{
279
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
279
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base');
280 280
 
281 281
 			$search = $manager->createSearch();
282 282
 			$expr = array(
283
-				$search->compare( '==', 'order.base.customerid', $customerId ),
284
-				$search->compare( '==', 'order.base.product.attribute.id', $id ),
283
+				$search->compare('==', 'order.base.customerid', $customerId),
284
+				$search->compare('==', 'order.base.product.attribute.id', $id),
285 285
 			);
286
-			$search->setConditions( $search->combine( '&&', $expr ) );
287
-			$search->setSlice( 0, 1 );
286
+			$search->setConditions($search->combine('&&', $expr));
287
+			$search->setSlice(0, 1);
288 288
 
289
-			if( count( $manager->searchItems( $search ) ) > 0 ) {
289
+			if (count($manager->searchItems($search)) > 0) {
290 290
 				return true;
291 291
 			}
292 292
 		}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param string $id Unique order base product attribute ID referencing the download file
303 303
 	 * @return boolean True if download is allowed, false if not
304 304
 	 */
305
-	protected function checkDownload( $customerId, $id )
305
+	protected function checkDownload($customerId, $id)
306 306
 	{
307 307
 		$context = $this->getContext();
308 308
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 		 * @category Developer
322 322
 		 * @category User
323 323
 		 */
324
-		$maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );
324
+		$maxcnt = $context->getConfig()->get('client/html/account/download/maxcount');
325 325
 
326
-		$listItem = $this->getListItem( $customerId, $id );
326
+		$listItem = $this->getListItem($customerId, $id);
327 327
 		$config = $listItem->getConfig();
328 328
 
329
-		if( !isset( $config['count'] ) ) {
329
+		if (!isset($config['count'])) {
330 330
 			$config['count'] = 0;
331 331
 		}
332 332
 
333
-		if( $maxcnt === null || ((int) $config['count']) < $maxcnt )
333
+		if ($maxcnt === null || ((int) $config['count']) < $maxcnt)
334 334
 		{
335 335
 			$config['count']++;
336
-			$listItem->setConfig( $config );
336
+			$listItem->setConfig($config);
337 337
 
338
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
339
-			$manager->saveItem( $listItem, false );
338
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
339
+			$manager->saveItem($listItem, false);
340 340
 
341 341
 			return true;
342 342
 		}
@@ -352,29 +352,29 @@  discard block
 block discarded – undo
352 352
 	 * @param string $refId Unique order base product attribute ID referencing the download file
353 353
 	 * @return \Aimeos\MSho\Common\Item\Lists\Iface List item object
354 354
 	 */
355
-	protected function getListItem( $customerId, $refId )
355
+	protected function getListItem($customerId, $refId)
356 356
 	{
357
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
357
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
358 358
 
359 359
 		$search = $manager->createSearch();
360 360
 		$expr = array(
361
-			$search->compare( '==', 'customer.lists.parentid', $customerId ),
362
-			$search->compare( '==', 'customer.lists.refid', $refId ),
363
-			$search->compare( '==', 'customer.lists.domain', 'order' ),
364
-			$search->compare( '==', 'customer.lists.type.domain', 'order' ),
365
-			$search->compare( '==', 'customer.lists.type.code', 'download' ),
361
+			$search->compare('==', 'customer.lists.parentid', $customerId),
362
+			$search->compare('==', 'customer.lists.refid', $refId),
363
+			$search->compare('==', 'customer.lists.domain', 'order'),
364
+			$search->compare('==', 'customer.lists.type.domain', 'order'),
365
+			$search->compare('==', 'customer.lists.type.code', 'download'),
366 366
 		);
367
-		$search->setConditions( $search->combine( '&&', $expr ) );
367
+		$search->setConditions($search->combine('&&', $expr));
368 368
 
369
-		$listItems = $manager->searchItems( $search );
369
+		$listItems = $manager->searchItems($search);
370 370
 
371
-		if( ( $listItem = reset( $listItems ) ) === false )
371
+		if (($listItem = reset($listItems)) === false)
372 372
 		{
373 373
 			$listItem = $manager->createItem();
374
-			$listItem->setTypeId( $this->getTypeItem( 'customer/lists/type', 'order', 'download' )->getId() );
375
-			$listItem->setParentId( $customerId );
376
-			$listItem->setDomain( 'order' );
377
-			$listItem->setRefId( $refId );
374
+			$listItem->setTypeId($this->getTypeItem('customer/lists/type', 'order', 'download')->getId());
375
+			$listItem->setParentId($customerId);
376
+			$listItem->setDomain('order');
377
+			$listItem->setRefId($refId);
378 378
 		}
379 379
 
380 380
 		return $listItem;
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Watch/Factory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32 32
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33 33
 	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
35 35
 	{
36 36
 		/** client/html/account/watch/name
37 37
 		 * Class name of the used account watch client implementation
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 		 * @since 2014.03
67 67
 		 * @category Developer
68 68
 		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/watch/name', 'Standard' );
69
+		if ($name === null) {
70
+			$name = $context->getConfig()->get('client/html/account/watch/name', 'Standard');
71 71
 		}
72 72
 
73
-		if( ctype_alnum( $name ) === false )
73
+		if (ctype_alnum($name) === false)
74 74
 		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
75
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\'.$name : '<not a string>';
76
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
77 77
 		}
78 78
 
79 79
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name;
80
+		$classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\'.$name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/watch' );
84
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/watch');
85 85
 	}
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Watch/Standard.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -68,42 +68,42 @@  discard block
 block discarded – undo
68 68
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69 69
 	 * @return string HTML code
70 70
 	 */
71
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
72 72
 	{
73 73
 		$context = $this->getContext();
74 74
 		$view = $this->getView();
75 75
 
76 76
 		try
77 77
 		{
78
-			$view = $this->setViewParams( $view, $tags, $expire );
78
+			$view = $this->setViewParams($view, $tags, $expire);
79 79
 
80 80
 			$html = '';
81
-			foreach( $this->getSubClients() as $subclient ) {
82
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
81
+			foreach ($this->getSubClients() as $subclient) {
82
+				$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
83 83
 			}
84 84
 			$view->watchBody = $html;
85 85
 		}
86
-		catch( \Aimeos\Client\Html\Exception $e )
86
+		catch (\Aimeos\Client\Html\Exception $e)
87 87
 		{
88
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
88
+			$error = array($this->getContext()->getI18n()->dt('client', $e->getMessage()));
89
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
90 90
 		}
91
-		catch( \Aimeos\Controller\Frontend\Exception $e )
91
+		catch (\Aimeos\Controller\Frontend\Exception $e)
92 92
 		{
93
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
93
+			$error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage()));
94
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
95 95
 		}
96
-		catch( \Aimeos\MShop\Exception $e )
96
+		catch (\Aimeos\MShop\Exception $e)
97 97
 		{
98
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
98
+			$error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
99
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
100 100
 		}
101
-		catch( \Exception $e )
101
+		catch (\Exception $e)
102 102
 		{
103
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
103
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
104 104
 
105
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
106
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
105
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
106
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
107 107
 		}
108 108
 
109 109
 		/** client/html/account/watch/standard/template-body
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		$tplconf = 'client/html/account/watch/standard/template-body';
130 130
 		$default = 'account/watch/body-default.php';
131 131
 
132
-		return $view->render( $view->config( $tplconf, $default ) );
132
+		return $view->render($view->config($tplconf, $default));
133 133
 	}
134 134
 
135 135
 
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
142 142
 	 * @return string|null String including HTML tags for the header on error
143 143
 	 */
144
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
144
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
145 145
 	{
146 146
 		try
147 147
 		{
148
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
148
+			$view = $this->setViewParams($this->getView(), $tags, $expire);
149 149
 
150 150
 			$html = '';
151
-			foreach( $this->getSubClients() as $subclient ) {
152
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
151
+			foreach ($this->getSubClients() as $subclient) {
152
+				$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
153 153
 			}
154 154
 			$view->watchHeader = $html;
155 155
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 			$tplconf = 'client/html/account/watch/standard/template-header';
178 178
 			$default = 'account/watch/header-default.php';
179 179
 
180
-			return $view->render( $view->config( $tplconf, $default ) );
180
+			return $view->render($view->config($tplconf, $default));
181 181
 		}
182
-		catch( \Exception $e )
182
+		catch (\Exception $e)
183 183
 		{
184
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
184
+			$this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
185 185
 		}
186 186
 	}
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param string|null $name Name of the sub-client (Default if null)
194 194
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
195 195
 	 */
196
-	public function getSubClient( $type, $name = null )
196
+	public function getSubClient($type, $name = null)
197 197
 	{
198 198
 		/** client/html/account/watch/decorators/excludes
199 199
 		 * Excludes decorators added by the "common" option from the account watch html client
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		 * @see client/html/account/watch/decorators/global
270 270
 		 */
271 271
 
272
-		return $this->createSubClient( 'account/watch/' . $type, $name );
272
+		return $this->createSubClient('account/watch/'.$type, $name);
273 273
 	}
274 274
 
275 275
 
@@ -282,43 +282,43 @@  discard block
 block discarded – undo
282 282
 	{
283 283
 		$view = $this->getView();
284 284
 		$context = $this->getContext();
285
-		$ids = $view->param( 'wat_id', array() );
285
+		$ids = $view->param('wat_id', array());
286 286
 
287
-		if( $context->getUserId() != null && !empty( $ids ) )
287
+		if ($context->getUserId() != null && !empty($ids))
288 288
 		{
289
-			$typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' );
290
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
289
+			$typeItem = $this->getTypeItem('customer/lists/type', 'product', 'watch');
290
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
291 291
 
292 292
 			$search = $manager->createSearch();
293 293
 			$expr = array(
294
-				$search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
295
-				$search->compare( '==', 'customer.lists.refid', $ids ),
296
-				$search->compare( '==', 'customer.lists.domain', 'product' ),
297
-				$search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
294
+				$search->compare('==', 'customer.lists.parentid', $context->getUserId()),
295
+				$search->compare('==', 'customer.lists.refid', $ids),
296
+				$search->compare('==', 'customer.lists.domain', 'product'),
297
+				$search->compare('==', 'customer.lists.typeid', $typeItem->getId()),
298 298
 			);
299
-			$search->setConditions( $search->combine( '&&', $expr ) );
299
+			$search->setConditions($search->combine('&&', $expr));
300 300
 
301 301
 			$items = array();
302
-			foreach( $manager->searchItems( $search ) as $item ) {
302
+			foreach ($manager->searchItems($search) as $item) {
303 303
 				$items[$item->getRefId()] = $item;
304 304
 			}
305 305
 
306 306
 
307
-			switch( $view->param( 'wat_action' ) )
307
+			switch ($view->param('wat_action'))
308 308
 			{
309 309
 				case 'add':
310 310
 
311 311
 					$search = $manager->createSearch();
312 312
 					$expr = array(
313
-						$search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
314
-						$search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
315
-						$search->compare( '==', 'customer.lists.domain', 'product' ),
313
+						$search->compare('==', 'customer.lists.parentid', $context->getUserId()),
314
+						$search->compare('==', 'customer.lists.typeid', $typeItem->getId()),
315
+						$search->compare('==', 'customer.lists.domain', 'product'),
316 316
 					);
317
-					$search->setConditions( $search->combine( '&&', $expr ) );
318
-					$search->setSlice( 0, 0 );
317
+					$search->setConditions($search->combine('&&', $expr));
318
+					$search->setSlice(0, 0);
319 319
 
320 320
 					$total = 0;
321
-					$manager->searchItems( $search, array(), $total );
321
+					$manager->searchItems($search, array(), $total);
322 322
 
323 323
 					/** client/html/account/watch/standard/maxitems
324 324
 					 * Maximum number of products that can be watched in parallel
@@ -338,30 +338,30 @@  discard block
 block discarded – undo
338 338
 					 * @category User
339 339
 					 * @category Developer
340 340
 					 */
341
-					$max = $context->getConfig()->get( 'client/html/account/watch/standard/maxitems', 100 );
341
+					$max = $context->getConfig()->get('client/html/account/watch/standard/maxitems', 100);
342 342
 
343 343
 					$item = $manager->createItem();
344
-					$item->setParentId( $context->getUserId() );
345
-					$item->setTypeId( $typeItem->getId() );
346
-					$item->setDomain( 'product' );
347
-					$item->setStatus( 1 );
344
+					$item->setParentId($context->getUserId());
345
+					$item->setTypeId($typeItem->getId());
346
+					$item->setDomain('product');
347
+					$item->setStatus(1);
348 348
 
349
-					foreach( (array) $view->param( 'wat_id', array() ) as $id )
349
+					foreach ((array) $view->param('wat_id', array()) as $id)
350 350
 					{
351
-						if( $total >= $max )
351
+						if ($total >= $max)
352 352
 						{
353
-							$error = array( sprintf( $context->getI18n()->dt( 'client', 'You can only watch up to %1$s products' ), $max ) );
354
-							$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
353
+							$error = array(sprintf($context->getI18n()->dt('client', 'You can only watch up to %1$s products'), $max));
354
+							$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
355 355
 							break;
356 356
 						}
357 357
 
358
-						if( !isset( $items[$id] ) )
358
+						if (!isset($items[$id]))
359 359
 						{
360
-							$item->setId( null );
361
-							$item->setRefId( $id );
360
+							$item->setId(null);
361
+							$item->setRefId($id);
362 362
 
363
-							$manager->saveItem( $item );
364
-							$manager->moveItem( $item->getId() );
363
+							$manager->saveItem($item);
364
+							$manager->moveItem($item->getId());
365 365
 
366 366
 							$total++;
367 367
 						}
@@ -371,25 +371,25 @@  discard block
 block discarded – undo
371 371
 
372 372
 				case 'edit':
373 373
 
374
-					foreach( (array) $view->param( 'wat_id', array() ) as $id )
374
+					foreach ((array) $view->param('wat_id', array()) as $id)
375 375
 					{
376
-						if( isset( $items[$id] ) )
376
+						if (isset($items[$id]))
377 377
 						{
378 378
 							$item = $items[$id];
379 379
 
380 380
 							$config = array(
381
-								'timeframe' => $view->param( 'wat_timeframe', 7 ),
382
-								'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
383
-								'price' => $view->param( 'wat_price', 0 ),
384
-								'stock' => $view->param( 'wat_stock', 0 ),
381
+								'timeframe' => $view->param('wat_timeframe', 7),
382
+								'pricevalue' => $view->param('wat_pricevalue', '0.00'),
383
+								'price' => $view->param('wat_price', 0),
384
+								'stock' => $view->param('wat_stock', 0),
385 385
 								'currency' => $context->getLocale()->getCurrencyId(),
386 386
 							);
387
-							$time = time() + ( $config['timeframe'] + 1 ) * 86400;
387
+							$time = time() + ($config['timeframe'] + 1) * 86400;
388 388
 
389
-							$item->setDateEnd( date( 'Y-m-d 00:00:00', $time ) );
390
-							$item->setConfig( $config );
389
+							$item->setDateEnd(date('Y-m-d 00:00:00', $time));
390
+							$item->setConfig($config);
391 391
 
392
-							$manager->saveItem( $item );
392
+							$manager->saveItem($item);
393 393
 						}
394 394
 					}
395 395
 
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 
400 400
 					$listIds = array();
401 401
 
402
-					foreach( (array) $view->param( 'wat_id', array() ) as $id )
402
+					foreach ((array) $view->param('wat_id', array()) as $id)
403 403
 					{
404
-						if( isset( $items[$id] ) ) {
404
+						if (isset($items[$id])) {
405 405
 							$listIds[] = $items[$id]->getId();
406 406
 						}
407 407
 					}
408 408
 
409
-					$manager->deleteItems( $listIds );
409
+					$manager->deleteItems($listIds);
410 410
 					break;
411 411
 			}
412 412
 		}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	protected function getSubClientNames()
424 424
 	{
425
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
425
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
426 426
 	}
427 427
 
428 428
 
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
433 433
 	 * @return integer Page number starting from 1
434 434
 	 */
435
-	protected function getProductListPage( \Aimeos\MW\View\Iface $view )
435
+	protected function getProductListPage(\Aimeos\MW\View\Iface $view)
436 436
 	{
437
-		$page = (int) $view->param( 'wat_page', 1 );
438
-		return ( $page < 1 ? 1 : $page );
437
+		$page = (int) $view->param('wat_page', 1);
438
+		return ($page < 1 ? 1 : $page);
439 439
 	}
440 440
 
441 441
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
446 446
 	 * @return integer Page size
447 447
 	 */
448
-	protected function getProductListSize( \Aimeos\MW\View\Iface $view )
448
+	protected function getProductListSize(\Aimeos\MW\View\Iface $view)
449 449
 	{
450 450
 		/** client/html/account/watch/size
451 451
 		 * The number of products shown in a list page for watch products
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 		 * @category Developer
467 467
 		 * @see client/html/catalog/lists/size
468 468
 		 */
469
-		$defaultSize = $this->getContext()->getConfig()->get( 'client/html/account/watch/size', 48 );
469
+		$defaultSize = $this->getContext()->getConfig()->get('client/html/account/watch/size', 48);
470 470
 
471
-		$size = (int) $view->param( 'watch-size', $defaultSize );
472
-		return ( $size < 1 || $size > 100 ? $defaultSize : $size );
471
+		$size = (int) $view->param('watch-size', $defaultSize);
472
+		return ($size < 1 || $size > 100 ? $defaultSize : $size);
473 473
 	}
474 474
 
475 475
 
@@ -481,33 +481,33 @@  discard block
 block discarded – undo
481 481
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
482 482
 	 * @return \Aimeos\MW\View\Iface Modified view object
483 483
 	 */
484
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
484
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
485 485
 	{
486
-		if( !isset( $this->cache ) )
486
+		if (!isset($this->cache))
487 487
 		{
488 488
 			$total = 0;
489 489
 			$productIds = array();
490 490
 			$context = $this->getContext();
491
-			$typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' );
491
+			$typeItem = $this->getTypeItem('customer/lists/type', 'product', 'watch');
492 492
 
493
-			$size = $this->getProductListSize( $view );
494
-			$current = $this->getProductListPage( $view );
495
-			$last = ( $total != 0 ? ceil( $total / $size ) : 1 );
493
+			$size = $this->getProductListSize($view);
494
+			$current = $this->getProductListPage($view);
495
+			$last = ($total != 0 ? ceil($total / $size) : 1);
496 496
 
497 497
 
498
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
498
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
499 499
 
500 500
 			$search = $manager->createSearch();
501 501
 			$expr = array(
502
-				$search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
503
-				$search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
504
-				$search->compare( '==', 'customer.lists.domain', 'product' ),
502
+				$search->compare('==', 'customer.lists.parentid', $context->getUserId()),
503
+				$search->compare('==', 'customer.lists.typeid', $typeItem->getId()),
504
+				$search->compare('==', 'customer.lists.domain', 'product'),
505 505
 			);
506
-			$search->setConditions( $search->combine( '&&', $expr ) );
507
-			$search->setSortations( array( $search->sort( '-', 'customer.lists.position' ) ) );
508
-			$search->setSlice( ( $current - 1 ) * $size, $size );
506
+			$search->setConditions($search->combine('&&', $expr));
507
+			$search->setSortations(array($search->sort('-', 'customer.lists.position')));
508
+			$search->setSlice(($current - 1) * $size, $size);
509 509
 
510
-			$view->watchListItems = $manager->searchItems( $search, array(), $total );
510
+			$view->watchListItems = $manager->searchItems($search, array(), $total);
511 511
 
512 512
 
513 513
 			/** client/html/account/watch/domains
@@ -526,19 +526,19 @@  discard block
 block discarded – undo
526 526
 			 * @category Developer
527 527
 			 * @see client/html/catalog/domains
528 528
 			 */
529
-			$default = array( 'text', 'price', 'media' );
530
-			$domains = $context->getConfig()->get( 'client/html/account/watch/domains', $default );
529
+			$default = array('text', 'price', 'media');
530
+			$domains = $context->getConfig()->get('client/html/account/watch/domains', $default);
531 531
 
532
-			foreach( $view->watchListItems as $listItem ) {
532
+			foreach ($view->watchListItems as $listItem) {
533 533
 				$productIds[] = $listItem->getRefId();
534 534
 			}
535 535
 
536
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
536
+			$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
537 537
 
538
-			$view->watchProductItems = $controller->getProductItems( $productIds, $domains );
538
+			$view->watchProductItems = $controller->getProductItems($productIds, $domains);
539 539
 			$view->watchPageFirst = 1;
540
-			$view->watchPagePrev = ( $current > 1 ? $current - 1 : 1 );
541
-			$view->watchPageNext = ( $current < $last ? $current + 1 : $last );
540
+			$view->watchPagePrev = ($current > 1 ? $current - 1 : 1);
541
+			$view->watchPageNext = ($current < $last ? $current + 1 : $last);
542 542
 			$view->watchPageLast = $last;
543 543
 			$view->watchPageCurr = $current;
544 544
 
Please login to merge, or discard this patch.
html/src/Client/Html/Email/Delivery/Html/Summary/Service/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68 68
 	 * @return string HTML code
69 69
 	*/
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
71 71
 	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
72
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
73 73
 
74 74
 		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
75
+		foreach ($this->getSubClients() as $subclient) {
76
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
77 77
 		}
78 78
 		$view->serviceBody = $html;
79 79
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-body';
102 102
 		$default = 'common/summary/service-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
104
+		return $view->render($view->config($tplconf, $default));
105 105
 	}
106 106
 
107 107
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string|null String including HTML tags for the header on error
115 115
 	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
119 119
 
120 120
 		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
121
+		foreach ($this->getSubClients() as $subclient) {
122
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
123 123
 		}
124 124
 		$view->serviceHeader = $html;
125 125
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-header';
149 149
 		$default = 'common/summary/service-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
151
+		return $view->render($view->config($tplconf, $default));
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string|null $name Name of the sub-client (Default if null)
160 160
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
161 161
 	 */
162
-	public function getSubClient( $type, $name = null )
162
+	public function getSubClient($type, $name = null)
163 163
 	{
164 164
 		/** client/html/email/delivery/html/summary/service/decorators/excludes
165 165
 		 * Excludes decorators added by the "common" option from the email delivery html summary service html client
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		 * @see client/html/email/delivery/html/summary/service/decorators/global
236 236
 		 */
237 237
 
238
-		return $this->createSubClient( 'email/delivery/html/summary/service/' . $type, $name );
238
+		return $this->createSubClient('email/delivery/html/summary/service/'.$type, $name);
239 239
 	}
240 240
 
241 241
 
@@ -246,6 +246,6 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function getSubClientNames()
248 248
 	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
249
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.