@@ -290,14 +290,14 @@ |
||
290 | 290 | |
291 | 291 | $indexManager = \Aimeos\MShop\Index\Manager\Factory::createManager($this->getContext()); |
292 | 292 | |
293 | - $search = $indexManager->createSearch($default); |
|
294 | - $search->setSlice( 0, $maxQuery ); |
|
295 | - $search->setConditions( |
|
296 | - $search->compare('!=', 'index.catalog.id', null) |
|
297 | - ); |
|
298 | - $search->setSortations( |
|
299 | - [$search->sort( '+', 'product.id' )] |
|
300 | - ); |
|
293 | + $search = $indexManager->createSearch($default); |
|
294 | + $search->setSlice( 0, $maxQuery ); |
|
295 | + $search->setConditions( |
|
296 | + $search->compare('!=', 'index.catalog.id', null) |
|
297 | + ); |
|
298 | + $search->setSortations( |
|
299 | + [$search->sort( '+', 'product.id' )] |
|
300 | + ); |
|
301 | 301 | |
302 | 302 | $content = $this->createContent( $container, $filenum ); |
303 | 303 | $names[] = $content->getResource(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product export' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product export'); |
|
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', 'Exports all available products' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports all available products'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function run() |
52 | 52 | { |
53 | 53 | $container = $this->createContainer(); |
54 | - $this->export( $container, false ); |
|
54 | + $this->export($container, false); |
|
55 | 55 | $container->close(); |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param \Aimeos\MW\Container\Content\Iface $content File content object |
63 | 63 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items |
64 | 64 | */ |
65 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) |
|
65 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) |
|
66 | 66 | { |
67 | 67 | /** controller/jobs/product/export/standard/template-items |
68 | 68 | * Relative path to the XML items template of the product site map job controller. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $view->exportItems = $items; |
96 | 96 | |
97 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
97 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @see controller/jobs/product/export/max-items |
124 | 124 | * @see controller/jobs/product/export/max-query |
125 | 125 | */ |
126 | - $location = $config->get( 'controller/jobs/product/export/location' ); |
|
126 | + $location = $config->get('controller/jobs/product/export/location'); |
|
127 | 127 | |
128 | 128 | /** controller/jobs/product/export/standard/container/type |
129 | 129 | * List of file container options for the export files |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @see controller/jobs/product/export/max-items |
141 | 141 | * @see controller/jobs/product/export/max-query |
142 | 142 | */ |
143 | - $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); |
|
143 | + $container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory'); |
|
144 | 144 | |
145 | 145 | /** controller/jobs/product/export/standard/container/content |
146 | 146 | * List of file container options for the export files |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @see controller/jobs/product/export/max-items |
158 | 158 | * @see controller/jobs/product/export/max-query |
159 | 159 | */ |
160 | - $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); |
|
160 | + $content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary'); |
|
161 | 161 | |
162 | 162 | /** controller/jobs/product/export/standard/container/options |
163 | 163 | * List of file container options for the export files |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | * @see controller/jobs/product/export/max-items |
175 | 175 | * @see controller/jobs/product/export/max-query |
176 | 176 | */ |
177 | - $options = $config->get( 'controller/jobs/product/export/standard/container/options', [] ); |
|
177 | + $options = $config->get('controller/jobs/product/export/standard/container/options', []); |
|
178 | 178 | |
179 | - if( $location === null ) |
|
179 | + if ($location === null) |
|
180 | 180 | { |
181 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' ); |
|
182 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
181 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location'); |
|
182 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
183 | 183 | } |
184 | 184 | |
185 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
185 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param integer $filenum New file number |
194 | 194 | * @return \Aimeos\MW\Container\Content\Iface New content object |
195 | 195 | */ |
196 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
196 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
197 | 197 | { |
198 | 198 | /** controller/jobs/product/export/standard/template-header |
199 | 199 | * Relative path to the XML site map header template of the product site map job controller. |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | $context = $this->getContext(); |
224 | 224 | $view = $context->getView(); |
225 | 225 | |
226 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
227 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
228 | - $container->add( $content ); |
|
226 | + $content = $container->create($this->getFilename($filenum)); |
|
227 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
228 | + $container->add($content); |
|
229 | 229 | |
230 | 230 | return $content; |
231 | 231 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param \Aimeos\MW\Container\Content\Iface $content |
238 | 238 | */ |
239 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
239 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
240 | 240 | { |
241 | 241 | /** controller/jobs/product/export/standard/template-footer |
242 | 242 | * Relative path to the XML site map footer template of the product site map job controller. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $context = $this->getContext(); |
267 | 267 | $view = $context->getView(); |
268 | 268 | |
269 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
269 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -277,50 +277,50 @@ discard block |
||
277 | 277 | * @param boolean $default True to filter exported products by default criteria |
278 | 278 | * @return array List of content (file) names |
279 | 279 | */ |
280 | - protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) |
|
280 | + protected function export(\Aimeos\MW\Container\Iface $container, $default = true) |
|
281 | 281 | { |
282 | - $domains = [ 'attribute', 'media', 'price', 'product', 'text' ]; |
|
282 | + $domains = ['attribute', 'media', 'price', 'product', 'text']; |
|
283 | 283 | |
284 | - $domains = $this->getConfig( 'domains', $domains ); |
|
285 | - $maxItems = $this->getConfig( 'max-items', 10000 ); |
|
286 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); |
|
284 | + $domains = $this->getConfig('domains', $domains); |
|
285 | + $maxItems = $this->getConfig('max-items', 10000); |
|
286 | + $maxQuery = $this->getConfig('max-query', 1000); |
|
287 | 287 | |
288 | 288 | $start = 0; $filenum = 1; |
289 | 289 | $names = []; |
290 | 290 | |
291 | - $indexManager = \Aimeos\MShop\Index\Manager\Factory::createManager($this->getContext()); |
|
291 | + $indexManager = \Aimeos\MShop\Index\Manager\Factory::createManager($this->getContext()); |
|
292 | 292 | |
293 | 293 | $search = $indexManager->createSearch($default); |
294 | - $search->setSlice( 0, $maxQuery ); |
|
294 | + $search->setSlice(0, $maxQuery); |
|
295 | 295 | $search->setConditions( |
296 | 296 | $search->compare('!=', 'index.catalog.id', null) |
297 | 297 | ); |
298 | 298 | $search->setSortations( |
299 | - [$search->sort( '+', 'product.id' )] |
|
299 | + [$search->sort('+', 'product.id')] |
|
300 | 300 | ); |
301 | 301 | |
302 | - $content = $this->createContent( $container, $filenum ); |
|
302 | + $content = $this->createContent($container, $filenum); |
|
303 | 303 | $names[] = $content->getResource(); |
304 | 304 | |
305 | 305 | do |
306 | 306 | { |
307 | - $items = $productManager->searchItems( $search, $domains ); |
|
308 | - $this->addItems( $content, $items ); |
|
307 | + $items = $productManager->searchItems($search, $domains); |
|
308 | + $this->addItems($content, $items); |
|
309 | 309 | |
310 | - $count = count( $items ); |
|
310 | + $count = count($items); |
|
311 | 311 | $start += $count; |
312 | - $search->setSlice( $start, $maxQuery ); |
|
312 | + $search->setSlice($start, $maxQuery); |
|
313 | 313 | |
314 | - if( $start + $maxQuery > $maxItems * $filenum ) |
|
314 | + if ($start + $maxQuery > $maxItems * $filenum) |
|
315 | 315 | { |
316 | - $this->closeContent( $content ); |
|
317 | - $content = $this->createContent( $container, ++$filenum ); |
|
316 | + $this->closeContent($content); |
|
317 | + $content = $this->createContent($container, ++$filenum); |
|
318 | 318 | $names[] = $content->getResource(); |
319 | 319 | } |
320 | 320 | } |
321 | - while( $count >= $search->getSliceSize() ); |
|
321 | + while ($count >= $search->getSliceSize()); |
|
322 | 322 | |
323 | - $this->closeContent( $content ); |
|
323 | + $this->closeContent($content); |
|
324 | 324 | |
325 | 325 | return $names; |
326 | 326 | } |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | * @param mixed $default Default value if name is unknown |
334 | 334 | * @return mixed Configuration value |
335 | 335 | */ |
336 | - protected function getConfig( $name, $default = null ) |
|
336 | + protected function getConfig($name, $default = null) |
|
337 | 337 | { |
338 | 338 | $config = $this->getContext()->getConfig(); |
339 | 339 | |
340 | - switch( $name ) |
|
340 | + switch ($name) |
|
341 | 341 | { |
342 | 342 | case 'domain': |
343 | 343 | /** controller/jobs/product/export/domains |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @see controller/jobs/product/export/max-items |
361 | 361 | * @see controller/jobs/product/export/max-query |
362 | 362 | */ |
363 | - return $config->get( 'controller/jobs/product/export/domains', $default ); |
|
363 | + return $config->get('controller/jobs/product/export/domains', $default); |
|
364 | 364 | |
365 | 365 | case 'max-items': |
366 | 366 | /** controller/jobs/product/export/max-items |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @see controller/jobs/product/export/max-query |
384 | 384 | * @see controller/jobs/product/export/domains |
385 | 385 | */ |
386 | - return $config->get( 'controller/jobs/product/export/max-items', $default ); |
|
386 | + return $config->get('controller/jobs/product/export/max-items', $default); |
|
387 | 387 | |
388 | 388 | case 'max-query': |
389 | 389 | /** controller/jobs/product/export/max-query |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @see controller/jobs/product/export/max-items |
407 | 407 | * @see controller/jobs/product/export/domains |
408 | 408 | */ |
409 | - return $config->get( 'controller/jobs/product/export/max-query', $default ); |
|
409 | + return $config->get('controller/jobs/product/export/max-query', $default); |
|
410 | 410 | |
411 | 411 | case 'filename': |
412 | 412 | /** controller/jobs/product/export/filename |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @see controller/jobs/product/export/max-query |
428 | 428 | * @see controller/jobs/product/export/domains |
429 | 429 | */ |
430 | - return $config->get( 'controller/jobs/product/export/filename', $default ); |
|
430 | + return $config->get('controller/jobs/product/export/filename', $default); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $default; |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | * @param integer $number Current file number |
441 | 441 | * @return string New file name |
442 | 442 | */ |
443 | - protected function getFilename( $number ) |
|
443 | + protected function getFilename($number) |
|
444 | 444 | { |
445 | - return sprintf( $this->getConfig( 'filename', 'aimeos-products-%1$d_%2$s.xml' ), $number, date( 'Y-m-d_H:i:s' ) ); |
|
445 | + return sprintf($this->getConfig('filename', 'aimeos-products-%1$d_%2$s.xml'), $number, date('Y-m-d_H:i:s')); |
|
446 | 446 | } |
447 | 447 | } |