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.
Test Setup Failed
Push — master ( fe4962...3aa77f )
by Thijs
04:04
created

ConfigFactory::config()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 2
eloc 6
nc 2
nop 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
 *
12
 * Returns Config class for a given platform. Configured with platform and user credentials.
13
 */
14
class ConfigFactory
15
{
16
    const FQCN = __NAMESPACE__ . '\Platform\%1$s\Config';
17
18
    /**
19
     * Return a Soap configuration for given platformConfig.
20
     *
21
     * @param PlatformConfigInterface $platform
22
     *
23
     * @return SoapConfig
24
     * @throws InputException
25
     */
26
    public static function config(PlatformConfigInterface $platform)
27
    {
28
        $platformName = $platform->getPlatformName();
29
        if (self::hasConfig($platformName) === false) {
30
            throw new InputException("Could not find a platform config for '$platformName'");
31
        }
32
33
        /** @var SoapConfig $soapConfig */
34
        $soapConfig = sprintf(self::FQCN, ucfirst($platformName));
35
36
        // return instance of config class with settings in place
37
        return $soapConfig::configure($platform);
38
    }
39
40
    /**
41
     * Check if config exists.
42
     *
43
     * @param string $className
44
     *
45
     * @return bool
46
     */
47
    public static function hasConfig($className)
48
    {
49
        $platformClassFQCN = sprintf(self::FQCN, ucfirst($className));
50
51
        return class_exists($platformClassFQCN);
52
    }
53
}
54