PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 16 ■ GENERATING DOCUMENTATION WITH PHPDOCUMENTOR


As you can see, all the classes and files in the project are listed in the left-hand frame. Both the
project name and the package name are incorporated into the documentation. The class names are all
hyperlinks. In Figure 16–2, you can see some of the documentation for the Command class I created in
Chapter 11.
phpDocumentor is smart enough to recognize that Command is an abstract class, and that it is
extended by FeedbackCommand and LoginCommand. Notice also that it has reported both the name and the
type of the argument required by the execute() method.
Because this level of detail alone is enough to provide an easily navigable overview of a large project,
it is a huge improvement over having no documentation at all. However, I can improve it significantly by
adding comments to my source code.


Figure 16–2. Default documentation for the Command class


DocBlock Comments


DocBlock comments are specially formatted to be recognized by a documentation application. They
take the form of standard multiline comments. Standard, that is, with the single addition of an asterisk to
each line within the comment:


/**



  • My DocBlock comment
    */


phpDocumentor is designed to expect special content within DocBlocks. This content includes
normal text descriptive of the element to be documented (for our purposes, a file, class, method, or

Free download pdf