@@ -16,49 +16,49 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - \Aimeos\MShop::cache( true ); |
|
19 | + \Aimeos\MShop::cache(true); |
|
20 | 20 | |
21 | 21 | $context = \TestHelperCntl::getContext(); |
22 | - $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Attribute\Standard( $context ); |
|
22 | + $this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Attribute\Standard($context); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | protected function tearDown() |
27 | 27 | { |
28 | - \Aimeos\MShop::cache( false ); |
|
28 | + \Aimeos\MShop::cache(false); |
|
29 | 29 | \Aimeos\MShop::clear(); |
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testGet() |
34 | 34 | { |
35 | - $item = $this->object->get( 'black', 'color' ); |
|
35 | + $item = $this->object->get('black', 'color'); |
|
36 | 36 | |
37 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item ); |
|
38 | - $this->assertEquals( 'black', $item->getCode() ); |
|
39 | - $this->assertEquals( 'color', $item->getType() ); |
|
37 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item); |
|
38 | + $this->assertEquals('black', $item->getCode()); |
|
39 | + $this->assertEquals('color', $item->getType()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | 43 | public function testGetUnknown() |
44 | 44 | { |
45 | - $this->assertEquals( null, $this->object->get( 'cache-test', 'color' ) ); |
|
45 | + $this->assertEquals(null, $this->object->get('cache-test', 'color')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testSet() |
50 | 50 | { |
51 | - $item = $this->object->get( 'black', 'color' ); |
|
51 | + $item = $this->object->get('black', 'color'); |
|
52 | 52 | |
53 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item ); |
|
53 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item); |
|
54 | 54 | |
55 | - $item->setCode( 'cache-test' ); |
|
55 | + $item->setCode('cache-test'); |
|
56 | 56 | |
57 | - $this->object->set( $item ); |
|
58 | - $item = $this->object->get( 'cache-test', 'color' ); |
|
57 | + $this->object->set($item); |
|
58 | + $item = $this->object->get('cache-test', 'color'); |
|
59 | 59 | |
60 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item ); |
|
61 | - $this->assertEquals( 'cache-test', $item->getCode() ); |
|
62 | - $this->assertEquals( 'color', $item->getType() ); |
|
60 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item); |
|
61 | + $this->assertEquals('cache-test', $item->getCode()); |
|
62 | + $this->assertEquals('color', $item->getType()); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - \Aimeos\MShop::cache( true ); |
|
19 | + \Aimeos\MShop::cache(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::cache( false ); |
|
30 | + \Aimeos\MShop::cache(false); |
|
31 | 31 | \Aimeos\MShop::clear(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | public function testGetCacheInvalidType() |
36 | 36 | { |
37 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
38 | - $this->object->getCachePublic( '$' ); |
|
37 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
38 | + $this->object->getCachePublic('$'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testGetCacheInvalidClass() |
43 | 43 | { |
44 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
45 | - $this->object->getCachePublic( 'unknown' ); |
|
44 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
45 | + $this->object->getCachePublic('unknown'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testGetProcessors() |
50 | 50 | { |
51 | - $processor = $this->object->getProcessorsPublic( array( 'media' => [] ) ); |
|
51 | + $processor = $this->object->getProcessorsPublic(array('media' => [])); |
|
52 | 52 | |
53 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor ); |
|
53 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testGetProcessorsInvalidType() |
58 | 58 | { |
59 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
60 | - $this->object->getProcessorsPublic( array( '$' => [] ) ); |
|
59 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
60 | + $this->object->getProcessorsPublic(array('$' => [])); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testGetProcessorsInvalidClass() |
65 | 65 | { |
66 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
67 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
66 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
67 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | 71 | public function testGetProcessorsInvalidInterface() |
72 | 72 | { |
73 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
74 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
73 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
74 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | class TestAbstract |
80 | 80 | extends \Aimeos\Controller\Common\Catalog\Import\Csv\Base |
81 | 81 | { |
82 | - public function getCachePublic( $type, $name = null ) |
|
82 | + public function getCachePublic($type, $name = null) |
|
83 | 83 | { |
84 | - return $this->getCache( $type, $name ); |
|
84 | + return $this->getCache($type, $name); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | - public function getProcessorsPublic( array $mappings ) |
|
88 | + public function getProcessorsPublic(array $mappings) |
|
89 | 89 | { |
90 | - return $this->getProcessors( $mappings ); |
|
90 | + return $this->getProcessors($mappings); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop::cache( true ); |
|
21 | + \Aimeos\MShop::cache(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::cache( false ); |
|
32 | + \Aimeos\MShop::cache(false); |
|
33 | 33 | \Aimeos\MShop::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 |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop::cache( true ); |
|
21 | + \Aimeos\MShop::cache(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::cache( false ); |
|
32 | + \Aimeos\MShop::cache(false); |
|
33 | 33 | \Aimeos\MShop::clear(); |
34 | 34 | |
35 | 35 | $this->object = null; |
@@ -38,40 +38,40 @@ 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 | |
52 | 52 | public function testRun() |
53 | 53 | { |
54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 ); |
|
54 | + $this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5); |
|
55 | 55 | |
56 | 56 | $this->object->run(); |
57 | 57 | |
58 | 58 | $ds = DIRECTORY_SEPARATOR; |
59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
61 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
59 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
60 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
61 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
62 | 62 | |
63 | - $file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 ); |
|
64 | - $file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 ); |
|
65 | - $index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 ); |
|
63 | + $file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000); |
|
64 | + $file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000); |
|
65 | + $index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000); |
|
66 | 66 | |
67 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
68 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
69 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
67 | + unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
68 | + unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
69 | + unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
70 | 70 | |
71 | - $this->assertContains( 'Cafe_Noire_Expresso', $file2 ); |
|
72 | - $this->assertContains( 'Unittest%3A_Bundle', $file2 ); |
|
71 | + $this->assertContains('Cafe_Noire_Expresso', $file2); |
|
72 | + $this->assertContains('Unittest%3A_Bundle', $file2); |
|
73 | 73 | |
74 | - $this->assertContains( 'aimeos-sitemap-1.xml.gz', $index ); |
|
75 | - $this->assertContains( 'aimeos-sitemap-2.xml.gz', $index ); |
|
74 | + $this->assertContains('aimeos-sitemap-1.xml.gz', $index); |
|
75 | + $this->assertContains('aimeos-sitemap-2.xml.gz', $index); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -19,18 +19,18 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function setUp() |
21 | 21 | { |
22 | - \Aimeos\MShop::cache( true ); |
|
22 | + \Aimeos\MShop::cache(true); |
|
23 | 23 | |
24 | 24 | $this->context = \TestHelperJobs::getContext(); |
25 | 25 | $this->aimeos = \TestHelperJobs::getAimeos(); |
26 | 26 | |
27 | - $this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard( $this->context, $this->aimeos ); |
|
27 | + $this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard($this->context, $this->aimeos); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - \Aimeos\MShop::cache( false ); |
|
33 | + \Aimeos\MShop::cache(false); |
|
34 | 34 | \Aimeos\MShop::clear(); |
35 | 35 | |
36 | 36 | $this->object = null; |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | |
40 | 40 | public function testGetName() |
41 | 41 | { |
42 | - $this->assertEquals( 'Products bought together', $this->object->getName() ); |
|
42 | + $this->assertEquals('Products bought together', $this->object->getName()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testGetDescription() |
47 | 47 | { |
48 | 48 | $text = 'Creates bought together product suggestions'; |
49 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
49 | + $this->assertEquals($text, $this->object->getDescription()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testRun() |
54 | 54 | { |
55 | - $stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' ) |
|
56 | - ->setConstructorArgs( array( $this->context ) ) |
|
57 | - ->setMethods( array( 'deleteItems', 'saveItem' ) ) |
|
55 | + $stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard') |
|
56 | + ->setConstructorArgs(array($this->context)) |
|
57 | + ->setMethods(array('deleteItems', 'saveItem')) |
|
58 | 58 | ->getMock(); |
59 | 59 | |
60 | - \Aimeos\MShop::inject( $this->context, 'product/lists', $stub ); |
|
60 | + \Aimeos\MShop::inject($this->context, 'product/lists', $stub); |
|
61 | 61 | |
62 | - $stub->expects( $this->atLeastOnce() )->method( 'deleteItems' ); |
|
63 | - $stub->expects( $this->atLeastOnce() )->method( 'saveItem' ); |
|
62 | + $stub->expects($this->atLeastOnce())->method('deleteItems'); |
|
63 | + $stub->expects($this->atLeastOnce())->method('saveItem'); |
|
64 | 64 | |
65 | 65 | $this->object->run(); |
66 | 66 | } |
@@ -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::create( $this->getContext(), 'product' ); |
|
51 | + $manager = \Aimeos\MShop::create($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 |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
42 | 42 | */ |
43 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
43 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
44 | 44 | { |
45 | - parent::__construct( $context ); |
|
45 | + parent::__construct($context); |
|
46 | 46 | |
47 | - $manager = \Aimeos\MShop::create( $context, 'catalog' ); |
|
48 | - $result = $manager->searchItems( $manager->createSearch() ); |
|
47 | + $manager = \Aimeos\MShop::create($context, 'catalog'); |
|
48 | + $result = $manager->searchItems($manager->createSearch()); |
|
49 | 49 | |
50 | - foreach( $result as $id => $item ) { |
|
51 | - $this->categories[ $item->getCode() ] = $id; |
|
50 | + foreach ($result as $id => $item) { |
|
51 | + $this->categories[$item->getCode()] = $id; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | * @param string|null $type Not used |
61 | 61 | * @return string|null Catalog ID or null if not found |
62 | 62 | */ |
63 | - public function get( $code, $type = null ) |
|
63 | + public function get($code, $type = null) |
|
64 | 64 | { |
65 | - if( isset( $this->categories[$code] ) ) { |
|
65 | + if (isset($this->categories[$code])) { |
|
66 | 66 | return $this->categories[$code]; |
67 | 67 | } |
68 | 68 | |
69 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); |
|
69 | + $manager = \Aimeos\MShop::create($this->getContext(), 'catalog'); |
|
70 | 70 | |
71 | 71 | $search = $manager->createSearch(); |
72 | - $search->setConditions( $search->compare( '==', 'catalog.code', $code ) ); |
|
72 | + $search->setConditions($search->compare('==', 'catalog.code', $code)); |
|
73 | 73 | |
74 | - $result = $manager->searchItems( $search ); |
|
74 | + $result = $manager->searchItems($search); |
|
75 | 75 | |
76 | - if( ( $item = reset( $result ) ) !== false ) |
|
76 | + if (($item = reset($result)) !== false) |
|
77 | 77 | { |
78 | 78 | $this->categories[$code] = $item->getId(); |
79 | 79 | return $item->getId(); |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param \Aimeos\MShop\Common\Item\Iface $item Catalog object |
88 | 88 | */ |
89 | - public function set( \Aimeos\MShop\Common\Item\Iface $item ) |
|
89 | + public function set(\Aimeos\MShop\Common\Item\Iface $item) |
|
90 | 90 | { |
91 | - $this->categories[ $item->getCode() ] = $item->getId(); |
|
91 | + $this->categories[$item->getCode()] = $item->getId(); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | \ No newline at end of file |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
42 | 42 | */ |
43 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
43 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
44 | 44 | { |
45 | - parent::__construct( $context ); |
|
45 | + parent::__construct($context); |
|
46 | 46 | |
47 | - $manager = \Aimeos\MShop::create( $context, 'attribute' ); |
|
48 | - $result = $manager->searchItems( $manager->createSearch() ); |
|
47 | + $manager = \Aimeos\MShop::create($context, 'attribute'); |
|
48 | + $result = $manager->searchItems($manager->createSearch()); |
|
49 | 49 | |
50 | - foreach( $result as $id => $item ) { |
|
51 | - $this->attributes[ $item->getCode() ][ $item->getType() ] = $item; |
|
50 | + foreach ($result as $id => $item) { |
|
51 | + $this->attributes[$item->getCode()][$item->getType()] = $item; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | * @param string|null $type Attribute type |
61 | 61 | * @return \Aimeos\MShop\Attribute\Item\Iface|null Attribute object or null if not found |
62 | 62 | */ |
63 | - public function get( $code, $type = null ) |
|
63 | + public function get($code, $type = null) |
|
64 | 64 | { |
65 | - if( isset( $this->attributes[$code] ) && isset( $this->attributes[$code][$type] ) ) { |
|
65 | + if (isset($this->attributes[$code]) && isset($this->attributes[$code][$type])) { |
|
66 | 66 | return $this->attributes[$code][$type]; |
67 | 67 | } |
68 | 68 | |
69 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'attribute' ); |
|
69 | + $manager = \Aimeos\MShop::create($this->getContext(), 'attribute'); |
|
70 | 70 | |
71 | 71 | $search = $manager->createSearch(); |
72 | 72 | $expr = array( |
73 | - $search->compare( '==', 'attribute.code', $code ), |
|
74 | - $search->compare( '==', 'attribute.type', $type ), |
|
73 | + $search->compare('==', 'attribute.code', $code), |
|
74 | + $search->compare('==', 'attribute.type', $type), |
|
75 | 75 | ); |
76 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
76 | + $search->setConditions($search->combine('&&', $expr)); |
|
77 | 77 | |
78 | - $result = $manager->searchItems( $search ); |
|
78 | + $result = $manager->searchItems($search); |
|
79 | 79 | |
80 | - if( ( $item = reset( $result ) ) !== false ) |
|
80 | + if (($item = reset($result)) !== false) |
|
81 | 81 | { |
82 | 82 | $this->attributes[$code][$type] = $item; |
83 | 83 | return $item; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param \Aimeos\MShop\Common\Item\Iface $item Attribute object |
92 | 92 | */ |
93 | - public function set( \Aimeos\MShop\Common\Item\Iface $item ) |
|
93 | + public function set(\Aimeos\MShop\Common\Item\Iface $item) |
|
94 | 94 | { |
95 | 95 | $code = $item->getCode(); |
96 | 96 | |
97 | - if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) { |
|
97 | + if (!isset($this->attributes[$code]) || !is_array($this->attributes[$code])) { |
|
98 | 98 | $this->attributes[$code] = []; |
99 | 99 | } |
100 | 100 | |
101 | - $this->attributes[$code][ $item->getType() ] = $item; |
|
101 | + $this->attributes[$code][$item->getType()] = $item; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | \ No newline at end of file |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
44 | 44 | * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object Decorated processor |
45 | 45 | */ |
46 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | - \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null ) |
|
46 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null) |
|
48 | 48 | { |
49 | - parent::__construct( $context, $mapping, $object ); |
|
49 | + parent::__construct($context, $mapping, $object); |
|
50 | 50 | |
51 | 51 | /** controller/common/product/import/csv/processor/product/listtypes |
52 | 52 | * Names of the product list types that are updated or removed |
@@ -74,26 +74,26 @@ discard block |
||
74 | 74 | * @see controller/common/product/import/csv/processor/text/listtypes |
75 | 75 | */ |
76 | 76 | $key = 'controller/common/product/import/csv/processor/product/listtypes'; |
77 | - $this->listTypes = $context->getConfig()->get( $key, ['default', 'suggestion'] ); |
|
77 | + $this->listTypes = $context->getConfig()->get($key, ['default', 'suggestion']); |
|
78 | 78 | |
79 | - if( $this->listTypes === null ) |
|
79 | + if ($this->listTypes === null) |
|
80 | 80 | { |
81 | 81 | $this->listTypes = []; |
82 | - $manager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
82 | + $manager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
83 | 83 | |
84 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
85 | - $search->setConditions( $search->compare( '==', 'product.lists.type.domain', 'product' ) ); |
|
84 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
85 | + $search->setConditions($search->compare('==', 'product.lists.type.domain', 'product')); |
|
86 | 86 | |
87 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
87 | + foreach ($manager->searchItems($search) as $item) { |
|
88 | 88 | $this->listTypes[$item->getCode()] = $item->getCode(); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
93 | - $this->listTypes = array_flip( $this->listTypes ); |
|
93 | + $this->listTypes = array_flip($this->listTypes); |
|
94 | 94 | } |
95 | 95 | |
96 | - $this->cache = $this->getCache( 'product' ); |
|
96 | + $this->cache = $this->getCache('product'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -104,47 +104,47 @@ discard block |
||
104 | 104 | * @param array $data List of CSV fields with position as key and data as value |
105 | 105 | * @return array List of data which has not been imported |
106 | 106 | */ |
107 | - public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) |
|
107 | + public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data) |
|
108 | 108 | { |
109 | 109 | $context = $this->getContext(); |
110 | - $manager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
111 | - $separator = $context->getConfig()->get( 'controller/common/product/import/csv/separator', "\n" ); |
|
110 | + $manager = \Aimeos\MShop::create($context, 'product/lists'); |
|
111 | + $separator = $context->getConfig()->get('controller/common/product/import/csv/separator', "\n"); |
|
112 | 112 | |
113 | - $listItems = $product->getListItems( 'product', null, null, false ); |
|
114 | - $this->cache->set( $product ); |
|
113 | + $listItems = $product->getListItems('product', null, null, false); |
|
114 | + $this->cache->set($product); |
|
115 | 115 | |
116 | - foreach( $this->getMappedChunk( $data, $this->getMapping() ) as $list ) |
|
116 | + foreach ($this->getMappedChunk($data, $this->getMapping()) as $list) |
|
117 | 117 | { |
118 | - if( $this->checkEntry( $list ) === false ) { |
|
118 | + if ($this->checkEntry($list) === false) { |
|
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | |
122 | - $listtype = $this->getValue( $list, 'product.lists.type', 'default' ); |
|
122 | + $listtype = $this->getValue($list, 'product.lists.type', 'default'); |
|
123 | 123 | |
124 | - foreach( explode( $separator, $this->getValue( $list, 'product.code', '' ) ) as $code ) |
|
124 | + foreach (explode($separator, $this->getValue($list, 'product.code', '')) as $code) |
|
125 | 125 | { |
126 | - $code = trim( $code ); |
|
126 | + $code = trim($code); |
|
127 | 127 | |
128 | - if( ( $prodid = $this->cache->get( $code ) ) === null ) |
|
128 | + if (($prodid = $this->cache->get($code)) === null) |
|
129 | 129 | { |
130 | 130 | $msg = 'No product for code "%1$s" available when importing product with code "%2$s"'; |
131 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( $msg, $code, $product->getCode() ) ); |
|
131 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf($msg, $code, $product->getCode())); |
|
132 | 132 | } |
133 | 133 | |
134 | - if( ( $listItem = $product->getListItem( 'product', $listtype, $prodid ) ) === null ) { |
|
135 | - $listItem = $manager->createItem()->setType( $listtype ); |
|
134 | + if (($listItem = $product->getListItem('product', $listtype, $prodid)) === null) { |
|
135 | + $listItem = $manager->createItem()->setType($listtype); |
|
136 | 136 | } else { |
137 | - unset( $listItems[$listItem->getId()] ); |
|
137 | + unset($listItems[$listItem->getId()]); |
|
138 | 138 | } |
139 | 139 | |
140 | - $listItem = $listItem->fromArray( $list )->setRefId( $prodid ); |
|
141 | - $product->addListItem( 'product', $listItem ); |
|
140 | + $listItem = $listItem->fromArray($list)->setRefId($prodid); |
|
141 | + $product->addListItem('product', $listItem); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - $product->deleteListItems( $listItems ); |
|
145 | + $product->deleteListItems($listItems); |
|
146 | 146 | |
147 | - return $this->getObject()->process( $product, $data ); |
|
147 | + return $this->getObject()->process($product, $data); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | * @param array $list Associative list of key/value pairs from the mapping |
155 | 155 | * @return boolean True if valid, false if not |
156 | 156 | */ |
157 | - protected function checkEntry( array $list ) |
|
157 | + protected function checkEntry(array $list) |
|
158 | 158 | { |
159 | - if( $this->getValue( $list, 'product.code' ) === null ) { |
|
159 | + if ($this->getValue($list, 'product.code') === null) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - if( ( $type = $this->getValue( $list, 'product.lists.type' ) ) && !isset( $this->listTypes[$type] ) ) |
|
163 | + if (($type = $this->getValue($list, 'product.lists.type')) && !isset($this->listTypes[$type])) |
|
164 | 164 | { |
165 | - $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'product list' ); |
|
166 | - throw new \Aimeos\Controller\Common\Exception( $msg ); |
|
165 | + $msg = sprintf('Invalid type "%1$s" (%2$s)', $type, 'product list'); |
|
166 | + throw new \Aimeos\Controller\Common\Exception($msg); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return true; |