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.

ConfigFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 40
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A config() 0 13 2
A hasConfig() 0 6 1
1
<?php
2
3
namespace WebservicesNl\Protocol\Soap\Config;
4
5
use WebservicesNl\Common\Exception\Client\InputException;
6
use WebservicesNl\Platform\PlatformConfigInterface;
7
use WebservicesNl\Protocol\Soap\Client\SoapConfig;
8
9
/**
10
 * Class ConfigFactory.
11
 * Returns Config class for a given platform. Configured with platform and user credentials.
12
 */
13
class ConfigFactory
14
{
15
    const FQCN = 'WebservicesNl\\Protocol\\Soap\\Config\\Platform\\%1$s\\Config';
16
17
    /**
18
     * Return a Soap configuration for given platformConfig.
19
     *
20
     * @param PlatformConfigInterface $platform
21
     *
22
     * @return SoapConfig
23
     * @throws InputException
24
     */
25 9
    public static function config(PlatformConfigInterface $platform)
26
    {
27 9
        $platformName = $platform->getPlatformName();
28 9
        if (self::hasConfig($platformName) === false) {
29 1
            throw new InputException("Could not find a platform config for '$platformName'");
30
        }
31
32
        /** @var SoapConfig $soapConfig */
33 8
        $soapConfig = sprintf(self::FQCN, ucfirst($platformName));
34
35
        // return instance of config class with settings in place
36 8
        return $soapConfig::configure($platform);
37
    }
38
39
    /**
40
     * Check if config exists.
41
     *
42
     * @param string $className
43
     *
44
     * @return bool
45
     */
46 9
    public static function hasConfig($className)
47
    {
48 9
        $platformClassFQCN = sprintf(self::FQCN, ucfirst($className));
49
50 9
        return class_exists($platformClassFQCN);
51
    }
52
}
53