GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.x ( 52ff30...48a2e9 )
by Jindřich
12s queued 11s
created

WebServiceFactory::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 5
cp 0.8
crap 2.032
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Skaut\Skautis\Wsdl;
5
6
use Skaut\Skautis\InvalidArgumentException;
7
8
/**
9
 * @inheritdoc
10
 */
11
class WebServiceFactory implements WebServiceFactoryInterface
12
{
13
14
    /** @var string Třída webové služby */
15
    protected $class;
16
17
18 6
    public function __construct(string $className = WebService::class)
19
    {
20 6
       if (!is_a($className, WebServiceInterface::class, true)) {
21
         throw new InvalidArgumentException("Argument must be class name of a class implementing WebServiceInterface. '$className' given");
22
       }
23
24 6
        $this->class = $className;
25 6
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 4
    public function createWebService(string $url, array $options): WebServiceInterface
31
    {
32 4
        if (empty($url)) {
33 1
          throw new InvalidArgumentException('WSDL URL cannot be empty.');
34
        }
35
36 3
        $soapClient = new \SoapClient($url, $options);
37 3
        return new $this->class($soapClient, $options);
38
    }
39
}
40