cvs: pear /PhpDocumentor package.xml /PhpDocumentor/phpDocumentor InlineTags.inc /PhpDocumentor/scripts create_package.xml.php
| From: | Chuck Burgess | Date: | Fri, 28 Mar 2008 01:24:14 +0000 |
| Subject: | cvs: pear /PhpDocumentor package.xml /PhpDocumentor/phpDocumentor InlineTags.inc /PhpDocumentor/scripts create_package.xml.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-51707@lists.php.net to get a copy of this message | ||
ashnazg Fri Mar 28 01:24:14 2008 UTC
Modified files:
/pear/PhpDocumentor package.xml
/pear/PhpDocumentor/scripts create_package.xml.php
/pear/PhpDocumentor/phpDocumentor InlineTags.inc
Log:
PEAR CS cleanup for InlineTags.inc
http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/package.xml?r1=1.145&r2=1.146&diff_format=u Index: pear/PhpDocumentor/package.xml diff -u pear/PhpDocumentor/package.xml:1.145 pear/PhpDocumentor/package.xml:1.146 --- pear/PhpDocumentor/package.xml:1.145 Tue Feb 26 12:15:56 2008 +++ pear/PhpDocumentor/package.xml Fri Mar 28 01:24:13 2008 @@ -69,8 +69,8 @@ <email>drewish@php.net</email> <active>yes</active> </developer> - <date>2008-02-25</date> - <time>05:56:11</time> + <date>2008-03-27</date> + <time>19:43:35</time> <version> <release>1.4.1</release> <api>1.4.0</api> @@ -1369,7 +1369,9 @@ <file name="HighlightParser.inc" role="php"> <tasks:replace from="@VER@" to="version" type="package-info" /> </file> - <file name="InlineTags.inc" role="php" /> + <file name="InlineTags.inc" role="php"> + <tasks:replace from="@VER@" to="version" type="package-info" /> + </file> <file name="IntermediateParser.inc" role="php"> <tasks:replace from="@VER@" to="version" type="package-info" /> <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> @@ -3122,7 +3124,7 @@ <release>stable</release> <api>stable</api> </stability> - <date>2008-02-25</date> + <date>2008-03-27</date> <license uri="http://www.opensource.org/licenses/lgpl-license.php">LGPL</license> <notes> Includes these PEAR items: http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/scripts/create_package.xml.php?r1=1.128&r2=1.129&diff_format=u Index: pear/PhpDocumentor/scripts/create_package.xml.php diff -u pear/PhpDocumentor/scripts/create_package.xml.php:1.128 pear/PhpDocumentor/scripts/create_package.xml.php:1.129 --- pear/PhpDocumentor/scripts/create_package.xml.php:1.128 Tue Feb 26 12:15:56 2008 +++ pear/PhpDocumentor/scripts/create_package.xml.php Fri Mar 28 01:24:13 2008 @@ -109,6 +109,7 @@ $pfm2->addReplacement('phpDocumentor/common.inc.php', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/common.inc.php', 'pear-config', '@PEAR-DIR@', 'php_dir'); $pfm2->addReplacement('phpDocumentor/HighlightParser.inc', 'package-info', '@VER@', 'version'); +$pfm2->addReplacement('phpDocumentor/InlineTags.inc', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/IntermediateParser.inc', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/IntermediateParser.inc', 'pear-config', '@PEAR-DIR@', 'php_dir'); $pfm2->addReplacement('phpDocumentor/LinkClasses.inc', 'package-info', '@VER@', 'version'); http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/phpDocumentor/InlineTags.inc?r1=1.7&r2=1.8&diff_format=u Index: pear/PhpDocumentor/phpDocumentor/InlineTags.inc diff -u pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.7 pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.8 --- pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.7 Thu Apr 19 20:20:57 2007 +++ pear/PhpDocumentor/phpDocumentor/InlineTags.inc Fri Mar 28 01:24:13 2008 @@ -6,7 +6,7 @@ * * PHP versions 4 and 5 * - * Copyright (c) 2002-2006 Gregory Beaver + * Copyright (c) 2002-2008 Gregory Beaver * * LICENSE: * @@ -25,26 +25,38 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * @category ToolsAndUtilities * @package phpDocumentor * @subpackage InlineTags * @author Gregory Beaver <cellog@php.net> - * @copyright 2002-2006 Gregory Beaver + * @copyright 2002-2008 Gregory Beaver * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @version CVS: $Id: InlineTags.inc,v 1.7 2007/04/19 20:20:57 ashnazg Exp $ + * @version CVS: $Id: InlineTags.inc,v 1.8 2008/03/28 01:24:13 ashnazg Exp $ * @filesource * @link http://www.phpdoc.org * @link http://pear.php.net/PhpDocumentor * @since separate file since 1.2 + * @todo CS cleanup - change package to PhpDocumentor */ + /** * Use this element to represent an {@}inline tag} like {@}link} - * @see parserStringWithInlineTags - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags - * @author Greg Beaver <cellog@php.net> - * @since 1.0rc1 - * @version $Revision: 1.7 $ - * @tutorial inlinetags.pkg + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @since 1.0rc1 + * @tutorial inlinetags.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserInlineTag extends parserBase { @@ -67,30 +79,36 @@ var $inlinetype = ''; /** - * @param string $type tag type (example: link) + * sets up the tag + * + * @param string $type tag type (example: link) * @param string $value tag value (example: what to link to) */ - function parserInlineTag($type,$value) + function parserInlineTag($type, $value) { $this->inlinetype = $type; - $this->value = trim($value); + $this->value = trim($value); } /** + * get length of the tag + * * @return integer length of the tag + * @todo CS cleanup - rename to strLen for camelCase rule */ function Strlen() { // fix 1203451 - if (is_array($this->value)) - { - return array_reduce(create_function('$a,$b', 'return $a + strlen($b);')) + - count($this->value); + if (is_array($this->value)) { + return array_reduce(create_function('$a, $b', 'return $a + strlen($b);')) + + count($this->value); } return strlen($this->value); } /** + * always gets an empty string + * * @return string always '', used by {@link Parser::handleDocBlock()} to * calculate the short description of a DocBlock * @see parserStringWithInlineTags::getString() @@ -104,11 +122,22 @@ /** * represents inline links - * @tutorial tags.inlinelink.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags - * @author Greg Beaver <cellog@php.net> - * @since 1.0rc1 + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @since 1.0rc1 + * @tutorial tags.inlinelink.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserLinkInlineTag extends parserInlineTag { @@ -120,78 +149,82 @@ var $linktext = ''; /** + * sets up the tag + * * @param string $link stored in $value, see {@link parserBase::$value} * @param string $text see {@link $linktext} */ - function parserLinkInlineTag($link,$text) + function parserLinkInlineTag($link, $text) { - if (strpos($link, ',')) - { - $link = explode(',',$link); - parserInlineTag::parserInlineTag('link',''); + if (strpos($link, ',')) { + $link = explode(',', $link); + parserInlineTag::parserInlineTag('link', ''); $this->value = $link; - } else - { - parserInlineTag::parserInlineTag('link',$link); + } else { + parserInlineTag::parserInlineTag('link', $link); } $this->linktext = trim($text); } /** - * @param Converter converter used to change the abstract link into text for - * display - * @return false|string returns the converted link or false if not converted - * successfully + * calls the output conversion + * + * @param Converter &$c converter used to change the abstract link + * into text for display + * + * @return false|string returns the converted link or false + * if not converted successfully + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (is_array($this->value)) - { + if (is_array($this->value)) { $ret = ''; - foreach($this->value as $text) - { - if (!empty($ret)) - { + foreach ($this->value as $text) { + if (!empty($ret)) { $ret .= ', '; } $ret .= $this->ConvertPart($c, trim($text)); } return $ret; - } else - { + } else { return $this->ConvertPart($c, $this->value); } } + /** + * convert part of the tag + * + * @param Converter &$c the output converter + * @param string $value the tag value + * + * @return string + * @todo CS cleanup - rename to convertPart for camelCase rule + */ function ConvertPart(&$c, $value) { - if (strpos($value,'://') || (strpos($value,'mailto:') === 0)) - { - if (strpos($value, ' ')) - { + if (strpos($value, '://') || (strpos($value, 'mailto:') === 0)) { + if (strpos($value, ' ')) { $value = explode(' ', $value); - $link = array_shift($value); - $text = join(' ', $value); - } else - { + $link = array_shift($value); + $text = join(' ', $value); + } else { $link = $value; $text = $this->linktext; } - return $c->returnLink($link,htmlspecialchars($text)); - } else - { + return $c->returnLink($link, htmlspecialchars($text)); + } else { $savevalue = $value; - $descrip = false; - if (strpos(trim($value),' ')) - { - $v = preg_split('/\s/',trim($value)); - if (in_array(strtolower($v[0]), array('object', 'function'))) - { - if (!isset($v[1]) || - (isset($v[1]) && strlen($v[1]) + $descrip = false; + if (strpos(trim($value), ' ')) { + $v = preg_split('/\s/', trim($value)); + if (in_array(strtolower($v[0]), array('object', 'function'))) { + if (!isset($v[1]) + || (isset($v[1]) && strlen($v[1]) && !in_array($v[1]{0}, array('$','&')) - && $v[1] != '###commanana####')) - { + && $v[1] != '###commanana####' + ) + ) { $vsave = $v[0]; array_shift($v); $v[0] = $vsave . ' ' . $v[0]; @@ -199,46 +232,26 @@ } $value = $c->getLink($v[0]); array_shift($v); - $descrip = join($v,' '); + $descrip = join($v, ' '); $descrip = str_replace('###commanana####', ',', $descrip); - } else - { + } else { $value = $c->getLink($value); } - if (is_string($value)) - { + if (is_string($value)) { // feature 564991 - if (strpos($value,'://')) - { + if (strpos($value, '://')) { // php function - return $c->returnLink($value, - $descrip ? $descrip : str_replace('PHP_MANUAL#','',$value)); + return $c->returnLink($value, $descrip ? $descrip : + str_replace('PHP_MANUAL#', '', $value)); } return $value; } - if (!$descrip) $descrip = $c->type_adjust($savevalue); - if (is_object($value)) return $c->returnSee($value, $descrip); -/* // getLink parsed a comma-delimited list of linked thingies, add the commas back in - if (is_array($value)) - { - $a = ''; - foreach($value as $i => $bub) - { - if (!empty($a)) $a .= ', '; - if (is_string($value[$i])) - { - // feature 564991 - if (strpos($value[$i],'://')) - { - // php function - $a .= $c->returnLink($value[$i],str_replace('PHP_MANUAL#','',$vals[$i])); - } else - $a .= $value[$i]; - } - if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]); - } - return $a; - } */ + if (!$descrip) { + $descrip = $c->type_adjust($savevalue); + } + if (is_object($value)) { + return $c->returnSee($value, $descrip); + } return $savevalue; } } @@ -246,75 +259,96 @@ /** * Represents inline links to external tutorial documentation - * @tutorial tags.inlinetutorial.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinetutorial.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserTutorialInlineTag extends parserLinkInlineTag { /** + * constructor + * * @param string $link stored in $value, see {@link parserBase::$value} * @param string $text see {@link $linktext} */ function parserTutorialInlineTag($link,$text) { - parserInlineTag::parserInlineTag('tutorial',$link); + parserInlineTag::parserInlineTag('tutorial', $link); $this->linktext = trim($text); } /** - * @param Converter converter used to change the abstract link into text for display - * @return mixed returns the converted link or false if not converted successfully + * convert part of the tag + * + * @param Converter &$c converter used to change the abstract link + * into text for display + * + * @return mixed returns the converted link + * or false if not converted successfully + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { $descrip = false; - if (strpos($this->value,',') === false) - { - if (strpos(trim($this->value),' ')) - { - $v = split(' ',trim($this->value)); + if (strpos($this->value, ',') === false) { + if (strpos(trim($this->value), ' ')) { + $v = split(' ', trim($this->value)); $value = $c->getTutorialLink($v[0]); array_shift($v); - $descrip = join($v,' '); - } else $value = $c->getTutorialLink($this->value); - } else - { - $vals = split(',',$this->value); + $descrip = join($v, ' '); + } else { + $value = $c->getTutorialLink($this->value); + } + } else { + $vals = split(',', $this->value); $descrip = array(); - foreach($vals as $val) - { + foreach ($vals as $val) { $val = trim($val); - if (strpos($val,' ')) - { - $v = split(' ',$val); + if (strpos($val, ' ')) { + $v = split(' ', $val); $value[] = $c->getTutorialLink($v[0]); array_shift($v); - $descrip[] = join($v,' '); - } else - { - $value[] = $c->getTutorialLink($val); + $descrip[] = join($v, ' '); + } else { + $value[] = $c->getTutorialLink($val); $descrip[] = false; } } } - if (is_string($value)) - { + if (is_string($value)) { return $value; } - if (is_object($value)) return $c->returnSee($value,$descrip); - // getLink parsed a comma-delimited list of linked thingies, add the commas back in - if (is_array($value)) - { + if (is_object($value)) { + return $c->returnSee($value, $descrip); + } + /* + * getLink parsed a comma-delimited list of linked thingies, + * add the commas back in + */ + if (is_array($value)) { $a = ''; - foreach($value as $i => $bub) - { - if (!empty($a)) $a .= ', '; - if (is_string($value[$i])) - { + foreach ($value as $i => $bub) { + if (!empty($a)) { + $a .= ', '; + } + if (is_string($value[$i])) { $a .= $value[$i]; } - if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]); + if (is_object($value[$i])) { + $a .= $c->returnSee($value[$i], $descrip[$i]); + } } return $a; } @@ -324,9 +358,21 @@ /** * represents inline source tag, used for function/method source - * @tutorial tags.inlinesource.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinesource.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserSourceInlineTag extends parserInlineTag { @@ -357,116 +403,144 @@ /** @var string|false */ var $_class; /**#@-*/ + /** - * @param string format "start [end]" where start and end are line numbers - * with the end line number optional + * constructor + * + * @param string $value format "start [end]", + * where start and end are line numbers + * with the end line number optional */ function parserSourceInlineTag($value) { - parserInlineTag::parserInlineTag('source',''); - preg_match('/^([0-9]+)\W([0-9]*)$/',trim($value), $match); - if (!count($match)) - { - preg_match('/^([0-9]+)$/',trim($value),$match); - if (count($match)) - { + parserInlineTag::parserInlineTag('source', ''); + preg_match('/^([0-9]+)\W([0-9]*)$/', trim($value), $match); + if (!count($match)) { + preg_match('/^([0-9]+)$/', trim($value), $match); + if (count($match)) { $this->start = (int) $match[1]; } - } else - { + } else { $this->start = (int) $match[1]; - $this->end = (int) $match[2]; + $this->end = (int) $match[2]; } } /** - * only used to determine blank lines. {@}source} will not be blank, - * probably + * only used to determine blank lines. {@}source} will not be blank, probably + * + * @return int */ function Strlen() { return 1; } + /** + * gets the source string + * + * @return string + */ function getString() { return '{@source}'; } /** - * @param string|array source code - * @param boolean in php 4.3.0, if this is a method this will be true - * @param string class name if this is a method + * sets the source tag's value + * + * @param string|array $source source code + * @param string|bool $class class name if this is a method, + * boolean in php 4.3.0, + * if this is a method this will be true + * + * @return void */ function setSource($source, $class = false) { - if (is_array($source)) - { + if (is_array($source)) { $this->_class = $class; $this->source = $source; - } else - { - $source = strstr($source,'function'); - $pos = strrpos($source,'}'); - $this->source = substr($source,0,$pos + 1); + } else { + $source = strstr($source, 'function'); + $pos = strrpos($source, '}'); + $this->source = substr($source, 0, $pos + 1); } } /** + * convert the tag + * + * @param Converter &$c the output converter object + * + * @return string * @uses stringConvert() in PHP 4.2.3-, this method is used to convert * @uses arrayConvert() in PHP 4.3.0+, this method is used to convert - * @param Converter + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (is_string($this->source)) return $this->stringConvert($c); + if (is_string($this->source)) { + return $this->stringConvert($c); + } return $this->arrayConvert($c); } /** - * @param Converter + * converter helper used in PHP 4.3.0+ + * + * @param Converter &$c the output converter object + * + * @return string * @uses phpDocumentor_HighlightParser Parses the tokenized source */ function arrayConvert(&$c) { $source = $this->source; - if ($this->end != '*') - { - $source = array_slice($this->source,0,$this->end + $this->start - 1); + if ($this->end != '*') { + $source = array_slice($this->source, 0, $this->end + $this->start - 1); } $start = $this->start - 1; - if ($start < 0) $start = 0; + if ($start < 0) { + $start = 0; + } return $c->ProgramExample($source, true, true, $this->_class, $start); } /** - * @param Converter + * converter helper used in PHP 4.2.3- + * + * @param Converter &$c the output converter object + * + * @return string * @uses Converter::unmangle() remove the extraneous stuff from * {@link highlight_string()} * @deprecated in favor of PHP 4.3.0+ {@link arrayConvert()} */ function stringConvert(&$c) { - $source = highlight_string('<?php '.$this->source.' ?>', true); - $source = '<code>'.substr($source,strlen('<code><font color="#000000"> + $source = highlight_string('<?php ' . $this->source . ' ?>', true); + $source = '<code>' . substr($source, strlen('<code><font color="#000000"> <font color="#0000CC"><?php </font>') - 1); - $source = str_replace('} </font><font color="#0000CC">?></font>','}</font></code>',$source); - if ($this->start || ($this->end != '*')) - { - $source = explode('<br />',$source); - $start = $this->start; - if ($this->end != '*') - { - $source = array_slice($source,$start - 1,$this->end - $start + 1); - } else - { - $source = array_slice($source,$start - 1); - } - $source = implode($source,'<br />'); - if ($start > 0) $source = "<code>$source"; - if ($this->end != '*') $source = "$source</code>"; + $source = str_replace('} </font><font color="#0000CC">?></font>', + '}</font></code>', $source); + if ($this->start || ($this->end != '*')) { + $source = explode('<br />', $source); + $start = $this->start; + if ($this->end != '*') { + $source = array_slice($source, $start - 1, $this->end - $start + 1); + } else { + $source = array_slice($source, $start - 1); + } + $source = implode($source, '<br />'); + if ($start > 0) { + $source = "<code>$source"; + } + if ($this->end != '*') { + $source = "$source</code>"; + } } - $source = $c->unmangle($source,$this->source); + $source = $c->unmangle($source, $this->source); return $source; } } @@ -474,70 +548,84 @@ /** * Represents the example inline tag, used to display an example file * inside a docblock or tutorial - * @tutorial tags.inlineexample.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineexample.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserExampleInlineTag extends parserSourceInlineTag { /** - * @param string format "filepath[ start [end]]" where start and end are line numbers - * with the end line number optional - * @param string full path to the current file, used to check relative - * directory locations - * @param boolean if true, then this is in a tutorial + * constructor + * + * @param string $value format "filepath[ start [end]]" + * where start and end are line numbers + * with the end line number optional + * @param string $current_path full path to the current file, + * used to check relative directory locations + * @param bool $isTutorial if true, then this is in a tutorial + * + * @return mixed + * @todo replace tokenizer_ext constant with TOKENIZER_EXT for CS rule */ function parserExampleInlineTag($value, $current_path, $isTutorial = false) { global $_phpDocumentor_setting; - parserInlineTag::parserInlineTag('example',''); - $path = false; + parserInlineTag::parserInlineTag('example', ''); + $path = false; $tagValue = trim($value); - $path = $isAbsPath = $pathOnly = $fileName = $fileExt = $original_path = $title = FALSE; - do - { + $path = $isAbsPath = $pathOnly = $fileName = $fileExt + = $original_path = $title = false; + do { // make sure the format is stuff.ext startline[ endline] - if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match)) - { + if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match)) { // or format is stuff.ext - if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match)) - { + if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match)) { // Murphy: Some funny path was given $original_path = $tagValue; // used for error output break; // try-block } } - if (strlen($match[1]) === 0) - { + if (strlen($match[1]) === 0) { // Murphy: Some funny path was given $original_path = $tagValue; // used for error output break; // try-block } $fileExt = $match[2]; - if (isset($match[3])) - { - $lines = explode(' ', trim($match[3])); + if (isset($match[3])) { + $lines = explode(' ', trim($match[3])); $this->start = (int) $lines[0]; if (isset($lines[1])) { $this->end = (int) $lines[1]; } } - $pathTmp = str_replace('\\', '/', $match[1]); // Replace windows '\' the path. + // Replace windows '\' the path. + $pathTmp = str_replace('\\', '/', $match[1]); // Is there a path and a file or is it just a file? - if (strpos($pathTmp,'/') === false) - { + if (strpos($pathTmp, '/') === false) { // No path part $pathOnly = ''; $fileName = $pathTmp .'.'. $fileExt; - } else - { - $splitPos = strrpos($pathTmp,'/'); // split the path on the last directory, find the filename + } else { + // split the path on the last directory, find the filename + $splitPos = strrpos($pathTmp, '/'); $pathOnly = substr($match[1], 0, $splitPos+1); $fileName = substr($match[1], $splitPos+1) .'.'. $fileExt; // Is the path absolute? (i.e. does it start like an absolute path?) - if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp)) - { // works for both windows 'C:' and URLs like 'http://' + if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp)) { + // works for both windows 'C:' and URLs like 'http://' $isAbsPath = true; // Yes } } @@ -545,78 +633,73 @@ $original_path = $pathOnly . $fileName; // Now look for the file starting with abs. path. - if ($isAbsPath) - { - $tmp = realpath($original_path); // remove any weirdities like /../file.ext - if ($tmp && is_file($tmp)) - { + if ($isAbsPath) { + // remove any weirdities like /../file.ext + $tmp = realpath($original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; } - // Alway break if abs. path was detected; even if file was not found. + /* + * Alway break if abs. path was detected, + * even if file was not found. + */ break; // try-block } // Search for the example file some standard places // 1) Look if the ini-var examplesdir is set and look there ... - if (isset($_phpDocumentor_setting['examplesdir'])) - { - $tmp = realpath($_phpDocumentor_setting['examplesdir'] . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + if (isset($_phpDocumentor_setting['examplesdir'])) { + $tmp = realpath($_phpDocumentor_setting['examplesdir'] + . PATH_DELIMITER . $original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } - // 2) Then try to look for an 'example/'-dir below the *currently* parsed file ... - if (!empty($current_path)) - { - $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $fileName); - if ($tmp && is_file($tmp)) - { + // 2) Then try to look for an 'example/'-dir + // below the *currently* parsed file ... + if (!empty($current_path)) { + $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' + . PATH_DELIMITER . $fileName); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } - // 3) Then try to look for the example file below the subdir PHPDOCUMENTOR_BASE/examples/ ... - if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples')) - { - $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + // 3) Then try to look for the example file + // below the subdir PHPDOCUMENTOR_BASE/examples/ ... + if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples')) { + $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' + . PATH_DELIMITER . $original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } // If we reach this point, nothing was found and $path is false. } while (false); - if (!$path) - { + if (!$path) { addWarning(PDERROR_EXAMPLE_NOT_FOUND, $original_path); $this->path = false; - } else - { - $f = @fopen($path,'r'); - if ($f) - { - $example = fread($f,filesize($path)); - if (tokenizer_ext && !$isTutorial) - { + } else { + $f = @fopen($path, 'r'); + if ($f) { + $example = fread($f, filesize($path)); + if (tokenizer_ext && !$isTutorial) { $obj = new phpDocumentorTWordParser; $obj->setup($example); $this->setSource($obj->getFileSource()); unset($obj); - } else - { + } else { $this->setSource($example); } } @@ -624,9 +707,14 @@ } /** - * @param string|array source code - * @param boolean in php 4.3.0, if this is a method this will be true - * @param string class name if this is a method + * sets the source + * + * @param string|array $source source code + * @param string|bool $class class name if this is a method, + * boolean in php 4.3.0, + * if this is a method this will be true + * + * @return void */ function setSource($source, $class = false) { @@ -635,36 +723,40 @@ } /** - * @param Converter + * converter helper for PHP 4.3.0+ + * + * @param Converter &$c output converter + * + * @return string * @uses phpDocumentor_HighlightParser Parses the tokenized source */ function arrayConvert(&$c) { $source = $this->source; - if ($this->end != '*') - { - $source = array_slice($this->source,0,$this->end + $this->start - 1); + if ($this->end != '*') { + $source = array_slice($this->source, 0, $this->end + $this->start - 1); } $start = $this->start - 1; - if ($start < 0) $start = 0; + if ($start < 0) { + $start = 0; + } return $c->exampleProgramExample($source, true, true, $this->_class, $start); } /** * Return the source for the example file, enclosed in * a <programlisting> tag to use in a tutorial + * * @return string */ function getProgramListing() { $source = explode("\n", $this->source); - $start = $this->start; - if ($this->end != '*') - { - $source = array_slice($source,$start - 1,$this->end - $start + 1); - } else - { - $source = array_slice($source,$start - 1); + $start = $this->start; + if ($this->end != '*') { + $source = array_slice($source, $start - 1, $this->end - $start + 1); + } else { + $source = array_slice($source, $start - 1); } $source = join("\n", $source); return @@ -678,9 +770,21 @@ /** * Represents the inheritdoc inline tag, used by classes/methods/vars to inherit * documentation from the parent class if possible - * @tutorial tags.inlineinheritdoc.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineinheritdoc.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserInheritdocInlineTag extends parserInlineTag { @@ -697,6 +801,12 @@ { } + /** + * only sets a warning and returns empty + * + * @return string + * @todo CS cleanup - rename to convert for camelCase rule + */ function Convert() { addWarning(PDERROR_INHERITDOC_DONT_WORK_HERE); @@ -706,9 +816,21 @@ /** * Represents the inline {@}id} tag for tutorials - * @tutorial tags.inlineid.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineid.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserIdInlineTag extends parserInlineTag { @@ -744,37 +866,59 @@ var $id; /** - * @param string package name - * @param string subpackage name - * @param string tutorial name - * @param string section/subsection name - * @param string category name + * constructor + * + * @param string $category category name + * @param string $package package name + * @param string $subpackage subpackage name + * @param string $tutorial tutorial name + * @param string $id section/subsection name */ function parserIdInlineTag($category,$package,$subpackage,$tutorial,$id = false) { - $this->package = $package; + $this->package = $package; $this->subpackage = $subpackage; - $this->tutorial = $tutorial; - $this->id = $id; - $this->category = $category; + $this->tutorial = $tutorial; + $this->id = $id; + $this->category = $category; } /** - * @param Converter + * converter + * + * @param Converter &$c output converter + * + * @return string * @uses Converter::getTutorialId() retrieve converter-specific ID + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (!$this->id) return ''; - return $c->getTutorialId($this->package,$this->subpackage,$this->tutorial,$this->id,$this->category); + if (!$this->id) { + return ''; + } + return $c->getTutorialId($this->package, $this->subpackage, + $this->tutorial, $this->id, $this->category); } } /** * Represents {@}toc} for table of contents generation in tutorials - * @tutorial tags.inlinetoc.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinetoc.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserTocInlineTag extends parserInlineTag { @@ -786,10 +930,15 @@ /** * @var array format: * <pre> - * array(array('tagname' => section, - * 'link' => returnsee link, - * 'id' => anchor name, - * 'title' => from title tag),...) + * array( + * array( + * 'tagname' => section, + * 'link' => returnsee link, + * 'id' => anchor name, + * 'title' => from title tag + * ), + * ... + * ) * </pre> * @access private */ @@ -801,18 +950,30 @@ */ var $_path = false; + /** + * constructor + */ function parserTocInlineTag() { - parent::parserInlineTag('toc',''); + parent::parserInlineTag('toc', ''); } /** - * @param array format: + * set the TOC + * + * @param array $toc format: * <pre> - * array(array('tag' => {@link parserXMLDocBookTag}, - * 'id' => {@link parserIdInlineTag}, - * 'title' => {@link parserXMLDocBookTag title}),...) + * array( + * array( + * 'tag' => {@link parserXMLDocBookTag}, + * 'id' => {@link parserIdInlineTag}, + * 'title' => {@link parserXMLDocBookTag title} + * ), + * ... + * ) * </pre> + * + * @return void */ function setTOC($toc) { @@ -820,7 +981,11 @@ } /** - * @param string + * set the path + * + * @param string $path the path + * + * @return void */ function setPath($path) { @@ -828,38 +993,48 @@ } /** - * @uses Converter::formatTutorialTOC() passes an array of format: + * converter method * * <pre> * array( * 'tagname' => string name of tag, - * 'link' => {@link tutorialLink} to the tutorial, - * 'id' => converter specific tutorial ID from {@link Converter::getTutorialId()} - * 'title' => title of the tutorial) + * 'link' => {@link tutorialLink} to the tutorial, + * 'id' => converter specific tutorial ID from + * {@link Converter::getTutorialId()} + * 'title' => title of the tutorial) * </pre> - * * and returns the results as the table of contents + * + * @param Converter &$c converter object + * + * @return mixed * @uses Converter::getTutorialId() retrieve the tutorial ID for - * @param Converter + * @uses Converter::formatTutorialTOC() passes an array of format: + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { $newtoc = array(); if (isset($this->toc) && is_array($this->toc)) { - foreach($this->toc as $i => $toc) - { - if (isset($toc['title'])) - $toc['tag']->setTitle($toc['title']); - else - $toc['tag']->setTitle(new parserStringWithInlineTags); + foreach ($this->toc as $i => $toc) { + if (isset($toc['title'])) { + $toc['tag']->setTitle($toc['title']); + } else { + $toc['tag']->setTitle(new parserStringWithInlineTags); + } $newtoc[$i]['tagname'] = $toc['tag']->name; - $l = new tutorialLink; - if (!isset($toc['title'])) $title = 'section '.$toc['id']->id; - else - $title = $toc['title']->Convert($c); - $l->addLink($toc['id']->id,$this->_path,basename($this->_path),$toc['id']->package, $toc['id']->subpackage, strip_tags($title)); - $newtoc[$i]['link'] = $c->returnSee($l); - $newtoc[$i]['id'] = $c->getTutorialId($toc['id']->package, $toc['id']->subpackage, basename($this->_path), $toc['id']->id, $toc['id']->category); + $l = new tutorialLink; + if (!isset($toc['title'])) { + $title = 'section '.$toc['id']->id; + } else { + $title = $toc['title']->Convert($c); + } + $l->addLink($toc['id']->id, $this->_path, basename($this->_path), + $toc['id']->package, $toc['id']->subpackage, strip_tags($title)); + $newtoc[$i]['link'] = $c->returnSee($l); + $newtoc[$i]['id'] = $c->getTutorialId($toc['id']->package, + $toc['id']->subpackage, basename($this->_path), + $toc['id']->id, $toc['id']->category); $newtoc[$i]['title'] = $title; } }
http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/package.xml?r1=1.145&r2=1.146&diff_format=u Index: pear/PhpDocumentor/package.xml diff -u pear/PhpDocumentor/package.xml:1.145 pear/PhpDocumentor/package.xml:1.146 --- pear/PhpDocumentor/package.xml:1.145 Tue Feb 26 12:15:56 2008 +++ pear/PhpDocumentor/package.xml Fri Mar 28 01:24:13 2008 @@ -69,8 +69,8 @@ <email>drewish@php.net</email> <active>yes</active> </developer> - <date>2008-02-25</date> - <time>05:56:11</time> + <date>2008-03-27</date> + <time>19:43:35</time> <version> <release>1.4.1</release> <api>1.4.0</api> @@ -1369,7 +1369,9 @@ <file name="HighlightParser.inc" role="php"> <tasks:replace from="@VER@" to="version" type="package-info" /> </file> - <file name="InlineTags.inc" role="php" /> + <file name="InlineTags.inc" role="php"> + <tasks:replace from="@VER@" to="version" type="package-info" /> + </file> <file name="IntermediateParser.inc" role="php"> <tasks:replace from="@VER@" to="version" type="package-info" /> <tasks:replace from="@PEAR-DIR@" to="php_dir" type="pear-config" /> @@ -3122,7 +3124,7 @@ <release>stable</release> <api>stable</api> </stability> - <date>2008-02-25</date> + <date>2008-03-27</date> <license uri="http://www.opensource.org/licenses/lgpl-license.php">LGPL</license> <notes> Includes these PEAR items: http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/scripts/create_package.xml.php?r1=1.128&r2=1.129&diff_format=u Index: pear/PhpDocumentor/scripts/create_package.xml.php diff -u pear/PhpDocumentor/scripts/create_package.xml.php:1.128 pear/PhpDocumentor/scripts/create_package.xml.php:1.129 --- pear/PhpDocumentor/scripts/create_package.xml.php:1.128 Tue Feb 26 12:15:56 2008 +++ pear/PhpDocumentor/scripts/create_package.xml.php Fri Mar 28 01:24:13 2008 @@ -109,6 +109,7 @@ $pfm2->addReplacement('phpDocumentor/common.inc.php', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/common.inc.php', 'pear-config', '@PEAR-DIR@', 'php_dir'); $pfm2->addReplacement('phpDocumentor/HighlightParser.inc', 'package-info', '@VER@', 'version'); +$pfm2->addReplacement('phpDocumentor/InlineTags.inc', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/IntermediateParser.inc', 'package-info', '@VER@', 'version'); $pfm2->addReplacement('phpDocumentor/IntermediateParser.inc', 'pear-config', '@PEAR-DIR@', 'php_dir'); $pfm2->addReplacement('phpDocumentor/LinkClasses.inc', 'package-info', '@VER@', 'version'); http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/phpDocumentor/InlineTags.inc?r1=1.7&r2=1.8&diff_format=u Index: pear/PhpDocumentor/phpDocumentor/InlineTags.inc diff -u pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.7 pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.8 --- pear/PhpDocumentor/phpDocumentor/InlineTags.inc:1.7 Thu Apr 19 20:20:57 2007 +++ pear/PhpDocumentor/phpDocumentor/InlineTags.inc Fri Mar 28 01:24:13 2008 @@ -6,7 +6,7 @@ * * PHP versions 4 and 5 * - * Copyright (c) 2002-2006 Gregory Beaver + * Copyright (c) 2002-2008 Gregory Beaver * * LICENSE: * @@ -25,26 +25,38 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * @category ToolsAndUtilities * @package phpDocumentor * @subpackage InlineTags * @author Gregory Beaver <cellog@php.net> - * @copyright 2002-2006 Gregory Beaver + * @copyright 2002-2008 Gregory Beaver * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @version CVS: $Id: InlineTags.inc,v 1.7 2007/04/19 20:20:57 ashnazg Exp $ + * @version CVS: $Id: InlineTags.inc,v 1.8 2008/03/28 01:24:13 ashnazg Exp $ * @filesource * @link http://www.phpdoc.org * @link http://pear.php.net/PhpDocumentor * @since separate file since 1.2 + * @todo CS cleanup - change package to PhpDocumentor */ + /** * Use this element to represent an {@}inline tag} like {@}link} - * @see parserStringWithInlineTags - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags - * @author Greg Beaver <cellog@php.net> - * @since 1.0rc1 - * @version $Revision: 1.7 $ - * @tutorial inlinetags.pkg + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @since 1.0rc1 + * @tutorial inlinetags.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserInlineTag extends parserBase { @@ -67,30 +79,36 @@ var $inlinetype = ''; /** - * @param string $type tag type (example: link) + * sets up the tag + * + * @param string $type tag type (example: link) * @param string $value tag value (example: what to link to) */ - function parserInlineTag($type,$value) + function parserInlineTag($type, $value) { $this->inlinetype = $type; - $this->value = trim($value); + $this->value = trim($value); } /** + * get length of the tag + * * @return integer length of the tag + * @todo CS cleanup - rename to strLen for camelCase rule */ function Strlen() { // fix 1203451 - if (is_array($this->value)) - { - return array_reduce(create_function('$a,$b', 'return $a + strlen($b);')) + - count($this->value); + if (is_array($this->value)) { + return array_reduce(create_function('$a, $b', 'return $a + strlen($b);')) + + count($this->value); } return strlen($this->value); } /** + * always gets an empty string + * * @return string always '', used by {@link Parser::handleDocBlock()} to * calculate the short description of a DocBlock * @see parserStringWithInlineTags::getString() @@ -104,11 +122,22 @@ /** * represents inline links - * @tutorial tags.inlinelink.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags - * @author Greg Beaver <cellog@php.net> - * @since 1.0rc1 + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @since 1.0rc1 + * @tutorial tags.inlinelink.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserLinkInlineTag extends parserInlineTag { @@ -120,78 +149,82 @@ var $linktext = ''; /** + * sets up the tag + * * @param string $link stored in $value, see {@link parserBase::$value} * @param string $text see {@link $linktext} */ - function parserLinkInlineTag($link,$text) + function parserLinkInlineTag($link, $text) { - if (strpos($link, ',')) - { - $link = explode(',',$link); - parserInlineTag::parserInlineTag('link',''); + if (strpos($link, ',')) { + $link = explode(',', $link); + parserInlineTag::parserInlineTag('link', ''); $this->value = $link; - } else - { - parserInlineTag::parserInlineTag('link',$link); + } else { + parserInlineTag::parserInlineTag('link', $link); } $this->linktext = trim($text); } /** - * @param Converter converter used to change the abstract link into text for - * display - * @return false|string returns the converted link or false if not converted - * successfully + * calls the output conversion + * + * @param Converter &$c converter used to change the abstract link + * into text for display + * + * @return false|string returns the converted link or false + * if not converted successfully + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (is_array($this->value)) - { + if (is_array($this->value)) { $ret = ''; - foreach($this->value as $text) - { - if (!empty($ret)) - { + foreach ($this->value as $text) { + if (!empty($ret)) { $ret .= ', '; } $ret .= $this->ConvertPart($c, trim($text)); } return $ret; - } else - { + } else { return $this->ConvertPart($c, $this->value); } } + /** + * convert part of the tag + * + * @param Converter &$c the output converter + * @param string $value the tag value + * + * @return string + * @todo CS cleanup - rename to convertPart for camelCase rule + */ function ConvertPart(&$c, $value) { - if (strpos($value,'://') || (strpos($value,'mailto:') === 0)) - { - if (strpos($value, ' ')) - { + if (strpos($value, '://') || (strpos($value, 'mailto:') === 0)) { + if (strpos($value, ' ')) { $value = explode(' ', $value); - $link = array_shift($value); - $text = join(' ', $value); - } else - { + $link = array_shift($value); + $text = join(' ', $value); + } else { $link = $value; $text = $this->linktext; } - return $c->returnLink($link,htmlspecialchars($text)); - } else - { + return $c->returnLink($link, htmlspecialchars($text)); + } else { $savevalue = $value; - $descrip = false; - if (strpos(trim($value),' ')) - { - $v = preg_split('/\s/',trim($value)); - if (in_array(strtolower($v[0]), array('object', 'function'))) - { - if (!isset($v[1]) || - (isset($v[1]) && strlen($v[1]) + $descrip = false; + if (strpos(trim($value), ' ')) { + $v = preg_split('/\s/', trim($value)); + if (in_array(strtolower($v[0]), array('object', 'function'))) { + if (!isset($v[1]) + || (isset($v[1]) && strlen($v[1]) && !in_array($v[1]{0}, array('$','&')) - && $v[1] != '###commanana####')) - { + && $v[1] != '###commanana####' + ) + ) { $vsave = $v[0]; array_shift($v); $v[0] = $vsave . ' ' . $v[0]; @@ -199,46 +232,26 @@ } $value = $c->getLink($v[0]); array_shift($v); - $descrip = join($v,' '); + $descrip = join($v, ' '); $descrip = str_replace('###commanana####', ',', $descrip); - } else - { + } else { $value = $c->getLink($value); } - if (is_string($value)) - { + if (is_string($value)) { // feature 564991 - if (strpos($value,'://')) - { + if (strpos($value, '://')) { // php function - return $c->returnLink($value, - $descrip ? $descrip : str_replace('PHP_MANUAL#','',$value)); + return $c->returnLink($value, $descrip ? $descrip : + str_replace('PHP_MANUAL#', '', $value)); } return $value; } - if (!$descrip) $descrip = $c->type_adjust($savevalue); - if (is_object($value)) return $c->returnSee($value, $descrip); -/* // getLink parsed a comma-delimited list of linked thingies, add the commas back in - if (is_array($value)) - { - $a = ''; - foreach($value as $i => $bub) - { - if (!empty($a)) $a .= ', '; - if (is_string($value[$i])) - { - // feature 564991 - if (strpos($value[$i],'://')) - { - // php function - $a .= $c->returnLink($value[$i],str_replace('PHP_MANUAL#','',$vals[$i])); - } else - $a .= $value[$i]; - } - if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]); - } - return $a; - } */ + if (!$descrip) { + $descrip = $c->type_adjust($savevalue); + } + if (is_object($value)) { + return $c->returnSee($value, $descrip); + } return $savevalue; } } @@ -246,75 +259,96 @@ /** * Represents inline links to external tutorial documentation - * @tutorial tags.inlinetutorial.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinetutorial.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserTutorialInlineTag extends parserLinkInlineTag { /** + * constructor + * * @param string $link stored in $value, see {@link parserBase::$value} * @param string $text see {@link $linktext} */ function parserTutorialInlineTag($link,$text) { - parserInlineTag::parserInlineTag('tutorial',$link); + parserInlineTag::parserInlineTag('tutorial', $link); $this->linktext = trim($text); } /** - * @param Converter converter used to change the abstract link into text for display - * @return mixed returns the converted link or false if not converted successfully + * convert part of the tag + * + * @param Converter &$c converter used to change the abstract link + * into text for display + * + * @return mixed returns the converted link + * or false if not converted successfully + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { $descrip = false; - if (strpos($this->value,',') === false) - { - if (strpos(trim($this->value),' ')) - { - $v = split(' ',trim($this->value)); + if (strpos($this->value, ',') === false) { + if (strpos(trim($this->value), ' ')) { + $v = split(' ', trim($this->value)); $value = $c->getTutorialLink($v[0]); array_shift($v); - $descrip = join($v,' '); - } else $value = $c->getTutorialLink($this->value); - } else - { - $vals = split(',',$this->value); + $descrip = join($v, ' '); + } else { + $value = $c->getTutorialLink($this->value); + } + } else { + $vals = split(',', $this->value); $descrip = array(); - foreach($vals as $val) - { + foreach ($vals as $val) { $val = trim($val); - if (strpos($val,' ')) - { - $v = split(' ',$val); + if (strpos($val, ' ')) { + $v = split(' ', $val); $value[] = $c->getTutorialLink($v[0]); array_shift($v); - $descrip[] = join($v,' '); - } else - { - $value[] = $c->getTutorialLink($val); + $descrip[] = join($v, ' '); + } else { + $value[] = $c->getTutorialLink($val); $descrip[] = false; } } } - if (is_string($value)) - { + if (is_string($value)) { return $value; } - if (is_object($value)) return $c->returnSee($value,$descrip); - // getLink parsed a comma-delimited list of linked thingies, add the commas back in - if (is_array($value)) - { + if (is_object($value)) { + return $c->returnSee($value, $descrip); + } + /* + * getLink parsed a comma-delimited list of linked thingies, + * add the commas back in + */ + if (is_array($value)) { $a = ''; - foreach($value as $i => $bub) - { - if (!empty($a)) $a .= ', '; - if (is_string($value[$i])) - { + foreach ($value as $i => $bub) { + if (!empty($a)) { + $a .= ', '; + } + if (is_string($value[$i])) { $a .= $value[$i]; } - if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]); + if (is_object($value[$i])) { + $a .= $c->returnSee($value[$i], $descrip[$i]); + } } return $a; } @@ -324,9 +358,21 @@ /** * represents inline source tag, used for function/method source - * @tutorial tags.inlinesource.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinesource.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserSourceInlineTag extends parserInlineTag { @@ -357,116 +403,144 @@ /** @var string|false */ var $_class; /**#@-*/ + /** - * @param string format "start [end]" where start and end are line numbers - * with the end line number optional + * constructor + * + * @param string $value format "start [end]", + * where start and end are line numbers + * with the end line number optional */ function parserSourceInlineTag($value) { - parserInlineTag::parserInlineTag('source',''); - preg_match('/^([0-9]+)\W([0-9]*)$/',trim($value), $match); - if (!count($match)) - { - preg_match('/^([0-9]+)$/',trim($value),$match); - if (count($match)) - { + parserInlineTag::parserInlineTag('source', ''); + preg_match('/^([0-9]+)\W([0-9]*)$/', trim($value), $match); + if (!count($match)) { + preg_match('/^([0-9]+)$/', trim($value), $match); + if (count($match)) { $this->start = (int) $match[1]; } - } else - { + } else { $this->start = (int) $match[1]; - $this->end = (int) $match[2]; + $this->end = (int) $match[2]; } } /** - * only used to determine blank lines. {@}source} will not be blank, - * probably + * only used to determine blank lines. {@}source} will not be blank, probably + * + * @return int */ function Strlen() { return 1; } + /** + * gets the source string + * + * @return string + */ function getString() { return '{@source}'; } /** - * @param string|array source code - * @param boolean in php 4.3.0, if this is a method this will be true - * @param string class name if this is a method + * sets the source tag's value + * + * @param string|array $source source code + * @param string|bool $class class name if this is a method, + * boolean in php 4.3.0, + * if this is a method this will be true + * + * @return void */ function setSource($source, $class = false) { - if (is_array($source)) - { + if (is_array($source)) { $this->_class = $class; $this->source = $source; - } else - { - $source = strstr($source,'function'); - $pos = strrpos($source,'}'); - $this->source = substr($source,0,$pos + 1); + } else { + $source = strstr($source, 'function'); + $pos = strrpos($source, '}'); + $this->source = substr($source, 0, $pos + 1); } } /** + * convert the tag + * + * @param Converter &$c the output converter object + * + * @return string * @uses stringConvert() in PHP 4.2.3-, this method is used to convert * @uses arrayConvert() in PHP 4.3.0+, this method is used to convert - * @param Converter + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (is_string($this->source)) return $this->stringConvert($c); + if (is_string($this->source)) { + return $this->stringConvert($c); + } return $this->arrayConvert($c); } /** - * @param Converter + * converter helper used in PHP 4.3.0+ + * + * @param Converter &$c the output converter object + * + * @return string * @uses phpDocumentor_HighlightParser Parses the tokenized source */ function arrayConvert(&$c) { $source = $this->source; - if ($this->end != '*') - { - $source = array_slice($this->source,0,$this->end + $this->start - 1); + if ($this->end != '*') { + $source = array_slice($this->source, 0, $this->end + $this->start - 1); } $start = $this->start - 1; - if ($start < 0) $start = 0; + if ($start < 0) { + $start = 0; + } return $c->ProgramExample($source, true, true, $this->_class, $start); } /** - * @param Converter + * converter helper used in PHP 4.2.3- + * + * @param Converter &$c the output converter object + * + * @return string * @uses Converter::unmangle() remove the extraneous stuff from * {@link highlight_string()} * @deprecated in favor of PHP 4.3.0+ {@link arrayConvert()} */ function stringConvert(&$c) { - $source = highlight_string('<?php '.$this->source.' ?>', true); - $source = '<code>'.substr($source,strlen('<code><font color="#000000"> + $source = highlight_string('<?php ' . $this->source . ' ?>', true); + $source = '<code>' . substr($source, strlen('<code><font color="#000000"> <font color="#0000CC"><?php </font>') - 1); - $source = str_replace('} </font><font color="#0000CC">?></font>','}</font></code>',$source); - if ($this->start || ($this->end != '*')) - { - $source = explode('<br />',$source); - $start = $this->start; - if ($this->end != '*') - { - $source = array_slice($source,$start - 1,$this->end - $start + 1); - } else - { - $source = array_slice($source,$start - 1); - } - $source = implode($source,'<br />'); - if ($start > 0) $source = "<code>$source"; - if ($this->end != '*') $source = "$source</code>"; + $source = str_replace('} </font><font color="#0000CC">?></font>', + '}</font></code>', $source); + if ($this->start || ($this->end != '*')) { + $source = explode('<br />', $source); + $start = $this->start; + if ($this->end != '*') { + $source = array_slice($source, $start - 1, $this->end - $start + 1); + } else { + $source = array_slice($source, $start - 1); + } + $source = implode($source, '<br />'); + if ($start > 0) { + $source = "<code>$source"; + } + if ($this->end != '*') { + $source = "$source</code>"; + } } - $source = $c->unmangle($source,$this->source); + $source = $c->unmangle($source, $this->source); return $source; } } @@ -474,70 +548,84 @@ /** * Represents the example inline tag, used to display an example file * inside a docblock or tutorial - * @tutorial tags.inlineexample.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineexample.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserExampleInlineTag extends parserSourceInlineTag { /** - * @param string format "filepath[ start [end]]" where start and end are line numbers - * with the end line number optional - * @param string full path to the current file, used to check relative - * directory locations - * @param boolean if true, then this is in a tutorial + * constructor + * + * @param string $value format "filepath[ start [end]]" + * where start and end are line numbers + * with the end line number optional + * @param string $current_path full path to the current file, + * used to check relative directory locations + * @param bool $isTutorial if true, then this is in a tutorial + * + * @return mixed + * @todo replace tokenizer_ext constant with TOKENIZER_EXT for CS rule */ function parserExampleInlineTag($value, $current_path, $isTutorial = false) { global $_phpDocumentor_setting; - parserInlineTag::parserInlineTag('example',''); - $path = false; + parserInlineTag::parserInlineTag('example', ''); + $path = false; $tagValue = trim($value); - $path = $isAbsPath = $pathOnly = $fileName = $fileExt = $original_path = $title = FALSE; - do - { + $path = $isAbsPath = $pathOnly = $fileName = $fileExt + = $original_path = $title = false; + do { // make sure the format is stuff.ext startline[ endline] - if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match)) - { + if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match)) { // or format is stuff.ext - if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match)) - { + if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match)) { // Murphy: Some funny path was given $original_path = $tagValue; // used for error output break; // try-block } } - if (strlen($match[1]) === 0) - { + if (strlen($match[1]) === 0) { // Murphy: Some funny path was given $original_path = $tagValue; // used for error output break; // try-block } $fileExt = $match[2]; - if (isset($match[3])) - { - $lines = explode(' ', trim($match[3])); + if (isset($match[3])) { + $lines = explode(' ', trim($match[3])); $this->start = (int) $lines[0]; if (isset($lines[1])) { $this->end = (int) $lines[1]; } } - $pathTmp = str_replace('\\', '/', $match[1]); // Replace windows '\' the path. + // Replace windows '\' the path. + $pathTmp = str_replace('\\', '/', $match[1]); // Is there a path and a file or is it just a file? - if (strpos($pathTmp,'/') === false) - { + if (strpos($pathTmp, '/') === false) { // No path part $pathOnly = ''; $fileName = $pathTmp .'.'. $fileExt; - } else - { - $splitPos = strrpos($pathTmp,'/'); // split the path on the last directory, find the filename + } else { + // split the path on the last directory, find the filename + $splitPos = strrpos($pathTmp, '/'); $pathOnly = substr($match[1], 0, $splitPos+1); $fileName = substr($match[1], $splitPos+1) .'.'. $fileExt; // Is the path absolute? (i.e. does it start like an absolute path?) - if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp)) - { // works for both windows 'C:' and URLs like 'http://' + if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp)) { + // works for both windows 'C:' and URLs like 'http://' $isAbsPath = true; // Yes } } @@ -545,78 +633,73 @@ $original_path = $pathOnly . $fileName; // Now look for the file starting with abs. path. - if ($isAbsPath) - { - $tmp = realpath($original_path); // remove any weirdities like /../file.ext - if ($tmp && is_file($tmp)) - { + if ($isAbsPath) { + // remove any weirdities like /../file.ext + $tmp = realpath($original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; } - // Alway break if abs. path was detected; even if file was not found. + /* + * Alway break if abs. path was detected, + * even if file was not found. + */ break; // try-block } // Search for the example file some standard places // 1) Look if the ini-var examplesdir is set and look there ... - if (isset($_phpDocumentor_setting['examplesdir'])) - { - $tmp = realpath($_phpDocumentor_setting['examplesdir'] . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + if (isset($_phpDocumentor_setting['examplesdir'])) { + $tmp = realpath($_phpDocumentor_setting['examplesdir'] + . PATH_DELIMITER . $original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } - // 2) Then try to look for an 'example/'-dir below the *currently* parsed file ... - if (!empty($current_path)) - { - $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $fileName); - if ($tmp && is_file($tmp)) - { + // 2) Then try to look for an 'example/'-dir + // below the *currently* parsed file ... + if (!empty($current_path)) { + $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' + . PATH_DELIMITER . $fileName); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } - // 3) Then try to look for the example file below the subdir PHPDOCUMENTOR_BASE/examples/ ... - if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples')) - { - $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + // 3) Then try to look for the example file + // below the subdir PHPDOCUMENTOR_BASE/examples/ ... + if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples')) { + $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' + . PATH_DELIMITER . $original_path); + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } } $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . $original_path); - if ($tmp && is_file($tmp)) - { + if ($tmp && is_file($tmp)) { $path = $tmp; // Yo! found it :) break; // try-block } // If we reach this point, nothing was found and $path is false. } while (false); - if (!$path) - { + if (!$path) { addWarning(PDERROR_EXAMPLE_NOT_FOUND, $original_path); $this->path = false; - } else - { - $f = @fopen($path,'r'); - if ($f) - { - $example = fread($f,filesize($path)); - if (tokenizer_ext && !$isTutorial) - { + } else { + $f = @fopen($path, 'r'); + if ($f) { + $example = fread($f, filesize($path)); + if (tokenizer_ext && !$isTutorial) { $obj = new phpDocumentorTWordParser; $obj->setup($example); $this->setSource($obj->getFileSource()); unset($obj); - } else - { + } else { $this->setSource($example); } } @@ -624,9 +707,14 @@ } /** - * @param string|array source code - * @param boolean in php 4.3.0, if this is a method this will be true - * @param string class name if this is a method + * sets the source + * + * @param string|array $source source code + * @param string|bool $class class name if this is a method, + * boolean in php 4.3.0, + * if this is a method this will be true + * + * @return void */ function setSource($source, $class = false) { @@ -635,36 +723,40 @@ } /** - * @param Converter + * converter helper for PHP 4.3.0+ + * + * @param Converter &$c output converter + * + * @return string * @uses phpDocumentor_HighlightParser Parses the tokenized source */ function arrayConvert(&$c) { $source = $this->source; - if ($this->end != '*') - { - $source = array_slice($this->source,0,$this->end + $this->start - 1); + if ($this->end != '*') { + $source = array_slice($this->source, 0, $this->end + $this->start - 1); } $start = $this->start - 1; - if ($start < 0) $start = 0; + if ($start < 0) { + $start = 0; + } return $c->exampleProgramExample($source, true, true, $this->_class, $start); } /** * Return the source for the example file, enclosed in * a <programlisting> tag to use in a tutorial + * * @return string */ function getProgramListing() { $source = explode("\n", $this->source); - $start = $this->start; - if ($this->end != '*') - { - $source = array_slice($source,$start - 1,$this->end - $start + 1); - } else - { - $source = array_slice($source,$start - 1); + $start = $this->start; + if ($this->end != '*') { + $source = array_slice($source, $start - 1, $this->end - $start + 1); + } else { + $source = array_slice($source, $start - 1); } $source = join("\n", $source); return @@ -678,9 +770,21 @@ /** * Represents the inheritdoc inline tag, used by classes/methods/vars to inherit * documentation from the parent class if possible - * @tutorial tags.inlineinheritdoc.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineinheritdoc.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserInheritdocInlineTag extends parserInlineTag { @@ -697,6 +801,12 @@ { } + /** + * only sets a warning and returns empty + * + * @return string + * @todo CS cleanup - rename to convert for camelCase rule + */ function Convert() { addWarning(PDERROR_INHERITDOC_DONT_WORK_HERE); @@ -706,9 +816,21 @@ /** * Represents the inline {@}id} tag for tutorials - * @tutorial tags.inlineid.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlineid.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserIdInlineTag extends parserInlineTag { @@ -744,37 +866,59 @@ var $id; /** - * @param string package name - * @param string subpackage name - * @param string tutorial name - * @param string section/subsection name - * @param string category name + * constructor + * + * @param string $category category name + * @param string $package package name + * @param string $subpackage subpackage name + * @param string $tutorial tutorial name + * @param string $id section/subsection name */ function parserIdInlineTag($category,$package,$subpackage,$tutorial,$id = false) { - $this->package = $package; + $this->package = $package; $this->subpackage = $subpackage; - $this->tutorial = $tutorial; - $this->id = $id; - $this->category = $category; + $this->tutorial = $tutorial; + $this->id = $id; + $this->category = $category; } /** - * @param Converter + * converter + * + * @param Converter &$c output converter + * + * @return string * @uses Converter::getTutorialId() retrieve converter-specific ID + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { - if (!$this->id) return ''; - return $c->getTutorialId($this->package,$this->subpackage,$this->tutorial,$this->id,$this->category); + if (!$this->id) { + return ''; + } + return $c->getTutorialId($this->package, $this->subpackage, + $this->tutorial, $this->id, $this->category); } } /** * Represents {@}toc} for table of contents generation in tutorials - * @tutorial tags.inlinetoc.pkg - * @package phpDocumentor + * + * @category ToolsAndUtilities + * @package phpDocumentor * @subpackage InlineTags + * @author Gregory Beaver <cellog@php.net> + * @copyright 2002-2008 Gregory Beaver + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @version Release: @VER@ + * @filesource + * @link http://www.phpdoc.org + * @link http://pear.php.net/PhpDocumentor + * @see parserStringWithInlineTags + * @tutorial tags.inlinetoc.pkg + * @todo CS cleanup - change package to PhpDocumentor + * @todo CS cleanup - change classname to PhpDocumentor_* */ class parserTocInlineTag extends parserInlineTag { @@ -786,10 +930,15 @@ /** * @var array format: * <pre> - * array(array('tagname' => section, - * 'link' => returnsee link, - * 'id' => anchor name, - * 'title' => from title tag),...) + * array( + * array( + * 'tagname' => section, + * 'link' => returnsee link, + * 'id' => anchor name, + * 'title' => from title tag + * ), + * ... + * ) * </pre> * @access private */ @@ -801,18 +950,30 @@ */ var $_path = false; + /** + * constructor + */ function parserTocInlineTag() { - parent::parserInlineTag('toc',''); + parent::parserInlineTag('toc', ''); } /** - * @param array format: + * set the TOC + * + * @param array $toc format: * <pre> - * array(array('tag' => {@link parserXMLDocBookTag}, - * 'id' => {@link parserIdInlineTag}, - * 'title' => {@link parserXMLDocBookTag title}),...) + * array( + * array( + * 'tag' => {@link parserXMLDocBookTag}, + * 'id' => {@link parserIdInlineTag}, + * 'title' => {@link parserXMLDocBookTag title} + * ), + * ... + * ) * </pre> + * + * @return void */ function setTOC($toc) { @@ -820,7 +981,11 @@ } /** - * @param string + * set the path + * + * @param string $path the path + * + * @return void */ function setPath($path) { @@ -828,38 +993,48 @@ } /** - * @uses Converter::formatTutorialTOC() passes an array of format: + * converter method * * <pre> * array( * 'tagname' => string name of tag, - * 'link' => {@link tutorialLink} to the tutorial, - * 'id' => converter specific tutorial ID from {@link Converter::getTutorialId()} - * 'title' => title of the tutorial) + * 'link' => {@link tutorialLink} to the tutorial, + * 'id' => converter specific tutorial ID from + * {@link Converter::getTutorialId()} + * 'title' => title of the tutorial) * </pre> - * * and returns the results as the table of contents + * + * @param Converter &$c converter object + * + * @return mixed * @uses Converter::getTutorialId() retrieve the tutorial ID for - * @param Converter + * @uses Converter::formatTutorialTOC() passes an array of format: + * @todo CS cleanup - rename to convert for camelCase rule */ function Convert(&$c) { $newtoc = array(); if (isset($this->toc) && is_array($this->toc)) { - foreach($this->toc as $i => $toc) - { - if (isset($toc['title'])) - $toc['tag']->setTitle($toc['title']); - else - $toc['tag']->setTitle(new parserStringWithInlineTags); + foreach ($this->toc as $i => $toc) { + if (isset($toc['title'])) { + $toc['tag']->setTitle($toc['title']); + } else { + $toc['tag']->setTitle(new parserStringWithInlineTags); + } $newtoc[$i]['tagname'] = $toc['tag']->name; - $l = new tutorialLink; - if (!isset($toc['title'])) $title = 'section '.$toc['id']->id; - else - $title = $toc['title']->Convert($c); - $l->addLink($toc['id']->id,$this->_path,basename($this->_path),$toc['id']->package, $toc['id']->subpackage, strip_tags($title)); - $newtoc[$i]['link'] = $c->returnSee($l); - $newtoc[$i]['id'] = $c->getTutorialId($toc['id']->package, $toc['id']->subpackage, basename($this->_path), $toc['id']->id, $toc['id']->category); + $l = new tutorialLink; + if (!isset($toc['title'])) { + $title = 'section '.$toc['id']->id; + } else { + $title = $toc['title']->Convert($c); + } + $l->addLink($toc['id']->id, $this->_path, basename($this->_path), + $toc['id']->package, $toc['id']->subpackage, strip_tags($title)); + $newtoc[$i]['link'] = $c->returnSee($l); + $newtoc[$i]['id'] = $c->getTutorialId($toc['id']->package, + $toc['id']->subpackage, basename($this->_path), + $toc['id']->id, $toc['id']->category); $newtoc[$i]['title'] = $title; } }