7
7
use CodeDredd \Soap \Driver \ExtSoap \ExtSoapEngineFactory ;
8
8
use CodeDredd \Soap \Exceptions \NotFoundConfigurationException ;
9
9
use CodeDredd \Soap \Exceptions \SoapException ;
10
- use CodeDredd \Soap \Faker \EngineFaker ;
11
10
use CodeDredd \Soap \Middleware \CisDhlMiddleware ;
12
11
use CodeDredd \Soap \Middleware \WsseMiddleware ;
13
12
use GuzzleHttp \Client ;
14
13
use GuzzleHttp \HandlerStack ;
15
14
use Http \Client \Common \PluginClient ;
16
15
use Http \Client \Exception \HttpException ;
17
- use Http \Client \HttpClient ;
18
- use Http \Discovery \Psr17FactoryDiscovery ;
19
16
use Illuminate \Contracts \Validation \Validator ;
20
- use Illuminate \Support \Facades \ Http ;
17
+ use Illuminate \Support \Arr ;
21
18
use Illuminate \Support \Str ;
22
19
use Illuminate \Support \Traits \Macroable ;
23
20
use Phpro \SoapClient \Type \ResultInterface ;
24
21
use Phpro \SoapClient \Type \ResultProviderInterface ;
25
22
use Psr \Http \Client \ClientInterface ;
26
23
use Soap \Engine \Engine ;
27
24
use Soap \Engine \Transport ;
25
+ use Soap \ExtSoapEngine \AbusedClient ;
28
26
use Soap \ExtSoapEngine \ExtSoapOptions ;
29
27
use Soap \ExtSoapEngine \Transport \TraceableTransport ;
30
- use Soap \ExtSoapEngine \Wsdl \InMemoryWsdlProvider ;
31
28
use Soap \ExtSoapEngine \Wsdl \PassThroughWsdlProvider ;
32
29
use Soap \ExtSoapEngine \Wsdl \WsdlProvider ;
33
30
use Soap \Psr18Transport \Psr18Transport ;
34
31
use Soap \Psr18Transport \Wsdl \Psr18Loader ;
35
32
use Soap \Psr18WsseMiddleware \WsaMiddleware ;
33
+ use Soap \Wsdl \Loader \FlatteningLoader ;
36
34
37
35
/**
38
36
* Class SoapClient.
@@ -47,76 +45,37 @@ class SoapClient
47
45
48
46
protected PluginClient $ pluginClient ;
49
47
50
- /**
51
- * @var Engine
52
- */
53
- protected $ engine ;
48
+ protected Engine $ engine ;
54
49
55
- /**
56
- * @var array
57
- */
58
- protected $ options = [];
50
+ protected array $ options = [];
59
51
60
- /**
61
- * @var ExtSoapOptions
62
- */
63
- protected $ extSoapOptions ;
52
+ protected ExtSoapOptions $ extSoapOptions ;
64
53
65
- /**
66
- * @var TraceableTransport
67
- */
68
- protected $ transport ;
54
+ protected TraceableTransport $ transport ;
69
55
70
- /**
71
- * @var array
72
- */
73
- protected $ guzzleClientOptions = [];
56
+ protected array $ guzzleClientOptions = [];
74
57
75
- /**
76
- * @var string
77
- */
78
- protected $ wsdl = '' ;
58
+ protected string $ wsdl = '' ;
79
59
80
- /**
81
- * @var bool
82
- */
83
- protected $ isClientBuilded = false ;
60
+ protected bool $ isClientBuilded = false ;
84
61
85
- /**
86
- * @var array
87
- */
88
- protected $ middlewares = [];
62
+ protected array $ middlewares = [];
89
63
90
- /**
91
- * @var SoapFactory|null
92
- */
93
- protected $ factory ;
64
+ protected SoapFactory |null $ factory ;
94
65
95
- /**
96
- * @var Psr18Loader|WsdlProvider
97
- */
98
- protected $ wsdlProvider ;
66
+ protected FlatteningLoader |WsdlProvider $ wsdlProvider ;
99
67
100
- /**
101
- * The request cookies.
102
- *
103
- * @var array
104
- */
105
- protected $ cookies ;
68
+ protected array $ cookies ;
106
69
107
70
/**
108
71
* The callbacks that should execute before the request is sent.
109
- *
110
- * @var array
111
72
*/
112
- protected $ beforeSendingCallbacks ;
73
+ protected \ Illuminate \ Support \ Collection $ beforeSendingCallbacks ;
113
74
114
75
/**
115
76
* The stub callables that will handle requests.
116
- *
117
- * @var \Illuminate\Support\Collection|null
118
77
*/
119
- protected $ stubCallbacks ;
78
+ protected \ Illuminate \ Support \ Collection | null $ stubCallbacks ;
120
79
121
80
/**
122
81
* Create a new Soap Client instance.
@@ -129,16 +88,16 @@ public function __construct(SoapFactory $factory = null)
129
88
$ this ->factory = $ factory ;
130
89
$ this ->client = new Client ($ this ->guzzleClientOptions );
131
90
$ this ->pluginClient = new PluginClient ($ this ->client , $ this ->middlewares );
132
- $ this ->wsdlProvider = Psr18Loader::createForClient ($ this ->pluginClient );
91
+ $ this ->wsdlProvider = new FlatteningLoader ( Psr18Loader::createForClient ($ this ->pluginClient ) );
133
92
$ this ->beforeSendingCallbacks = collect ([
134
93
function (Request $ request , array $ options ) {
135
- $ this ->cookies = $ options ['cookies ' ];
94
+ $ this ->cookies = Arr:: wrap ( $ options ['cookies ' ]) ;
136
95
},
137
96
]);
138
97
}
139
98
140
99
public function refreshWsdlProvider (){
141
- $ this ->wsdlProvider = Psr18Loader::createForClient ($ this ->pluginClient );
100
+ $ this ->wsdlProvider = new FlatteningLoader ( Psr18Loader::createForClient ($ this ->pluginClient ) );
142
101
143
102
return $ this ;
144
103
}
@@ -160,7 +119,7 @@ public function getPluginClient(): PluginClient
160
119
161
120
protected function setTransport (Transport $ handler = null ): static
162
121
{
163
- $ soapClient = \ Soap \ ExtSoapEngine \ AbusedClient::createFromOptions (
122
+ $ soapClient = AbusedClient::createFromOptions (
164
123
ExtSoapOptions::defaults ($ this ->wsdl , $ this ->options )
165
124
);
166
125
$ transport = $ handler ?? Psr18Transport::createForClient ($ this ->pluginClient );
0 commit comments