1 | <?php |
||
40 | abstract class AbstractColumnCollectorObserver extends AbstractObserver implements HookAwareInterface, ObserverFactoryInterface |
||
41 | { |
||
42 | |||
43 | /** |
||
44 | * The loader instance for the custom validations. |
||
45 | * |
||
46 | * @var \TechDivision\Import\Loaders\LoaderInterface |
||
47 | */ |
||
48 | private $loader; |
||
49 | |||
50 | /** |
||
51 | * The registry processor instance. |
||
52 | * |
||
53 | * @var \TechDivision\Import\Services\RegistryProcessorInterface |
||
54 | */ |
||
55 | private $registryProcessor; |
||
56 | |||
57 | /** |
||
58 | * The flag to query whether or not the value has to be validated on the main row only. |
||
59 | * |
||
60 | * @var boolean |
||
61 | */ |
||
62 | private $mainRowOnly = false; |
||
63 | |||
64 | /** |
||
65 | * The array with the column names to assemble the data for. |
||
66 | * |
||
67 | * @var array |
||
68 | */ |
||
69 | private $columnNames = array(); |
||
70 | |||
71 | /** |
||
72 | * The array with the collected column values. |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | private $values = array(); |
||
77 | |||
78 | /** |
||
79 | * Initializes the callback with the loader instance. |
||
80 | * |
||
81 | * @param \TechDivision\Import\Loaders\LoaderInterface $loader The loader for the validations |
||
82 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
83 | * @param boolean $mainRowOnly The flag to decide whether or not only values of the main row has to be |
||
84 | */ |
||
85 | public function __construct( |
||
94 | |||
95 | /** |
||
96 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance. |
||
97 | * |
||
98 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
99 | * |
||
100 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance |
||
101 | */ |
||
102 | public function createObserver(SubjectInterface $subject) : ObserverInterface |
||
111 | |||
112 | /** |
||
113 | * Will be invoked by the action on the events the listener has been registered for. |
||
114 | * |
||
115 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
116 | * |
||
117 | * @return array The modified row |
||
118 | * @see \TechDivision\Import\Observers\ObserverInterface::handle() |
||
119 | */ |
||
120 | public function handle(SubjectInterface $subject) : array |
||
133 | |||
134 | /** |
||
135 | * Return's the loader instance for the custom validations. |
||
136 | * |
||
137 | * @return \TechDivision\Import\Loaders\LoaderInterface The loader instance |
||
138 | */ |
||
139 | protected function getLoader() : LoaderInterface |
||
143 | |||
144 | /** |
||
145 | * Return's the registry processor instance. |
||
146 | * |
||
147 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The processor instance |
||
148 | */ |
||
149 | protected function getRegistryProcessor() : RegistryProcessorInterface |
||
153 | |||
154 | /** |
||
155 | * Query whether or not we've to parse the main row only. |
||
156 | * |
||
157 | * @return bool TRUE if only the main row has to be parsed, else FALSE |
||
158 | */ |
||
159 | protected function useMainRowOnly() : bool |
||
163 | |||
164 | /** |
||
165 | * Return's the primary key value that will be used as second incdex. |
||
166 | * |
||
167 | * @return string The primary key to be used |
||
168 | */ |
||
169 | abstract protected function getPrimaryKey() : string; |
||
170 | |||
171 | /** |
||
172 | * Process the observer's business logic. |
||
173 | * |
||
174 | * @return void |
||
175 | */ |
||
176 | protected function process() : void |
||
200 | |||
201 | /** |
||
202 | * Intializes the previously loaded global data for exactly one bunch. |
||
203 | * |
||
204 | * @param string $serial The serial of the actual import |
||
205 | * |
||
206 | * @return void |
||
207 | */ |
||
208 | public function setUp($serial) |
||
212 | |||
213 | /** |
||
214 | * Clean up the global data after importing the variants. |
||
215 | * |
||
216 | * @param string $serial The serial of the actual import |
||
217 | * |
||
218 | * @return void |
||
219 | */ |
||
220 | public function tearDown($serial) |
||
237 | } |
||
238 |
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.