@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Catalog index optimization' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog 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 catalog index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Optimizes the catalog index for searching products'); |
|
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::createManager( $this->getContext() )->optimize(); |
|
54 | + \Aimeos\MShop\Index\Manager\Factory::createManager($this->getContext())->optimize(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -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/index/rebuild/name |
36 | 36 | * Class name of the used catalog index rebuild 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/index/rebuild/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/index/rebuild/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\\Index\\Rebuild\\' . $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\\Index\\Rebuild\\' . $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\\Index\\Rebuild\\' . $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/index/rebuild/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the catalog index rebuild controllers |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/index/rebuild/decorators/excludes |
155 | 155 | * @see controller/jobs/index/rebuild/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'index/rebuild' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'index/rebuild'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Catalog index rebuild' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog 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 catalog index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rebuilds the catalog 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::createManager( $context ); |
|
60 | + $manager = \Aimeos\MShop\Index\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | 62 | $manager->rebuildIndex(); |
63 | - $manager->cleanupIndex( $timestamp ); |
|
63 | + $manager->cleanupIndex($timestamp); |
|
64 | 64 | } |
65 | 65 | } |
@@ -37,35 +37,35 @@ discard block |
||
37 | 37 | * @param string $path Name of the domain |
38 | 38 | * @throws \Aimeos\Controller\Jobs\Exception If the given path is invalid or the controllers wasn't found |
39 | 39 | */ |
40 | - static public function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path ) |
|
40 | + static public function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path) |
|
41 | 41 | { |
42 | - $path = strtolower( trim( $path, "/ \n\t\r\0\x0B" ) ); |
|
42 | + $path = strtolower(trim($path, "/ \n\t\r\0\x0B")); |
|
43 | 43 | |
44 | - if( empty( $path ) ) { |
|
45 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Controller path is empty' ) ); |
|
44 | + if (empty($path)) { |
|
45 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Controller path is empty')); |
|
46 | 46 | } |
47 | 47 | |
48 | - $parts = explode( '/', $path ); |
|
48 | + $parts = explode('/', $path); |
|
49 | 49 | |
50 | - foreach( $parts as $key => $part ) |
|
50 | + foreach ($parts as $key => $part) |
|
51 | 51 | { |
52 | - if( ctype_alnum( $part ) === false ) { |
|
53 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid controller "%1$s" in "%2$s"', $part, $path ) ); |
|
52 | + if (ctype_alnum($part) === false) { |
|
53 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid controller "%1$s" in "%2$s"', $part, $path)); |
|
54 | 54 | } |
55 | 55 | |
56 | - $parts[$key] = ucwords( $part ); |
|
56 | + $parts[$key] = ucwords($part); |
|
57 | 57 | } |
58 | 58 | |
59 | - $factory = '\\Aimeos\\Controller\\Jobs\\' . join( '\\', $parts ) . '\\Factory'; |
|
59 | + $factory = '\\Aimeos\\Controller\\Jobs\\' . join('\\', $parts) . '\\Factory'; |
|
60 | 60 | |
61 | - if( class_exists( $factory ) === false ) { |
|
62 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $factory ) ); |
|
61 | + if (class_exists($factory) === false) { |
|
62 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $factory)); |
|
63 | 63 | } |
64 | 64 | |
65 | - $controller = call_user_func_array( array( $factory, 'createController' ), array( $context, $aimeos ) ); |
|
65 | + $controller = call_user_func_array(array($factory, 'createController'), array($context, $aimeos)); |
|
66 | 66 | |
67 | - if( $controller === false ) { |
|
68 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
67 | + if ($controller === false) { |
|
68 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid factory "%1$s"', $factory)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $controller; |
@@ -81,32 +81,32 @@ discard block |
||
81 | 81 | * relative job controller paths (core and extensions) |
82 | 82 | * @return array Associative list of controller names as key and the class instance as value |
83 | 83 | */ |
84 | - static public function getControllers( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, array $cntlPaths ) |
|
84 | + static public function getControllers(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, array $cntlPaths) |
|
85 | 85 | { |
86 | 86 | $cntlList = array(); |
87 | - $subFolder = trim( str_replace( '\\', DIRECTORY_SEPARATOR, self::$prefix ), '/' ); |
|
87 | + $subFolder = trim(str_replace('\\', DIRECTORY_SEPARATOR, self::$prefix), '/'); |
|
88 | 88 | |
89 | - if( strncmp( $subFolder, 'Aimeos' . DIRECTORY_SEPARATOR, 7 ) === 0 ) { |
|
90 | - $subFolder = substr( $subFolder, 7 ); |
|
89 | + if (strncmp($subFolder, 'Aimeos' . DIRECTORY_SEPARATOR, 7) === 0) { |
|
90 | + $subFolder = substr($subFolder, 7); |
|
91 | 91 | } |
92 | 92 | |
93 | - foreach( $cntlPaths as $path => $list ) |
|
93 | + foreach ($cntlPaths as $path => $list) |
|
94 | 94 | { |
95 | - foreach( $list as $relpath ) |
|
95 | + foreach ($list as $relpath) |
|
96 | 96 | { |
97 | 97 | $path .= DIRECTORY_SEPARATOR . $relpath . DIRECTORY_SEPARATOR . $subFolder; |
98 | 98 | |
99 | - if( is_dir( $path ) ) |
|
99 | + if (is_dir($path)) |
|
100 | 100 | { |
101 | - $it = new \DirectoryIterator( $path ); |
|
102 | - $list = self::createControllers( $it, $context, $aimeos ); |
|
101 | + $it = new \DirectoryIterator($path); |
|
102 | + $list = self::createControllers($it, $context, $aimeos); |
|
103 | 103 | |
104 | - $cntlList = array_merge( $cntlList, $list ); |
|
104 | + $cntlList = array_merge($cntlList, $list); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - ksort( $cntlList ); |
|
109 | + ksort($cntlList); |
|
110 | 110 | |
111 | 111 | return $cntlList; |
112 | 112 | } |
@@ -121,26 +121,26 @@ discard block |
||
121 | 121 | * @param string $prefix Part of the class name between "\Aimeos\Controller\Jobs" and "Factory" |
122 | 122 | * @throws \Aimeos\Controller\Jobs\Exception If factory name is invalid or if the controller couldn't be instantiated |
123 | 123 | */ |
124 | - static protected function createControllers( \DirectoryIterator $dir, \Aimeos\MShop\Context\Item\Iface $context, |
|
125 | - \Aimeos\Bootstrap $aimeos, $prefix = '' ) |
|
124 | + static protected function createControllers(\DirectoryIterator $dir, \Aimeos\MShop\Context\Item\Iface $context, |
|
125 | + \Aimeos\Bootstrap $aimeos, $prefix = '') |
|
126 | 126 | { |
127 | 127 | $list = array(); |
128 | 128 | |
129 | - foreach( $dir as $entry ) |
|
129 | + foreach ($dir as $entry) |
|
130 | 130 | { |
131 | - if( $entry->getType() === 'dir' && $entry->isDot() === false ) |
|
131 | + if ($entry->getType() === 'dir' && $entry->isDot() === false) |
|
132 | 132 | { |
133 | - $name = strtolower( $entry->getBaseName() ); |
|
134 | - $it = new \DirectoryIterator( $entry->getPathName() ); |
|
135 | - $pref = ( $prefix !== '' ? $prefix . '/' : '' ) . $name; |
|
136 | - $subList = self::createControllers( $it, $context, $aimeos, $pref ); |
|
133 | + $name = strtolower($entry->getBaseName()); |
|
134 | + $it = new \DirectoryIterator($entry->getPathName()); |
|
135 | + $pref = ($prefix !== '' ? $prefix . '/' : '') . $name; |
|
136 | + $subList = self::createControllers($it, $context, $aimeos, $pref); |
|
137 | 137 | |
138 | - $list = array_merge( $list, $subList ); |
|
138 | + $list = array_merge($list, $subList); |
|
139 | 139 | } |
140 | - else if( $prefix !== '' && $entry->getType() === 'file' |
|
141 | - && ( $name = $entry->getBaseName( '.php' ) ) === 'Factory' ) |
|
140 | + else if ($prefix !== '' && $entry->getType() === 'file' |
|
141 | + && ($name = $entry->getBaseName('.php')) === 'Factory') |
|
142 | 142 | { |
143 | - $list[$prefix] = self::createController( $context, $aimeos, $prefix ); |
|
143 | + $list[$prefix] = self::createController($context, $aimeos, $prefix); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 |
@@ -136,8 +136,7 @@ |
||
136 | 136 | $subList = self::createControllers( $it, $context, $aimeos, $pref ); |
137 | 137 | |
138 | 138 | $list = array_merge( $list, $subList ); |
139 | - } |
|
140 | - else if( $prefix !== '' && $entry->getType() === 'file' |
|
139 | + } else if( $prefix !== '' && $entry->getType() === 'file' |
|
141 | 140 | && ( $name = $entry->getBaseName( '.php' ) ) === 'Factory' ) |
142 | 141 | { |
143 | 142 | $list[$prefix] = self::createController( $context, $aimeos, $prefix ); |
@@ -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/export/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/export/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\\Export\\' . $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\\Export\\' . $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/export/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the product export job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/product/export/decorators/excludes |
155 | 155 | * @see controller/jobs/product/export/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/export' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/export'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -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/export/sitemap/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/export/sitemap/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\\Export\\Sitemap\\' . $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\\Export\\Sitemap\\' . $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/export/sitemap/decorators/excludes |
83 | 83 | * Excludes decorators added by the "common" option from the product export sitemap job controller |
@@ -154,6 +154,6 @@ discard block |
||
154 | 154 | * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/excludes |
155 | 155 | * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/global |
156 | 156 | */ |
157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/export/sitemap' ); |
|
157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/export/sitemap'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', '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. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $view->siteItems = $items; |
129 | 129 | $view->siteFreq = $changefreq; |
130 | 130 | |
131 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
131 | + $content->add($view->render($view->config($tplconf, $default))); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @see controller/jobs/product/export/sitemap/max-query |
175 | 175 | * @see controller/jobs/product/export/sitemap/changefreq |
176 | 176 | */ |
177 | - $location = $config->get( 'controller/jobs/product/export/sitemap/location', sys_get_temp_dir() ); |
|
177 | + $location = $config->get('controller/jobs/product/export/sitemap/location', sys_get_temp_dir()); |
|
178 | 178 | |
179 | 179 | /** controller/jobs/product/export/sitemap/container/options |
180 | 180 | * List of file container options for the site map files |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * @see controller/jobs/product/export/sitemap/max-query |
195 | 195 | * @see controller/jobs/product/export/sitemap/changefreq |
196 | 196 | */ |
197 | - $options = $config->get( 'controller/jobs/product/export/sitemap/container/options', array() ); |
|
197 | + $options = $config->get('controller/jobs/product/export/sitemap/container/options', array()); |
|
198 | 198 | |
199 | - return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options ); |
|
199 | + return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param integer $filenum New file number |
208 | 208 | * @return \Aimeos\MW\Container\Content\Iface New content object |
209 | 209 | */ |
210 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
210 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
211 | 211 | { |
212 | 212 | $config = $this->getContext()->getConfig(); |
213 | 213 | |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | |
239 | 239 | $view = $this->getContext()->getView(); |
240 | 240 | |
241 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
242 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
243 | - $container->add( $content ); |
|
241 | + $content = $container->create($this->getFilename($filenum)); |
|
242 | + $content->add($view->render($view->config($tplconf, $default))); |
|
243 | + $container->add($content); |
|
244 | 244 | |
245 | 245 | return $content; |
246 | 246 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @param \Aimeos\MW\Container\Content\Iface $content |
253 | 253 | */ |
254 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
254 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
255 | 255 | { |
256 | 256 | $config = $this->getContext()->getConfig(); |
257 | 257 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | $view = $this->getContext()->getView(); |
284 | 284 | |
285 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
285 | + $content->add($view->render($view->config($tplconf, $default))); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param \Aimeos\MW\Container\Iface $container File container object |
293 | 293 | * @param array $files List of generated site map file names |
294 | 294 | */ |
295 | - protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) |
|
295 | + protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files) |
|
296 | 296 | { |
297 | 297 | $config = $this->getContext()->getConfig(); |
298 | 298 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | $view = $this->getContext()->getView(); |
325 | 325 | $view->siteFiles = $files; |
326 | 326 | |
327 | - $content = $container->create( 'aimeos-sitemap-index.xml' ); |
|
328 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
329 | - $container->add( $content ); |
|
327 | + $content = $container->create('aimeos-sitemap-index.xml'); |
|
328 | + $content->add($view->render($view->config($tplconf, $default))); |
|
329 | + $container->add($content); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param mixed $default Default value if name is unknown |
338 | 338 | * @return mixed Configuration value |
339 | 339 | */ |
340 | - protected function getConfig( $name, $default = null ) |
|
340 | + protected function getConfig($name, $default = null) |
|
341 | 341 | { |
342 | 342 | $config = $this->getContext()->getConfig(); |
343 | 343 | |
344 | - switch( $name ) |
|
344 | + switch ($name) |
|
345 | 345 | { |
346 | 346 | case 'domain': |
347 | 347 | return array(); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @see controller/jobs/product/export/sitemap/max-query |
369 | 369 | * @see controller/jobs/product/export/sitemap/changefreq |
370 | 370 | */ |
371 | - return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); |
|
371 | + return $config->get('controller/jobs/product/export/sitemap/max-items', 50000); |
|
372 | 372 | |
373 | 373 | case 'max-query': |
374 | 374 | /** controller/jobs/product/export/sitemap/max-query |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * @see controller/jobs/product/export/sitemap/max-items |
389 | 389 | * @see controller/jobs/product/export/sitemap/changefreq |
390 | 390 | */ |
391 | - return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); |
|
391 | + return $config->get('controller/jobs/product/export/sitemap/max-query', 1000); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | return $default; |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @param integer $number Current file number |
402 | 402 | * @return string New file name |
403 | 403 | */ |
404 | - protected function getFilename( $number ) |
|
404 | + protected function getFilename($number) |
|
405 | 405 | { |
406 | - return sprintf( 'aimeos-sitemap-%d.xml', $number ); |
|
406 | + return sprintf('aimeos-sitemap-%d.xml', $number); |
|
407 | 407 | } |
408 | 408 | } |
@@ -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 ); |
|
54 | + $this->export($container); |
|
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 | $config = $this->getContext()->getConfig(); |
68 | 68 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $view->exportItems = $items; |
97 | 97 | |
98 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
98 | + $content->add($view->render($view->config($tplconf, $default))); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @see controller/jobs/product/export/max-items |
125 | 125 | * @see controller/jobs/product/export/max-query |
126 | 126 | */ |
127 | - $location = $config->get( 'controller/jobs/product/export/location', sys_get_temp_dir() ); |
|
127 | + $location = $config->get('controller/jobs/product/export/location', sys_get_temp_dir()); |
|
128 | 128 | |
129 | 129 | /** controller/jobs/product/export/standard/container/type |
130 | 130 | * List of file container options for the export files |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @see controller/jobs/product/export/max-items |
142 | 142 | * @see controller/jobs/product/export/max-query |
143 | 143 | */ |
144 | - $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); |
|
144 | + $container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory'); |
|
145 | 145 | |
146 | 146 | /** controller/jobs/product/export/standard/container/content |
147 | 147 | * List of file container options for the export files |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see controller/jobs/product/export/max-items |
159 | 159 | * @see controller/jobs/product/export/max-query |
160 | 160 | */ |
161 | - $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); |
|
161 | + $content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary'); |
|
162 | 162 | |
163 | 163 | /** controller/jobs/product/export/standard/container/options |
164 | 164 | * List of file container options for the export files |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | * @see controller/jobs/product/export/max-items |
176 | 176 | * @see controller/jobs/product/export/max-query |
177 | 177 | */ |
178 | - $options = $config->get( 'controller/jobs/product/export/standard/container/options', array() ); |
|
178 | + $options = $config->get('controller/jobs/product/export/standard/container/options', array()); |
|
179 | 179 | |
180 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
180 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param integer $filenum New file number |
189 | 189 | * @return \Aimeos\MW\Container\Content\Iface New content object |
190 | 190 | */ |
191 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
191 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
192 | 192 | { |
193 | 193 | $config = $this->getContext()->getConfig(); |
194 | 194 | |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | |
220 | 220 | $view = $this->getContext()->getView(); |
221 | 221 | |
222 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
223 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
224 | - $container->add( $content ); |
|
222 | + $content = $container->create($this->getFilename($filenum)); |
|
223 | + $content->add($view->render($view->config($tplconf, $default))); |
|
224 | + $container->add($content); |
|
225 | 225 | |
226 | 226 | return $content; |
227 | 227 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @param \Aimeos\MW\Container\Content\Iface $content |
234 | 234 | */ |
235 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
235 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
236 | 236 | { |
237 | 237 | $config = $this->getContext()->getConfig(); |
238 | 238 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | $view = $this->getContext()->getView(); |
265 | 265 | |
266 | - $content->add( $view->render( $view->config( $tplconf, $default ) ) ); |
|
266 | + $content->add($view->render($view->config($tplconf, $default))); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -273,45 +273,45 @@ discard block |
||
273 | 273 | * @param \Aimeos\MW\Container\Iface $container Container object |
274 | 274 | * @return array List of content (file) names |
275 | 275 | */ |
276 | - protected function export( \Aimeos\MW\Container\Iface $container ) |
|
276 | + protected function export(\Aimeos\MW\Container\Iface $container) |
|
277 | 277 | { |
278 | - $default = array( 'attribute', 'media', 'price', 'product', 'text' ); |
|
278 | + $default = array('attribute', 'media', 'price', 'product', 'text'); |
|
279 | 279 | |
280 | - $domains = $this->getConfig( 'domains', $default ); |
|
281 | - $maxItems = $this->getConfig( 'max-items', 10000 ); |
|
282 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); |
|
280 | + $domains = $this->getConfig('domains', $default); |
|
281 | + $maxItems = $this->getConfig('max-items', 10000); |
|
282 | + $maxQuery = $this->getConfig('max-query', 1000); |
|
283 | 283 | |
284 | 284 | $start = 0; $filenum = 1; |
285 | 285 | $names = array(); |
286 | 286 | |
287 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
287 | + $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
288 | 288 | |
289 | - $search = $productManager->createSearch( true ); |
|
290 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
291 | - $search->setSlice( 0, $maxQuery ); |
|
289 | + $search = $productManager->createSearch(true); |
|
290 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
291 | + $search->setSlice(0, $maxQuery); |
|
292 | 292 | |
293 | - $content = $this->createContent( $container, $filenum ); |
|
293 | + $content = $this->createContent($container, $filenum); |
|
294 | 294 | $names[] = $content->getResource(); |
295 | 295 | |
296 | 296 | do |
297 | 297 | { |
298 | - $items = $productManager->searchItems( $search, $domains ); |
|
299 | - $this->addItems( $content, $items ); |
|
298 | + $items = $productManager->searchItems($search, $domains); |
|
299 | + $this->addItems($content, $items); |
|
300 | 300 | |
301 | - $count = count( $items ); |
|
301 | + $count = count($items); |
|
302 | 302 | $start += $count; |
303 | - $search->setSlice( $start, $maxQuery ); |
|
303 | + $search->setSlice($start, $maxQuery); |
|
304 | 304 | |
305 | - if( $start + $maxQuery > $maxItems * $filenum ) |
|
305 | + if ($start + $maxQuery > $maxItems * $filenum) |
|
306 | 306 | { |
307 | - $this->closeContent( $content ); |
|
308 | - $content = $this->createContent( $container, ++$filenum ); |
|
307 | + $this->closeContent($content); |
|
308 | + $content = $this->createContent($container, ++$filenum); |
|
309 | 309 | $names[] = $content->getResource(); |
310 | 310 | } |
311 | 311 | } |
312 | - while( $count >= $search->getSliceSize() ); |
|
312 | + while ($count >= $search->getSliceSize()); |
|
313 | 313 | |
314 | - $this->closeContent( $content ); |
|
314 | + $this->closeContent($content); |
|
315 | 315 | |
316 | 316 | return $names; |
317 | 317 | } |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * @param mixed $default Default value if name is unknown |
325 | 325 | * @return mixed Configuration value |
326 | 326 | */ |
327 | - protected function getConfig( $name, $default = null ) |
|
327 | + protected function getConfig($name, $default = null) |
|
328 | 328 | { |
329 | 329 | $config = $this->getContext()->getConfig(); |
330 | 330 | |
331 | - switch( $name ) |
|
331 | + switch ($name) |
|
332 | 332 | { |
333 | 333 | case 'domain': |
334 | 334 | /** controller/jobs/product/export/domains |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @see controller/jobs/product/export/max-items |
351 | 351 | * @see controller/jobs/product/export/max-query |
352 | 352 | */ |
353 | - return $config->get( 'controller/jobs/product/export/domains', $default ); |
|
353 | + return $config->get('controller/jobs/product/export/domains', $default); |
|
354 | 354 | |
355 | 355 | case 'max-items': |
356 | 356 | /** controller/jobs/product/export/max-items |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @see controller/jobs/product/export/max-query |
373 | 373 | * @see controller/jobs/product/export/domains |
374 | 374 | */ |
375 | - return $config->get( 'controller/jobs/product/export/max-items', $default ); |
|
375 | + return $config->get('controller/jobs/product/export/max-items', $default); |
|
376 | 376 | |
377 | 377 | case 'max-query': |
378 | 378 | /** controller/jobs/product/export/max-query |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @see controller/jobs/product/export/max-items |
395 | 395 | * @see controller/jobs/product/export/domains |
396 | 396 | */ |
397 | - return $config->get( 'controller/jobs/product/export/max-query', $default ); |
|
397 | + return $config->get('controller/jobs/product/export/max-query', $default); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | return $default; |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * @param integer $number Current file number |
408 | 408 | * @return string New file name |
409 | 409 | */ |
410 | - protected function getFilename( $number ) |
|
410 | + protected function getFilename($number) |
|
411 | 411 | { |
412 | - return sprintf( 'aimeos-products-%d.xml', $number ); |
|
412 | + return sprintf('aimeos-products-%d.xml', $number); |
|
413 | 413 | } |
414 | 414 | } |
@@ -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/product/bought/name |
36 | 36 | * Class name of the used product suggestions 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/product/bought/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('controller/jobs/product/bought/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\\Product\\Bought\\' . $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\\Product\\Bought\\' . $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\\Product\\Bought\\' . $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/product/bought/decorators/excludes |
84 | 84 | * Excludes decorators added by the "common" option from the product bought job controller |
@@ -155,6 +155,6 @@ discard block |
||
155 | 155 | * @see controller/jobs/product/bought/decorators/excludes |
156 | 156 | * @see controller/jobs/product/bought/decorators/global |
157 | 157 | */ |
158 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'product/bought' ); |
|
158 | + return self::addControllerDecorators($context, $aimeos, $controller, 'product/bought'); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |