1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Contao\Callback;
14:
15: /**
16: * Class AbstractReturningCallbackListener.
17: *
18: * Abstract base class for callbacks that are returning a value.
19: *
20: * @package DcGeneral\Contao\Callback
21: */
22: abstract class AbstractReturningCallbackListener extends AbstractCallbackListener
23: {
24: /**
25: * Update the values in the event with the value returned by the callback.
26: *
27: * @param \Symfony\Component\EventDispatcher\Event $event The event being emitted.
28: *
29: * @param mixed $value The value returned by the callback.
30: *
31: * @return void
32: */
33: abstract public function update($event, $value);
34:
35: /**
36: * {@inheritdoc}
37: */
38: public function __invoke($event)
39: {
40: if ($this->getCallback())
41: {
42: $this->update(
43: $event,
44: Callbacks::callArgs($this->getCallback(), $this->getArgs($event))
45: );
46: }
47: }
48: }
49: