Utility to print to screen class name, vars and functions?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Latio

    Utility to print to screen class name, vars and functions?

    I am thinking of writing a utility that will read a class and output
    something like the example below to the screen:-

    Class: User
    Variable Names: $name, $age, $sex
    Function Names: addUser, editUser, approveUser, activateUser, deleteUser

    I would like to be able to actually select which classes to process and
    perhaps use a stylesheet to format the output. Even might look at adding
    other information such as last modified date.

    It doesn't look too difficult using "get_class_vars " and "get_class_meth ods"
    but before I go off and do this, I wondered if any such thing already
    exists?

    Cheers

    Phil



  • Kimmo Laine

    #2
    Re: Utility to print to screen class name, vars and functions?

    Phil Latio kirjoitti:
    I am thinking of writing a utility that will read a class and output
    something like the example below to the screen:-
    >
    Class: User
    Variable Names: $name, $age, $sex
    Function Names: addUser, editUser, approveUser, activateUser, deleteUser
    >
    I would like to be able to actually select which classes to process and
    perhaps use a stylesheet to format the output. Even might look at adding
    other information such as last modified date.
    >
    It doesn't look too difficult using "get_class_vars " and "get_class_meth ods"
    but before I go off and do this, I wondered if any such thing already
    exists?
    I'm thinking with var_dump you get the most out of a class variables,
    then combine it with get_class_metho ds and there you have it. A very
    nice reflection of the class.

    var_dump($objec t);
    echo 'functions: '.implode(',', get_class_metho ds(get_class($o bject)));

    --
    "En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
    spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)

    Comment

    Working...