1 | <?php |
||
36 | class GenericCompositeObserver implements ObserverInterface, ObserverFactoryInterface |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The composite's subject instance. |
||
41 | * |
||
42 | * @var \TechDivision\Import\Subjects\SubjectInterface |
||
43 | */ |
||
44 | protected $subject; |
||
45 | |||
46 | /** |
||
47 | * The actual row that will be processed by the composite's observers. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $row = array(); |
||
52 | |||
53 | /** |
||
54 | * The array with the composite's observers. |
||
55 | * |
||
56 | * @var \TechDivision\Import\Observers\ObserverInterface[] |
||
57 | */ |
||
58 | protected $observers = array(); |
||
59 | |||
60 | /** |
||
61 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance. |
||
62 | * |
||
63 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
64 | * |
||
65 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance |
||
66 | */ |
||
67 | public function createObserver(SubjectInterface $subject) |
||
81 | |||
82 | /** |
||
83 | * Will be invoked by the action on the events the listener has been registered for. |
||
84 | * |
||
85 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
86 | * |
||
87 | * @return array The modified row |
||
88 | */ |
||
89 | public function handle(SubjectInterface $subject) |
||
124 | |||
125 | /** |
||
126 | * Return's the observer's subject instance. |
||
127 | * |
||
128 | * @return \TechDivision\Import\Subjects\SubjectInterface The observer's subject instance |
||
129 | */ |
||
130 | public function getSubject() |
||
134 | |||
135 | /** |
||
136 | * Adds the passed observer to the composites array with observers. |
||
137 | * |
||
138 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to add |
||
139 | * |
||
140 | * @return void |
||
141 | */ |
||
142 | public function addObserver(ObserverInterface $observer) |
||
146 | |||
147 | /** |
||
148 | * Set's the obeserver's subject instance to initialize the observer with. |
||
149 | * |
||
150 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The observer's subject |
||
151 | * |
||
152 | * @return void |
||
153 | */ |
||
154 | protected function setSubject(SubjectInterface $subject) |
||
158 | |||
159 | /** |
||
160 | * Returns the array with the composite's observers. |
||
161 | * |
||
162 | * @return \TechDivision\Import\Observers\ObserverInterface[] |
||
163 | */ |
||
164 | protected function getObservers() |
||
168 | |||
169 | /** |
||
170 | * Intializes the previously loaded global data for exactly one bunch. |
||
171 | * |
||
172 | * @param string $serial The serial of the actual import |
||
173 | * |
||
174 | * @return void |
||
175 | */ |
||
176 | public function setUp($serial) |
||
189 | |||
190 | /** |
||
191 | * Clean up the global data after importing the variants. |
||
192 | * |
||
193 | * @param string $serial The serial of the actual import |
||
194 | * |
||
195 | * @return void |
||
196 | */ |
||
197 | public function tearDown($serial) |
||
210 | } |
||
211 |