@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
28 | 28 | * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor Decorated processor |
29 | 29 | */ |
30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
31 | - \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null ) |
|
30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
31 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null) |
|
32 | 32 | { |
33 | 33 | } |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param array $data List of CSV fields with position as key and data as value |
41 | 41 | * @return array List of data which hasn't been imported |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
43 | + public function process(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
44 | 44 | { |
45 | 45 | return $data; |
46 | 46 | } |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * @param array $codes List of coupon codes |
27 | 27 | * @return array Associative list of coupon codes as key and coupon code items as value |
28 | 28 | */ |
29 | - protected function getCouponCodeItems( array $codes ) |
|
29 | + protected function getCouponCodeItems(array $codes) |
|
30 | 30 | { |
31 | 31 | $result = []; |
32 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
32 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
33 | 33 | |
34 | 34 | $search = $manager->createSearch(); |
35 | - $search->setConditions( $search->compare( '==', 'coupon.code.code', $codes ) ); |
|
36 | - $search->setSlice( 0, count( $codes ) ); |
|
35 | + $search->setConditions($search->compare('==', 'coupon.code.code', $codes)); |
|
36 | + $search->setSlice(0, count($codes)); |
|
37 | 37 | |
38 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
39 | - $result[ $item->getCode() ] = $item; |
|
38 | + foreach ($manager->searchItems($search) as $item) { |
|
39 | + $result[$item->getCode()] = $item; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $result; |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param integer $codePos Column position which contains the unique coupon code (starting from 0) |
52 | 52 | * @return array List of arrays with coupon codes as keys and list of values from the CSV file |
53 | 53 | */ |
54 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) |
|
54 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) |
|
55 | 55 | { |
56 | 56 | $count = 0; |
57 | 57 | $data = []; |
58 | 58 | |
59 | - while( $content->valid() && $count++ < $maxcnt ) |
|
59 | + while ($content->valid() && $count++ < $maxcnt) |
|
60 | 60 | { |
61 | 61 | $row = $content->current(); |
62 | - $data[ $row[$codePos] ] = $row; |
|
62 | + $data[$row[$codePos]] = $row; |
|
63 | 63 | $content->next(); |
64 | 64 | } |
65 | 65 | |
@@ -98,21 +98,21 @@ discard block |
||
98 | 98 | * @param array $mapping List of domain item keys with the CSV field position as key |
99 | 99 | * @return array List of associative arrays containing the chunked properties |
100 | 100 | */ |
101 | - protected function getMappedChunk( array &$data, array $mapping ) |
|
101 | + protected function getMappedChunk(array &$data, array $mapping) |
|
102 | 102 | { |
103 | 103 | $idx = 0; |
104 | 104 | $map = []; |
105 | 105 | |
106 | - foreach( $mapping as $pos => $key ) |
|
106 | + foreach ($mapping as $pos => $key) |
|
107 | 107 | { |
108 | - if( isset( $map[$idx][$key] ) ) { |
|
108 | + if (isset($map[$idx][$key])) { |
|
109 | 109 | $idx++; |
110 | 110 | } |
111 | 111 | |
112 | - if( isset( $data[$pos] ) ) |
|
112 | + if (isset($data[$pos])) |
|
113 | 113 | { |
114 | 114 | $map[$idx][$key] = $data[$pos]; |
115 | - unset( $data[$pos] ); |
|
115 | + unset($data[$pos]); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -126,37 +126,37 @@ discard block |
||
126 | 126 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values |
127 | 127 | * @return \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface Processor object |
128 | 128 | */ |
129 | - protected function getProcessors( array $mappings ) |
|
129 | + protected function getProcessors(array $mappings) |
|
130 | 130 | { |
131 | 131 | $context = $this->getContext(); |
132 | 132 | $config = $context->getConfig(); |
133 | - $object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done( $context, [] ); |
|
133 | + $object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done($context, []); |
|
134 | 134 | |
135 | - foreach( $mappings as $type => $mapping ) |
|
135 | + foreach ($mappings as $type => $mapping) |
|
136 | 136 | { |
137 | - if( ctype_alnum( $type ) === false ) |
|
137 | + if (ctype_alnum($type) === false) |
|
138 | 138 | { |
139 | 139 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type : '<not a string>'; |
140 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
140 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
141 | 141 | } |
142 | 142 | |
143 | - $name = $config->get( 'controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard' ); |
|
143 | + $name = $config->get('controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard'); |
|
144 | 144 | |
145 | - if( ctype_alnum( $name ) === false ) |
|
145 | + if (ctype_alnum($name) === false) |
|
146 | 146 | { |
147 | 147 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
148 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
148 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
149 | 149 | } |
150 | 150 | |
151 | - $classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
151 | + $classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
152 | 152 | |
153 | - if( class_exists( $classname ) === false ) { |
|
154 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
153 | + if (class_exists($classname) === false) { |
|
154 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
155 | 155 | } |
156 | 156 | |
157 | - $object = new $classname( $context, $mapping, $object ); |
|
157 | + $object = new $classname($context, $mapping, $object); |
|
158 | 158 | |
159 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object ); |
|
159 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $object; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process end' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process end'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Terminates expired subscriptions' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Terminates expired subscriptions'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -65,51 +65,51 @@ discard block |
||
65 | 65 | * @since 2018.04 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
68 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
69 | 69 | |
70 | - $processors = $this->getProcessors( $names ); |
|
71 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
70 | + $processors = $this->getProcessors($names); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
72 | 72 | |
73 | - $search = $manager->createSearch( true ); |
|
73 | + $search = $manager->createSearch(true); |
|
74 | 74 | $expr = [ |
75 | - $search->compare( '<', 'subscription.dateend', date( 'Y-m-d' ) ), |
|
75 | + $search->compare('<', 'subscription.dateend', date('Y-m-d')), |
|
76 | 76 | $search->getConditions(), |
77 | 77 | ]; |
78 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
79 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
78 | + $search->setConditions($search->combine('&&', $expr)); |
|
79 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
80 | 80 | |
81 | 81 | $start = 0; |
82 | 82 | |
83 | 83 | do |
84 | 84 | { |
85 | - $search->setSlice( $start, 100 ); |
|
86 | - $items = $manager->searchItems( $search ); |
|
85 | + $search->setSlice($start, 100); |
|
86 | + $items = $manager->searchItems($search); |
|
87 | 87 | |
88 | - foreach( $items as $item ) |
|
88 | + foreach ($items as $item) |
|
89 | 89 | { |
90 | 90 | try |
91 | 91 | { |
92 | - foreach( $processors as $processor ) { |
|
93 | - $processor->end( $item ); |
|
92 | + foreach ($processors as $processor) { |
|
93 | + $processor->end($item); |
|
94 | 94 | } |
95 | 95 | |
96 | - if( ( $reason = $item->getReason() ) === null ) { |
|
96 | + if (($reason = $item->getReason()) === null) { |
|
97 | 97 | $reason = \Aimeos\MShop\Subscription\Item\Iface::REASON_END; |
98 | 98 | } |
99 | 99 | |
100 | - $manager->saveItem( $item->setReason( $reason )->setStatus( 0 ) ); |
|
100 | + $manager->saveItem($item->setReason($reason)->setStatus(0)); |
|
101 | 101 | } |
102 | - catch( \Exception $e ) |
|
102 | + catch (\Exception $e) |
|
103 | 103 | { |
104 | 104 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
105 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
106 | - $logger->log( $e->getTraceAsString() ); |
|
105 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
106 | + $logger->log($e->getTraceAsString()); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - $count = count( $items ); |
|
110 | + $count = count($items); |
|
111 | 111 | $start += $count; |
112 | 112 | } |
113 | - while( $count === $search->getSliceSize() ); |
|
113 | + while ($count === $search->getSliceSize()); |
|
114 | 114 | } |
115 | 115 | } |
@@ -98,8 +98,7 @@ |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | $manager->saveItem( $item->setReason( $reason )->setStatus( 0 ) ); |
101 | - } |
|
102 | - catch( \Exception $e ) |
|
101 | + } catch( \Exception $e ) |
|
103 | 102 | { |
104 | 103 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
105 | 104 | $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $interval = new \DateInterval( $item->getInterval() ); |
95 | 95 | $item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) ); |
96 | - } |
|
97 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
98 | 97 | { |
99 | 98 | $item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT ); |
100 | 99 | $item->setDateEnd( date_create()->format( 'Y-m-d' ) ); |
@@ -108,8 +107,7 @@ discard block |
||
108 | 107 | foreach( $processors as $processor ) { |
109 | 108 | $processor->renew( $item, $newInvoice ); |
110 | 109 | } |
111 | - } |
|
112 | - catch( \Exception $e ) |
|
110 | + } catch( \Exception $e ) |
|
113 | 111 | { |
114 | 112 | $msg = 'Unable to process subscription with ID "%1$s": %2$s'; |
115 | 113 | $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
@@ -152,8 +150,7 @@ discard block |
||
152 | 150 | |
153 | 151 | $context->setUserId( $baseItem->getCustomerId() ); |
154 | 152 | $context->setGroupIds( $customerItem->getGroups() ); |
155 | - } |
|
156 | - catch( \Exception $e ) {} // Subscription without account |
|
153 | + } catch( \Exception $e ) {} // Subscription without account |
|
157 | 154 | |
158 | 155 | return $context; |
159 | 156 | } |
@@ -128,7 +128,6 @@ discard block |
||
128 | 128 | * Adds the given addresses to the basket |
129 | 129 | * |
130 | 130 | * @param \Aimeos\MShop\Context\Item\Iface Context object |
131 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the addresses to |
|
132 | 131 | * @param array $addresses Associative list of type as key and address object implementing \Aimeos\MShop\Order\Item\Base\Address\Iface as value |
133 | 132 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with addresses added |
134 | 133 | */ |
@@ -205,7 +204,6 @@ discard block |
||
205 | 204 | * Adds the given products to the basket |
206 | 205 | * |
207 | 206 | * @param \Aimeos\MShop\Context\Item\Iface Context object |
208 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the products to |
|
209 | 207 | * @param \Aimeos\MShop\Order\Item\Base\Product\Iface[] $orderProducts List of product items |
210 | 208 | * @param string $orderProductId Unique ID of the ordered subscription product |
211 | 209 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with products added |
@@ -232,7 +230,6 @@ discard block |
||
232 | 230 | * Adds a matching delivery and payment service to the basket |
233 | 231 | * |
234 | 232 | * @param \Aimeos\MShop\Context\Item\Iface Context object |
235 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the services to |
|
236 | 233 | * @param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values |
237 | 234 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added |
238 | 235 | */ |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process renew' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process renew'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Renews subscriptions at next date' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Renews subscriptions at next date'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -54,73 +54,73 @@ discard block |
||
54 | 54 | $config = $context->getConfig(); |
55 | 55 | $logger = $context->getLogger(); |
56 | 56 | |
57 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
57 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
58 | 58 | |
59 | - $date = date( 'Y-m-d' ); |
|
60 | - $processors = $this->getProcessors( $names ); |
|
61 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
59 | + $date = date('Y-m-d'); |
|
60 | + $processors = $this->getProcessors($names); |
|
61 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
62 | 62 | |
63 | - $search = $manager->createSearch( true ); |
|
63 | + $search = $manager->createSearch(true); |
|
64 | 64 | $expr = [ |
65 | - $search->compare( '<=', 'subscription.datenext', $date ), |
|
66 | - $search->combine( '||', [ |
|
67 | - $search->compare( '==', 'subscription.dateend', null ), |
|
68 | - $search->compare( '>', 'subscription.dateend', $date ), |
|
69 | - ] ), |
|
65 | + $search->compare('<=', 'subscription.datenext', $date), |
|
66 | + $search->combine('||', [ |
|
67 | + $search->compare('==', 'subscription.dateend', null), |
|
68 | + $search->compare('>', 'subscription.dateend', $date), |
|
69 | + ]), |
|
70 | 70 | $search->getConditions(), |
71 | 71 | ]; |
72 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
73 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
72 | + $search->setConditions($search->combine('&&', $expr)); |
|
73 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
74 | 74 | |
75 | 75 | $start = 0; |
76 | 76 | |
77 | 77 | do |
78 | 78 | { |
79 | - $search->setSlice( $start, 100 ); |
|
80 | - $items = $manager->searchItems( $search ); |
|
79 | + $search->setSlice($start, 100); |
|
80 | + $items = $manager->searchItems($search); |
|
81 | 81 | |
82 | - foreach( $items as $item ) |
|
82 | + foreach ($items as $item) |
|
83 | 83 | { |
84 | 84 | try |
85 | 85 | { |
86 | - $context = $this->createContext( $item->getOrderBaseId() ); |
|
87 | - $newOrder = $this->createOrderBase( $context, $item ); |
|
88 | - $newInvoice = $this->createOrderInvoice( $context, $newOrder ); |
|
86 | + $context = $this->createContext($item->getOrderBaseId()); |
|
87 | + $newOrder = $this->createOrderBase($context, $item); |
|
88 | + $newInvoice = $this->createOrderInvoice($context, $newOrder); |
|
89 | 89 | |
90 | 90 | try |
91 | 91 | { |
92 | - $this->createPayment( $context, $newOrder, $newInvoice ); |
|
92 | + $this->createPayment($context, $newOrder, $newInvoice); |
|
93 | 93 | |
94 | - $interval = new \DateInterval( $item->getInterval() ); |
|
95 | - $item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) ); |
|
94 | + $interval = new \DateInterval($item->getInterval()); |
|
95 | + $item->setDateNext(date_create()->add($interval)->format('Y-m-d')); |
|
96 | 96 | } |
97 | - catch( \Exception $e ) |
|
97 | + catch (\Exception $e) |
|
98 | 98 | { |
99 | - $item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT ); |
|
100 | - $item->setDateEnd( date_create()->format( 'Y-m-d' ) ); |
|
101 | - $manager->saveItem( $item ); |
|
99 | + $item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT); |
|
100 | + $item->setDateEnd(date_create()->format('Y-m-d')); |
|
101 | + $manager->saveItem($item); |
|
102 | 102 | |
103 | 103 | throw $e; |
104 | 104 | } |
105 | 105 | |
106 | - $manager->saveItem( $item ); |
|
106 | + $manager->saveItem($item); |
|
107 | 107 | |
108 | - foreach( $processors as $processor ) { |
|
109 | - $processor->renew( $item, $newInvoice ); |
|
108 | + foreach ($processors as $processor) { |
|
109 | + $processor->renew($item, $newInvoice); |
|
110 | 110 | } |
111 | 111 | } |
112 | - catch( \Exception $e ) |
|
112 | + catch (\Exception $e) |
|
113 | 113 | { |
114 | 114 | $msg = 'Unable to process subscription with ID "%1$s": %2$s'; |
115 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
116 | - $logger->log( $e->getTraceAsString() ); |
|
115 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
116 | + $logger->log($e->getTraceAsString()); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - $count = count( $items ); |
|
120 | + $count = count($items); |
|
121 | 121 | $start += $count; |
122 | 122 | } |
123 | - while( $count === $search->getSliceSize() ); |
|
123 | + while ($count === $search->getSliceSize()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | * @param array $addresses Associative list of type as key and address object implementing \Aimeos\MShop\Order\Item\Base\Address\Iface as value |
133 | 133 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with addresses added |
134 | 134 | */ |
135 | - protected function addBasketAddresses( \Aimeos\MShop\Context\Item\Iface $context, |
|
136 | - \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses ) |
|
135 | + protected function addBasketAddresses(\Aimeos\MShop\Context\Item\Iface $context, |
|
136 | + \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses) |
|
137 | 137 | { |
138 | - foreach( $addresses as $type => $orderAddress ) { |
|
139 | - $newBasket->setAddress( $orderAddress, $type ); |
|
138 | + foreach ($addresses as $type => $orderAddress) { |
|
139 | + $newBasket->setAddress($orderAddress, $type); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $newBasket; |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * @param array $codes List of coupon codes that should be added to the given basket |
152 | 152 | * @return \Aimeos\MShop\Order\Item\Base\Iface Basket, maybe with coupons added |
153 | 153 | */ |
154 | - protected function addBasketCoupons( \Aimeos\MShop\Context\Item\Iface $context, |
|
155 | - \Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes ) |
|
154 | + protected function addBasketCoupons(\Aimeos\MShop\Context\Item\Iface $context, |
|
155 | + \Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes) |
|
156 | 156 | { |
157 | 157 | /** controller/jobs/subcription/process/renew/standard/use-coupons |
158 | 158 | * |
@@ -166,34 +166,34 @@ discard block |
||
166 | 166 | * @category User |
167 | 167 | * @since 2018.10 |
168 | 168 | */ |
169 | - if( $context->getConfig()->get( 'controller/jobs/subcription/process/renew/standard/use-coupons', false ) ) |
|
169 | + if ($context->getConfig()->get('controller/jobs/subcription/process/renew/standard/use-coupons', false)) |
|
170 | 170 | { |
171 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'coupon' ); |
|
172 | - $codeManager = \Aimeos\MShop\Factory::createManager( $context, 'coupon/code' ); |
|
171 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'coupon'); |
|
172 | + $codeManager = \Aimeos\MShop\Factory::createManager($context, 'coupon/code'); |
|
173 | 173 | |
174 | - foreach( $codes as $code ) |
|
174 | + foreach ($codes as $code) |
|
175 | 175 | { |
176 | - $search = $manager->createSearch( true )->setSlice( 0, 1 ); |
|
176 | + $search = $manager->createSearch(true)->setSlice(0, 1); |
|
177 | 177 | $expr = [ |
178 | - $search->compare( '==', 'coupon.code.code', $code ), |
|
179 | - $codeManager->createSearch( true )->getConditions(), |
|
178 | + $search->compare('==', 'coupon.code.code', $code), |
|
179 | + $codeManager->createSearch(true)->getConditions(), |
|
180 | 180 | $search->getConditions(), |
181 | 181 | ]; |
182 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
182 | + $search->setConditions($search->combine('&&', $expr)); |
|
183 | 183 | |
184 | - $result = $manager->searchItems( $search ); |
|
184 | + $result = $manager->searchItems($search); |
|
185 | 185 | |
186 | - if( ( $item = reset( $result ) ) === false ) { |
|
186 | + if (($item = reset($result)) === false) { |
|
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | |
190 | - $provider = $manager->getProvider( $item, strtolower( $code ) ); |
|
190 | + $provider = $manager->getProvider($item, strtolower($code)); |
|
191 | 191 | |
192 | - if( $provider->isAvailable( $basket ) !== true ) { |
|
192 | + if ($provider->isAvailable($basket) !== true) { |
|
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | |
196 | - $provider->addCoupon( $basket ); |
|
196 | + $provider->addCoupon($basket); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | * @param string $orderProductId Unique ID of the ordered subscription product |
211 | 211 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with products added |
212 | 212 | */ |
213 | - protected function addBasketProducts( \Aimeos\MShop\Context\Item\Iface $context, |
|
214 | - \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId ) |
|
213 | + protected function addBasketProducts(\Aimeos\MShop\Context\Item\Iface $context, |
|
214 | + \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId) |
|
215 | 215 | { |
216 | - foreach( $orderProducts as $orderProduct ) |
|
216 | + foreach ($orderProducts as $orderProduct) |
|
217 | 217 | { |
218 | - if( $orderProduct->getId() == $orderProductId ) |
|
218 | + if ($orderProduct->getId() == $orderProductId) |
|
219 | 219 | { |
220 | - foreach( $orderProduct->getAttributeItems() as $attrItem ) { |
|
221 | - $attrItem->setId( null ); |
|
220 | + foreach ($orderProduct->getAttributeItems() as $attrItem) { |
|
221 | + $attrItem->setId(null); |
|
222 | 222 | } |
223 | - $newBasket->addProduct( $orderProduct->setId( null ) ); |
|
223 | + $newBasket->addProduct($orderProduct->setId(null)); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
@@ -236,35 +236,35 @@ discard block |
||
236 | 236 | * @param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values |
237 | 237 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added |
238 | 238 | */ |
239 | - protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context, |
|
240 | - \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services ) |
|
239 | + protected function addBasketServices(\Aimeos\MShop\Context\Item\Iface $context, |
|
240 | + \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services) |
|
241 | 241 | { |
242 | 242 | $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT; |
243 | 243 | |
244 | - if( isset( $services[$type] ) ) |
|
244 | + if (isset($services[$type])) |
|
245 | 245 | { |
246 | - foreach( $services[$type] as $orderService ) { |
|
247 | - $newBasket->addService( $orderService, $type ); |
|
246 | + foreach ($services[$type] as $orderService) { |
|
247 | + $newBasket->addService($orderService, $type); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | 251 | $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY; |
252 | 252 | |
253 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
254 | - $orderServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
253 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
254 | + $orderServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
255 | 255 | |
256 | - $search = $serviceManager->createSearch( true ); |
|
257 | - $search->setSortations( [$search->sort( '+', 'service.position' )] ); |
|
258 | - $search->setConditions( $search->compare( '==', 'service.type', $type ) ); |
|
256 | + $search = $serviceManager->createSearch(true); |
|
257 | + $search->setSortations([$search->sort('+', 'service.position')]); |
|
258 | + $search->setConditions($search->compare('==', 'service.type', $type)); |
|
259 | 259 | |
260 | - foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item ) |
|
260 | + foreach ($serviceManager->searchItems($search, ['media', 'price', 'text']) as $item) |
|
261 | 261 | { |
262 | - $provider = $serviceManager->getProvider( $item, $item->getType() ); |
|
262 | + $provider = $serviceManager->getProvider($item, $item->getType()); |
|
263 | 263 | |
264 | - if( $provider->isAvailable( $newBasket ) === true ) |
|
264 | + if ($provider->isAvailable($newBasket) === true) |
|
265 | 265 | { |
266 | - $orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item ); |
|
267 | - return $newBasket->addService( $orderServiceItem, $type ); |
|
266 | + $orderServiceItem = $orderServiceManager->createItem()->copyFrom($item); |
|
267 | + return $newBasket->addService($orderServiceItem, $type); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -278,30 +278,30 @@ discard block |
||
278 | 278 | * @param string $baseId Unique order base ID |
279 | 279 | * @return \Aimeos\MShop\Context\Item\Iface New context object |
280 | 280 | */ |
281 | - protected function createContext( $baseId ) |
|
281 | + protected function createContext($baseId) |
|
282 | 282 | { |
283 | 283 | $context = clone $this->getContext(); |
284 | 284 | |
285 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
286 | - $baseItem = $manager->getItem( $baseId ); |
|
285 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
286 | + $baseItem = $manager->getItem($baseId); |
|
287 | 287 | |
288 | 288 | $locale = $baseItem->getLocale(); |
289 | 289 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
290 | 290 | |
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
292 | - $locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level ); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
292 | + $locale = $manager->bootstrap($baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level); |
|
293 | 293 | |
294 | - $context->setLocale( $locale ); |
|
294 | + $context->setLocale($locale); |
|
295 | 295 | |
296 | 296 | try |
297 | 297 | { |
298 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
299 | - $customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); |
|
298 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
299 | + $customerItem = $manager->getItem($baseItem->getCustomerId(), ['customer/group']); |
|
300 | 300 | |
301 | - $context->setUserId( $baseItem->getCustomerId() ); |
|
302 | - $context->setGroupIds( $customerItem->getGroups() ); |
|
301 | + $context->setUserId($baseItem->getCustomerId()); |
|
302 | + $context->setGroupIds($customerItem->getGroups()); |
|
303 | 303 | } |
304 | - catch( \Exception $e ) {} // Subscription without account |
|
304 | + catch (\Exception $e) {} // Subscription without account |
|
305 | 305 | |
306 | 306 | return $context; |
307 | 307 | } |
@@ -314,19 +314,19 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID |
315 | 315 | * @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage |
316 | 316 | */ |
317 | - protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription ) |
|
317 | + protected function createOrderBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription) |
|
318 | 318 | { |
319 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
319 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
320 | 320 | |
321 | - $basket = $manager->load( $subscription->getOrderBaseId() ); |
|
322 | - $newBasket = $manager->createItem()->setCustomerId( $basket->getCustomerId() ); |
|
321 | + $basket = $manager->load($subscription->getOrderBaseId()); |
|
322 | + $newBasket = $manager->createItem()->setCustomerId($basket->getCustomerId()); |
|
323 | 323 | |
324 | - $newBasket = $this->addBasketProducts( $context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId() ); |
|
325 | - $newBasket = $this->addBasketAddresses( $context, $newBasket, $basket->getAddresses() ); |
|
326 | - $newBasket = $this->addBasketServices( $context, $newBasket, $basket->getServices() ); |
|
327 | - $newBasket = $this->addBasketCoupons( $context, $newBasket, array_keys( $basket->getCoupons() ) ); |
|
324 | + $newBasket = $this->addBasketProducts($context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId()); |
|
325 | + $newBasket = $this->addBasketAddresses($context, $newBasket, $basket->getAddresses()); |
|
326 | + $newBasket = $this->addBasketServices($context, $newBasket, $basket->getServices()); |
|
327 | + $newBasket = $this->addBasketCoupons($context, $newBasket, array_keys($basket->getCoupons())); |
|
328 | 328 | |
329 | - return $manager->store( $newBasket ); |
|
329 | + return $manager->store($newBasket); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -337,15 +337,15 @@ discard block |
||
337 | 337 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage |
338 | 338 | * @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage |
339 | 339 | */ |
340 | - protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
340 | + protected function createOrderInvoice(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
341 | 341 | { |
342 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
342 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
343 | 343 | |
344 | 344 | $item = $manager->createItem(); |
345 | - $item->setBaseId( $basket->getId() ); |
|
346 | - $item->setType( 'subscription' ); |
|
345 | + $item->setBaseId($basket->getId()); |
|
346 | + $item->setType('subscription'); |
|
347 | 347 | |
348 | - return $manager->saveItem( $item ); |
|
348 | + return $manager->saveItem($item); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -356,17 +356,17 @@ discard block |
||
356 | 356 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services |
357 | 357 | * @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order |
358 | 358 | */ |
359 | - protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
360 | - \Aimeos\MShop\Order\Item\Iface $invoice ) |
|
359 | + protected function createPayment(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
360 | + \Aimeos\MShop\Order\Item\Iface $invoice) |
|
361 | 361 | { |
362 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
362 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
363 | 363 | |
364 | - foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service ) |
|
364 | + foreach ($basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT) as $service) |
|
365 | 365 | { |
366 | - $item = $manager->getItem( $service->getServiceId() ); |
|
367 | - $provider = $manager->getProvider( $item, 'payment' ); |
|
366 | + $item = $manager->getItem($service->getServiceId()); |
|
367 | + $provider = $manager->getProvider($item, 'payment'); |
|
368 | 368 | |
369 | - $provider->repay( $invoice ); |
|
369 | + $provider->repay($invoice); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
@@ -20,49 +20,49 @@ discard block |
||
20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
21 | 21 | $this->context = \TestHelperJobs::getContext(); |
22 | 22 | |
23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos ); |
|
23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos); |
|
24 | 24 | |
25 | - \Aimeos\MShop\Factory::setCache( true ); |
|
25 | + \Aimeos\MShop\Factory::setCache(true); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | protected function tearDown() |
30 | 30 | { |
31 | - \Aimeos\MShop\Factory::setCache( false ); |
|
31 | + \Aimeos\MShop\Factory::setCache(false); |
|
32 | 32 | \Aimeos\MShop\Factory::clear(); |
33 | 33 | |
34 | - unset( $this->object, $this->context ); |
|
34 | + unset($this->object, $this->context); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetName() |
39 | 39 | { |
40 | - $this->assertEquals( 'Subscription process start', $this->object->getName() ); |
|
40 | + $this->assertEquals('Subscription process start', $this->object->getName()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetDescription() |
45 | 45 | { |
46 | - $this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() ); |
|
46 | + $this->assertEquals('Process subscriptions initially', $this->object->getDescription()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testRun() |
51 | 51 | { |
52 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
52 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
53 | 53 | $item = $this->getSubscription(); |
54 | 54 | |
55 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
56 | - ->setConstructorArgs( [$this->context] ) |
|
57 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
55 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
56 | + ->setConstructorArgs([$this->context]) |
|
57 | + ->setMethods(['searchItems', 'saveItem']) |
|
58 | 58 | ->getMock(); |
59 | 59 | |
60 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
60 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
61 | 61 | |
62 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
63 | - ->will( $this->returnValue( [$item] ) ); |
|
62 | + $managerStub->expects($this->once())->method('searchItems') |
|
63 | + ->will($this->returnValue([$item])); |
|
64 | 64 | |
65 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
65 | + $managerStub->expects($this->once())->method('saveItem'); |
|
66 | 66 | |
67 | 67 | $this->object->run(); |
68 | 68 | } |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | |
71 | 71 | public function testRunException() |
72 | 72 | { |
73 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
74 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] ); |
|
73 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
74 | + $this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']); |
|
75 | 75 | |
76 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
77 | - ->setConstructorArgs( [$this->context] ) |
|
78 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
76 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
77 | + ->setConstructorArgs([$this->context]) |
|
78 | + ->setMethods(['searchItems', 'saveItem']) |
|
79 | 79 | ->getMock(); |
80 | 80 | |
81 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
81 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
82 | 82 | |
83 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
84 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
83 | + $managerStub->expects($this->once())->method('searchItems') |
|
84 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
85 | 85 | |
86 | - $managerStub->expects( $this->once() )->method( 'saveItem' ) |
|
87 | - ->will( $this->throwException( new \Exception() ) ); |
|
86 | + $managerStub->expects($this->once())->method('saveItem') |
|
87 | + ->will($this->throwException(new \Exception())); |
|
88 | 88 | |
89 | 89 | $this->object->run(); |
90 | 90 | } |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function getSubscription() |
94 | 94 | { |
95 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
95 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
96 | 96 | |
97 | 97 | $search = $manager->createSearch(); |
98 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
98 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
99 | 99 | |
100 | - $items = $manager->searchItems( $search ); |
|
100 | + $items = $manager->searchItems($search); |
|
101 | 101 | |
102 | - if( ( $item = reset( $items ) ) !== false ) { |
|
102 | + if (($item = reset($items)) !== false) { |
|
103 | 103 | return $item; |
104 | 104 | } |
105 | 105 | |
106 | - throw new \Exception( 'No subscription item found' ); |
|
106 | + throw new \Exception('No subscription item found'); |
|
107 | 107 | } |
108 | 108 | } |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop\Factory::setCache( true ); |
|
21 | + \Aimeos\MShop\Factory::setCache(true); |
|
22 | 22 | |
23 | 23 | $this->context = \TestHelperJobs::getContext(); |
24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
25 | 25 | |
26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos ); |
|
26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
32 | + \Aimeos\MShop\Factory::setCache(false); |
|
33 | 33 | \Aimeos\MShop\Factory::clear(); |
34 | 34 | |
35 | 35 | $this->object = null; |
@@ -38,40 +38,40 @@ discard block |
||
38 | 38 | |
39 | 39 | public function testGetName() |
40 | 40 | { |
41 | - $this->assertEquals( 'Product site map', $this->object->getName() ); |
|
41 | + $this->assertEquals('Product site map', $this->object->getName()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testGetDescription() |
46 | 46 | { |
47 | 47 | $text = 'Creates a product site map for search engines'; |
48 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
48 | + $this->assertEquals($text, $this->object->getDescription()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testRun() |
53 | 53 | { |
54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 ); |
|
54 | + $this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5); |
|
55 | 55 | |
56 | 56 | $this->object->run(); |
57 | 57 | |
58 | 58 | $ds = DIRECTORY_SEPARATOR; |
59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
61 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
59 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
60 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
61 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
62 | 62 | |
63 | - $file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 ); |
|
64 | - $file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 ); |
|
65 | - $index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 ); |
|
63 | + $file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000); |
|
64 | + $file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000); |
|
65 | + $index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000); |
|
66 | 66 | |
67 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
68 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
69 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
67 | + unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
68 | + unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
69 | + unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
70 | 70 | |
71 | - $this->assertContains( 'Cafe_Noire_Expresso', $file2 ); |
|
72 | - $this->assertContains( 'Unittest%3A_Bundle', $file2 ); |
|
71 | + $this->assertContains('Cafe_Noire_Expresso', $file2); |
|
72 | + $this->assertContains('Unittest%3A_Bundle', $file2); |
|
73 | 73 | |
74 | - $this->assertContains( 'aimeos-sitemap-1.xml.gz', $index ); |
|
75 | - $this->assertContains( 'aimeos-sitemap-2.xml.gz', $index ); |
|
74 | + $this->assertContains('aimeos-sitemap-1.xml.gz', $index); |
|
75 | + $this->assertContains('aimeos-sitemap-2.xml.gz', $index); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
20 | + \Aimeos\MShop\Factory::setCache(true); |
|
21 | 21 | |
22 | 22 | $this->context = \TestHelperCntl::getContext(); |
23 | - $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
23 | + $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
29 | + \Aimeos\MShop\Factory::setCache(false); |
|
30 | 30 | \Aimeos\MShop\Factory::clear(); |
31 | 31 | } |
32 | 32 | |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | 4 => '50', |
50 | 50 | ); |
51 | 51 | |
52 | - $product = $this->create( 'job_csv_test' ); |
|
52 | + $product = $this->create('job_csv_test'); |
|
53 | 53 | |
54 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
55 | - $object->process( $product, $data ); |
|
54 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
55 | + $object->process($product, $data); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | $pos = 0; |
59 | 59 | $expected = array( |
60 | - array( 'package-weight', '3.00', 'de' ), |
|
61 | - array( 'package-width', '50', null ), |
|
60 | + array('package-weight', '3.00', 'de'), |
|
61 | + array('package-width', '50', null), |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | $items = $product->getPropertyItems(); |
65 | - $this->assertEquals( 2, count( $items ) ); |
|
65 | + $this->assertEquals(2, count($items)); |
|
66 | 66 | |
67 | - foreach( $items as $item ) |
|
67 | + foreach ($items as $item) |
|
68 | 68 | { |
69 | - $this->assertEquals( $expected[$pos][0], $item->getType() ); |
|
70 | - $this->assertEquals( $expected[$pos][1], $item->getValue() ); |
|
71 | - $this->assertEquals( $expected[$pos][2], $item->getLanguageId() ); |
|
69 | + $this->assertEquals($expected[$pos][0], $item->getType()); |
|
70 | + $this->assertEquals($expected[$pos][1], $item->getValue()); |
|
71 | + $this->assertEquals($expected[$pos][2], $item->getLanguageId()); |
|
72 | 72 | $pos++; |
73 | 73 | } |
74 | 74 | } |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | 1 => '10', |
92 | 92 | ); |
93 | 93 | |
94 | - $product = $this->create( 'job_csv_test' ); |
|
94 | + $product = $this->create('job_csv_test'); |
|
95 | 95 | |
96 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
97 | - $object->process( $product, $data ); |
|
98 | - $object->process( $product, $dataUpdate ); |
|
96 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
97 | + $object->process($product, $data); |
|
98 | + $object->process($product, $dataUpdate); |
|
99 | 99 | |
100 | 100 | |
101 | 101 | $items = $product->getPropertyItems(); |
102 | - $item = reset( $items ); |
|
102 | + $item = reset($items); |
|
103 | 103 | |
104 | - $this->assertEquals( 1, count( $items ) ); |
|
105 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item ); |
|
104 | + $this->assertEquals(1, count($items)); |
|
105 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item); |
|
106 | 106 | |
107 | - $this->assertEquals( 'package-height', $item->getType() ); |
|
108 | - $this->assertEquals( '10', $item->getValue() ); |
|
107 | + $this->assertEquals('package-height', $item->getType()); |
|
108 | + $this->assertEquals('10', $item->getValue()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | 1 => '3.00', |
122 | 122 | ); |
123 | 123 | |
124 | - $product = $this->create( 'job_csv_test' ); |
|
124 | + $product = $this->create('job_csv_test'); |
|
125 | 125 | |
126 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
127 | - $object->process( $product, $data ); |
|
126 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
127 | + $object->process($product, $data); |
|
128 | 128 | |
129 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, [], $this->endpoint ); |
|
130 | - $object->process( $product, [] ); |
|
129 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, [], $this->endpoint); |
|
130 | + $object->process($product, []); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | $items = $product->getPropertyItems(); |
134 | 134 | |
135 | - $this->assertEquals( 0, count( $items ) ); |
|
135 | + $this->assertEquals(0, count($items)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -152,23 +152,23 @@ discard block |
||
152 | 152 | 3 => '3.00', |
153 | 153 | ); |
154 | 154 | |
155 | - $product = $this->create( 'job_csv_test' ); |
|
155 | + $product = $this->create('job_csv_test'); |
|
156 | 156 | |
157 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
158 | - $object->process( $product, $data ); |
|
157 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
158 | + $object->process($product, $data); |
|
159 | 159 | |
160 | 160 | $items = $product->getPropertyItems(); |
161 | 161 | |
162 | - $this->assertEquals( 1, count( $items ) ); |
|
162 | + $this->assertEquals(1, count($items)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @param string $code |
168 | 168 | */ |
169 | - protected function create( $code ) |
|
169 | + protected function create($code) |
|
170 | 170 | { |
171 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
172 | - return $manager->createItem()->setCode( $code ); |
|
171 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
172 | + return $manager->createItem()->setCode($code); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process start' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process subscriptions initially' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @see controller/common/subscription/process/payment-status |
68 | 68 | * @see controller/common/subscription/process/payment-days |
69 | 69 | */ |
70 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
70 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
71 | 71 | |
72 | 72 | /** controller/common/subscription/process/payment-status |
73 | 73 | * Minimum payment status that will activate the subscription |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see controller/common/subscription/process/payment-days |
87 | 87 | */ |
88 | 88 | $status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED; |
89 | - $status = $config->get( 'controller/common/subscription/process/payment-status', $status ); |
|
89 | + $status = $config->get('controller/common/subscription/process/payment-status', $status); |
|
90 | 90 | |
91 | 91 | /** controller/common/subscription/process/payment-days |
92 | 92 | * Number of days to wait for the payment until subscription is removed |
@@ -104,74 +104,74 @@ discard block |
||
104 | 104 | * @see controller/common/subscription/process/processors |
105 | 105 | * @see controller/common/subscription/process/payment-status |
106 | 106 | */ |
107 | - $days = (float) $config->get( 'controller/common/subscription/process/payment-days', 3 ); |
|
107 | + $days = (float) $config->get('controller/common/subscription/process/payment-days', 3); |
|
108 | 108 | |
109 | 109 | |
110 | - $processors = $this->getProcessors( $names ); |
|
111 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
112 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
110 | + $processors = $this->getProcessors($names); |
|
111 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
113 | 113 | |
114 | - $search = $manager->createSearch( true ); |
|
114 | + $search = $manager->createSearch(true); |
|
115 | 115 | $expr = [ |
116 | - $search->compare( '==', 'subscription.datenext', null ), |
|
116 | + $search->compare('==', 'subscription.datenext', null), |
|
117 | 117 | $search->getConditions(), |
118 | 118 | ]; |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
120 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
121 | 121 | |
122 | - $date = date( 'Y-m-d H:i:s', time() - 86400 * $days ); |
|
122 | + $date = date('Y-m-d H:i:s', time() - 86400 * $days); |
|
123 | 123 | $start = 0; |
124 | 124 | |
125 | 125 | do |
126 | 126 | { |
127 | 127 | $ordBaseIds = $payStatus = []; |
128 | 128 | |
129 | - $search->setSlice( $start, 100 ); |
|
130 | - $items = $manager->searchItems( $search ); |
|
129 | + $search->setSlice($start, 100); |
|
130 | + $items = $manager->searchItems($search); |
|
131 | 131 | |
132 | - foreach( $items as $item ) { |
|
132 | + foreach ($items as $item) { |
|
133 | 133 | $ordBaseIds[] = $item->getOrderBaseId(); |
134 | 134 | } |
135 | 135 | |
136 | - $orderSearch = $orderManager->createSearch()->setSlice( 0, $search->getSliceSize() ); |
|
137 | - $orderSearch->setConditions( $orderSearch->compare( '==', 'order.base.id', $ordBaseIds ) ); |
|
138 | - $orderSearch->setSortations( [$orderSearch->sort( '+', 'order.id' )] ); |
|
136 | + $orderSearch = $orderManager->createSearch()->setSlice(0, $search->getSliceSize()); |
|
137 | + $orderSearch->setConditions($orderSearch->compare('==', 'order.base.id', $ordBaseIds)); |
|
138 | + $orderSearch->setSortations([$orderSearch->sort('+', 'order.id')]); |
|
139 | 139 | |
140 | - foreach( $orderManager->searchItems( $orderSearch ) as $orderItem ) { |
|
140 | + foreach ($orderManager->searchItems($orderSearch) as $orderItem) { |
|
141 | 141 | $payStatus[$orderItem->getBaseId()] = $orderItem->getPaymentStatus(); |
142 | 142 | } |
143 | 143 | |
144 | - foreach( $items as $item ) |
|
144 | + foreach ($items as $item) |
|
145 | 145 | { |
146 | 146 | try |
147 | 147 | { |
148 | - if( isset( $payStatus[$item->getOrderBaseId()] ) && $payStatus[$item->getOrderBaseId()] >= $status ) |
|
148 | + if (isset($payStatus[$item->getOrderBaseId()]) && $payStatus[$item->getOrderBaseId()] >= $status) |
|
149 | 149 | { |
150 | - foreach( $processors as $processor ) { |
|
151 | - $processor->begin( $item ); |
|
150 | + foreach ($processors as $processor) { |
|
151 | + $processor->begin($item); |
|
152 | 152 | } |
153 | 153 | |
154 | - $interval = new \DateInterval( $item->getInterval() ); |
|
155 | - $item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) ); |
|
154 | + $interval = new \DateInterval($item->getInterval()); |
|
155 | + $item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d')); |
|
156 | 156 | } |
157 | - elseif( $item->getTimeCreated() < $date ) |
|
157 | + elseif ($item->getTimeCreated() < $date) |
|
158 | 158 | { |
159 | - $item->setStatus( 0 ); |
|
159 | + $item->setStatus(0); |
|
160 | 160 | } |
161 | 161 | |
162 | - $manager->saveItem( $item ); |
|
162 | + $manager->saveItem($item); |
|
163 | 163 | } |
164 | - catch( \Exception $e ) |
|
164 | + catch (\Exception $e) |
|
165 | 165 | { |
166 | 166 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
167 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
168 | - $logger->log( $e->getTraceAsString() ); |
|
167 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
168 | + $logger->log($e->getTraceAsString()); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - $count = count( $items ); |
|
172 | + $count = count($items); |
|
173 | 173 | $start += $count; |
174 | 174 | } |
175 | - while( $count === $search->getSliceSize() ); |
|
175 | + while ($count === $search->getSliceSize()); |
|
176 | 176 | } |
177 | 177 | } |
@@ -153,15 +153,13 @@ |
||
153 | 153 | |
154 | 154 | $interval = new \DateInterval( $item->getInterval() ); |
155 | 155 | $item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) ); |
156 | - } |
|
157 | - elseif( $item->getTimeCreated() < $date ) |
|
156 | + } elseif( $item->getTimeCreated() < $date ) |
|
158 | 157 | { |
159 | 158 | $item->setStatus( 0 ); |
160 | 159 | } |
161 | 160 | |
162 | 161 | $manager->saveItem( $item ); |
163 | - } |
|
164 | - catch( \Exception $e ) |
|
162 | + } catch( \Exception $e ) |
|
165 | 163 | { |
166 | 164 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
167 | 165 | $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - public static function getContext( $site = 'unittest' ) |
|
22 | + public static function getContext($site = 'unittest') |
|
23 | 23 | { |
24 | - if( !isset( self::$context[$site] ) ) { |
|
25 | - self::$context[$site] = self::createContext( $site ); |
|
24 | + if (!isset(self::$context[$site])) { |
|
25 | + self::$context[$site] = self::createContext($site); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function getAimeos() |
33 | 33 | { |
34 | - if( !isset( self::$aimeos ) ) |
|
34 | + if (!isset(self::$aimeos)) |
|
35 | 35 | { |
36 | 36 | require_once 'Bootstrap.php'; |
37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
38 | 38 | |
39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$aimeos; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | public static function getControllerPaths() |
48 | 48 | { |
49 | - return self::getAimeos()->getCustomPaths( 'controller/jobs' ); |
|
49 | + return self::getAimeos()->getCustomPaths('controller/jobs'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param string $site |
55 | 55 | */ |
56 | - private static function createContext( $site ) |
|
56 | + private static function createContext($site) |
|
57 | 57 | { |
58 | 58 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
59 | 59 | $aimeos = self::getAimeos(); |
@@ -63,80 +63,80 @@ discard block |
||
63 | 63 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
64 | 64 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
65 | 65 | |
66 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
67 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
68 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
69 | - $ctx->setConfig( $conf ); |
|
66 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
67 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
68 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
69 | + $ctx->setConfig($conf); |
|
70 | 70 | |
71 | 71 | |
72 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
73 | - $ctx->setLogger( $logger ); |
|
72 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
73 | + $ctx->setLogger($logger); |
|
74 | 74 | |
75 | 75 | |
76 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
77 | - $ctx->setDatabaseManager( $dbm ); |
|
76 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
77 | + $ctx->setDatabaseManager($dbm); |
|
78 | 78 | |
79 | 79 | |
80 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
81 | - $ctx->setFilesystemManager( $fs ); |
|
80 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
81 | + $ctx->setFilesystemManager($fs); |
|
82 | 82 | |
83 | 83 | |
84 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
85 | - $ctx->setMessageQueueManager( $mq ); |
|
84 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
85 | + $ctx->setMessageQueueManager($mq); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $cache = new \Aimeos\MW\Cache\None(); |
89 | - $ctx->setCache( $cache ); |
|
89 | + $ctx->setCache($cache); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $session = new \Aimeos\MW\Session\None(); |
93 | - $ctx->setSession( $session ); |
|
93 | + $ctx->setSession($session); |
|
94 | 94 | |
95 | 95 | |
96 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
97 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
96 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
97 | + $ctx->setI18n(array('de' => $i18n)); |
|
98 | 98 | |
99 | 99 | |
100 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
101 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
102 | - $ctx->setLocale( $locale ); |
|
100 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
101 | + $locale = $localeManager->bootstrap($site, 'de', '', false); |
|
102 | + $ctx->setLocale($locale); |
|
103 | 103 | |
104 | 104 | |
105 | - $view = self::createView( $conf ); |
|
106 | - $ctx->setView( $view ); |
|
105 | + $view = self::createView($conf); |
|
106 | + $ctx->setView($view); |
|
107 | 107 | |
108 | 108 | |
109 | - $ctx->setEditor( 'core:controller/jobs' ); |
|
109 | + $ctx->setEditor('core:controller/jobs'); |
|
110 | 110 | |
111 | 111 | return $ctx; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | - protected static function createView( \Aimeos\MW\Config\Iface $config ) |
|
115 | + protected static function createView(\Aimeos\MW\Config\Iface $config) |
|
116 | 116 | { |
117 | 117 | $tmplpaths = array_merge_recursive( |
118 | - self::getAimeos()->getCustomPaths( 'client/html/templates' ), |
|
119 | - self::getAimeos()->getCustomPaths( 'controller/jobs/templates' ) |
|
118 | + self::getAimeos()->getCustomPaths('client/html/templates'), |
|
119 | + self::getAimeos()->getCustomPaths('controller/jobs/templates') |
|
120 | 120 | ); |
121 | 121 | |
122 | - $view = new \Aimeos\MW\View\Standard( $tmplpaths ); |
|
122 | + $view = new \Aimeos\MW\View\Standard($tmplpaths); |
|
123 | 123 | |
124 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
125 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
126 | - $view->addHelper( 'translate', $helper ); |
|
124 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
125 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
126 | + $view->addHelper('translate', $helper); |
|
127 | 127 | |
128 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
129 | - $view->addHelper( 'url', $helper ); |
|
128 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
129 | + $view->addHelper('url', $helper); |
|
130 | 130 | |
131 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
132 | - $view->addHelper( 'number', $helper ); |
|
131 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
132 | + $view->addHelper('number', $helper); |
|
133 | 133 | |
134 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
135 | - $view->addHelper( 'date', $helper ); |
|
134 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
135 | + $view->addHelper('date', $helper); |
|
136 | 136 | |
137 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) ); |
|
138 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
139 | - $view->addHelper( 'config', $helper ); |
|
137 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html')); |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
139 | + $view->addHelper('config', $helper); |
|
140 | 140 | |
141 | 141 | return $view; |
142 | 142 | } |