Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/documentation' of https://github.com/mikaelkael/zf2
Browse files Browse the repository at this point in the history
 into hotfix/docbook-fixes
  • Loading branch information
weierophinney committed Dec 20, 2011
2 parents fce4c8c + aaf1a00 commit 9ef748e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion documentation/manual/en/manual-lint.xml.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE book [
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML 5//EN" "-" [
<!-- Add translated specific definitions and snippets -->
<!ENTITY % language-snippets SYSTEM "./ref/language-snippets.xml">
%language-snippets;
Expand Down
2 changes: 1 addition & 1 deletion documentation/manual/en/manual.xml.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book [
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML 5//EN" "-" [
<!-- Add translated specific definitions and snippets -->
<!ENTITY % language-snippets SYSTEM "./ref/language-snippets.xml">
%language-snippets;
Expand Down
41 changes: 21 additions & 20 deletions library/Zend/Docbook/ClassMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
namespace Zend\Docbook;

use Zend\Filter\Word\CamelCaseToDash as CamelCaseToDashFilter,
Zend\Code\Reflection\MethodReflection;
Zend\Code\Reflection\MethodReflection,
Zend\Code\Reflection\DocBlockReflection;

class ClassMethod
{
Expand Down Expand Up @@ -59,8 +60,8 @@ class ClassMethod

/**
* Constructor
*
* @param ReflectionMethod $reflection
*
* @param ReflectionMethod $reflection
* @return void
*/
public function __construct(MethodReflection $reflection)
Expand All @@ -70,7 +71,7 @@ public function __construct(MethodReflection $reflection)

/**
* Retrieve method name
*
*
* @return string
*/
public function getName()
Expand All @@ -80,7 +81,7 @@ public function getName()

/**
* Get normalized method identifier
*
*
* @return string
*/
public function getId()
Expand All @@ -98,7 +99,7 @@ public function getId()
foreach (explode('\\', $namespace) as $segment) {
$id .= $filter->filter($segment) . '.';
}
$id .= $filter->filter($class)
$id .= $filter->filter($class)
. '.methods.'
. $filter->filter($name);

Expand All @@ -108,41 +109,41 @@ public function getId()

/**
* Retrieve method short description
*
*
* @return string
*/
public function getShortDescription()
{
$rDocblock = $this->reflection->getDocblock();
if ($rDocblock instanceof Zend\Code\Reflection\DocBlockReflection) {
if ($rDocblock instanceof DocBlockReflection) {
return $rDocblock->getShortDescription();
}
return '';
}

/**
* Retrieve method long description
*
*
* @return string
*/
public function getLongDescription()
{
$rDocblock = $this->reflection->getDocblock();
if ($rDocblock instanceof Zend\Code\Reflection\DocBlockReflection) {
if ($rDocblock instanceof DocBlockReflection) {
return $rDocblock->getLongDescription();
}
return '';
}

/**
* Retrieve method return type
*
*
* @return string
*/
public function getReturnType()
{
$rDocblock = $this->reflection->getDocblock();
if (!$rDocblock instanceof Zend\Code\Reflection\DocBlockReflection) {
if (!$rDocblock instanceof DocBlockReflection) {
return 'void';
}

Expand All @@ -157,7 +158,7 @@ public function getReturnType()

/**
* Return method argument prototype
*
*
* @return string
*/
public function getPrototype()
Expand Down Expand Up @@ -193,8 +194,8 @@ public function getPrototype()

/**
* Resolve the types provided via an @param or @return annotation
*
* @param string $value
*
* @param string $value
* @return string
*/
protected function resolveTypes($value)
Expand All @@ -220,7 +221,7 @@ protected function resolveTypes($value)

/**
* Get the namespace of the class containing this method
*
*
* @return string
*/
protected function getNamespace()
Expand All @@ -236,7 +237,7 @@ protected function getNamespace()

/**
* Get the class containing this method, without the leading namespace
*
*
* @return string
*/
protected function getClass()
Expand All @@ -254,7 +255,7 @@ protected function getClass()

/**
* Get import statements and aliases from the class containing this method
*
*
* @return array
*/
protected function getUses()
Expand All @@ -273,7 +274,7 @@ protected function getUses()

/**
* Get parameter annotations from docblock
*
*
* @return array
*/
protected function getParameterTags()
Expand All @@ -283,7 +284,7 @@ protected function getParameterTags()
}

$rDocblock = $this->reflection->getDocblock();
if ($rDocblock instanceof Zend\Code\Reflection\DocBlockReflection) {
if ($rDocblock instanceof DocBlockReflection) {
$params = $rDocblock->getTags('param');
} else {
$params = array();
Expand Down
23 changes: 13 additions & 10 deletions library/Zend/Docbook/SkeletonGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class SkeletonGenerator

/**
* Constructor
*
* @param ClassParser $parser
*
* @param ClassParser $parser
* @return void
*/
public function __construct(ClassParser $parser)
Expand All @@ -24,7 +24,7 @@ public function __construct(ClassParser $parser)

/**
* Generate docbook
*
*
* @return string
*/
public function generate()
Expand Down Expand Up @@ -83,23 +83,26 @@ public function generate()
$entry = $dom->createElement('varlistentry');
$entry->setAttribute('xml:id', $method->getId());

$term = $dom->createElement('term');
$term = $dom->createElement('term', $method->getName());

$item1 = $dom->createElement('listitem');
$synop = $dom->createElement('methodsynopsis');
$mname = $dom->createElement('methodname', $method->getName());
$mparam = $dom->createElement('methodparam');
$fparam = $dom->createElement('funcparams', $method->getPrototype());
$mparam->appendChild($fparam);
$synop->appendChild($mname);
$synop->appendChild($mparam);
$term->appendChild($synop);
$item1->appendChild($synop);

$item = $dom->createElement('listitem');
$item->appendChild($dom->createElement('para', $method->getShortDescription()));
$item->appendChild($dom->createElement('para', $method->getLongDescription()));
$item->appendChild($dom->createElement('para', 'Returns ' . $method->getReturnType()));
$item2 = $dom->createElement('listitem');
$item2->appendChild($dom->createElement('para', $method->getShortDescription()));
$item2->appendChild($dom->createElement('para', $method->getLongDescription()));
$item2->appendChild($dom->createElement('para', 'Returns ' . $method->getReturnType()));

$entry->appendChild($term);
$entry->appendChild($item);
$entry->appendChild($item1);
$entry->appendChild($item2);

$varlist->appendChild($entry);
}
Expand Down

0 comments on commit 9ef748e

Please sign in to comment.