File indexing completed on 2024-12-22 05:37:07
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Soap 0017 * @subpackage AutoDiscover 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id:$ 0021 */ 0022 0023 class Zend_Soap_Server_Proxy 0024 { 0025 /** 0026 * @var object 0027 */ 0028 protected $_classInstance; 0029 /** 0030 * @var string 0031 */ 0032 protected $_className; 0033 /** 0034 * Constructor 0035 * 0036 * @param object $service 0037 */ 0038 public function __construct($className, $classArgs = array()) 0039 { 0040 $class = new ReflectionClass($className); 0041 $constructor = $class->getConstructor(); 0042 if ($constructor === null) { 0043 $this->_classInstance = $class->newInstance(); 0044 } else { 0045 $this->_classInstance = $class->newInstanceArgs($classArgs); 0046 } 0047 $this->_className = $className; 0048 } 0049 /** 0050 * Proxy for the WS-I compliant call 0051 * 0052 * @param string $name 0053 * @param string $arguments 0054 * @return array 0055 */ 0056 public function __call($name, $arguments) 0057 { 0058 $result = call_user_func_array(array($this->_classInstance, $name), $this->_preProcessArguments($arguments)); 0059 return array("{$name}Result"=>$result); 0060 } 0061 /** 0062 * Pre process arguments 0063 * 0064 * @param mixed $arguments 0065 * @return array 0066 */ 0067 protected function _preProcessArguments($arguments) 0068 { 0069 if (count($arguments) == 1 && is_object($arguments[0])) { 0070 return get_object_vars($arguments[0]); 0071 } else { 0072 return $arguments; 0073 } 0074 } 0075 }