forked from clue/reactphp-soap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxy.php
More file actions
50 lines (45 loc) · 1.28 KB
/
Proxy.php
File metadata and controls
50 lines (45 loc) · 1.28 KB
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
<?php
namespace Clue\React\Soap;
use React\Promise\PromiseInterface;
/**
* The `Proxy` class wraps an existing [`Client`](#client) instance in order to ease calling
* SOAP functions.
*
* ```php
* $proxy = new Clue\React\Soap\Proxy($client);
* ```
*
* Each and every method call to the `Proxy` class will be sent via SOAP.
*
* ```php
* $proxy->myMethod($myArg1, $myArg2)->then(function ($response) {
* // result received
* });
* ```
*
* Please refer to your WSDL or its accompanying documentation for details
* on which functions and arguments are supported.
*
* > Note that this class is called "Proxy" because it will forward (proxy) all
* method calls to the actual SOAP service via the underlying
* [`Client::soapCall()`](#soapcall) method. This is not to be confused with
* using a proxy server. See [`Client`](#client) documentation for more
* details on how to use an HTTP proxy server.
*/
final class Proxy
{
private $client;
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* @param string $name
* @param mixed[] $args
* @return PromiseInterface
*/
public function __call(string $name, array $args): PromiseInterface
{
return $this->client->soapCall($name, $args);
}
}