Completed
Push — master ( 8e4c14...5cbf24 )
by Meng
02:18
created

Soap::request()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 4
1
<?php
2
3
namespace Meng\Soap;
4
5
/**
6
 * @internal
7
 */
8
class Soap extends \SoapClient
9
{
10
    private $endpoint;
11
    private $soapRequest;
12
    private $soapResponse;
13
    private $soapAction;
14
    private $soapVersion;
15
16
    public function __doRequest($request, $location, $action, $version, $one_way = 0)
17
    {
18
        if (null !== $this->soapResponse) {
19
            return $this->soapResponse;
20
        }
21
22
        $this->endpoint = (string)$location;
23
        $this->soapAction = (string)$action;
24
        $this->soapVersion = (string)$version;
25
        $this->soapRequest = (string)$request;
26
        return '';
27
    }
28
29
    public function request($function_name, $arguments, $options, $input_headers)
30
    {
31
        $this->__soapCall($function_name, $arguments, $options, $input_headers);
32
        return new SoapRequest($this->endpoint, $this->soapAction, $this->soapVersion, $this->soapRequest);
33
    }
34
35
    public function response($response, $function_name, &$output_headers)
36
    {
37
        $this->soapResponse = $response;
38
        $response = $this->__soapCall($function_name, [], null, null, $output_headers);
39
        $this->soapResponse = null;
40
        return $response;
41
    }
42
}