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.

FactoryTrait::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 10
nc 2
nop 1
1
<?php
2
3
namespace Emarref\Jwt;
4
5
trait FactoryTrait
6
{
7
    /**
8
     * @return string
9
     */
10
    abstract protected function getClassMap();
11
12
    /**
13
     * @return string
14
     */
15
    abstract protected function getDefaultClass();
16
17
    /**
18
     * @param string $name
19
     * @return object
20
     */
21
    public function get($name)
22
    {
23
        $classMap     = $this->getClassMap();
24
        $defaultClass = $this->getDefaultClass();
25
26
        if (isset($classMap[$name])) {
27
            $class = $classMap[$name];
28
            $parameter = new $class();
29
        } else {
30
            $class = $defaultClass;
31
            $parameter = new $class($name);
32
        }
33
34
        return $parameter;
35
    }
36
}
37