[TASK] Add more fixers for php-cs-fixer
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Mvc / Controller / ControllerContext.php
1 <?php
2 namespace TYPO3\CMS\Form\Mvc\Controller;
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 use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
18 use TYPO3\CMS\Form\Domain\Model\Configuration;
19 use TYPO3\CMS\Form\Domain\Model\ValidationElement;
20
21 /**
22 * Extension to the default Extbase Controller Context.
23 */
24 class ControllerContext extends \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
25 {
26 /**
27 * Extends a given default ControllerContext.
28 *
29 * @param \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
30 * @return ControllerContext
31 */
32 public static function extend(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $source)
33 {
34 $controllerContext = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(self::class);
35 $propertyNames = ObjectAccess::getGettableProperties($source);
36 foreach ($propertyNames as $propertyName => $propertyValue) {
37 ObjectAccess::setProperty($controllerContext, $propertyName, $propertyValue);
38 }
39 return $controllerContext;
40 }
41
42 /**
43 * @var Configuration
44 */
45 protected $configuration;
46
47 /**
48 * @var ValidationElement
49 */
50 protected $validationElement;
51
52 /**
53 * @return Configuration
54 */
55 public function getConfiguration()
56 {
57 return $this->configuration;
58 }
59
60 /**
61 * @param Configuration $configuration
62 * @return ControllerContext
63 */
64 public function setConfiguration(Configuration $configuration)
65 {
66 $this->configuration = $configuration;
67 return $this;
68 }
69
70 /**
71 * @return ValidationElement
72 */
73 public function getValidationElement()
74 {
75 return $this->validationElement;
76 }
77
78 /**
79 * @param ValidationElement $validationElement
80 */
81 public function setValidationElement(ValidationElement $validationElement)
82 {
83 $this->validationElement = $validationElement;
84 }
85 }