miniMVC/src/sys/r.php

70 lines
1.5 KiB
PHP

<?php
/**
* MiniMVC
*
* Convention-based micro-framework for PHP
*
* @package miniMVC
* @author Timothy J. Warren
* @copyright Copyright (c) 2011 - 2012
* @link https://github.com/timw4mail/miniMVC
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Class for examining other classes
*
* @package miniMVC
* @subpackage System
*/
class R extends ReflectionClass {
//public $methods, $properties, $doc_comments, $parent_class, $static_properties, $internal;
/**
* ReflectionClass Constructor
*
* @param mixed $var
*/
public function __construct($var)
{
parent::__construct($var);
}
/**
* Attempt to run static functions in non-static context
*
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
if(is_callable($this->$name))
{
//Add $this object to args
array_push($args, $this);
//Call the dynamic function
return call_user_func_array($this->$name, $args);
}
}
/**
* Retrieve as much information about the class as possible
*/
public function get_all()
{
$this->methods = $this->getMethods();
$this->properties = $this->getProperties();
$this->doc_comments = $this->getDocComment();
$this->parent_class = $this->getParentClass();
$this->static_properties = $this->getStaticProperties();
$this->internal = (int)$this->isInternal();
return $this;
}
}