Skip to content

Instantly share code, notes, and snippets.

@userid
Created March 30, 2017 03:58
Show Gist options
  • Select an option

  • Save userid/78a19d9a3f59080feea2bfea9e62b6e9 to your computer and use it in GitHub Desktop.

Select an option

Save userid/78a19d9a3f59080feea2bfea9e62b6e9 to your computer and use it in GitHub Desktop.
<?php
//print_r($_GET);
class A{
}
class B extends A{
}
//print_r(get_declared_classes());
function REData(ReflectionExtension $re, $return=false) {
defined('UNDEFINED') || define('UNDEFINED','%undefined%');
$_data = [];
$_data['getName:'] = $re->getName() ?: UNDEFINED;
$_data['getVersion:'] = $re->getVersion() ?: UNDEFINED;
$_data['info:'] = $re->info() ?: UNDEFINED;
$_data['getClassName:'] = PHP_EOL.implode(", ",$re->getClassNames()) ?: UNDEFINED;
foreach ($re->getConstants() as $key => $value) $_data['getConstants:'] .= "\n{$key}:={$value}";
$_data['getDependencies:'] = $re->getDependencies() ?: UNDEFINED;
$_data['getFunctions:'] = PHP_EOL.implode(", ",array_keys($re->getFunctions())) ?: UNDEFINED;
$_data['getINIEntries:'] = $re->getINIEntries() ?: UNDEFINED;
$_data['isPersistent:'] = $re->isPersistent() ?: UNDEFINED;
$_data['isTemporary:'] = $re->isTemporary() ?: UNDEFINED;
return print_r($_data, $return);
}
REData( new ReflectionExtension( 'Reflection' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment