@@ -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; |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 87 | 87 | * @return string HTML code |
| 88 | 88 | */ |
| 89 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 89 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 90 | 90 | { |
| 91 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 91 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 92 | 92 | |
| 93 | 93 | $html = ''; |
| 94 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 95 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 94 | + foreach ($this->getSubClients() as $subclient) { |
|
| 95 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 96 | 96 | } |
| 97 | 97 | $view->deliveryBody = $html; |
| 98 | 98 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $tplconf = 'client/html/checkout/standard/address/delivery/standard/template-body'; |
| 120 | 120 | $default = 'checkout/standard/address-delivery-body-default.php'; |
| 121 | 121 | |
| 122 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 122 | + return $view->render($view->config($tplconf, $default)); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 132 | 132 | * @return string|null String including HTML tags for the header on error |
| 133 | 133 | */ |
| 134 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 134 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 135 | 135 | { |
| 136 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 136 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 137 | 137 | |
| 138 | 138 | $html = ''; |
| 139 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 140 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 139 | + foreach ($this->getSubClients() as $subclient) { |
|
| 140 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 141 | 141 | } |
| 142 | 142 | $view->deliveryHeader = $html; |
| 143 | 143 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $tplconf = 'client/html/checkout/standard/address/delivery/standard/template-header'; |
| 166 | 166 | $default = 'checkout/standard/address-delivery-header-default.php'; |
| 167 | 167 | |
| 168 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 168 | + return $view->render($view->config($tplconf, $default)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string|null $name Name of the sub-client (Default if null) |
| 177 | 177 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 178 | 178 | */ |
| 179 | - public function getSubClient( $type, $name = null ) |
|
| 179 | + public function getSubClient($type, $name = null) |
|
| 180 | 180 | { |
| 181 | 181 | /** client/html/checkout/standard/address/delivery/decorators/excludes |
| 182 | 182 | * Excludes decorators added by the "common" option from the checkout standard address delivery html client |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @see client/html/checkout/standard/address/delivery/decorators/global |
| 253 | 253 | */ |
| 254 | 254 | |
| 255 | - return $this->createSubClient( 'checkout/standard/address/delivery/' . $type, $name ); |
|
| 255 | + return $this->createSubClient('checkout/standard/address/delivery/'.$type, $name); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -266,24 +266,24 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | try |
| 268 | 268 | { |
| 269 | - if( ( $id = $view->param( 'ca_delivery_delete', null ) ) !== null ) |
|
| 269 | + if (($id = $view->param('ca_delivery_delete', null)) !== null) |
|
| 270 | 270 | { |
| 271 | - $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 272 | - $address = $customerAddressManager->getItem( $id ); |
|
| 271 | + $customerAddressManager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 272 | + $address = $customerAddressManager->getItem($id); |
|
| 273 | 273 | |
| 274 | - if( $address->getParentId() != $context->getUserId() ) { |
|
| 275 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Address with ID "%1$s" not found', $id ) ); |
|
| 274 | + if ($address->getParentId() != $context->getUserId()) { |
|
| 275 | + throw new \Aimeos\Client\Html\Exception(sprintf('Address with ID "%1$s" not found', $id)); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $customerAddressManager->deleteItem( $id ); |
|
| 278 | + $customerAddressManager->deleteItem($id); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // only start if there's something to do |
| 282 | - if( $view->param( 'ca_deliveryoption', null ) === null ) { |
|
| 282 | + if ($view->param('ca_deliveryoption', null) === null) { |
|
| 283 | 283 | return; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 286 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 287 | 287 | |
| 288 | 288 | /** client/html/checkout/standard/address/delivery/disable-new |
| 289 | 289 | * Disables the option to enter a different delivery address for an order |
@@ -304,63 +304,63 @@ discard block |
||
| 304 | 304 | * @see client/html/checkout/standard/address/delivery/optional |
| 305 | 305 | * @see client/html/checkout/standard/address/delivery/hidden |
| 306 | 306 | */ |
| 307 | - $disable = $view->config( 'client/html/checkout/standard/address/delivery/disable-new', false ); |
|
| 307 | + $disable = $view->config('client/html/checkout/standard/address/delivery/disable-new', false); |
|
| 308 | 308 | $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY; |
| 309 | 309 | |
| 310 | - if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
| 310 | + if (($option = $view->param('ca_deliveryoption', 'null')) === 'null' && $disable === false) // new address |
|
| 311 | 311 | { |
| 312 | - $params = $view->param( 'ca_delivery', array() ); |
|
| 313 | - $invalid = $this->checkFields( $params ); |
|
| 312 | + $params = $view->param('ca_delivery', array()); |
|
| 313 | + $invalid = $this->checkFields($params); |
|
| 314 | 314 | |
| 315 | - if( count( $invalid ) > 0 ) |
|
| 315 | + if (count($invalid) > 0) |
|
| 316 | 316 | { |
| 317 | 317 | $view->deliveryError = $invalid; |
| 318 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
|
| 318 | + throw new \Aimeos\Client\Html\Exception(sprintf('At least one delivery address part is missing or invalid')); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $basketCtrl->setAddress( $type, $params ); |
|
| 321 | + $basketCtrl->setAddress($type, $params); |
|
| 322 | 322 | } |
| 323 | - else if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) !== '-1' ) // existing address |
|
| 323 | + else if (($option = $view->param('ca_deliveryoption', 'null')) !== '-1') // existing address |
|
| 324 | 324 | { |
| 325 | - $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 326 | - $address = $customerAddressManager->getItem( $option ); |
|
| 325 | + $customerAddressManager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 326 | + $address = $customerAddressManager->getItem($option); |
|
| 327 | 327 | |
| 328 | - if( $address->getParentId() != $context->getUserId() ) { |
|
| 329 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Address with ID "%1$s" not found', $option ) ); |
|
| 328 | + if ($address->getParentId() != $context->getUserId()) { |
|
| 329 | + throw new \Aimeos\Client\Html\Exception(sprintf('Address with ID "%1$s" not found', $option)); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | $invalid = array(); |
| 333 | - $params = $view->param( 'ca_delivery_' . $option, array() ); |
|
| 333 | + $params = $view->param('ca_delivery_'.$option, array()); |
|
| 334 | 334 | |
| 335 | - if( !empty( $params ) ) |
|
| 335 | + if (!empty($params)) |
|
| 336 | 336 | { |
| 337 | 337 | $list = array(); |
| 338 | - $invalid = $this->checkFields( $params ); |
|
| 338 | + $invalid = $this->checkFields($params); |
|
| 339 | 339 | |
| 340 | - foreach( $params as $key => $value ) { |
|
| 341 | - $list[str_replace( 'order.base', 'customer', $key )] = $value; |
|
| 340 | + foreach ($params as $key => $value) { |
|
| 341 | + $list[str_replace('order.base', 'customer', $key)] = $value; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - $address->fromArray( $list ); |
|
| 345 | - $customerAddressManager->saveItem( $address ); |
|
| 344 | + $address->fromArray($list); |
|
| 345 | + $customerAddressManager->saveItem($address); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - if( count( $invalid ) > 0 ) |
|
| 348 | + if (count($invalid) > 0) |
|
| 349 | 349 | { |
| 350 | 350 | $view->deliveryError = $invalid; |
| 351 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
|
| 351 | + throw new \Aimeos\Client\Html\Exception(sprintf('At least one delivery address part is missing or invalid')); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $basketCtrl->setAddress( $type, $address ); |
|
| 354 | + $basketCtrl->setAddress($type, $address); |
|
| 355 | 355 | } |
| 356 | 356 | else |
| 357 | 357 | { |
| 358 | - $basketCtrl->setAddress( $type, null ); |
|
| 358 | + $basketCtrl->setAddress($type, null); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | parent::process(); |
| 362 | 362 | } |
| 363 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 363 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 364 | 364 | { |
| 365 | 365 | $view->deliveryError = $e->getErrorList(); |
| 366 | 366 | throw $e; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | * @param array &$params Associative list of address keys (order.base.address.* or customer.address.*) and their values |
| 375 | 375 | * @return array List of missing field names |
| 376 | 376 | */ |
| 377 | - protected function checkFields( array &$params ) |
|
| 377 | + protected function checkFields(array &$params) |
|
| 378 | 378 | { |
| 379 | 379 | $view = $this->getView(); |
| 380 | 380 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @see client/html/checkout/standard/address/countries |
| 417 | 417 | * @see client/html/checkout/standard/address/validate |
| 418 | 418 | */ |
| 419 | - $mandatory = $view->config( 'client/html/checkout/standard/address/delivery/mandatory', $this->mandatory ); |
|
| 419 | + $mandatory = $view->config('client/html/checkout/standard/address/delivery/mandatory', $this->mandatory); |
|
| 420 | 420 | |
| 421 | 421 | /** client/html/checkout/standard/address/delivery/optional |
| 422 | 422 | * List of delivery address input fields that are optional |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | * @see client/html/checkout/standard/address/countries |
| 457 | 457 | * @see client/html/checkout/standard/address/validate |
| 458 | 458 | */ |
| 459 | - $optional = $view->config( 'client/html/checkout/standard/address/delivery/optional', $this->optional ); |
|
| 459 | + $optional = $view->config('client/html/checkout/standard/address/delivery/optional', $this->optional); |
|
| 460 | 460 | |
| 461 | 461 | /** client/html/checkout/standard/address/validate |
| 462 | 462 | * |
@@ -465,32 +465,32 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | |
| 467 | 467 | $invalid = array(); |
| 468 | - $allFields = array_flip( array_merge( $mandatory, $optional ) ); |
|
| 468 | + $allFields = array_flip(array_merge($mandatory, $optional)); |
|
| 469 | 469 | |
| 470 | - foreach( $params as $key => $value ) |
|
| 470 | + foreach ($params as $key => $value) |
|
| 471 | 471 | { |
| 472 | - if( isset( $allFields[$key] ) ) |
|
| 472 | + if (isset($allFields[$key])) |
|
| 473 | 473 | { |
| 474 | - $name = substr( $key, 19 ); |
|
| 475 | - $regex = $view->config( 'client/html/checkout/standard/address/validate/' . $name ); |
|
| 474 | + $name = substr($key, 19); |
|
| 475 | + $regex = $view->config('client/html/checkout/standard/address/validate/'.$name); |
|
| 476 | 476 | |
| 477 | - if( $regex && preg_match( '/' . $regex . '/', $value ) !== 1 ) |
|
| 477 | + if ($regex && preg_match('/'.$regex.'/', $value) !== 1) |
|
| 478 | 478 | { |
| 479 | - $msg = $view->translate( 'client', 'Delivery address part "%1$s" is invalid' ); |
|
| 480 | - $invalid[$key] = sprintf( $msg, $name ); |
|
| 481 | - unset( $params[$key] ); |
|
| 479 | + $msg = $view->translate('client', 'Delivery address part "%1$s" is invalid'); |
|
| 480 | + $invalid[$key] = sprintf($msg, $name); |
|
| 481 | + unset($params[$key]); |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | else |
| 485 | 485 | { |
| 486 | - unset( $params[$key] ); |
|
| 486 | + unset($params[$key]); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
| 491 | - if( isset( $params['order.base.address.salutation'] ) |
|
| 491 | + if (isset($params['order.base.address.salutation']) |
|
| 492 | 492 | && $params['order.base.address.salutation'] === \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY |
| 493 | - && in_array( 'order.base.address.company', $mandatory ) === false |
|
| 493 | + && in_array('order.base.address.company', $mandatory) === false |
|
| 494 | 494 | ) { |
| 495 | 495 | $mandatory[] = 'order.base.address.company'; |
| 496 | 496 | } else { |
@@ -498,13 +498,13 @@ discard block |
||
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | |
| 501 | - foreach( $mandatory as $key ) |
|
| 501 | + foreach ($mandatory as $key) |
|
| 502 | 502 | { |
| 503 | - if( !isset( $params[$key] ) || $params[$key] == '' ) |
|
| 503 | + if (!isset($params[$key]) || $params[$key] == '') |
|
| 504 | 504 | { |
| 505 | - $msg = $view->translate( 'client', 'Delivery address part "%1$s" is missing' ); |
|
| 506 | - $invalid[$key] = sprintf( $msg, substr( $key, 19 ) ); |
|
| 507 | - unset( $params[$key] ); |
|
| 505 | + $msg = $view->translate('client', 'Delivery address part "%1$s" is missing'); |
|
| 506 | + $invalid[$key] = sprintf($msg, substr($key, 19)); |
|
| 507 | + unset($params[$key]); |
|
| 508 | 508 | } |
| 509 | 509 | } |
| 510 | 510 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | protected function getSubClientNames() |
| 521 | 521 | { |
| 522 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 522 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | |
@@ -531,17 +531,17 @@ discard block |
||
| 531 | 531 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 532 | 532 | * @return \Aimeos\MW\View\Iface Modified view object |
| 533 | 533 | */ |
| 534 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 534 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 535 | 535 | { |
| 536 | - if( !isset( $this->cache ) ) |
|
| 536 | + if (!isset($this->cache)) |
|
| 537 | 537 | { |
| 538 | 538 | $context = $this->getContext(); |
| 539 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 539 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 540 | 540 | |
| 541 | 541 | try { |
| 542 | - $langid = $basketCntl->get()->getAddress( 'delivery' )->getLanguageId(); |
|
| 543 | - } catch( \Exception $e ) { |
|
| 544 | - $langid = $view->param( 'ca_delivery/order.base.address.languageid', $context->getLocale()->getLanguageId() ); |
|
| 542 | + $langid = $basketCntl->get()->getAddress('delivery')->getLanguageId(); |
|
| 543 | + } catch (\Exception $e) { |
|
| 544 | + $langid = $view->param('ca_delivery/order.base.address.languageid', $context->getLocale()->getLanguageId()); |
|
| 545 | 545 | } |
| 546 | 546 | $view->deliveryLanguage = $langid; |
| 547 | 547 | |
@@ -584,13 +584,13 @@ discard block |
||
| 584 | 584 | * @see client/html/checkout/standard/address/delivery/optional |
| 585 | 585 | * @see client/html/checkout/standard/address/countries |
| 586 | 586 | */ |
| 587 | - $hidden = $view->config( 'client/html/checkout/standard/address/delivery/hidden', array() ); |
|
| 587 | + $hidden = $view->config('client/html/checkout/standard/address/delivery/hidden', array()); |
|
| 588 | 588 | |
| 589 | - if( count( $view->get( 'addressLanguages', array() ) ) === 1 ) { |
|
| 589 | + if (count($view->get('addressLanguages', array())) === 1) { |
|
| 590 | 590 | $hidden[] = 'order.base.address.languageid'; |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - $salutations = array( 'company', 'mr', 'mrs' ); |
|
| 593 | + $salutations = array('company', 'mr', 'mrs'); |
|
| 594 | 594 | |
| 595 | 595 | /** client/html/checkout/standard/address/delivery/salutations |
| 596 | 596 | * List of salutions the customer can select from for the delivery address |
@@ -620,10 +620,10 @@ discard block |
||
| 620 | 620 | * @see client/html/checkout/standard/address/delivery/hidden |
| 621 | 621 | * @see client/html/checkout/standard/address/countries |
| 622 | 622 | */ |
| 623 | - $view->deliverySalutations = $view->config( 'client/html/checkout/standard/address/delivery/salutations', $salutations ); |
|
| 623 | + $view->deliverySalutations = $view->config('client/html/checkout/standard/address/delivery/salutations', $salutations); |
|
| 624 | 624 | |
| 625 | - $view->deliveryMandatory = $view->config( 'client/html/checkout/standard/address/delivery/mandatory', $this->mandatory ); |
|
| 626 | - $view->deliveryOptional = $view->config( 'client/html/checkout/standard/address/delivery/optional', $this->optional ); |
|
| 625 | + $view->deliveryMandatory = $view->config('client/html/checkout/standard/address/delivery/mandatory', $this->mandatory); |
|
| 626 | + $view->deliveryOptional = $view->config('client/html/checkout/standard/address/delivery/optional', $this->optional); |
|
| 627 | 627 | $view->deliveryHidden = $hidden; |
| 628 | 628 | |
| 629 | 629 | |
@@ -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 | |
@@ -68,19 +68,19 @@ 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 | $view = $this->getView(); |
| 74 | 74 | |
| 75 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 75 | + if ($view->param('his_action', 'list') != 'list') { |
|
| 76 | 76 | return ''; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 79 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 80 | 80 | |
| 81 | 81 | $html = ''; |
| 82 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 82 | + foreach ($this->getSubClients() as $subclient) { |
|
| 83 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 84 | 84 | } |
| 85 | 85 | $view->listsBody = $html; |
| 86 | 86 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $tplconf = 'client/html/account/history/lists/standard/template-body'; |
| 108 | 108 | $default = 'account/history/list-body-default.php'; |
| 109 | 109 | |
| 110 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 110 | + return $view->render($view->config($tplconf, $default)); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 120 | 120 | * @return string|null String including HTML tags for the header on error |
| 121 | 121 | */ |
| 122 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 122 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 123 | 123 | { |
| 124 | 124 | $view = $this->getView(); |
| 125 | 125 | |
| 126 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 126 | + if ($view->param('his_action', 'list') != 'list') { |
|
| 127 | 127 | return ''; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 130 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 131 | 131 | |
| 132 | 132 | $html = ''; |
| 133 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 133 | + foreach ($this->getSubClients() as $subclient) { |
|
| 134 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 135 | 135 | } |
| 136 | 136 | $view->listsHeader = $html; |
| 137 | 137 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $tplconf = 'client/html/account/history/lists/standard/template-header'; |
| 160 | 160 | $default = 'account/history/list-header-default.php'; |
| 161 | 161 | |
| 162 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 162 | + return $view->render($view->config($tplconf, $default)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
| 171 | 171 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 172 | 172 | */ |
| 173 | - public function getSubClient( $type, $name = null ) |
|
| 173 | + public function getSubClient($type, $name = null) |
|
| 174 | 174 | { |
| 175 | 175 | /** client/html/account/history/lists/decorators/excludes |
| 176 | 176 | * Excludes decorators added by the "common" option from the account history list html client |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @see client/html/account/history/lists/decorators/global |
| 247 | 247 | */ |
| 248 | 248 | |
| 249 | - return $this->createSubClient( 'account/history/lists/' . $type, $name ); |
|
| 249 | + return $this->createSubClient('account/history/lists/'.$type, $name); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected function getSubClientNames() |
| 259 | 259 | { |
| 260 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 260 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
@@ -269,24 +269,24 @@ discard block |
||
| 269 | 269 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 270 | 270 | * @return \Aimeos\MW\View\Iface Modified view object |
| 271 | 271 | */ |
| 272 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 272 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 273 | 273 | { |
| 274 | - if( !isset( $this->cache ) ) |
|
| 274 | + if (!isset($this->cache)) |
|
| 275 | 275 | { |
| 276 | 276 | $context = $this->getContext(); |
| 277 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 277 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 278 | 278 | |
| 279 | 279 | |
| 280 | - $search = $manager->createSearch( true ); |
|
| 280 | + $search = $manager->createSearch(true); |
|
| 281 | 281 | $expr = array( |
| 282 | 282 | $search->getConditions(), |
| 283 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 283 | + $search->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 284 | 284 | ); |
| 285 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 286 | - $search->setSortations( array( $search->sort( '-', 'order.id' ) ) ); |
|
| 285 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 286 | + $search->setSortations(array($search->sort('-', 'order.id'))); |
|
| 287 | 287 | |
| 288 | 288 | |
| 289 | - $view->listsOrderItems = $manager->searchItems( $search ); |
|
| 289 | + $view->listsOrderItems = $manager->searchItems($search); |
|
| 290 | 290 | |
| 291 | 291 | $this->cache = $view; |
| 292 | 292 | } |
@@ -66,13 +66,13 @@ discard block |
||
| 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 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 74 | + foreach ($this->getSubClients() as $subclient) { |
|
| 75 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 76 | 76 | } |
| 77 | 77 | $view->serviceBody = $html; |
| 78 | 78 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/account/history/order/service/standard/template-body'; |
| 101 | 101 | $default = 'common/summary/service-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->serviceHeader = $html; |
| 124 | 124 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/account/history/order/service/standard/template-header'; |
| 148 | 148 | $default = 'common/summary/service-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/account/history/order/service/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the account history order service html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/account/history/order/service/decorators/excludes |
| 234 | 234 | * @see client/html/account/history/order/service/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'account/history/order/service/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('account/history/order/service/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -66,13 +66,13 @@ discard block |
||
| 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 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 74 | + foreach ($this->getSubClients() as $subclient) { |
|
| 75 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 76 | 76 | } |
| 77 | 77 | $view->couponBody = $html; |
| 78 | 78 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/account/history/order/coupon/standard/template-body'; |
| 101 | 101 | $default = 'common/summary/coupon-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->couponHeader = $html; |
| 124 | 124 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/account/history/order/coupon/standard/template-header'; |
| 148 | 148 | $default = 'common/summary/coupon-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/account/history/order/coupon/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the account history order coupon html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/account/history/order/coupon/decorators/excludes |
| 234 | 234 | * @see client/html/account/history/order/coupon/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'account/history/order/coupon/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('account/history/order/coupon/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |