svn: /phd/trunk/phpdotnet/phd/Package/IDE/ API/Param.php Base.php TODO-RENDERING XML.php demo.php

From: Date: Mon, 23 May 2011 03:25:05 +0000
Subject: svn: /phd/trunk/phpdotnet/phd/Package/IDE/ API/Param.php Base.php TODO-RENDERING XML.php demo.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8165@lists.php.net to get a copy of this message
moacir Mon, 23 May 2011 03:25:05 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=311343 Log: rendering the description of parameters Changed paths: U phd/trunk/phpdotnet/phd/Package/IDE/API/Param.php U phd/trunk/phpdotnet/phd/Package/IDE/Base.php U phd/trunk/phpdotnet/phd/Package/IDE/TODO-RENDERING U phd/trunk/phpdotnet/phd/Package/IDE/XML.php U phd/trunk/phpdotnet/phd/Package/IDE/demo.php Modified: phd/trunk/phpdotnet/phd/Package/IDE/API/Param.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/IDE/API/Param.php 2011-05-23 01:47:06 UTC (rev 311342) +++ phd/trunk/phpdotnet/phd/Package/IDE/API/Param.php 2011-05-23 03:25:05 UTC (rev 311343) @@ -53,6 +53,13 @@ private $initializer; /** + * Detailed description of the parameter. + * + * @var string + */ + private $description; + + /** * Creates a new instance. * * @param SimpleXMLElement $xmlElement @@ -63,6 +70,7 @@ $this->type = $xmlElement->type; $this->optional = $xmlElement->optional == 'true'; $this->initializer = $xmlElement->initializer; + $this->description = $xmlElement->description; } /** @@ -127,6 +135,17 @@ { return $this->initializer; } + + /** + * Gets the parameter description. + * + * @return string Value of the parameter description. + */ + public function getDescription() + { + return $this->description; + } + } /* Modified: phd/trunk/phpdotnet/phd/Package/IDE/Base.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/IDE/Base.php 2011-05-23 01:47:06 UTC (rev 311342) +++ phd/trunk/phpdotnet/phd/Package/IDE/Base.php 2011-05-23 03:25:05 UTC (rev 311343) @@ -7,6 +7,7 @@ 'caution' => 'format_notes', 'entry' => 'format_changelog_entry', 'function' => 'format_seealso_entry', + 'listitem' => 'format_parameter_desc', 'methodparam' => 'format_methodparam', 'methodname' => 'format_seealso_entry', 'member' => 'format_member', @@ -65,6 +66,7 @@ 'manualid' => null, 'version' => null, 'params' => array(), + 'currentParam' => null, 'return' => array( 'type' => null, 'description' => null, @@ -286,7 +288,6 @@ } return; } - //TODO Render the description of params $param['name'] = $this->cchunk['param']['name']; $param['type'] = $this->cchunk['param']['type']; $param['optional'] = $this->cchunk['param']['opt']; @@ -295,7 +296,7 @@ } $this->cchunk['methodparam'] = $this->dchunk['methodparam']; $this->cchunk['param'] = $this->dchunk['param']; - $this->function['params'][] = $param; + $this->function['params'][$param['name']] = $param; } public function format_parameter_text($value, $tag) { @@ -305,8 +306,31 @@ if (!empty($this->cchunk['methodparam'])) { $this->cchunk['param']['name'] = $value; } + if ($this->role == 'parameters') { + $this->cchunk['currentParam'] = trim($value); + } } + public function format_parameter_desc($open, $name, $attrs, $props) { + if ($this->role != 'parameters') { + return; + } + if ($open) { + //Read the description + $reader = ReaderKeeper::getReader(); + $content = ''; + do { + $reader->read(); + if ($reader->nodeType === \XMLReader::ELEMENT) { + $content .= trim($reader->readContent()); + } + } while ($reader->name != $name); + if (isset($this->cchunk['currentParam']) && isset($this->function['params'][$this->cchunk['currentParam']])) { + $this->function['params'][$this->cchunk['currentParam']]['description'] = $content; + } + } + } + public function format_initializer_text($value, $tag) { if (!$this->isFunctionRefSet) { return; Modified: phd/trunk/phpdotnet/phd/Package/IDE/TODO-RENDERING =================================================================== --- phd/trunk/phpdotnet/phd/Package/IDE/TODO-RENDERING 2011-05-23 01:47:06 UTC (rev 311342) +++ phd/trunk/phpdotnet/phd/Package/IDE/TODO-RENDERING 2011-05-23 03:25:05 UTC (rev 311343) @@ -1,7 +1,7 @@ IDE Function Skeleton: http://wiki.php.net/doc/skeletons/ide-function - Render the description of the seealso entry -- Render the description of the params ++ Render the description of the params - Render examples + Render notes + Render <version> Modified: phd/trunk/phpdotnet/phd/Package/IDE/XML.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/IDE/XML.php 2011-05-23 01:47:06 UTC (rev 311342) +++ phd/trunk/phpdotnet/phd/Package/IDE/XML.php 2011-05-23 03:25:05 UTC (rev 311343) @@ -27,6 +27,11 @@ if (isset($param['initializer'])) { $str .= ' <initializer>' . $param['initializer'] . '</initializer>' . PHP_EOL; } + $str .= ' <description>' . PHP_EOL; + if (isset($param['description'])) { + $str .= $this->e($param['description']) . PHP_EOL; + } + $str .= ' </description>' . PHP_EOL; $str .= ' </param>' . PHP_EOL; } $str .= '</params>' . PHP_EOL; Modified: phd/trunk/phpdotnet/phd/Package/IDE/demo.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/IDE/demo.php 2011-05-23 01:47:06 UTC (rev 311342) +++ phd/trunk/phpdotnet/phd/Package/IDE/demo.php 2011-05-23 03:25:05 UTC (rev 311343) @@ -10,6 +10,9 @@ spl_autoload_register(array("phpdotnet\\phd\\Autoloader", "autoload")); +//FIXME Remove this call to Config +PhD\Config::init(array()); + function usage() { echo <<<USAGE @@ -160,6 +163,7 @@ echo "\tType: " . $param->getType() . PHP_EOL; echo "\tOptional: " . ($param->isOptional() ? 'true' : 'false') . PHP_EOL; echo "\tInitializer: " . $param->getInitializer() . PHP_EOL; + echo "\tDescription: " . $param->getDescription() . PHP_EOL; } }

« previous php.doc.cvs (#8165) next »