-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDocumentSoapObjectWrapper.php
61 lines (55 loc) · 1.63 KB
/
DocumentSoapObjectWrapper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* @link https://github.com/borodulin/yii2-services
* @license https://github.com/borodulin/yii2-services/blob/master/LICENSE.md
*/
namespace conquer\services;
use yii\base\Component;
/**
* DocumentSoapObjectWrapper is a wrapper class internally used
* when generatorConfig contains bindingStyle key set to document value.
*
* @author Jan Was <[email protected]>
* @package system.web.services
*/
class DocumentSoapObjectWrapper extends Component
{
/**
* @var object the service provider
*/
public $object = null;
/**
* Constructor.
* @param object $object the service provider
* @param array $config
*/
public function __construct($object, $config = [])
{
$this->object = $object;
parent::__construct($config);
}
/**
* PHP __call magic method.
* This method calls the service provider to execute the actual logic.
* @param string $name method name
* @param array $arguments method arguments
* @return mixed method return value
*/
public function __call($name, $arguments)
{
if (is_array($arguments) && isset($arguments[0])) {
$result = call_user_func_array([$this->object, $name], (array)$arguments[0]);
} else {
$result = call_user_func_array([$this->object, $name], $arguments);
}
return $result === null ? $result : [$name . 'Result' => $result];
}
/**
* Returns the fully qualified name of this class.
* @return string the fully qualified name of this class.
*/
public static function className()
{
return get_called_class();
}
}