[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / version / Classes / Dependency / EventCallback.php
1 <?php
2 namespace TYPO3\CMS\Version\Dependency;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 /**
17 * Object to hold information on a callback to a defined object and method.
18 */
19 class EventCallback {
20
21 /**
22 * @var object
23 */
24 protected $object;
25
26 /**
27 * @var string
28 */
29 protected $method;
30
31 /**
32 * @var array
33 */
34 protected $targetArguments;
35
36 /**
37 * Creates the objects.
38 *
39 * @param object $object
40 * @param string $method
41 * @param array $targetArguments (optional)
42 */
43 public function __construct($object, $method, array $targetArguments = array()) {
44 $this->object = $object;
45 $this->method = $method;
46 $this->targetArguments = $targetArguments;
47 $this->targetArguments['target'] = $object;
48 }
49
50 /**
51 * Executes the callback.
52 *
53 * @param array $callerArguments
54 * @param object $caller
55 * @param string $eventName
56 * @return mixed
57 */
58 public function execute(array $callerArguments = array(), $caller, $eventName) {
59 return call_user_func_array(array($this->object, $this->method), array($callerArguments, $this->targetArguments, $caller, $eventName));
60 }
61
62 }