[BUGFIX] Code cleanup tx_linkvalidator_processor
authorPhilipp Gampe <dev@philippgampe.info>
Tue, 20 Mar 2012 20:59:45 +0000 (21:59 +0100)
committerPhilipp Gampe <dev@philippgampe.info>
Tue, 20 Mar 2012 20:59:45 +0000 (21:59 +0100)
 * remove unused variables
 * initialize used variables
 * allow IDE type hinting

Change-Id: I1854c2c99a7071e6efbdd40d0b475ead5a5fc07f
Fixes: #35058
Releases: 4.5, 4.6, 4.7, 4.8

typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php

index 0ab7779..26a2d0e 100644 (file)
@@ -73,7 +73,7 @@ class tx_linkvalidator_Processor {
        /**
         * Array for hooks for own checks
         *
-        * @var array
+        * @var tx_linkvalidator_linktype_Abstract[]
         */
        protected $hookObjectsArr = array();
 
@@ -85,6 +85,20 @@ class tx_linkvalidator_Processor {
        protected $extPageInTreeInfo = array();
 
        /**
+        * Reference to the current element with table:uid, e.g. pages:85
+        *
+        * @var string
+        */
+       protected $recordReference = '';
+
+       /**
+        * Linked page together with a possible anchor, e.g. 85#c105
+        *
+        * @var string
+        */
+       protected $pageWithAnchor = '';
+
+       /**
         * Fill hookObjectsArr with different link types and possible XClasses.
         */
        public function __construct() {
@@ -221,16 +235,6 @@ class tx_linkvalidator_Processor {
         */
        public function analyzeRecord(array &$results, $table, array $fields, array $record) {
 
-                       // Array to store urls from relevant field contents
-               $urls = array();
-
-               $referencedRecordType = '';
-                       // Last-parsed link element was a page
-               $wasPage = TRUE;
-
-                       // Flag whether row contains a broken link in some field or not
-               $rowContainsBrokenLink = FALSE;
-
                        // Put together content of all relevant fields
                $haystack = '';
                $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
@@ -250,7 +254,7 @@ class tx_linkvalidator_Processor {
                                $softRefs = t3lib_BEfunc::explodeSoftRefParserList($conf['softref']);
                                        // Traverse soft references
                                foreach ($softRefs as $spKey => $spParams) {
-                                               // create / get object
+                                               /** @var t3lib_softrefproc $softRefObj Create or get the soft reference object */
                                        $softRefObj = &t3lib_BEfunc::softRefParserObj($spKey);
 
                                                // If there is an object returned...
@@ -424,8 +428,8 @@ class tx_linkvalidator_Processor {
                                        $theList .= $this->extGetTreeList($row['uid'], $depth - 1, $begin - 1, $permsClause, $considerHidden);
                                }
                        }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
                }
-               $GLOBALS['TYPO3_DB']->sql_free_result($res);
                return $theList;
        }