| @@ -115,6 +115,10 @@ discard block | ||
| 115 | 115 | return \TestHelperCntl::getContext(); | 
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | + /** | |
| 119 | + * @param string $type | |
| 120 | + * @param string $name | |
| 121 | + */ | |
| 118 | 122 | public function getCachePublic( $type, $name = null ) | 
| 119 | 123 |  	{ | 
| 120 | 124 | return $this->getCache( $type, $name ); | 
| @@ -127,6 +131,11 @@ discard block | ||
| 127 | 131 | } | 
| 128 | 132 | |
| 129 | 133 | |
| 134 | + /** | |
| 135 | + * @param string $path | |
| 136 | + * @param string $domain | |
| 137 | + * @param string $code | |
| 138 | + */ | |
| 130 | 139 | public function getTypeIdPublic( $path, $domain, $code ) | 
| 131 | 140 |  	{ | 
| 132 | 141 | return $this->getTypeId( $path, $domain, $code ); | 
| @@ -16,92 +16,92 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | protected function setUp() | 
| 18 | 18 |  	{ | 
| 19 | - \Aimeos\MShop\Factory::setCache( true ); | |
| 19 | + \Aimeos\MShop\Factory::setCache(true); | |
| 20 | 20 | |
| 21 | 21 | $context = \TestHelperCntl::getContext(); | 
| 22 | 22 | $aimeos = \TestHelperCntl::getAimeos(); | 
| 23 | 23 | |
| 24 | - $this->object = new TestAbstract( $context, $aimeos ); | |
| 24 | + $this->object = new TestAbstract($context, $aimeos); | |
| 25 | 25 | } | 
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() | 
| 29 | 29 |  	{ | 
| 30 | - \Aimeos\MShop\Factory::setCache( false ); | |
| 30 | + \Aimeos\MShop\Factory::setCache(false); | |
| 31 | 31 | \Aimeos\MShop\Factory::clear(); | 
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | public function testGetCache() | 
| 36 | 36 |  	{ | 
| 37 | - $cache = $this->object->getCachePublic( 'attribute' ); | |
| 37 | +		$cache = $this->object->getCachePublic('attribute'); | |
| 38 | 38 | |
| 39 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache ); | |
| 39 | +		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache); | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testGetCacheInvalidType() | 
| 44 | 44 |  	{ | 
| 45 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 46 | - $this->object->getCachePublic( '$' ); | |
| 45 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 46 | +		$this->object->getCachePublic('$'); | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetCacheInvalidClass() | 
| 51 | 51 |  	{ | 
| 52 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 53 | - $this->object->getCachePublic( 'unknown' ); | |
| 52 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 53 | +		$this->object->getCachePublic('unknown'); | |
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testGetCacheInvalidInterface() | 
| 58 | 58 |  	{ | 
| 59 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 60 | - $this->object->getCachePublic( 'attribute', 'unknown' ); | |
| 59 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 60 | +		$this->object->getCachePublic('attribute', 'unknown'); | |
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function testGetProcessors() | 
| 65 | 65 |  	{ | 
| 66 | - $processor = $this->object->getProcessorsPublic( array( 'attribute' => [] ) ); | |
| 66 | +		$processor = $this->object->getProcessorsPublic(array('attribute' => [])); | |
| 67 | 67 | |
| 68 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor ); | |
| 68 | +		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor); | |
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | public function testGetProcessorsInvalidType() | 
| 73 | 73 |  	{ | 
| 74 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 75 | - $this->object->getProcessorsPublic( array( '$' => [] ) ); | |
| 74 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 75 | +		$this->object->getProcessorsPublic(array('$' => [])); | |
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | public function testGetProcessorsInvalidClass() | 
| 80 | 80 |  	{ | 
| 81 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 82 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); | |
| 81 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 82 | +		$this->object->getProcessorsPublic(array('unknown' => [])); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | public function testGetProcessorsInvalidInterface() | 
| 87 | 87 |  	{ | 
| 88 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 89 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); | |
| 88 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 89 | +		$this->object->getProcessorsPublic(array('unknown' => [])); | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testGetTypeId() | 
| 94 | 94 |  	{ | 
| 95 | - $typeid = $this->object->getTypeIdPublic( 'attribute/type', 'product', 'color' ); | |
| 95 | +		$typeid = $this->object->getTypeIdPublic('attribute/type', 'product', 'color'); | |
| 96 | 96 | |
| 97 | - $this->assertNotEquals( null, $typeid ); | |
| 97 | + $this->assertNotEquals(null, $typeid); | |
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | public function testGetTypeIdUnknown() | 
| 102 | 102 |  	{ | 
| 103 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); | |
| 104 | - $this->object->getTypeIdPublic( 'attribute/type', 'product', 'unknown' ); | |
| 103 | +		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); | |
| 104 | +		$this->object->getTypeIdPublic('attribute/type', 'product', 'unknown'); | |
| 105 | 105 | } | 
| 106 | 106 | } | 
| 107 | 107 | |
| @@ -115,21 +115,21 @@ discard block | ||
| 115 | 115 | return \TestHelperCntl::getContext(); | 
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | - public function getCachePublic( $type, $name = null ) | |
| 118 | + public function getCachePublic($type, $name = null) | |
| 119 | 119 |  	{ | 
| 120 | - return $this->getCache( $type, $name ); | |
| 120 | + return $this->getCache($type, $name); | |
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | 123 | |
| 124 | - public function getProcessorsPublic( array $mappings ) | |
| 124 | + public function getProcessorsPublic(array $mappings) | |
| 125 | 125 |  	{ | 
| 126 | - return $this->getProcessors( $mappings ); | |
| 126 | + return $this->getProcessors($mappings); | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | |
| 130 | - public function getTypeIdPublic( $path, $domain, $code ) | |
| 130 | + public function getTypeIdPublic($path, $domain, $code) | |
| 131 | 131 |  	{ | 
| 132 | - return $this->getTypeId( $path, $domain, $code ); | |
| 132 | + return $this->getTypeId($path, $domain, $code); | |
| 133 | 133 | } | 
| 134 | 134 | } | 
| 135 | 135 | |
| @@ -104,37 +104,37 @@ | ||
| 104 | 104 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values | 
| 105 | 105 | * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object | 
| 106 | 106 | */ | 
| 107 | - protected function getProcessors( array $mappings ) | |
| 107 | + protected function getProcessors(array $mappings) | |
| 108 | 108 |  	{ | 
| 109 | 109 | $list = []; | 
| 110 | 110 | $context = $this->getContext(); | 
| 111 | 111 | $config = $context->getConfig(); | 
| 112 | 112 | |
| 113 | - foreach( $mappings as $type => $mapping ) | |
| 113 | + foreach ($mappings as $type => $mapping) | |
| 114 | 114 |  		{ | 
| 115 | - if( ctype_alnum( $type ) === false ) | |
| 115 | + if (ctype_alnum($type) === false) | |
| 116 | 116 |  			{ | 
| 117 | 117 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type : '<not a string>'; | 
| 118 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 118 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | - $name = $config->get( 'controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard' ); | |
| 121 | +			$name = $config->get('controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard'); | |
| 122 | 122 | |
| 123 | - if( ctype_alnum( $name ) === false ) | |
| 123 | + if (ctype_alnum($name) === false) | |
| 124 | 124 |  			{ | 
| 125 | 125 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; | 
| 126 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 126 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | - $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; | |
| 129 | + $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; | |
| 130 | 130 | |
| 131 | -			if( class_exists( $classname ) === false ) { | |
| 132 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); | |
| 131 | +			if (class_exists($classname) === false) { | |
| 132 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); | |
| 133 | 133 | } | 
| 134 | 134 | |
| 135 | - $object = new $classname( $context, $mapping ); | |
| 135 | + $object = new $classname($context, $mapping); | |
| 136 | 136 | |
| 137 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object ); | |
| 137 | +			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object); | |
| 138 | 138 | |
| 139 | 139 | $list[$type] = $object; | 
| 140 | 140 | } | 
| @@ -27,37 +27,37 @@ | ||
| 27 | 27 | * @param array $pnames List of processor names | 
| 28 | 28 | * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object | 
| 29 | 29 | */ | 
| 30 | - protected function getProcessors( array $pnames ) | |
| 30 | + protected function getProcessors(array $pnames) | |
| 31 | 31 |  	{ | 
| 32 | 32 | $list = []; | 
| 33 | 33 | $context = $this->getContext(); | 
| 34 | 34 | $config = $context->getConfig(); | 
| 35 | 35 | |
| 36 | - foreach( $pnames as $pname ) | |
| 36 | + foreach ($pnames as $pname) | |
| 37 | 37 |  		{ | 
| 38 | - if( ctype_alnum( $pname ) === false ) | |
| 38 | + if (ctype_alnum($pname) === false) | |
| 39 | 39 |  			{ | 
| 40 | 40 | $classname = is_string($pname) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>'; | 
| 41 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 41 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | - $name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' ); | |
| 44 | +			$name = $config->get('controller/common/subscription/process/processor/' . $pname . '/name', 'Standard'); | |
| 45 | 45 | |
| 46 | - if( ctype_alnum( $name ) === false ) | |
| 46 | + if (ctype_alnum($name) === false) | |
| 47 | 47 |  			{ | 
| 48 | 48 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>'; | 
| 49 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 49 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | - $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name; | |
| 52 | + $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst($pname) . '\\' . $name; | |
| 53 | 53 | |
| 54 | -			if( class_exists( $classname ) === false ) { | |
| 55 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); | |
| 54 | +			if (class_exists($classname) === false) { | |
| 55 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | - $object = new $classname( $context ); | |
| 58 | + $object = new $classname($context); | |
| 59 | 59 | |
| 60 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object ); | |
| 60 | +			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object); | |
| 61 | 61 | |
| 62 | 62 | $list[$pname] = $object; | 
| 63 | 63 | } | 
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 | */ | 
| 29 | 29 | public function getName() | 
| 30 | 30 |  	{ | 
| 31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product export' ); | |
| 31 | +		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product export'); | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 | |
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | */ | 
| 40 | 40 | public function getDescription() | 
| 41 | 41 |  	{ | 
| 42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Exports all available products' ); | |
| 42 | +		return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports all available products'); | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | |
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | public function run() | 
| 52 | 52 |  	{ | 
| 53 | 53 | $container = $this->createContainer(); | 
| 54 | - $this->export( $container, false ); | |
| 54 | + $this->export($container, false); | |
| 55 | 55 | $container->close(); | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | * @param \Aimeos\MW\Container\Content\Iface $content File content object | 
| 63 | 63 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items | 
| 64 | 64 | */ | 
| 65 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) | |
| 65 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) | |
| 66 | 66 |  	{ | 
| 67 | 67 | /** controller/jobs/product/export/standard/template-items | 
| 68 | 68 | * Relative path to the XML items template of the product site map job controller. | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 | |
| 95 | 95 | $view->exportItems = $items; | 
| 96 | 96 | |
| 97 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); | |
| 97 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); | |
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | 100 | |
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | * @see controller/jobs/product/export/max-items | 
| 124 | 124 | * @see controller/jobs/product/export/max-query | 
| 125 | 125 | */ | 
| 126 | - $location = $config->get( 'controller/jobs/product/export/location' ); | |
| 126 | +		$location = $config->get('controller/jobs/product/export/location'); | |
| 127 | 127 | |
| 128 | 128 | /** controller/jobs/product/export/standard/container/type | 
| 129 | 129 | * List of file container options for the export files | 
| @@ -140,7 +140,7 @@ discard block | ||
| 140 | 140 | * @see controller/jobs/product/export/max-items | 
| 141 | 141 | * @see controller/jobs/product/export/max-query | 
| 142 | 142 | */ | 
| 143 | - $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); | |
| 143 | +		$container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory'); | |
| 144 | 144 | |
| 145 | 145 | /** controller/jobs/product/export/standard/container/content | 
| 146 | 146 | * List of file container options for the export files | 
| @@ -157,7 +157,7 @@ discard block | ||
| 157 | 157 | * @see controller/jobs/product/export/max-items | 
| 158 | 158 | * @see controller/jobs/product/export/max-query | 
| 159 | 159 | */ | 
| 160 | - $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); | |
| 160 | +		$content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary'); | |
| 161 | 161 | |
| 162 | 162 | /** controller/jobs/product/export/standard/container/options | 
| 163 | 163 | * List of file container options for the export files | 
| @@ -174,15 +174,15 @@ discard block | ||
| 174 | 174 | * @see controller/jobs/product/export/max-items | 
| 175 | 175 | * @see controller/jobs/product/export/max-query | 
| 176 | 176 | */ | 
| 177 | - $options = $config->get( 'controller/jobs/product/export/standard/container/options', [] ); | |
| 177 | +		$options = $config->get('controller/jobs/product/export/standard/container/options', []); | |
| 178 | 178 | |
| 179 | - if( $location === null ) | |
| 179 | + if ($location === null) | |
| 180 | 180 |  		{ | 
| 181 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' ); | |
| 182 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); | |
| 181 | +			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location'); | |
| 182 | + throw new \Aimeos\Controller\Jobs\Exception($msg); | |
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); | |
| 185 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); | |
| 186 | 186 | } | 
| 187 | 187 | |
| 188 | 188 | |
| @@ -193,7 +193,7 @@ discard block | ||
| 193 | 193 | * @param integer $filenum New file number | 
| 194 | 194 | * @return \Aimeos\MW\Container\Content\Iface New content object | 
| 195 | 195 | */ | 
| 196 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) | |
| 196 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) | |
| 197 | 197 |  	{ | 
| 198 | 198 | /** controller/jobs/product/export/standard/template-header | 
| 199 | 199 | * Relative path to the XML site map header template of the product site map job controller. | 
| @@ -223,9 +223,9 @@ discard block | ||
| 223 | 223 | $context = $this->getContext(); | 
| 224 | 224 | $view = $context->getView(); | 
| 225 | 225 | |
| 226 | - $content = $container->create( $this->getFilename( $filenum ) ); | |
| 227 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); | |
| 228 | - $container->add( $content ); | |
| 226 | + $content = $container->create($this->getFilename($filenum)); | |
| 227 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); | |
| 228 | + $container->add($content); | |
| 229 | 229 | |
| 230 | 230 | return $content; | 
| 231 | 231 | } | 
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | * | 
| 237 | 237 | * @param \Aimeos\MW\Container\Content\Iface $content | 
| 238 | 238 | */ | 
| 239 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) | |
| 239 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) | |
| 240 | 240 |  	{ | 
| 241 | 241 | /** controller/jobs/product/export/standard/template-footer | 
| 242 | 242 | * Relative path to the XML site map footer template of the product site map job controller. | 
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | $context = $this->getContext(); | 
| 267 | 267 | $view = $context->getView(); | 
| 268 | 268 | |
| 269 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); | |
| 269 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); | |
| 270 | 270 | } | 
| 271 | 271 | |
| 272 | 272 | |
| @@ -277,45 +277,45 @@ discard block | ||
| 277 | 277 | * @param boolean $default True to filter exported products by default criteria | 
| 278 | 278 | * @return array List of content (file) names | 
| 279 | 279 | */ | 
| 280 | - protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) | |
| 280 | + protected function export(\Aimeos\MW\Container\Iface $container, $default = true) | |
| 281 | 281 |  	{ | 
| 282 | - $domains = array( 'attribute', 'media', 'price', 'product', 'text' ); | |
| 282 | +		$domains = array('attribute', 'media', 'price', 'product', 'text'); | |
| 283 | 283 | |
| 284 | - $domains = $this->getConfig( 'domains', $domains ); | |
| 285 | - $maxItems = $this->getConfig( 'max-items', 10000 ); | |
| 286 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); | |
| 284 | +		$domains = $this->getConfig('domains', $domains); | |
| 285 | +		$maxItems = $this->getConfig('max-items', 10000); | |
| 286 | +		$maxQuery = $this->getConfig('max-query', 1000); | |
| 287 | 287 | |
| 288 | 288 | $start = 0; $filenum = 1; | 
| 289 | 289 | $names = []; | 
| 290 | 290 | |
| 291 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); | |
| 291 | + $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); | |
| 292 | 292 | |
| 293 | - $search = $productManager->createSearch( $default ); | |
| 294 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); | |
| 295 | - $search->setSlice( 0, $maxQuery ); | |
| 293 | + $search = $productManager->createSearch($default); | |
| 294 | +		$search->setSortations(array($search->sort('+', 'product.id'))); | |
| 295 | + $search->setSlice(0, $maxQuery); | |
| 296 | 296 | |
| 297 | - $content = $this->createContent( $container, $filenum ); | |
| 297 | + $content = $this->createContent($container, $filenum); | |
| 298 | 298 | $names[] = $content->getResource(); | 
| 299 | 299 | |
| 300 | 300 | do | 
| 301 | 301 |  		{ | 
| 302 | - $items = $productManager->searchItems( $search, $domains ); | |
| 303 | - $this->addItems( $content, $items ); | |
| 302 | + $items = $productManager->searchItems($search, $domains); | |
| 303 | + $this->addItems($content, $items); | |
| 304 | 304 | |
| 305 | - $count = count( $items ); | |
| 305 | + $count = count($items); | |
| 306 | 306 | $start += $count; | 
| 307 | - $search->setSlice( $start, $maxQuery ); | |
| 307 | + $search->setSlice($start, $maxQuery); | |
| 308 | 308 | |
| 309 | - if( $start + $maxQuery > $maxItems * $filenum ) | |
| 309 | + if ($start + $maxQuery > $maxItems * $filenum) | |
| 310 | 310 |  			{ | 
| 311 | - $this->closeContent( $content ); | |
| 312 | - $content = $this->createContent( $container, ++$filenum ); | |
| 311 | + $this->closeContent($content); | |
| 312 | + $content = $this->createContent($container, ++$filenum); | |
| 313 | 313 | $names[] = $content->getResource(); | 
| 314 | 314 | } | 
| 315 | 315 | } | 
| 316 | - while( $count >= $search->getSliceSize() ); | |
| 316 | + while ($count >= $search->getSliceSize()); | |
| 317 | 317 | |
| 318 | - $this->closeContent( $content ); | |
| 318 | + $this->closeContent($content); | |
| 319 | 319 | |
| 320 | 320 | return $names; | 
| 321 | 321 | } | 
| @@ -328,11 +328,11 @@ discard block | ||
| 328 | 328 | * @param mixed $default Default value if name is unknown | 
| 329 | 329 | * @return mixed Configuration value | 
| 330 | 330 | */ | 
| 331 | - protected function getConfig( $name, $default = null ) | |
| 331 | + protected function getConfig($name, $default = null) | |
| 332 | 332 |  	{ | 
| 333 | 333 | $config = $this->getContext()->getConfig(); | 
| 334 | 334 | |
| 335 | - switch( $name ) | |
| 335 | + switch ($name) | |
| 336 | 336 |  		{ | 
| 337 | 337 | case 'domain': | 
| 338 | 338 | /** controller/jobs/product/export/domains | 
| @@ -355,7 +355,7 @@ discard block | ||
| 355 | 355 | * @see controller/jobs/product/export/max-items | 
| 356 | 356 | * @see controller/jobs/product/export/max-query | 
| 357 | 357 | */ | 
| 358 | - return $config->get( 'controller/jobs/product/export/domains', $default ); | |
| 358 | +				return $config->get('controller/jobs/product/export/domains', $default); | |
| 359 | 359 | |
| 360 | 360 | case 'max-items': | 
| 361 | 361 | /** controller/jobs/product/export/max-items | 
| @@ -378,7 +378,7 @@ discard block | ||
| 378 | 378 | * @see controller/jobs/product/export/max-query | 
| 379 | 379 | * @see controller/jobs/product/export/domains | 
| 380 | 380 | */ | 
| 381 | - return $config->get( 'controller/jobs/product/export/max-items', $default ); | |
| 381 | +				return $config->get('controller/jobs/product/export/max-items', $default); | |
| 382 | 382 | |
| 383 | 383 | case 'max-query': | 
| 384 | 384 | /** controller/jobs/product/export/max-query | 
| @@ -401,7 +401,7 @@ discard block | ||
| 401 | 401 | * @see controller/jobs/product/export/max-items | 
| 402 | 402 | * @see controller/jobs/product/export/domains | 
| 403 | 403 | */ | 
| 404 | - return $config->get( 'controller/jobs/product/export/max-query', $default ); | |
| 404 | +				return $config->get('controller/jobs/product/export/max-query', $default); | |
| 405 | 405 | |
| 406 | 406 | case 'filename': | 
| 407 | 407 | /** controller/jobs/product/export/filename | 
| @@ -422,7 +422,7 @@ discard block | ||
| 422 | 422 | * @see controller/jobs/product/export/max-query | 
| 423 | 423 | * @see controller/jobs/product/export/domains | 
| 424 | 424 | */ | 
| 425 | - return $config->get( 'controller/jobs/product/export/filename', $default ); | |
| 425 | +				return $config->get('controller/jobs/product/export/filename', $default); | |
| 426 | 426 | } | 
| 427 | 427 | |
| 428 | 428 | return $default; | 
| @@ -435,8 +435,8 @@ discard block | ||
| 435 | 435 | * @param integer $number Current file number | 
| 436 | 436 | * @return string New file name | 
| 437 | 437 | */ | 
| 438 | - protected function getFilename( $number ) | |
| 438 | + protected function getFilename($number) | |
| 439 | 439 |  	{ | 
| 440 | - return sprintf( $this->getConfig( 'filename', 'aimeos-products-%1$d_%2$s.xml' ), $number, date( 'Y-m-d_H:i:s' ) ); | |
| 440 | +		return sprintf($this->getConfig('filename', 'aimeos-products-%1$d_%2$s.xml'), $number, date('Y-m-d_H:i:s')); | |
| 441 | 441 | } | 
| 442 | 442 | } | 
| @@ -142,37 +142,37 @@ | ||
| 142 | 142 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values | 
| 143 | 143 | * @return \Aimeos\Controller\Common\Order\Export\Csv\Processor\Iface Processor object | 
| 144 | 144 | */ | 
| 145 | - protected function getProcessors( array $mappings ) | |
| 145 | + protected function getProcessors(array $mappings) | |
| 146 | 146 |  	{ | 
| 147 | 147 | $list = []; | 
| 148 | 148 | $context = $this->getContext(); | 
| 149 | 149 | $config = $context->getConfig(); | 
| 150 | 150 | |
| 151 | - foreach( $mappings as $type => $mapping ) | |
| 151 | + foreach ($mappings as $type => $mapping) | |
| 152 | 152 |  		{ | 
| 153 | - if( ctype_alnum( $type ) === false ) | |
| 153 | + if (ctype_alnum($type) === false) | |
| 154 | 154 |  			{ | 
| 155 | 155 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type : '<not a string>'; | 
| 156 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 156 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | - $name = $config->get( 'controller/common/order/export/csv/processor/' . $type . '/name', 'Standard' ); | |
| 159 | +			$name = $config->get('controller/common/order/export/csv/processor/' . $type . '/name', 'Standard'); | |
| 160 | 160 | |
| 161 | - if( ctype_alnum( $name ) === false ) | |
| 161 | + if (ctype_alnum($name) === false) | |
| 162 | 162 |  			{ | 
| 163 | 163 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; | 
| 164 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 164 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 165 | 165 | } | 
| 166 | 166 | |
| 167 | - $classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; | |
| 167 | + $classname = '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; | |
| 168 | 168 | |
| 169 | -			if( class_exists( $classname ) === false ) { | |
| 170 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); | |
| 169 | +			if (class_exists($classname) === false) { | |
| 170 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); | |
| 171 | 171 | } | 
| 172 | 172 | |
| 173 | - $object = new $classname( $context, $mapping ); | |
| 173 | + $object = new $classname($context, $mapping); | |
| 174 | 174 | |
| 175 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\Iface', $object ); | |
| 175 | +			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Order\\Export\\Csv\\Processor\\Iface', $object); | |
| 176 | 176 | |
| 177 | 177 | $list[$type] = $object; | 
| 178 | 178 | } | 
| @@ -18,18 +18,18 @@ discard block | ||
| 18 | 18 | |
| 19 | 19 | protected function setUp() | 
| 20 | 20 |  	{ | 
| 21 | - \Aimeos\MShop\Factory::setCache( true ); | |
| 21 | + \Aimeos\MShop\Factory::setCache(true); | |
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); | 
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); | 
| 25 | 25 | |
| 26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos ); | |
| 26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos); | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() | 
| 31 | 31 |  	{ | 
| 32 | - \Aimeos\MShop\Factory::setCache( false ); | |
| 32 | + \Aimeos\MShop\Factory::setCache(false); | |
| 33 | 33 | \Aimeos\MShop\Factory::clear(); | 
| 34 | 34 | |
| 35 | 35 | $this->object = null; | 
| @@ -38,14 +38,14 @@ discard block | ||
| 38 | 38 | |
| 39 | 39 | public function testGetName() | 
| 40 | 40 |  	{ | 
| 41 | - $this->assertEquals( 'Product site map', $this->object->getName() ); | |
| 41 | +		$this->assertEquals('Product site map', $this->object->getName()); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() | 
| 46 | 46 |  	{ | 
| 47 | 47 | $text = 'Creates a product site map for search engines'; | 
| 48 | - $this->assertEquals( $text, $this->object->getDescription() ); | |
| 48 | + $this->assertEquals($text, $this->object->getDescription()); | |
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | |
| @@ -54,22 +54,22 @@ discard block | ||
| 54 | 54 | $this->object->run(); | 
| 55 | 55 | |
| 56 | 56 | $ds = DIRECTORY_SEPARATOR; | 
| 57 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); | |
| 58 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); | |
| 59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); | |
| 57 | +		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); | |
| 58 | +		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); | |
| 59 | +		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); | |
| 60 | 60 | |
| 61 | - $file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 ); | |
| 62 | - $file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 ); | |
| 63 | - $index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 ); | |
| 61 | +		$file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000); | |
| 62 | +		$file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000); | |
| 63 | +		$index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000); | |
| 64 | 64 | |
| 65 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); | |
| 66 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); | |
| 67 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); | |
| 65 | +		unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); | |
| 66 | +		unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); | |
| 67 | +		unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); | |
| 68 | 68 | |
| 69 | - $this->assertContains( 'Cafe_Noire_Expresso', $file2 ); | |
| 70 | - $this->assertContains( 'Unittest%3A_Bundle', $file2 ); | |
| 69 | +		$this->assertContains('Cafe_Noire_Expresso', $file2); | |
| 70 | +		$this->assertContains('Unittest%3A_Bundle', $file2); | |
| 71 | 71 | |
| 72 | - $this->assertContains( 'aimeos-sitemap-1.xml.gz', $index ); | |
| 73 | - $this->assertContains( 'aimeos-sitemap-2.xml.gz', $index ); | |
| 72 | +		$this->assertContains('aimeos-sitemap-1.xml.gz', $index); | |
| 73 | +		$this->assertContains('aimeos-sitemap-2.xml.gz', $index); | |
| 74 | 74 | } | 
| 75 | 75 | } | 
| 76 | 76 | \ No newline at end of file | 
| @@ -18,18 +18,18 @@ discard block | ||
| 18 | 18 | |
| 19 | 19 | protected function setUp() | 
| 20 | 20 |  	{ | 
| 21 | - \Aimeos\MShop\Factory::setCache( true ); | |
| 21 | + \Aimeos\MShop\Factory::setCache(true); | |
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperJobs::getContext(); | 
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); | 
| 25 | 25 | |
| 26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard( $this->context, $this->aimeos ); | |
| 26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos); | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() | 
| 31 | 31 |  	{ | 
| 32 | - \Aimeos\MShop\Factory::setCache( false ); | |
| 32 | + \Aimeos\MShop\Factory::setCache(false); | |
| 33 | 33 | \Aimeos\MShop\Factory::clear(); | 
| 34 | 34 | |
| 35 | 35 | $this->object = null; | 
| @@ -38,34 +38,34 @@ discard block | ||
| 38 | 38 | |
| 39 | 39 | public function testGetName() | 
| 40 | 40 |  	{ | 
| 41 | - $this->assertEquals( 'Product export', $this->object->getName() ); | |
| 41 | +		$this->assertEquals('Product export', $this->object->getName()); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() | 
| 46 | 46 |  	{ | 
| 47 | 47 | $text = 'Exports all available products'; | 
| 48 | - $this->assertEquals( $text, $this->object->getDescription() ); | |
| 48 | + $this->assertEquals($text, $this->object->getDescription()); | |
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testRun() | 
| 53 | 53 |  	{ | 
| 54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml' ); | |
| 54 | +		$this->context->getConfig()->set('controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml'); | |
| 55 | 55 | |
| 56 | 56 | $this->object->run(); | 
| 57 | 57 | |
| 58 | 58 | $ds = DIRECTORY_SEPARATOR; | 
| 59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-products-1.xml' ); | |
| 60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-products-2.xml' ); | |
| 59 | +		$this->assertFileExists('tmp' . $ds . 'aimeos-products-1.xml'); | |
| 60 | +		$this->assertFileExists('tmp' . $ds . 'aimeos-products-2.xml'); | |
| 61 | 61 | |
| 62 | - $file1 = file_get_contents( 'tmp' . $ds . 'aimeos-products-1.xml' ); | |
| 63 | - $file2 = file_get_contents( 'tmp' . $ds . 'aimeos-products-2.xml' ); | |
| 62 | +		$file1 = file_get_contents('tmp' . $ds . 'aimeos-products-1.xml'); | |
| 63 | +		$file2 = file_get_contents('tmp' . $ds . 'aimeos-products-2.xml'); | |
| 64 | 64 | |
| 65 | - unlink( 'tmp' . $ds . 'aimeos-products-1.xml' ); | |
| 66 | - unlink( 'tmp' . $ds . 'aimeos-products-2.xml' ); | |
| 65 | +		unlink('tmp' . $ds . 'aimeos-products-1.xml'); | |
| 66 | +		unlink('tmp' . $ds . 'aimeos-products-2.xml'); | |
| 67 | 67 | |
| 68 | - $this->assertContains( 'CNE', $file2 ); | |
| 69 | - $this->assertContains( 'U:BUNDLE', $file2 ); | |
| 68 | +		$this->assertContains('CNE', $file2); | |
| 69 | +		$this->assertContains('U:BUNDLE', $file2); | |
| 70 | 70 | } | 
| 71 | 71 | } | 
| 72 | 72 | \ No newline at end of file | 
| @@ -27,8 +27,8 @@ discard block | ||
| 27 | 27 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value | 
| 28 | 28 | * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor Decorated processor | 
| 29 | 29 | */ | 
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, | |
| 31 | - \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null ) | |
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, | |
| 31 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null) | |
| 32 | 32 |  	{ | 
| 33 | 33 | } | 
| 34 | 34 | |
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | * @param array $data List of CSV fields with position as key and data as value | 
| 41 | 41 | * @return array List of data which hasn't been imported | 
| 42 | 42 | */ | 
| 43 | - public function process( \Aimeos\MShop\Product\Item\Iface $item, array $data ) | |
| 43 | + public function process(\Aimeos\MShop\Product\Item\Iface $item, array $data) | |
| 44 | 44 |  	{ | 
| 45 | 45 | return $data; | 
| 46 | 46 | } | 
| @@ -30,14 +30,14 @@ discard block | ||
| 30 | 30 | * @param array $data Associative list of product codes and lists of CSV field indexes and their data | 
| 31 | 31 | * @return array Associative list of CSV field indexes and their converted data | 
| 32 | 32 | */ | 
| 33 | - protected function convertData( array $convlist, array $data ) | |
| 33 | + protected function convertData(array $convlist, array $data) | |
| 34 | 34 |  	{ | 
| 35 | - foreach( $convlist as $idx => $converter ) | |
| 35 | + foreach ($convlist as $idx => $converter) | |
| 36 | 36 |  		{ | 
| 37 | - foreach( $data as $code => $list ) | |
| 37 | + foreach ($data as $code => $list) | |
| 38 | 38 |  			{ | 
| 39 | -				if( isset( $list[$idx] ) ) { | |
| 40 | - $data[$code][$idx] = $converter->translate( $list[$idx] ); | |
| 39 | +				if (isset($list[$idx])) { | |
| 40 | + $data[$code][$idx] = $converter->translate($list[$idx]); | |
| 41 | 41 | } | 
| 42 | 42 | } | 
| 43 | 43 | } | 
| @@ -53,36 +53,36 @@ discard block | ||
| 53 | 53 | * @param string|null Name of the cache implementation | 
| 54 | 54 | * @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object | 
| 55 | 55 | */ | 
| 56 | - protected function getCache( $type, $name = null ) | |
| 56 | + protected function getCache($type, $name = null) | |
| 57 | 57 |  	{ | 
| 58 | 58 | $context = $this->getContext(); | 
| 59 | 59 | $config = $context->getConfig(); | 
| 60 | 60 | |
| 61 | - if( ctype_alnum( $type ) === false ) | |
| 61 | + if (ctype_alnum($type) === false) | |
| 62 | 62 |  		{ | 
| 63 | 63 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>'; | 
| 64 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 64 | +			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | -		if( $name === null ) { | |
| 68 | - $name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' ); | |
| 67 | +		if ($name === null) { | |
| 68 | +			$name = $config->get('controller/common/product/import/csv/cache/' . $type . '/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\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $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 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; | |
| 77 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name; | |
| 78 | 78 | |
| 79 | -		if( class_exists( $classname ) === false ) { | |
| 80 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); | |
| 79 | +		if (class_exists($classname) === false) { | |
| 80 | +			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); | |
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | - $object = new $classname( $context ); | |
| 83 | + $object = new $classname($context); | |
| 84 | 84 | |
| 85 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object ); | |
| 85 | +		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object); | |
| 86 | 86 | |
| 87 | 87 | return $object; | 
| 88 | 88 | } | 
| @@ -94,12 +94,12 @@ discard block | ||
| 94 | 94 | * @param array $convmap List of converter names for the values at the position in the CSV file | 
| 95 | 95 | * @return array Associative list of positions and converter objects | 
| 96 | 96 | */ | 
| 97 | - protected function getConverterList( array $convmap ) | |
| 97 | + protected function getConverterList(array $convmap) | |
| 98 | 98 |  	{ | 
| 99 | 99 | $convlist = []; | 
| 100 | 100 | |
| 101 | -		foreach( $convmap as $idx => $name ) { | |
| 102 | - $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); | |
| 101 | +		foreach ($convmap as $idx => $name) { | |
| 102 | + $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name); | |
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | return $convlist; | 
| @@ -114,15 +114,15 @@ discard block | ||
| 114 | 114 | * @param integer $codePos Column position which contains the unique product code (starting from 0) | 
| 115 | 115 | * @return array List of arrays with product codes as keys and list of values from the CSV file | 
| 116 | 116 | */ | 
| 117 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) | |
| 117 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) | |
| 118 | 118 |  	{ | 
| 119 | 119 | $count = 0; | 
| 120 | 120 | $data = []; | 
| 121 | 121 | |
| 122 | - while( $content->valid() && $count++ < $maxcnt ) | |
| 122 | + while ($content->valid() && $count++ < $maxcnt) | |
| 123 | 123 |  		{ | 
| 124 | 124 | $row = $content->current(); | 
| 125 | - $data[ $row[$codePos] ] = $row; | |
| 125 | + $data[$row[$codePos]] = $row; | |
| 126 | 126 | $content->next(); | 
| 127 | 127 | } | 
| 128 | 128 | |
| @@ -221,21 +221,21 @@ discard block | ||
| 221 | 221 | * @param array $mapping List of domain item keys with the CSV field position as key | 
| 222 | 222 | * @return array List of associative arrays containing the chunked properties | 
| 223 | 223 | */ | 
| 224 | - protected function getMappedChunk( array &$data, array $mapping ) | |
| 224 | + protected function getMappedChunk(array &$data, array $mapping) | |
| 225 | 225 |  	{ | 
| 226 | 226 | $idx = 0; | 
| 227 | 227 | $map = []; | 
| 228 | 228 | |
| 229 | - foreach( $mapping as $pos => $key ) | |
| 229 | + foreach ($mapping as $pos => $key) | |
| 230 | 230 |  		{ | 
| 231 | -			if( isset( $map[$idx][$key] ) ) { | |
| 231 | +			if (isset($map[$idx][$key])) { | |
| 232 | 232 | $idx++; | 
| 233 | 233 | } | 
| 234 | 234 | |
| 235 | - if( isset( $data[$pos] ) ) | |
| 235 | + if (isset($data[$pos])) | |
| 236 | 236 |  			{ | 
| 237 | 237 | $map[$idx][$key] = $data[$pos]; | 
| 238 | - unset( $data[$pos] ); | |
| 238 | + unset($data[$pos]); | |
| 239 | 239 | } | 
| 240 | 240 | } | 
| 241 | 241 | |
| @@ -249,37 +249,37 @@ discard block | ||
| 249 | 249 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values | 
| 250 | 250 | * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object | 
| 251 | 251 | */ | 
| 252 | - protected function getProcessors( array $mappings ) | |
| 252 | + protected function getProcessors(array $mappings) | |
| 253 | 253 |  	{ | 
| 254 | 254 | $context = $this->getContext(); | 
| 255 | 255 | $config = $context->getConfig(); | 
| 256 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, [] ); | |
| 256 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, []); | |
| 257 | 257 | |
| 258 | - foreach( $mappings as $type => $mapping ) | |
| 258 | + foreach ($mappings as $type => $mapping) | |
| 259 | 259 |  		{ | 
| 260 | - if( ctype_alnum( $type ) === false ) | |
| 260 | + if (ctype_alnum($type) === false) | |
| 261 | 261 |  			{ | 
| 262 | 262 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>'; | 
| 263 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 263 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 264 | 264 | } | 
| 265 | 265 | |
| 266 | - $name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' ); | |
| 266 | +			$name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard'); | |
| 267 | 267 | |
| 268 | - if( ctype_alnum( $name ) === false ) | |
| 268 | + if (ctype_alnum($name) === false) | |
| 269 | 269 |  			{ | 
| 270 | 270 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; | 
| 271 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); | |
| 271 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); | |
| 272 | 272 | } | 
| 273 | 273 | |
| 274 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; | |
| 274 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; | |
| 275 | 275 | |
| 276 | -			if( class_exists( $classname ) === false ) { | |
| 277 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); | |
| 276 | +			if (class_exists($classname) === false) { | |
| 277 | +				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); | |
| 278 | 278 | } | 
| 279 | 279 | |
| 280 | - $object = new $classname( $context, $mapping, $object ); | |
| 280 | + $object = new $classname($context, $mapping, $object); | |
| 281 | 281 | |
| 282 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object ); | |
| 282 | +			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object); | |
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | 285 | return $object; | 
| @@ -293,17 +293,17 @@ discard block | ||
| 293 | 293 | * @param array $domains List of domains whose items should be fetched too | 
| 294 | 294 | * @return array Associative list of product codes as key and product items as value | 
| 295 | 295 | */ | 
| 296 | - protected function getProducts( array $codes, array $domains ) | |
| 296 | + protected function getProducts(array $codes, array $domains) | |
| 297 | 297 |  	{ | 
| 298 | 298 | $result = []; | 
| 299 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); | |
| 299 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); | |
| 300 | 300 | |
| 301 | 301 | $search = $manager->createSearch(); | 
| 302 | - $search->setConditions( $search->compare( '==', 'product.code', $codes ) ); | |
| 303 | - $search->setSlice( 0, count( $codes ) ); | |
| 302 | +		$search->setConditions($search->compare('==', 'product.code', $codes)); | |
| 303 | + $search->setSlice(0, count($codes)); | |
| 304 | 304 | |
| 305 | -		foreach( $manager->searchItems( $search, $domains ) as $item ) { | |
| 306 | - $result[ $item->getCode() ] = $item; | |
| 305 | +		foreach ($manager->searchItems($search, $domains) as $item) { | |
| 306 | + $result[$item->getCode()] = $item; | |
| 307 | 307 | } | 
| 308 | 308 | |
| 309 | 309 | return $result; | 
| @@ -318,23 +318,23 @@ discard block | ||
| 318 | 318 | * @param string $code Unique code of the type item | 
| 319 | 319 | * @return string Unique ID of the type item | 
| 320 | 320 | */ | 
| 321 | - protected function getTypeId( $path, $domain, $code ) | |
| 321 | + protected function getTypeId($path, $domain, $code) | |
| 322 | 322 |  	{ | 
| 323 | - if( !isset( self::$types[$path][$domain] ) ) | |
| 323 | + if (!isset(self::$types[$path][$domain])) | |
| 324 | 324 |  		{ | 
| 325 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $path ); | |
| 326 | - $key = str_replace( '/', '.', $path ); | |
| 325 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $path); | |
| 326 | +			$key = str_replace('/', '.', $path); | |
| 327 | 327 | |
| 328 | 328 | $search = $manager->createSearch(); | 
| 329 | - $search->setConditions( $search->compare( '==', $key . '.domain', $domain ) ); | |
| 329 | +			$search->setConditions($search->compare('==', $key . '.domain', $domain)); | |
| 330 | 330 | |
| 331 | -			foreach( $manager->searchItems( $search ) as $id => $item ) { | |
| 332 | - self::$types[$path][$domain][ $item->getCode() ] = $id; | |
| 331 | +			foreach ($manager->searchItems($search) as $id => $item) { | |
| 332 | + self::$types[$path][$domain][$item->getCode()] = $id; | |
| 333 | 333 | } | 
| 334 | 334 | } | 
| 335 | 335 | |
| 336 | -		if( !isset( self::$types[$path][$domain][$code] ) ) { | |
| 337 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path ) ); | |
| 336 | +		if (!isset(self::$types[$path][$domain][$code])) { | |
| 337 | +			throw new \Aimeos\Controller\Jobs\Exception(sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path)); | |
| 338 | 338 | } | 
| 339 | 339 | |
| 340 | 340 | return self::$types[$path][$domain][$code]; |