summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-12-09 20:11:00 +0100
committerAndreas Gohr <andi@splitbrain.org>2014-12-09 20:11:00 +0100
commit61a4313f55c7e83e0b78c9c6a8eb2efb13ff0512 (patch)
treec7269ea61f5d4230a6f916dbabee4ce412e0a9fb /inc/parser
parent9a0ca2cfd8ac42895af3be2efbd2cab7e6d33578 (diff)
parent8702de7f7e170bddfdb622c393c3cac3446fd1c5 (diff)
downloadrpg-61a4313f55c7e83e0b78c9c6a8eb2efb13ff0512.tar.gz
rpg-61a4313f55c7e83e0b78c9c6a8eb2efb13ff0512.tar.bz2
Merge pull request #945 from splitbrain/scrutinizerissues
Scrutinizer issues and IXR library updates
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php5
-rw-r--r--inc/parser/lexer.php25
-rw-r--r--inc/parser/metadata.php16
-rw-r--r--inc/parser/renderer.php10
-rw-r--r--inc/parser/xhtml.php22
5 files changed, 49 insertions, 29 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 62a1c241e..d96a01a60 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -712,6 +712,9 @@ class Doku_Handler_CallWriter {
var $Handler;
+ /**
+ * @param Doku_Handler $Handler
+ */
function Doku_Handler_CallWriter(& $Handler) {
$this->Handler = & $Handler;
}
@@ -748,7 +751,7 @@ class Doku_Handler_Nest {
/**
* constructor
*
- * @param object $CallWriter the renderers current call writer
+ * @param Doku_Handler_CallWriter $CallWriter the renderers current call writer
* @param string $close closing instruction name, this is required to properly terminate the
* syntax mode if the document ends without a closing pattern
*/
diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php
index 2e84eca7c..b46a5f505 100644
--- a/inc/parser/lexer.php
+++ b/inc/parser/lexer.php
@@ -56,12 +56,12 @@ class Doku_LexerParallelRegex {
/**
* Adds a pattern with an optional label.
*
- * @param mixed $pattern Perl style regex. Must be UTF-8
+ * @param mixed $pattern Perl style regex. Must be UTF-8
* encoded. If its a string, the (, )
* lose their meaning unless they
* form part of a lookahead or
* lookbehind assertation.
- * @param string $label Label of regex to be returned
+ * @param bool|string $label Label of regex to be returned
* on a match. Label must be ASCII
* @access public
*/
@@ -151,7 +151,8 @@ class Doku_LexerParallelRegex {
* "or" operator. Caches the regex.
* Will automatically escape (, ) and / tokens.
*
- * @param array $patterns List of patterns in order.
+ * @internal array $_patterns List of patterns in order.
+ * @return null|string
* @access private
*/
function _getCompoundedRegex() {
@@ -297,6 +298,7 @@ class Doku_Lexer {
*/
function Doku_Lexer(&$parser, $start = "accept", $case = false) {
$this->_case = $case;
+ /** @var Doku_LexerParallelRegex[] _regexes */
$this->_regexes = array();
$this->_parser = &$parser;
$this->_mode = new Doku_LexerStateStack($start);
@@ -425,11 +427,13 @@ class Doku_Lexer {
* Sends the matched token and any leading unmatched
* text to the parser changing the lexer to a new
* mode if one is listed.
- * @param string $unmatched Unmatched leading portion.
- * @param string $matched Actual token match.
- * @param string $mode Mode after match. A boolean
+ * @param string $unmatched Unmatched leading portion.
+ * @param string $matched Actual token match.
+ * @param bool|string $mode Mode after match. A boolean
* false mode causes no change.
- * @param int $pos Current byte index location in raw doc
+ * @param int $initialPos
+ * @param int $matchPos
+ * Current byte index location in raw doc
* thats being parsed
* @return boolean False if there was any error
* from the parser.
@@ -498,11 +502,12 @@ class Doku_Lexer {
* Calls the parser method named after the current
* mode. Empty content will be ignored. The lexer
* has a parser handler for each mode in the lexer.
- * @param string $content Text parsed.
- * @param boolean $is_match Token is recognised rather
+ * @param string $content Text parsed.
+ * @param boolean $is_match Token is recognised rather
* than unparsed data.
- * @param int $pos Current byte index location in raw doc
+ * @param int $pos Current byte index location in raw doc
* thats being parsed
+ * @return bool
* @access private
*/
function _invokeParser($content, $is_match, $pos) {
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index 313b70df5..ac8fd2130 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -165,7 +165,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
if(!isset($this->meta['title'])) $this->meta['title'] = $text;
// add the header to the TOC
- $hid = $this->_headerToLink($text, 'true');
+ $hid = $this->_headerToLink($text, true);
$this->toc_additem($hid, $text, $level);
// add to summary
@@ -422,8 +422,8 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* keep track of internal links in $this->meta['relation']['references']
*
- * @param string $id page ID to link to. eg. 'wiki:syntax'
- * @param string|array $name name for the link, array for media file
+ * @param string $id page ID to link to. eg. 'wiki:syntax'
+ * @param string|array|null $name name for the link, array for media file
*/
function internallink($id, $name = null) {
global $ID;
@@ -459,8 +459,8 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render an external link
*
- * @param string $url full URL with scheme
- * @param string|array $name name for the link, array for media file
+ * @param string $url full URL with scheme
+ * @param string|array|null $name name for the link, array for media file
*/
function externallink($url, $name = null) {
if(is_array($name)) {
@@ -629,9 +629,9 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* Construct a title and handle images in titles
*
* @author Harry Fuecks <hfuecks@gmail.com>
- * @param string|array $title either string title or media array
- * @param string $default default title if nothing else is found
- * @param null|string $id linked page id (used to extract title from first heading)
+ * @param string|array|null $title either string title or media array
+ * @param string $default default title if nothing else is found
+ * @param null|string $id linked page id (used to extract title from first heading)
* @return string title text
*/
function _getLinkTitle($title, $default, $id = null) {
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php
index 668b617d1..e1d28267a 100644
--- a/inc/parser/renderer.php
+++ b/inc/parser/renderer.php
@@ -190,7 +190,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
/**
* Render plain text data
*
- * @param $text
+ * @param string $text
*/
function cdata($text) {
}
@@ -760,6 +760,9 @@ class Doku_Renderer extends DokuWiki_Plugin {
* casing and special chars
*
* @author Andreas Gohr <andi@splitbrain.org>
+ *
+ * @param string $name
+ * @return string
*/
function _simpleTitle($name) {
global $conf;
@@ -779,6 +782,11 @@ class Doku_Renderer extends DokuWiki_Plugin {
/**
* Resolve an interwikilink
+ *
+ * @param string $shortcut identifier for the interwiki link
+ * @param string $reference fragment that refers the content
+ * @param null|bool $exists reference which returns if an internal page exists
+ * @return string interwikilink
*/
function _resolveInterWiki(&$shortcut, $reference, &$exists = null) {
//get interwiki URL
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index b73e3a881..f1703111e 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -59,10 +59,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Register a new edit section range
*
- * @param $type string The section type identifier
- * @param $title string The section title
- * @param $start int The byte position for the edit start
- * @return string A marker class for the starting HTML element
+ * @param string $type The section type identifier
+ * @param string $title The section title
+ * @param int $start The byte position for the edit start
+ * @return string A marker class for the starting HTML element
+ *
* @author Adrian Lang <lang@cosmocode.de>
*/
public function startSectionEdit($start, $type, $title = null) {
@@ -73,8 +74,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Finish an edit section range
*
- * @param $end int The byte position for the edit end; null for the rest of
- * the page
+ * @param int $end The byte position for the edit end; null for the rest of the page
+ *
* @author Adrian Lang <lang@cosmocode.de>
*/
public function finishSectionEdit($end = null) {
@@ -823,6 +824,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// now first resolve and clean up the $id
resolve_pageid(getNS($ID), $id, $exists, $this->date_at, true);
+ $link = array();
$name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype);
if(!$isImage) {
if($exists) {
@@ -910,6 +912,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
}
//prepare for formating
+ $link = array();
$link['target'] = $conf['target']['extern'];
$link['style'] = '';
$link['pre'] = '';
@@ -987,6 +990,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
global $conf;
//simple setup
+ $link = array();
$link['target'] = $conf['target']['windows'];
$link['pre'] = '';
$link['suf'] = '';
@@ -1578,7 +1582,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* Returns HTML code for images used in link titles
*
* @author Andreas Gohr <andi@splitbrain.org>
- * @param string $img
+ * @param array $img
* @return string HTML img tag or similar
*/
function _imageTitle($img) {
@@ -1663,7 +1667,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// prepare alternative formats
$extensions = array('webm', 'ogv', 'mp4');
$files = media_alternativefiles($src, $extensions);
- $poster = media_alternativefiles($src, array('jpg', 'png'), true);
+ $poster = media_alternativefiles($src, array('jpg', 'png'));
if(!empty($poster)) {
$posterUrl = ml(reset($poster), '', true, '&');
}
@@ -1707,7 +1711,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param array $atts - additional attributes for the <audio> tag
* @return string
*/
- function _audio($src, $atts = null) {
+ function _audio($src, $atts = array()) {
$files = array();
$isExternal = media_isexternal($src);