Example #1
0
 /**
  * Exports a reflection object.
  *
  * Returns the output if TRUE is specified for return, printing it otherwise.
  * This is purely a wrapper method, which calls the corresponding method of
  * the parent class.
  * @param ReflectionExtension|string $extension
  *        ReflectionExtension object or name of the extension
  * @param boolean $return
  *        Whether to return (TRUE) or print (FALSE) the output
  * @return mixed
  */
 public static function export($extension, $return = false)
 {
     return parent::export($extension, $return);
 }
<?php

class Foo
{
    public $prop;
    function Func($name)
    {
        echo "Hello {$name}";
    }
}
ReflectionClass::export('Foo');
//output: Class [ class Foo ] { @@ /home/cg/root/main.php 3-10 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [1] { Property [ public $prop ] } - Methods [1] { Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } } } }
ReflectionObject::export(new Foo());
// output: Object of class [ class Foo ] { @@ /home/cg/root/main.php 3-10 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [1] { Property [ public $prop ] } - Dynamic properties [0] { } - Methods [1] { Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } } } }
ReflectionMethod::export('Foo', 'func');
// output:  Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } }
ReflectionProperty::export('Foo', 'prop');
//output: Property [ public $prop ]
ReflectionExtension::export('standard');
//output: Extension [ extension #15 standard version 5.5.18 ] ...
Example #3
0
<?php

header('Content-type: text/plain; charset=utf-8');
ReflectionExtension::export('yb');
<?php

ob_start();
ReflectionExtension::export("reflection", true);
$test = ob_get_clean();
var_dump(empty($test));
unset($test);
ob_start();
ReflectionExtension::export("reflection", false);
$test = ob_get_clean();
var_dump(empty($test));
?>
==DONE==