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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 9
cts 10
cp 0.9
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A createWebService() 0 9 2
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