NcentralClientFactory::factory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Spinen\Ncentral;
4
5
use Spinen\Ncentral\NcentralClient;
6
use Spinen\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 1
    public static function factory(string $wsdl) : \Spinen\Ncentral\NcentralClient
15
    {
16 1
        $engine = ExtSoapEngineFactory::fromOptions(
17 1
            ExtSoapOptions::defaults($wsdl, [])
18 1
                ->withClassMap(NcentralClassmap::getCollection())
19
        );
20 1
        $eventDispatcher = new EventDispatcher();
21
22 1
        return new NcentralClient($engine, $eventDispatcher);
23
    }
24
25
26
}
27
28