@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
34 | 34 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
36 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
37 | 37 | { |
38 | 38 | $iface = '\Aimeos\Controller\Frontend\Service\Iface'; |
39 | - if( !( $controller instanceof $iface ) ) |
|
39 | + if (!($controller instanceof $iface)) |
|
40 | 40 | { |
41 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
42 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
41 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
42 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $this->controller = $controller; |
46 | 46 | |
47 | - parent::__construct( $context ); |
|
47 | + parent::__construct($context); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @return mixed Returns the value of the called method |
57 | 57 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
58 | 58 | */ |
59 | - public function __call( $name, array $param ) |
|
59 | + public function __call($name, array $param) |
|
60 | 60 | { |
61 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
61 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
70 | 70 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
71 | 71 | */ |
72 | - public function checkAttributes( $serviceId, array $attributes ) |
|
72 | + public function checkAttributes($serviceId, array $attributes) |
|
73 | 73 | { |
74 | - return $this->controller->checkAttributes( $serviceId, $attributes ); |
|
74 | + return $this->controller->checkAttributes($serviceId, $attributes); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
83 | 83 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
84 | 84 | */ |
85 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
85 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
86 | 86 | { |
87 | - return $this->controller->getProvider( $serviceId, $ref ); |
|
87 | + return $this->controller->getProvider($serviceId, $ref); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
96 | 96 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
97 | 97 | */ |
98 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
98 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
99 | 99 | { |
100 | - return $this->controller->getProviders( $type, $ref ); |
|
100 | + return $this->controller->getProviders($type, $ref); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
113 | 113 | * or null if no form data is required |
114 | 114 | */ |
115 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
115 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
116 | 116 | { |
117 | - return $this->controller->process( $orderItem, $serviceId, $urls, $params ); |
|
117 | + return $this->controller->process($orderItem, $serviceId, $urls, $params); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | * @param string $orderid Unique ID of the order whose payment status should be updated |
130 | 130 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
131 | 131 | */ |
132 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ) |
|
132 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid) |
|
133 | 133 | { |
134 | - return $this->controller->updateSync( $request, $response, $urls, $code, $orderid ); |
|
134 | + return $this->controller->updateSync($request, $response, $urls, $code, $orderid); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
36 | 36 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
37 | 37 | */ |
38 | - public function checkAttributes( $serviceId, array $attributes ) |
|
38 | + public function checkAttributes($serviceId, array $attributes) |
|
39 | 39 | { |
40 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
41 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
40 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
41 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
42 | 42 | |
43 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
43 | + return array_filter($provider->checkConfigFE($attributes)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | * @param string[] $ref List of domain names whose items should be fetched too |
52 | 52 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
53 | 53 | */ |
54 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
54 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
55 | 55 | { |
56 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
57 | - return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) ); |
|
56 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
57 | + return $manager->getProvider($manager->getItem($serviceId, $ref, true)); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -65,26 +65,26 @@ discard block |
||
65 | 65 | * @param string[] $ref List of domain names whose items should be fetched too |
66 | 66 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
67 | 67 | */ |
68 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
68 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
69 | 69 | { |
70 | 70 | $list = []; |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
72 | 72 | |
73 | - $search = $manager->createSearch( true ); |
|
74 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
73 | + $search = $manager->createSearch(true); |
|
74 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
75 | 75 | |
76 | - if( $type != null ) |
|
76 | + if ($type != null) |
|
77 | 77 | { |
78 | 78 | $expr = array( |
79 | 79 | $search->getConditions(), |
80 | - $search->compare( '==', 'service.type.code', $type ), |
|
81 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
80 | + $search->compare('==', 'service.type.code', $type), |
|
81 | + $search->compare('==', 'service.type.domain', 'service'), |
|
82 | 82 | ); |
83 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
83 | + $search->setConditions($search->combine('&&', $expr)); |
|
84 | 84 | } |
85 | 85 | |
86 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
87 | - $list[$id] = $manager->getProvider( $item ); |
|
86 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
87 | + $list[$id] = $manager->getProvider($item); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $list; |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
103 | 103 | * or null if no form data is required |
104 | 104 | */ |
105 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
105 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
106 | 106 | { |
107 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
107 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
108 | 108 | |
109 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
110 | - $provider->injectGlobalConfigBE( $urls ); |
|
109 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
110 | + $provider->injectGlobalConfigBE($urls); |
|
111 | 111 | |
112 | - return $provider->process( $orderItem, $params ); |
|
112 | + return $provider->process($orderItem, $params); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -124,38 +124,38 @@ discard block |
||
124 | 124 | * @param string $orderid Unique ID of the order whose payment status should be updated |
125 | 125 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
126 | 126 | */ |
127 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ) |
|
127 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid) |
|
128 | 128 | { |
129 | 129 | $params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
130 | 130 | $params['orderid'] = $orderid; |
131 | 131 | |
132 | 132 | $context = $this->getContext(); |
133 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
133 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
134 | 134 | |
135 | - $provider = $manager->getProvider( $manager->findItem( $code ) ); |
|
136 | - $provider->injectGlobalConfigBE( $urls ); |
|
135 | + $provider = $manager->getProvider($manager->findItem($code)); |
|
136 | + $provider->injectGlobalConfigBE($urls); |
|
137 | 137 | |
138 | 138 | $body = (string) $request->getBody(); |
139 | 139 | $output = null; |
140 | 140 | $headers = []; |
141 | 141 | |
142 | - if( ( $orderItem = $provider->updateSync( $params, $body, $output, $headers ) ) !== null ) |
|
142 | + if (($orderItem = $provider->updateSync($params, $body, $output, $headers)) !== null) |
|
143 | 143 | { |
144 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
145 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
144 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
145 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
146 | 146 | ) { |
147 | - $provider->query( $orderItem ); |
|
147 | + $provider->query($orderItem); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // update stock, coupons, etc. |
151 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
151 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem); |
|
152 | 152 | } |
153 | 153 | |
154 | - foreach( $headers as $name => $header ) { |
|
155 | - $response->withHeader( $name, $header ); |
|
154 | + foreach ($headers as $name => $header) { |
|
155 | + $response->withHeader($name, $header); |
|
156 | 156 | } |
157 | 157 | |
158 | - $response->withBody( $response->createStreamFromString( $output ) ); |
|
158 | + $response->withBody($response->createStreamFromString($output)); |
|
159 | 159 | |
160 | 160 | return $orderItem; |
161 | 161 | } |
@@ -31,52 +31,52 @@ discard block |
||
31 | 31 | * @param integer $quantity New product quantity |
32 | 32 | * @return \Aimeos\MShop\Price\Item\Iface Price item with calculated price |
33 | 33 | */ |
34 | - protected function calcPrice( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity ) |
|
34 | + protected function calcPrice(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity) |
|
35 | 35 | { |
36 | 36 | $context = $this->getContext(); |
37 | 37 | |
38 | - if( empty( $prices ) ) |
|
38 | + if (empty($prices)) |
|
39 | 39 | { |
40 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
41 | - $prices = $manager->getItem( $product->getProductId(), array( 'price' ) )->getRefItems( 'price', 'default' ); |
|
40 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
41 | + $prices = $manager->getItem($product->getProductId(), array('price'))->getRefItems('price', 'default'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
46 | - $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
45 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
46 | + $price = $priceManager->getLowestPrice($prices, $quantity); |
|
47 | 47 | |
48 | 48 | // customers can pay what they would like to pay |
49 | - if( ( $attr = $product->getAttributeItem( 'price', 'custom' ) ) !== null ) |
|
49 | + if (($attr = $product->getAttributeItem('price', 'custom')) !== null) |
|
50 | 50 | { |
51 | 51 | $amount = $attr->getValue(); |
52 | 52 | |
53 | - if( preg_match( '/^[0-9]*(\.[0-9]+)?$/', $amount ) !== 1 || ((double) $amount) < 0.01 ) |
|
53 | + if (preg_match('/^[0-9]*(\.[0-9]+)?$/', $amount) !== 1 || ((double) $amount) < 0.01) |
|
54 | 54 | { |
55 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid price value "%1$s"' ); |
|
56 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $amount ) ); |
|
55 | + $msg = $context->getI18n()->dt('controller/frontend', 'Invalid price value "%1$s"'); |
|
56 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $amount)); |
|
57 | 57 | } |
58 | 58 | |
59 | - $price->setValue( $amount ); |
|
59 | + $price->setValue($amount); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $orderAttributes = $product->getAttributes(); |
63 | - $attrItems = $this->getAttributeItems( $orderAttributes ); |
|
63 | + $attrItems = $this->getAttributeItems($orderAttributes); |
|
64 | 64 | |
65 | 65 | // add prices of (optional) attributes |
66 | - foreach( $orderAttributes as $orderAttrItem ) |
|
66 | + foreach ($orderAttributes as $orderAttrItem) |
|
67 | 67 | { |
68 | 68 | $attrId = $orderAttrItem->getAttributeId(); |
69 | 69 | |
70 | - if( isset( $attrItems[$attrId] ) |
|
71 | - && ( $prices = $attrItems[$attrId]->getRefItems( 'price', 'default' ) ) !== [] |
|
70 | + if (isset($attrItems[$attrId]) |
|
71 | + && ($prices = $attrItems[$attrId]->getRefItems('price', 'default')) !== [] |
|
72 | 72 | ) { |
73 | - $attrPrice = $priceManager->getLowestPrice( $prices, $orderAttrItem->getQuantity() ); |
|
74 | - $price->addItem( $attrPrice, $orderAttrItem->getQuantity() ); |
|
73 | + $attrPrice = $priceManager->getLowestPrice($prices, $orderAttrItem->getQuantity()); |
|
74 | + $price->addItem($attrPrice, $orderAttrItem->getQuantity()); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | 78 | // remove product rebate of original price in favor to rebates granted for the order |
79 | - $price->setRebate( '0.00' ); |
|
79 | + $price->setRebate('0.00'); |
|
80 | 80 | |
81 | 81 | return $price; |
82 | 82 | } |
@@ -90,43 +90,43 @@ discard block |
||
90 | 90 | * @param array $refMap Associative list of list type codes as keys and lists of reference IDs as values |
91 | 91 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated |
92 | 92 | */ |
93 | - protected function checkListRef( $prodId, $domain, array $refMap ) |
|
93 | + protected function checkListRef($prodId, $domain, array $refMap) |
|
94 | 94 | { |
95 | - if( empty( $refMap ) ) { |
|
95 | + if (empty($refMap)) { |
|
96 | 96 | return; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $context = $this->getContext(); |
100 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
101 | - $search = $productManager->createSearch( true ); |
|
100 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
101 | + $search = $productManager->createSearch(true); |
|
102 | 102 | |
103 | 103 | $expr = array( |
104 | - $search->compare( '==', 'product.id', $prodId ), |
|
104 | + $search->compare('==', 'product.id', $prodId), |
|
105 | 105 | $search->getConditions(), |
106 | 106 | ); |
107 | 107 | |
108 | - foreach( $refMap as $listType => $refIds ) |
|
108 | + foreach ($refMap as $listType => $refIds) |
|
109 | 109 | { |
110 | - if( empty( $refIds ) ) { |
|
110 | + if (empty($refIds)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | - foreach( $refIds as $key => $refId ) { |
|
114 | + foreach ($refIds as $key => $refId) { |
|
115 | 115 | $refIds[$key] = (string) $refId; |
116 | 116 | } |
117 | 117 | |
118 | - $param = array( $domain, $this->getProductListTypeItem( $domain, $listType )->getId(), $refIds ); |
|
119 | - $cmpfunc = $search->createFunction( 'product.contains', $param ); |
|
118 | + $param = array($domain, $this->getProductListTypeItem($domain, $listType)->getId(), $refIds); |
|
119 | + $cmpfunc = $search->createFunction('product.contains', $param); |
|
120 | 120 | |
121 | - $expr[] = $search->compare( '==', $cmpfunc, count( $refIds ) ); |
|
121 | + $expr[] = $search->compare('==', $cmpfunc, count($refIds)); |
|
122 | 122 | } |
123 | 123 | |
124 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
124 | + $search->setConditions($search->combine('&&', $expr)); |
|
125 | 125 | |
126 | - if( count( $productManager->searchItems( $search, [] ) ) === 0 ) |
|
126 | + if (count($productManager->searchItems($search, [])) === 0) |
|
127 | 127 | { |
128 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' ); |
|
129 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) ); |
|
128 | + $msg = $context->getI18n()->dt('controller/frontend', 'Invalid "%1$s" references for product with ID %2$s'); |
|
129 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, json_encode($prodId))); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -136,41 +136,41 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @param string $type Basket type |
138 | 138 | */ |
139 | - protected function checkLocale( $type ) |
|
139 | + protected function checkLocale($type) |
|
140 | 140 | { |
141 | 141 | $errors = []; |
142 | 142 | $context = $this->getContext(); |
143 | 143 | $session = $context->getSession(); |
144 | 144 | $locale = $this->get()->getLocale(); |
145 | 145 | |
146 | - $localeStr = $session->get( 'aimeos/basket/locale' ); |
|
146 | + $localeStr = $session->get('aimeos/basket/locale'); |
|
147 | 147 | $localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId(); |
148 | 148 | |
149 | - if( $localeStr !== null && $localeStr !== $localeKey ) |
|
149 | + if ($localeStr !== null && $localeStr !== $localeKey) |
|
150 | 150 | { |
151 | - $locParts = explode( '|', $localeStr ); |
|
152 | - $locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' ); |
|
153 | - $locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' ); |
|
154 | - $locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' ); |
|
151 | + $locParts = explode('|', $localeStr); |
|
152 | + $locSite = (isset($locParts[0]) ? $locParts[0] : ''); |
|
153 | + $locLanguage = (isset($locParts[1]) ? $locParts[1] : ''); |
|
154 | + $locCurrency = (isset($locParts[2]) ? $locParts[2] : ''); |
|
155 | 155 | |
156 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
157 | - $locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false ); |
|
156 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
157 | + $locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false); |
|
158 | 158 | |
159 | 159 | $context = clone $context; |
160 | - $context->setLocale( $locale ); |
|
160 | + $context->setLocale($locale); |
|
161 | 161 | |
162 | - $manager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context )->getSubManager( 'base' ); |
|
163 | - $basket = $manager->getSession( $type ); |
|
162 | + $manager = \Aimeos\MShop\Order\Manager\Factory::createManager($context)->getSubManager('base'); |
|
163 | + $basket = $manager->getSession($type); |
|
164 | 164 | |
165 | - $this->copyAddresses( $basket, $errors, $localeKey ); |
|
166 | - $this->copyServices( $basket, $errors ); |
|
167 | - $this->copyProducts( $basket, $errors, $localeKey ); |
|
168 | - $this->copyCoupons( $basket, $errors, $localeKey ); |
|
165 | + $this->copyAddresses($basket, $errors, $localeKey); |
|
166 | + $this->copyServices($basket, $errors); |
|
167 | + $this->copyProducts($basket, $errors, $localeKey); |
|
168 | + $this->copyCoupons($basket, $errors, $localeKey); |
|
169 | 169 | |
170 | - $manager->setSession( $basket, $type ); |
|
170 | + $manager->setSession($basket, $type); |
|
171 | 171 | } |
172 | 172 | |
173 | - $session->set( 'aimeos/basket/locale', $localeKey ); |
|
173 | + $session->set('aimeos/basket/locale', $localeKey); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | * @param string $localeKey Unique identifier of the site, language and currency |
183 | 183 | * @return array Associative list of errors occured |
184 | 184 | */ |
185 | - protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey ) |
|
185 | + protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey) |
|
186 | 186 | { |
187 | - foreach( $basket->getAddresses() as $type => $item ) |
|
187 | + foreach ($basket->getAddresses() as $type => $item) |
|
188 | 188 | { |
189 | 189 | try |
190 | 190 | { |
191 | - $this->setAddress( $type, $item->toArray() ); |
|
192 | - $basket->deleteAddress( $type ); |
|
191 | + $this->setAddress($type, $item->toArray()); |
|
192 | + $basket->deleteAddress($type); |
|
193 | 193 | } |
194 | - catch( \Exception $e ) |
|
194 | + catch (\Exception $e) |
|
195 | 195 | { |
196 | 196 | $logger = $this->getContext()->getLogger(); |
197 | 197 | $errors['address'][$type] = $e->getMessage(); |
198 | 198 | |
199 | 199 | $str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s'; |
200 | - $logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO ); |
|
200 | + $logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -213,22 +213,22 @@ discard block |
||
213 | 213 | * @param string $localeKey Unique identifier of the site, language and currency |
214 | 214 | * @return array Associative list of errors occured |
215 | 215 | */ |
216 | - protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey ) |
|
216 | + protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey) |
|
217 | 217 | { |
218 | - foreach( $basket->getCoupons() as $code => $list ) |
|
218 | + foreach ($basket->getCoupons() as $code => $list) |
|
219 | 219 | { |
220 | 220 | try |
221 | 221 | { |
222 | - $this->addCoupon( $code ); |
|
223 | - $basket->deleteCoupon( $code, true ); |
|
222 | + $this->addCoupon($code); |
|
223 | + $basket->deleteCoupon($code, true); |
|
224 | 224 | } |
225 | - catch( \Exception $e ) |
|
225 | + catch (\Exception $e) |
|
226 | 226 | { |
227 | 227 | $logger = $this->getContext()->getLogger(); |
228 | 228 | $errors['coupon'][$code] = $e->getMessage(); |
229 | 229 | |
230 | 230 | $str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s'; |
231 | - $logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO ); |
|
231 | + $logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $localeKey Unique identifier of the site, language and currency |
245 | 245 | * @return array Associative list of errors occured |
246 | 246 | */ |
247 | - protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey ) |
|
247 | + protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey) |
|
248 | 248 | { |
249 | - foreach( $basket->getProducts() as $pos => $product ) |
|
249 | + foreach ($basket->getProducts() as $pos => $product) |
|
250 | 250 | { |
251 | - if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) { |
|
251 | + if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) { |
|
252 | 252 | continue; |
253 | 253 | } |
254 | 254 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | { |
257 | 257 | $attrIds = []; |
258 | 258 | |
259 | - foreach( $product->getAttributes() as $attrItem ) { |
|
259 | + foreach ($product->getAttributes() as $attrItem) { |
|
260 | 260 | $attrIds[$attrItem->getType()][] = $attrItem->getAttributeId(); |
261 | 261 | } |
262 | 262 | |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | $product->getProductId(), |
265 | 265 | $product->getQuantity(), |
266 | 266 | $product->getStockType(), |
267 | - $this->getValue( $attrIds, 'variant', [] ), |
|
268 | - $this->getValue( $attrIds, 'config', [] ), |
|
269 | - $this->getValue( $attrIds, 'hidden', [] ), |
|
270 | - $this->getValue( $attrIds, 'custom', [] ) |
|
267 | + $this->getValue($attrIds, 'variant', []), |
|
268 | + $this->getValue($attrIds, 'config', []), |
|
269 | + $this->getValue($attrIds, 'hidden', []), |
|
270 | + $this->getValue($attrIds, 'custom', []) |
|
271 | 271 | ); |
272 | 272 | |
273 | - $basket->deleteProduct( $pos ); |
|
273 | + $basket->deleteProduct($pos); |
|
274 | 274 | } |
275 | - catch( \Exception $e ) |
|
275 | + catch (\Exception $e) |
|
276 | 276 | { |
277 | 277 | $code = $product->getProductCode(); |
278 | 278 | $logger = $this->getContext()->getLogger(); |
279 | 279 | $errors['product'][$pos] = $e->getMessage(); |
280 | 280 | |
281 | 281 | $str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s'; |
282 | - $logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO ); |
|
282 | + $logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -294,24 +294,24 @@ discard block |
||
294 | 294 | * @param array $errors Associative list of previous errors |
295 | 295 | * @return array Associative list of errors occured |
296 | 296 | */ |
297 | - protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors ) |
|
297 | + protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors) |
|
298 | 298 | { |
299 | - foreach( $basket->getServices() as $type => $list ) |
|
299 | + foreach ($basket->getServices() as $type => $list) |
|
300 | 300 | { |
301 | - foreach( $list as $item ) |
|
301 | + foreach ($list as $item) |
|
302 | 302 | { |
303 | 303 | try |
304 | 304 | { |
305 | 305 | $attributes = []; |
306 | 306 | |
307 | - foreach( $item->getAttributes() as $attrItem ) { |
|
307 | + foreach ($item->getAttributes() as $attrItem) { |
|
308 | 308 | $attributes[$attrItem->getCode()] = $attrItem->getValue(); |
309 | 309 | } |
310 | 310 | |
311 | - $this->addService( $type, $item->getServiceId(), $attributes ); |
|
312 | - $basket->deleteService( $type ); |
|
311 | + $this->addService($type, $item->getServiceId(), $attributes); |
|
312 | + $basket->deleteService($type); |
|
313 | 313 | } |
314 | - catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically |
|
314 | + catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface |
328 | 328 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one |
329 | 329 | */ |
330 | - protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) ) |
|
330 | + protected function getAttributes(array $attributeIds, array $domains = array('price', 'text')) |
|
331 | 331 | { |
332 | - if( empty( $attributeIds ) ) { |
|
332 | + if (empty($attributeIds)) { |
|
333 | 333 | return []; |
334 | 334 | } |
335 | 335 | |
336 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
336 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
337 | 337 | |
338 | - $search = $attributeManager->createSearch( true ); |
|
338 | + $search = $attributeManager->createSearch(true); |
|
339 | 339 | $expr = array( |
340 | - $search->compare( '==', 'attribute.id', $attributeIds ), |
|
340 | + $search->compare('==', 'attribute.id', $attributeIds), |
|
341 | 341 | $search->getConditions(), |
342 | 342 | ); |
343 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
344 | - $search->setSlice( 0, 0x7fffffff ); |
|
343 | + $search->setConditions($search->combine('&&', $expr)); |
|
344 | + $search->setSlice(0, 0x7fffffff); |
|
345 | 345 | |
346 | - $attrItems = $attributeManager->searchItems( $search, $domains ); |
|
346 | + $attrItems = $attributeManager->searchItems($search, $domains); |
|
347 | 347 | |
348 | - if( count( $attrItems ) !== count( $attributeIds ) ) |
|
348 | + if (count($attrItems) !== count($attributeIds)) |
|
349 | 349 | { |
350 | 350 | $i18n = $this->getContext()->getI18n(); |
351 | - $expected = implode( ',', $attributeIds ); |
|
352 | - $actual = implode( ',', array_keys( $attrItems ) ); |
|
353 | - $msg = $i18n->dt( 'controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"' ); |
|
351 | + $expected = implode(',', $attributeIds); |
|
352 | + $actual = implode(',', array_keys($attrItems)); |
|
353 | + $msg = $i18n->dt('controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"'); |
|
354 | 354 | |
355 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $actual, $expected ) ); |
|
355 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $actual, $expected)); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return $attrItems; |
@@ -365,31 +365,31 @@ discard block |
||
365 | 365 | * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items |
366 | 366 | * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values |
367 | 367 | */ |
368 | - protected function getAttributeItems( array $orderAttributes ) |
|
368 | + protected function getAttributeItems(array $orderAttributes) |
|
369 | 369 | { |
370 | - if( empty( $orderAttributes ) ) { |
|
370 | + if (empty($orderAttributes)) { |
|
371 | 371 | return []; |
372 | 372 | } |
373 | 373 | |
374 | - $attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
375 | - $search = $attributeManager->createSearch( true ); |
|
374 | + $attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
375 | + $search = $attributeManager->createSearch(true); |
|
376 | 376 | $expr = []; |
377 | 377 | |
378 | - foreach( $orderAttributes as $item ) |
|
378 | + foreach ($orderAttributes as $item) |
|
379 | 379 | { |
380 | 380 | $tmp = array( |
381 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
382 | - $search->compare( '==', 'attribute.code', $item->getValue() ), |
|
383 | - $search->compare( '==', 'attribute.type.domain', 'product' ), |
|
384 | - $search->compare( '==', 'attribute.type.code', $item->getCode() ), |
|
385 | - $search->compare( '>', 'attribute.type.status', 0 ), |
|
381 | + $search->compare('==', 'attribute.domain', 'product'), |
|
382 | + $search->compare('==', 'attribute.code', $item->getValue()), |
|
383 | + $search->compare('==', 'attribute.type.domain', 'product'), |
|
384 | + $search->compare('==', 'attribute.type.code', $item->getCode()), |
|
385 | + $search->compare('>', 'attribute.type.status', 0), |
|
386 | 386 | $search->getConditions(), |
387 | 387 | ); |
388 | - $expr[] = $search->combine( '&&', $tmp ); |
|
388 | + $expr[] = $search->combine('&&', $tmp); |
|
389 | 389 | } |
390 | 390 | |
391 | - $search->setConditions( $search->combine( '||', $expr ) ); |
|
392 | - return $attributeManager->searchItems( $search, array( 'price' ) ); |
|
391 | + $search->setConditions($search->combine('||', $expr)); |
|
392 | + return $attributeManager->searchItems($search, array('price')); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | * @param array $quantities Associative list of attribute IDs as keys and their quantities as values |
403 | 403 | * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface |
404 | 404 | */ |
405 | - protected function getOrderProductAttributes( $type, array $ids, array $values = [], array $quantities = [] ) |
|
405 | + protected function getOrderProductAttributes($type, array $ids, array $values = [], array $quantities = []) |
|
406 | 406 | { |
407 | - if( empty( $ids ) ) { |
|
407 | + if (empty($ids)) { |
|
408 | 408 | return []; |
409 | 409 | } |
410 | 410 | |
411 | 411 | $list = []; |
412 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' ); |
|
412 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute'); |
|
413 | 413 | |
414 | - foreach( $this->getAttributes( $ids ) as $id => $attrItem ) |
|
414 | + foreach ($this->getAttributes($ids) as $id => $attrItem) |
|
415 | 415 | { |
416 | 416 | $item = $manager->createItem(); |
417 | - $item->copyFrom( $attrItem ); |
|
418 | - $item->setType( $type ); |
|
419 | - $item->setQuantity( isset( $quantities[$id] ) ? $quantities[$id] : 1 ); |
|
417 | + $item->copyFrom($attrItem); |
|
418 | + $item->setType($type); |
|
419 | + $item->setQuantity(isset($quantities[$id]) ? $quantities[$id] : 1); |
|
420 | 420 | |
421 | - if( isset( $values[$id] ) ) { |
|
422 | - $item->setValue( $values[$id] ); |
|
421 | + if (isset($values[$id])) { |
|
422 | + $item->setValue($values[$id]); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | $list[] = $item; |
@@ -436,23 +436,23 @@ discard block |
||
436 | 436 | * @param string $code Code of the list type |
437 | 437 | * @return \Aimeos\MShop\Common\Item\Type\Iface List type item |
438 | 438 | */ |
439 | - protected function getProductListTypeItem( $domain, $code ) |
|
439 | + protected function getProductListTypeItem($domain, $code) |
|
440 | 440 | { |
441 | 441 | $context = $this->getContext(); |
442 | 442 | |
443 | - if( empty( $this->listTypeItems ) ) |
|
443 | + if (empty($this->listTypeItems)) |
|
444 | 444 | { |
445 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
445 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
446 | 446 | |
447 | - foreach( $manager->searchItems( $manager->createSearch( true ) ) as $item ) { |
|
448 | - $this->listTypeItems[ $item->getDomain() ][ $item->getCode() ] = $item; |
|
447 | + foreach ($manager->searchItems($manager->createSearch(true)) as $item) { |
|
448 | + $this->listTypeItems[$item->getDomain()][$item->getCode()] = $item; |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
452 | - if( !isset( $this->listTypeItems[$domain][$code] ) ) |
|
452 | + if (!isset($this->listTypeItems[$domain][$code])) |
|
453 | 453 | { |
454 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found' ); |
|
455 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, $code ) ); |
|
454 | + $msg = $context->getI18n()->dt('controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found'); |
|
455 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, $code)); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | return $this->listTypeItems[$domain][$code]; |
@@ -467,43 +467,43 @@ discard block |
||
467 | 467 | * @param array $domains Names of the domain items that should be fetched too |
468 | 468 | * @return array List of products matching the given attributes |
469 | 469 | */ |
470 | - protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, |
|
471 | - array $domains = array( 'attribute', 'media', 'price', 'text' ) ) |
|
470 | + protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, |
|
471 | + array $domains = array('attribute', 'media', 'price', 'text')) |
|
472 | 472 | { |
473 | 473 | $subProductIds = []; |
474 | - foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) { |
|
474 | + foreach ($productItem->getRefItems('product', 'default', 'default') as $item) { |
|
475 | 475 | $subProductIds[] = $item->getId(); |
476 | 476 | } |
477 | 477 | |
478 | - if( count( $subProductIds ) === 0 ) { |
|
478 | + if (count($subProductIds) === 0) { |
|
479 | 479 | return []; |
480 | 480 | } |
481 | 481 | |
482 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
483 | - $search = $productManager->createSearch( true ); |
|
482 | + $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
483 | + $search = $productManager->createSearch(true); |
|
484 | 484 | |
485 | 485 | $expr = array( |
486 | - $search->compare( '==', 'product.id', $subProductIds ), |
|
486 | + $search->compare('==', 'product.id', $subProductIds), |
|
487 | 487 | $search->getConditions(), |
488 | 488 | ); |
489 | 489 | |
490 | - if( count( $variantAttributeIds ) > 0 ) |
|
490 | + if (count($variantAttributeIds) > 0) |
|
491 | 491 | { |
492 | - foreach( $variantAttributeIds as $key => $id ) { |
|
492 | + foreach ($variantAttributeIds as $key => $id) { |
|
493 | 493 | $variantAttributeIds[$key] = (string) $id; |
494 | 494 | } |
495 | 495 | |
496 | - $listTypeItem = $this->getProductListTypeItem( 'attribute', 'variant' ); |
|
496 | + $listTypeItem = $this->getProductListTypeItem('attribute', 'variant'); |
|
497 | 497 | |
498 | - $param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds ); |
|
499 | - $cmpfunc = $search->createFunction( 'product.contains', $param ); |
|
498 | + $param = array('attribute', $listTypeItem->getId(), $variantAttributeIds); |
|
499 | + $cmpfunc = $search->createFunction('product.contains', $param); |
|
500 | 500 | |
501 | - $expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) ); |
|
501 | + $expr[] = $search->compare('==', $cmpfunc, count($variantAttributeIds)); |
|
502 | 502 | } |
503 | 503 | |
504 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
504 | + $search->setConditions($search->combine('&&', $expr)); |
|
505 | 505 | |
506 | - return $productManager->searchItems( $search, $domains ); |
|
506 | + return $productManager->searchItems($search, $domains); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -515,9 +515,9 @@ discard block |
||
515 | 515 | * @param mixed $default Default value if no value is available for the given name |
516 | 516 | * @return mixed Value from the array or default value |
517 | 517 | */ |
518 | - protected function getValue( array $values, $name, $default = null ) |
|
518 | + protected function getValue(array $values, $name, $default = null) |
|
519 | 519 | { |
520 | - if( isset( $values[$name] ) ) { |
|
520 | + if (isset($values[$name])) { |
|
521 | 521 | return $values[$name]; |
522 | 522 | } |
523 | 523 |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases |
34 | 34 | * connections, logger, session, etc. |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
36 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
37 | 37 | { |
38 | - parent::__construct( $context ); |
|
38 | + parent::__construct($context); |
|
39 | 39 | |
40 | - $this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
40 | + $this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function clear() |
50 | 50 | { |
51 | 51 | $this->baskets[$this->type] = $this->domainManager->createItem(); |
52 | - $this->domainManager->setSession( $this->baskets[$this->type], $this->type ); |
|
52 | + $this->domainManager->setSession($this->baskets[$this->type], $this->type); |
|
53 | 53 | |
54 | 54 | return $this; |
55 | 55 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function get() |
64 | 64 | { |
65 | - if( !isset( $this->baskets[$this->type] ) ) |
|
65 | + if (!isset($this->baskets[$this->type])) |
|
66 | 66 | { |
67 | - $this->baskets[$this->type] = $this->domainManager->getSession( $this->type ); |
|
68 | - $this->checkLocale( $this->type ); |
|
67 | + $this->baskets[$this->type] = $this->domainManager->getSession($this->type); |
|
68 | + $this->checkLocale($this->type); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $this->baskets[$this->type]; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function save() |
81 | 81 | { |
82 | - if( isset( $this->baskets[$this->type] ) && $this->baskets[$this->type]->isModified() ) { |
|
83 | - $this->domainManager->setSession( $this->baskets[$this->type], $this->type ); |
|
82 | + if (isset($this->baskets[$this->type]) && $this->baskets[$this->type]->isModified()) { |
|
83 | + $this->domainManager->setSession($this->baskets[$this->type], $this->type); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $this; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $type Basket type |
94 | 94 | * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object |
95 | 95 | */ |
96 | - public function setType( $type ) |
|
96 | + public function setType($type) |
|
97 | 97 | { |
98 | 98 | $this->type = $type; |
99 | 99 | return $this; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @category Developer |
128 | 128 | * @see controller/frontend/basket/limit-seconds |
129 | 129 | */ |
130 | - $count = $config->get( 'controller/frontend/basket/limit-count', 5 ); |
|
130 | + $count = $config->get('controller/frontend/basket/limit-count', 5); |
|
131 | 131 | |
132 | 132 | /** controller/frontend/basket/limit-seconds |
133 | 133 | * Order limitation time frame in seconds |
@@ -145,30 +145,30 @@ discard block |
||
145 | 145 | * @category Developer |
146 | 146 | * @see controller/frontend/basket/limit-count |
147 | 147 | */ |
148 | - $seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 ); |
|
148 | + $seconds = $config->get('controller/frontend/basket/limit-seconds', 300); |
|
149 | 149 | |
150 | 150 | $search = $this->domainManager->createSearch(); |
151 | 151 | $expr = [ |
152 | - $search->compare( '==', 'order.base.editor', $context->getEditor() ), |
|
153 | - $search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
152 | + $search->compare('==', 'order.base.editor', $context->getEditor()), |
|
153 | + $search->compare('>=', 'order.base.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
154 | 154 | ]; |
155 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
156 | - $search->setSlice( 0, 0 ); |
|
155 | + $search->setConditions($search->combine('&&', $expr)); |
|
156 | + $search->setSlice(0, 0); |
|
157 | 157 | |
158 | - $this->domainManager->searchItems( $search, [], $total ); |
|
158 | + $this->domainManager->searchItems($search, [], $total); |
|
159 | 159 | |
160 | - if( $total > $count ) |
|
160 | + if ($total > $count) |
|
161 | 161 | { |
162 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Temporary order limit reached' ); |
|
163 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
162 | + $msg = $context->getI18n()->dt('controller/frontend', 'Temporary order limit reached'); |
|
163 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | 167 | $basket = $this->get()->finish(); |
168 | - $basket->setCustomerId( (string) $context->getUserId() ); |
|
168 | + $basket->setCustomerId((string) $context->getUserId()); |
|
169 | 169 | |
170 | 170 | $this->domainManager->begin(); |
171 | - $this->domainManager->store( $basket ); |
|
171 | + $this->domainManager->store($basket); |
|
172 | 172 | $this->domainManager->commit(); |
173 | 173 | |
174 | 174 | return $basket; |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param boolean $default True to add default criteria (user logged in), false if not |
184 | 184 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts |
185 | 185 | */ |
186 | - public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true ) |
|
186 | + public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true) |
|
187 | 187 | { |
188 | - return $this->domainManager->load( $id, $parts, false, $default ); |
|
188 | + return $this->domainManager->load($id, $parts, false, $default); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -204,33 +204,33 @@ discard block |
||
204 | 204 | * @param string $stocktype Unique code of the stock type to deliver the products from |
205 | 205 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
206 | 206 | */ |
207 | - public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [], |
|
208 | - array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] ) |
|
207 | + public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [], |
|
208 | + array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = []) |
|
209 | 209 | { |
210 | 210 | $attributeMap = [ |
211 | - 'custom' => array_keys( $customAttributeValues ), |
|
212 | - 'config' => array_keys( $configAttributeIds ), |
|
211 | + 'custom' => array_keys($customAttributeValues), |
|
212 | + 'config' => array_keys($configAttributeIds), |
|
213 | 213 | 'hidden' => $hiddenAttributeIds, |
214 | 214 | ]; |
215 | - $this->checkListRef( $prodid, 'attribute', $attributeMap ); |
|
215 | + $this->checkListRef($prodid, 'attribute', $attributeMap); |
|
216 | 216 | |
217 | 217 | |
218 | 218 | $context = $this->getContext(); |
219 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
220 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ), true ); |
|
221 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
219 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
220 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'), true); |
|
221 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
222 | 222 | |
223 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
224 | - $orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype ); |
|
223 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
224 | + $orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype); |
|
225 | 225 | |
226 | - $attr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues ); |
|
227 | - $attr = array_merge( $attr, $this->getOrderProductAttributes( 'config', array_keys( $configAttributeIds ), [], $configAttributeIds ) ); |
|
228 | - $attr = array_merge( $attr, $this->getOrderProductAttributes( 'hidden', $hiddenAttributeIds ) ); |
|
226 | + $attr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues); |
|
227 | + $attr = array_merge($attr, $this->getOrderProductAttributes('config', array_keys($configAttributeIds), [], $configAttributeIds)); |
|
228 | + $attr = array_merge($attr, $this->getOrderProductAttributes('hidden', $hiddenAttributeIds)); |
|
229 | 229 | |
230 | - $orderBaseProductItem->setAttributes( $attr ); |
|
231 | - $orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) ); |
|
230 | + $orderBaseProductItem->setAttributes($attr); |
|
231 | + $orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity)); |
|
232 | 232 | |
233 | - $this->get()->addProduct( $orderBaseProductItem ); |
|
233 | + $this->get()->addProduct($orderBaseProductItem); |
|
234 | 234 | $this->save(); |
235 | 235 | } |
236 | 236 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param integer $position Position number (key) of the order product item |
242 | 242 | */ |
243 | - public function deleteProduct( $position ) |
|
243 | + public function deleteProduct($position) |
|
244 | 244 | { |
245 | - $product = $this->get()->getProduct( $position ); |
|
245 | + $product = $this->get()->getProduct($position); |
|
246 | 246 | |
247 | - if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
247 | + if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
248 | 248 | { |
249 | - $msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually' ); |
|
250 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) ); |
|
249 | + $msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually'); |
|
250 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position)); |
|
251 | 251 | } |
252 | 252 | |
253 | - $this->get()->deleteProduct( $position ); |
|
253 | + $this->get()->deleteProduct($position); |
|
254 | 254 | $this->save(); |
255 | 255 | } |
256 | 256 | |
@@ -262,32 +262,32 @@ discard block |
||
262 | 262 | * @param integer $quantity New quantiy of the product item |
263 | 263 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
264 | 264 | */ |
265 | - public function editProduct( $position, $quantity, array $configAttributeCodes = [] ) |
|
265 | + public function editProduct($position, $quantity, array $configAttributeCodes = []) |
|
266 | 266 | { |
267 | - $product = $this->get()->getProduct( $position ); |
|
267 | + $product = $this->get()->getProduct($position); |
|
268 | 268 | |
269 | - if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
269 | + if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
270 | 270 | { |
271 | - $msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be changed' ); |
|
272 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) ); |
|
271 | + $msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Basket item at position "%1$d" cannot be changed'); |
|
272 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $position)); |
|
273 | 273 | } |
274 | 274 | |
275 | - $product->setQuantity( $quantity ); |
|
275 | + $product->setQuantity($quantity); |
|
276 | 276 | |
277 | 277 | $attributes = $product->getAttributes(); |
278 | - foreach( $attributes as $key => $attribute ) |
|
278 | + foreach ($attributes as $key => $attribute) |
|
279 | 279 | { |
280 | - if( in_array( $attribute->getCode(), $configAttributeCodes ) ) { |
|
281 | - unset( $attributes[$key] ); |
|
280 | + if (in_array($attribute->getCode(), $configAttributeCodes)) { |
|
281 | + unset($attributes[$key]); |
|
282 | 282 | } |
283 | 283 | } |
284 | - $product->setAttributes( $attributes ); |
|
284 | + $product->setAttributes($attributes); |
|
285 | 285 | |
286 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
287 | - $productItem = $manager->findItem( $product->getProductCode(), array( 'price', 'text' ) ); |
|
288 | - $product->setPrice( $this->calcPrice( $product, $productItem->getRefItems( 'price', 'default' ), $quantity ) ); |
|
286 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
287 | + $productItem = $manager->findItem($product->getProductCode(), array('price', 'text')); |
|
288 | + $product->setPrice($this->calcPrice($product, $productItem->getRefItems('price', 'default'), $quantity)); |
|
289 | 289 | |
290 | - $this->get()->editProduct( $product, $position ); |
|
290 | + $this->get()->editProduct($product, $position); |
|
291 | 291 | |
292 | 292 | $this->save(); |
293 | 293 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $code Coupon code entered by the user |
300 | 300 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
301 | 301 | */ |
302 | - public function addCoupon( $code ) |
|
302 | + public function addCoupon($code) |
|
303 | 303 | { |
304 | 304 | $context = $this->getContext(); |
305 | 305 | |
@@ -319,62 +319,62 @@ discard block |
||
319 | 319 | * @category User |
320 | 320 | * @category Developer |
321 | 321 | */ |
322 | - $allowed = $context->getConfig()->get( 'controller/frontend/basket/standard/coupon/allowed', 1 ); |
|
322 | + $allowed = $context->getConfig()->get('controller/frontend/basket/standard/coupon/allowed', 1); |
|
323 | 323 | |
324 | - if( $allowed <= count( $this->get()->getCoupons() ) ) |
|
324 | + if ($allowed <= count($this->get()->getCoupons())) |
|
325 | 325 | { |
326 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Number of coupon codes exceeds the limit' ); |
|
327 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
326 | + $msg = $context->getI18n()->dt('controller/frontend', 'Number of coupon codes exceeds the limit'); |
|
327 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
331 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
332 | - $codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
331 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
332 | + $codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
333 | 333 | |
334 | 334 | |
335 | - $search = $codeManager->createSearch( true ); |
|
335 | + $search = $codeManager->createSearch(true); |
|
336 | 336 | $expr = array( |
337 | - $search->compare( '==', 'coupon.code.code', $code ), |
|
337 | + $search->compare('==', 'coupon.code.code', $code), |
|
338 | 338 | $search->getConditions(), |
339 | 339 | ); |
340 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
341 | - $search->setSlice( 0, 1 ); |
|
340 | + $search->setConditions($search->combine('&&', $expr)); |
|
341 | + $search->setSlice(0, 1); |
|
342 | 342 | |
343 | - $result = $codeManager->searchItems( $search ); |
|
343 | + $result = $codeManager->searchItems($search); |
|
344 | 344 | |
345 | - if( ( $codeItem = reset( $result ) ) === false ) |
|
345 | + if (($codeItem = reset($result)) === false) |
|
346 | 346 | { |
347 | - $msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid or not available any more' ), $code ); |
|
348 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
347 | + $msg = sprintf($context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid or not available any more'), $code); |
|
348 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
352 | - $search = $manager->createSearch( true ); |
|
352 | + $search = $manager->createSearch(true); |
|
353 | 353 | $expr = array( |
354 | - $search->compare( '==', 'coupon.id', $codeItem->getParentId() ), |
|
354 | + $search->compare('==', 'coupon.id', $codeItem->getParentId()), |
|
355 | 355 | $search->getConditions(), |
356 | 356 | ); |
357 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
358 | - $search->setSlice( 0, 1 ); |
|
357 | + $search->setConditions($search->combine('&&', $expr)); |
|
358 | + $search->setSlice(0, 1); |
|
359 | 359 | |
360 | - $result = $manager->searchItems( $search ); |
|
360 | + $result = $manager->searchItems($search); |
|
361 | 361 | |
362 | - if( ( $item = reset( $result ) ) === false ) |
|
362 | + if (($item = reset($result)) === false) |
|
363 | 363 | { |
364 | - $msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Coupon for code "%1$s" is not available any more' ), $code ); |
|
365 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
364 | + $msg = sprintf($context->getI18n()->dt('controller/frontend', 'Coupon for code "%1$s" is not available any more'), $code); |
|
365 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
369 | - $provider = $manager->getProvider( $item, $codeItem->getCode() ); |
|
369 | + $provider = $manager->getProvider($item, $codeItem->getCode()); |
|
370 | 370 | |
371 | - if( $provider->isAvailable( $this->get() ) !== true ) |
|
371 | + if ($provider->isAvailable($this->get()) !== true) |
|
372 | 372 | { |
373 | - $msg = sprintf( $context->getI18n()->dt( 'controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met' ), $code ); |
|
374 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
373 | + $msg = sprintf($context->getI18n()->dt('controller/frontend', 'Requirements for coupon code "%1$s" aren\'t met'), $code); |
|
374 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
375 | 375 | } |
376 | 376 | |
377 | - $provider->addCoupon( $this->get() ); |
|
377 | + $provider->addCoupon($this->get()); |
|
378 | 378 | $this->save(); |
379 | 379 | } |
380 | 380 | |
@@ -385,24 +385,24 @@ discard block |
||
385 | 385 | * @param string $code Coupon code entered by the user |
386 | 386 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
387 | 387 | */ |
388 | - public function deleteCoupon( $code ) |
|
388 | + public function deleteCoupon($code) |
|
389 | 389 | { |
390 | 390 | $context = $this->getContext(); |
391 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' ); |
|
391 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'coupon'); |
|
392 | 392 | |
393 | 393 | $search = $manager->createSearch(); |
394 | - $search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) ); |
|
395 | - $search->setSlice( 0, 1 ); |
|
394 | + $search->setConditions($search->compare('==', 'coupon.code.code', $code)); |
|
395 | + $search->setSlice(0, 1); |
|
396 | 396 | |
397 | - $result = $manager->searchItems( $search ); |
|
397 | + $result = $manager->searchItems($search); |
|
398 | 398 | |
399 | - if( ( $item = reset( $result ) ) === false ) |
|
399 | + if (($item = reset($result)) === false) |
|
400 | 400 | { |
401 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Coupon code "%1$s" is invalid' ); |
|
402 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $code ) ); |
|
401 | + $msg = $context->getI18n()->dt('controller/frontend', 'Coupon code "%1$s" is invalid'); |
|
402 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $code)); |
|
403 | 403 | } |
404 | 404 | |
405 | - $manager->getProvider( $item, $code )->deleteCoupon( $this->get() ); |
|
405 | + $manager->getProvider($item, $code)->deleteCoupon($this->get()); |
|
406 | 406 | $this->save(); |
407 | 407 | } |
408 | 408 | |
@@ -415,30 +415,30 @@ discard block |
||
415 | 415 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
416 | 416 | * if one of the keys is invalid when using an array with key/value pairs |
417 | 417 | */ |
418 | - public function setAddress( $type, $value ) |
|
418 | + public function setAddress($type, $value) |
|
419 | 419 | { |
420 | 420 | $context = $this->getContext(); |
421 | - $address = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' )->createItem(); |
|
422 | - $address->setType( $type ); |
|
421 | + $address = \Aimeos\MShop\Factory::createManager($context, 'order/base/address')->createItem(); |
|
422 | + $address->setType($type); |
|
423 | 423 | |
424 | - if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface ) |
|
424 | + if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface) |
|
425 | 425 | { |
426 | - $address->copyFrom( $value ); |
|
427 | - $this->get()->setAddress( $address, $type ); |
|
426 | + $address->copyFrom($value); |
|
427 | + $this->get()->setAddress($address, $type); |
|
428 | 428 | } |
429 | - else if( is_array( $value ) ) |
|
429 | + else if (is_array($value)) |
|
430 | 430 | { |
431 | - $this->setAddressFromArray( $address, $value ); |
|
432 | - $this->get()->setAddress( $address, $type ); |
|
431 | + $this->setAddressFromArray($address, $value); |
|
432 | + $this->get()->setAddress($address, $type); |
|
433 | 433 | } |
434 | - else if( $value === null ) |
|
434 | + else if ($value === null) |
|
435 | 435 | { |
436 | - $this->get()->deleteAddress( $type ); |
|
436 | + $this->get()->deleteAddress($type); |
|
437 | 437 | } |
438 | 438 | else |
439 | 439 | { |
440 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid value for address type "%1$s"' ); |
|
441 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $type ) ); |
|
440 | + $msg = $context->getI18n()->dt('controller/frontend', 'Invalid value for address type "%1$s"'); |
|
441 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $type)); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $this->save(); |
@@ -454,42 +454,42 @@ discard block |
||
454 | 454 | * entered by the customer when choosing one of the delivery or payment options |
455 | 455 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
456 | 456 | */ |
457 | - public function addService( $type, $id, array $attributes = [] ) |
|
457 | + public function addService($type, $id, array $attributes = []) |
|
458 | 458 | { |
459 | 459 | $context = $this->getContext(); |
460 | 460 | |
461 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
462 | - $serviceItem = $serviceManager->getItem( $id, array( 'media', 'price', 'text' ) ); |
|
461 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
462 | + $serviceItem = $serviceManager->getItem($id, array('media', 'price', 'text')); |
|
463 | 463 | |
464 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
465 | - $result = $provider->checkConfigFE( $attributes ); |
|
466 | - $unknown = array_diff_key( $attributes, $result ); |
|
464 | + $provider = $serviceManager->getProvider($serviceItem); |
|
465 | + $result = $provider->checkConfigFE($attributes); |
|
466 | + $unknown = array_diff_key($attributes, $result); |
|
467 | 467 | |
468 | - if( count( $unknown ) > 0 ) |
|
468 | + if (count($unknown) > 0) |
|
469 | 469 | { |
470 | - $msg = $context->getI18n()->dt( 'controller/frontend', 'Unknown attributes "%1$s"' ); |
|
471 | - $msg = sprintf( $msg, implode( '","', array_keys( $unknown ) ) ); |
|
472 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
470 | + $msg = $context->getI18n()->dt('controller/frontend', 'Unknown attributes "%1$s"'); |
|
471 | + $msg = sprintf($msg, implode('","', array_keys($unknown))); |
|
472 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
473 | 473 | } |
474 | 474 | |
475 | - foreach( $result as $key => $value ) |
|
475 | + foreach ($result as $key => $value) |
|
476 | 476 | { |
477 | - if( $value !== null ) { |
|
478 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $value ); |
|
477 | + if ($value !== null) { |
|
478 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($value); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | - $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
482 | + $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
483 | 483 | $orderServiceItem = $orderBaseServiceManager->createItem(); |
484 | - $orderServiceItem->copyFrom( $serviceItem ); |
|
484 | + $orderServiceItem->copyFrom($serviceItem); |
|
485 | 485 | |
486 | 486 | // remove service rebate of original price |
487 | - $price = $provider->calcPrice( $this->get() )->setRebate( '0.00' ); |
|
488 | - $orderServiceItem->setPrice( $price ); |
|
487 | + $price = $provider->calcPrice($this->get())->setRebate('0.00'); |
|
488 | + $orderServiceItem->setPrice($price); |
|
489 | 489 | |
490 | - $provider->setConfigFE( $orderServiceItem, $attributes ); |
|
490 | + $provider->setConfigFE($orderServiceItem, $attributes); |
|
491 | 491 | |
492 | - $this->get()->addService( $orderServiceItem, $type ); |
|
492 | + $this->get()->addService($orderServiceItem, $type); |
|
493 | 493 | $this->save(); |
494 | 494 | } |
495 | 495 | |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @param string $type Service type code like 'payment' or 'delivery' |
501 | 501 | */ |
502 | - public function deleteService( $type ) |
|
502 | + public function deleteService($type) |
|
503 | 503 | { |
504 | - $this->get()->deleteService( $type ); |
|
504 | + $this->get()->deleteService($type); |
|
505 | 505 | $this->save(); |
506 | 506 | } |
507 | 507 | |
@@ -514,18 +514,18 @@ discard block |
||
514 | 514 | * an address item. |
515 | 515 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
516 | 516 | */ |
517 | - protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
|
517 | + protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map) |
|
518 | 518 | { |
519 | - foreach( $map as $key => $value ) { |
|
520 | - $map[$key] = strip_tags( $value ); // prevent XSS |
|
519 | + foreach ($map as $key => $value) { |
|
520 | + $map[$key] = strip_tags($value); // prevent XSS |
|
521 | 521 | } |
522 | 522 | |
523 | - $errors = $address->fromArray( $map ); |
|
523 | + $errors = $address->fromArray($map); |
|
524 | 524 | |
525 | - if( count( $errors ) > 0 ) |
|
525 | + if (count($errors) > 0) |
|
526 | 526 | { |
527 | - $msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Invalid address properties, please check your input' ); |
|
528 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors ); |
|
527 | + $msg = $this->getContext()->getI18n()->dt('controller/frontend', 'Invalid address properties, please check your input'); |
|
528 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors); |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | } |
@@ -28,33 +28,33 @@ discard block |
||
28 | 28 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
29 | 29 | * @since 2017.04 |
30 | 30 | */ |
31 | - public function addItem( array $values ) |
|
31 | + public function addItem(array $values) |
|
32 | 32 | { |
33 | 33 | $list = []; |
34 | 34 | $context = $this->getContext(); |
35 | 35 | $config = $context->getConfig(); |
36 | 36 | |
37 | 37 | // Show only generated passwords in account creation e-mails |
38 | - $pass = ( isset( $values['customer.password'] ) ? false : true ); |
|
38 | + $pass = (isset($values['customer.password']) ? false : true); |
|
39 | 39 | |
40 | - foreach( $values as $key => $val ) { |
|
41 | - $list[str_replace( 'order.base.address', 'customer', $key )] = $val; |
|
40 | + foreach ($values as $key => $val) { |
|
41 | + $list[str_replace('order.base.address', 'customer', $key)] = $val; |
|
42 | 42 | } |
43 | 43 | |
44 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
45 | - $list = $this->addItemDefaults( $list ); |
|
44 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
45 | + $list = $this->addItemDefaults($list); |
|
46 | 46 | |
47 | 47 | try |
48 | 48 | { |
49 | - $item = $manager->findItem( $list['customer.code'] ); |
|
49 | + $item = $manager->findItem($list['customer.code']); |
|
50 | 50 | } |
51 | - catch( \Aimeos\MShop\Exception $e ) |
|
51 | + catch (\Aimeos\MShop\Exception $e) |
|
52 | 52 | { |
53 | - $this->checkLimit( $list ); |
|
53 | + $this->checkLimit($list); |
|
54 | 54 | |
55 | 55 | $item = $manager->createItem(); |
56 | - $item->fromArray( $list ); |
|
57 | - $item->setId( null ); |
|
56 | + $item->fromArray($list); |
|
57 | + $item->setId(null); |
|
58 | 58 | |
59 | 59 | /** controller/frontend/customer/groupids |
60 | 60 | * List of groups new customers should be assigned to |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * @category User |
69 | 69 | * @category Developer |
70 | 70 | */ |
71 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', [] ) ); |
|
71 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', [])); |
|
72 | 72 | |
73 | - $item = $manager->saveItem( $item ); |
|
73 | + $item = $manager->saveItem($item); |
|
74 | 74 | |
75 | 75 | $msg = $item->toArray(); |
76 | - $msg['customer.password'] = ( $pass ? $list['customer.password'] : null ); |
|
77 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
76 | + $msg['customer.password'] = ($pass ? $list['customer.password'] : null); |
|
77 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | return $item; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
88 | 88 | */ |
89 | - public function createItem( array $values = [] ) |
|
89 | + public function createItem(array $values = []) |
|
90 | 90 | { |
91 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
91 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
92 | 92 | |
93 | 93 | $item = $manager->createItem(); |
94 | - $item->fromArray( $values ); |
|
95 | - $item->setId( null ); |
|
96 | - $item->setStatus( 1 ); |
|
94 | + $item->fromArray($values); |
|
95 | + $item->setId(null); |
|
96 | + $item->setStatus(1); |
|
97 | 97 | |
98 | 98 | return $item; |
99 | 99 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | * @param string $id Unique customer ID |
106 | 106 | * @since 2017.04 |
107 | 107 | */ |
108 | - public function deleteItem( $id ) |
|
108 | + public function deleteItem($id) |
|
109 | 109 | { |
110 | - $this->checkUser( $id ); |
|
110 | + $this->checkUser($id); |
|
111 | 111 | |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
113 | - $manager->deleteItem( $id ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
113 | + $manager->deleteItem($id); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
123 | 123 | * @since 2017.04 |
124 | 124 | */ |
125 | - public function editItem( $id, array $values ) |
|
125 | + public function editItem($id, array $values) |
|
126 | 126 | { |
127 | - $this->checkUser( $id ); |
|
127 | + $this->checkUser($id); |
|
128 | 128 | |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
130 | - $item = $manager->getItem( $id, ['customer/group'], true ); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
130 | + $item = $manager->getItem($id, ['customer/group'], true); |
|
131 | 131 | |
132 | - unset( $values['customer.id'] ); |
|
133 | - $item->fromArray( $values ); |
|
132 | + unset($values['customer.id']); |
|
133 | + $item->fromArray($values); |
|
134 | 134 | |
135 | - return $manager->saveItem( $item ); |
|
135 | + return $manager->saveItem($item); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
145 | 145 | * @since 2017.04 |
146 | 146 | */ |
147 | - public function getItem( $id = null, array $domains = [] ) |
|
147 | + public function getItem($id = null, array $domains = []) |
|
148 | 148 | { |
149 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
149 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
150 | 150 | |
151 | - if( $id == null ) { |
|
152 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
151 | + if ($id == null) { |
|
152 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
153 | 153 | } |
154 | 154 | |
155 | - $this->checkUser( $id ); |
|
155 | + $this->checkUser($id); |
|
156 | 156 | |
157 | - return $manager->getItem( $id, $domains, true ); |
|
157 | + return $manager->getItem($id, $domains, true); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
169 | 169 | * @since 2017.04 |
170 | 170 | */ |
171 | - public function findItem( $code, array $domains = [] ) |
|
171 | + public function findItem($code, array $domains = []) |
|
172 | 172 | { |
173 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
173 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
181 | 181 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
182 | 182 | */ |
183 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
183 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
184 | 184 | { |
185 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
185 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
194 | 194 | * @since 2017.04 |
195 | 195 | */ |
196 | - public function addAddressItem( array $values ) |
|
196 | + public function addAddressItem(array $values) |
|
197 | 197 | { |
198 | 198 | $context = $this->getContext(); |
199 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
199 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
200 | 200 | |
201 | 201 | $item = $manager->createItem(); |
202 | - $item->fromArray( $values ); |
|
203 | - $item->setId( null ); |
|
204 | - $item->setParentId( $context->getUserId() ); |
|
202 | + $item->fromArray($values); |
|
203 | + $item->setId(null); |
|
204 | + $item->setParentId($context->getUserId()); |
|
205 | 205 | |
206 | - return $manager->saveItem( $item ); |
|
206 | + return $manager->saveItem($item); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
214 | 214 | */ |
215 | - public function createAddressItem( array $values = [] ) |
|
215 | + public function createAddressItem(array $values = []) |
|
216 | 216 | { |
217 | 217 | $context = $this->getContext(); |
218 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
218 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
219 | 219 | |
220 | 220 | $item = $manager->createItem(); |
221 | - $item->fromArray( $values ); |
|
222 | - $item->setId( null ); |
|
221 | + $item->fromArray($values); |
|
222 | + $item->setId(null); |
|
223 | 223 | |
224 | - $item->setParentId( $context->getUserId() ); |
|
224 | + $item->setParentId($context->getUserId()); |
|
225 | 225 | |
226 | 226 | return $item; |
227 | 227 | } |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | * @param string $id Unique customer address ID |
234 | 234 | * @since 2017.04 |
235 | 235 | */ |
236 | - public function deleteAddressItem( $id ) |
|
236 | + public function deleteAddressItem($id) |
|
237 | 237 | { |
238 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
238 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
239 | 239 | |
240 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
240 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
241 | 241 | |
242 | - $manager->deleteItem( $id ); |
|
242 | + $manager->deleteItem($id); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -251,17 +251,17 @@ discard block |
||
251 | 251 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
252 | 252 | * @since 2017.04 |
253 | 253 | */ |
254 | - public function editAddressItem( $id, array $values ) |
|
254 | + public function editAddressItem($id, array $values) |
|
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
256 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
257 | 257 | |
258 | - $item = $manager->getItem( $id, [], true ); |
|
259 | - $this->checkUser( $item->getParentId() ); |
|
258 | + $item = $manager->getItem($id, [], true); |
|
259 | + $this->checkUser($item->getParentId()); |
|
260 | 260 | |
261 | - unset( $values['customer.address.id'] ); |
|
262 | - $item->fromArray( $values ); |
|
261 | + unset($values['customer.address.id']); |
|
262 | + $item->fromArray($values); |
|
263 | 263 | |
264 | - return $manager->saveItem( $item ); |
|
264 | + return $manager->saveItem($item); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
273 | 273 | * @since 2017.04 |
274 | 274 | */ |
275 | - public function getAddressItem( $id ) |
|
275 | + public function getAddressItem($id) |
|
276 | 276 | { |
277 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
277 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
278 | 278 | |
279 | - $item = $manager->getItem( $id ); |
|
280 | - $this->checkUser( $item->getParentId() ); |
|
279 | + $item = $manager->getItem($id); |
|
280 | + $this->checkUser($item->getParentId()); |
|
281 | 281 | |
282 | 282 | return $item; |
283 | 283 | } |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
290 | 290 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
291 | 291 | */ |
292 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
292 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
293 | 293 | { |
294 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
294 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
303 | 303 | * @since 2017.06 |
304 | 304 | */ |
305 | - public function addListItem( array $values ) |
|
305 | + public function addListItem(array $values) |
|
306 | 306 | { |
307 | 307 | $context = $this->getContext(); |
308 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
308 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
309 | 309 | |
310 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
310 | + if (!isset($values['customer.lists.typeid'])) |
|
311 | 311 | { |
312 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
313 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
312 | + if (!isset($values['customer.lists.type'])) { |
|
313 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
314 | 314 | } |
315 | 315 | |
316 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
317 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
316 | + if (!isset($values['customer.lists.domain'])) { |
|
317 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
318 | 318 | } |
319 | 319 | |
320 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
321 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
320 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
321 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
322 | 322 | $values['customer.lists.typeid'] = $typeItem->getId(); |
323 | 323 | } |
324 | 324 | |
325 | 325 | $item = $manager->createItem(); |
326 | - $item->fromArray( $values ); |
|
327 | - $item->setId( null ); |
|
328 | - $item->setParentId( $context->getUserId() ); |
|
326 | + $item->fromArray($values); |
|
327 | + $item->setId(null); |
|
328 | + $item->setParentId($context->getUserId()); |
|
329 | 329 | |
330 | - return $manager->saveItem( $item ); |
|
330 | + return $manager->saveItem($item); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | public function createListsFilter() |
341 | 341 | { |
342 | 342 | $context = $this->getContext(); |
343 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
343 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
344 | 344 | |
345 | 345 | $filter = $manager->createSearch(); |
346 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
346 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
347 | 347 | |
348 | 348 | return $filter; |
349 | 349 | } |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | * @param string $id Unique customer address ID |
356 | 356 | * @since 2017.06 |
357 | 357 | */ |
358 | - public function deleteListItem( $id ) |
|
358 | + public function deleteListItem($id) |
|
359 | 359 | { |
360 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
360 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
361 | 361 | |
362 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
362 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
363 | 363 | |
364 | - $manager->deleteItem( $id ); |
|
364 | + $manager->deleteItem($id); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -373,33 +373,33 @@ discard block |
||
373 | 373 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
374 | 374 | * @since 2017.06 |
375 | 375 | */ |
376 | - public function editListItem( $id, array $values ) |
|
376 | + public function editListItem($id, array $values) |
|
377 | 377 | { |
378 | 378 | $context = $this->getContext(); |
379 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
379 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
380 | 380 | |
381 | - $item = $manager->getItem( $id, [], true ); |
|
382 | - $this->checkUser( $item->getParentId() ); |
|
381 | + $item = $manager->getItem($id, [], true); |
|
382 | + $this->checkUser($item->getParentId()); |
|
383 | 383 | |
384 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
384 | + if (!isset($values['customer.lists.typeid'])) |
|
385 | 385 | { |
386 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
387 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
386 | + if (!isset($values['customer.lists.type'])) { |
|
387 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
388 | 388 | } |
389 | 389 | |
390 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
391 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
390 | + if (!isset($values['customer.lists.domain'])) { |
|
391 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
392 | 392 | } |
393 | 393 | |
394 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
395 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
394 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
395 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
396 | 396 | $values['customer.lists.typeid'] = $typeItem->getId(); |
397 | 397 | } |
398 | 398 | |
399 | - unset( $values['customer.lists.id'] ); |
|
400 | - $item->fromArray( $values ); |
|
399 | + unset($values['customer.lists.id']); |
|
400 | + $item->fromArray($values); |
|
401 | 401 | |
402 | - return $manager->saveItem( $item ); |
|
402 | + return $manager->saveItem($item); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
411 | 411 | * @since 2017.06 |
412 | 412 | */ |
413 | - public function getListItem( $id ) |
|
413 | + public function getListItem($id) |
|
414 | 414 | { |
415 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
416 | - $item = $manager->getItem( $id ); |
|
415 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
416 | + $item = $manager->getItem($id); |
|
417 | 417 | |
418 | - $this->checkUser( $item->getParentId() ); |
|
418 | + $this->checkUser($item->getParentId()); |
|
419 | 419 | |
420 | 420 | return $item; |
421 | 421 | } |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
430 | 430 | * @since 2017.06 |
431 | 431 | */ |
432 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
432 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
433 | 433 | { |
434 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
434 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
435 | 435 | |
436 | - return $manager->searchItems( $filter, [], $total ); |
|
436 | + return $manager->searchItems($filter, [], $total); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | |
@@ -443,37 +443,37 @@ discard block |
||
443 | 443 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
444 | 444 | * @return string[] Associative list of customer key/value pairs with default values set |
445 | 445 | */ |
446 | - protected function addItemDefaults( array $values ) |
|
446 | + protected function addItemDefaults(array $values) |
|
447 | 447 | { |
448 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
448 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
449 | 449 | { |
450 | 450 | $label = ''; |
451 | 451 | |
452 | - if( isset( $values['customer.lastname'] ) ) { |
|
452 | + if (isset($values['customer.lastname'])) { |
|
453 | 453 | $label = $values['customer.lastname']; |
454 | 454 | } |
455 | 455 | |
456 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
456 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
457 | 457 | $label = $values['customer.firstname'] . ' ' . $label; |
458 | 458 | } |
459 | 459 | |
460 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
460 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
461 | 461 | $label .= ' (' . $values['customer.company'] . ')'; |
462 | 462 | } |
463 | 463 | |
464 | 464 | $values['customer.label'] = $label; |
465 | 465 | } |
466 | 466 | |
467 | - if( !isset( $values['customer.code'] ) && isset( $values['customer.email'] ) ) { |
|
467 | + if (!isset($values['customer.code']) && isset($values['customer.email'])) { |
|
468 | 468 | $values['customer.code'] = $values['customer.email']; |
469 | 469 | } |
470 | 470 | |
471 | - if( !isset( $values['customer.status'] ) ) { |
|
471 | + if (!isset($values['customer.status'])) { |
|
472 | 472 | $values['customer.status'] = 1; |
473 | 473 | } |
474 | 474 | |
475 | - if( !isset( $values['customer.password'] ) ) { |
|
476 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
475 | + if (!isset($values['customer.password'])) { |
|
476 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | return $values; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
487 | 487 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
488 | 488 | */ |
489 | - protected function checkLimit( array $values ) |
|
489 | + protected function checkLimit(array $values) |
|
490 | 490 | { |
491 | 491 | $total = 0; |
492 | 492 | $context = $this->getContext(); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @category Developer |
508 | 508 | * @see controller/frontend/customer/limit-seconds |
509 | 509 | */ |
510 | - $count = $config->get( 'controller/frontend/customer/limit-count', 5 ); |
|
510 | + $count = $config->get('controller/frontend/customer/limit-count', 5); |
|
511 | 511 | |
512 | 512 | /** controller/frontend/customer/limit-seconds |
513 | 513 | * Customer account limitation time frame in seconds |
@@ -525,22 +525,22 @@ discard block |
||
525 | 525 | * @category Developer |
526 | 526 | * @see controller/frontend/customer/limit-count |
527 | 527 | */ |
528 | - $seconds = $config->get( 'controller/frontend/customer/limit-seconds', 300 ); |
|
528 | + $seconds = $config->get('controller/frontend/customer/limit-seconds', 300); |
|
529 | 529 | |
530 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
530 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
531 | 531 | |
532 | 532 | $search = $manager->createSearch(); |
533 | 533 | $expr = [ |
534 | - $search->compare( '==', 'customer.editor', $context->getEditor() ), |
|
535 | - $search->compare( '>=', 'customer.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
534 | + $search->compare('==', 'customer.editor', $context->getEditor()), |
|
535 | + $search->compare('>=', 'customer.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
536 | 536 | ]; |
537 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
538 | - $search->setSlice( 0, 0 ); |
|
537 | + $search->setConditions($search->combine('&&', $expr)); |
|
538 | + $search->setSlice(0, 0); |
|
539 | 539 | |
540 | - $manager->searchItems( $search, [], $total ); |
|
540 | + $manager->searchItems($search, [], $total); |
|
541 | 541 | |
542 | - if( $total > $count ) { |
|
543 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary limit reached' ) ); |
|
542 | + if ($total > $count) { |
|
543 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary limit reached')); |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | * @param string $id Unique customer ID |
552 | 552 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
553 | 553 | */ |
554 | - protected function checkUser( $id ) |
|
554 | + protected function checkUser($id) |
|
555 | 555 | { |
556 | - if( $id != $this->getContext()->getUserId() ) |
|
556 | + if ($id != $this->getContext()->getUserId()) |
|
557 | 557 | { |
558 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
559 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
558 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
559 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
@@ -31,42 +31,42 @@ discard block |
||
31 | 31 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
32 | 32 | * @since 2017.03 |
33 | 33 | */ |
34 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ) |
|
34 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds) |
|
35 | 35 | { |
36 | - if( !empty( $attrIds ) ) |
|
36 | + if (!empty($attrIds)) |
|
37 | 37 | { |
38 | - $attrIds = $this->validateIds( $attrIds ); |
|
38 | + $attrIds = $this->validateIds($attrIds); |
|
39 | 39 | |
40 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $attrIds ) ); |
|
40 | + $func = $filter->createFunction('index.attributeaggregate', array($attrIds)); |
|
41 | 41 | $expr = array( |
42 | - $filter->compare( '==', $func, count( $attrIds ) ), |
|
42 | + $filter->compare('==', $func, count($attrIds)), |
|
43 | 43 | $filter->getConditions(), |
44 | 44 | ); |
45 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
45 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
46 | 46 | } |
47 | 47 | |
48 | - if( !empty( $optIds ) ) |
|
48 | + if (!empty($optIds)) |
|
49 | 49 | { |
50 | - $optIds = $this->validateIds( $optIds ); |
|
50 | + $optIds = $this->validateIds($optIds); |
|
51 | 51 | |
52 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $optIds ) ); |
|
52 | + $func = $filter->createFunction('index.attributeaggregate', array($optIds)); |
|
53 | 53 | $expr = array( |
54 | - $filter->compare( '>', $func, 0 ), |
|
54 | + $filter->compare('>', $func, 0), |
|
55 | 55 | $filter->getConditions(), |
56 | 56 | ); |
57 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
57 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
58 | 58 | } |
59 | 59 | |
60 | - foreach( $oneIds as $type => $list ) |
|
60 | + foreach ($oneIds as $type => $list) |
|
61 | 61 | { |
62 | - if( ( $list = $this->validateIds( (array) $list ) ) !== [] ) |
|
62 | + if (($list = $this->validateIds((array) $list)) !== []) |
|
63 | 63 | { |
64 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $list ) ); |
|
64 | + $func = $filter->createFunction('index.attributeaggregate', array($list)); |
|
65 | 65 | $expr = array( |
66 | - $filter->compare( '>', $func, 0 ), |
|
66 | + $filter->compare('>', $func, 0), |
|
67 | 67 | $filter->getConditions(), |
68 | 68 | ); |
69 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
69 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -86,38 +86,38 @@ discard block |
||
86 | 86 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
87 | 87 | * @since 2017.03 |
88 | 88 | */ |
89 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
90 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ) |
|
89 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
90 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default') |
|
91 | 91 | { |
92 | - $catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId ); |
|
92 | + $catIds = (!is_array($catId) ? explode(',', $catId) : $catId); |
|
93 | 93 | |
94 | - if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
94 | + if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
95 | 95 | { |
96 | 96 | $list = []; |
97 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
97 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog'); |
|
98 | 98 | |
99 | - foreach( $catIds as $catId ) |
|
99 | + foreach ($catIds as $catId) |
|
100 | 100 | { |
101 | - $tree = $cntl->getTree( $catId, [], $level ); |
|
102 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) ); |
|
101 | + $tree = $cntl->getTree($catId, [], $level); |
|
102 | + $list = array_merge($list, $this->getCatalogIdsFromTree($tree)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $catIds = $list; |
106 | 106 | } |
107 | 107 | |
108 | - $expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) ); |
|
108 | + $expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds))); |
|
109 | 109 | $expr[] = $filter->getConditions(); |
110 | 110 | |
111 | - if( $sort === 'relevance' ) |
|
111 | + if ($sort === 'relevance') |
|
112 | 112 | { |
113 | - $cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) ); |
|
114 | - $expr[] = $filter->compare( '>=', $cmpfunc, 0 ); |
|
113 | + $cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds)); |
|
114 | + $expr[] = $filter->compare('>=', $cmpfunc, 0); |
|
115 | 115 | |
116 | - $sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) ); |
|
117 | - $filter->setSortations( array( $filter->sort( $direction, $sortfunc ) ) ); |
|
116 | + $sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds)); |
|
117 | + $filter->setSortations(array($filter->sort($direction, $sortfunc))); |
|
118 | 118 | } |
119 | 119 | |
120 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
120 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
121 | 121 | |
122 | 122 | return $filter; |
123 | 123 | } |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
135 | 135 | * @since 2017.03 |
136 | 136 | */ |
137 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ) |
|
137 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default') |
|
138 | 138 | { |
139 | 139 | $langid = $this->getContext()->getLocale()->getLanguageId(); |
140 | - $cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ); |
|
141 | - $expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() ); |
|
140 | + $cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input)); |
|
141 | + $expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions()); |
|
142 | 142 | |
143 | - return $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
143 | + return $filter->setConditions($filter->combine('&&', $expr)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @return array Associative list of key values as key and the product count for this key as value |
153 | 153 | * @since 2017.03 |
154 | 154 | */ |
155 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
155 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
156 | 156 | { |
157 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key ); |
|
157 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
170 | 170 | * @since 2017.03 |
171 | 171 | */ |
172 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
172 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
173 | 173 | { |
174 | 174 | $sortations = []; |
175 | 175 | $context = $this->getContext(); |
176 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'index' ); |
|
176 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'index'); |
|
177 | 177 | |
178 | 178 | |
179 | 179 | /** controller/frontend/product/ignore-dates |
@@ -188,55 +188,55 @@ discard block |
||
188 | 188 | * @since 2017.10 |
189 | 189 | * @category Developer |
190 | 190 | */ |
191 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
191 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
192 | 192 | { |
193 | 193 | $search = $manager->createSearch(); |
194 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
194 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
195 | 195 | } |
196 | 196 | else |
197 | 197 | { |
198 | - $search = $manager->createSearch( true ); |
|
198 | + $search = $manager->createSearch(true); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - $expr = array( $search->compare( '!=', 'index.catalog.id', null ) ); |
|
202 | + $expr = array($search->compare('!=', 'index.catalog.id', null)); |
|
203 | 203 | |
204 | - switch( $sort ) |
|
204 | + switch ($sort) |
|
205 | 205 | { |
206 | 206 | case 'code': |
207 | - $sortations[] = $search->sort( $direction, 'product.code' ); |
|
207 | + $sortations[] = $search->sort($direction, 'product.code'); |
|
208 | 208 | break; |
209 | 209 | |
210 | 210 | case 'ctime': |
211 | - $sortations[] = $search->sort( $direction, 'product.ctime' ); |
|
211 | + $sortations[] = $search->sort($direction, 'product.ctime'); |
|
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'name': |
215 | 215 | $langid = $context->getLocale()->getLanguageId(); |
216 | 216 | |
217 | - $cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) ); |
|
218 | - $expr[] = $search->compare( '>=', $cmpfunc, '' ); |
|
217 | + $cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product')); |
|
218 | + $expr[] = $search->compare('>=', $cmpfunc, ''); |
|
219 | 219 | |
220 | - $sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) ); |
|
221 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
220 | + $sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name')); |
|
221 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
222 | 222 | break; |
223 | 223 | |
224 | 224 | case 'price': |
225 | 225 | $currencyid = $context->getLocale()->getCurrencyId(); |
226 | 226 | |
227 | - $cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
228 | - $expr[] = $search->compare( '>=', $cmpfunc, '0.00' ); |
|
227 | + $cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default')); |
|
228 | + $expr[] = $search->compare('>=', $cmpfunc, '0.00'); |
|
229 | 229 | |
230 | - $sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
231 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
230 | + $sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default')); |
|
231 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
232 | 232 | break; |
233 | 233 | } |
234 | 234 | |
235 | 235 | $expr[] = $search->getConditions(); |
236 | 236 | |
237 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
238 | - $search->setSortations( $sortations ); |
|
239 | - $search->setSlice( $start, $size ); |
|
237 | + $search->setConditions($search->combine('&&', $expr)); |
|
238 | + $search->setSortations($sortations); |
|
239 | + $search->setSlice($start, $size); |
|
240 | 240 | |
241 | 241 | return $search; |
242 | 242 | } |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
251 | 251 | * @since 2017.03 |
252 | 252 | */ |
253 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ) |
|
253 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')) |
|
254 | 254 | { |
255 | - $items = $this->getItems( [$productId], $domains ); |
|
255 | + $items = $this->getItems([$productId], $domains); |
|
256 | 256 | |
257 | - if( ( $item = reset( $items ) ) !== false ) { |
|
257 | + if (($item = reset($items)) !== false) { |
|
258 | 258 | return $item; |
259 | 259 | } |
260 | 260 | |
261 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) ); |
|
261 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId)); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
271 | 271 | * @since 2017.03 |
272 | 272 | */ |
273 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ) |
|
273 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')) |
|
274 | 274 | { |
275 | 275 | $context = $this->getContext(); |
276 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
276 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
277 | 277 | |
278 | 278 | /** controller/frontend/order/ignore-dates |
279 | 279 | * Ignore start and end dates of products |
@@ -287,24 +287,24 @@ discard block |
||
287 | 287 | * @since 2017.08 |
288 | 288 | * @category Developer |
289 | 289 | */ |
290 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
290 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
291 | 291 | { |
292 | 292 | $search = $manager->createSearch(); |
293 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
293 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
294 | 294 | } |
295 | 295 | else |
296 | 296 | { |
297 | - $search = $manager->createSearch( true ); |
|
297 | + $search = $manager->createSearch(true); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $expr = array( |
301 | - $search->compare( '==', 'product.id', $productIds ), |
|
301 | + $search->compare('==', 'product.id', $productIds), |
|
302 | 302 | $search->getConditions(), |
303 | 303 | ); |
304 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
305 | - $search->setSlice( 0, count( $productIds ) ); |
|
304 | + $search->setConditions($search->combine('&&', $expr)); |
|
305 | + $search->setSlice(0, count($productIds)); |
|
306 | 306 | |
307 | - return $manager->searchItems( $search, $domains ); |
|
307 | + return $manager->searchItems($search, $domains); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
318 | 318 | * @since 2017.03 |
319 | 319 | */ |
320 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
320 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
321 | 321 | { |
322 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total ); |
|
322 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children |
330 | 330 | * @return array List of catalog IDs |
331 | 331 | */ |
332 | - protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item ) |
|
332 | + protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item) |
|
333 | 333 | { |
334 | - $list = array( $item->getId() ); |
|
334 | + $list = array($item->getId()); |
|
335 | 335 | |
336 | - foreach( $item->getChildren() as $child ) { |
|
337 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) ); |
|
336 | + foreach ($item->getChildren() as $child) { |
|
337 | + $list = array_merge($list, $this->getCatalogIdsFromTree($child)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $list; |
@@ -347,13 +347,13 @@ discard block |
||
347 | 347 | * @param array $ids List of IDs to validate |
348 | 348 | * @return array List of validated IDs |
349 | 349 | */ |
350 | - protected function validateIds( array $ids ) |
|
350 | + protected function validateIds(array $ids) |
|
351 | 351 | { |
352 | 352 | $list = []; |
353 | 353 | |
354 | - foreach( $ids as $id ) |
|
354 | + foreach ($ids as $id) |
|
355 | 355 | { |
356 | - if( $id != '' ) { |
|
356 | + if ($id != '') { |
|
357 | 357 | $list[] = (int) $id; |
358 | 358 | } |
359 | 359 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param boolean $default Use default criteria to limit orders |
46 | 46 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
47 | 47 | */ |
48 | - public function getItem( $id, $default = true ); |
|
48 | + public function getItem($id, $default = true); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param integer &$total|null Variable that will contain the total number of available items |
56 | 56 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
57 | 57 | */ |
58 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
58 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
80 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
102 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -117,5 +117,5 @@ discard block |
||
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
120 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
121 | 121 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Order\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @param string $type Arbitrary order type (max. eight chars) |
67 | 67 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
68 | 68 | */ |
69 | - public function addItem( $baseId, $type ) |
|
69 | + public function addItem($baseId, $type) |
|
70 | 70 | { |
71 | - return $this->controller->addItem( $baseId, $type ); |
|
71 | + return $this->controller->addItem($baseId, $type); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param boolean $default Use default criteria to limit orders |
91 | 91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
92 | 92 | */ |
93 | - public function getItem( $id, $default = true ) |
|
93 | + public function getItem($id, $default = true) |
|
94 | 94 | { |
95 | - return $this->controller->getItem( $id ); |
|
95 | + return $this->controller->getItem($id); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param integer &$total|null Variable that will contain the total number of available items |
104 | 104 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
105 | 105 | */ |
106 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
106 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
107 | 107 | { |
108 | - return $this->controller->searchItems( $filter, $total ); |
|
108 | + return $this->controller->searchItems($filter, $total); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
129 | 129 | * @return void |
130 | 130 | */ |
131 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
131 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
132 | 132 | { |
133 | - $this->getController()->block( $orderItem ); |
|
133 | + $this->getController()->block($orderItem); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
156 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
157 | 157 | { |
158 | - $this->getController()->unblock( $orderItem ); |
|
158 | + $this->getController()->unblock($orderItem); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
177 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
178 | 178 | { |
179 | - $this->getController()->update( $orderItem ); |
|
179 | + $this->getController()->update($orderItem); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * @param string $type Arbitrary order type (max. eight chars) |
30 | 30 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
31 | 31 | */ |
32 | - public function addItem( $baseId, $type ) |
|
32 | + public function addItem($baseId, $type) |
|
33 | 33 | { |
34 | 34 | $total = 0; |
35 | 35 | $context = $this->getContext(); |
36 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
36 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
37 | 37 | |
38 | 38 | /** controller/frontend/order/limit-seconds |
39 | 39 | * Order limitation time frame in seconds |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | * @see controller/frontend/basket/limit-count |
52 | 52 | * @see controller/frontend/basket/limit-seconds |
53 | 53 | */ |
54 | - $seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 ); |
|
54 | + $seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300); |
|
55 | 55 | |
56 | 56 | $search = $manager->createSearch(); |
57 | 57 | $expr = [ |
58 | - $search->compare( '==', 'order.baseid', $baseId ), |
|
59 | - $search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
58 | + $search->compare('==', 'order.baseid', $baseId), |
|
59 | + $search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
60 | 60 | ]; |
61 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
62 | - $search->setSlice( 0, 0 ); |
|
61 | + $search->setConditions($search->combine('&&', $expr)); |
|
62 | + $search->setSlice(0, 0); |
|
63 | 63 | |
64 | - $manager->searchItems( $search, [], $total ); |
|
64 | + $manager->searchItems($search, [], $total); |
|
65 | 65 | |
66 | - if( $total > 0 ) { |
|
67 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) ); |
|
66 | + if ($total > 0) { |
|
67 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created')); |
|
68 | 68 | } |
69 | 69 | |
70 | - $item = $manager->createItem()->setBaseId( $baseId )->setType( $type ); |
|
71 | - return $manager->saveItem( $item ); |
|
70 | + $item = $manager->createItem()->setBaseId($baseId)->setType($type); |
|
71 | + return $manager->saveItem($item); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function createFilter() |
81 | 81 | { |
82 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true ); |
|
82 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -90,30 +90,30 @@ discard block |
||
90 | 90 | * @param boolean $default Use default criteria to limit orders |
91 | 91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
92 | 92 | */ |
93 | - public function getItem( $id, $default = true ) |
|
93 | + public function getItem($id, $default = true) |
|
94 | 94 | { |
95 | 95 | $context = $this->getContext(); |
96 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
96 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
97 | 97 | |
98 | - $search = $manager->createSearch( true ); |
|
98 | + $search = $manager->createSearch(true); |
|
99 | 99 | $expr = [ |
100 | - $search->compare( '==', 'order.id', $id ), |
|
100 | + $search->compare('==', 'order.id', $id), |
|
101 | 101 | $search->getConditions(), |
102 | 102 | ]; |
103 | 103 | |
104 | - if( $default !== false ) { |
|
105 | - $expr[] = $search->compare( '==', 'order.editor', $context->getEditor() ); |
|
104 | + if ($default !== false) { |
|
105 | + $expr[] = $search->compare('==', 'order.editor', $context->getEditor()); |
|
106 | 106 | } |
107 | 107 | |
108 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
108 | + $search->setConditions($search->combine('&&', $expr)); |
|
109 | 109 | |
110 | - $items = $manager->searchItems( $search ); |
|
110 | + $items = $manager->searchItems($search); |
|
111 | 111 | |
112 | - if( ( $item = reset( $items ) ) !== false ) { |
|
112 | + if (($item = reset($items)) !== false) { |
|
113 | 113 | return $item; |
114 | 114 | } |
115 | 115 | |
116 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) ); |
|
116 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * @param \Aimeos\MShop\Order\Item\Iface $item Order object |
124 | 124 | * @return \Aimeos\MShop\Order\Item\Iface Saved order item |
125 | 125 | */ |
126 | - public function saveItem( \Aimeos\MShop\Order\Item\Iface $item ) |
|
126 | + public function saveItem(\Aimeos\MShop\Order\Item\Iface $item) |
|
127 | 127 | { |
128 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' ); |
|
129 | - return $manager->saveItem( $item ); |
|
128 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order'); |
|
129 | + return $manager->saveItem($item); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @param integer|null &$total Variable that will contain the total number of available items |
138 | 138 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
139 | 139 | */ |
140 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
140 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
141 | 141 | { |
142 | 142 | $context = $this->getContext(); |
143 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
143 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
144 | 144 | |
145 | 145 | $expr = [ |
146 | 146 | $filter->getConditions(), |
147 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
147 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
148 | 148 | ]; |
149 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
149 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
150 | 150 | |
151 | - return $manager->searchItems( $filter, [], $total ); |
|
151 | + return $manager->searchItems($filter, [], $total); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
172 | 172 | */ |
173 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
173 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
174 | 174 | { |
175 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
175 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
196 | 196 | */ |
197 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
197 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
198 | 198 | { |
199 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
199 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
216 | 216 | */ |
217 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
217 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
218 | 218 | { |
219 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
219 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
220 | 220 | } |
221 | 221 | } |