[CLEANUP] Cleanup ext:core/Configuration 01/33801/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 4 Nov 2014 19:14:45 +0000 (20:14 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 8 Nov 2014 21:39:58 +0000 (22:39 +0100)
* Use one use-statement per class
* Format phpDoc correctly

Resolves: #62705
Releases: master
Change-Id: If199c6962eeff31789742a05ddfd0b37d89b0079
Reviewed-on: http://review.typo3.org/33801
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Configuration/ConfigurationManager.php
typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php
typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php

index 1e4c5b9..480e52b 100644 (file)
@@ -14,7 +14,8 @@ namespace TYPO3\CMS\Core\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Utility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 
 /**
  * Handle loading and writing of global and local (instance specific)
@@ -24,7 +25,6 @@ use TYPO3\CMS\Core\Utility;
  * - EXT:core/Configuration/DefaultConfiguration.php (default TYPO3_CONF_VARS)
  * - typo3conf/LocalConfiguration.php (overrides of TYPO3_CONF_VARS)
  * - typo3conf/AdditionalConfiguration.php (optional additional local code blocks)
- * - typo3conf/localconf.php (legacy configuration file)
  *
  * @author Helge Funk <helge.funk@e-net.info>
  */
@@ -151,7 +151,7 @@ class ConfigurationManager {
         */
        public function updateLocalConfiguration(array $configurationToMerge) {
                $newLocalConfiguration = $this->getLocalConfiguration();
-               Utility\ArrayUtility::mergeRecursiveWithOverrule($newLocalConfiguration, $configurationToMerge);
+               ArrayUtility::mergeRecursiveWithOverrule($newLocalConfiguration, $configurationToMerge);
                $this->writeLocalConfiguration($newLocalConfiguration);
        }
 
@@ -162,7 +162,7 @@ class ConfigurationManager {
         * @return mixed Value at path
         */
        public function getDefaultConfigurationValueByPath($path) {
-               return Utility\ArrayUtility::getValueByPath($this->getDefaultConfiguration(), $path);
+               return ArrayUtility::getValueByPath($this->getDefaultConfiguration(), $path);
        }
 
        /**
@@ -172,7 +172,7 @@ class ConfigurationManager {
         * @return mixed Value at path
         */
        public function getLocalConfigurationValueByPath($path) {
-               return Utility\ArrayUtility::getValueByPath($this->getLocalConfiguration(), $path);
+               return ArrayUtility::getValueByPath($this->getLocalConfiguration(), $path);
        }
 
        /**
@@ -184,8 +184,8 @@ class ConfigurationManager {
         */
        public function getConfigurationValueByPath($path) {
                $defaultConfiguration = $this->getDefaultConfiguration();
-               Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $this->getLocalConfiguration());
-               return Utility\ArrayUtility::getValueByPath($defaultConfiguration, $path);
+               ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $this->getLocalConfiguration());
+               return ArrayUtility::getValueByPath($defaultConfiguration, $path);
        }
 
        /**
@@ -199,7 +199,7 @@ class ConfigurationManager {
                $result = FALSE;
                if ($this->isValidLocalConfigurationPath($path)) {
                        $localConfiguration = $this->getLocalConfiguration();
-                       $localConfiguration = Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
+                       $localConfiguration = ArrayUtility::setValueByPath($localConfiguration, $path, $value);
                        $result = $this->writeLocalConfiguration($localConfiguration);
                }
                return $result;
@@ -215,7 +215,7 @@ class ConfigurationManager {
                $localConfiguration = $this->getLocalConfiguration();
                foreach ($pairs as $path => $value) {
                        if ($this->isValidLocalConfigurationPath($path)) {
-                               $localConfiguration = Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
+                               $localConfiguration = ArrayUtility::setValueByPath($localConfiguration, $path, $value);
                        }
                }
                return $this->writeLocalConfiguration($localConfiguration);
@@ -232,9 +232,9 @@ class ConfigurationManager {
                $localConfiguration = $this->getLocalConfiguration();
                foreach ($keys as $path) {
                        // Remove key if path is within LocalConfiguration
-                       if (Utility\ArrayUtility::isValidPath($localConfiguration, $path)) {
+                       if (ArrayUtility::isValidPath($localConfiguration, $path)) {
                                $result = TRUE;
-                               $localConfiguration = Utility\ArrayUtility::removeByPath($localConfiguration, $path);
+                               $localConfiguration = ArrayUtility::removeByPath($localConfiguration, $path);
                        }
                }
                if ($result) {
@@ -266,7 +266,7 @@ class ConfigurationManager {
                        $localConfiguration = $this->getLocalConfiguration();
                        if (is_array($localConfiguration)) {
                                $defaultConfiguration = $this->getDefaultConfiguration();
-                               Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $localConfiguration);
+                               ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $localConfiguration);
                                $GLOBALS['TYPO3_CONF_VARS'] = $defaultConfiguration;
                        } else {
                                throw new \UnexpectedValueException('LocalConfiguration invalid.', 1349272276);
@@ -295,16 +295,15 @@ class ConfigurationManager {
                                $localConfigurationFile . ' is not writable.', 1346323822
                        );
                }
-               $configuration = Utility\ArrayUtility::sortByKeyRecursive($configuration);
-               $result = Utility\GeneralUtility::writeFile(
+               $configuration = ArrayUtility::sortByKeyRecursive($configuration);
+               $result = GeneralUtility::writeFile(
                        $localConfigurationFile,
                        '<?php' . LF .
                                'return ' .
-                                       Utility\ArrayUtility::arrayExport(
-                                               Utility\ArrayUtility::renumberKeysToAvoidLeapsIfKeysAreAllNumeric($configuration)
+                                       ArrayUtility::arrayExport(
+                                               ArrayUtility::renumberKeysToAvoidLeapsIfKeysAreAllNumeric($configuration)
                                        ) .
-                               ';' . LF .
-                       '?>',
+                               ';' . LF,
                        TRUE
                );
 
@@ -322,11 +321,10 @@ class ConfigurationManager {
         * @access private
         */
        public function writeAdditionalConfiguration(array $additionalConfigurationLines) {
-               return Utility\GeneralUtility::writeFile(
+               return GeneralUtility::writeFile(
                        PATH_site . $this->additionalConfigurationFile,
                        '<?php' . LF .
-                               implode(LF, $additionalConfigurationLines) . LF .
-                       '?>'
+                               implode(LF, $additionalConfigurationLines) . LF
                );
        }
 
@@ -350,7 +348,7 @@ class ConfigurationManager {
                $additionalFactoryConfigurationFileLocation = $this->getAdditionalFactoryConfigurationFileLocation();
                if (file_exists($additionalFactoryConfigurationFileLocation)) {
                        $additionalFactoryConfigurationArray = require $additionalFactoryConfigurationFileLocation;
-                       Utility\ArrayUtility::mergeRecursiveWithOverrule(
+                       ArrayUtility::mergeRecursiveWithOverrule(
                                $localConfigurationArray,
                                $additionalFactoryConfigurationArray
                        );
@@ -367,11 +365,11 @@ class ConfigurationManager {
        protected function isValidLocalConfigurationPath($path) {
                // Early return for white listed paths
                foreach ($this->whiteListedLocalConfigurationPaths as $whiteListedPath) {
-                       if (Utility\GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
+                       if (GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
                                return TRUE;
                        }
                }
-               return Utility\ArrayUtility::isValidPath($this->getDefaultConfiguration(), $path);
+               return ArrayUtility::isValidPath($this->getDefaultConfiguration(), $path);
        }
 
 }
index 2640876..e4cbedb 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Configuration\FlexForm;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Contains functions for manipulating flex form data
@@ -23,20 +24,40 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
  */
 class FlexFormTools {
 
-       // If set, the charset of data XML is converted to system charset.
+       /**
+        * If set, the charset of data XML is converted to system charset.
+        *
+        * @var bool
+        */
        public $convertCharset = FALSE;
 
-       // If set, section indexes are re-numbered before processing
+       /**
+        * If set, section indexes are re-numbered before processing
+        *
+        * @var bool
+        */
        public $reNumberIndexesOfSectionData = FALSE;
 
-       // Contains data structure when traversing flexform
+       /**
+        * Contains data structure when traversing flexform
+        *
+        * @var array
+        */
        public $traverseFlexFormXMLData_DS = array();
 
-       // Contains data array when traversing flexform
+       /**
+        * Contains data array when traversing flexform
+        *
+        * @var array
+        */
        public $traverseFlexFormXMLData_Data = array();
 
-       // Options for array2xml() for flexform.
-       // This will map the weird keys from the internal array to tags that could potentially be checked with a DTD/schema
+       /**
+        * Options for array2xml() for flexform.
+        * This will map the weird keys from the internal array to tags that could potentially be checked with a DTD/schema
+        *
+        * @var array
+        */
        public $flexArray2Xml_options = array(
                'parentTagMap' => array(
                        'data' => 'sheet',
@@ -54,10 +75,15 @@ class FlexFormTools {
        /**
         * Reference to object called
         *
+        * @var object
         */
        public $callBackObj = NULL;
 
-       // Used for accumulation of clean XML
+       /**
+        * Used for accumulation of clean XML
+        *
+        * @var array
+        */
        public $cleanFlexFormXML = array();
 
        /**
@@ -68,7 +94,7 @@ class FlexFormTools {
         * @param array $row The record data array
         * @param object $callBackObj Object (passed by reference) in which the call back function is located
         * @param string $callBackMethod_value Method name of call back function in object for values
-        * @return bool If TRUE, error happened (error string returned)
+        * @return bool|string If TRUE, error happened (error string returned)
         */
        public function traverseFlexFormXMLData($table, $field, $row, $callBackObj, $callBackMethod_value) {
                if (!is_array($GLOBALS['TCA'][$table]) || !is_array($GLOBALS['TCA'][$table]['columns'][$field])) {
@@ -83,14 +109,14 @@ class FlexFormTools {
                        $xmlData = $row[$field];
                        // Convert charset:
                        if ($this->convertCharset) {
-                               $xmlHeaderAttributes = \TYPO3\CMS\Core\Utility\GeneralUtility::xmlGetHeaderAttribs($xmlData);
+                               $xmlHeaderAttributes = GeneralUtility::xmlGetHeaderAttribs($xmlData);
                                $storeInCharset = strtolower($xmlHeaderAttributes['encoding']);
                                if ($storeInCharset) {
                                        $currentCharset = $GLOBALS['LANG']->charSet;
                                        $xmlData = $GLOBALS['LANG']->csConvObj->conv($xmlData, $storeInCharset, $currentCharset, 1);
                                }
                        }
-                       $editData = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($xmlData);
+                       $editData = GeneralUtility::xml2array($xmlData);
                        if (!is_array($editData)) {
                                return 'Parsing error: ' . $editData;
                        }
@@ -125,7 +151,7 @@ class FlexFormTools {
                        foreach ($lKeys as $lKey) {
                                foreach ($sKeys as $sheet) {
                                        $sheetCfg = $dataStructArray['sheets'][$sheet];
-                                       list($dataStruct, $sheet) = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveSheetDefInDS($dataStructArray, $sheet);
+                                       list($dataStruct, $sheet) = GeneralUtility::resolveSheetDefInDS($dataStructArray, $sheet);
                                        // Render sheet:
                                        if (is_array($dataStruct['ROOT']) && is_array($dataStruct['ROOT']['el'])) {
                                                // Separate language key
@@ -216,7 +242,13 @@ class FlexFormTools {
        public function getAvailableLanguages() {
                $isL = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables');
                // Find all language records in the system
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('static_lang_isocode,title,uid', 'sys_language', 'pid=0' . BackendUtility::deleteClause('sys_language'), '', 'title');
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       'static_lang_isocode,title,uid',
+                       'sys_language',
+                       'pid=0' . BackendUtility::deleteClause('sys_language'),
+                       '',
+                       'title'
+               );
                // Traverse them
                $output = array();
                $output[0] = array(
@@ -258,7 +290,7 @@ class FlexFormTools {
                // New structure:
                $this->cleanFlexFormXML = array();
                // Create and call iterator object:
-               $flexObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
+               $flexObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
                $flexObj->reNumberIndexesOfSectionData = TRUE;
                $flexObj->traverseFlexFormXMLData($table, $field, $row, $this, 'cleanFlexFormXML_callBackFunction');
                return $this->flexArray2Xml($this->cleanFlexFormXML, TRUE);
@@ -362,7 +394,7 @@ class FlexFormTools {
                }
                $options = $GLOBALS['TYPO3_CONF_VARS']['BE']['niceFlexFormXMLtags'] ? $this->flexArray2Xml_options : array();
                $spaceInd = $GLOBALS['TYPO3_CONF_VARS']['BE']['compactFlexFormXML'] ? -1 : 4;
-               $output = \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml($array, '', 0, 'T3FlexForms', $spaceInd, $options);
+               $output = GeneralUtility::array2xml($array, '', 0, 'T3FlexForms', $spaceInd, $options);
                if ($addPrologue) {
                        $output = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . LF . $output;
                }
index eed10ae..dc02c1b 100644 (file)
@@ -29,14 +29,14 @@ abstract class AbstractConditionMatcher {
        /**
         * Id of the current page.
         *
-        * @var         integer
+        * @var int
         */
        protected $pageId;
 
        /**
         * The rootline for the current page.
         *
-        * @var         array
+        * @var array
         */
        protected $rootline;
 
@@ -44,7 +44,7 @@ abstract class AbstractConditionMatcher {
         * Whether to simulate the behaviour and match all conditions
         * (used in TypoScript object browser).
         *
-        * @var         boolean
+        * @var bool
         */
        protected $simulateMatchResult = FALSE;
 
@@ -52,7 +52,7 @@ abstract class AbstractConditionMatcher {
         * Whether to simulat the behaviour and match specific conditions
         * (used in TypoScript object browser).
         *
-        * @var         array
+        * @var array
         */
        protected $simulateMatchConditions = array();
 
@@ -316,17 +316,11 @@ abstract class AbstractConditionMatcher {
                                return (bool)GeneralUtility::cmpFQDN(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value);
                                break;
                        case 'hour':
-
                        case 'minute':
-
                        case 'month':
-
                        case 'year':
-
                        case 'dayofweek':
-
                        case 'dayofmonth':
-
                        case 'dayofyear':
                                // In order to simulate time properly in templates.
                                $theEvalTime = $GLOBALS['SIM_EXEC_TIME'];