Esempio n. 1
0
	public function this() {
		$reflection = Ev\Evaluer::reflection();
		$instance = Ev\Evaluer::instance();
		
		if(substr($this->_thing, -2) === '()')
			return $this->_this_method($reflection, $instance);
		else
			return $this->_this_property($reflection, $instance);
	}
Esempio n. 2
0
	public function self() {
		$reflection = Ev\Evaluer::reflection();
		
		if($reflection instanceof \ReflectionMethod)
			$reflection = $reflection->getDeclaringClass();
		
		if(substr($this->_thing, -2) === '()')
			return $this->_self_method($reflection);
		else
			return $this->_self_property($reflection);
	}
	public function show_source() {
		$reflection = false;
		$current_reflection = Ev\Evaluer::reflection();
		
		if($this->target === '.') $reflection = $current_reflection;
		else $reflection = self::reflection_target_to_reflection($this->target);
		
		$this->_make_internal_message($reflection);
		
		echo $this->_extract_php($reflection->getFileName(), $reflection->getStartLine(), $reflection->getEndLine());
	}
Esempio n. 4
0
	public function ls() {
		$current_reflection = \AIP\lib\srvr\evlr\Evaluer::reflection();
		
		if($this->_target === '.' and false === $current_reflection)
			LS\_LS_NO_REFLECTION::init()->render();
			
		$reflection = '.' === $this->_target ? $current_reflection : self::reflection_target_to_reflection($this->_target);
		
		if($reflection instanceof \ReflectionClass)
			LS\_LS_CLASS::init($reflection, $this->_args)->render();
			
		if($reflection instanceof \ReflectionMethod)
			LS\_LS_METHOD::init($reflection, $this->_args)->render();
	}
Esempio n. 5
0
	protected static function reflection_target_to_reflection($target) {
		$current_reflection = S\evlr\Evaluer::reflection();
		
		if(is_array($target)) {
			if($target[0] === '$this') {
				$method = substr($target[1], 0, -2);
				
				if(!$current_reflection instanceof \ReflectionClass) die('CONSTRUCT::44');
				if(!$current_reflection->hasMethod($method)) die('CONSTRUCT::45');
				
				return $current_reflection->getMethod($method);
			}
			elseif(substr($target[0], 0, 1) === '$') {
				$var_name = substr($target[0], 1);
				
				$sandbox_vars = S\evlr\Evaluer::sandbox_vars();
				if(!isset($sandbox_vars[$var_name])) die('CONSTRUCT::55');
				
				$var = $sandbox_vars[$var_name];
				if(!is_object($var)) die('CONSTRUCT::58');
				
				$reflection = new S\Reflectionizer(array($var, $target[1]));
				return $reflection->reflectionize();
			}
			else {
				$reflection = new S\Reflectionizer($target);
				return $reflection->reflectionize();
			}
		}
		elseif(substr($target, 0, 1) === '$') {
			$var_name = substr($target, 1);
			
			$sandbox_vars = S\evlr\Evaluer::sandbox_vars();
			if(!isset($sandbox_vars[$var_name])) die('CONSTRUCT::67');
			
			$reflection = new S\Reflectionizer($sandbox_vars[$var_name]);
			return $reflection->reflectionize();
		}
		else {
			$reflection = new S\Reflectionizer($target);
			return $reflection->reflectionize();
		}
	}
Esempio n. 6
0
	protected function _cd_thing() {
		$current_reflection = Ev\Evaluer::reflection();
		
		if(is_array($this->_thing)) {
			if($this->_thing[0] === '$this') {
				if(!$current_reflection instanceof \ReflectionClass) die('CD::73'); // TODO : throw Exception
				
				$this->_thing[0] = $current_reflection->name;
			}
		}
		
		$r = new \AIP\lib\srvr\Reflectionizer($this->_thing);
		
		Ev\Evaluer::$path[] = $r->locationize();
		Ev\Evaluer::reflection($r->reflectionize());
		Ev\Evaluer::sandbox_vars(array(), false);
		
		if(is_object($this->_thing))
			Ev\Evaluer::instance($this->_thing);
		
		return true;
	}