Sorry, newbie question here but anyways,
I'm trying to use the Google Data API to work with some Google Spreadsheets and I'm trying to use var_dump to look at the structure of the objects I'm receiving from its API calls. I tried using var_dump but it's not giving me what I expect. Most of the properties that it shows me show up as protected like this:
...
["_entryClassName:protected"]
...
and I've tried looking at examples of how the objects properties are being accessed and for the properties that I can actually access with the property access operator (->) I don't even see them in the var_dump output.
So, I'm really confused and I was wondering what is the best way for me to know what are the public properties and methods of my class instance and how many of them are there?
Thanks for any help in advance.
You can find the official API documentation within the API documentation of the Zend Framework (Because its part of it): http://framework.zend.com/apidoc/core/ (in package
Zend_Gdata
)As a sidenote: The ZF only implements accessor methods (
get*()
andset*()
) instead of public properties.I would suggest using an IDE with a debugger for this work.
However, if you want to do it the hard way, you can use reflection, and especially the
ReflectionClass
which has a number of useful methods:http://www.php.net/manual/en/class.reflectionclass.php
Example:
You can use:
See example with the first method:
See get_class_methods in the php manual.
I think you want PHP's ReflectionClass which returns information about a class definition at runtime.
The getMethods function for example accepts parameters to determine whether it should return information about
private
,protected
,public
,static
methods etc. Although as it says on php.net,I'm not sure how full the rest of the
ReflectionClass
documentation is, but this makes me think you may want to get ready for a bit of hacking around to achieve exactly what you want.