‪TYPO3CMS  ‪main
EventCallback.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
26 {
27  protected object ‪$object;
28  protected string ‪$method;
29  protected array ‪$targetArguments;
30 
31  public function ‪__construct(object ‪$object, string ‪$method, array ‪$targetArguments = [])
32  {
33  $this->object = ‪$object;
34  $this->method = ‪$method;
35  $this->targetArguments = ‪$targetArguments;
36  $this->targetArguments['target'] = ‪$object;
37  }
38 
42  public function ‪execute(array $callerArguments, object $caller, string $eventName): mixed
43  {
44  $callable = [‪$this->object, ‪$this->method];
45  if (is_callable($callable)) {
46  return $callable($callerArguments, $this->targetArguments, $caller, $eventName);
47  }
48  return null;
49  }
50 }
‪TYPO3\CMS\Workspaces\Dependency\EventCallback\$targetArguments
‪array $targetArguments
Definition: EventCallback.php:29
‪TYPO3\CMS\Workspaces\Dependency\EventCallback\execute
‪execute(array $callerArguments, object $caller, string $eventName)
Definition: EventCallback.php:42
‪TYPO3\CMS\Workspaces\Dependency\EventCallback
Definition: EventCallback.php:26
‪TYPO3\CMS\Workspaces\Dependency
Definition: DependencyEntityFactory.php:18
‪TYPO3\CMS\Workspaces\Dependency\EventCallback\__construct
‪__construct(object $object, string $method, array $targetArguments=[])
Definition: EventCallback.php:31
‪TYPO3\CMS\Workspaces\Dependency\EventCallback\$object
‪object $object
Definition: EventCallback.php:27
‪TYPO3\CMS\Workspaces\Dependency\EventCallback\$method
‪string $method
Definition: EventCallback.php:28