1 | <?php |
||
39 | class GenericHookAwareColumnCollectorObserver extends AbstractObserver implements HookAwareInterface, ObserverFactoryInterface |
||
40 | { |
||
41 | |||
42 | /** |
||
43 | * The loader instance for the custom validations. |
||
44 | * |
||
45 | * @var \TechDivision\Import\Loaders\LoaderInterface |
||
46 | */ |
||
47 | protected $loader; |
||
48 | |||
49 | /** |
||
50 | * The registry processor instance. |
||
51 | * |
||
52 | * @var \TechDivision\Import\Services\RegistryProcessorInterface |
||
53 | */ |
||
54 | protected $registryProcessor; |
||
55 | |||
56 | /** |
||
57 | * The array with the column names to assemble the data for. |
||
58 | * |
||
59 | * @var array |
||
60 | */ |
||
61 | protected $columnNames = array(); |
||
62 | |||
63 | /** |
||
64 | * The array with the collected column values. |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $values = array(); |
||
69 | |||
70 | /** |
||
71 | * Initializes the callback with the loader instance. |
||
72 | * |
||
73 | * @param \TechDivision\Import\Loaders\LoaderInterface $loader The loader for the validations |
||
74 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
75 | */ |
||
76 | public function __construct(LoaderInterface $loader, RegistryProcessorInterface $registryProcessor) |
||
81 | |||
82 | /** |
||
83 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance. |
||
84 | * |
||
85 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
86 | * |
||
87 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance |
||
88 | */ |
||
89 | public function createObserver(SubjectInterface $subject) |
||
98 | |||
99 | /** |
||
100 | * Will be invoked by the action on the events the listener has been registered for. |
||
101 | * |
||
102 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
103 | * |
||
104 | * @return array The modified row |
||
105 | * @see \TechDivision\Import\Observers\ObserverInterface::handle() |
||
106 | */ |
||
107 | public function handle(SubjectInterface $subject) |
||
120 | |||
121 | /** |
||
122 | * Return's the loader instance for the custom validations. |
||
123 | * |
||
124 | * @return \TechDivision\Import\Loaders\LoaderInterface The loader instance |
||
125 | */ |
||
126 | protected function getLoader() |
||
130 | |||
131 | /** |
||
132 | * Return's the registry processor instance. |
||
133 | * |
||
134 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The processor instance |
||
135 | */ |
||
136 | protected function getRegistryProcessor() |
||
140 | |||
141 | /** |
||
142 | * Process the observer's business logic. |
||
143 | * |
||
144 | * @return array The processed row |
||
145 | * @throws \Exception Is thrown, if the product with the SKU can not be loaded |
||
146 | */ |
||
147 | protected function process() |
||
160 | |||
161 | /** |
||
162 | * Intializes the previously loaded global data for exactly one bunch. |
||
163 | * |
||
164 | * @param string $serial The serial of the actual import |
||
165 | * |
||
166 | * @return void |
||
167 | */ |
||
168 | public function setUp($serial) |
||
171 | |||
172 | /** |
||
173 | * Clean up the global data after importing the variants. |
||
174 | * |
||
175 | * @param string $serial The serial of the actual import |
||
176 | * |
||
177 | * @return void |
||
178 | */ |
||
179 | public function tearDown($serial) |
||
195 | } |
||
196 |
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.