note 82721 rejected from language.oop5.reflection by nlopess

From: Date: Sat, 26 Apr 2008 17:44:38 +0000
Subject: note 82721 rejected from language.oop5.reflection by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138819@lists.php.net to get a copy of this message
Note Submitter: nicl54 at yahoo dot es ---- I need some help from someone, I'm doing a reflextion class which read and show all features about its methods, but when I want to explain all documentation about method wiht var_export($class->getProperties(), 1), I can't explain documentacion of each one. Why I need this explication, because I want to show a documentation about the class and the user only need to write the name of the class. porpuse reengineer this is the code: <?php /** *information about class, example class. * *@author N.J.L.I. */ class personal{ private $date_a = " "; private $arrays_val = " "; private $inst = " "; /** *information about method CONSTRUCT * */ public function __construct(){ $this->inst = new DB_Class(); $this->inst ->DB_Init(); }//function construct /** *information about method DESTRUCT * */ public function __destruct(){ $this->inst = new DB_Class(); $this->inst ->DB_Desconectar(); }//function destruct /** *information about method SET_VALUES * */ public function set_values($values){ $this->arrays_val = $values; $this->date_a = $this->arrays_val["date_a"]; }//function set_values }//class personal $class = new ReflectionClass('personal'); // Print class methods //printf("---> Methods: %s\n", var_export($class->getMethods(), 1));//here is the problem //var_export get information structured and return valid PHP code. $arreglo = var_export($class->getMethods(), 1); echo $arreglo; print_r ($arreglo);//get the same result like using echo. //The above example will output: array ( 0 => ReflectionMethod::__set_state(array( 'name' => '__construct', 'class' => 'personal', )), 1 => ReflectionMethod::__set_state(array( 'name' => '__destruct', 'class' => 'personal', )), 2 => ReflectionMethod::__set_state(array( 'name' => 'set_values', 'class' => 'personal', )), ) //I need from the previus output take for example: array( 'name' => 'set_values', 'class' => 'personal', ) and call each one with: $method = new ReflectionMethod('personal','set_values'); //the output will be: ---> Documentation: '/** *information about method SET_VALUES * */' ?>

« previous php.notes (#138819) next »