Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting PHP classes that use __call()

I was wondering if there is a way to force phpDocumentor to print out the potential methods you could use for getting and setting when you do them dynamically with a __call().

In the case of my simple getter, I would want it to cycle through all private variables and just append get to them (and uppercase the first letter, of course).

like image 733
Toby Avatar asked Mar 04 '11 09:03

Toby


People also ask

How to make an instance of a class in PHP?

To create an instance of a class, the new keyword must be used. An object will always be created unless the object has a constructor defined that throws an exception on error. Classes should be defined before instantiation (and in some cases this is a requirement).

Why must you use PhpDoc syntax to document code?

PhpDoc, short for PhpDocumentor, is a powerful tool that allows you to easily document your code via specially formatted comments. The documentation will be available not only in the source code, but also in professional documentation extracted using either the web or command-line interface.

What is a PHP class?

A PHP class, and more generally, object-oriented programming, provides additional approaches to reusability, and can be used for a variety of purposes: They can describe entities that have known properties and behaviors. They can be used as messages to functions and other objects.


1 Answers

See the phpDocumentor reference on @method.

like image 171
josemimg Avatar answered Oct 03 '22 03:10

josemimg