‪TYPO3CMS  10.4
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 {
43 
47  protected ‪$defaultOptions = [
48  'closure' => null
49  ];
50 
57  protected function ‪executeInternal()
58  {
60  $closure = $this->‪parseOption('closure');
61  if ($closure === null) {
62  return;
63  }
64  if (!$closure instanceof \Closure) {
65  throw new ‪FinisherException(sprintf('The option "closure" must be of type Closure, "%s" given.', gettype($closure)), 1332155239);
66  }
67  $closure($this->finisherContext);
68  }
69 }
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher
Definition: ClosureFinisher.php:42
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher\$defaultOptions
‪array $defaultOptions
Definition: ClosureFinisher.php:46
‪TYPO3\CMS\Form\Domain\Finishers
Definition: AbstractFinisher.php:22
‪TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher\executeInternal
‪executeInternal()
Definition: ClosureFinisher.php:56
‪TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher
Definition: AbstractFinisher.php:41
‪TYPO3\CMS\Form\Domain\Finishers\Exception\FinisherException
Definition: FinisherException.php:26
‪TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher\parseOption
‪string array null parseOption(string $optionName)
Definition: AbstractFinisher.php:161