‪TYPO3CMS  ‪main
ClosureFinisher.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 
18 /*
19  * Inspired by and partially taken from the Neos.Form package (www.neos.io)
20  */
21 
23 
25 
42 {
46  protected ‪$defaultOptions = [
47  'closure' => null,
48  ];
49 
56  protected function ‪executeInternal()
57  {
59  $closure = $this->‪parseOption('closure');
60  if ($closure === null) {
61  return;
62  }
63  if (!$closure instanceof \Closure) {
64  throw new ‪FinisherException(sprintf('The option "closure" must be of type Closure, "%s" given.', gettype($closure)), 1332155239);
65  }
66  $closure($this->finisherContext);
67  }
68 }
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher
Definition: ClosureFinisher.php:42
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher\$defaultOptions
‪array $defaultOptions
Definition: ClosureFinisher.php:45
‪TYPO3\CMS\Form\Domain\Finishers
Definition: AbstractFinisher.php:22
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher\executeInternal
‪executeInternal()
Definition: ClosureFinisher.php:55
‪TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher\parseOption
‪string array int null parseOption(string $optionName)
Definition: AbstractFinisher.php:139
‪TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher
Definition: AbstractFinisher.php:41
‪TYPO3\CMS\Form\Domain\Finishers\Exception\FinisherException
Definition: FinisherException.php:25