1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WsdlToPhp\PackageGenerator\Generator; |
4
|
|
|
|
5
|
|
|
class GeneratorSoapClient extends AbstractGeneratorAware |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var SoapClient |
9
|
|
|
*/ |
10
|
|
|
protected $soapClient; |
11
|
|
|
/** |
12
|
|
|
* @see \WsdlToPhp\PackageGenerator\Generator\AbstractGeneratorAware::__construct() |
13
|
|
|
*/ |
14
|
420 |
|
public function __construct(Generator $generator) |
15
|
|
|
{ |
16
|
420 |
|
parent::__construct($generator); |
17
|
420 |
|
$this->initSoapClient(); |
18
|
416 |
|
} |
19
|
|
|
/** |
20
|
|
|
* @throws \InvalidArgumentException |
21
|
|
|
* @return GeneratorSoapClient |
22
|
|
|
*/ |
23
|
424 |
|
public function initSoapClient() |
24
|
|
|
{ |
25
|
|
|
try { |
26
|
424 |
|
$soapClient = new SoapClient($this->getSoapClientOptions(SOAP_1_1), true); |
27
|
424 |
|
} catch (\SoapFault $fault) { |
28
|
|
|
try { |
29
|
4 |
|
$soapClient = new SoapClient($this->getSoapClientOptions(SOAP_1_2), true); |
30
|
4 |
|
} catch (\SoapFault $fault) { |
31
|
4 |
|
throw new \InvalidArgumentException(sprintf('Unable to load WSDL at "%s"!', $this->getGenerator()->getOptionOrigin()), __LINE__, $fault); |
32
|
|
|
} |
33
|
|
|
} |
34
|
420 |
|
return $this->setSoapClient($soapClient); |
35
|
|
|
} |
36
|
|
|
/** |
37
|
|
|
* @param int $soapVersion |
38
|
|
|
* @return string[] |
39
|
|
|
*/ |
40
|
424 |
|
public function getSoapClientOptions($soapVersion) |
41
|
|
|
{ |
42
|
424 |
|
return array_merge(array( |
43
|
424 |
|
SoapClient::WSDL_SOAP_VERSION => $soapVersion, |
44
|
424 |
|
SoapClient::WSDL_URL => $this->getGenerator()->getOptionOrigin(), |
45
|
424 |
|
SoapClient::WSDL_LOGIN => $this->getGenerator()->getOptionBasicLogin(), |
46
|
424 |
|
SoapClient::WSDL_PROXY_HOST => $this->getGenerator()->getOptionProxyHost(), |
47
|
424 |
|
SoapClient::WSDL_PROXY_PORT => $this->getGenerator()->getOptionProxyPort(), |
48
|
424 |
|
SoapClient::WSDL_PASSWORD => $this->getGenerator()->getOptionBasicPassword(), |
49
|
424 |
|
SoapClient::WSDL_PROXY_LOGIN => $this->getGenerator()->getOptionProxyLogin(), |
50
|
424 |
|
SoapClient::WSDL_PROXY_PASSWORD => $this->getGenerator()->getOptionProxyPassword(), |
51
|
424 |
|
), $this->getGenerator()->getOptionSoapOptions()); |
52
|
|
|
} |
53
|
|
|
/** |
54
|
|
|
* @param SoapClient $soapClient |
55
|
|
|
* @return GeneratorSoapClient |
56
|
|
|
*/ |
57
|
420 |
|
public function setSoapClient(SoapClient $soapClient) |
58
|
|
|
{ |
59
|
420 |
|
$this->soapClient = $soapClient; |
60
|
420 |
|
return $this; |
61
|
|
|
} |
62
|
|
|
/** |
63
|
|
|
* @return SoapClient |
64
|
|
|
*/ |
65
|
400 |
|
public function getSoapClient() |
66
|
|
|
{ |
67
|
400 |
|
return $this->soapClient; |
68
|
|
|
} |
69
|
|
|
/** |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
12 |
|
public function getSoapClientStreamContextOptions() |
73
|
|
|
{ |
74
|
12 |
|
$options = array(); |
75
|
12 |
|
$soapClient = $this->getSoapClient(); |
76
|
12 |
|
if ($soapClient instanceof SoapClient) { |
77
|
12 |
|
$options = $soapClient->getStreamContextOptions(); |
|
|
|
|
78
|
12 |
|
} |
79
|
12 |
|
return $options; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.