@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop::cache( true ); |
|
20 | + \Aimeos\MShop::cache(true); |
|
21 | 21 | |
22 | 22 | $this->context = \TestHelperCntl::getContext(); |
23 | - $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $this->context, [] ); |
|
23 | + $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($this->context, []); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - \Aimeos\MShop::cache( false ); |
|
29 | + \Aimeos\MShop::cache(false); |
|
30 | 30 | \Aimeos\MShop::clear(); |
31 | 31 | } |
32 | 32 | |
@@ -49,31 +49,31 @@ discard block |
||
49 | 49 | 4 => 1, |
50 | 50 | ); |
51 | 51 | |
52 | - $catalog = $this->create( 'job_csv_test' ); |
|
52 | + $catalog = $this->create('job_csv_test'); |
|
53 | 53 | |
54 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
55 | - $object->process( $catalog, $data ); |
|
54 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
55 | + $object->process($catalog, $data); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | $listItems = $catalog->getListItems(); |
59 | - $listItem = reset( $listItems ); |
|
59 | + $listItem = reset($listItems); |
|
60 | 60 | |
61 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
62 | - $this->assertEquals( 1, count( $listItems ) ); |
|
61 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
62 | + $this->assertEquals(1, count($listItems)); |
|
63 | 63 | |
64 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
65 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
66 | - $this->assertEquals( 'text', $listItem->getDomain() ); |
|
67 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
64 | + $this->assertEquals(1, $listItem->getStatus()); |
|
65 | + $this->assertEquals(0, $listItem->getPosition()); |
|
66 | + $this->assertEquals('text', $listItem->getDomain()); |
|
67 | + $this->assertEquals('default', $listItem->getType()); |
|
68 | 68 | |
69 | 69 | $refItem = $listItem->getRefItem(); |
70 | 70 | |
71 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
72 | - $this->assertEquals( 'name', $refItem->getType() ); |
|
73 | - $this->assertEquals( 'test text', $refItem->getLabel() ); |
|
74 | - $this->assertEquals( 'Job CSV test', $refItem->getContent() ); |
|
75 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
76 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
71 | + $this->assertEquals(1, $refItem->getStatus()); |
|
72 | + $this->assertEquals('name', $refItem->getType()); |
|
73 | + $this->assertEquals('test text', $refItem->getLabel()); |
|
74 | + $this->assertEquals('Job CSV test', $refItem->getContent()); |
|
75 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
76 | + $this->assertEquals(1, $refItem->getStatus()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -101,27 +101,27 @@ discard block |
||
101 | 101 | 7 => 'Long: Job CSV test 2', |
102 | 102 | ); |
103 | 103 | |
104 | - $catalog = $this->create( 'job_csv_test' ); |
|
104 | + $catalog = $this->create('job_csv_test'); |
|
105 | 105 | |
106 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
107 | - $object->process( $catalog, $data ); |
|
106 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
107 | + $object->process($catalog, $data); |
|
108 | 108 | |
109 | 109 | |
110 | 110 | $pos = 0; |
111 | 111 | $listItems = $catalog->getListItems(); |
112 | 112 | $expected = array( |
113 | - 0 => array( 'name', 'Job CSV test' ), |
|
114 | - 1 => array( 'short', 'Short: Job CSV test' ), |
|
115 | - 2 => array( 'long', 'Long: Job CSV test' ), |
|
116 | - 3 => array( 'long', 'Long: Job CSV test 2' ), |
|
113 | + 0 => array('name', 'Job CSV test'), |
|
114 | + 1 => array('short', 'Short: Job CSV test'), |
|
115 | + 2 => array('long', 'Long: Job CSV test'), |
|
116 | + 3 => array('long', 'Long: Job CSV test 2'), |
|
117 | 117 | ); |
118 | 118 | |
119 | - $this->assertEquals( 4, count( $listItems ) ); |
|
119 | + $this->assertEquals(4, count($listItems)); |
|
120 | 120 | |
121 | - foreach( $listItems as $listItem ) |
|
121 | + foreach ($listItems as $listItem) |
|
122 | 122 | { |
123 | - $this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() ); |
|
124 | - $this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() ); |
|
123 | + $this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType()); |
|
124 | + $this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent()); |
|
125 | 125 | $pos++; |
126 | 126 | } |
127 | 127 | } |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | 1 => 'Short: Job CSV test', |
145 | 145 | ); |
146 | 146 | |
147 | - $catalog = $this->create( 'job_csv_test' ); |
|
147 | + $catalog = $this->create('job_csv_test'); |
|
148 | 148 | |
149 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
150 | - $object->process( $catalog, $data ); |
|
151 | - $object->process( $catalog, $dataUpdate ); |
|
149 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
150 | + $object->process($catalog, $data); |
|
151 | + $object->process($catalog, $dataUpdate); |
|
152 | 152 | |
153 | 153 | |
154 | 154 | $listItems = $catalog->getListItems(); |
155 | - $listItem = reset( $listItems ); |
|
155 | + $listItem = reset($listItems); |
|
156 | 156 | |
157 | - $this->assertEquals( 1, count( $listItems ) ); |
|
158 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
157 | + $this->assertEquals(1, count($listItems)); |
|
158 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
159 | 159 | |
160 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
161 | - $this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() ); |
|
160 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
161 | + $this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent()); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | 1 => 'Job CSV test', |
175 | 175 | ); |
176 | 176 | |
177 | - $catalog = $this->create( 'job_csv_test' ); |
|
177 | + $catalog = $this->create('job_csv_test'); |
|
178 | 178 | |
179 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
180 | - $object->process( $catalog, $data ); |
|
179 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
180 | + $object->process($catalog, $data); |
|
181 | 181 | |
182 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint ); |
|
183 | - $object->process( $catalog, [] ); |
|
182 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint); |
|
183 | + $object->process($catalog, []); |
|
184 | 184 | |
185 | 185 | |
186 | 186 | $listItems = $catalog->getListItems(); |
187 | 187 | |
188 | - $this->assertEquals( 0, count( $listItems ) ); |
|
188 | + $this->assertEquals(0, count($listItems)); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | 3 => '', |
206 | 206 | ); |
207 | 207 | |
208 | - $catalog = $this->create( 'job_csv_test' ); |
|
208 | + $catalog = $this->create('job_csv_test'); |
|
209 | 209 | |
210 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
211 | - $object->process( $catalog, $data ); |
|
210 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
211 | + $object->process($catalog, $data); |
|
212 | 212 | |
213 | 213 | |
214 | 214 | $listItems = $catalog->getListItems(); |
215 | 215 | |
216 | - $this->assertEquals( 1, count( $listItems ) ); |
|
216 | + $this->assertEquals(1, count($listItems)); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -237,26 +237,26 @@ discard block |
||
237 | 237 | 5 => 'default', |
238 | 238 | ); |
239 | 239 | |
240 | - $this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/text/listtypes', array( 'default' ) ); |
|
240 | + $this->context->getConfig()->set('controller/common/catalog/import/csv/processor/text/listtypes', array('default')); |
|
241 | 241 | |
242 | - $catalog = $this->create( 'job_csv_test' ); |
|
242 | + $catalog = $this->create('job_csv_test'); |
|
243 | 243 | |
244 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
244 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
245 | 245 | |
246 | - $this->setExpectedException( '\Aimeos\Controller\Common\Exception' ); |
|
247 | - $object->process( $catalog, $data ); |
|
246 | + $this->setExpectedException('\Aimeos\Controller\Common\Exception'); |
|
247 | + $object->process($catalog, $data); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
251 | 251 | /** |
252 | 252 | * @param string $code |
253 | 253 | */ |
254 | - protected function create( $code ) |
|
254 | + protected function create($code) |
|
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context ); |
|
256 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::create($this->context); |
|
257 | 257 | |
258 | 258 | $item = $manager->createItem(); |
259 | - $item->setCode( $code ); |
|
259 | + $item->setCode($code); |
|
260 | 260 | |
261 | 261 | return $item; |
262 | 262 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product site map' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product site map'); |
|
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', 'Creates a product site map for search engines' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates a product site map for search engines'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $container = $this->createContainer(); |
54 | 54 | |
55 | - $files = $this->export( $container ); |
|
56 | - $this->createSitemapIndex( $container, $files ); |
|
55 | + $files = $this->export($container); |
|
56 | + $this->createSitemapIndex($container, $files); |
|
57 | 57 | |
58 | 58 | $container->close(); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param \Aimeos\MW\Container\Content\Iface $content File content object |
66 | 66 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items |
67 | 67 | */ |
68 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) |
|
68 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) |
|
69 | 69 | { |
70 | 70 | $config = $this->getContext()->getConfig(); |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @see controller/jobs/product/export/sitemap/max-items |
97 | 97 | * @see controller/jobs/product/export/sitemap/max-query |
98 | 98 | */ |
99 | - $changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' ); |
|
99 | + $changefreq = $config->get('controller/jobs/product/export/sitemap/changefreq', 'daily'); |
|
100 | 100 | |
101 | 101 | /** controller/jobs/product/export/sitemap/standard/template-items |
102 | 102 | * Relative path to the XML items template of the product site map job controller. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $view->siteItems = $items; |
130 | 130 | $view->siteFreq = $changefreq; |
131 | 131 | |
132 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
132 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @see controller/jobs/product/export/sitemap/max-query |
176 | 176 | * @see controller/jobs/product/export/sitemap/changefreq |
177 | 177 | */ |
178 | - $location = $config->get( 'controller/jobs/product/export/sitemap/location' ); |
|
178 | + $location = $config->get('controller/jobs/product/export/sitemap/location'); |
|
179 | 179 | |
180 | 180 | /** controller/jobs/product/export/sitemap/container/options |
181 | 181 | * List of file container options for the site map files |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | * @see controller/jobs/product/export/sitemap/max-query |
197 | 197 | * @see controller/jobs/product/export/sitemap/changefreq |
198 | 198 | */ |
199 | - $default = array( 'gzip-mode' => 'wb' ); |
|
200 | - $options = $config->get( 'controller/jobs/product/export/sitemap/container/options', $default ); |
|
199 | + $default = array('gzip-mode' => 'wb'); |
|
200 | + $options = $config->get('controller/jobs/product/export/sitemap/container/options', $default); |
|
201 | 201 | |
202 | - if( $location === null ) |
|
202 | + if ($location === null) |
|
203 | 203 | { |
204 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location' ); |
|
205 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
204 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location'); |
|
205 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
206 | 206 | } |
207 | 207 | |
208 | - return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options ); |
|
208 | + return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param integer $filenum New file number |
217 | 217 | * @return \Aimeos\MW\Container\Content\Iface New content object |
218 | 218 | */ |
219 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
219 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
220 | 220 | { |
221 | 221 | /** controller/jobs/product/export/sitemap/standard/template-header |
222 | 222 | * Relative path to the XML site map header template of the product site map job controller. |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $context = $this->getContext(); |
247 | 247 | $view = $context->getView(); |
248 | 248 | |
249 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
250 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
251 | - $container->add( $content ); |
|
249 | + $content = $container->create($this->getFilename($filenum)); |
|
250 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
251 | + $container->add($content); |
|
252 | 252 | |
253 | 253 | return $content; |
254 | 254 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param \Aimeos\MW\Container\Content\Iface $content |
261 | 261 | */ |
262 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
262 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
263 | 263 | { |
264 | 264 | /** controller/jobs/product/export/sitemap/standard/template-footer |
265 | 265 | * Relative path to the XML site map footer template of the product site map job controller. |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $context = $this->getContext(); |
290 | 290 | $view = $context->getView(); |
291 | 291 | |
292 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
292 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param \Aimeos\MW\Container\Iface $container File container object |
300 | 300 | * @param array $files List of generated site map file names |
301 | 301 | */ |
302 | - protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) |
|
302 | + protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files) |
|
303 | 303 | { |
304 | 304 | /** controller/jobs/product/export/sitemap/standard/template-index |
305 | 305 | * Relative path to the XML site map index template of the product site map job controller. |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | |
332 | 332 | $view->siteFiles = $files; |
333 | 333 | |
334 | - $content = $container->create( 'aimeos-sitemap-index.xml' ); |
|
335 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
336 | - $container->add( $content ); |
|
334 | + $content = $container->create('aimeos-sitemap-index.xml'); |
|
335 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
336 | + $container->add($content); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -344,44 +344,44 @@ discard block |
||
344 | 344 | * @param boolean $default True to filter exported products by default criteria |
345 | 345 | * @return array List of content (file) names |
346 | 346 | */ |
347 | - protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) |
|
347 | + protected function export(\Aimeos\MW\Container\Iface $container, $default = true) |
|
348 | 348 | { |
349 | - $domains = $this->getConfig( 'domains', [] ); |
|
350 | - $maxItems = $this->getConfig( 'max-items', 10000 ); |
|
351 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); |
|
349 | + $domains = $this->getConfig('domains', []); |
|
350 | + $maxItems = $this->getConfig('max-items', 10000); |
|
351 | + $maxQuery = $this->getConfig('max-query', 1000); |
|
352 | 352 | |
353 | 353 | $start = 0; $filenum = 1; |
354 | 354 | $names = []; |
355 | 355 | |
356 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'index' ); |
|
356 | + $manager = \Aimeos\MShop::create($this->getContext(), 'index'); |
|
357 | 357 | |
358 | - $search = $manager->createSearch( $default ); |
|
359 | - $search->setConditions( $search->compare( '!=', 'index.catalog.id', null ) ); |
|
360 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
361 | - $search->setSlice( 0, $maxQuery ); |
|
358 | + $search = $manager->createSearch($default); |
|
359 | + $search->setConditions($search->compare('!=', 'index.catalog.id', null)); |
|
360 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
361 | + $search->setSlice(0, $maxQuery); |
|
362 | 362 | |
363 | - $content = $this->createContent( $container, $filenum ); |
|
363 | + $content = $this->createContent($container, $filenum); |
|
364 | 364 | $names[] = $content->getResource(); |
365 | 365 | |
366 | 366 | do |
367 | 367 | { |
368 | - $items = $manager->searchItems( $search, $domains ); |
|
369 | - $this->addItems( $content, $items ); |
|
368 | + $items = $manager->searchItems($search, $domains); |
|
369 | + $this->addItems($content, $items); |
|
370 | 370 | |
371 | - $count = count( $items ); |
|
371 | + $count = count($items); |
|
372 | 372 | $start += $count; |
373 | - $search->setSlice( $start, $maxQuery ); |
|
373 | + $search->setSlice($start, $maxQuery); |
|
374 | 374 | |
375 | - if( $start + $maxQuery > $maxItems * $filenum ) |
|
375 | + if ($start + $maxQuery > $maxItems * $filenum) |
|
376 | 376 | { |
377 | - $this->closeContent( $content ); |
|
378 | - $content = $this->createContent( $container, ++$filenum ); |
|
377 | + $this->closeContent($content); |
|
378 | + $content = $this->createContent($container, ++$filenum); |
|
379 | 379 | $names[] = $content->getResource(); |
380 | 380 | } |
381 | 381 | } |
382 | - while( $count >= $search->getSliceSize() ); |
|
382 | + while ($count >= $search->getSliceSize()); |
|
383 | 383 | |
384 | - $this->closeContent( $content ); |
|
384 | + $this->closeContent($content); |
|
385 | 385 | |
386 | 386 | return $names; |
387 | 387 | } |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * @param mixed $default Default value if name is unknown |
395 | 395 | * @return mixed Configuration value |
396 | 396 | */ |
397 | - protected function getConfig( $name, $default = null ) |
|
397 | + protected function getConfig($name, $default = null) |
|
398 | 398 | { |
399 | 399 | $config = $this->getContext()->getConfig(); |
400 | 400 | |
401 | - switch( $name ) |
|
401 | + switch ($name) |
|
402 | 402 | { |
403 | 403 | case 'domains': |
404 | 404 | /** controller/jobs/product/export/sitemap/domains |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @see controller/jobs/product/export/sitemap/max-query |
420 | 420 | * @see controller/jobs/product/export/sitemap/changefreq |
421 | 421 | */ |
422 | - return $config->get( 'controller/jobs/product/export/sitemap/domains', $default ); |
|
422 | + return $config->get('controller/jobs/product/export/sitemap/domains', $default); |
|
423 | 423 | |
424 | 424 | case 'max-items': |
425 | 425 | /** controller/jobs/product/export/sitemap/max-items |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @see controller/jobs/product/export/sitemap/changefreq |
445 | 445 | * @see controller/jobs/product/export/sitemap/domains |
446 | 446 | */ |
447 | - return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); |
|
447 | + return $config->get('controller/jobs/product/export/sitemap/max-items', 50000); |
|
448 | 448 | |
449 | 449 | case 'max-query': |
450 | 450 | /** controller/jobs/product/export/sitemap/max-query |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @see controller/jobs/product/export/sitemap/changefreq |
466 | 466 | * @see controller/jobs/product/export/sitemap/domains |
467 | 467 | */ |
468 | - return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); |
|
468 | + return $config->get('controller/jobs/product/export/sitemap/max-query', 1000); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | return $default; |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | * @param integer $number Current file number |
479 | 479 | * @return string New file name |
480 | 480 | */ |
481 | - protected function getFilename( $number ) |
|
481 | + protected function getFilename($number) |
|
482 | 482 | { |
483 | - return sprintf( 'aimeos-sitemap-%d.xml', $number ); |
|
483 | + return sprintf('aimeos-sitemap-%d.xml', $number); |
|
484 | 484 | } |
485 | 485 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Products bought together' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Products bought together'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Creates bought together product suggestions' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates bought together product suggestions'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @see controller/jobs/product/bought/min-confidence |
73 | 73 | * @see controller/jobs/product/bought/limit-days |
74 | 74 | */ |
75 | - $maxItems = $config->get( 'controller/jobs/product/bought/max-items', 5 ); |
|
75 | + $maxItems = $config->get('controller/jobs/product/bought/max-items', 5); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/product/bought/min-support |
78 | 78 | * Minimum support value to sort out all irrelevant combinations |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/product/bought/min-confidence |
102 | 102 | * @see controller/jobs/product/bought/limit-days |
103 | 103 | */ |
104 | - $minSupport = $config->get( 'controller/jobs/product/bought/min-support', 0.02 ); |
|
104 | + $minSupport = $config->get('controller/jobs/product/bought/min-support', 0.02); |
|
105 | 105 | |
106 | 106 | /** controller/jobs/product/bought/min-confidence |
107 | 107 | * Minimum confidence value for high quality suggestions |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @see controller/jobs/product/bought/min-support |
127 | 127 | * @see controller/jobs/product/bought/limit-days |
128 | 128 | */ |
129 | - $minConfidence = $config->get( 'controller/jobs/product/bought/min-confidence', 0.66 ); |
|
129 | + $minConfidence = $config->get('controller/jobs/product/bought/min-confidence', 0.66); |
|
130 | 130 | |
131 | 131 | /** controller/jobs/product/bought/limit-days |
132 | 132 | * Only use orders placed in the past within the configured number of days for calculating bought together products |
@@ -150,43 +150,43 @@ discard block |
||
150 | 150 | * @see controller/jobs/product/bought/min-support |
151 | 151 | * @see controller/jobs/product/bought/min-confidence |
152 | 152 | */ |
153 | - $days = $config->get( 'controller/jobs/product/bought/limit-days', 180 ); |
|
154 | - $date = date( 'Y-m-d H:i:s', time() - $days * 86400 ); |
|
153 | + $days = $config->get('controller/jobs/product/bought/limit-days', 180); |
|
154 | + $date = date('Y-m-d H:i:s', time() - $days * 86400); |
|
155 | 155 | |
156 | 156 | |
157 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
157 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
158 | 158 | $search = $baseManager->createSearch(); |
159 | - $search->setConditions( $search->compare( '>', 'order.base.ctime', $date ) ); |
|
160 | - $search->setSlice( 0, 0 ); |
|
159 | + $search->setConditions($search->compare('>', 'order.base.ctime', $date)); |
|
160 | + $search->setSlice(0, 0); |
|
161 | 161 | $totalOrders = 0; |
162 | - $baseManager->searchItems( $search, [], $totalOrders ); |
|
162 | + $baseManager->searchItems($search, [], $totalOrders); |
|
163 | 163 | |
164 | - $baseProductManager = \Aimeos\MShop::create( $context, 'order/base/product' ); |
|
164 | + $baseProductManager = \Aimeos\MShop::create($context, 'order/base/product'); |
|
165 | 165 | $search = $baseProductManager->createSearch(); |
166 | - $search->setConditions( $search->compare( '>', 'order.base.product.ctime', $date ) ); |
|
166 | + $search->setConditions($search->compare('>', 'order.base.product.ctime', $date)); |
|
167 | 167 | $start = 0; |
168 | 168 | |
169 | 169 | do |
170 | 170 | { |
171 | - $totalCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); |
|
172 | - $prodIds = array_keys( $totalCounts ); |
|
171 | + $totalCounts = $baseProductManager->aggregate($search, 'order.base.product.productid'); |
|
172 | + $prodIds = array_keys($totalCounts); |
|
173 | 173 | |
174 | - foreach( $totalCounts as $id => $count ) |
|
174 | + foreach ($totalCounts as $id => $count) |
|
175 | 175 | { |
176 | - $this->removeListItems( $id ); |
|
176 | + $this->removeListItems($id); |
|
177 | 177 | |
178 | - if( $count / $totalOrders > $minSupport ) |
|
178 | + if ($count / $totalOrders > $minSupport) |
|
179 | 179 | { |
180 | - $productIds = $this->getSuggestions( $id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date ); |
|
181 | - $this->addListItems( $id, $productIds ); |
|
180 | + $productIds = $this->getSuggestions($id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date); |
|
181 | + $this->addListItems($id, $productIds); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - $count = count( $totalCounts ); |
|
185 | + $count = count($totalCounts); |
|
186 | 186 | $start += $count; |
187 | - $search->setSlice( $start ); |
|
187 | + $search->setSlice($start); |
|
188 | 188 | } |
189 | - while( $count >= $search->getSliceSize() ); |
|
189 | + while ($count >= $search->getSliceSize()); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -203,59 +203,59 @@ discard block |
||
203 | 203 | * @param string $date Date in YYYY-MM-DD HH:mm:ss format after which orders should be used for calculations |
204 | 204 | * @return array List of suggested product IDs as key and their confidence as value |
205 | 205 | */ |
206 | - protected function getSuggestions( $id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date ) |
|
206 | + protected function getSuggestions($id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date) |
|
207 | 207 | { |
208 | 208 | $refIds = []; |
209 | 209 | $context = $this->getContext(); |
210 | 210 | |
211 | - $catalogListManager = \Aimeos\MShop::create( $context, 'catalog/lists' ); |
|
212 | - $baseProductManager = \Aimeos\MShop::create( $context, 'order/base/product' ); |
|
211 | + $catalogListManager = \Aimeos\MShop::create($context, 'catalog/lists'); |
|
212 | + $baseProductManager = \Aimeos\MShop::create($context, 'order/base/product'); |
|
213 | 213 | |
214 | 214 | |
215 | 215 | $search = $baseProductManager->createSearch(); |
216 | - $func = $search->createFunction( 'order.base.product.count', array( (string) $id ) ); |
|
216 | + $func = $search->createFunction('order.base.product.count', array((string) $id)); |
|
217 | 217 | $expr = array( |
218 | - $search->compare( '==', 'order.base.product.productid', $prodIds ), |
|
219 | - $search->compare( '>', 'order.base.product.ctime', $date ), |
|
220 | - $search->compare( '==', $func, 1 ), |
|
218 | + $search->compare('==', 'order.base.product.productid', $prodIds), |
|
219 | + $search->compare('>', 'order.base.product.ctime', $date), |
|
220 | + $search->compare('==', $func, 1), |
|
221 | 221 | ); |
222 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
222 | + $search->setConditions($search->combine('&&', $expr)); |
|
223 | 223 | |
224 | - $relativeCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); |
|
224 | + $relativeCounts = $baseProductManager->aggregate($search, 'order.base.product.productid'); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | $search = $catalogListManager->createSearch(); |
228 | 228 | $expr = array( |
229 | - $search->compare( '==', 'catalog.lists.refid', array_keys( $relativeCounts ) ), |
|
230 | - $search->compare( '==', 'catalog.lists.domain', 'product' ), |
|
229 | + $search->compare('==', 'catalog.lists.refid', array_keys($relativeCounts)), |
|
230 | + $search->compare('==', 'catalog.lists.domain', 'product'), |
|
231 | 231 | ); |
232 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
232 | + $search->setConditions($search->combine('&&', $expr)); |
|
233 | 233 | |
234 | - foreach( $catalogListManager->searchItems( $search ) as $listItem ) { |
|
234 | + foreach ($catalogListManager->searchItems($search) as $listItem) { |
|
235 | 235 | $refIds[$listItem->getRefId()] = true; |
236 | 236 | } |
237 | 237 | |
238 | 238 | |
239 | - unset( $relativeCounts[$id] ); |
|
239 | + unset($relativeCounts[$id]); |
|
240 | 240 | $supportA = $count / $total; |
241 | 241 | $products = []; |
242 | 242 | |
243 | - foreach( $relativeCounts as $prodId => $relCnt ) |
|
243 | + foreach ($relativeCounts as $prodId => $relCnt) |
|
244 | 244 | { |
245 | - if( !isset( $refIds[$prodId] ) ) { |
|
245 | + if (!isset($refIds[$prodId])) { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | |
249 | 249 | $supportAB = $relCnt / $total; |
250 | 250 | |
251 | - if( $supportAB > $minSupport && ( $conf = ( $supportAB / $supportA ) ) > $minConfidence ) { |
|
251 | + if ($supportAB > $minSupport && ($conf = ($supportAB / $supportA)) > $minConfidence) { |
|
252 | 252 | $products[$prodId] = $conf; |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - arsort( $products ); |
|
256 | + arsort($products); |
|
257 | 257 | |
258 | - return array_keys( array_slice( $products, 0, $maxItems, true ) ); |
|
258 | + return array_keys(array_slice($products, 0, $maxItems, true)); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -265,26 +265,26 @@ discard block |
||
265 | 265 | * @param string $productId Unique ID of the product the given products should be referenced to |
266 | 266 | * @param array $productIds List of position as key and product ID as value |
267 | 267 | */ |
268 | - protected function addListItems( $productId, array $productIds ) |
|
268 | + protected function addListItems($productId, array $productIds) |
|
269 | 269 | { |
270 | - if( empty( $productIds ) ) { |
|
270 | + if (empty($productIds)) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
274 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
275 | 275 | $item = $manager->createItem(); |
276 | 276 | |
277 | - foreach( $productIds as $pos => $refid ) |
|
277 | + foreach ($productIds as $pos => $refid) |
|
278 | 278 | { |
279 | - $item->setId( null ); |
|
280 | - $item->setParentId( $productId ); |
|
281 | - $item->setDomain( 'product' ); |
|
282 | - $item->setType( 'bought-together' ); |
|
283 | - $item->setPosition( $pos ); |
|
284 | - $item->setRefId( $refid ); |
|
285 | - $item->setStatus( 1 ); |
|
286 | - |
|
287 | - $manager->saveItem( $item, false ); |
|
279 | + $item->setId(null); |
|
280 | + $item->setParentId($productId); |
|
281 | + $item->setDomain('product'); |
|
282 | + $item->setType('bought-together'); |
|
283 | + $item->setPosition($pos); |
|
284 | + $item->setRefId($refid); |
|
285 | + $item->setStatus(1); |
|
286 | + |
|
287 | + $manager->saveItem($item, false); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param string $productId Unique ID of the product the references should be removed from |
296 | 296 | */ |
297 | - protected function removeListItems( $productId ) |
|
297 | + protected function removeListItems($productId) |
|
298 | 298 | { |
299 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
299 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
300 | 300 | |
301 | 301 | $search = $manager->createSearch(); |
302 | 302 | $expr = array( |
303 | - $search->compare( '==', 'product.lists.parentid', $productId ), |
|
304 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
305 | - $search->compare( '==', 'product.lists.type', 'bought-together' ), |
|
303 | + $search->compare('==', 'product.lists.parentid', $productId), |
|
304 | + $search->compare('==', 'product.lists.domain', 'product'), |
|
305 | + $search->compare('==', 'product.lists.type', 'bought-together'), |
|
306 | 306 | ); |
307 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
307 | + $search->setConditions($search->combine('&&', $expr)); |
|
308 | 308 | |
309 | - $listItems = $manager->searchItems( $search ); |
|
309 | + $listItems = $manager->searchItems($search); |
|
310 | 310 | |
311 | - $manager->deleteItems( array_keys( $listItems ) ); |
|
311 | + $manager->deleteItems(array_keys($listItems)); |
|
312 | 312 | } |
313 | 313 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes unfinished orders' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes unfinished orders'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Deletes unfinished orders an makes their products and coupon codes available again' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Deletes unfinished orders an makes their products and coupon codes available again'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | public function run() |
53 | 53 | { |
54 | 54 | $context = $this->getContext(); |
55 | - $controller = \Aimeos\Controller\Common\Order\Factory::createController( $context ); |
|
56 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
57 | - $manager = \Aimeos\MShop::create( $context, 'order' ); |
|
55 | + $controller = \Aimeos\Controller\Common\Order\Factory::createController($context); |
|
56 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
57 | + $manager = \Aimeos\MShop::create($context, 'order'); |
|
58 | 58 | |
59 | 59 | /** controller/jobs/order/cleanup/unfinished/keep-hours |
60 | 60 | * Release the ordered products after the configured time if no payment was confirmed |
@@ -74,35 +74,35 @@ discard block |
||
74 | 74 | * @since 2014.07 |
75 | 75 | * @category User |
76 | 76 | */ |
77 | - $hours = $context->getConfig()->get( 'controller/jobs/order/cleanup/unfinished/keep-hours', 24 ); |
|
78 | - $limit = date( 'Y-m-d H:i:s', time() - 3600 * $hours ); |
|
77 | + $hours = $context->getConfig()->get('controller/jobs/order/cleanup/unfinished/keep-hours', 24); |
|
78 | + $limit = date('Y-m-d H:i:s', time() - 3600 * $hours); |
|
79 | 79 | |
80 | 80 | $search = $manager->createSearch(); |
81 | 81 | $expr = array( |
82 | - $search->compare( '<', 'order.mtime', $limit ), |
|
83 | - $search->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED ), |
|
82 | + $search->compare('<', 'order.mtime', $limit), |
|
83 | + $search->compare('==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED), |
|
84 | 84 | ); |
85 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
85 | + $search->setConditions($search->combine('&&', $expr)); |
|
86 | 86 | |
87 | 87 | $start = 0; |
88 | 88 | |
89 | 89 | do |
90 | 90 | { |
91 | 91 | $baseIds = []; |
92 | - $items = $manager->searchItems( $search ); |
|
92 | + $items = $manager->searchItems($search); |
|
93 | 93 | |
94 | - foreach( $items as $item ) |
|
94 | + foreach ($items as $item) |
|
95 | 95 | { |
96 | - $controller->unblock( $item ); |
|
96 | + $controller->unblock($item); |
|
97 | 97 | $baseIds[] = $item->getBaseId(); |
98 | 98 | } |
99 | 99 | |
100 | - $baseManager->deleteItems( $baseIds ); |
|
100 | + $baseManager->deleteItems($baseIds); |
|
101 | 101 | |
102 | - $count = count( $items ); |
|
102 | + $count = count($items); |
|
103 | 103 | $start += $count; |
104 | - $search->setSlice( $start ); |
|
104 | + $search->setSlice($start); |
|
105 | 105 | } |
106 | - while( $count >= $search->getSliceSize() ); |
|
106 | + while ($count >= $search->getSliceSize()); |
|
107 | 107 | } |
108 | 108 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes unpaid orders' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes unpaid orders'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Deletes unpaid orders to keep the database clean' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Deletes unpaid orders to keep the database clean'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | public function run() |
53 | 53 | { |
54 | 54 | $context = $this->getContext(); |
55 | - $controller = \Aimeos\Controller\Common\Order\Factory::createController( $context ); |
|
56 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
57 | - $manager = \Aimeos\MShop::create( $context, 'order' ); |
|
55 | + $controller = \Aimeos\Controller\Common\Order\Factory::createController($context); |
|
56 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
57 | + $manager = \Aimeos\MShop::create($context, 'order'); |
|
58 | 58 | |
59 | 59 | /** controller/jobs/order/cleanup/unpaid/keep-days |
60 | 60 | * Removes all orders from the database that are unpaid |
@@ -71,35 +71,35 @@ discard block |
||
71 | 71 | * @since 2014.07 |
72 | 72 | * @category User |
73 | 73 | */ |
74 | - $days = $context->getConfig()->get( 'controller/jobs/order/cleanup/unpaid/keep-days', 3 ); |
|
75 | - $limit = date( 'Y-m-d H:i:s', time() - 86400 * $days ); |
|
74 | + $days = $context->getConfig()->get('controller/jobs/order/cleanup/unpaid/keep-days', 3); |
|
75 | + $limit = date('Y-m-d H:i:s', time() - 86400 * $days); |
|
76 | 76 | |
77 | 77 | $search = $manager->createSearch(); |
78 | 78 | $expr = array( |
79 | - $search->compare( '<', 'order.mtime', $limit ), |
|
80 | - $search->compare( '<', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_REFUND ), |
|
79 | + $search->compare('<', 'order.mtime', $limit), |
|
80 | + $search->compare('<', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_REFUND), |
|
81 | 81 | ); |
82 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
82 | + $search->setConditions($search->combine('&&', $expr)); |
|
83 | 83 | |
84 | 84 | $start = 0; |
85 | 85 | |
86 | 86 | do |
87 | 87 | { |
88 | 88 | $baseIds = []; |
89 | - $items = $manager->searchItems( $search ); |
|
89 | + $items = $manager->searchItems($search); |
|
90 | 90 | |
91 | - foreach( $items as $item ) |
|
91 | + foreach ($items as $item) |
|
92 | 92 | { |
93 | - $controller->unblock( $item ); |
|
93 | + $controller->unblock($item); |
|
94 | 94 | $baseIds[] = $item->getBaseId(); |
95 | 95 | } |
96 | 96 | |
97 | - $baseManager->deleteItems( $baseIds ); |
|
97 | + $baseManager->deleteItems($baseIds); |
|
98 | 98 | |
99 | - $count = count( $items ); |
|
99 | + $count = count($items); |
|
100 | 100 | $start += $count; |
101 | - $search->setSlice( $start ); |
|
101 | + $search->setSlice($start); |
|
102 | 102 | } |
103 | - while( $count >= $search->getSliceSize() ); |
|
103 | + while ($count >= $search->getSliceSize()); |
|
104 | 104 | } |
105 | 105 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Cache cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Cache cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the expired entries from the cache' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the expired entries from the cache'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MAdmin\Cache\Manager\Factory::create( $this->getContext() )->getCache()->cleanup(); |
|
54 | + \Aimeos\MAdmin\Cache\Manager\Factory::create($this->getContext())->getCache()->cleanup(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Log cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Log cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the old log entries from the database and archives them (optional)' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the old log entries from the database and archives them (optional)'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @see controller/jobs/admin/log/standard/container/format |
72 | 72 | * @see controller/jobs/admin/log/standard/container/options |
73 | 73 | */ |
74 | - $limit = $config->get( 'controller/jobs/admin/log/standard/limit-days', 30 ); |
|
75 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
74 | + $limit = $config->get('controller/jobs/admin/log/standard/limit-days', 30); |
|
75 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/admin/log/standard/path |
78 | 78 | * Path to a writable directory where the log archive files should be stored |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/admin/log/standard/container/options |
102 | 102 | * @see controller/jobs/admin/log/standard/limit-days |
103 | 103 | */ |
104 | - if( ( $path = $config->get( 'controller/jobs/admin/log/standard/path', null ) ) !== null ) |
|
104 | + if (($path = $config->get('controller/jobs/admin/log/standard/path', null)) !== null) |
|
105 | 105 | { |
106 | 106 | /** controller/jobs/admin/log/standard/container/type |
107 | 107 | * Container file type storing all coupon code files to import |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * @see controller/jobs/admin/log/standard/limit-days |
176 | 176 | */ |
177 | 177 | |
178 | - $type = $config->get( 'controller/jobs/admin/log/standard/container/type', 'Zip' ); |
|
179 | - $format = $config->get( 'controller/jobs/admin/log/standard/container/format', 'CSV' ); |
|
180 | - $options = $config->get( 'controller/jobs/admin/log/standard/container/options', [] ); |
|
178 | + $type = $config->get('controller/jobs/admin/log/standard/container/type', 'Zip'); |
|
179 | + $format = $config->get('controller/jobs/admin/log/standard/container/format', 'CSV'); |
|
180 | + $options = $config->get('controller/jobs/admin/log/standard/container/options', []); |
|
181 | 181 | |
182 | - $path .= DIRECTORY_SEPARATOR . str_replace( ' ', '_', $limitDate ); |
|
183 | - $container = \Aimeos\MW\Container\Factory::getContainer( $path, $type, $format, $options ); |
|
182 | + $path .= DIRECTORY_SEPARATOR . str_replace(' ', '_', $limitDate); |
|
183 | + $container = \Aimeos\MW\Container\Factory::getContainer($path, $type, $format, $options); |
|
184 | 184 | } |
185 | 185 | |
186 | - $manager = \Aimeos\MAdmin::create( $context, 'log' ); |
|
186 | + $manager = \Aimeos\MAdmin::create($context, 'log'); |
|
187 | 187 | |
188 | 188 | $search = $manager->createSearch(); |
189 | - $search->setConditions( $search->compare( '<=', 'log.timestamp', $limitDate ) ); |
|
190 | - $search->setSortations( array( $search->sort( '+', 'log.timestamp' ) ) ); |
|
189 | + $search->setConditions($search->compare('<=', 'log.timestamp', $limitDate)); |
|
190 | + $search->setSortations(array($search->sort('+', 'log.timestamp'))); |
|
191 | 191 | |
192 | 192 | $start = 0; |
193 | 193 | $contents = []; |
@@ -195,37 +195,37 @@ discard block |
||
195 | 195 | do |
196 | 196 | { |
197 | 197 | $ids = []; |
198 | - $items = $manager->searchItems( $search ); |
|
198 | + $items = $manager->searchItems($search); |
|
199 | 199 | |
200 | - foreach( $items as $id => $item ) |
|
200 | + foreach ($items as $id => $item) |
|
201 | 201 | { |
202 | - if( $container !== null ) |
|
202 | + if ($container !== null) |
|
203 | 203 | { |
204 | 204 | $facility = $item->getFacility(); |
205 | 205 | |
206 | - if( !isset( $contents[$facility] ) ) { |
|
207 | - $contents[$facility] = $container->create( $facility ); |
|
206 | + if (!isset($contents[$facility])) { |
|
207 | + $contents[$facility] = $container->create($facility); |
|
208 | 208 | } |
209 | 209 | |
210 | - $contents[$facility]->add( $item->toArray() ); |
|
210 | + $contents[$facility]->add($item->toArray()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $ids[] = $id; |
214 | 214 | } |
215 | 215 | |
216 | - $manager->deleteItems( $ids ); |
|
216 | + $manager->deleteItems($ids); |
|
217 | 217 | |
218 | - $count = count( $items ); |
|
218 | + $count = count($items); |
|
219 | 219 | $start += $count; |
220 | - $search->setSlice( $start ); |
|
220 | + $search->setSlice($start); |
|
221 | 221 | } |
222 | - while( $count >= $search->getSliceSize() ); |
|
222 | + while ($count >= $search->getSliceSize()); |
|
223 | 223 | |
224 | 224 | |
225 | - if( $container !== null && !empty( $contents ) ) |
|
225 | + if ($container !== null && !empty($contents)) |
|
226 | 226 | { |
227 | - foreach( $contents as $content ) { |
|
228 | - $container->add( $content ); |
|
227 | + foreach ($contents as $content) { |
|
228 | + $container->add($content); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $container->close(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index optimization' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index optimization'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Optimizes the index for searching products faster' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Optimizes the index for searching products faster'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MShop\Index\Manager\Factory::create( $this->getContext() )->optimize(); |
|
54 | + \Aimeos\MShop\Index\Manager\Factory::create($this->getContext())->optimize(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index rebuild' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index rebuild'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rebuilds the index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rebuilds the index for searching products'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - $timestamp = date( 'Y-m-d H:i:s' ); |
|
54 | + $timestamp = date('Y-m-d H:i:s'); |
|
55 | 55 | $context = clone $this->getContext(); |
56 | 56 | |
57 | - $context->getLocale()->setLanguageId( null ); |
|
58 | - $context->getLocale()->setCurrencyId( null ); |
|
57 | + $context->getLocale()->setLanguageId(null); |
|
58 | + $context->getLocale()->setCurrencyId(null); |
|
59 | 59 | |
60 | - $manager = \Aimeos\MShop\Index\Manager\Factory::create( $context ); |
|
60 | + $manager = \Aimeos\MShop\Index\Manager\Factory::create($context); |
|
61 | 61 | |
62 | 62 | $manager->rebuildIndex(); |
63 | - $manager->cleanupIndex( $timestamp ); |
|
63 | + $manager->cleanupIndex($timestamp); |
|
64 | 64 | } |
65 | 65 | } |