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   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
getClassMap() 0 1 ?
getDefaultClass() 0 1 ?
A get() 0 15 2
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