[TASK] Cleanup fluid
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 10 Mar 2013 21:42:07 +0000 (22:42 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 13 Mar 2013 22:49:01 +0000 (23:49 +0100)
- Remove dead code
- Add missing property definitions
- Add function descriptions

Change-Id: I0ec563d42d7e763db7f482c9721edb4717703213
Resolves: #46162
Releases: 6.1
Reviewed-on: https://review.typo3.org/18831
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/fluid/Classes/Compatibility/DocbookGeneratorService.php
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/BooleanNode.php
typo3/sysext/fluid/Classes/Core/Widget/Bootstrap.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/PageInfoViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/PagePathViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Fixtures/ConstraintSyntaxTreeNode.php

index 15f37b3..f6ff4a5 100644 (file)
@@ -13,17 +13,16 @@ namespace TYPO3\CMS\Fluid\Compatibility;
  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
  * Public License for more details.                                       *
  *                                                                        */
+
 /**
  * Class extending the docbook generator service for use in typo3 v4.
  *
  * Usage in TypoScript:
  *
- *
- *
  * config.disableAllHeaderCode = 1
  * page = PAGE
  * page.10 = USER_INT
- * page.10.userFunc = Tx_Fluid_Compatibility_DocbookGeneratorService->userFunc
+ * page.10.userFunc = \TYPO3\CMS\Fluid\Compatibility\DocbookGeneratorService->userFunc
  *
  * @internal
  */
@@ -35,6 +34,11 @@ class DocbookGeneratorService extends \TYPO3\CMS\Fluid\Service\DocbookGenerator
         */
        protected $objectManager;
 
+       /**
+        * User function
+        *
+        * @return string
+        */
        public function userFunc() {
                $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $this->injectDocCommentParser($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\DocCommentParser'));
@@ -42,6 +46,12 @@ class DocbookGeneratorService extends \TYPO3\CMS\Fluid\Service\DocbookGenerator
                return $this->generateDocbook('TYPO3\CMS\Fluid\ViewHelpers');
        }
 
+       /**
+        * Get class names within namespace
+        *
+        * @param string $namespace
+        * @return array
+        */
        protected function getClassNamesInNamespace($namespace) {
                $namespaceParts = explode('\\', $namespace);
                if ($namespaceParts[count($namespaceParts) - 1] == '') {
@@ -54,6 +64,14 @@ class DocbookGeneratorService extends \TYPO3\CMS\Fluid\Service\DocbookGenerator
                return $classNames;
        }
 
+       /**
+        * Search recursivly class names within namespace
+        *
+        * @param string $namespace
+        * @param string $directory
+        * @param array $classNames
+        * @return void
+        */
        private function recursiveClassNameSearch($namespace, $directory, &$classNames) {
 
                $dh = opendir($directory);
index 367b74b..74a73c3 100644 (file)
@@ -224,14 +224,12 @@ class BooleanNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode {
                                } else {
                                        return ($evaluatedLeftSide == $evaluatedRightSide);
                                }
-                               break;
                        case '!=':
                                if (is_object($evaluatedLeftSide) || is_object($evaluatedRightSide)) {
                                        return ($evaluatedLeftSide !== $evaluatedRightSide);
                                } else {
                                        return ($evaluatedLeftSide != $evaluatedRightSide);
                                }
-                               break;
                        case '%':
                                if (!self::isComparable($evaluatedLeftSide, $evaluatedRightSide)) {
                                        return FALSE;
index 5b19f07..eaa0e7d 100644 (file)
@@ -39,6 +39,11 @@ class Bootstrap {
        protected $objectManager;
 
        /**
+        * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
         * @param string $content The content
         * @param array $configuration The TS configuration array
         * @return string $content The processed content
index 68c5f2c..9d50d90 100644 (file)
@@ -58,7 +58,7 @@ class PageInfoViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackend
                } else {
                        // On root-level of page tree
                        // Make Icon
-                       $iconImg = '<img' . IconUtility::skinImg($this->backPath, 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
+                       $iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
                        if ($GLOBALS['BE_USER']->user['admin']) {
                                $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
                        } else {
index 3c491e7..c3d99af 100644 (file)
@@ -42,7 +42,6 @@ class PagePathViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackend
         * @see template::getPagePath() Note: can't call this method as it's protected!
         */
        public function render() {
-               $doc = $this->getDocInstance();
                $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
                $pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
                // Is this a real page
index 7b76581..a175430 100644 (file)
@@ -256,7 +256,6 @@ abstract class AbstractFormFieldViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\
                $errors = $this->controllerContext->getRequest()->getErrors();
                $formObjectName = $this->viewHelperVariableContainer->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\FormViewHelper', 'formObjectName');
                $propertyName = $this->arguments['property'];
-               $formErrors = array();
                foreach ($errors as $error) {
                        if ($error instanceof \TYPO3\CMS\Extbase\Validation\PropertyError && $error->getPropertyName() === $formObjectName) {
                                $formErrors = $error->getErrors();
index 21f4723..a202a1a 100644 (file)
@@ -13,7 +13,7 @@ namespace TYPO3\CMS\Fluid\ViewHelpers\Uri;
  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
  * Public License for more details.                                       *
  *                                                                        */
-/*
+/**
  * Resizes a given image (if required) and returns its relative path.
  *
  * = Examples =
@@ -55,6 +55,18 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelpe
        protected $configurationManager;
 
        /**
+        * Contains a backup of the current $GLOBALS['TSFE'] if used in BE mode
+        *
+        * @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
+        */
+       protected $tsfeBackup;
+
+       /**
+        * @var string
+        */
+       protected $workingDirectoryBackup;
+
+       /**
         * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
         * @return void
         */
@@ -115,7 +127,7 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelpe
         */
        protected function simulateFrontendEnvironment() {
                $this->tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL;
-               // set the working directory to the site root
+               // Set the working directory to the site root
                $this->workingDirectoryBackup = getcwd();
                chdir(PATH_site);
                $typoScriptSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
index c0d548d..33463b9 100644 (file)
@@ -17,6 +17,11 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Fixtures;
 class ConstraintSyntaxTreeNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode {
        public $callProtocol = array();
 
+       /**
+        * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer
+        */
+       protected $variableContainer;
+
        public function __construct(\TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $variableContainer) {
                $this->variableContainer = $variableContainer;
        }