@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
31 | 31 | */ |
32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
33 | 33 | { |
34 | 34 | /** controller/jobs/product/import/csv/name |
35 | 35 | * Class name of the used product suggestions scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2015.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if ( $name === null ) { |
|
67 | + if ($name === null) { |
|
68 | 68 | $name = $context->getConfig()->get('controller/jobs/product/import/csv/name', 'Standard'); |
69 | 69 | } |
70 | 70 | |
71 | - if ( ctype_alnum($name) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | 73 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name : '<not a string>'; |
74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name; |
79 | 79 | |
80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
81 | 81 | |
82 | 82 | /** controller/jobs/product/import/csv/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the product import CSV job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/product/import/csv/decorators/excludes |
155 | 155 | * @see controller/jobs/product/import/csv/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/import/csv' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/import/csv'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -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/customer/email/watch/name |
36 | 36 | * Class name of the used product notification e-mail 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/customer/email/watch/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/customer/email/watch/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\\Customer\\Email\\Watch\\' . $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\\Customer\\Email\\Watch\\' . $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\\Customer\\Email\\Watch\\' . $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/customer/email/watch/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the customer email watch controllers |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/customer/email/watch/decorators/excludes |
155 | 155 | * @see controller/jobs/customer/email/watch/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'customer/email/watch' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'customer/email/watch'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function getName() |
35 | 35 | { |
36 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product notification e-mails' ); |
|
36 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product notification e-mails'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getDescription() |
46 | 46 | { |
47 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends e-mails for watched products' ); |
|
47 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends e-mails for watched products'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -57,48 +57,48 @@ discard block |
||
57 | 57 | { |
58 | 58 | $langIds = array(); |
59 | 59 | $context = $this->getContext(); |
60 | - $typeId = $this->getListTypeItem( 'watch' )->getId(); |
|
60 | + $typeId = $this->getListTypeItem('watch')->getId(); |
|
61 | 61 | |
62 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
63 | - $custManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
62 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
63 | + $custManager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
64 | 64 | |
65 | - $localeItems = $localeManager->searchItems( $localeManager->createSearch() ); |
|
65 | + $localeItems = $localeManager->searchItems($localeManager->createSearch()); |
|
66 | 66 | |
67 | - foreach( $localeItems as $localeItem ) |
|
67 | + foreach ($localeItems as $localeItem) |
|
68 | 68 | { |
69 | 69 | $langId = $localeItem->getLanguageId(); |
70 | 70 | |
71 | - if( isset( $langIds[$langId] ) ) { |
|
71 | + if (isset($langIds[$langId])) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $langIds[$langId] = true; |
76 | 76 | // fetch language specific text and media items for products |
77 | - $context->getLocale()->setLanguageId( $langId ); |
|
77 | + $context->getLocale()->setLanguageId($langId); |
|
78 | 78 | |
79 | - $search = $custManager->createSearch( true ); |
|
79 | + $search = $custManager->createSearch(true); |
|
80 | 80 | $expr = array( |
81 | - $search->compare( '==', 'customer.languageid', $langId ), |
|
82 | - $search->compare( '==', 'customer.lists.typeid', $typeId ), |
|
83 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
81 | + $search->compare('==', 'customer.languageid', $langId), |
|
82 | + $search->compare('==', 'customer.lists.typeid', $typeId), |
|
83 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
84 | 84 | $search->getConditions(), |
85 | 85 | ); |
86 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
87 | - $search->setSortations( array( $search->sort( '+', 'customer.id' ) ) ); |
|
86 | + $search->setConditions($search->combine('&&', $expr)); |
|
87 | + $search->setSortations(array($search->sort('+', 'customer.id'))); |
|
88 | 88 | |
89 | 89 | $start = 0; |
90 | 90 | |
91 | 91 | do |
92 | 92 | { |
93 | - $customers = $custManager->searchItems( $search ); |
|
93 | + $customers = $custManager->searchItems($search); |
|
94 | 94 | |
95 | - $this->execute( $context, $customers, $typeId ); |
|
95 | + $this->execute($context, $customers, $typeId); |
|
96 | 96 | |
97 | - $count = count( $customers ); |
|
97 | + $count = count($customers); |
|
98 | 98 | $start += $count; |
99 | - $search->setSlice( $start ); |
|
99 | + $search->setSlice($start); |
|
100 | 100 | } |
101 | - while( $count >= $search->getSliceSize() ); |
|
101 | + while ($count >= $search->getSliceSize()); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -110,32 +110,32 @@ discard block |
||
110 | 110 | * @param array $customers List of customer items implementing \Aimeos\MShop\Customer\Item\Iface |
111 | 111 | * @param string $listTypeId Customer list type ID |
112 | 112 | */ |
113 | - protected function execute( \Aimeos\MShop\Context\Item\Iface $context, array $customers, $listTypeId ) |
|
113 | + protected function execute(\Aimeos\MShop\Context\Item\Iface $context, array $customers, $listTypeId) |
|
114 | 114 | { |
115 | 115 | $prodIds = $custIds = array(); |
116 | - $whItem = $this->getWarehouseItem( 'default' ); |
|
117 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
118 | - $listItems = $this->getListItems( $context, array_keys( $customers ), $listTypeId ); |
|
116 | + $whItem = $this->getWarehouseItem('default'); |
|
117 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
118 | + $listItems = $this->getListItems($context, array_keys($customers), $listTypeId); |
|
119 | 119 | |
120 | - foreach( $listItems as $id => $listItem ) |
|
120 | + foreach ($listItems as $id => $listItem) |
|
121 | 121 | { |
122 | 122 | $refId = $listItem->getRefId(); |
123 | - $custIds[ $listItem->getParentId() ][$id] = $refId; |
|
123 | + $custIds[$listItem->getParentId()][$id] = $refId; |
|
124 | 124 | $prodIds[$refId] = $refId; |
125 | 125 | } |
126 | 126 | |
127 | - $date = date( 'Y-m-d H:i:s' ); |
|
128 | - $products = $this->getProducts( $context, $prodIds, $whItem->getId() ); |
|
127 | + $date = date('Y-m-d H:i:s'); |
|
128 | + $products = $this->getProducts($context, $prodIds, $whItem->getId()); |
|
129 | 129 | |
130 | - foreach( $custIds as $custId => $list ) |
|
130 | + foreach ($custIds as $custId => $list) |
|
131 | 131 | { |
132 | 132 | $custListItems = $listIds = array(); |
133 | 133 | |
134 | - foreach( $list as $listId => $prodId ) |
|
134 | + foreach ($list as $listId => $prodId) |
|
135 | 135 | { |
136 | 136 | $listItem = $listItems[$listId]; |
137 | 137 | |
138 | - if( $listItem->getDateEnd() < $date ) { |
|
138 | + if ($listItem->getDateEnd() < $date) { |
|
139 | 139 | $listIds[] = $listId; |
140 | 140 | } |
141 | 141 | |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | |
145 | 145 | try |
146 | 146 | { |
147 | - $custProducts = $this->getListProducts( $custListItems, $products ); |
|
147 | + $custProducts = $this->getListProducts($custListItems, $products); |
|
148 | 148 | |
149 | - if( !empty( $custProducts ) ) |
|
149 | + if (!empty($custProducts)) |
|
150 | 150 | { |
151 | - $this->sendMail( $context, $customers[$custId]->getPaymentAddress(), $custProducts ); |
|
152 | - $listIds += array_keys( $custProducts ); |
|
151 | + $this->sendMail($context, $customers[$custId]->getPaymentAddress(), $custProducts); |
|
152 | + $listIds += array_keys($custProducts); |
|
153 | 153 | } |
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | 157 | $str = 'Error while trying to send product notification e-mail for customer ID "%1$s": %2$s'; |
158 | - $msg = sprintf( $str, $custId, $e->getMessage() ); |
|
159 | - $context->getLogger()->log( $msg ); |
|
158 | + $msg = sprintf($str, $custId, $e->getMessage()); |
|
159 | + $context->getLogger()->log($msg); |
|
160 | 160 | } |
161 | 161 | |
162 | - $listManager->deleteItems( $listIds ); |
|
162 | + $listManager->deleteItems($listIds); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
171 | 171 | * @return \Aimeos\Client\Html\Iface Product notification e-mail client |
172 | 172 | */ |
173 | - protected function getClient( \Aimeos\MShop\Context\Item\Iface $context ) |
|
173 | + protected function getClient(\Aimeos\MShop\Context\Item\Iface $context) |
|
174 | 174 | { |
175 | - if( !isset( $this->client ) ) |
|
175 | + if (!isset($this->client)) |
|
176 | 176 | { |
177 | - $templatePaths = $this->getAimeos()->getCustomPaths( 'client/html' ); |
|
178 | - $this->client = \Aimeos\Client\Html\Email\Watch\Factory::createClient( $context, $templatePaths ); |
|
177 | + $templatePaths = $this->getAimeos()->getCustomPaths('client/html'); |
|
178 | + $this->client = \Aimeos\Client\Html\Email\Watch\Factory::createClient($context, $templatePaths); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $this->client; |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | * @param string $listTypeId Customer list type ID |
191 | 191 | * @return array List of customer list items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
192 | 192 | */ |
193 | - protected function getListItems( \Aimeos\MShop\Context\Item\Iface $context, array $custIds, $listTypeId ) |
|
193 | + protected function getListItems(\Aimeos\MShop\Context\Item\Iface $context, array $custIds, $listTypeId) |
|
194 | 194 | { |
195 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
195 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
196 | 196 | |
197 | 197 | $search = $listManager->createSearch(); |
198 | 198 | $expr = array( |
199 | - $search->compare( '==', 'customer.lists.parentid', $custIds ), |
|
200 | - $search->compare( '==', 'customer.lists.typeid', $listTypeId ), |
|
201 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
199 | + $search->compare('==', 'customer.lists.parentid', $custIds), |
|
200 | + $search->compare('==', 'customer.lists.typeid', $listTypeId), |
|
201 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
202 | 202 | ); |
203 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
204 | - $search->setSlice( 0, 0x7fffffff ); |
|
203 | + $search->setConditions($search->combine('&&', $expr)); |
|
204 | + $search->setSlice(0, 0x7fffffff); |
|
205 | 205 | |
206 | - return $listManager->searchItems( $search ); |
|
206 | + return $listManager->searchItems($search); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -214,35 +214,35 @@ discard block |
||
214 | 214 | * @param array $products List of product items implementing \Aimeos\MShop\Product\Item\Iface |
215 | 215 | * @return array Multi-dimensional associative list of list IDs as key and product / price item maps as values |
216 | 216 | */ |
217 | - protected function getListProducts( array $listItems, array $products ) |
|
217 | + protected function getListProducts(array $listItems, array $products) |
|
218 | 218 | { |
219 | 219 | $result = array(); |
220 | - $priceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price' ); |
|
220 | + $priceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price'); |
|
221 | 221 | |
222 | - foreach( $listItems as $id => $listItem ) |
|
222 | + foreach ($listItems as $id => $listItem) |
|
223 | 223 | { |
224 | 224 | try |
225 | 225 | { |
226 | 226 | $refId = $listItem->getRefId(); |
227 | 227 | $config = $listItem->getConfig(); |
228 | 228 | |
229 | - if( isset( $products[$refId] ) ) |
|
229 | + if (isset($products[$refId])) |
|
230 | 230 | { |
231 | - $prices = $products[$refId]->getRefItems( 'price', 'default', 'default' ); |
|
232 | - $currencyId = ( isset( $config['currency'] ) ? $config['currency'] : null ); |
|
231 | + $prices = $products[$refId]->getRefItems('price', 'default', 'default'); |
|
232 | + $currencyId = (isset($config['currency']) ? $config['currency'] : null); |
|
233 | 233 | |
234 | - $price = $priceManager->getLowestPrice( $prices, 1, $currencyId ); |
|
234 | + $price = $priceManager->getLowestPrice($prices, 1, $currencyId); |
|
235 | 235 | |
236 | - if( isset( $config['stock'] ) && $config['stock'] == 1 || |
|
237 | - isset( $config['price'] ) && $config['price'] == 1 && |
|
238 | - isset( $config['pricevalue'] ) && $config['pricevalue'] > $price->getValue() |
|
236 | + if (isset($config['stock']) && $config['stock'] == 1 || |
|
237 | + isset($config['price']) && $config['price'] == 1 && |
|
238 | + isset($config['pricevalue']) && $config['pricevalue'] > $price->getValue() |
|
239 | 239 | ) { |
240 | 240 | $result[$id]['item'] = $products[$refId]; |
241 | 241 | $result[$id]['price'] = $price; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
245 | - catch( \Exception $e ) { ; } // no price available |
|
245 | + catch (\Exception $e) {; } // no price available |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | return $result; |
@@ -256,27 +256,27 @@ discard block |
||
256 | 256 | * @param array $prodIds List of product IDs |
257 | 257 | * @param string $whId Unique warehouse ID |
258 | 258 | */ |
259 | - protected function getProducts( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $whId ) |
|
259 | + protected function getProducts(\Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $whId) |
|
260 | 260 | { |
261 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
262 | - $search = $productManager->createSearch( true ); |
|
263 | - $domains = array( 'text', 'price', 'media' ); |
|
261 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
262 | + $search = $productManager->createSearch(true); |
|
263 | + $domains = array('text', 'price', 'media'); |
|
264 | 264 | |
265 | 265 | $stockExpr = array( |
266 | - $search->compare( '==', 'product.stock.stocklevel', null ), |
|
267 | - $search->compare( '>', 'product.stock.stocklevel', 0 ), |
|
266 | + $search->compare('==', 'product.stock.stocklevel', null), |
|
267 | + $search->compare('>', 'product.stock.stocklevel', 0), |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | $expr = array( |
271 | - $search->compare( '==', 'product.id', $prodIds ), |
|
271 | + $search->compare('==', 'product.id', $prodIds), |
|
272 | 272 | $search->getConditions(), |
273 | - $search->compare( '==', 'product.stock.warehouseid', $whId ), |
|
274 | - $search->combine( '||', $stockExpr ), |
|
273 | + $search->compare('==', 'product.stock.warehouseid', $whId), |
|
274 | + $search->combine('||', $stockExpr), |
|
275 | 275 | ); |
276 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
277 | - $search->setSlice( 0, 0x7fffffff ); |
|
276 | + $search->setConditions($search->combine('&&', $expr)); |
|
277 | + $search->setSlice(0, 0x7fffffff); |
|
278 | 278 | |
279 | - return $productManager->searchItems( $search, $domains ); |
|
279 | + return $productManager->searchItems($search, $domains); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | * @return \Aimeos\MShop\Common\Item\Type\Iface List type item |
288 | 288 | * @throws \Aimeos\Controller\Jobs\Exception If the list type item wasn't found |
289 | 289 | */ |
290 | - protected function getListTypeItem( $code ) |
|
290 | + protected function getListTypeItem($code) |
|
291 | 291 | { |
292 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists/type' ); |
|
292 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists/type'); |
|
293 | 293 | |
294 | - $search = $manager->createSearch( true ); |
|
295 | - $search->setConditions( $search->compare( '==', 'customer.lists.type.code', $code ) ); |
|
296 | - $result = $manager->searchItems( $search ); |
|
294 | + $search = $manager->createSearch(true); |
|
295 | + $search->setConditions($search->compare('==', 'customer.lists.type.code', $code)); |
|
296 | + $result = $manager->searchItems($search); |
|
297 | 297 | |
298 | - if( ( $item = reset( $result ) ) === false ) { |
|
299 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'List type for domain "%1$s" and code "%2$s" not found', 'customer', $code ) ); |
|
298 | + if (($item = reset($result)) === false) { |
|
299 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('List type for domain "%1$s" and code "%2$s" not found', 'customer', $code)); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | return $item; |
@@ -310,21 +310,21 @@ discard block |
||
310 | 310 | * @return \Aimeos\MShop\Product\Item\Stock\Warehouse\Iface Warehouse item |
311 | 311 | * @throws \Aimeos\Controller\Jobs\Exception If the warehouse item wasn't found |
312 | 312 | */ |
313 | - protected function getWarehouseItem( $code ) |
|
313 | + protected function getWarehouseItem($code) |
|
314 | 314 | { |
315 | - if( !isset( $this->warehouses ) ) |
|
315 | + if (!isset($this->warehouses)) |
|
316 | 316 | { |
317 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock/warehouse' ); |
|
318 | - $search = $manager->createSearch( true ); |
|
317 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock/warehouse'); |
|
318 | + $search = $manager->createSearch(true); |
|
319 | 319 | |
320 | 320 | $this->warehouses = array(); |
321 | - foreach( $manager->searchItems( $search ) as $whItem ) { |
|
322 | - $this->warehouses[ $whItem->getCode() ] = $whItem; |
|
321 | + foreach ($manager->searchItems($search) as $whItem) { |
|
322 | + $this->warehouses[$whItem->getCode()] = $whItem; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
326 | - if( !isset( $this->warehouses[$code] ) ) { |
|
327 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No warehouse "%1$s" found', $code ) ); |
|
326 | + if (!isset($this->warehouses[$code])) { |
|
327 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No warehouse "%1$s" found', $code)); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | return $this->warehouses[$code]; |
@@ -338,27 +338,27 @@ discard block |
||
338 | 338 | * @param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address of the customer |
339 | 339 | * @param array $products List of products a notification should be sent for |
340 | 340 | */ |
341 | - protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context, |
|
342 | - \Aimeos\MShop\Common\Item\Address\Iface $address, array $products ) |
|
341 | + protected function sendMail(\Aimeos\MShop\Context\Item\Iface $context, |
|
342 | + \Aimeos\MShop\Common\Item\Address\Iface $address, array $products) |
|
343 | 343 | { |
344 | 344 | $view = $context->getView(); |
345 | 345 | $view->extProducts = $products; |
346 | 346 | $view->extAddressItem = $address; |
347 | 347 | |
348 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) ); |
|
349 | - $view->addHelper( 'translate', $helper ); |
|
348 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $context->getI18n($address->getLanguageId())); |
|
349 | + $view->addHelper('translate', $helper); |
|
350 | 350 | |
351 | 351 | $mailer = $context->getMail(); |
352 | 352 | $message = $mailer->createMessage(); |
353 | 353 | |
354 | - $helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ); |
|
355 | - $view->addHelper( 'mail', $helper ); |
|
354 | + $helper = new \Aimeos\MW\View\Helper\Mail\Standard($view, $message); |
|
355 | + $view->addHelper('mail', $helper); |
|
356 | 356 | |
357 | - $client = $this->getClient( $context ); |
|
358 | - $client->setView( $view ); |
|
357 | + $client = $this->getClient($context); |
|
358 | + $client->setView($view); |
|
359 | 359 | $client->getHeader(); |
360 | 360 | $client->getBody(); |
361 | 361 | |
362 | - $mailer->send( $message ); |
|
362 | + $mailer->send($message); |
|
363 | 363 | } |
364 | 364 | } |
@@ -151,8 +151,7 @@ discard block |
||
151 | 151 | $this->sendMail( $context, $customers[$custId]->getPaymentAddress(), $custProducts ); |
152 | 152 | $listIds += array_keys( $custProducts ); |
153 | 153 | } |
154 | - } |
|
155 | - catch( \Exception $e ) |
|
154 | + } catch( \Exception $e ) |
|
156 | 155 | { |
157 | 156 | $str = 'Error while trying to send product notification e-mail for customer ID "%1$s": %2$s'; |
158 | 157 | $msg = sprintf( $str, $custId, $e->getMessage() ); |
@@ -241,8 +240,7 @@ discard block |
||
241 | 240 | $result[$id]['price'] = $price; |
242 | 241 | } |
243 | 242 | } |
244 | - } |
|
245 | - catch( \Exception $e ) { ; } // no price available |
|
243 | + } catch( \Exception $e ) { ; } // no price available |
|
246 | 244 | } |
247 | 245 | |
248 | 246 | return $result; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
31 | 31 | */ |
32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
33 | 33 | { |
34 | 34 | /** controller/jobs/customer/email/account/name |
35 | 35 | * Class name of the used product notification e-mail scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2016.04 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'controller/jobs/customer/email/account/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('controller/jobs/customer/email/account/name', 'Standard'); |
|
69 | 69 | } |
70 | 70 | |
71 | - if( ctype_alnum( $name ) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\' . $name : '<not a string>'; |
|
74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\' . $name : '<not a string>'; |
|
74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\' . $name; |
79 | 79 | |
80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
81 | 81 | |
82 | 82 | /** controller/jobs/customer/email/account/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the customer email account controllers |
@@ -153,6 +153,6 @@ discard block |
||
153 | 153 | * @see controller/jobs/customer/email/account/decorators/excludes |
154 | 154 | * @see controller/jobs/customer/email/account/decorators/global |
155 | 155 | */ |
156 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'customer/email/account' ); |
|
156 | + return self::addControllerDecorators($context, $aimeos, $controller, 'customer/email/account'); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
31 | 31 | * @param \Aimeos\Bootstrap $aimeos \Aimeos\Bootstrap main object |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos ) |
|
33 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos) |
|
34 | 34 | { |
35 | 35 | $this->context = $context; |
36 | 36 | $this->aimeos = $aimeos; |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | * @return \Aimeos\MShop\Common\Item\Type\Iface Type item |
69 | 69 | * @throws \Aimeos\Controller\Jobs\Exception If no item is found |
70 | 70 | */ |
71 | - protected function getTypeItem( $prefix, $domain, $code ) |
|
71 | + protected function getTypeItem($prefix, $domain, $code) |
|
72 | 72 | { |
73 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $prefix ); |
|
74 | - $prefix = str_replace( '/', '.', $prefix ); |
|
73 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $prefix); |
|
74 | + $prefix = str_replace('/', '.', $prefix); |
|
75 | 75 | |
76 | 76 | $search = $manager->createSearch(); |
77 | 77 | $expr = array( |
78 | - $search->compare( '==', $prefix . '.domain', $domain ), |
|
79 | - $search->compare( '==', $prefix . '.code', $code ), |
|
78 | + $search->compare('==', $prefix . '.domain', $domain), |
|
79 | + $search->compare('==', $prefix . '.code', $code), |
|
80 | 80 | ); |
81 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
82 | - $result = $manager->searchItems( $search ); |
|
81 | + $search->setConditions($search->combine('&&', $expr)); |
|
82 | + $result = $manager->searchItems($search); |
|
83 | 83 | |
84 | - if( ( $item = reset( $result ) ) === false ) |
|
84 | + if (($item = reset($result)) === false) |
|
85 | 85 | { |
86 | - $msg = sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $prefix ); |
|
87 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
86 | + $msg = sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $prefix); |
|
87 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $item; |
@@ -11,22 +11,22 @@ |
||
11 | 11 | * Set error reporting to maximum |
12 | 12 | */ |
13 | 13 | error_reporting( -1 ); |
14 | -ini_set( 'display_errors', '1' ); |
|
14 | +ini_set('display_errors', '1'); |
|
15 | 15 | |
16 | -date_default_timezone_set( 'UTC' ); |
|
16 | +date_default_timezone_set('UTC'); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Set locale settings to reasonable defaults |
20 | 20 | */ |
21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
24 | -setlocale( LC_TIME, 'POSIX' ); |
|
21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
24 | +setlocale(LC_TIME, 'POSIX'); |
|
25 | 25 | |
26 | 26 | /* |
27 | 27 | * Set include path for tests |
28 | 28 | */ |
29 | -define( 'PATH_TESTS', __DIR__ ); |
|
29 | +define('PATH_TESTS', __DIR__); |
|
30 | 30 | |
31 | 31 | require_once 'TestHelperJobs.php'; |
32 | 32 | \TestHelperJobs::bootstrap(); |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | $this->context = \TestHelperJobs::getContext('unitperf'); |
18 | 18 | |
19 | 19 | $config = $this->context->getConfig(); |
20 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/product-import.zip' ); |
|
21 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
22 | - $config->set( 'controller/jobs/product/import/csv/container/content', 'CSV' ); |
|
23 | - $config->set( 'controller/jobs/product/import/csv/mapping', $this->getMapping() ); |
|
20 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/product-import.zip'); |
|
21 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
22 | + $config->set('controller/jobs/product/import/csv/container/content', 'CSV'); |
|
23 | + $config->set('controller/jobs/product/import/csv/mapping', $this->getMapping()); |
|
24 | 24 | |
25 | - $container = \Aimeos\MW\Container\Factory::getContainer( 'tmp/product-import.zip', 'Zip', 'CSV', array() ); |
|
25 | + $container = \Aimeos\MW\Container\Factory::getContainer('tmp/product-import.zip', 'Zip', 'CSV', array()); |
|
26 | 26 | |
27 | - $content = $container->create( 'product.csv' ); |
|
27 | + $content = $container->create('product.csv'); |
|
28 | 28 | |
29 | - for( $i = 0; $i < 1000; $i++ ) |
|
29 | + for ($i = 0; $i < 1000; $i++) |
|
30 | 30 | { |
31 | 31 | $data = array(); |
32 | 32 | |
33 | - $data = $this->addProduct( $data, $i ); |
|
34 | - $data = $this->addText( $data, $i ); |
|
35 | - $data = $this->addMedia( $data, $i ); |
|
36 | - $data = $this->addPrice( $data, $i ); |
|
37 | - $data = $this->addAttribute( $data, $i ); |
|
38 | - $data = $this->addProductRef( $data, $i ); |
|
39 | - $data = $this->addProperty( $data, $i ); |
|
33 | + $data = $this->addProduct($data, $i); |
|
34 | + $data = $this->addText($data, $i); |
|
35 | + $data = $this->addMedia($data, $i); |
|
36 | + $data = $this->addPrice($data, $i); |
|
37 | + $data = $this->addAttribute($data, $i); |
|
38 | + $data = $this->addProductRef($data, $i); |
|
39 | + $data = $this->addProperty($data, $i); |
|
40 | 40 | |
41 | - $content->add( $data ); |
|
41 | + $content->add($data); |
|
42 | 42 | } |
43 | 43 | |
44 | - $container->add( $content ); |
|
44 | + $container->add($content); |
|
45 | 45 | |
46 | 46 | $container->close(); |
47 | 47 | } |
@@ -55,25 +55,25 @@ discard block |
||
55 | 55 | $this->cleanupPrice(); |
56 | 56 | $this->cleanupProduct(); |
57 | 57 | |
58 | - unlink( 'tmp/product-import.zip' ); |
|
58 | + unlink('tmp/product-import.zip'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testImport() |
63 | 63 | { |
64 | 64 | $aimeos = \TestHelperJobs::getAimeos(); |
65 | - $cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController( $this->context, $aimeos, 'Standard' ); |
|
65 | + $cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController($this->context, $aimeos, 'Standard'); |
|
66 | 66 | |
67 | - $start = microtime( true ); |
|
67 | + $start = microtime(true); |
|
68 | 68 | |
69 | 69 | $cntl->run(); |
70 | 70 | |
71 | - $stop = microtime( true ); |
|
72 | - echo "\n product import CSV: " . ( ( $stop - $start ) ) . " sec\n"; |
|
71 | + $stop = microtime(true); |
|
72 | + echo "\n product import CSV: " . (($stop - $start)) . " sec\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - protected function addAttribute( array $data, $cnt ) |
|
76 | + protected function addAttribute(array $data, $cnt) |
|
77 | 77 | { |
78 | 78 | $data[] = 'length'; // type |
79 | 79 | $data[] = 'import-' . ($cnt % 30); // code |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - protected function addMedia( array $data, $cnt ) |
|
89 | + protected function addMedia(array $data, $cnt) |
|
90 | 90 | { |
91 | 91 | $data[] = "/path/to/image-$cnt.jpg"; // url |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | - protected function addPrice( array $data, $cnt ) |
|
97 | + protected function addPrice(array $data, $cnt) |
|
98 | 98 | { |
99 | 99 | $data[] = 1; // quantity |
100 | 100 | $data[] = 'import-' . $cnt; // label |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - protected function addProduct( array $data, $cnt ) |
|
108 | + protected function addProduct(array $data, $cnt) |
|
109 | 109 | { |
110 | 110 | $data[] = 'import-' . $cnt; // code |
111 | 111 | $data[] = 'import-' . $cnt; // label |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | - protected function addProductRef( array $data, $cnt ) |
|
119 | + protected function addProductRef(array $data, $cnt) |
|
120 | 120 | { |
121 | 121 | $data[] = 'import-' . ($cnt % 100); // code |
122 | 122 | $data[] = 'suggestion'; // type |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | - protected function addProperty( array $data, $cnt ) |
|
128 | + protected function addProperty(array $data, $cnt) |
|
129 | 129 | { |
130 | 130 | $data[] = 'package-weight'; // type |
131 | 131 | $data[] = '0.5'; // value |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | - protected function addText( array $data, $cnt ) |
|
137 | + protected function addText(array $data, $cnt) |
|
138 | 138 | { |
139 | 139 | $data[] = 'name'; // type |
140 | 140 | $data[] = 'import-name-' . $cnt; //content |
@@ -149,132 +149,132 @@ discard block |
||
149 | 149 | |
150 | 150 | protected function cleanupAttribute() |
151 | 151 | { |
152 | - $manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( $this->context ); |
|
152 | + $manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager($this->context); |
|
153 | 153 | |
154 | 154 | $search = $manager->createSearch(); |
155 | 155 | $expr = array( |
156 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
157 | - $search->compare( '==', 'attribute.label', 'import-%' ), |
|
156 | + $search->compare('==', 'attribute.domain', 'product'), |
|
157 | + $search->compare('==', 'attribute.label', 'import-%'), |
|
158 | 158 | ); |
159 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
160 | - $search->setSortations( array( $search->sort( '+', 'attribute.id' ) ) ); |
|
159 | + $search->setConditions($search->combine('&&', $expr)); |
|
160 | + $search->setSortations(array($search->sort('+', 'attribute.id'))); |
|
161 | 161 | |
162 | 162 | $start = 0; |
163 | 163 | |
164 | 164 | do |
165 | 165 | { |
166 | - $result = $manager->searchItems( $search ); |
|
167 | - $manager->deleteItems( array_keys( $result ) ); |
|
166 | + $result = $manager->searchItems($search); |
|
167 | + $manager->deleteItems(array_keys($result)); |
|
168 | 168 | |
169 | - $count = count( $result ); |
|
169 | + $count = count($result); |
|
170 | 170 | $start += $count; |
171 | - $search->setSlice( $start ); |
|
171 | + $search->setSlice($start); |
|
172 | 172 | } |
173 | - while( $count == $search->getSliceSize() ); |
|
173 | + while ($count == $search->getSliceSize()); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | 177 | protected function cleanupMedia() |
178 | 178 | { |
179 | - $manager = \Aimeos\MShop\Media\Manager\Factory::createManager( $this->context ); |
|
179 | + $manager = \Aimeos\MShop\Media\Manager\Factory::createManager($this->context); |
|
180 | 180 | |
181 | 181 | $search = $manager->createSearch(); |
182 | 182 | $expr = array( |
183 | - $search->compare( '==', 'media.domain', 'product' ), |
|
184 | - $search->compare( '==', 'media.label', 'import-%' ), |
|
183 | + $search->compare('==', 'media.domain', 'product'), |
|
184 | + $search->compare('==', 'media.label', 'import-%'), |
|
185 | 185 | ); |
186 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
187 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
186 | + $search->setConditions($search->combine('&&', $expr)); |
|
187 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
188 | 188 | |
189 | 189 | $start = 0; |
190 | 190 | |
191 | 191 | do |
192 | 192 | { |
193 | - $result = $manager->searchItems( $search ); |
|
194 | - $manager->deleteItems( array_keys( $result ) ); |
|
193 | + $result = $manager->searchItems($search); |
|
194 | + $manager->deleteItems(array_keys($result)); |
|
195 | 195 | |
196 | - $count = count( $result ); |
|
196 | + $count = count($result); |
|
197 | 197 | $start += $count; |
198 | - $search->setSlice( $start ); |
|
198 | + $search->setSlice($start); |
|
199 | 199 | } |
200 | - while( $count == $search->getSliceSize() ); |
|
200 | + while ($count == $search->getSliceSize()); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | 204 | protected function cleanupPrice() |
205 | 205 | { |
206 | - $manager = \Aimeos\MShop\Price\Manager\Factory::createManager( $this->context ); |
|
206 | + $manager = \Aimeos\MShop\Price\Manager\Factory::createManager($this->context); |
|
207 | 207 | |
208 | 208 | $search = $manager->createSearch(); |
209 | 209 | $expr = array( |
210 | - $search->compare( '==', 'price.domain', 'product' ), |
|
211 | - $search->compare( '==', 'price.label', 'import-%' ), |
|
210 | + $search->compare('==', 'price.domain', 'product'), |
|
211 | + $search->compare('==', 'price.label', 'import-%'), |
|
212 | 212 | ); |
213 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
214 | - $search->setSortations( array( $search->sort( '+', 'price.id' ) ) ); |
|
213 | + $search->setConditions($search->combine('&&', $expr)); |
|
214 | + $search->setSortations(array($search->sort('+', 'price.id'))); |
|
215 | 215 | |
216 | 216 | $start = 0; |
217 | 217 | |
218 | 218 | do |
219 | 219 | { |
220 | - $result = $manager->searchItems( $search ); |
|
221 | - $manager->deleteItems( array_keys( $result ) ); |
|
220 | + $result = $manager->searchItems($search); |
|
221 | + $manager->deleteItems(array_keys($result)); |
|
222 | 222 | |
223 | - $count = count( $result ); |
|
223 | + $count = count($result); |
|
224 | 224 | $start += $count; |
225 | - $search->setSlice( $start ); |
|
225 | + $search->setSlice($start); |
|
226 | 226 | } |
227 | - while( $count == $search->getSliceSize() ); |
|
227 | + while ($count == $search->getSliceSize()); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | 231 | protected function cleanupProduct() |
232 | 232 | { |
233 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
233 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
234 | 234 | |
235 | 235 | $search = $manager->createSearch(); |
236 | - $search->setConditions( $search->compare( '==', 'product.code', 'import-%' ) ); |
|
237 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
236 | + $search->setConditions($search->compare('==', 'product.code', 'import-%')); |
|
237 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
238 | 238 | |
239 | 239 | $start = 0; |
240 | 240 | |
241 | 241 | do |
242 | 242 | { |
243 | - $result = $manager->searchItems( $search ); |
|
244 | - $manager->deleteItems( array_keys( $result ) ); |
|
243 | + $result = $manager->searchItems($search); |
|
244 | + $manager->deleteItems(array_keys($result)); |
|
245 | 245 | |
246 | - $count = count( $result ); |
|
246 | + $count = count($result); |
|
247 | 247 | $start += $count; |
248 | - $search->setSlice( $start ); |
|
248 | + $search->setSlice($start); |
|
249 | 249 | } |
250 | - while( $count == $search->getSliceSize() ); |
|
250 | + while ($count == $search->getSliceSize()); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
254 | 254 | protected function cleanupText() |
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Text\Manager\Factory::createManager( $this->context ); |
|
256 | + $manager = \Aimeos\MShop\Text\Manager\Factory::createManager($this->context); |
|
257 | 257 | |
258 | 258 | $search = $manager->createSearch(); |
259 | 259 | $expr = array( |
260 | - $search->compare( '==', 'text.domain', 'product' ), |
|
261 | - $search->compare( '==', 'text.label', 'import-%' ), |
|
260 | + $search->compare('==', 'text.domain', 'product'), |
|
261 | + $search->compare('==', 'text.label', 'import-%'), |
|
262 | 262 | ); |
263 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
264 | - $search->setSortations( array( $search->sort( '+', 'text.id' ) ) ); |
|
263 | + $search->setConditions($search->combine('&&', $expr)); |
|
264 | + $search->setSortations(array($search->sort('+', 'text.id'))); |
|
265 | 265 | |
266 | 266 | $start = 0; |
267 | 267 | |
268 | 268 | do |
269 | 269 | { |
270 | - $result = $manager->searchItems( $search ); |
|
271 | - $manager->deleteItems( array_keys( $result ) ); |
|
270 | + $result = $manager->searchItems($search); |
|
271 | + $manager->deleteItems(array_keys($result)); |
|
272 | 272 | |
273 | - $count = count( $result ); |
|
273 | + $count = count($result); |
|
274 | 274 | $start += $count; |
275 | - $search->setSlice( $start ); |
|
275 | + $search->setSlice($start); |
|
276 | 276 | } |
277 | - while( $count == $search->getSliceSize() ); |
|
277 | + while ($count == $search->getSliceSize()); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 |
@@ -4,11 +4,11 @@ |
||
4 | 4 | 'jobs' => array( |
5 | 5 | 'product' => array( |
6 | 6 | 'export' => array( |
7 | - 'location' => dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'tmp', |
|
7 | + 'location' => dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp', |
|
8 | 8 | 'max-items' => 15, |
9 | 9 | 'max-query' => 5, |
10 | 10 | 'sitemap' => array( |
11 | - 'location' => dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'tmp', |
|
11 | + 'location' => dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp', |
|
12 | 12 | 'max-items' => 15, |
13 | 13 | 'max-query' => 5, |
14 | 14 | ), |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | $context = \TestHelperJobs::getContext(); |
16 | 16 | $aimeos = \TestHelperJobs::getAimeos(); |
17 | 17 | |
18 | - $obj = \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController( $context, $aimeos ); |
|
19 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj ); |
|
18 | + $obj = \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController($context, $aimeos); |
|
19 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $context = \TestHelperJobs::getContext(); |
26 | 26 | $aimeos = \TestHelperJobs::getAimeos(); |
27 | 27 | |
28 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
29 | - \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController( $context, $aimeos, 'Wrong$$$Name' ); |
|
28 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
29 | + \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController($context, $aimeos, 'Wrong$$$Name'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $context = \TestHelperJobs::getContext(); |
36 | 36 | $aimeos = \TestHelperJobs::getAimeos(); |
37 | 37 | |
38 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
39 | - \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController( $context, $aimeos, 'WrongClass' ); |
|
38 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
39 | + \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController($context, $aimeos, 'WrongClass'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $context = \TestHelperJobs::getContext(); |
46 | 46 | $aimeos = \TestHelperJobs::getAimeos(); |
47 | 47 | |
48 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
49 | - \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController( $context, $aimeos, 'Factory' ); |
|
48 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
49 | + \Aimeos\Controller\Jobs\Order\Email\Payment\Factory::createController($context, $aimeos, 'Factory'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |