Completed
Push — master ( c2e2b8...acecd3 )
by Meng
03:52
created

Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 6
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
1
<?php
2
3
namespace Meng\AsyncSoap\Guzzle;
4
5
use GuzzleHttp\ClientInterface;
6
use Meng\Soap\HttpBinding\RequestBuilder;
7
use Meng\Soap\Interpreter;
8
use Psr\Http\Message\ResponseInterface;
9
10
class Factory
11
{
12
    public function create(ClientInterface $client, $wsdl, RequestBuilder $httpBinding, array $options = [])
13
    {
14
        $interpreterPromise = $client->requestAsync('GET', $wsdl)->then(
15
            function (ResponseInterface $response) use ($options) {
16
                $wsdl = $response->getBody()->getContents();
17
                return new Interpreter('data://text/plain;base64,' . base64_encode($wsdl), $options);
18
            }
19
        );
20
21
        return new SoapClient($client, $interpreterPromise, $httpBinding);
22
    }
23
}