Using PHPDocumentor to document the magic functions.
| From: | Richard Quadling | Date: | Tue, 12 Jan 2010 11:46:51 +0000 |
| Subject: | Using PHPDocumentor to document the magic functions. | ||
| Groups: | php.general php.pear.general | ||
| Request: | Send a blank email to php-general+get-301015@lists.php.net to get a copy of this message | ||
Hi.
To implement public readonly properties you can use getX(), getY(),
getZ() methods (which then access the private vars) or you can use
__get($var) to consolidate/simplify the number of methods.
With the discrete getters() it is easy to docblock them. Everything is
obvious, but there is a LOT of duplicate code and documentation.
But how do you docblock __get()?
With the magic functions __get(), __set(), __call(), __callStatic(),
they act as proxies. It is NOT the proxy itself that is normally
wanted to be documented (maybe in a cursory manner), but what is being
proxied.
If you are creating a WSDL file for SOAP and have __get() and
__call(), then you would want to document each entry but without the
code duplication.
What is the best approach?
Regards,
Richard Quadling.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling