Passed
Pull Request — develop (#4)
by Stephen
03:46 queued 53s
created

NcentralClientFactory::factory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Spinen\Nable\Ncentral;
4
5
use Spinen\Nable\Ncentral\NcentralClient;
6
use Spinen\Nable\Ncentral\NcentralClassmap;
7
use Symfony\Component\EventDispatcher\EventDispatcher;
8
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapEngineFactory;
9
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapOptions;
10
11
class NcentralClientFactory
12
{
13
14
    public static function factory(string $wsdl) : \Spinen\Nable\Ncentral\NcentralClient
15
    {
16
        $engine = ExtSoapEngineFactory::fromOptions(
17
            ExtSoapOptions::defaults($wsdl, [])
18
                ->withClassMap(NcentralClassmap::getCollection())
19
        );
20
        $eventDispatcher = new EventDispatcher();
21
22
        return new NcentralClient($engine, $eventDispatcher);
23
    }
24
25
26
}
27
28