1 | <?php |
||
35 | class GenericCompositeObserver implements ObserverInterface |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * The composite's subject instance. |
||
40 | * |
||
41 | * @var \TechDivision\Import\Subjects\SubjectInterface |
||
42 | */ |
||
43 | protected $subject; |
||
44 | |||
45 | /** |
||
46 | * The actual row that will be processed by the composite's observers. |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $row = array(); |
||
51 | |||
52 | /** |
||
53 | * The array with the composite's observers. |
||
54 | * |
||
55 | * @var \TechDivision\Import\Observers\ObserverInterface[] |
||
56 | */ |
||
57 | protected $observers = array(); |
||
58 | |||
59 | /** |
||
60 | * Will be invoked by the action on the events the listener has been registered for. |
||
61 | * |
||
62 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance |
||
63 | * |
||
64 | * @return array The modified row |
||
65 | */ |
||
66 | public function handle(SubjectInterface $subject) |
||
98 | |||
99 | /** |
||
100 | * Return's the observer's subject instance. |
||
101 | * |
||
102 | * @return \TechDivision\Import\Subjects\SubjectInterface The observer's subject instance |
||
103 | */ |
||
104 | public function getSubject() |
||
108 | |||
109 | /** |
||
110 | * Adds the passed observer to the composites array with observers. |
||
111 | * |
||
112 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to add |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public function addObserver(ObserverInterface $observer) |
||
120 | |||
121 | /** |
||
122 | * Set's the obeserver's subject instance to initialize the observer with. |
||
123 | * |
||
124 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The observer's subject |
||
125 | * |
||
126 | * @return void |
||
127 | */ |
||
128 | protected function setSubject(SubjectInterface $subject) |
||
132 | |||
133 | /** |
||
134 | * Returns the array with the composite's observers. |
||
135 | * |
||
136 | * @return \TechDivision\Import\Observers\ObserverInterface[] |
||
137 | */ |
||
138 | protected function getObservers() |
||
142 | } |
||
143 |