PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 16 ■ GENERATING DOCUMENTATION WITH PHPDOCUMENTOR


abstract function execute( CommandContext $context );


It may seem strange to add more documentation than code to a document. Documentation in
abstract classes is particularly important, though, because it provides directions for developers who
need to understand how to extend the class. If you are worried about the amount of dead space the PHP
engine must parse and discard for a well-documented project, it is a relatively trivial matter to add code
to your build tools to strip out comments on installation. You can see our documentation’s output in
Figure 16–6.


Figure 16–6. Documenting methods


Creating Links in Documentation


phpDocumentor generates a hyperlinked documentation environment for you. Sometimes, though, you
will want to generate your own hyperlinks, either to other elements within documentation or to external
sites. In this section, we will look at the tags for both of these and encounter a new syntax: the inline tag.
As you construct a DocBlock comment, you may want to talk about a related class, property, or
method. To make it easy for the user to navigate to this feature, you can use the @see tag. @see requires a
reference to an element in the following format:


class
class::method()


or like this:


class::$property

Free download pdf