From 42ea7f447f39fbc2f79eaaec31f8c10ede59c5d0 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 11:30:27 +0200 Subject: Many PHPDocs, some unused and dyn declared vars many PHPDocs some unused variables some dynamically declared variables declared --- inc/indexer.php | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 6 deletions(-) (limited to 'inc/indexer.php') diff --git a/inc/indexer.php b/inc/indexer.php index 5ca2f0bb1..ec0c523e0 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -61,6 +61,8 @@ define('IDX_ASIAN', '(?:'.IDX_ASIAN1.'|'.IDX_ASIAN2.'|'.IDX_ASIAN3.')'); * * @author Tom N Harris * @author Michael Hamann + * + * @return int|string */ function idx_get_version(){ static $indexer_version = null; @@ -84,6 +86,9 @@ function idx_get_version(){ * Differs from strlen in handling of asian characters. * * @author Tom N Harris + * + * @param string $w + * @return int */ function wordlen($w){ $l = strlen($w); @@ -115,7 +120,8 @@ class Doku_Indexer { * * @param string $page a page name * @param string $text the body of the page - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris * @author Andreas Gohr */ @@ -190,6 +196,7 @@ class Doku_Indexer { * * @param string $text content of the page * @return array list of word IDs and number of times used + * * @author Andreas Gohr * @author Christopher Smith * @author Tom N Harris @@ -245,7 +252,8 @@ class Doku_Indexer { * @param string $page a page name * @param mixed $key a key string or array of key=>value pairs * @param mixed $value the value or list of values - * @return boolean the function completed successfully + * @return boolean|string the function completed successfully + * * @author Tom N Harris * @author Michael Hamann */ @@ -453,7 +461,8 @@ class Doku_Indexer { * Erases entries in all known indexes. * * @param string $page a page name - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris */ public function deletePage($page) { @@ -474,6 +483,7 @@ class Doku_Indexer { * * @param string $page a page name * @return boolean the function completed successfully + * * @author Tom N Harris */ protected function deletePageNoLock($page) { @@ -568,6 +578,7 @@ class Doku_Indexer { * @param string $text plain text * @param boolean $wc are wildcards allowed? * @return array list of words in the text + * * @author Tom N Harris * @author Andreas Gohr */ @@ -676,6 +687,7 @@ class Doku_Indexer { * * @param array $tokens list of words to search for * @return array list of page names with usage counts + * * @author Tom N Harris * @author Andreas Gohr */ @@ -730,6 +742,7 @@ class Doku_Indexer { * @param string $value search term to look for, must be a string or array of strings * @param callback $func comparison function * @return array lists with page names, keys are query values if $value is array + * * @author Tom N Harris * @author Michael Hamann */ @@ -829,6 +842,7 @@ class Doku_Indexer { * @param array $words The query terms. * @param array $result Set to word => array("length*id" ...) * @return array Set to length => array(id ...) + * * @author Tom N Harris */ protected function getIndexWords(&$words, &$result) { @@ -909,6 +923,7 @@ class Doku_Indexer { * * @param string $key list only pages containing the metadata key (optional) * @return array list of page names + * * @author Tom N Harris */ public function getPages($key=null) { @@ -942,6 +957,7 @@ class Doku_Indexer { * @param int $minlen minimum length of words to count * @param string $key metadata key to list. Uses the fulltext index if not given * @return array list of words as the keys and frequency as values + * * @author Tom N Harris */ public function histogram($min=1, $max=0, $minlen=3, $key=null) { @@ -1002,6 +1018,8 @@ class Doku_Indexer { * Lock the indexer. * * @author Tom N Harris + * + * @return bool|string */ protected function lock() { global $conf; @@ -1033,6 +1051,8 @@ class Doku_Indexer { * Release the indexer lock. * * @author Tom N Harris + * + * @return bool */ protected function unlock() { global $conf; @@ -1050,6 +1070,7 @@ class Doku_Indexer { * @param string $idx name of the index * @param string $suffix subpart identifier * @return array list of lines without CR or LF + * * @author Tom N Harris */ protected function getIndex($idx, $suffix) { @@ -1066,6 +1087,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param array $lines list of lines without LF * @return bool If saving succeeded + * * @author Tom N Harris */ protected function saveIndex($idx, $suffix, &$lines) { @@ -1090,6 +1112,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param int $id the line number * @return string a line with trailing whitespace removed + * * @author Tom N Harris */ protected function getIndexKey($idx, $suffix, $id) { @@ -1114,6 +1137,7 @@ class Doku_Indexer { * @param int $id the line number * @param string $line line to write * @return bool If saving succeeded + * * @author Tom N Harris */ protected function saveIndexKey($idx, $suffix, $id, $line) { @@ -1155,6 +1179,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param string $value line to find in the index * @return int|bool line number of the value in the index or false if writing the index failed + * * @author Tom N Harris */ protected function addIndexKey($idx, $suffix, $value) { @@ -1178,6 +1203,8 @@ class Doku_Indexer { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY + * + * @return array */ protected function listIndexLengths() { return idx_listIndexLengths(); @@ -1190,6 +1217,9 @@ class Doku_Indexer { * that there are indices for. * * @author YoBoY + * + * @param array|int $filter + * @return array */ protected function indexLengths($filter) { global $conf; @@ -1216,6 +1246,11 @@ class Doku_Indexer { * Insert or replace a tuple in a line. * * @author Tom N Harris + * + * @param string $line + * @param string $id + * @param int $count + * @return string */ protected function updateTuple($line, $id, $count) { if ($line != ''){ @@ -1237,6 +1272,10 @@ class Doku_Indexer { * * @author Tom N Harris * @author Andreas Gohr + * + * @param array $keys + * @param string $line + * @return array */ protected function parseTuples(&$keys, $line) { $result = array(); @@ -1257,13 +1296,16 @@ class Doku_Indexer { * Sum the counts in a list of tuples. * * @author Tom N Harris + * + * @param string $line + * @return int */ protected function countTuples($line) { $freq = 0; $parts = explode(':', $line); foreach ($parts as $tuple) { if ($tuple === '') continue; - list($pid, $cnt) = explode('*', $tuple); + list(/* $pid */, $cnt) = explode('*', $tuple); $freq += (int)$cnt; } return $freq; @@ -1273,7 +1315,8 @@ class Doku_Indexer { /** * Create an instance of the indexer. * - * @return Doku_Indexer a Doku_Indexer + * @return Doku_Indexer a Doku_Indexer + * * @author Tom N Harris */ function idx_get_indexer() { @@ -1288,6 +1331,7 @@ function idx_get_indexer() { * Returns words that will be ignored. * * @return array list of stop words + * * @author Tom N Harris */ function & idx_get_stopwords() { @@ -1312,7 +1356,8 @@ function & idx_get_stopwords() { * @param string $page name of the page to index * @param boolean $verbose print status messages * @param boolean $force force reindexing even when the index is up to date - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris */ function idx_addPage($page, $verbose=false, $force=false) { @@ -1441,6 +1486,10 @@ function idx_tokenizer($string, $wc=false) { * Read the list of words in an index (if it exists). * * @author Tom N Harris + * + * @param string $idx + * @param string $suffix + * @return array */ function idx_getIndex($idx, $suffix) { global $conf; @@ -1456,6 +1505,8 @@ function idx_getIndex($idx, $suffix) { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY + * + * @return array */ function idx_listIndexLengths() { global $conf; @@ -1510,6 +1561,9 @@ function idx_listIndexLengths() { * that there are indices for. * * @author YoBoY + * + * @param array|int $filter + * @return array */ function idx_indexLengths($filter) { global $conf; @@ -1539,6 +1593,9 @@ function idx_indexLengths($filter) { * not a letter, number, or underscore. * * @author Tom N Harris + * + * @param string $name + * @return string */ function idx_cleanName($name) { $name = utf8_romanize(trim((string)$name)); -- cgit v1.2.3