Ejemplo n.º 1
0
Archivo: Proxy.php Proyecto: psagi/sdo
 /**
  * Invoke the method name in the target service.
  *
  * @param string $method_name Method
  * @param array  $arguments   Arguments
  *
  * @return mixed
  */
 public function __call($method_name, $arguments)
 {
     if ($this->instance_of_the_component === null) {
         $this->instance_of_the_component = SCA::createInstance($this->component_class_name);
         SCA::fillInReferences($this->instance_of_the_component);
     }
     if (SCA_Helper::checkMethods($method_name, $this->instance_of_the_component)) {
         $arguments_by_value_array = array();
         foreach ($arguments as $arg) {
             $arguments_by_value_array[] = is_object($arg) ? clone $arg : $arg;
         }
         $return = call_user_func_array(array(&$this->instance_of_the_component, $method_name), $arguments_by_value_array);
     } else {
         $classname = get_class($this->instance_of_the_component);
         $msg = "Method '{$method_name}' not found in class {$classname}";
         throw new SCA_RuntimeException($msg);
     }
     return $return;
 }