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

Soap   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __doRequest() 0 12 2
A request() 0 5 1
A response() 0 7 1
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
}