Location: PHPKode > scripts > Dynamic Proxy > dynamic-proxy/simple/TargetSIP.php
<?php
/*
 * @author Pulni4kiya <hide@address.com>
 * @date 2009-04-20
 * @version 1.0 2009-04-20
 */

require_once 'ISimpleInvocationProxy.php';
class TargetSIP implements ISimpleInvocationProxy {
	protected $target = null;
	
	public function __construct($target) {
		if (is_object($target) == false) throw new InvalidArgumentException('The parameter must be an object!');
		$this->target = $target;
	}
	
	public function &InvokeMethod($proxy, $methodName, array $args, ChainSIP $chain) {
		$code = '@$result =& $this->target->' . $methodName . '(';
		foreach ($args AS $k => $v) {
			$code .= '&$array[' . $k . '],';
		}
		if (count($args) > 0) $code = substr($code, 0, -1);
		$code.= ');';

		eval($code);
		return $result;
	}
}
?>
Return current item: Dynamic Proxy