<?php
/**
 * MiniMVC
 *
 * Convention-based micro-framework for PHP
 *
 * @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
 *
 * @extends ReflectionClass
 */
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
	 */
	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;
	}

}