Skip to content

Commit f9442c4

Browse files
Apply fixes from StyleCI (#191)
Co-authored-by: StyleCI Bot <[email protected]>
1 parent 125577d commit f9442c4

File tree

10 files changed

+24
-36
lines changed

10 files changed

+24
-36
lines changed

src/Client/Request.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace CodeDredd\Soap\Client;
44

5-
use CodeDredd\Soap\Xml\SoapXml;
65
use CodeDredd\Soap\Xml\XMLSerializer;
76
use Illuminate\Support\Arr;
87
use Illuminate\Support\Str;

src/Driver/ExtSoap/ExtSoapEngineFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static function fromOptionsWithHandler(
1919
): EngineFaker|SimpleEngine {
2020
$driver = ExtSoapDriver::createFromOptions($options);
2121
if ($withMocking) {
22-
2322
}
2423

2524
return $withMocking ? new EngineFaker($driver, $transport, $options) : new SimpleEngine($driver, $transport);

src/Faker/EngineFaker.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ public function getMetadata(): Metadata
4343
{
4444
return $this->driver->getMetadata();
4545
}
46-
4746
}

src/Middleware/CisDhlMiddleware.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
use Http\Client\Common\Plugin;
66
use Http\Promise\Promise;
77
use Psr\Http\Message\RequestInterface;
8+
use Psr\Http\Message\ResponseInterface;
89
use Soap\Psr18Transport\Xml\XmlMessageManipulator;
910
use Soap\Xml\Builder\SoapHeader;
1011
use Soap\Xml\Builder\SoapHeaders;
1112
use Soap\Xml\Manipulator\PrependSoapHeaders;
12-
use VeeWee\Xml\Dom\Document;
13-
use Psr\Http\Message\ResponseInterface;
1413
use function VeeWee\Xml\Dom\Builder\children;
1514
use function VeeWee\Xml\Dom\Builder\namespaced_element;
1615
use function VeeWee\Xml\Dom\Builder\value;
16+
use VeeWee\Xml\Dom\Document;
1717

1818
class CisDhlMiddleware implements Plugin
1919
{
@@ -48,7 +48,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
4848
return $next(
4949
(new XmlMessageManipulator)(
5050
$request,
51-
function (Document $document) use ($request) {
51+
function (Document $document) {
5252
$builder = new SoapHeaders(
5353
new SoapHeader(
5454
self::CIS_NS,

src/Middleware/WsseMiddleware.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ function (Document $xml) {
120120
$wsse->attachTokentoSig($token);
121121
}
122122

123-
124-
125123
// Add end-to-end encryption if configured:
126124
if ($this->encrypt) {
127125
$key = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
@@ -131,7 +129,7 @@ function (Document $xml) {
131129
$wsse->encryptSoapDoc($siteKey, $key, [
132130
'KeyInfo' => [
133131
'X509SubjectKeyIdentifier' => $this->serverCertificateHasSubjectKeyIdentifier,
134-
]
132+
],
135133
]);
136134
}
137135
}
@@ -142,7 +140,7 @@ function (Document $xml) {
142140

143141
public function afterResponse(ResponseInterface $response): ResponseInterface
144142
{
145-
if (!$this->encrypt) {
143+
if (! $this->encrypt) {
146144
return $response;
147145
}
148146

@@ -158,8 +156,8 @@ function (Document $xml) {
158156
'key' => $this->privateKeyFile,
159157
'isFile' => true,
160158
'isCert' => false,
161-
]
162-
]
159+
],
160+
],
163161
]
164162
);
165163
}

src/SoapClient.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@
77
use CodeDredd\Soap\Driver\ExtSoap\ExtSoapEngineFactory;
88
use CodeDredd\Soap\Exceptions\NotFoundConfigurationException;
99
use CodeDredd\Soap\Exceptions\SoapException;
10-
use CodeDredd\Soap\Faker\EngineFaker;
1110
use CodeDredd\Soap\Middleware\CisDhlMiddleware;
1211
use CodeDredd\Soap\Middleware\WsseMiddleware;
1312
use GuzzleHttp\Client;
1413
use GuzzleHttp\HandlerStack;
1514
use Http\Client\Common\PluginClient;
1615
use Http\Client\Exception\HttpException;
17-
use Http\Client\HttpClient;
1816
use Http\Discovery\Psr17FactoryDiscovery;
1917
use Illuminate\Contracts\Validation\Validator;
20-
use Illuminate\Support\Facades\Http;
2118
use Illuminate\Support\Str;
2219
use Illuminate\Support\Traits\Macroable;
2320
use Phpro\SoapClient\Type\ResultInterface;
@@ -27,7 +24,6 @@
2724
use Soap\Engine\Transport;
2825
use Soap\ExtSoapEngine\ExtSoapOptions;
2926
use Soap\ExtSoapEngine\Transport\TraceableTransport;
30-
use Soap\ExtSoapEngine\Wsdl\InMemoryWsdlProvider;
3127
use Soap\ExtSoapEngine\Wsdl\PassThroughWsdlProvider;
3228
use Soap\ExtSoapEngine\Wsdl\WsdlProvider;
3329
use Soap\Psr18Transport\Psr18Transport;
@@ -137,7 +133,8 @@ function (Request $request, array $options) {
137133
]);
138134
}
139135

140-
public function refreshWsdlProvider(){
136+
public function refreshWsdlProvider()
137+
{
141138
$this->wsdlProvider = Psr18Loader::createForClient($this->pluginClient);
142139

143140
return $this;
@@ -170,7 +167,6 @@ protected function setTransport(Transport $handler = null): static
170167
$transport
171168
);
172169

173-
174170
return $this;
175171
}
176172

@@ -205,10 +201,10 @@ public function withGuzzleClientOptions($options)
205201
{
206202
$this->guzzleClientOptions = array_merge_recursive($this->guzzleClientOptions, $options);
207203
$this->client = new Client($this->guzzleClientOptions);
204+
208205
return $this;
209206
}
210207

211-
212208
public function getEngine(): Engine
213209
{
214210
return $this->engine;
@@ -369,7 +365,7 @@ public function __call($method, $parameters)
369365
public function call(string $method, $arguments = []): Response
370366
{
371367
try {
372-
if (!$this->isClientBuilded) {
368+
if (! $this->isClientBuilded) {
373369
$this->buildClient();
374370
}
375371
$this->refreshEngine();
@@ -384,7 +380,7 @@ public function call(string $method, $arguments = []): Response
384380
if ($result instanceof ResultProviderInterface) {
385381
$result = Response::fromSoapResponse($result->getResult());
386382
}
387-
if (!$result instanceof ResultInterface) {
383+
if (! $result instanceof ResultInterface) {
388384
$result = Response::fromSoapResponse($result);
389385
}
390386
} catch (\Exception $exception) {
@@ -430,9 +426,9 @@ public function buildClient(string $setup = '')
430426
*/
431427
public function byConfig(string $setup)
432428
{
433-
if (!empty($setup)) {
429+
if (! empty($setup)) {
434430
$setup = config()->get('soap.clients.'.$setup);
435-
if (!$setup) {
431+
if (! $setup) {
436432
throw new NotFoundConfigurationException($setup);
437433
}
438434
foreach ($setup as $setupItem => $setupItemConfig) {

tests/Unit/Commands/MakeValidationCommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class MakeValidationCommandTest extends TestCase
88
{
9-
109
public function testConsoleCommand()
1110
{
1211
$this->markTestSkipped('wsdl2Php package has been removed. Needs refactoring');

tests/Unit/Middleware/CisDhlMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CisDhlMiddlewareTest extends TestCase
1212
public function testCisDHLMiddleware()
1313
{
1414
Soap::fake();
15-
$client = Soap::withCisDHLAuth('test', 'dhl')->baseWsdl(dirname(__DIR__, 2) . '/Fixtures/Wsdl/weather.wsdl');
15+
$client = Soap::withCisDHLAuth('test', 'dhl')->baseWsdl(dirname(__DIR__, 2).'/Fixtures/Wsdl/weather.wsdl');
1616
$response = $client->call('GetWeatherInformation');
1717
Soap::assertSent(function (Request $request) {
1818
return Str::contains($request->xmlContent(), '<cis:Authentification');

tests/Unit/SoapClientTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use CodeDredd\Soap\Tests\Fixtures\CustomSoapClient;
1111
use CodeDredd\Soap\Tests\TestCase;
1212
use GuzzleHttp\RedirectMiddleware;
13-
use Illuminate\Support\Arr;
1413
use Illuminate\Support\Str;
1514

1615
class SoapClientTest extends TestCase
@@ -24,7 +23,7 @@ public function testSimpleCall()
2423
{
2524
Soap::fake();
2625
Soap::assertNothingSent();
27-
$response = Soap::baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl')
26+
$response = Soap::baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl')
2827
->call('GetWeatherInformation');
2928
self::assertTrue($response->ok());
3029
Soap::assertSent(function (Request $request) {
@@ -46,14 +45,14 @@ public function testMagicCallByConfig()
4645
public function testWsseWithWsaCall()
4746
{
4847
Soap::fake();
49-
$client = Soap::baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl')->withWsse([
48+
$client = Soap::baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl')->withWsse([
5049
'userTokenName' => 'Test',
5150
'userTokenPassword' => 'passwordTest',
5251
'mustUnderstand' => false,
5352
])->withWsa();
5453
$response = $client->GetWeatherInformation();
5554
Soap::assertSent(function (Request $request) {
56-
return !Str::contains($request->xmlContent(), 'mustUnderstand');
55+
return ! Str::contains($request->xmlContent(), 'mustUnderstand');
5756
});
5857
self::assertTrue($response->ok());
5958
}
@@ -116,7 +115,7 @@ public function testSoapFake($action, $fake, $exspected)
116115
return Soap::response($item);
117116
})->all();
118117
Soap::fake($fake);
119-
$response = Soap::baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl')
118+
$response = Soap::baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl')
120119
->call($action);
121120
self::assertEquals($exspected, $response->json());
122121
}
@@ -149,10 +148,10 @@ public function testSoapOptions(): void
149148
{
150149
Soap::fake();
151150
$client = Soap::withOptions(['soap_version' => SOAP_1_2])
152-
->baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl');
151+
->baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl');
153152
$response = $client->call('GetWeatherInformation');
154153
self::assertTrue($response->ok());
155-
Soap::assertSent(function (Request $request) {
154+
Soap::assertSent(function (Request $request) {
156155
return Str::contains(
157156
$request->getRequest()->getHeaderLine('Content-Type'),
158157
'application/soap+xml; charset="utf-8"'
@@ -190,9 +189,9 @@ public function testRealSoapCall(): void
190189
public function testSoapWithDifferentHeaders($header, $exspected): void
191190
{
192191
Soap::fake();
193-
$client = Soap::withHeaders($header)->baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl');
192+
$client = Soap::withHeaders($header)->baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl');
194193
$response = $client->call('GetWeatherInformation');
195-
Soap::assertSent(function (Request $request) use ($exspected) {
194+
Soap::assertSent(function (Request $request) use ($exspected) {
196195
return $request->getRequest()->getHeaderLine('test') === $exspected;
197196
});
198197
self::assertTrue($response->ok());
@@ -224,7 +223,7 @@ public function testSoapClientClassMayBeCustomized(): void
224223
public function testHandlerOptions(): void
225224
{
226225
Soap::fake();
227-
$client = Soap::baseWsdl(dirname(__DIR__, 1) . '/Fixtures/Wsdl/weather.wsdl');
226+
$client = Soap::baseWsdl(dirname(__DIR__, 1).'/Fixtures/Wsdl/weather.wsdl');
228227
$response = $client->call('GetWeatherInformation');
229228
self::assertTrue($response->ok());
230229
self::assertEquals(true, $client->getClient()->getConfig()['verify']);

tests/Unit/Xml/XmlSerializerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace CodeDredd\Soap\Tests\Unit\Xml;
44

55
use CodeDredd\Soap\Tests\TestCase;
6-
use CodeDredd\Soap\Xml\SoapXml;
76
use CodeDredd\Soap\Xml\XMLSerializer;
87

98
class XmlSerializerTest extends TestCase

0 commit comments

Comments
 (0)