Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Proxy.php
Go to the documentation of this file.
1 <?php
24 {
28  protected $_classInstance;
32  protected $_className;
38  public function __construct($className, $classArgs = array())
39  {
40  $class = new ReflectionClass($className);
41  $constructor = $class->getConstructor();
42  if ($constructor === null) {
43  $this->_classInstance = $class->newInstance();
44  } else {
45  $this->_classInstance = $class->newInstanceArgs($classArgs);
46  }
47  $this->_className = $className;
48  }
56  public function __call($name, $arguments)
57  {
58  $result = call_user_func_array(array($this->_classInstance, $name), $this->_preProcessArguments($arguments));
59  return array("{$name}Result"=>$result);
60  }
67  protected function _preProcessArguments($arguments)
68  {
69  if (count($arguments) == 1 && is_object($arguments[0])) {
70  return get_object_vars($arguments[0]);
71  } else {
72  return $arguments;
73  }
74  }
75 }
_preProcessArguments($arguments)
Definition: Proxy.php:67
__call($name, $arguments)
Definition: Proxy.php:56
$_option $_optionId $class
Definition: date.phtml:13
$arguments
__construct($className, $classArgs=array())
Definition: Proxy.php:38
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31
if(!isset($_GET['name'])) $name
Definition: log.php:14