1 | <?php |
||
36 | class GenericValidationObserver extends AbstractObserver implements ObserverFactoryInterface |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The registry processor instance. |
||
41 | * |
||
42 | * @var \TechDivision\Import\Services\RegistryProcessorInterface |
||
43 | */ |
||
44 | protected $registryProcessor; |
||
45 | |||
46 | /** |
||
47 | * Array with virtual column name mappings (this is a temporary |
||
48 | * solution till techdivision/import#179 as been implemented). |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $reverseHeaderMappings = array(); |
||
53 | |||
54 | /** |
||
55 | * Initializes the observer with the registry processor instance. |
||
56 | * |
||
57 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
58 | */ |
||
59 | public function __construct(RegistryProcessorInterface $registryProcessor) |
||
63 | |||
64 | /** |
||
65 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance. |
||
66 | * |
||
67 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
68 | * |
||
69 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance |
||
70 | */ |
||
71 | public function createObserver(SubjectInterface $subject) |
||
80 | |||
81 | /** |
||
82 | * Will be invoked by the action on the events the listener has been registered for. |
||
83 | * |
||
84 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
85 | * |
||
86 | * @return array The modified row |
||
87 | * @see \TechDivision\Import\Observers\ObserverInterface::handle() |
||
88 | */ |
||
89 | public function handle(SubjectInterface $subject) |
||
102 | |||
103 | /** |
||
104 | * Process the observer's business logic. |
||
105 | * |
||
106 | * @return array The processed row |
||
107 | */ |
||
108 | protected function process() |
||
148 | |||
149 | /** |
||
150 | * Reverse map the passed header name, to the original column name. |
||
151 | * |
||
152 | * @param string $headerName The header name to reverse map |
||
153 | * |
||
154 | * @return string The original column name |
||
155 | */ |
||
156 | protected function reverseMapHeaderNameToColumnName(string $headerName) : string |
||
160 | |||
161 | /** |
||
162 | * @return string |
||
163 | */ |
||
164 | protected function getEmptyAttributeValueConstant() : string |
||
168 | |||
169 | /** |
||
170 | * Return's the array with callbacks for the passed type. |
||
171 | * |
||
172 | * @param string $type The type of the callbacks to return |
||
173 | * |
||
174 | * @return array The callbacks |
||
175 | */ |
||
176 | protected function getCallbacksByType($type) |
||
180 | } |
||
181 |