@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
32 | 32 | */ |
33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
34 | 34 | { |
35 | 35 | /** controller/jobs/order/service/payment/name |
36 | 36 | * Class name of the used order service payment scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | * @since 2014.07 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - if( $name === null ) { |
|
69 | - $name = $context->getConfig()->get( 'controller/jobs/order/service/payment/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/order/service/payment/name', 'Standard'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( ctype_alnum( $name ) === false ) |
|
72 | + if (ctype_alnum($name) === false) |
|
73 | 73 | { |
74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Payment\\' . $name : '<not a string>'; |
|
75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Payment\\' . $name : '<not a string>'; |
|
75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
79 | 79 | $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Payment\\' . $name; |
80 | 80 | |
81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
82 | 82 | |
83 | 83 | /** controller/jobs/order/service/payment/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the order service payment controllers |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/order/service/payment/decorators/excludes |
155 | 155 | * @see controller/jobs/order/service/payment/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/service/payment' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/service/payment'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Capture authorized payments' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Capture authorized payments'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Authorized payments of orders will be captured after dispatching or after a configurable amount of time' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Authorized payments of orders will be captured after dispatching or after a configurable amount of time'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @category User |
69 | 69 | * @category Developer |
70 | 70 | */ |
71 | - $days = $config->get( 'controller/jobs/order/service/payment/limit-days', 90 ); |
|
72 | - $date = date( 'Y-m-d 00:00:00', time() - 86400 * $days ); |
|
71 | + $days = $config->get('controller/jobs/order/service/payment/limit-days', 90); |
|
72 | + $date = date('Y-m-d 00:00:00', time() - 86400 * $days); |
|
73 | 73 | |
74 | 74 | /** controller/jobs/order/service/payment/capture-days |
75 | 75 | * Automatically capture payments after the configured amount of days |
@@ -84,91 +84,91 @@ discard block |
||
84 | 84 | * @category User |
85 | 85 | * @category Developer |
86 | 86 | */ |
87 | - $capDays = $config->get( 'controller/jobs/order/service/payment/capture-days', null ); |
|
87 | + $capDays = $config->get('controller/jobs/order/service/payment/capture-days', null); |
|
88 | 88 | |
89 | 89 | |
90 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
90 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
91 | 91 | $serviceSearch = $serviceManager->createSearch(); |
92 | - $serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type.code', 'payment' ) ); |
|
92 | + $serviceSearch->setConditions($serviceSearch->compare('==', 'service.type.code', 'payment')); |
|
93 | 93 | |
94 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
94 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
95 | 95 | $orderSearch = $orderManager->createSearch(); |
96 | 96 | |
97 | - $status = array( \Aimeos\MShop\Order\Item\Base::STAT_DISPATCHED, \Aimeos\MShop\Order\Item\Base::STAT_DELIVERED ); |
|
97 | + $status = array(\Aimeos\MShop\Order\Item\Base::STAT_DISPATCHED, \Aimeos\MShop\Order\Item\Base::STAT_DELIVERED); |
|
98 | 98 | $start = 0; |
99 | 99 | |
100 | 100 | do |
101 | 101 | { |
102 | - $serviceItems = $serviceManager->searchItems( $serviceSearch ); |
|
102 | + $serviceItems = $serviceManager->searchItems($serviceSearch); |
|
103 | 103 | |
104 | - foreach( $serviceItems as $serviceItem ) |
|
104 | + foreach ($serviceItems as $serviceItem) |
|
105 | 105 | { |
106 | 106 | try |
107 | 107 | { |
108 | - $serviceProvider = $serviceManager->getProvider( $serviceItem ); |
|
108 | + $serviceProvider = $serviceManager->getProvider($serviceItem); |
|
109 | 109 | |
110 | - if( !$serviceProvider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE ) ) { |
|
110 | + if (!$serviceProvider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | $expr = array(); |
116 | - $expr[] = $orderSearch->compare( '==', 'order.siteid', $serviceItem->getSiteId() ); |
|
117 | - $expr[] = $orderSearch->compare( '>', 'order.datepayment', $date ); |
|
116 | + $expr[] = $orderSearch->compare('==', 'order.siteid', $serviceItem->getSiteId()); |
|
117 | + $expr[] = $orderSearch->compare('>', 'order.datepayment', $date); |
|
118 | 118 | |
119 | - if( $capDays !== null ) |
|
119 | + if ($capDays !== null) |
|
120 | 120 | { |
121 | - $capdate = date( 'Y-m-d 00:00:00', time() - 86400 * $capDays ); |
|
122 | - $expr[] = $orderSearch->compare( '<=', 'order.datepayment', $capdate ); |
|
121 | + $capdate = date('Y-m-d 00:00:00', time() - 86400 * $capDays); |
|
122 | + $expr[] = $orderSearch->compare('<=', 'order.datepayment', $capdate); |
|
123 | 123 | } |
124 | 124 | else |
125 | 125 | { |
126 | - $expr[] = $orderSearch->compare( '==', 'order.statusdelivery', $status ); |
|
126 | + $expr[] = $orderSearch->compare('==', 'order.statusdelivery', $status); |
|
127 | 127 | } |
128 | 128 | |
129 | - $expr[] = $orderSearch->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED ); |
|
130 | - $expr[] = $orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ); |
|
131 | - $expr[] = $orderSearch->compare( '==', 'order.base.service.type', 'payment' ); |
|
129 | + $expr[] = $orderSearch->compare('==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED); |
|
130 | + $expr[] = $orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()); |
|
131 | + $expr[] = $orderSearch->compare('==', 'order.base.service.type', 'payment'); |
|
132 | 132 | |
133 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
133 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | $orderStart = 0; |
137 | 137 | |
138 | 138 | do |
139 | 139 | { |
140 | - $orderItems = $orderManager->searchItems( $orderSearch ); |
|
140 | + $orderItems = $orderManager->searchItems($orderSearch); |
|
141 | 141 | |
142 | - foreach( $orderItems as $orderItem ) |
|
142 | + foreach ($orderItems as $orderItem) |
|
143 | 143 | { |
144 | 144 | try |
145 | 145 | { |
146 | - $serviceProvider->capture( $orderItem ); |
|
146 | + $serviceProvider->capture($orderItem); |
|
147 | 147 | } |
148 | - catch( \Exception $e ) |
|
148 | + catch (\Exception $e) |
|
149 | 149 | { |
150 | 150 | $str = 'Error while capturing payment for order with ID "%1$s": %2$s'; |
151 | - $context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) ); |
|
151 | + $context->getLogger()->log(sprintf($str, $orderItem->getId(), $e->getMessage())); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - $orderCount = count( $orderItems ); |
|
155 | + $orderCount = count($orderItems); |
|
156 | 156 | $orderStart += $orderCount; |
157 | - $orderSearch->setSlice( $orderStart ); |
|
157 | + $orderSearch->setSlice($orderStart); |
|
158 | 158 | } |
159 | - while( $orderCount >= $orderSearch->getSliceSize() ); |
|
159 | + while ($orderCount >= $orderSearch->getSliceSize()); |
|
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | 163 | $str = 'Error while capturing payments for service with ID "%1$s": %2$s'; |
164 | - $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
|
164 | + $context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage())); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $count = count( $serviceItems ); |
|
168 | + $count = count($serviceItems); |
|
169 | 169 | $start += $count; |
170 | - $serviceSearch->setSlice( $start ); |
|
170 | + $serviceSearch->setSlice($start); |
|
171 | 171 | } |
172 | - while( $count >= $serviceSearch->getSliceSize() ); |
|
172 | + while ($count >= $serviceSearch->getSliceSize()); |
|
173 | 173 | } |
174 | 174 | } |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $capdate = date( 'Y-m-d 00:00:00', time() - 86400 * $capDays ); |
122 | 122 | $expr[] = $orderSearch->compare( '<=', 'order.datepayment', $capdate ); |
123 | - } |
|
124 | - else |
|
123 | + } else |
|
125 | 124 | { |
126 | 125 | $expr[] = $orderSearch->compare( '==', 'order.statusdelivery', $status ); |
127 | 126 | } |
@@ -144,8 +143,7 @@ discard block |
||
144 | 143 | try |
145 | 144 | { |
146 | 145 | $serviceProvider->capture( $orderItem ); |
147 | - } |
|
148 | - catch( \Exception $e ) |
|
146 | + } catch( \Exception $e ) |
|
149 | 147 | { |
150 | 148 | $str = 'Error while capturing payment for order with ID "%1$s": %2$s'; |
151 | 149 | $context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) ); |
@@ -157,8 +155,7 @@ discard block |
||
157 | 155 | $orderSearch->setSlice( $orderStart ); |
158 | 156 | } |
159 | 157 | while( $orderCount >= $orderSearch->getSliceSize() ); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
158 | + } catch( \Exception $e ) |
|
162 | 159 | { |
163 | 160 | $str = 'Error while capturing payments for service with ID "%1$s": %2$s'; |
164 | 161 | $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
32 | 32 | */ |
33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
34 | 34 | { |
35 | 35 | /** controller/jobs/order/service/delivery/name |
36 | 36 | * Class name of the used order service delivery scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | * @since 2014.03 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - if( $name === null ) { |
|
69 | - $name = $context->getConfig()->get( 'controller/jobs/order/service/delivery/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/order/service/delivery/name', 'Standard'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( ctype_alnum( $name ) === false ) |
|
72 | + if (ctype_alnum($name) === false) |
|
73 | 73 | { |
74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Delivery\\' . $name : '<not a string>'; |
|
75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Delivery\\' . $name : '<not a string>'; |
|
75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
79 | 79 | $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Service\\Delivery\\' . $name; |
80 | 80 | |
81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
82 | 82 | |
83 | 83 | /** controller/jobs/order/service/delivery/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the order service delivery controllers |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/order/service/delivery/decorators/excludes |
155 | 155 | * @see controller/jobs/order/service/delivery/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/service/delivery' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/service/delivery'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process order delivery services' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Process order delivery services'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends paid orders to the ERP system or logistic partner' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends paid orders to the ERP system or logistic partner'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -68,75 +68,75 @@ discard block |
||
68 | 68 | * @see controller/jobs/order/email/payment/standard/limit-days |
69 | 69 | * @see controller/jobs/order/email/delivery/standard/limit-days |
70 | 70 | */ |
71 | - $days = $context->getConfig()->get( 'controller/jobs/order/service/delivery/limit-days', 90 ); |
|
72 | - $date = date( 'Y-m-d 00:00:00', time() - 86400 * $days ); |
|
71 | + $days = $context->getConfig()->get('controller/jobs/order/service/delivery/limit-days', 90); |
|
72 | + $date = date('Y-m-d 00:00:00', time() - 86400 * $days); |
|
73 | 73 | |
74 | - $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager( $context ); |
|
74 | + $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context); |
|
75 | 75 | $serviceSearch = $serviceManager->createSearch(); |
76 | - $serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type.code', 'delivery' ) ); |
|
76 | + $serviceSearch->setConditions($serviceSearch->compare('==', 'service.type.code', 'delivery')); |
|
77 | 77 | |
78 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context ); |
|
78 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context); |
|
79 | 79 | $orderSearch = $orderManager->createSearch(); |
80 | 80 | |
81 | 81 | $start = 0; |
82 | 82 | |
83 | 83 | do |
84 | 84 | { |
85 | - $serviceItems = $serviceManager->searchItems( $serviceSearch ); |
|
85 | + $serviceItems = $serviceManager->searchItems($serviceSearch); |
|
86 | 86 | |
87 | - foreach( $serviceItems as $serviceItem ) |
|
87 | + foreach ($serviceItems as $serviceItem) |
|
88 | 88 | { |
89 | 89 | try |
90 | 90 | { |
91 | - $serviceProvider = $serviceManager->getProvider( $serviceItem ); |
|
91 | + $serviceProvider = $serviceManager->getProvider($serviceItem); |
|
92 | 92 | |
93 | 93 | $expr = array( |
94 | - $orderSearch->compare( '==', 'order.siteid', $serviceItem->getSiteId() ), |
|
95 | - $orderSearch->compare( '>', 'order.datepayment', $date ), |
|
96 | - $orderSearch->compare( '>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING ), |
|
97 | - $orderSearch->compare( '==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED ), |
|
98 | - $orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ), |
|
99 | - $orderSearch->compare( '==', 'order.base.service.type', 'delivery' ), |
|
94 | + $orderSearch->compare('==', 'order.siteid', $serviceItem->getSiteId()), |
|
95 | + $orderSearch->compare('>', 'order.datepayment', $date), |
|
96 | + $orderSearch->compare('>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING), |
|
97 | + $orderSearch->compare('==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED), |
|
98 | + $orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()), |
|
99 | + $orderSearch->compare('==', 'order.base.service.type', 'delivery'), |
|
100 | 100 | ); |
101 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
101 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
102 | 102 | |
103 | 103 | $orderStart = 0; |
104 | 104 | |
105 | 105 | do |
106 | 106 | { |
107 | - $orderItems = $orderManager->searchItems( $orderSearch ); |
|
107 | + $orderItems = $orderManager->searchItems($orderSearch); |
|
108 | 108 | |
109 | - foreach( $orderItems as $orderItem ) |
|
109 | + foreach ($orderItems as $orderItem) |
|
110 | 110 | { |
111 | 111 | try |
112 | 112 | { |
113 | - $serviceProvider->process( $orderItem ); |
|
114 | - $orderManager->saveItem( $orderItem ); |
|
113 | + $serviceProvider->process($orderItem); |
|
114 | + $orderManager->saveItem($orderItem); |
|
115 | 115 | } |
116 | - catch( \Exception $e ) |
|
116 | + catch (\Exception $e) |
|
117 | 117 | { |
118 | 118 | $str = 'Error while processing order with ID "%1$s": %2$s'; |
119 | - $context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) ); |
|
119 | + $context->getLogger()->log(sprintf($str, $orderItem->getId(), $e->getMessage())); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - $orderCount = count( $orderItems ); |
|
123 | + $orderCount = count($orderItems); |
|
124 | 124 | $orderStart += $orderCount; |
125 | - $orderSearch->setSlice( $orderStart ); |
|
125 | + $orderSearch->setSlice($orderStart); |
|
126 | 126 | } |
127 | - while( $orderCount >= $orderSearch->getSliceSize() ); |
|
127 | + while ($orderCount >= $orderSearch->getSliceSize()); |
|
128 | 128 | } |
129 | - catch( \Exception $e ) |
|
129 | + catch (\Exception $e) |
|
130 | 130 | { |
131 | 131 | $str = 'Error while processing service with ID "%1$s": %2$s'; |
132 | - $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
|
132 | + $context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage())); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $count = count( $serviceItems ); |
|
136 | + $count = count($serviceItems); |
|
137 | 137 | $start += $count; |
138 | - $serviceSearch->setSlice( $start ); |
|
138 | + $serviceSearch->setSlice($start); |
|
139 | 139 | } |
140 | - while( $count >= $serviceSearch->getSliceSize() ); |
|
140 | + while ($count >= $serviceSearch->getSliceSize()); |
|
141 | 141 | } |
142 | 142 | } |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $serviceProvider->process( $orderItem ); |
114 | 114 | $orderManager->saveItem( $orderItem ); |
115 | - } |
|
116 | - catch( \Exception $e ) |
|
115 | + } catch( \Exception $e ) |
|
117 | 116 | { |
118 | 117 | $str = 'Error while processing order with ID "%1$s": %2$s'; |
119 | 118 | $context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) ); |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | $orderSearch->setSlice( $orderStart ); |
126 | 125 | } |
127 | 126 | while( $orderCount >= $orderSearch->getSliceSize() ); |
128 | - } |
|
129 | - catch( \Exception $e ) |
|
127 | + } catch( \Exception $e ) |
|
130 | 128 | { |
131 | 129 | $str = 'Error while processing service with ID "%1$s": %2$s'; |
132 | 130 | $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
@@ -29,6 +29,6 @@ |
||
29 | 29 | * @param \Aimeos\Bootstrap $aimeos \Aimeos\Bootstrap object |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function __construct( \Aimeos\Controller\Jobs\Iface $controller, |
|
33 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos ); |
|
32 | + public function __construct(\Aimeos\Controller\Jobs\Iface $controller, |
|
33 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos); |
|
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
34 | 34 | * @param \Aimeos\Bootstrap $aimeos \Aimeos\Bootstrap object |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\Controller\Jobs\Iface $controller, |
|
37 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos ) |
|
36 | + public function __construct(\Aimeos\Controller\Jobs\Iface $controller, |
|
37 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos) |
|
38 | 38 | { |
39 | 39 | $this->context = $context; |
40 | 40 | $this->aimeos = $aimeos; |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @return mixed Returns the value of the called method |
51 | 51 | * @throws \Aimeos\Controller\Jobs\Exception If method call failed |
52 | 52 | */ |
53 | - public function __call( $name, array $param ) |
|
53 | + public function __call($name, array $param) |
|
54 | 54 | { |
55 | - if( ( $result = call_user_func_array( array( $this->controller, $name ), $param ) ) === false ) { |
|
56 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
55 | + if (($result = call_user_func_array(array($this->controller, $name), $param)) === false) { |
|
56 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to call method "%1$s"', $name)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $result; |
@@ -28,5 +28,5 @@ |
||
28 | 28 | * @param string|null $name Name of the controller implementation (Default if null) |
29 | 29 | * @return \Aimeos\Controller\Jobs\Iface Controller object |
30 | 30 | */ |
31 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ); |
|
31 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null); |
|
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $classname Full name of the class for which the object should be returned |
32 | 32 | * @param \Aimeos\Controller\Jobs\Iface|null $controller Frontend controller object |
33 | 33 | */ |
34 | - public static function injectController( $classname, \Aimeos\Controller\Jobs\Iface $controller = null ) |
|
34 | + public static function injectController($classname, \Aimeos\Controller\Jobs\Iface $controller = null) |
|
35 | 35 | { |
36 | 36 | self::$objects[$classname] = $controller; |
37 | 37 | } |
@@ -47,29 +47,29 @@ discard block |
||
47 | 47 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Controller\Jobs\Attribute\Decorator\" |
48 | 48 | * @return \Aimeos\Controller\Jobs\Common\Iface Controller object |
49 | 49 | */ |
50 | - protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
51 | - \Aimeos\Controller\Jobs\Iface $controller, array $decorators, $classprefix ) |
|
50 | + protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
51 | + \Aimeos\Controller\Jobs\Iface $controller, array $decorators, $classprefix) |
|
52 | 52 | { |
53 | 53 | $iface = '\\Aimeos\\Controller\\Jobs\\Common\\Decorator\\Iface'; |
54 | 54 | |
55 | - foreach( $decorators as $name ) |
|
55 | + foreach ($decorators as $name) |
|
56 | 56 | { |
57 | - if( ctype_alnum( $name ) === false ) |
|
57 | + if (ctype_alnum($name) === false) |
|
58 | 58 | { |
59 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
60 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
59 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
60 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $classname = $classprefix . $name; |
64 | 64 | |
65 | - if( class_exists( $classname ) === false ) { |
|
66 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
65 | + if (class_exists($classname) === false) { |
|
66 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
67 | 67 | } |
68 | 68 | |
69 | - $controller = new $classname( $controller, $context, $aimeos ); |
|
69 | + $controller = new $classname($controller, $context, $aimeos); |
|
70 | 70 | |
71 | - if( !( $controller instanceof $iface ) ) { |
|
72 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
|
71 | + if (!($controller instanceof $iface)) { |
|
72 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface)); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * @param string $domain Domain name in lower case, e.g. "product" |
87 | 87 | * @return \Aimeos\Controller\Jobs\Common\Iface Controller object |
88 | 88 | */ |
89 | - protected static function addControllerDecorators( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
90 | - \Aimeos\Controller\Jobs\Iface $controller, $domain ) |
|
89 | + protected static function addControllerDecorators(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
90 | + \Aimeos\Controller\Jobs\Iface $controller, $domain) |
|
91 | 91 | { |
92 | - if( !is_string( $domain ) || $domain === '' ) { |
|
93 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid domain "%1$s"', $domain ) ); |
|
92 | + if (!is_string($domain) || $domain === '') { |
|
93 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid domain "%1$s"', $domain)); |
|
94 | 94 | } |
95 | 95 | |
96 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $domain ) ) ); |
|
96 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $domain))); |
|
97 | 97 | $config = $context->getConfig(); |
98 | 98 | |
99 | 99 | /** controller/jobs/common/decorators/default |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | * @since 2014.03 |
119 | 119 | * @category Developer |
120 | 120 | */ |
121 | - $decorators = $config->get( 'controller/jobs/common/decorators/default', array() ); |
|
122 | - $excludes = $config->get( 'controller/jobs/' . $domain . '/decorators/excludes', array() ); |
|
121 | + $decorators = $config->get('controller/jobs/common/decorators/default', array()); |
|
122 | + $excludes = $config->get('controller/jobs/' . $domain . '/decorators/excludes', array()); |
|
123 | 123 | |
124 | - foreach( $decorators as $key => $name ) |
|
124 | + foreach ($decorators as $key => $name) |
|
125 | 125 | { |
126 | - if( in_array( $name, $excludes ) ) { |
|
127 | - unset( $decorators[$key] ); |
|
126 | + if (in_array($name, $excludes)) { |
|
127 | + unset($decorators[$key]); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | $classprefix = '\\Aimeos\\Controller\\Jobs\\Common\\Decorator\\'; |
132 | - $controller = self::addDecorators( $context, $aimeos, $controller, $decorators, $classprefix ); |
|
132 | + $controller = self::addDecorators($context, $aimeos, $controller, $decorators, $classprefix); |
|
133 | 133 | |
134 | 134 | $classprefix = '\\Aimeos\\Controller\\Jobs\\Common\\Decorator\\'; |
135 | - $decorators = $config->get( 'controller/jobs/' . $domain . '/decorators/global', array() ); |
|
136 | - $controller = self::addDecorators( $context, $aimeos, $controller, $decorators, $classprefix ); |
|
135 | + $decorators = $config->get('controller/jobs/' . $domain . '/decorators/global', array()); |
|
136 | + $controller = self::addDecorators($context, $aimeos, $controller, $decorators, $classprefix); |
|
137 | 137 | |
138 | - $classprefix = '\\Aimeos\\Controller\\Jobs\\' . ucfirst( $localClass ) . '\\Decorator\\'; |
|
139 | - $decorators = $config->get( 'controller/jobs/' . $domain . '/decorators/local', array() ); |
|
140 | - $controller = self::addDecorators( $context, $aimeos, $controller, $decorators, $classprefix ); |
|
138 | + $classprefix = '\\Aimeos\\Controller\\Jobs\\' . ucfirst($localClass) . '\\Decorator\\'; |
|
139 | + $decorators = $config->get('controller/jobs/' . $domain . '/decorators/local', array()); |
|
140 | + $controller = self::addDecorators($context, $aimeos, $controller, $decorators, $classprefix); |
|
141 | 141 | |
142 | 142 | return $controller; |
143 | 143 | } |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | * @param string $interface Name of the controller interface |
153 | 153 | * @return \Aimeos\Controller\Jobs\Common\Iface Controller object |
154 | 154 | */ |
155 | - protected static function createControllerBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
156 | - $classname, $interface ) |
|
155 | + protected static function createControllerBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, |
|
156 | + $classname, $interface) |
|
157 | 157 | { |
158 | - if( isset( self::$objects[$classname] ) ) { |
|
158 | + if (isset(self::$objects[$classname])) { |
|
159 | 159 | return self::$objects[$classname]; |
160 | 160 | } |
161 | 161 | |
162 | - if( class_exists( $classname ) === false ) { |
|
163 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
162 | + if (class_exists($classname) === false) { |
|
163 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
164 | 164 | } |
165 | 165 | |
166 | - $controller = new $classname( $context, $aimeos ); |
|
166 | + $controller = new $classname($context, $aimeos); |
|
167 | 167 | |
168 | - if( !( $controller instanceof $interface ) ) { |
|
169 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
168 | + if (!($controller instanceof $interface)) { |
|
169 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $controller; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
32 | 32 | */ |
33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
34 | 34 | { |
35 | 35 | /** controller/jobs/admin/cache/name |
36 | 36 | * Class name of the used admin cache scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | * @since 2014.03 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - if( $name === null ) { |
|
69 | - $name = $context->getConfig()->get( 'controller/jobs/admin/cache/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/admin/cache/name', 'Standard'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( ctype_alnum( $name ) === false ) |
|
72 | + if (ctype_alnum($name) === false) |
|
73 | 73 | { |
74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Admin\\Cache\\' . $name : '<not a string>'; |
|
75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Admin\\Cache\\' . $name : '<not a string>'; |
|
75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
79 | 79 | $classname = '\\Aimeos\\Controller\\Jobs\\Admin\\Cache\\' . $name; |
80 | 80 | |
81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
82 | 82 | |
83 | 83 | /** controller/jobs/admin/cache/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the admin cache controllers |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/admin/cache/decorators/excludes |
155 | 155 | * @see controller/jobs/admin/cache/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'admin/cache' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'admin/cache'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |