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.
Completed
Pull Request — develop (#32)
by Boy
08:18 queued 05:44
created

AuthnContextClass::getTypes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Surfnet\StepupBundle\Value;
4
5
use Surfnet\SamlBundle\Exception\InvalidArgumentException;
6
7
final class AuthnContextClass
8
{
9
    const TYPE_GATEWAY='gateway';
10
    const TYPE_SECOND_FACTOR_ONLY='second-factor-only';
11
12
    /**
13
     * @var string
14
     */
15
    private $identifier;
16
17
    /**
18
     * @var string
19
     */
20
    private $type;
21
22
    /**
23
     * AuthnContextClassRef constructor.
24
     * @param string $identifier
25
     * @param string $type
26
     */
27
    public function __construct($identifier, $type)
28
    {
29
        $this->identifier = $identifier;
30
31
        if (!in_array($type, [self::TYPE_GATEWAY, self::TYPE_SECOND_FACTOR_ONLY])) {
32
            throw InvalidArgumentException::invalidType(
33
              'AuthnContextClassRef class constant',
34
              'type',
35
              $type
36
            );
37
        }
38
39
        $this->type = $type;
40
    }
41
42
    public static function getTypes()
43
    {
44
        return [
45
            static::TYPE_GATEWAY,
46
            static::TYPE_SECOND_FACTOR_ONLY,
47
        ];
48
    }
49
50
    /**
51
     * @param string $authnContextClassRef
52
     */
53
    public function isIdentifiedBy($authnContextClassRef)
54
    {
55
        return $this->identifier === $authnContextClassRef;
56
    }
57
58
    /**
59
     * @param $type
60
     * @return bool
61
     */
62
    public function isOfType($type)
63
    {
64
        return $this->type === $type;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function __toString()
71
    {
72
        return  $this->identifier;
73
    }
74
}
75