protected function _make_internal_message(\Reflector $reflection) {
		$type = false;
		$name = false;
		$location = false;
		
		if($reflection instanceof \ReflectionFunction) {
			$type = 'function';
			$name = $reflection->name;
		}
		elseif($reflection instanceof \ReflectionClass) {
			$type = 'class';
			$name = $reflection->name;
		}
		elseif($reflection instanceof \ReflectionMethod) {
			$type = 'method';
			$name = $reflection->getDeclaringClass()->name . '::' . $reflection->name;
		}
		
		$location = $reflection->getFileName() . ':' . $reflection->getStartLine();
		
		Ev\Evaluer::make_internal_from(
			Ev\Evaluer::SOURCE_OUTPUT,
			sprintf("Source Code for %s '%s' (%s)", $type, $name, $location)
		);
	}
	public static function parse($line, $statement) {
		Evaluer::make_internal_from(
			Evaluer::SOURCE_OUTPUT,
			'History'
		);
		
		return substr($line, 0, 1) === '!' ? self::parse_bang($line) : self::parse_history($line);
	}
Beispiel #3
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);
	}
Beispiel #4
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);
	}
Beispiel #5
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();
	}
Beispiel #6
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();
		}
	}
Beispiel #7
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;
	}
Beispiel #8
0
	public function render() {
		print_r(\AIP\lib\srvr\evlr\Evaluer::sandbox_vars());
	}
Beispiel #9
0
	public function get_path() {
		return Ev\Evaluer::pathenize();
	}