@@ -203,7 +203,7 @@ |
||
| 203 | 203 | */ |
| 204 | 204 | public function preLoadAttributeId(array $attribute) |
| 205 | 205 | { |
| 206 | - $this->preLoadedAttributeIds[$attribute[MemberNames::ATTRIBUTE_CODE]]= $attribute[MemberNames::ATTRIBUTE_ID]; |
|
| 206 | + $this->preLoadedAttributeIds[$attribute[MemberNames::ATTRIBUTE_CODE]] = $attribute[MemberNames::ATTRIBUTE_ID]; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | unset($keys[array_search(EntityStatus::MEMBER_NAME, $keys, true)]); |
| 77 | 77 | |
| 78 | 78 | // prepare the SET part of the SQL statement |
| 79 | - array_walk($keys, function (&$value, $key) { |
|
| 79 | + array_walk($keys, function(&$value, $key) { |
|
| 80 | 80 | $value = sprintf('%s=:%s', $value, $value); |
| 81 | 81 | }); |
| 82 | 82 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $artefacts = array(); |
| 62 | 62 | |
| 63 | 63 | // load the attribute option values for the custom store views |
| 64 | - $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), function ($value) { |
|
| 64 | + $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), function($value) { |
|
| 65 | 65 | return $this->explode($value, $this->getMultipleFieldDelimiter()); |
| 66 | 66 | }); |
| 67 | 67 | |
@@ -58,13 +58,13 @@ |
||
| 58 | 58 | $artefacts = array(); |
| 59 | 59 | |
| 60 | 60 | // load the attribute option values/positions |
| 61 | - $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), function ($value) { |
|
| 61 | + $attributeOptionValues = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_VALUES, array(), function($value) { |
|
| 62 | 62 | return $this->explode($value, $this->getMultipleFieldDelimiter()); |
| 63 | 63 | }); |
| 64 | - $attributeOptionSortOrder = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SORT_ORDER, array(), function ($value) { |
|
| 64 | + $attributeOptionSortOrder = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SORT_ORDER, array(), function($value) { |
|
| 65 | 65 | return $this->explode($value, $this->getMultipleFieldDelimiter()); |
| 66 | 66 | }); |
| 67 | - $attributeOptionSwatch = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SWATCH, array(), function ($value) { |
|
| 67 | + $attributeOptionSwatch = $this->getValue(ColumnKeys::ATTRIBUTE_OPTION_SWATCH, array(), function($value) { |
|
| 68 | 68 | return $this->explode($value, $this->getMultipleValueDelimiter()); |
| 69 | 69 | }); |
| 70 | 70 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | // optimize autoloader with custom path |
| 59 | 59 | return $this->taskComposerInstall() |
| 60 | - ->preferDist() |
|
| 61 | - ->optimizeAutoloader() |
|
| 62 | - ->run(); |
|
| 60 | + ->preferDist() |
|
| 61 | + ->optimizeAutoloader() |
|
| 62 | + ->run(); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | // optimize autoloader with custom path |
| 73 | 73 | return $this->taskComposerUpdate() |
| 74 | - ->preferDist() |
|
| 75 | - ->optimizeAutoloader() |
|
| 76 | - ->run(); |
|
| 74 | + ->preferDist() |
|
| 75 | + ->optimizeAutoloader() |
|
| 76 | + ->run(); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | public function prepare() |
| 95 | 95 | { |
| 96 | 96 | return $this->taskFileSystemStack() |
| 97 | - ->mkdir($this->properties['dist.dir']) |
|
| 98 | - ->mkdir($this->properties['target.dir']) |
|
| 99 | - ->mkdir(sprintf('%s/reports', $this->properties['target.dir'])) |
|
| 100 | - ->run(); |
|
| 97 | + ->mkdir($this->properties['dist.dir']) |
|
| 98 | + ->mkdir($this->properties['target.dir']) |
|
| 99 | + ->mkdir(sprintf('%s/reports', $this->properties['target.dir'])) |
|
| 100 | + ->run(); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // run PHPUnit |
| 169 | 169 | return $this->taskPHPUnit(sprintf('%s/bin/phpunit', $this->properties['vendor.dir'])) |
| 170 | - ->configFile('phpunit.xml') |
|
| 171 | - ->run(); |
|
| 170 | + ->configFile('phpunit.xml') |
|
| 171 | + ->run(); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | { |
| 123 | 123 | // prepare the patterns for the files that has to be ignored |
| 124 | 124 | $ignore = array( |
| 125 | - $this->properties['vendor.dir'].'/techdivision/import-attribute-set/src/Utils', |
|
| 125 | + $this->properties['vendor.dir'] . '/techdivision/import-attribute-set/src/Utils', |
|
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | 128 | // run the copy past detector |
@@ -57,14 +57,14 @@ |
||
| 57 | 57 | |
| 58 | 58 | // add debug log entry |
| 59 | 59 | $this->getSubject() |
| 60 | - ->getSystemLogger() |
|
| 61 | - ->debug( |
|
| 62 | - sprintf( |
|
| 63 | - 'Successfully copied image %s for swatch with id %s', |
|
| 64 | - $imagePath, |
|
| 65 | - $attributeOptionSwatch[MemberNames::SWATCH_ID] |
|
| 66 | - ) |
|
| 67 | - ); |
|
| 60 | + ->getSystemLogger() |
|
| 61 | + ->debug( |
|
| 62 | + sprintf( |
|
| 63 | + 'Successfully copied image %s for swatch with id %s', |
|
| 64 | + $imagePath, |
|
| 65 | + $attributeOptionSwatch[MemberNames::SWATCH_ID] |
|
| 66 | + ) |
|
| 67 | + ); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | )); |
| 48 | 48 | |
| 49 | 49 | // skip this step for color swatches and text swatches |
| 50 | - if (isset($attributeOptionSwatch[MemberNames::TYPE]) && $attributeOptionSwatch[MemberNames::TYPE] === SwatchTypes::IMAGE) { |
|
| 50 | + if (isset($attributeOptionSwatch[MemberNames::TYPE]) && $attributeOptionSwatch[MemberNames::TYPE] === SwatchTypes::IMAGE) { |
|
| 51 | 51 | // upload the file to the configured directory |
| 52 | 52 | $imagePath = $this->getSubject()->uploadFile($attributeOptionSwatch[MemberNames::VALUE]); |
| 53 | 53 | |
@@ -86,8 +86,8 @@ |
||
| 86 | 86 | // load the columns from the metadata |
| 87 | 87 | $columns = array_filter( |
| 88 | 88 | $columnMetadataLoader->load($entityType), |
| 89 | - function ($value) { |
|
| 90 | - return $value['Key'] !== 'PRI' && $value['Null'] === 'NO' ; |
|
| 89 | + function($value) { |
|
| 90 | + return $value['Key'] !== 'PRI' && $value['Null'] === 'NO'; |
|
| 91 | 91 | } |
| 92 | 92 | ); |
| 93 | 93 | // initialize the raw entities and their default values, if available |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // mock the attribute bunch processor |
| 95 | 95 | $this->mockBunchProcessor = $this->getMockBuilder('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface') |
| 96 | - ->setMethods(get_class_methods('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface')) |
|
| 97 | - ->getMock(); |
|
| 96 | + ->setMethods(get_class_methods('TechDivision\Import\Attribute\Services\AttributeBunchProcessorInterface')) |
|
| 97 | + ->getMock(); |
|
| 98 | 98 | |
| 99 | 99 | // the observer instance we want to test |
| 100 | 100 | $this->observer = new CatalogAttributeObserver($this->mockBunchProcessor); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | array(ColumnKeys::IS_FILTERABLE_IN_GRID), |
| 149 | 149 | array(ColumnKeys::SEARCH_WEIGHT), |
| 150 | 150 | array(ColumnKeys::ADDITIONAL_DATA) |
| 151 | - ) |
|
| 151 | + ) |
|
| 152 | 152 | ->willReturnOnConsecutiveCalls( |
| 153 | 153 | true, |
| 154 | 154 | false, |
@@ -190,23 +190,23 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | // mock the method that persists the entity |
| 192 | 192 | $this->mockBunchProcessor->expects($this->once()) |
| 193 | - ->method('persistCatalogAttribute') |
|
| 194 | - ->with( |
|
| 195 | - array_merge( |
|
| 196 | - array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 197 | - $this->rawEntity, |
|
| 198 | - array(EntityStatus::MEMBER_NAME => EntityStatus::STATUS_CREATE) |
|
| 199 | - ) |
|
| 200 | - ) |
|
| 201 | - ->willReturn(null); |
|
| 193 | + ->method('persistCatalogAttribute') |
|
| 194 | + ->with( |
|
| 195 | + array_merge( |
|
| 196 | + array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 197 | + $this->rawEntity, |
|
| 198 | + array(EntityStatus::MEMBER_NAME => EntityStatus::STATUS_CREATE) |
|
| 199 | + ) |
|
| 200 | + ) |
|
| 201 | + ->willReturn(null); |
|
| 202 | 202 | $this->mockBunchProcessor->expects($this->once()) |
| 203 | - ->method('loadRawEntity') |
|
| 204 | - ->willReturn( |
|
| 205 | - array_merge( |
|
| 206 | - array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 207 | - $this->rawEntity |
|
| 208 | - ) |
|
| 209 | - ); |
|
| 203 | + ->method('loadRawEntity') |
|
| 204 | + ->willReturn( |
|
| 205 | + array_merge( |
|
| 206 | + array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 207 | + $this->rawEntity |
|
| 208 | + ) |
|
| 209 | + ); |
|
| 210 | 210 | |
| 211 | 211 | // invoke the handle method |
| 212 | 212 | $this->assertSame($row, $this->observer->handle($mockSubject)); |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // mock the attribute bunch processor |
| 105 | 105 | $this->mockBunchProcessor = $this->getMockBuilder(AttributeBunchProcessorInterface::class) |
| 106 | - ->setMethods(get_class_methods(AttributeBunchProcessorInterface::class)) |
|
| 107 | - ->getMock(); |
|
| 106 | + ->setMethods(get_class_methods(AttributeBunchProcessorInterface::class)) |
|
| 107 | + ->getMock(); |
|
| 108 | 108 | |
| 109 | 109 | $this->mockEntityMerger = $this->getMockBuilder(EntityMergerInterface::class) |
| 110 | - ->setMethods(get_class_methods(EntityMergerInterface::class)) |
|
| 111 | - ->getMock(); |
|
| 110 | + ->setMethods(get_class_methods(EntityMergerInterface::class)) |
|
| 111 | + ->getMock(); |
|
| 112 | 112 | |
| 113 | 113 | // the observer instance we want to test |
| 114 | 114 | $this->observer = new CatalogAttributeUpdateObserver($this->mockBunchProcessor, $this->mockEntityMerger); |
@@ -190,36 +190,36 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | // mock the method that loads the existing entity |
| 192 | 192 | $this->mockBunchProcessor->expects($this->once()) |
| 193 | - ->method('loadCatalogAttribute') |
|
| 194 | - ->with($lastAttributeId) |
|
| 195 | - ->willReturn($existingEntity); |
|
| 193 | + ->method('loadCatalogAttribute') |
|
| 194 | + ->with($lastAttributeId) |
|
| 195 | + ->willReturn($existingEntity); |
|
| 196 | 196 | // mock the method that persists the entity |
| 197 | 197 | $this->mockBunchProcessor->expects($this->once()) |
| 198 | - ->method('persistCatalogAttribute') |
|
| 199 | - ->with($expectedEntity) |
|
| 200 | - ->willReturn(null); |
|
| 198 | + ->method('persistCatalogAttribute') |
|
| 199 | + ->with($expectedEntity) |
|
| 200 | + ->willReturn(null); |
|
| 201 | 201 | // mock the method that loads the raw entity |
| 202 | 202 | $this->mockBunchProcessor->expects($this->once()) |
| 203 | - ->method('loadRawEntity') |
|
| 204 | - ->willReturn( |
|
| 205 | - array_merge( |
|
| 206 | - array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 207 | - $this->rawEntity |
|
| 208 | - ) |
|
| 209 | - ); |
|
| 203 | + ->method('loadRawEntity') |
|
| 204 | + ->willReturn( |
|
| 205 | + array_merge( |
|
| 206 | + array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 207 | + $this->rawEntity |
|
| 208 | + ) |
|
| 209 | + ); |
|
| 210 | 210 | |
| 211 | 211 | // mock the entity merger method |
| 212 | 212 | $this->mockEntityMerger->expects($this->any()) |
| 213 | - ->method('merge') |
|
| 214 | - ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 215 | - foreach (array_keys($attr) as $key) { |
|
| 216 | - if (isset($headers[$key])) { |
|
| 217 | - continue; |
|
| 218 | - } |
|
| 219 | - unset($attr[$key]); |
|
| 220 | - } |
|
| 221 | - return $attr; |
|
| 222 | - }); |
|
| 213 | + ->method('merge') |
|
| 214 | + ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 215 | + foreach (array_keys($attr) as $key) { |
|
| 216 | + if (isset($headers[$key])) { |
|
| 217 | + continue; |
|
| 218 | + } |
|
| 219 | + unset($attr[$key]); |
|
| 220 | + } |
|
| 221 | + return $attr; |
|
| 222 | + }); |
|
| 223 | 223 | |
| 224 | 224 | // invoke the handle method |
| 225 | 225 | $this->assertSame($row, $this->observer->handle($mockSubject)); |
@@ -403,36 +403,36 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // mock the method that loads the existing entity |
| 405 | 405 | $this->mockBunchProcessor->expects($this->once()) |
| 406 | - ->method('loadCatalogAttribute') |
|
| 407 | - ->with($lastAttributeId) |
|
| 408 | - ->willReturn($existingEntity); |
|
| 406 | + ->method('loadCatalogAttribute') |
|
| 407 | + ->with($lastAttributeId) |
|
| 408 | + ->willReturn($existingEntity); |
|
| 409 | 409 | // mock the method that persists the entity |
| 410 | 410 | $this->mockBunchProcessor->expects($this->once()) |
| 411 | - ->method('persistCatalogAttribute') |
|
| 412 | - ->with($expectedEntity) |
|
| 413 | - ->willReturn(null); |
|
| 411 | + ->method('persistCatalogAttribute') |
|
| 412 | + ->with($expectedEntity) |
|
| 413 | + ->willReturn(null); |
|
| 414 | 414 | // mock the method that loads the raw entity |
| 415 | 415 | $this->mockBunchProcessor->expects($this->once()) |
| 416 | - ->method('loadRawEntity') |
|
| 417 | - ->willReturn( |
|
| 418 | - array_merge( |
|
| 419 | - array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 420 | - $this->rawEntity |
|
| 421 | - ) |
|
| 422 | - ); |
|
| 416 | + ->method('loadRawEntity') |
|
| 417 | + ->willReturn( |
|
| 418 | + array_merge( |
|
| 419 | + array(MemberNames::ATTRIBUTE_ID => $lastAttributeId), |
|
| 420 | + $this->rawEntity |
|
| 421 | + ) |
|
| 422 | + ); |
|
| 423 | 423 | |
| 424 | 424 | // mock the entity merger method |
| 425 | 425 | $this->mockEntityMerger->expects($this->any()) |
| 426 | - ->method('merge') |
|
| 427 | - ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 428 | - foreach (array_keys($attr) as $key) { |
|
| 429 | - if (isset($headers[$key])) { |
|
| 430 | - continue; |
|
| 431 | - } |
|
| 432 | - unset($attr[$key]); |
|
| 433 | - } |
|
| 434 | - return $attr; |
|
| 435 | - }); |
|
| 426 | + ->method('merge') |
|
| 427 | + ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 428 | + foreach (array_keys($attr) as $key) { |
|
| 429 | + if (isset($headers[$key])) { |
|
| 430 | + continue; |
|
| 431 | + } |
|
| 432 | + unset($attr[$key]); |
|
| 433 | + } |
|
| 434 | + return $attr; |
|
| 435 | + }); |
|
| 436 | 436 | // invoke the handle method |
| 437 | 437 | $this->assertSame($row, $this->observer->handle($mockSubject)); |
| 438 | 438 | } |
@@ -137,16 +137,16 @@ discard block |
||
| 137 | 137 | ->willReturn($row); |
| 138 | 138 | $mockSubject->expects($this->any()) |
| 139 | 139 | ->method('hasHeader') |
| 140 | - ->willReturnCallback(function ($key) use ($headers) { |
|
| 140 | + ->willReturnCallback(function($key) use ($headers) { |
|
| 141 | 141 | return array_key_exists($key, $headers); |
| 142 | 142 | }); |
| 143 | 143 | $mockSubject->expects($this->any()) |
| 144 | 144 | ->method('getHeader') |
| 145 | - ->willReturnCallback(function ($key) use ($headers) { |
|
| 145 | + ->willReturnCallback(function($key) use ($headers) { |
|
| 146 | 146 | if (array_key_exists($key, $headers)) { |
| 147 | 147 | return $headers[$key]; |
| 148 | 148 | } |
| 149 | - throw new \InvalidArgumentException(sprintf('Header %s is not available', $key));; |
|
| 149 | + throw new \InvalidArgumentException(sprintf('Header %s is not available', $key)); ; |
|
| 150 | 150 | }); |
| 151 | 151 | $mockSubject->expects($this->once()) |
| 152 | 152 | ->method('hasBeenProcessed') |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // mock the entity merger method |
| 212 | 212 | $this->mockEntityMerger->expects($this->any()) |
| 213 | 213 | ->method('merge') |
| 214 | - ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 214 | + ->willReturnCallback(function($observer, $entity, $attr) use ($headers) { |
|
| 215 | 215 | foreach (array_keys($attr) as $key) { |
| 216 | 216 | if (isset($headers[$key])) { |
| 217 | 217 | continue; |
@@ -331,16 +331,16 @@ discard block |
||
| 331 | 331 | ->willReturn($lastAttributeId = 1001); |
| 332 | 332 | $mockSubject->expects($this->any()) |
| 333 | 333 | ->method('hasHeader') |
| 334 | - ->willReturnCallback(function ($key) use ($headers) { |
|
| 334 | + ->willReturnCallback(function($key) use ($headers) { |
|
| 335 | 335 | return array_key_exists($key, $headers); |
| 336 | 336 | }); |
| 337 | 337 | $mockSubject->expects($this->any()) |
| 338 | 338 | ->method('getHeader') |
| 339 | - ->willReturnCallback(function ($key) use ($headers) { |
|
| 339 | + ->willReturnCallback(function($key) use ($headers) { |
|
| 340 | 340 | if (array_key_exists($key, $headers)) { |
| 341 | 341 | return $headers[$key]; |
| 342 | 342 | } |
| 343 | - throw new \InvalidArgumentException(sprintf('Header %s is not available', $key));; |
|
| 343 | + throw new \InvalidArgumentException(sprintf('Header %s is not available', $key)); ; |
|
| 344 | 344 | }); |
| 345 | 345 | |
| 346 | 346 | // initialize the existing entity |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | // mock the entity merger method |
| 425 | 425 | $this->mockEntityMerger->expects($this->any()) |
| 426 | 426 | ->method('merge') |
| 427 | - ->willReturnCallback(function ($observer, $entity, $attr) use ($headers) { |
|
| 427 | + ->willReturnCallback(function($observer, $entity, $attr) use ($headers) { |
|
| 428 | 428 | foreach (array_keys($attr) as $key) { |
| 429 | 429 | if (isset($headers[$key])) { |
| 430 | 430 | continue; |