1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Services\ImportProcessorFactory |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Services; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\ConfigurationInterface; |
24
|
|
|
use TechDivision\Import\Services\ImportProcessor; |
25
|
|
|
use TechDivision\Import\Assembler\CategoryAssembler; |
26
|
|
|
use TechDivision\Import\Repositories\StoreRepository; |
27
|
|
|
use TechDivision\Import\Repositories\TaxClassRepository; |
28
|
|
|
use TechDivision\Import\Repositories\LinkTypeRepository; |
29
|
|
|
use TechDivision\Import\Repositories\CategoryRepository; |
30
|
|
|
use TechDivision\Import\Repositories\StoreWebsiteRepository; |
31
|
|
|
use TechDivision\Import\Repositories\EavAttributeRepository; |
32
|
|
|
use TechDivision\Import\Repositories\EavEntityTypeRepository; |
33
|
|
|
use TechDivision\Import\Repositories\LinkAttributeRepository; |
34
|
|
|
use TechDivision\Import\Repositories\CoreConfigDataRepository; |
35
|
|
|
use TechDivision\Import\Repositories\CategoryVarcharRepository; |
36
|
|
|
use TechDivision\Import\Repositories\EavAttributeSetRepository; |
37
|
|
|
use TechDivision\Import\Utils\Generators\CoreConfigDataUidGenerator; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Factory to create a new import processor. |
41
|
|
|
* |
42
|
|
|
* @author Tim Wagner <[email protected]> |
43
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
44
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
45
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
46
|
|
|
* @link http://www.techdivision.com |
47
|
|
|
*/ |
48
|
|
|
class ImportProcessorFactory |
49
|
|
|
{ |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Factory method to create a new import processor instance. |
53
|
|
|
* |
54
|
|
|
* @param \PDO $connection The PDO connection to use |
55
|
|
|
* @param TechDivision\Import\ConfigurationInterface $configuration The subject configuration |
56
|
|
|
* |
57
|
|
|
* @return object The processor instance |
58
|
|
|
*/ |
59
|
|
|
public static function factory(\PDO $connection, ConfigurationInterface $configuration) |
60
|
|
|
{ |
61
|
|
|
|
62
|
|
|
// extract Magento edition/version |
63
|
|
|
$utilityClassName = $configuration->getUtilityClassName(); |
64
|
|
|
|
65
|
|
|
// initialize the repository that provides category query functionality |
66
|
|
|
$categoryRepository = new CategoryRepository($connection, $utilityClassName); |
|
|
|
|
67
|
|
|
$categoryRepository->init(); |
68
|
|
|
|
69
|
|
|
// initialize the repository that provides category varchar value query functionality |
70
|
|
|
$categoryVarcharRepository = new CategoryVarcharRepository($connection, $utilityClassName); |
|
|
|
|
71
|
|
|
$categoryVarcharRepository->init(); |
72
|
|
|
|
73
|
|
|
// initialize the repository that provides EAV attribute query functionality |
74
|
|
|
$eavAttributeRepository = new EavAttributeRepository($connection, $utilityClassName); |
|
|
|
|
75
|
|
|
$eavAttributeRepository->init(); |
76
|
|
|
|
77
|
|
|
// initialize the repository that provides EAV attribute set query functionality |
78
|
|
|
$eavAttributeSetRepository = new EavAttributeSetRepository($connection, $utilityClassName); |
|
|
|
|
79
|
|
|
$eavAttributeSetRepository->init(); |
80
|
|
|
|
81
|
|
|
// initialize the repository that provides EAV entity type query functionality |
82
|
|
|
$eavEntityTypeRepository = new EavEntityTypeRepository($connection, $utilityClassName); |
|
|
|
|
83
|
|
|
$eavEntityTypeRepository->init(); |
84
|
|
|
|
85
|
|
|
// initialize the repository that provides store query functionality |
86
|
|
|
$storeRepository = new StoreRepository($connection, $utilityClassName); |
|
|
|
|
87
|
|
|
$storeRepository->init(); |
88
|
|
|
|
89
|
|
|
// initialize the repository that provides store website query functionality |
90
|
|
|
$storeWebsiteRepository = new StoreWebsiteRepository($connection, $utilityClassName); |
|
|
|
|
91
|
|
|
$storeWebsiteRepository->init(); |
92
|
|
|
|
93
|
|
|
// initialize the repository that provides tax class query functionality |
94
|
|
|
$taxClassRepository = new TaxClassRepository($connection, $utilityClassName); |
|
|
|
|
95
|
|
|
$taxClassRepository->init(); |
96
|
|
|
|
97
|
|
|
// initialize the repository that provides link type query functionality |
98
|
|
|
$linkTypeRepository = new LinkTypeRepository($connection, $utilityClassName); |
|
|
|
|
99
|
|
|
$linkTypeRepository->init(); |
100
|
|
|
|
101
|
|
|
// initialize the repository that provides link attribute query functionality |
102
|
|
|
$linkAttributeRepository = new LinkAttributeRepository($connection, $utilityClassName); |
|
|
|
|
103
|
|
|
$linkAttributeRepository->init(); |
104
|
|
|
|
105
|
|
|
// initialize the repository that provides core config data functionality |
106
|
|
|
$coreConfigDataRepository = new CoreConfigDataRepository(new CoreConfigDataUidGenerator(), $connection, $utilityClassName); |
|
|
|
|
107
|
|
|
$coreConfigDataRepository->init(); |
108
|
|
|
|
109
|
|
|
// initialize the category assembler |
110
|
|
|
$categoryAssembler = new CategoryAssembler($categoryRepository, $categoryVarcharRepository); |
111
|
|
|
|
112
|
|
|
// initialize the import processor |
113
|
|
|
$importProcessor = new ImportProcessor( |
114
|
|
|
$connection, |
|
|
|
|
115
|
|
|
$categoryAssembler, |
116
|
|
|
$categoryRepository, |
117
|
|
|
$categoryVarcharRepository, |
118
|
|
|
$eavAttributeRepository, |
119
|
|
|
$eavAttributeSetRepository, |
120
|
|
|
$eavEntityTypeRepository, |
121
|
|
|
$storeRepository, |
122
|
|
|
$storeWebsiteRepository, |
123
|
|
|
$taxClassRepository, |
124
|
|
|
$linkTypeRepository, |
125
|
|
|
$linkAttributeRepository, |
126
|
|
|
$coreConfigDataRepository |
127
|
|
|
); |
128
|
|
|
|
129
|
|
|
// return the initialize import processor instance |
130
|
|
|
return $importProcessor; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.