@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @param string|null $type Attribute type |
| 43 | 43 | * @return string|null Product ID or null if not found |
| 44 | 44 | */ |
| 45 | - public function get( $code, $type = null ) |
|
| 45 | + public function get($code, $type = null) |
|
| 46 | 46 | { |
| 47 | - if( isset( $this->prodmap[$code] ) ) { |
|
| 47 | + if (isset($this->prodmap[$code])) { |
|
| 48 | 48 | return $this->prodmap[$code]; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
| 51 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
| 52 | 52 | |
| 53 | 53 | $search = $manager->createSearch(); |
| 54 | - $search->setConditions( $search->compare( '==', 'product.code', $code ) ); |
|
| 54 | + $search->setConditions($search->compare('==', 'product.code', $code)); |
|
| 55 | 55 | |
| 56 | - $result = $manager->searchItems( $search ); |
|
| 56 | + $result = $manager->searchItems($search); |
|
| 57 | 57 | |
| 58 | - if( ( $item = reset( $result ) ) !== false ) |
|
| 58 | + if (($item = reset($result)) !== false) |
|
| 59 | 59 | { |
| 60 | 60 | $this->prodmap[$code] = $item->getId(); |
| 61 | 61 | return $this->prodmap[$code]; |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param \Aimeos\MShop\Common\Item\Iface $item Product object |
| 70 | 70 | */ |
| 71 | - public function set( \Aimeos\MShop\Common\Item\Iface $item ) |
|
| 71 | + public function set(\Aimeos\MShop\Common\Item\Iface $item) |
|
| 72 | 72 | { |
| 73 | - $this->prodmap[ $item->getCode() ] = $item->getId(); |
|
| 73 | + $this->prodmap[$item->getCode()] = $item->getId(); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | \ No newline at end of file |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 31 | 31 | { |
| 32 | 32 | $this->context = $context; |
| 33 | 33 | } |
@@ -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,38 +53,38 @@ 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 | $iface = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface'; |
| 61 | 61 | |
| 62 | - if( ctype_alnum( $type ) === false ) |
|
| 62 | + if (ctype_alnum($type) === false) |
|
| 63 | 63 | { |
| 64 | 64 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>'; |
| 65 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 65 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $config->get('controller/common/product/import/csv/cache/' . $type . '/name', 'Standard'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ctype_alnum( $name ) === false ) |
|
| 72 | + if (ctype_alnum($name) === false) |
|
| 73 | 73 | { |
| 74 | 74 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; |
| 75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; |
|
| 78 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name; |
|
| 79 | 79 | |
| 80 | - if( class_exists( $classname ) === false ) { |
|
| 81 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 80 | + if (class_exists($classname) === false) { |
|
| 81 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $object = new $classname( $context ); |
|
| 84 | + $object = new $classname($context); |
|
| 85 | 85 | |
| 86 | - if( !( $object instanceof $iface ) ) { |
|
| 87 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
|
| 86 | + if (!($object instanceof $iface)) { |
|
| 87 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface)); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $object; |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | * @param array $convmap List of converter names for the values at the position in the CSV file |
| 98 | 98 | * @return array Associative list of positions and converter objects |
| 99 | 99 | */ |
| 100 | - protected function getConverterList( array $convmap ) |
|
| 100 | + protected function getConverterList(array $convmap) |
|
| 101 | 101 | { |
| 102 | 102 | $convlist = array(); |
| 103 | 103 | |
| 104 | - foreach( $convmap as $idx => $name ) { |
|
| 105 | - $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); |
|
| 104 | + foreach ($convmap as $idx => $name) { |
|
| 105 | + $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $convlist; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * @param integer $codePos Column position which contains the unique product code (starting from 0) |
| 118 | 118 | * @return array List of arrays with product codes as keys and list of values from the CSV file |
| 119 | 119 | */ |
| 120 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) |
|
| 120 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) |
|
| 121 | 121 | { |
| 122 | 122 | $count = 0; |
| 123 | 123 | $data = array(); |
| 124 | 124 | |
| 125 | - while( $content->valid() && $count++ < $maxcnt ) |
|
| 125 | + while ($content->valid() && $count++ < $maxcnt) |
|
| 126 | 126 | { |
| 127 | 127 | $row = $content->current(); |
| 128 | - $data[ $row[$codePos] ] = $row; |
|
| 128 | + $data[$row[$codePos]] = $row; |
|
| 129 | 129 | $content->next(); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -222,13 +222,13 @@ discard block |
||
| 222 | 222 | * @param array $list List of CSV fields with the CSV field position as key |
| 223 | 223 | * @return Associative list of domain item keys and the converted values |
| 224 | 224 | */ |
| 225 | - protected function getMappedData( array $mapping, array $list ) |
|
| 225 | + protected function getMappedData(array $mapping, array $list) |
|
| 226 | 226 | { |
| 227 | 227 | $map = array(); |
| 228 | 228 | |
| 229 | - foreach( $mapping as $idx => $key ) |
|
| 229 | + foreach ($mapping as $idx => $key) |
|
| 230 | 230 | { |
| 231 | - if( !isset( $list[$idx] ) ) { |
|
| 231 | + if (!isset($list[$idx])) { |
|
| 232 | 232 | break; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -245,39 +245,39 @@ discard block |
||
| 245 | 245 | * @param array $mapping Associative list of processor types as keys and index/data mappings as values |
| 246 | 246 | * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object |
| 247 | 247 | */ |
| 248 | - protected function getProcessors( array $mappings ) |
|
| 248 | + protected function getProcessors(array $mappings) |
|
| 249 | 249 | { |
| 250 | 250 | $context = $this->getContext(); |
| 251 | 251 | $config = $context->getConfig(); |
| 252 | 252 | $iface = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface'; |
| 253 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, array() ); |
|
| 253 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, array()); |
|
| 254 | 254 | |
| 255 | - foreach( $mappings as $type => $mapping ) |
|
| 255 | + foreach ($mappings as $type => $mapping) |
|
| 256 | 256 | { |
| 257 | - if( ctype_alnum( $type ) === false ) |
|
| 257 | + if (ctype_alnum($type) === false) |
|
| 258 | 258 | { |
| 259 | 259 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>'; |
| 260 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 260 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' ); |
|
| 263 | + $name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard'); |
|
| 264 | 264 | |
| 265 | - if( ctype_alnum( $name ) === false ) |
|
| 265 | + if (ctype_alnum($name) === false) |
|
| 266 | 266 | { |
| 267 | 267 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
| 268 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 268 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
| 271 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
| 272 | 272 | |
| 273 | - if( class_exists( $classname ) === false ) { |
|
| 274 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 273 | + if (class_exists($classname) === false) { |
|
| 274 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $object = new $classname( $context, $mapping, $object ); |
|
| 277 | + $object = new $classname($context, $mapping, $object); |
|
| 278 | 278 | |
| 279 | - if( !( $object instanceof $iface ) ) { |
|
| 280 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
|
| 279 | + if (!($object instanceof $iface)) { |
|
| 280 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface)); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -292,17 +292,17 @@ discard block |
||
| 292 | 292 | * @param array $domains List of domains whose items should be fetched too |
| 293 | 293 | * @return array Associative list of product codes as key and product items as value |
| 294 | 294 | */ |
| 295 | - protected function getProducts( array $codes, array $domains ) |
|
| 295 | + protected function getProducts(array $codes, array $domains) |
|
| 296 | 296 | { |
| 297 | 297 | $result = array(); |
| 298 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
| 298 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
| 299 | 299 | |
| 300 | 300 | $search = $manager->createSearch(); |
| 301 | - $search->setConditions( $search->compare( '==', 'product.code', $codes ) ); |
|
| 302 | - $search->setSlice( 0, count( $codes ) ); |
|
| 301 | + $search->setConditions($search->compare('==', 'product.code', $codes)); |
|
| 302 | + $search->setSlice(0, count($codes)); |
|
| 303 | 303 | |
| 304 | - foreach( $manager->searchItems( $search, $domains ) as $item ) { |
|
| 305 | - $result[ $item->getCode() ] = $item; |
|
| 304 | + foreach ($manager->searchItems($search, $domains) as $item) { |
|
| 305 | + $result[$item->getCode()] = $item; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | return $result; |
@@ -317,23 +317,23 @@ discard block |
||
| 317 | 317 | * @param string $code Unique code of the type item |
| 318 | 318 | * @return string Unique ID of the type item |
| 319 | 319 | */ |
| 320 | - protected function getTypeId( $path, $domain, $code ) |
|
| 320 | + protected function getTypeId($path, $domain, $code) |
|
| 321 | 321 | { |
| 322 | - if( !isset( self::$types[$path][$domain] ) ) |
|
| 322 | + if (!isset(self::$types[$path][$domain])) |
|
| 323 | 323 | { |
| 324 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $path ); |
|
| 325 | - $key = str_replace( '/', '.', $path ); |
|
| 324 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $path); |
|
| 325 | + $key = str_replace('/', '.', $path); |
|
| 326 | 326 | |
| 327 | 327 | $search = $manager->createSearch(); |
| 328 | - $search->setConditions( $search->compare( '==', $key . '.domain', $domain ) ); |
|
| 328 | + $search->setConditions($search->compare('==', $key . '.domain', $domain)); |
|
| 329 | 329 | |
| 330 | - foreach( $manager->searchItems( $search ) as $id => $item ) { |
|
| 331 | - self::$types[$path][$domain][ $item->getCode() ] = $id; |
|
| 330 | + foreach ($manager->searchItems($search) as $id => $item) { |
|
| 331 | + self::$types[$path][$domain][$item->getCode()] = $id; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if( !isset( self::$types[$path][$domain][$code] ) ) { |
|
| 336 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path ) ); |
|
| 335 | + if (!isset(self::$types[$path][$domain][$code])) { |
|
| 336 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path)); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | return self::$types[$path][$domain][$code]; |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | public static function bootstrap() |
| 16 | 16 | { |
| 17 | 17 | self::getAimeos(); |
| 18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 18 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - public static function getContext( $site = 'unittest' ) |
|
| 22 | + public static function getContext($site = 'unittest') |
|
| 23 | 23 | { |
| 24 | - if( !isset( self::$context[$site] ) ) { |
|
| 25 | - self::$context[$site] = self::createContext( $site ); |
|
| 24 | + if (!isset(self::$context[$site])) { |
|
| 25 | + self::$context[$site] = self::createContext($site); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public static function getAimeos() |
| 33 | 33 | { |
| 34 | - if( !isset( self::$aimeos ) ) |
|
| 34 | + if (!isset(self::$aimeos)) |
|
| 35 | 35 | { |
| 36 | 36 | require_once 'Bootstrap.php'; |
| 37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 38 | 38 | |
| 39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
| 40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
| 39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
| 40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return self::$aimeos; |
@@ -47,40 +47,40 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @param string $site |
| 49 | 49 | */ |
| 50 | - private static function createContext( $site ) |
|
| 50 | + private static function createContext($site) |
|
| 51 | 51 | { |
| 52 | 52 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 53 | 53 | $aimeos = self::getAimeos(); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - $paths = $aimeos->getConfigPaths( 'mysql' ); |
|
| 56 | + $paths = $aimeos->getConfigPaths('mysql'); |
|
| 57 | 57 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 58 | 58 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 59 | 59 | |
| 60 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
| 61 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 62 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 63 | - $ctx->setConfig( $conf ); |
|
| 60 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
| 61 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 62 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 63 | + $ctx->setConfig($conf); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 67 | - $ctx->setDatabaseManager( $dbm ); |
|
| 66 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 67 | + $ctx->setDatabaseManager($dbm); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 71 | - $ctx->setLogger( $logger ); |
|
| 70 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 71 | + $ctx->setLogger($logger); |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | $session = new \Aimeos\MW\Session\None(); |
| 75 | - $ctx->setSession( $session ); |
|
| 75 | + $ctx->setSession($session); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 79 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 80 | - $ctx->setLocale( $locale ); |
|
| 78 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 79 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 80 | + $ctx->setLocale($locale); |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - $ctx->setEditor( 'core:controller/common' ); |
|
| 83 | + $ctx->setEditor('core:controller/common'); |
|
| 84 | 84 | |
| 85 | 85 | return $ctx; |
| 86 | 86 | } |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 24 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 25 | 25 | |
| 26 | 26 | $this->context = \TestHelperCntl::getContext(); |
| 27 | - $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, array() ); |
|
| 27 | + $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, array()); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | protected function tearDown() |
| 38 | 38 | { |
| 39 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 39 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 40 | 40 | \Aimeos\MShop\Factory::clear(); |
| 41 | 41 | |
| 42 | 42 | $this->object = null; |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function testProcess() |
| 47 | 47 | { |
| 48 | - $product = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->createItem(); |
|
| 48 | + $product = \Aimeos\MShop\Factory::createManager($this->context, 'product')->createItem(); |
|
| 49 | 49 | |
| 50 | - $result = $this->object->process( $product, array( 'test' ) ); |
|
| 50 | + $result = $this->object->process($product, array('test')); |
|
| 51 | 51 | |
| 52 | - $this->assertEquals( array( 'test' ), $result ); |
|
| 52 | + $this->assertEquals(array('test'), $result); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -14,44 +14,44 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 17 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 18 | 18 | |
| 19 | 19 | $context = \TestHelperCntl::getContext(); |
| 20 | - $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Catalog\Standard( $context ); |
|
| 20 | + $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Catalog\Standard($context); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | protected function tearDown() |
| 25 | 25 | { |
| 26 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 26 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 27 | 27 | \Aimeos\MShop\Factory::clear(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testGet() |
| 32 | 32 | { |
| 33 | - $result = $this->object->get( 'root' ); |
|
| 33 | + $result = $this->object->get('root'); |
|
| 34 | 34 | |
| 35 | - $this->assertNotEquals( null, $result ); |
|
| 36 | - $this->assertInternalType( 'integer', $result ); |
|
| 35 | + $this->assertNotEquals(null, $result); |
|
| 36 | + $this->assertInternalType('integer', $result); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testGetUnknown() |
| 41 | 41 | { |
| 42 | - $this->assertEquals( null, $this->object->get( 'cache-test' ) ); |
|
| 42 | + $this->assertEquals(null, $this->object->get('cache-test')); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | public function testSet() |
| 47 | 47 | { |
| 48 | - $item = \Aimeos\MShop\Factory::createManager( \TestHelperCntl::getContext(), 'catalog' )->createItem(); |
|
| 49 | - $item->setCode( 'cache-test' ); |
|
| 50 | - $item->setId( 1 ); |
|
| 48 | + $item = \Aimeos\MShop\Factory::createManager(\TestHelperCntl::getContext(), 'catalog')->createItem(); |
|
| 49 | + $item->setCode('cache-test'); |
|
| 50 | + $item->setId(1); |
|
| 51 | 51 | |
| 52 | - $this->object->set( $item ); |
|
| 53 | - $id = $this->object->get( 'cache-test' ); |
|
| 52 | + $this->object->set($item); |
|
| 53 | + $id = $this->object->get('cache-test'); |
|
| 54 | 54 | |
| 55 | - $this->assertEquals( $item->getId(), $id ); |
|
| 55 | + $this->assertEquals($item->getId(), $id); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -14,41 +14,41 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 17 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 18 | 18 | |
| 19 | 19 | $context = \TestHelperCntl::getContext(); |
| 20 | - $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Product\Standard( $context ); |
|
| 20 | + $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Product\Standard($context); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | protected function tearDown() |
| 25 | 25 | { |
| 26 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 26 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 27 | 27 | \Aimeos\MShop\Factory::clear(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testGet() |
| 32 | 32 | { |
| 33 | - $this->assertNotEquals( null, $this->object->get( 'CNC' ) ); |
|
| 33 | + $this->assertNotEquals(null, $this->object->get('CNC')); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | public function testGetUnknown() |
| 38 | 38 | { |
| 39 | - $this->assertEquals( null, $this->object->get( 'cache-test' ) ); |
|
| 39 | + $this->assertEquals(null, $this->object->get('cache-test')); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testSet() |
| 44 | 44 | { |
| 45 | - $item = \Aimeos\MShop\Factory::createManager( \TestHelperCntl::getContext(), 'product' )->createItem(); |
|
| 46 | - $item->setCode( 'cache-test' ); |
|
| 47 | - $item->setId( 1 ); |
|
| 45 | + $item = \Aimeos\MShop\Factory::createManager(\TestHelperCntl::getContext(), 'product')->createItem(); |
|
| 46 | + $item->setCode('cache-test'); |
|
| 47 | + $item->setId(1); |
|
| 48 | 48 | |
| 49 | - $this->object->set( $item ); |
|
| 50 | - $id = $this->object->get( 'cache-test' ); |
|
| 49 | + $this->object->set($item); |
|
| 50 | + $id = $this->object->get('cache-test'); |
|
| 51 | 51 | |
| 52 | - $this->assertEquals( $item->getId(), $id ); |
|
| 52 | + $this->assertEquals($item->getId(), $id); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -14,92 +14,92 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 17 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 18 | 18 | |
| 19 | 19 | $context = \TestHelperCntl::getContext(); |
| 20 | 20 | $aimeos = \TestHelperCntl::getAimeos(); |
| 21 | 21 | |
| 22 | - $this->object = new TestAbstract( $context, $aimeos ); |
|
| 22 | + $this->object = new TestAbstract($context, $aimeos); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | protected function tearDown() |
| 27 | 27 | { |
| 28 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 28 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 29 | 29 | \Aimeos\MShop\Factory::clear(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | public function testGetCache() |
| 34 | 34 | { |
| 35 | - $cache = $this->object->getCachePublic( 'attribute' ); |
|
| 35 | + $cache = $this->object->getCachePublic('attribute'); |
|
| 36 | 36 | |
| 37 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache ); |
|
| 37 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | public function testGetCacheInvalidType() |
| 42 | 42 | { |
| 43 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 44 | - $this->object->getCachePublic( '$' ); |
|
| 43 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 44 | + $this->object->getCachePublic('$'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | public function testGetCacheInvalidClass() |
| 49 | 49 | { |
| 50 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 51 | - $this->object->getCachePublic( 'unknown' ); |
|
| 50 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 51 | + $this->object->getCachePublic('unknown'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testGetCacheInvalidInterface() |
| 56 | 56 | { |
| 57 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 58 | - $this->object->getCachePublic( 'attribute', 'unknown' ); |
|
| 57 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 58 | + $this->object->getCachePublic('attribute', 'unknown'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testGetProcessors() |
| 63 | 63 | { |
| 64 | - $processor = $this->object->getProcessorsPublic( array( 'attribute' => array() ) ); |
|
| 64 | + $processor = $this->object->getProcessorsPublic(array('attribute' => array())); |
|
| 65 | 65 | |
| 66 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor ); |
|
| 66 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | public function testGetProcessorsInvalidType() |
| 71 | 71 | { |
| 72 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 73 | - $this->object->getProcessorsPublic( array( '$' => array() ) ); |
|
| 72 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 73 | + $this->object->getProcessorsPublic(array('$' => array())); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testGetProcessorsInvalidClass() |
| 78 | 78 | { |
| 79 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 80 | - $this->object->getProcessorsPublic( array( 'unknown' => array() ) ); |
|
| 79 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 80 | + $this->object->getProcessorsPublic(array('unknown' => array())); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testGetProcessorsInvalidInterface() |
| 85 | 85 | { |
| 86 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 87 | - $this->object->getProcessorsPublic( array( 'unknown' => array() ) ); |
|
| 86 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 87 | + $this->object->getProcessorsPublic(array('unknown' => array())); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | public function testGetTypeId() |
| 92 | 92 | { |
| 93 | - $typeid = $this->object->getTypeIdPublic( 'attribute/type', 'product', 'color' ); |
|
| 93 | + $typeid = $this->object->getTypeIdPublic('attribute/type', 'product', 'color'); |
|
| 94 | 94 | |
| 95 | - $this->assertNotEquals( null, $typeid ); |
|
| 95 | + $this->assertNotEquals(null, $typeid); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | public function testGetTypeIdUnknown() |
| 100 | 100 | { |
| 101 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 102 | - $this->object->getTypeIdPublic( 'attribute/type', 'product', 'unknown' ); |
|
| 101 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 102 | + $this->object->getTypeIdPublic('attribute/type', 'product', 'unknown'); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | class TestAbstract |
| 108 | 108 | extends \Aimeos\Controller\Common\Product\Import\Csv\Base |
| 109 | 109 | { |
| 110 | - public function getCachePublic( $type, $name = null ) |
|
| 110 | + public function getCachePublic($type, $name = null) |
|
| 111 | 111 | { |
| 112 | - return $this->getCache( $type, $name ); |
|
| 112 | + return $this->getCache($type, $name); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
| 116 | - public function getProcessorsPublic( array $mappings ) |
|
| 116 | + public function getProcessorsPublic(array $mappings) |
|
| 117 | 117 | { |
| 118 | - return $this->getProcessors( $mappings ); |
|
| 118 | + return $this->getProcessors($mappings); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | - public function getTypeIdPublic( $path, $domain, $code ) |
|
| 122 | + public function getTypeIdPublic($path, $domain, $code) |
|
| 123 | 123 | { |
| 124 | - return $this->getTypeId( $path, $domain, $code ); |
|
| 124 | + return $this->getTypeId($path, $domain, $code); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -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/order/cleanup/unpaid/name |
| 36 | 36 | * Class name of the used order cleanup unpaid scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @since 2014.07 |
| 66 | 66 | * @category Developer |
| 67 | 67 | */ |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $context->getConfig()->get( 'controller/jobs/order/cleanup/unpaid/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $context->getConfig()->get('controller/jobs/order/cleanup/unpaid/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\\Order\\Cleanup\\Unpaid\\' . $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\\Order\\Cleanup\\Unpaid\\' . $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\\Order\\Cleanup\\Unpaid\\' . $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/order/cleanup/unpaid/decorators/excludes |
| 84 | 84 | * Excludes decorators added by the "common" option from the order cleanup unpaid controllers |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | * @see controller/jobs/order/cleanup/unpaid/decorators/excludes |
| 155 | 155 | * @see controller/jobs/order/cleanup/unpaid/decorators/global |
| 156 | 156 | */ |
| 157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/cleanup/unpaid' ); |
|
| 157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/cleanup/unpaid'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |