[TASK] Further cleanup indexed_search 55/41855/4
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 22 Jul 2015 21:43:10 +0000 (23:43 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 23 Jul 2015 10:34:40 +0000 (12:34 +0200)
* Cleanup phpDoc
* introduce use statements where needed

Resolves: #68478
Releases: master
Change-Id: I4044ab6e5fd74c2bf03dd2533eb0eeccfd7d68b4
Reviewed-on: http://review.typo3.org/41855
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Classes/Example/PluginHook.php
typo3/sysext/indexed_search/Classes/FileContentParser.php
typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php
typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php
typo3/sysext/indexed_search/Classes/Utility/IndexedSearchUtility.php
typo3/sysext/indexed_search/Classes/ViewHelpers/Format/DateTimeViewHelper.php
typo3/sysext/indexed_search/Classes/ViewHelpers/Format/FlagValueViewHelper.php
typo3/sysext/indexed_search/Classes/ViewHelpers/Format/GroupListViewHelper.php

index d8910e4..947b5ab 100644 (file)
@@ -27,11 +27,21 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
  */
 class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
 
-       // previously known as $this->piVars['sword']
+       /**
+        * previously known as $this->piVars['sword']
+        *
+        * @var string
+        */
        protected $sword = NULL;
 
+       /**
+        * @var array
+        */
        protected $searchWords = array();
 
+       /**
+        * @var array
+        */
        protected $searchData;
 
        /**
@@ -45,6 +55,9 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         */
        protected $searchRootPageIdList = 0;
 
+       /**
+        * @var int
+        */
        protected $defaultResultNumber = 10;
 
        /**
@@ -274,7 +287,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
                        }
                }
                // Print a message telling which words in which sections we searched for
-               if (substr($this->searchData['sections'], 0, 2) == 'rl') {
+               if (substr($this->searchData['sections'], 0, 2) === 'rl') {
                        $result['searchedInSectionInfo'] = LocalizationUtility::translate('result.inSection', 'IndexedSearch') . ' "' . substr($this->getPathFromPageId(substr($this->searchData['sections'], 4)), 1) . '"';
                }
                return $result;
index 8632cc2..f8461a8 100644 (file)
@@ -25,11 +25,12 @@ namespace TYPO3\CMS\IndexedSearch\Example;
 class PluginHook {
 
        /**
+        * Is set to a reference to the parent object, "pi1/class.indexedsearch.php"
+        *
         * @var \TYPO3\CMS\IndexedSearch\Controller\SearchFormController
         */
        public $pObj;
 
-       // Is set to a reference to the parent object, "pi1/class.indexedsearch.php"
        /**
         * EXAMPLE of how you can post process the initialized values in the frontend plugin.
         * The example reverses the order of elements in the ranking selector box. You can modify other values like this or add / remove items.
@@ -46,7 +47,7 @@ class PluginHook {
        /**
         * Providing an alternative search algorithm!
         *
-        * @param array Array of search words
+        * @param array $sWArr Array of search words
         * @return array Array of first row, result rows, count
         */
        public function getResultRows($sWArr) {
index cb10c65..09b3992 100644 (file)
@@ -14,41 +14,62 @@ namespace TYPO3\CMS\IndexedSearch;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\CommandUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+
 /**
  * External standard parsers for indexed_search
  * MUST RETURN utf-8 content!
  */
 class FileContentParser {
 
-       // This value is also overridden from config.
+       /**
+        * This value is also overridden from config.
+        * zero: whole PDF file is indexed in one. positive value: Indicates number of pages at a time, eg. "5" would means 1-5,6-10,....
+        * Negative integer would indicate (abs value) number of groups. Eg "3" groups of 10 pages would be 1-4,5-8,9-10
+        *
+        * @var int
+        */
        public $pdf_mode = -20;
 
-       // zero: whole PDF file is indexed in one. positive value: Indicates number of pages at a time, eg. "5" would means 1-5,6-10,.... Negative integer would indicate (abs value) number of groups. Eg "3" groups of 10 pages would be 1-4,5-8,9-10
-       // This array is configured in initialization:
+       /**
+        * @var array
+        */
        public $app = array();
 
+       /**
+        * @var array
+        */
        public $ext2itemtype_map = array();
 
+       /**
+        * @var array
+        */
        public $supportedExtensions = array();
 
+       /**
+        * @var \TYPO3\CMS\IndexedSearch\Indexer
+        */
        public $pObj;
 
-       // Reference to parent object (indexer class)
+       /**
+        * @var \TYPO3\CMS\Lang\LanguageService|\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
+        */
        protected $langObject;
 
-       // Reference to LANG-Object
        /**
         * Constructs this external parsers object
         */
        public function __construct() {
                // Set the language object to be used accordant to current TYPO3_MODE:
-               $this->langObject = TYPO3_MODE == 'FE' ? $GLOBALS['TSFE'] : $GLOBALS['LANG'];
+               $this->langObject = TYPO3_MODE === 'FE' ? $GLOBALS['TSFE'] : $GLOBALS['LANG'];
        }
 
        /**
         * Initialize external parser for parsing content.
         *
-        * @param string File extension
+        * @param string $extension File extension
         * @return bool Returns TRUE if extension is supported/enabled, otherwise FALSE.
         */
        public function initParser($extension) {
@@ -60,7 +81,7 @@ class FileContentParser {
                $extOK = FALSE;
                $mainExtension = '';
                // Ignore extensions
-               $ignoreExtensions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), TRUE);
+               $ignoreExtensions = GeneralUtility::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), TRUE);
                if (in_array($extension, $ignoreExtensions)) {
                        $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_main.xlf:ignoreExtensions'), $extension), 1);
                        return FALSE;
@@ -75,7 +96,7 @@ class FileContentParser {
                                                $this->app['pdfinfo'] = $pdfPath . 'pdfinfo' . $exe;
                                                $this->app['pdftotext'] = $pdfPath . 'pdftotext' . $exe;
                                                // PDF mode:
-                                               $this->pdf_mode = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($indexerConfig['pdf_mode'], -100, 100);
+                                               $this->pdf_mode = MathUtility::forceIntegerInRange($indexerConfig['pdf_mode'], -100, 100);
                                                $extOK = TRUE;
                                        } else {
                                                $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_main.xlf:pdfToolsNotFound'), $pdfPath), 3);
@@ -99,7 +120,6 @@ class FileContentParser {
                                }
                                break;
                        case 'pps':
-
                        case 'ppt':
                                // MS PowerPoint
                                // ppthtml
@@ -131,15 +151,10 @@ class FileContentParser {
                                }
                                break;
                        case 'sxc':
-
                        case 'sxi':
-
                        case 'sxw':
-
                        case 'ods':
-
                        case 'odp':
-
                        case 'odt':
                                // Oasis OpenDocument Text
                                if ($indexerConfig['unzip']) {
@@ -169,17 +184,13 @@ class FileContentParser {
                                }
                                break;
                        case 'txt':
-
                        case 'csv':
-
                        case 'xml':
-
                        case 'tif':
                                // PHP EXIF
                                $extOK = TRUE;
                                break;
                        case 'html':
-
                        case 'htm':
                                // PHP strip-tags()
                                $extOK = TRUE;
@@ -187,7 +198,6 @@ class FileContentParser {
                                // making "html" the common "item_type"
                                break;
                        case 'jpg':
-
                        case 'jpeg':
                                // PHP EXIF
                                $extOK = TRUE;
@@ -201,73 +211,56 @@ class FileContentParser {
                        $this->ext2itemtype_map[$extension] = $mainExtension ?: $extension;
                        return TRUE;
                }
+               return FALSE;
        }
 
        /**
         * Initialize external parser for backend modules
         * Doesn't evaluate if parser is configured right - more like returning POSSIBLE supported extensions (for showing icons etc) in backend and frontend plugin
         *
-        * @param string File extension to initialize for.
+        * @param string $extension File extension to initialize for.
         * @return bool Returns TRUE if the extension is supported and enabled, otherwise FALSE.
         */
        public function softInit($extension) {
                switch ($extension) {
                        case 'pdf':
-
                        case 'doc':
-
                        case 'pps':
-
                        case 'ppt':
-
                        case 'xls':
-
                        case 'sxc':
-
                        case 'sxi':
-
                        case 'sxw':
-
                        case 'ods':
-
                        case 'odp':
-
                        case 'odt':
-
                        case 'rtf':
-
                        case 'txt':
-
                        case 'html':
-
                        case 'htm':
-
                        case 'csv':
-
                        case 'xml':
-
                        case 'jpg':
-
                        case 'jpeg':
-
                        case 'tif':
                                // TIF images (EXIF comment)
                                return TRUE;
                                break;
                }
+               return FALSE;
        }
 
        /**
         * Return title of entry in media type selector box.
         *
-        * @param string File extension
+        * @param string $extension File extension
         * @return string String with label value of entry in media type search selector box (frontend plugin).
         */
        public function searchTypeMediaTitle($extension) {
                // Read indexer-config
                $indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
                // Ignore extensions
-               $ignoreExtensions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), TRUE);
+               $ignoreExtensions = GeneralUtility::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), TRUE);
                if (in_array($extension, $ignoreExtensions)) {
                        return FALSE;
                }
@@ -286,7 +279,6 @@ class FileContentParser {
                                }
                                break;
                        case 'pps':
-
                        case 'ppt':
                                // MS PowerPoint
                                // ppthtml
@@ -344,15 +336,12 @@ class FileContentParser {
                                }
                                break;
                        case 'jpeg':
-
                        case 'jpg':
-
                        case 'tif':
                                // PHP EXIF
                                return sprintf($this->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_main.xlf:extension.Images'), $extension);
                                break;
                        case 'html':
-
                        case 'htm':
                                // PHP strip-tags()
                                return sprintf($this->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang_main.xlf:extension.HTML'), $extension);
@@ -372,12 +361,13 @@ class FileContentParser {
                        default:
                                // Do nothing
                }
+               return '';
        }
 
        /**
         * Returns TRUE if the input extension (item_type) is a potentially a multi-page extension
         *
-        * @param string Extension / item_type string
+        * @param string $extension Extension / item_type string
         * @return bool Return TRUE if multi-page
         */
        public function isMultiplePageExtension($extension) {
@@ -387,6 +377,7 @@ class FileContentParser {
                                return TRUE;
                                break;
                }
+               return FALSE;
        }
 
        /**
@@ -414,7 +405,7 @@ class FileContentParser {
         * @return array Standard content array (title, description, keywords, body keys)
         */
        public function readFileContent($ext, $absFile, $cPKey) {
-               unset($contentArr);
+               $contentArr = NULL;
                // Return immediately if initialization didn't set support up:
                if (!$this->supportedExtensions[$ext]) {
                        return FALSE;
@@ -426,20 +417,20 @@ class FileContentParser {
                                        $this->setLocaleForServerFileSystem();
                                        // Getting pdf-info:
                                        $cmd = $this->app['pdfinfo'] . ' ' . escapeshellarg($absFile);
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $pdfInfo = $this->splitPdfInfo($res);
                                        unset($res);
                                        if ((int)$pdfInfo['pages']) {
                                                list($low, $high) = explode('-', $cPKey);
                                                // Get pdf content:
-                                               $tempFileName = \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('Typo3_indexer');
+                                               $tempFileName = GeneralUtility::tempnam('Typo3_indexer');
                                                // Create temporary name
                                                @unlink($tempFileName);
                                                // Delete if exists, just to be safe.
                                                $cmd = $this->app['pdftotext'] . ' -f ' . $low . ' -l ' . $high . ' -enc UTF-8 -q ' . escapeshellarg($absFile) . ' ' . $tempFileName;
-                                               \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
+                                               CommandUtility::exec($cmd);
                                                if (@is_file($tempFileName)) {
-                                                       $content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
+                                                       $content = GeneralUtility::getUrl($tempFileName);
                                                        unlink($tempFileName);
                                                } else {
                                                        $content = '';
@@ -456,7 +447,7 @@ class FileContentParser {
                                if ($this->app['catdoc']) {
                                        $this->setLocaleForServerFileSystem();
                                        $cmd = $this->app['catdoc'] . ' -d utf-8 ' . escapeshellarg($absFile);
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $content = implode(LF, $res);
                                        unset($res);
                                        $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content));
@@ -464,12 +455,11 @@ class FileContentParser {
                                }
                                break;
                        case 'pps':
-
                        case 'ppt':
                                if ($this->app['ppthtml']) {
                                        $this->setLocaleForServerFileSystem();
                                        $cmd = $this->app['ppthtml'] . ' ' . escapeshellarg($absFile);
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $content = implode(LF, $res);
                                        unset($res);
                                        $content = $this->pObj->convertHTMLToUtf8($content);
@@ -482,7 +472,7 @@ class FileContentParser {
                                if ($this->app['xlhtml']) {
                                        $this->setLocaleForServerFileSystem();
                                        $cmd = $this->app['xlhtml'] . ' -nc -te ' . escapeshellarg($absFile);
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $content = implode(LF, $res);
                                        unset($res);
                                        $content = $this->pObj->convertHTMLToUtf8($content);
@@ -492,26 +482,21 @@ class FileContentParser {
                                }
                                break;
                        case 'sxi':
-
                        case 'sxc':
-
                        case 'sxw':
-
                        case 'ods':
-
                        case 'odp':
-
                        case 'odt':
                                if ($this->app['unzip']) {
                                        $this->setLocaleForServerFileSystem();
                                        // Read content.xml:
                                        $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' content.xml';
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $content_xml = implode(LF, $res);
                                        unset($res);
                                        // Read meta.xml:
                                        $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' meta.xml';
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $meta_xml = implode(LF, $res);
                                        unset($res);
                                        $utf8_content = trim(strip_tags(str_replace('<', ' <', $content_xml)));
@@ -519,7 +504,7 @@ class FileContentParser {
                                        $contentArr['title'] = basename($absFile);
                                        // Make sure the title doesn't expose the absolute path!
                                        // Meta information
-                                       $metaContent = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2tree($meta_xml);
+                                       $metaContent = GeneralUtility::xml2tree($meta_xml);
                                        $metaContent = $metaContent['office:document-meta'][0]['ch']['office:meta'][0]['ch'];
                                        if (is_array($metaContent)) {
                                                $contentArr['title'] = $metaContent['dc:title'][0]['values'][0] ? $metaContent['dc:title'][0]['values'][0] : $contentArr['title'];
@@ -538,7 +523,7 @@ class FileContentParser {
                                if ($this->app['unrtf']) {
                                        $this->setLocaleForServerFileSystem();
                                        $cmd = $this->app['unrtf'] . ' ' . escapeshellarg($absFile);
-                                       \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                                       CommandUtility::exec($cmd, $res);
                                        $fileContent = implode(LF, $res);
                                        unset($res);
                                        $fileContent = $this->pObj->convertHTMLToUtf8($fileContent);
@@ -547,11 +532,10 @@ class FileContentParser {
                                }
                                break;
                        case 'txt':
-
                        case 'csv':
                                $this->setLocaleForServerFileSystem();
                                // Raw text
-                               $content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absFile);
+                               $content = GeneralUtility::getUrl($absFile);
                                // @todo Implement auto detection of charset (currently assuming utf-8)
                                $contentCharset = 'utf-8';
                                $content = $this->pObj->convertHTMLToUtf8($content, $contentCharset);
@@ -561,16 +545,15 @@ class FileContentParser {
                                $this->setLocaleForServerFileSystem(TRUE);
                                break;
                        case 'html':
-
                        case 'htm':
-                               $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absFile);
+                               $fileContent = GeneralUtility::getUrl($absFile);
                                $fileContent = $this->pObj->convertHTMLToUtf8($fileContent);
                                $contentArr = $this->pObj->splitHTMLContent($fileContent);
                                break;
                        case 'xml':
                                $this->setLocaleForServerFileSystem();
                                // PHP strip-tags()
-                               $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absFile);
+                               $fileContent = GeneralUtility::getUrl($absFile);
                                // Finding charset:
                                preg_match('/^[[:space:]]*<\\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i', substr($fileContent, 0, 200), $reg);
                                $charset = $reg[1] ? $this->pObj->csObj->parse_charset($reg[1]) : 'utf-8';
@@ -582,9 +565,7 @@ class FileContentParser {
                                $this->setLocaleForServerFileSystem(TRUE);
                                break;
                        case 'jpg':
-
                        case 'jpeg':
-
                        case 'tif':
                                $this->setLocaleForServerFileSystem();
                                // PHP EXIF
@@ -663,7 +644,7 @@ class FileContentParser {
                                $this->setLocaleForServerFileSystem();
                                // Getting pdf-info:
                                $cmd = $this->app['pdfinfo'] . ' ' . escapeshellarg($absFile);
-                               \TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
+                               CommandUtility::exec($cmd, $res);
                                $pdfInfo = $this->splitPdfInfo($res);
                                unset($res);
                                if ((int)$pdfInfo['pages']) {
@@ -672,7 +653,7 @@ class FileContentParser {
                                        if ($this->pdf_mode > 0) {
                                                $iter = ceil($pdfInfo['pages'] / $this->pdf_mode);
                                        } else {
-                                               $iter = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(abs($this->pdf_mode), 1, $pdfInfo['pages']);
+                                               $iter = MathUtility::forceIntegerInRange(abs($this->pdf_mode), 1, $pdfInfo['pages']);
                                        }
                                        // Traverse and create intervals.
                                        for ($a = 0; $a < $iter; $a++) {
@@ -691,7 +672,7 @@ class FileContentParser {
        /**
         * Analysing PDF info into a useable format.
         *
-        * @param array Array of PDF content, coming from the pdfinfo tool
+        * @param array $pdfInfoArray Array of PDF content, coming from the pdfinfo tool
         * @return array Result array
         * @access private
         * @see fileContentParts()
@@ -712,7 +693,7 @@ class FileContentParser {
        /**
         * Removes some strange char(12) characters and line breaks that then to occur in the end of the string from external files.
         *
-        * @param string String to clean up
+        * @param string $string String to clean up
         * @return string String
         */
        public function removeEndJunk($string) {
@@ -727,8 +708,8 @@ class FileContentParser {
        /**
         * Return icon for file extension
         *
-        * @param string File extension, lowercase.
-        * @return string Relative file reference, resolvable by \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName()
+        * @param string $extension File extension, lowercase.
+        * @return string Relative file reference, resolvable by GeneralUtility::getFileAbsFileName()
         */
        public function getIcon($extension) {
                if ($extension === 'htm') {
index 08dc5bb..bee4340 100644 (file)
@@ -23,27 +23,25 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  */
 class CrawlerHook {
 
-       // Static:
        /**
+        * Number of seconds to use as interval between queued indexing operations of URLs / files (types 2 & 3)
+        *
         * @var int
         */
        public $secondsPerExternalUrl = 3;
 
-       // Number of seconds to use as interval between queued indexing operations of URLs / files (types 2 & 3)
-       // Internal, dynamic:
        /**
+        * Counts up for each added URL (type 3)
+        *
         * @var int
         */
        public $instanceCounter = 0;
 
-       // Counts up for each added URL (type 3)
-       // Internal, static:
        /**
         * @var string
         */
        public $callBack = CrawlerHook::class;
 
-       // The object reference to this class.
        /**
         * Initialization of crawler hook.
         * This function is asked for each instance of the crawler and we must check if something is timed to happen and if so put entry(s) in the crawlers log to start processing.
@@ -442,9 +440,9 @@ class CrawlerHook {
        /**
         * Check if an input URL are allowed to be indexed. Depends on whether it is already present in the url log.
         *
-        * @param string URL string to check
-        * @param array Array of already indexed URLs (input url is looked up here and must not exist already)
-        * @param string Base URL of the indexing process (input URL must be "inside" the base URL!)
+        * @param string $url URL string to check
+        * @param array $urlLog Array of already indexed URLs (input url is looked up here and must not exist already)
+        * @param string $baseUrl Base URL of the indexing process (input URL must be "inside" the base URL!)
         * @return string Returls the URL if OK, otherwise FALSE
         */
        public function checkUrl($url, $urlLog, $baseUrl) {
@@ -462,11 +460,11 @@ class CrawlerHook {
        /**
         * Indexing External URL
         *
-        * @param string URL, http://....
-        * @param int Page id to relate indexing to.
-        * @param array Rootline array to relate indexing to
-        * @param int Configuration UID
-        * @param int Set ID value
+        * @param string $url URL, http://....
+        * @param int $pageId Page id to relate indexing to.
+        * @param array $rl Rootline array to relate indexing to
+        * @param int $cfgUid Configuration UID
+        * @param int $setId Set ID value
         * @return array URLs found on this page
         */
        public function indexExtUrl($url, $pageId, $rl, $cfgUid, $setId) {
@@ -510,9 +508,9 @@ class CrawlerHook {
        /**
         * Indexing Single Record
         *
-        * @param array Record to index
-        * @param array Configuration Record
-        * @param array Rootline array to relate indexing to
+        * @param array $r Record to index
+        * @param array $cfgRec Configuration Record
+        * @param array $rl Rootline array to relate indexing to
         * @return void
         */
        public function indexSingleRecord($r, $cfgRec, $rl = NULL) {
@@ -543,7 +541,7 @@ class CrawlerHook {
         * Get rootline for closest TypoScript template root.
         * Algorithm same as used in Web > Template, Object browser
         *
-        * @param int The page id to traverse rootline back from
+        * @param int $id The page id to traverse rootline back from
         * @return array Array where the root lines uid values are found.
         */
        public function getUidRootLineForClosestTemplate($id) {
@@ -567,7 +565,7 @@ class CrawlerHook {
        /**
         * Generate the unix time stamp for next visit.
         *
-        * @param array Index configuration record
+        * @param array $cfgRec Index configuration record
         * @return int The next time stamp
         */
        public function generateNextIndexingTime($cfgRec) {
@@ -585,15 +583,14 @@ class CrawlerHook {
                // Now, find out how many blocks of the length of frequency there is until the next time:
                $frequencyBlocksUntilNextTime = ceil(($currentTime - $lastSureOffset) / $frequencySeconds);
                // Set next time to the offset + the frequencyblocks multiplied with the frequency length in seconds.
-               $nextTime = $lastSureOffset + $frequencyBlocksUntilNextTime * $frequencySeconds;
-               return $nextTime;
+               return $lastSureOffset + $frequencyBlocksUntilNextTime * $frequencySeconds;
        }
 
        /**
         * Checks if $url has any of the URls in the $url_deny "list" in it and if so, returns TRUE.
         *
-        * @param string URL to test
-        * @param string String where URLs are separated by line-breaks; If any of these strings is the first part of $url, the function returns TRUE (to indicate denial of decend)
+        * @param string $url URL to test
+        * @param string $url_deny String where URLs are separated by line-breaks; If any of these strings is the first part of $url, the function returns TRUE (to indicate denial of decend)
         * @return bool TRUE if there is a matching URL (hence, do not index!)
         */
        public function checkDeniedSuburls($url, $url_deny) {
@@ -612,8 +609,8 @@ class CrawlerHook {
        /**
         * Adding entry in queue for Hook
         *
-        * @param array Configuration record
-        * @param string Title/URL
+        * @param array $cfgRec Configuration record
+        * @param string $title Title/URL
         * @return void
         */
        public function addQueueEntryForHook($cfgRec, $title) {
@@ -629,7 +626,7 @@ class CrawlerHook {
        /**
         * Deletes all data stored by indexed search for a given page
         *
-        * @param int Uid of the page to delete all pHash
+        * @param int $id Uid of the page to delete all pHash
         * @return void
         */
        public function deleteFromIndex($id) {
@@ -641,7 +638,14 @@ class CrawlerHook {
                                $pHashesToDelete[] = $pHashRow['phash'];
                        }
                        $where_clause = 'phash IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)) . ')';
-                       $tables = explode(',', 'index_debug,index_fulltext,index_grlist,index_phash,index_rel,index_section');
+                       $tables = array(
+                               'index_debug',
+                               'index_fulltext',
+                               'index_grlist',
+                               'index_phash',
+                               'index_rel',
+                               'index_section',
+                       );
                        foreach ($tables as $table) {
                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where_clause);
                        }
@@ -665,7 +669,7 @@ class CrawlerHook {
         */
        public function processCmdmap_preProcess($command, $table, $id, $value, $pObj) {
                // Clean up the index
-               if ($command == 'delete' && $table == 'pages') {
+               if ($command === 'delete' && $table === 'pages') {
                        $this->deleteFromIndex($id);
                }
        }
@@ -684,9 +688,9 @@ class CrawlerHook {
                // Check if any fields are actually updated:
                if (!empty($fieldArray)) {
                        // Translate new ids.
-                       if ($status == 'new') {
+                       if ($status === 'new') {
                                $id = $pObj->substNEWwithIDs[$id];
-                       } elseif ($table == 'pages' && $status == 'update' && (array_key_exists('hidden', $fieldArray) && $fieldArray['hidden'] == 1 || array_key_exists('no_search', $fieldArray) && $fieldArray['no_search'] == 1)) {
+                       } elseif ($table === 'pages' && $status === 'update' && (array_key_exists('hidden', $fieldArray) && $fieldArray['hidden'] == 1 || array_key_exists('no_search', $fieldArray) && $fieldArray['no_search'] == 1)) {
                                // If the page should be hidden or not indexed after update, delete index for this page
                                $this->deleteFromIndex($id);
                        }
index 0b19635..a5c677e 100644 (file)
@@ -21,7 +21,6 @@ namespace TYPO3\CMS\IndexedSearch\Utility;
  */
 class DoubleMetaPhoneUtility {
 
-       //  properties
        /**
         * @var string
         */
index 3d73df1..a9ac543 100644 (file)
@@ -141,7 +141,6 @@ class IndexedSearchUtility {
         * @param string $operator The possible operator to find in the internal operator array.
         * @param array $operatorTranslateTable an array of possible operators
         * @return string If found, the SQL operator for the localized input operator.
-        * @access private
         */
        static protected function getOperator($operator, $operatorTranslateTable) {
                $operator = trim($operator);
index 3ec7775..b6921d7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace TYPO3\CMS\IndexedSearch\ViewHelpers\Format;
 
-/**
+/*
  * This file is part of the TYPO3 CMS project.
  *
  * It is free software; you can redistribute it and/or modify it under
@@ -24,7 +24,6 @@ use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
  */
 class DateTimeViewHelper extends AbstractViewHelper implements CompilableInterface {
 
-
        /**
         * Render the given timestamp as date & time
         *
index a61ad90..49d89f1 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace TYPO3\CMS\IndexedSearch\ViewHelpers\Format;
 
-/**
+/*
  * This file is part of the TYPO3 CMS project.
  *
  * It is free software; you can redistribute it and/or modify it under
index 6d1ac6e..e813d95 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace TYPO3\CMS\IndexedSearch\ViewHelpers\Format;
 
-/**
+/*
  * This file is part of the TYPO3 CMS project.
  *
  * It is free software; you can redistribute it and/or modify it under