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: use Symfony\Component\EventDispatcher\Event;
16:
17: /**
18: * Class AbstractStaticCallbackListener.
19: *
20: * Abstract base class for callbacks with static arguments that are independent from the event.
21: * The parameters are passed as optional list to the constructor.
22: *
23: * @package DcGeneral\Contao\Callback
24: */
25: abstract class AbstractStaticCallbackListener extends AbstractCallbackListener
26: {
27: /**
28: * Arguments for the callback.
29: *
30: * @var array
31: */
32: protected $args;
33:
34: /**
35: * {@inheritdoc}
36: *
37: * @param mixed $_ [optional] A variable list of arguments to be passed to the callback.
38: */
39: public function __construct($callback, $_ = null)
40: {
41: parent::__construct($callback);
42:
43: $args = func_get_args();
44: array_shift($args);
45:
46: $this->args = $args;
47: }
48:
49: /**
50: * {@inheritdoc}
51: */
52: public function getArgs($event)
53: {
54: return $this->args;
55: }
56: }
57: