static function ExecuteTarget(rObjectRouter $self, $objargs = array()) { $objname = $self->GetObjectName(); if (class_exists($objname)) { $obj = new $objname(); if (method_exists($obj, 'initialize')) { call_user_func_array(array($obj, "initialize"), $objargs); } if ($obj instanceof WaxObject) { // good if (class_exists($obj->GetType() . $self->GetMethod() . "Ctx")) { $ctxname = $obj->GetType() . $self->GetMethod() . "Ctx"; $ob_ctx = new $ctxname(); $objtype = $obj->GetType(); $obj = new $objtype(); $obj->id = $self->GetObjectID(); $args = $self->GetArgs(); if (!$args) { $args = array(); } array_unshift($args, $obj); if ($ob_ctx instanceof Context) { return call_user_func_array(array($ob_ctx, "Execute"), $args); } else { throw new InvalidContextException($ctxname); } } else { $obj->id = $self->GetObjectID(); $method = $self->GetMethod(); $args = $self->GetArgs(); if (!$args) { $args = array(); } return call_user_func_array(array($obj, $method), $args); } } else { // bad throw new InvalidTargetException($objname); } } else { throw new ObjectNotFoundException($objname, "", array()); } }