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.

Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getResponse() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Netaxept API package.
5
 *
6
 * (c) Andrew Plank
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace FDM\Netaxept\Response;
15
16
use Webmozart\Assert\Assert;
17
18
class Factory
19
{
20
    private $classMap = [];
21
22
    public function __construct(
23
        $queryClass = Query::class,
24
        $processClass = Process::class,
25
        $registerClass = Register::class
26
    ) {
27
        $this->classMap = [
28
            'PaymentInfo' => $queryClass,
29
            'ProcessResponse' => $processClass,
30
            'RegisterResponse' => $registerClass,
31
        ];
32
    }
33
34
    public function getResponse(\SimpleXMLElement $xml)
35
    {
36
        Assert::notEmpty(
37
            $this->classMap[$xml->getName()],
38
            'Unable to instantiate response class for ' . $xml->getName()
39
        );
40
41
        $className = $this->classMap[$xml->getName()];
42
43
        return new $className($xml);
44
    }
45
}
46