@@ -68,13 +68,13 @@ discard block |
||
| 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 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->addressBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/checkout/standard/summary/address/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/address-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->addressHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/checkout/standard/summary/address/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/address-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/checkout/standard/summary/address/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the checkout standard summary address html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/checkout/standard/summary/address/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/address/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('checkout/standard/summary/address/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,18 +259,18 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 264 | + $view = parent::setViewParams($view, $tags, $expire); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 266 | + if (!isset($this->cache)) |
|
| 267 | 267 | { |
| 268 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 270 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 268 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 269 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 270 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 271 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 272 | 272 | |
| 273 | - $url = $view->url( $target, $cntl, $action, array( 'c_step' => 'address' ), array(), $config ); |
|
| 273 | + $url = $view->url($target, $cntl, $action, array('c_step' => 'address'), array(), $config); |
|
| 274 | 274 | |
| 275 | 275 | $view->summaryUrlAddressBilling = $url; |
| 276 | 276 | $view->summaryUrlAddressDelivery = $url; |
@@ -31,7 +31,7 @@ discard block |
||
| 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/checkout/standard/name |
| 37 | 37 | * Class name of the used checkout standard client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/checkout/standard/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/checkout/standard/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\\Checkout\\Standard\\' . $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\\Checkout\\Standard\\'.$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\\Checkout\\Standard\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Checkout\\Standard\\'.$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, 'checkout/standard' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'checkout/standard'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'delivery' ); |
|
| 16 | +sprintf('delivery'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 73 | 73 | * @return string HTML code |
| 74 | 74 | */ |
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 76 | 76 | { |
| 77 | 77 | $view = $this->getView(); |
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 78 | + $step = $view->get('standardStepActive'); |
|
| 79 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 80 | 80 | |
| 81 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 81 | + if ($step != 'delivery' && !(in_array('delivery', $onepage) && in_array($step, $onepage))) { |
|
| 82 | 82 | return ''; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 85 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 86 | 86 | |
| 87 | 87 | $html = ''; |
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | + foreach ($this->getSubClients() as $subclient) { |
|
| 89 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 90 | 90 | } |
| 91 | 91 | $view->deliveryBody = $html; |
| 92 | 92 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $tplconf = 'client/html/checkout/standard/delivery/standard/template-body'; |
| 114 | 114 | $default = 'checkout/standard/delivery-body-default.php'; |
| 115 | 115 | |
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 116 | + return $view->render($view->config($tplconf, $default)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,21 +125,21 @@ discard block |
||
| 125 | 125 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 126 | 126 | * @return string|null String including HTML tags for the header on error |
| 127 | 127 | */ |
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 128 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 129 | 129 | { |
| 130 | 130 | $view = $this->getView(); |
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 131 | + $step = $view->get('standardStepActive'); |
|
| 132 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 133 | 133 | |
| 134 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 134 | + if ($step != 'delivery' && !(in_array('delivery', $onepage) && in_array($step, $onepage))) { |
|
| 135 | 135 | return ''; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 138 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 139 | 139 | |
| 140 | 140 | $html = ''; |
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 141 | + foreach ($this->getSubClients() as $subclient) { |
|
| 142 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 143 | 143 | } |
| 144 | 144 | $view->deliveryHeader = $html; |
| 145 | 145 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $tplconf = 'client/html/checkout/standard/delivery/standard/template-header'; |
| 168 | 168 | $default = 'checkout/standard/delivery-header-default.php'; |
| 169 | 169 | |
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + return $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string|null $name Name of the sub-client (Default if null) |
| 179 | 179 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 180 | 180 | */ |
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 181 | + public function getSubClient($type, $name = null) |
|
| 182 | 182 | { |
| 183 | 183 | /** client/html/checkout/standard/delivery/decorators/excludes |
| 184 | 184 | * Excludes decorators added by the "common" option from the checkout standard delivery html client |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see client/html/checkout/standard/delivery/decorators/global |
| 255 | 255 | */ |
| 256 | 256 | |
| 257 | - return $this->createSubClient( 'checkout/standard/delivery/' . $type, $name ); |
|
| 257 | + return $this->createSubClient('checkout/standard/delivery/'.$type, $name); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | try |
| 271 | 271 | { |
| 272 | 272 | $context = $this->getContext(); |
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 274 | 274 | |
| 275 | 275 | // only start if there's something to do |
| 276 | - if( ( $serviceId = $view->param( 'c_deliveryoption', null ) ) !== null ) |
|
| 276 | + if (($serviceId = $view->param('c_deliveryoption', null)) !== null) |
|
| 277 | 277 | { |
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 279 | 279 | |
| 280 | - $attributes = $view->param( 'c_delivery/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'delivery', $serviceId, $attributes ); |
|
| 280 | + $attributes = $view->param('c_delivery/'.$serviceId, array()); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes('delivery', $serviceId, $attributes); |
|
| 282 | 282 | |
| 283 | - foreach( $errors as $key => $msg ) |
|
| 283 | + foreach ($errors as $key => $msg) |
|
| 284 | 284 | { |
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 285 | + if ($msg === null) { |
|
| 286 | + unset($errors[$key]); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'delivery', $serviceId, $attributes ); |
|
| 290 | + if (count($errors) === 0) { |
|
| 291 | + $basketCtrl->setService('delivery', $serviceId, $attributes); |
|
| 292 | 292 | } else { |
| 293 | 293 | $view->standardStepActive = 'delivery'; |
| 294 | 294 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // Test if delivery service is available |
| 304 | 304 | $services = $basketCtrl->get()->getServices(); |
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'delivery', $services ) ) |
|
| 305 | + if (!isset($view->standardStepActive) && !array_key_exists('delivery', $services)) |
|
| 306 | 306 | { |
| 307 | 307 | $view->standardStepActive = 'delivery'; |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | - catch( \Exception $e ) |
|
| 311 | + catch (\Exception $e) |
|
| 312 | 312 | { |
| 313 | 313 | $view->standardStepActive = 'delivery'; |
| 314 | 314 | throw $e; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected function getSubClientNames() |
| 325 | 325 | { |
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 326 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
@@ -335,24 +335,24 @@ discard block |
||
| 335 | 335 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 336 | 336 | * @return \Aimeos\MW\View\Iface Modified view object |
| 337 | 337 | */ |
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 338 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 339 | 339 | { |
| 340 | - if( !isset( $this->cache ) ) |
|
| 340 | + if (!isset($this->cache)) |
|
| 341 | 341 | { |
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | |
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 346 | 346 | |
| 347 | 347 | $basket = $basketCntl->get(); |
| 348 | 348 | |
| 349 | - $services = $serviceCntl->getServices( 'delivery', $basket ); |
|
| 349 | + $services = $serviceCntl->getServices('delivery', $basket); |
|
| 350 | 350 | $serviceAttributes = $servicePrices = array(); |
| 351 | 351 | |
| 352 | - foreach( $services as $id => $service ) |
|
| 352 | + foreach ($services as $id => $service) |
|
| 353 | 353 | { |
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'delivery', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'delivery', $id, $basket ); |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes('delivery', $id, $basket); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice('delivery', $id, $basket); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $view->deliveryServices = $services; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'payment' ); |
|
| 16 | +sprintf('payment'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 73 | 73 | * @return string HTML code |
| 74 | 74 | */ |
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 76 | 76 | { |
| 77 | 77 | $view = $this->getView(); |
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 78 | + $step = $view->get('standardStepActive'); |
|
| 79 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 80 | 80 | |
| 81 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 81 | + if ($step != 'payment' && !(in_array('payment', $onepage) && in_array($step, $onepage))) { |
|
| 82 | 82 | return ''; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 85 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 86 | 86 | |
| 87 | 87 | $html = ''; |
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | + foreach ($this->getSubClients() as $subclient) { |
|
| 89 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 90 | 90 | } |
| 91 | 91 | $view->paymentBody = $html; |
| 92 | 92 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $tplconf = 'client/html/checkout/standard/payment/standard/template-body'; |
| 114 | 114 | $default = 'checkout/standard/payment-body-default.php'; |
| 115 | 115 | |
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 116 | + return $view->render($view->config($tplconf, $default)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,21 +125,21 @@ discard block |
||
| 125 | 125 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 126 | 126 | * @return string|null String including HTML tags for the header on error |
| 127 | 127 | */ |
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 128 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 129 | 129 | { |
| 130 | 130 | $view = $this->getView(); |
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 131 | + $step = $view->get('standardStepActive'); |
|
| 132 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 133 | 133 | |
| 134 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 134 | + if ($step != 'payment' && !(in_array('payment', $onepage) && in_array($step, $onepage))) { |
|
| 135 | 135 | return ''; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 138 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 139 | 139 | |
| 140 | 140 | $html = ''; |
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 141 | + foreach ($this->getSubClients() as $subclient) { |
|
| 142 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 143 | 143 | } |
| 144 | 144 | $view->paymentHeader = $html; |
| 145 | 145 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $tplconf = 'client/html/checkout/standard/payment/standard/template-header'; |
| 168 | 168 | $default = 'checkout/standard/payment-header-default.php'; |
| 169 | 169 | |
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + return $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string|null $name Name of the sub-client (Default if null) |
| 179 | 179 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 180 | 180 | */ |
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 181 | + public function getSubClient($type, $name = null) |
|
| 182 | 182 | { |
| 183 | 183 | /** client/html/checkout/standard/payment/decorators/excludes |
| 184 | 184 | * Excludes decorators added by the "common" option from the checkout standard payment html client |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see client/html/checkout/standard/payment/decorators/global |
| 255 | 255 | */ |
| 256 | 256 | |
| 257 | - return $this->createSubClient( 'checkout/standard/payment/' . $type, $name ); |
|
| 257 | + return $this->createSubClient('checkout/standard/payment/'.$type, $name); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | try |
| 271 | 271 | { |
| 272 | 272 | $context = $this->getContext(); |
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 274 | 274 | |
| 275 | 275 | // only start if there's something to do |
| 276 | - if( ( $serviceId = $view->param( 'c_paymentoption', null ) ) !== null ) |
|
| 276 | + if (($serviceId = $view->param('c_paymentoption', null)) !== null) |
|
| 277 | 277 | { |
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 279 | 279 | |
| 280 | - $attributes = $view->param( 'c_payment/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'payment', $serviceId, $attributes ); |
|
| 280 | + $attributes = $view->param('c_payment/'.$serviceId, array()); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes('payment', $serviceId, $attributes); |
|
| 282 | 282 | |
| 283 | - foreach( $errors as $key => $msg ) |
|
| 283 | + foreach ($errors as $key => $msg) |
|
| 284 | 284 | { |
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 285 | + if ($msg === null) { |
|
| 286 | + unset($errors[$key]); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'payment', $serviceId, $attributes ); |
|
| 290 | + if (count($errors) === 0) { |
|
| 291 | + $basketCtrl->setService('payment', $serviceId, $attributes); |
|
| 292 | 292 | } else { |
| 293 | 293 | $view->standardStepActive = 'payment'; |
| 294 | 294 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // Test if payment service is available |
| 304 | 304 | $services = $basketCtrl->get()->getServices(); |
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'payment', $services ) ) |
|
| 305 | + if (!isset($view->standardStepActive) && !array_key_exists('payment', $services)) |
|
| 306 | 306 | { |
| 307 | 307 | $view->standardStepActive = 'payment'; |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | - catch( \Exception $e ) |
|
| 311 | + catch (\Exception $e) |
|
| 312 | 312 | { |
| 313 | 313 | $view->standardStepActive = 'payment'; |
| 314 | 314 | throw $e; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected function getSubClientNames() |
| 325 | 325 | { |
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 326 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
@@ -335,24 +335,24 @@ discard block |
||
| 335 | 335 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 336 | 336 | * @return \Aimeos\MW\View\Iface Modified view object |
| 337 | 337 | */ |
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 338 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 339 | 339 | { |
| 340 | - if( !isset( $this->cache ) ) |
|
| 340 | + if (!isset($this->cache)) |
|
| 341 | 341 | { |
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | |
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 346 | 346 | |
| 347 | 347 | $basket = $basketCntl->get(); |
| 348 | 348 | |
| 349 | - $services = $serviceCntl->getServices( 'payment', $basket ); |
|
| 349 | + $services = $serviceCntl->getServices('payment', $basket); |
|
| 350 | 350 | $serviceAttributes = $servicePrices = array(); |
| 351 | 351 | |
| 352 | - foreach( $services as $id => $service ) |
|
| 352 | + foreach ($services as $id => $service) |
|
| 353 | 353 | { |
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'payment', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'payment', $id, $basket ); |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes('payment', $id, $basket); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice('payment', $id, $basket); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $view->paymentServices = $services; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'address' ); |
|
| 16 | +sprintf('address'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @since 2014.03 |
| 83 | 83 | * @category Developer |
| 84 | 84 | */ |
| 85 | - private $subPartNames = array( 'billing', 'delivery' ); |
|
| 85 | + private $subPartNames = array('billing', 'delivery'); |
|
| 86 | 86 | |
| 87 | 87 | private $cache; |
| 88 | 88 | |
@@ -95,21 +95,21 @@ discard block |
||
| 95 | 95 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 96 | 96 | * @return string HTML code |
| 97 | 97 | */ |
| 98 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 98 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 99 | 99 | { |
| 100 | 100 | $view = $this->getView(); |
| 101 | - $step = $view->get( 'standardStepActive', 'address' ); |
|
| 102 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 101 | + $step = $view->get('standardStepActive', 'address'); |
|
| 102 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 103 | 103 | |
| 104 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 104 | + if ($step != 'address' && !(in_array('address', $onepage) && in_array($step, $onepage))) { |
|
| 105 | 105 | return ''; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 108 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 109 | 109 | |
| 110 | 110 | $html = ''; |
| 111 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 112 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 111 | + foreach ($this->getSubClients() as $subclient) { |
|
| 112 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 113 | 113 | } |
| 114 | 114 | $view->addressBody = $html; |
| 115 | 115 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $tplconf = 'client/html/checkout/standard/address/standard/template-body'; |
| 137 | 137 | $default = 'checkout/standard/address-body-default.php'; |
| 138 | 138 | |
| 139 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 139 | + return $view->render($view->config($tplconf, $default)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 149 | 149 | * @return string|null String including HTML tags for the header on error |
| 150 | 150 | */ |
| 151 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 151 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 152 | 152 | { |
| 153 | 153 | $view = $this->getView(); |
| 154 | - $step = $view->get( 'standardStepActive' ); |
|
| 155 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 154 | + $step = $view->get('standardStepActive'); |
|
| 155 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 156 | 156 | |
| 157 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 157 | + if ($step != 'address' && !(in_array('address', $onepage) && in_array($step, $onepage))) { |
|
| 158 | 158 | return ''; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 161 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 162 | 162 | |
| 163 | 163 | $html = ''; |
| 164 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 165 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 164 | + foreach ($this->getSubClients() as $subclient) { |
|
| 165 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 166 | 166 | } |
| 167 | 167 | $view->addressHeader = $html; |
| 168 | 168 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $tplconf = 'client/html/checkout/standard/address/standard/template-header'; |
| 191 | 191 | $default = 'checkout/standard/address-header-default.php'; |
| 192 | 192 | |
| 193 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 193 | + return $view->render($view->config($tplconf, $default)); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param string|null $name Name of the sub-client (Default if null) |
| 202 | 202 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 203 | 203 | */ |
| 204 | - public function getSubClient( $type, $name = null ) |
|
| 204 | + public function getSubClient($type, $name = null) |
|
| 205 | 205 | { |
| 206 | 206 | /** client/html/checkout/standard/address/decorators/excludes |
| 207 | 207 | * Excludes decorators added by the "common" option from the checkout standard address html client |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @see client/html/checkout/standard/address/decorators/global |
| 278 | 278 | */ |
| 279 | 279 | |
| 280 | - return $this->createSubClient( 'checkout/standard/address/' . $type, $name ); |
|
| 280 | + return $this->createSubClient('checkout/standard/address/'.$type, $name); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -294,17 +294,17 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | parent::process(); |
| 296 | 296 | |
| 297 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 297 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 298 | 298 | |
| 299 | 299 | // Test if addresses are available |
| 300 | 300 | $addresses = $basketCntl->get()->getAddresses(); |
| 301 | - if( !isset( $view->standardStepActive ) && count( $addresses ) === 0 ) |
|
| 301 | + if (!isset($view->standardStepActive) && count($addresses) === 0) |
|
| 302 | 302 | { |
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - catch( \Exception $e ) |
|
| 307 | + catch (\Exception $e) |
|
| 308 | 308 | { |
| 309 | 309 | $this->getView()->standardStepActive = 'address'; |
| 310 | 310 | throw $e; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected function getSubClientNames() |
| 322 | 322 | { |
| 323 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 323 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -332,44 +332,44 @@ discard block |
||
| 332 | 332 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 333 | 333 | * @return \Aimeos\MW\View\Iface Modified view object |
| 334 | 334 | */ |
| 335 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 335 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 336 | 336 | { |
| 337 | - if( !isset( $this->cache ) ) |
|
| 337 | + if (!isset($this->cache)) |
|
| 338 | 338 | { |
| 339 | 339 | $context = $this->getContext(); |
| 340 | 340 | |
| 341 | 341 | |
| 342 | - $customerManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 342 | + $customerManager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 343 | 343 | |
| 344 | - $search = $customerManager->createSearch( true ); |
|
| 344 | + $search = $customerManager->createSearch(true); |
|
| 345 | 345 | $expr = array( |
| 346 | - $search->compare( '==', 'customer.id', $context->getUserId() ), |
|
| 346 | + $search->compare('==', 'customer.id', $context->getUserId()), |
|
| 347 | 347 | $search->getConditions(), |
| 348 | 348 | ); |
| 349 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 349 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 350 | 350 | |
| 351 | - $items = $customerManager->searchItems( $search ); |
|
| 351 | + $items = $customerManager->searchItems($search); |
|
| 352 | 352 | |
| 353 | - if( ( $item = reset( $items ) ) !== false ) |
|
| 353 | + if (($item = reset($items)) !== false) |
|
| 354 | 354 | { |
| 355 | 355 | $deliveryAddressItems = array(); |
| 356 | 356 | |
| 357 | - $orderAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' ); |
|
| 358 | - $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 357 | + $orderAddressManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/address'); |
|
| 358 | + $customerAddressManager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 359 | 359 | |
| 360 | 360 | $search = $customerAddressManager->createSearch(); |
| 361 | - $search->setConditions( $search->compare( '==', 'customer.address.parentid', $item->getId() ) ); |
|
| 361 | + $search->setConditions($search->compare('==', 'customer.address.parentid', $item->getId())); |
|
| 362 | 362 | |
| 363 | - foreach( $customerAddressManager->searchItems( $search ) as $id => $address ) |
|
| 363 | + foreach ($customerAddressManager->searchItems($search) as $id => $address) |
|
| 364 | 364 | { |
| 365 | 365 | $deliveryAddressItem = $orderAddressManager->createItem(); |
| 366 | - $deliveryAddressItem->copyFrom( $address ); |
|
| 366 | + $deliveryAddressItem->copyFrom($address); |
|
| 367 | 367 | |
| 368 | 368 | $deliveryAddressItems[$id] = $deliveryAddressItem; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $paymentAddressItem = $orderAddressManager->createItem(); |
| 372 | - $paymentAddressItem->copyFrom( $item->getPaymentAddress() ); |
|
| 372 | + $paymentAddressItem->copyFrom($item->getPaymentAddress()); |
|
| 373 | 373 | |
| 374 | 374 | $view->addressCustomerItem = $item; |
| 375 | 375 | $view->addressPaymentItem = $paymentAddressItem; |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 381 | - $locales = $localeManager->searchItems( $localeManager->createSearch( true ) ); |
|
| 380 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 381 | + $locales = $localeManager->searchItems($localeManager->createSearch(true)); |
|
| 382 | 382 | |
| 383 | 383 | $languages = array(); |
| 384 | - foreach( $locales as $locale ) { |
|
| 384 | + foreach ($locales as $locale) { |
|
| 385 | 385 | $languages[$locale->getLanguageId()] = $locale->getLanguageId(); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | * @see client/html/checkout/standard/address/delivery/mandatory |
| 419 | 419 | * @see client/html/checkout/standard/address/delivery/optional |
| 420 | 420 | */ |
| 421 | - $view->addressCountries = $view->config( 'client/html/checkout/standard/address/countries', array() ); |
|
| 421 | + $view->addressCountries = $view->config('client/html/checkout/standard/address/countries', array()); |
|
| 422 | 422 | |
| 423 | 423 | /** client/html/checkout/standard/address/states |
| 424 | 424 | * List of available states that that users can select from in the front-end |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | * @see client/html/checkout/standard/address/delivery/mandatory |
| 466 | 466 | * @see client/html/checkout/standard/address/delivery/optional |
| 467 | 467 | */ |
| 468 | - $view->addressStates = $view->config( 'client/html/checkout/standard/address/states', array() ); |
|
| 468 | + $view->addressStates = $view->config('client/html/checkout/standard/address/states', array()); |
|
| 469 | 469 | |
| 470 | 470 | |
| 471 | 471 | $this->cache = $view; |
@@ -31,7 +31,7 @@ discard block |
||
| 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/checkout/update/name |
| 37 | 37 | * Class name of the used checkout update client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/checkout/update/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/checkout/update/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\\Checkout\\Update\\' . $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\\Checkout\\Update\\'.$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\\Checkout\\Update\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Checkout\\Update\\'.$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, 'checkout/update' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'checkout/update'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -67,42 +67,42 @@ discard block |
||
| 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 | 72 | $context = $this->getContext(); |
| 73 | 73 | $view = $this->getView(); |
| 74 | 74 | |
| 75 | 75 | try |
| 76 | 76 | { |
| 77 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 77 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 78 | 78 | |
| 79 | 79 | $html = ''; |
| 80 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 81 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | + foreach ($this->getSubClients() as $subclient) { |
|
| 81 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 82 | 82 | } |
| 83 | 83 | $view->updateBody = $html; |
| 84 | 84 | } |
| 85 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 85 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 86 | 86 | { |
| 87 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 88 | - $view->updateErrorList = $view->get( 'updateErrorList', array() ) + $error; |
|
| 87 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 88 | + $view->updateErrorList = $view->get('updateErrorList', array()) + $error; |
|
| 89 | 89 | } |
| 90 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 90 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 91 | 91 | { |
| 92 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 93 | - $view->updateErrorList = $view->get( 'updateErrorList', array() ) + $error; |
|
| 92 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 93 | + $view->updateErrorList = $view->get('updateErrorList', array()) + $error; |
|
| 94 | 94 | } |
| 95 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 95 | + catch (\Aimeos\MShop\Exception $e) |
|
| 96 | 96 | { |
| 97 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 98 | - $view->updateErrorList = $view->get( 'updateErrorList', array() ) + $error; |
|
| 97 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 98 | + $view->updateErrorList = $view->get('updateErrorList', array()) + $error; |
|
| 99 | 99 | } |
| 100 | - catch( \Exception $e ) |
|
| 100 | + catch (\Exception $e) |
|
| 101 | 101 | { |
| 102 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 102 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 103 | 103 | |
| 104 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 105 | - $view->updateErrorList = $view->get( 'updateErrorList', array() ) + $error; |
|
| 104 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 105 | + $view->updateErrorList = $view->get('updateErrorList', array()) + $error; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** client/html/checkout/update/standard/template-body |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $tplconf = 'client/html/checkout/update/standard/template-body'; |
| 129 | 129 | $default = 'checkout/update/body-default.php'; |
| 130 | 130 | |
| 131 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 131 | + return $view->render($view->config($tplconf, $default)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 141 | 141 | * @return string|null String including HTML tags for the header on error |
| 142 | 142 | */ |
| 143 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 143 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 144 | 144 | { |
| 145 | 145 | try |
| 146 | 146 | { |
| 147 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 147 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 148 | 148 | |
| 149 | 149 | $html = ''; |
| 150 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 151 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 150 | + foreach ($this->getSubClients() as $subclient) { |
|
| 151 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 152 | 152 | } |
| 153 | 153 | $view->updateHeader = $html; |
| 154 | 154 | |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | $tplconf = 'client/html/checkout/update/standard/template-header'; |
| 177 | 177 | $default = 'checkout/update/header-default.php'; |
| 178 | 178 | |
| 179 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 179 | + return $view->render($view->config($tplconf, $default)); |
|
| 180 | 180 | } |
| 181 | - catch( \Exception $e ) |
|
| 181 | + catch (\Exception $e) |
|
| 182 | 182 | { |
| 183 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 183 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param string|null $name Name of the sub-client (Default if null) |
| 193 | 193 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 194 | 194 | */ |
| 195 | - public function getSubClient( $type, $name = null ) |
|
| 195 | + public function getSubClient($type, $name = null) |
|
| 196 | 196 | { |
| 197 | 197 | /** client/html/checkout/update/decorators/excludes |
| 198 | 198 | * Excludes decorators added by the "common" option from the checkout update html client |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @see client/html/checkout/update/decorators/global |
| 269 | 269 | */ |
| 270 | 270 | |
| 271 | - return $this->createSubClient( 'checkout/update/' . $type, $name ); |
|
| 271 | + return $this->createSubClient('checkout/update/'.$type, $name); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
@@ -284,16 +284,16 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | try |
| 286 | 286 | { |
| 287 | - $provider = $this->getServiceProvider( $view->param( 'code' ) ); |
|
| 287 | + $provider = $this->getServiceProvider($view->param('code')); |
|
| 288 | 288 | |
| 289 | - $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 290 | - $params = array( 'code' => $view->param( 'code' ), 'orderid' => $view->param( 'orderid' ) ); |
|
| 289 | + $config = array('absoluteUri' => true, 'namespace' => false); |
|
| 290 | + $params = array('code' => $view->param('code'), 'orderid' => $view->param('orderid')); |
|
| 291 | 291 | $urls = array( |
| 292 | - 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 293 | - 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 292 | + 'payment.url-success' => $this->getUrlConfirm($view, $params, $config), |
|
| 293 | + 'payment.url-update' => $this->getUrlUpdate($view, $params, $config), |
|
| 294 | 294 | ); |
| 295 | 295 | $urls['payment.url-self'] = $urls['payment.url-update']; |
| 296 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 296 | + $provider->injectGlobalConfigBE($urls); |
|
| 297 | 297 | |
| 298 | 298 | $response = null; |
| 299 | 299 | $headers = array(); |
@@ -302,24 +302,24 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | $body = $view->request()->getBody(); |
| 304 | 304 | |
| 305 | - if( ( $orderItem = $provider->updateSync( $view->param(), $body, $response, $headers ) ) !== null ) { |
|
| 306 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); // stock, coupons |
|
| 305 | + if (($orderItem = $provider->updateSync($view->param(), $body, $response, $headers)) !== null) { |
|
| 306 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem); // stock, coupons |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | $view->updateMessage = $response; |
| 310 | 310 | } |
| 311 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 311 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
| 312 | 312 | { |
| 313 | 313 | $view->updateMessage = $e->getMessage(); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if( !empty( $headers ) ) { |
|
| 316 | + if (!empty($headers)) { |
|
| 317 | 317 | $view->updateHttpHeaders = $headers; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | parent::process(); |
| 321 | 321 | } |
| 322 | - catch( \Exception $e ) |
|
| 322 | + catch (\Exception $e) |
|
| 323 | 323 | { |
| 324 | 324 | /** client/html/checkout/standard/update/http-error |
| 325 | 325 | * HTTP header sent for failed attempts to update the order status |
@@ -334,16 +334,16 @@ discard block |
||
| 334 | 334 | * @category Developer |
| 335 | 335 | * @see client/html/checkout/standard/update/http-success |
| 336 | 336 | */ |
| 337 | - $default = array( 'HTTP/1.1 500 Error updating order status' ); |
|
| 338 | - $headerList = $context->getConfig()->get( 'client/html/checkout/standard/update/http-error', $default ); |
|
| 337 | + $default = array('HTTP/1.1 500 Error updating order status'); |
|
| 338 | + $headerList = $context->getConfig()->get('client/html/checkout/standard/update/http-error', $default); |
|
| 339 | 339 | |
| 340 | 340 | $view->updateHttpHeaders = $headerList; |
| 341 | 341 | $view->updateMessage = $e->getMessage(); |
| 342 | 342 | |
| 343 | 343 | $body = $view->request()->getBody(); |
| 344 | - $params = print_r( $view->param(), true ); |
|
| 344 | + $params = print_r($view->param(), true); |
|
| 345 | 345 | $msg = "Updating order status failed: %1\$s\n%2\$s\n%3\$s"; |
| 346 | - $context->getLogger()->log( sprintf( $msg, $e->getMessage(), $params, $body ) ); |
|
| 346 | + $context->getLogger()->log(sprintf($msg, $e->getMessage(), $params, $body)); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
@@ -355,22 +355,22 @@ discard block |
||
| 355 | 355 | * @throws \Aimeos\Client\Html\Exception If no service item could be found |
| 356 | 356 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 357 | 357 | */ |
| 358 | - protected function getServiceProvider( $code ) |
|
| 358 | + protected function getServiceProvider($code) |
|
| 359 | 359 | { |
| 360 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 360 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 361 | 361 | |
| 362 | 362 | $search = $serviceManager->createSearch(); |
| 363 | - $search->setConditions( $search->compare( '==', 'service.code', $code ) ); |
|
| 363 | + $search->setConditions($search->compare('==', 'service.code', $code)); |
|
| 364 | 364 | |
| 365 | - $result = $serviceManager->searchItems( $search ); |
|
| 365 | + $result = $serviceManager->searchItems($search); |
|
| 366 | 366 | |
| 367 | - if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 367 | + if (($serviceItem = reset($result)) === false) |
|
| 368 | 368 | { |
| 369 | - $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 370 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 369 | + $msg = sprintf('No service for code "%1$s" found', $code); |
|
| 370 | + throw new \Aimeos\Client\Html\Exception($msg); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - return $serviceManager->getProvider( $serviceItem ); |
|
| 373 | + return $serviceManager->getProvider($serviceItem); |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | protected function getSubClientNames() |
| 383 | 383 | { |
| 384 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 384 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | |
@@ -393,14 +393,14 @@ discard block |
||
| 393 | 393 | * @param array $config Default URL configuration |
| 394 | 394 | * @return string URL string |
| 395 | 395 | */ |
| 396 | - protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 396 | + protected function getUrlConfirm(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 397 | 397 | { |
| 398 | - $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 399 | - $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 400 | - $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 401 | - $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 398 | + $target = $view->config('client/html/checkout/confirm/url/target'); |
|
| 399 | + $cntl = $view->config('client/html/checkout/confirm/url/controller', 'checkout'); |
|
| 400 | + $action = $view->config('client/html/checkout/confirm/url/action', 'confirm'); |
|
| 401 | + $config = $view->config('client/html/checkout/confirm/url/config', $config); |
|
| 402 | 402 | |
| 403 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 403 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | |
@@ -412,13 +412,13 @@ discard block |
||
| 412 | 412 | * @param array $config Default URL configuration |
| 413 | 413 | * @return string URL string |
| 414 | 414 | */ |
| 415 | - protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 415 | + protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 416 | 416 | { |
| 417 | - $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 418 | - $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 419 | - $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 420 | - $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 417 | + $target = $view->config('client/html/checkout/update/url/target'); |
|
| 418 | + $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout'); |
|
| 419 | + $action = $view->config('client/html/checkout/update/url/action', 'update'); |
|
| 420 | + $config = $view->config('client/html/checkout/update/url/config', $config); |
|
| 421 | 421 | |
| 422 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 422 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 423 | 423 | } |
| 424 | 424 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 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/favorite/name |
| 37 | 37 | * Class name of the used account favorite client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/account/favorite/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/account/favorite/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\\Favorite\\' . $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\\Favorite\\'.$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\\Favorite\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Account\\Favorite\\'.$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/favorite' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'account/favorite'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | } |
| 88 | 88 | \ No newline at end of file |
@@ -68,42 +68,42 @@ discard block |
||
| 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->favoriteBody = $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->favoriteErrorList = $view->get( 'favoriteErrorList', array() ) + $error; |
|
| 88 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 89 | + $view->favoriteErrorList = $view->get('favoriteErrorList', 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->favoriteErrorList = $view->get( 'favoriteErrorList', array() ) + $error; |
|
| 93 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 94 | + $view->favoriteErrorList = $view->get('favoriteErrorList', 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->favoriteErrorList = $view->get( 'favoriteErrorList', array() ) + $error; |
|
| 98 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 99 | + $view->favoriteErrorList = $view->get('favoriteErrorList', 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->favoriteErrorList = $view->get( 'favoriteErrorList', array() ) + $error; |
|
| 105 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 106 | + $view->favoriteErrorList = $view->get('favoriteErrorList', array()) + $error; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** client/html/account/favorite/standard/template-body |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $tplconf = 'client/html/account/favorite/standard/template-body'; |
| 130 | 130 | $default = 'account/favorite/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 |
||
| 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->favoriteHeader = $html; |
| 155 | 155 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | $tplconf = 'client/html/account/favorite/standard/template-header'; |
| 178 | 178 | $default = 'account/favorite/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 |
||
| 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/favorite/decorators/excludes |
| 199 | 199 | * Excludes decorators added by the "common" option from the account favorite html client |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @see client/html/account/favorite/decorators/excludes |
| 269 | 269 | * @see client/html/account/favorite/decorators/global |
| 270 | 270 | */ |
| 271 | - return $this->createSubClient( 'account/favorite/' . $type, $name ); |
|
| 271 | + return $this->createSubClient('account/favorite/'.$type, $name); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
@@ -281,48 +281,48 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | $view = $this->getView(); |
| 283 | 283 | $context = $this->getContext(); |
| 284 | - $ids = $view->param( 'fav_id', array() ); |
|
| 284 | + $ids = $view->param('fav_id', array()); |
|
| 285 | 285 | |
| 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', 'favorite' ); |
|
| 290 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 289 | + $typeItem = $this->getTypeItem('customer/lists/type', 'product', 'favorite'); |
|
| 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( 'fav_action' ) ) |
|
| 307 | + switch ($view->param('fav_action')) |
|
| 308 | 308 | { |
| 309 | 309 | case 'add': |
| 310 | 310 | |
| 311 | 311 | $item = $manager->createItem(); |
| 312 | - $item->setParentId( $context->getUserId() ); |
|
| 313 | - $item->setTypeId( $typeItem->getId() ); |
|
| 314 | - $item->setDomain( 'product' ); |
|
| 315 | - $item->setStatus( 1 ); |
|
| 312 | + $item->setParentId($context->getUserId()); |
|
| 313 | + $item->setTypeId($typeItem->getId()); |
|
| 314 | + $item->setDomain('product'); |
|
| 315 | + $item->setStatus(1); |
|
| 316 | 316 | |
| 317 | - foreach( (array) $view->param( 'fav_id', array() ) as $id ) |
|
| 317 | + foreach ((array) $view->param('fav_id', array()) as $id) |
|
| 318 | 318 | { |
| 319 | - if( !isset( $items[$id] ) ) |
|
| 319 | + if (!isset($items[$id])) |
|
| 320 | 320 | { |
| 321 | - $item->setId( null ); |
|
| 322 | - $item->setRefId( $id ); |
|
| 321 | + $item->setId(null); |
|
| 322 | + $item->setRefId($id); |
|
| 323 | 323 | |
| 324 | - $manager->saveItem( $item ); |
|
| 325 | - $manager->moveItem( $item->getId() ); |
|
| 324 | + $manager->saveItem($item); |
|
| 325 | + $manager->moveItem($item->getId()); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
@@ -332,14 +332,14 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $listIds = array(); |
| 334 | 334 | |
| 335 | - foreach( (array) $view->param( 'fav_id', array() ) as $id ) |
|
| 335 | + foreach ((array) $view->param('fav_id', array()) as $id) |
|
| 336 | 336 | { |
| 337 | - if( isset( $items[$id] ) ) { |
|
| 337 | + if (isset($items[$id])) { |
|
| 338 | 338 | $listIds[] = $items[$id]->getId(); |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $manager->deleteItems( $listIds ); |
|
| 342 | + $manager->deleteItems($listIds); |
|
| 343 | 343 | break; |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | protected function getSubClientNames() |
| 357 | 357 | { |
| 358 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 358 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | |
@@ -365,10 +365,10 @@ discard block |
||
| 365 | 365 | * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters |
| 366 | 366 | * @return integer Page number starting from 1 |
| 367 | 367 | */ |
| 368 | - protected function getProductListPage( \Aimeos\MW\View\Iface $view ) |
|
| 368 | + protected function getProductListPage(\Aimeos\MW\View\Iface $view) |
|
| 369 | 369 | { |
| 370 | - $page = (int) $view->param( 'fav_page', 1 ); |
|
| 371 | - return ( $page < 1 ? 1 : $page ); |
|
| 370 | + $page = (int) $view->param('fav_page', 1); |
|
| 371 | + return ($page < 1 ? 1 : $page); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters |
| 379 | 379 | * @return integer Page size |
| 380 | 380 | */ |
| 381 | - protected function getProductListSize( \Aimeos\MW\View\Iface $view ) |
|
| 381 | + protected function getProductListSize(\Aimeos\MW\View\Iface $view) |
|
| 382 | 382 | { |
| 383 | 383 | /** client/html/account/favorite/size |
| 384 | 384 | * The number of products shown in a list page for favorite products |
@@ -399,10 +399,10 @@ discard block |
||
| 399 | 399 | * @category Developer |
| 400 | 400 | * @see client/html/catalog/lists/size |
| 401 | 401 | */ |
| 402 | - $defaultSize = $this->getContext()->getConfig()->get( 'client/html/account/favorite/size', 48 ); |
|
| 402 | + $defaultSize = $this->getContext()->getConfig()->get('client/html/account/favorite/size', 48); |
|
| 403 | 403 | |
| 404 | - $size = (int) $view->param( 'fav-size', $defaultSize ); |
|
| 405 | - return ( $size < 1 || $size > 100 ? $defaultSize : $size ); |
|
| 404 | + $size = (int) $view->param('fav-size', $defaultSize); |
|
| 405 | + return ($size < 1 || $size > 100 ? $defaultSize : $size); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | |
@@ -414,33 +414,33 @@ discard block |
||
| 414 | 414 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 415 | 415 | * @return \Aimeos\MW\View\Iface Modified view object |
| 416 | 416 | */ |
| 417 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 417 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 418 | 418 | { |
| 419 | - if( !isset( $this->cache ) ) |
|
| 419 | + if (!isset($this->cache)) |
|
| 420 | 420 | { |
| 421 | 421 | $total = 0; |
| 422 | 422 | $productIds = array(); |
| 423 | 423 | $context = $this->getContext(); |
| 424 | - $typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'favorite' ); |
|
| 424 | + $typeItem = $this->getTypeItem('customer/lists/type', 'product', 'favorite'); |
|
| 425 | 425 | |
| 426 | - $size = $this->getProductListSize( $view ); |
|
| 427 | - $current = $this->getProductListPage( $view ); |
|
| 428 | - $last = ( $total != 0 ? ceil( $total / $size ) : 1 ); |
|
| 426 | + $size = $this->getProductListSize($view); |
|
| 427 | + $current = $this->getProductListPage($view); |
|
| 428 | + $last = ($total != 0 ? ceil($total / $size) : 1); |
|
| 429 | 429 | |
| 430 | 430 | |
| 431 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 431 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 432 | 432 | |
| 433 | 433 | $search = $manager->createSearch(); |
| 434 | 434 | $expr = array( |
| 435 | - $search->compare( '==', 'customer.lists.parentid', $context->getUserId() ), |
|
| 436 | - $search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ), |
|
| 437 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
| 435 | + $search->compare('==', 'customer.lists.parentid', $context->getUserId()), |
|
| 436 | + $search->compare('==', 'customer.lists.typeid', $typeItem->getId()), |
|
| 437 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
| 438 | 438 | ); |
| 439 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 440 | - $search->setSortations( array( $search->sort( '-', 'customer.lists.position' ) ) ); |
|
| 441 | - $search->setSlice( ( $current - 1 ) * $size, $size ); |
|
| 439 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 440 | + $search->setSortations(array($search->sort('-', 'customer.lists.position'))); |
|
| 441 | + $search->setSlice(($current - 1) * $size, $size); |
|
| 442 | 442 | |
| 443 | - $view->favoriteListItems = $manager->searchItems( $search, array(), $total ); |
|
| 443 | + $view->favoriteListItems = $manager->searchItems($search, array(), $total); |
|
| 444 | 444 | |
| 445 | 445 | |
| 446 | 446 | /** client/html/account/favorite/domains |
@@ -459,19 +459,19 @@ discard block |
||
| 459 | 459 | * @category Developer |
| 460 | 460 | * @see client/html/catalog/domains |
| 461 | 461 | */ |
| 462 | - $default = array( 'text', 'price', 'media' ); |
|
| 463 | - $domains = $context->getConfig()->get( 'client/html/account/favorite/domains', $default ); |
|
| 462 | + $default = array('text', 'price', 'media'); |
|
| 463 | + $domains = $context->getConfig()->get('client/html/account/favorite/domains', $default); |
|
| 464 | 464 | |
| 465 | - foreach( $view->favoriteListItems as $listItem ) { |
|
| 465 | + foreach ($view->favoriteListItems as $listItem) { |
|
| 466 | 466 | $productIds[] = $listItem->getRefId(); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 469 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 470 | 470 | |
| 471 | - $view->favoriteProductItems = $controller->getProductItems( $productIds, $domains ); |
|
| 471 | + $view->favoriteProductItems = $controller->getProductItems($productIds, $domains); |
|
| 472 | 472 | $view->favoritePageFirst = 1; |
| 473 | - $view->favoritePagePrev = ( $current > 1 ? $current - 1 : 1 ); |
|
| 474 | - $view->favoritePageNext = ( $current < $last ? $current + 1 : $last ); |
|
| 473 | + $view->favoritePagePrev = ($current > 1 ? $current - 1 : 1); |
|
| 474 | + $view->favoritePageNext = ($current < $last ? $current + 1 : $last); |
|
| 475 | 475 | $view->favoritePageLast = $last; |
| 476 | 476 | $view->favoritePageCurr = $current; |
| 477 | 477 | |