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::config()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2
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