Completed
Push — master ( a94a5c...e317aa )
by Florent
02:24
created

ClaimCheckerManager::getSupportedClaimCheckers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\ClaimChecker;
13
14
use Jose\Object\JWTInterface;
15
16
/**
17
 * Class ClaimCheckerManager
18
 */
19
class ClaimCheckerManager implements ClaimCheckerManagerInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function checkClaims(JWTInterface $jwt)
25
    {
26
        $checkers = $this->getSupportedClaimCheckers();
27
        $checked_claims = [];
28
29
        foreach ($checkers as $checker) {
30
            $checked_claims = array_merge(
31
                $checked_claims,
32
                $checker->checkClaim($jwt)
33
            );
34
        }
35
36
        return $checked_claims;
37
    }
38
39
    /**
40
     * @return \Jose\ClaimChecker\ClaimCheckerInterface[]
41
     */
42
    protected function getSupportedClaimCheckers()
43
    {
44
        return [
45
            new ExpirationTimeChecker(),
46
            new IssuedAtChecker(),
47
            new NotBeforeChecker(),
48
        ];
49
    }
50
}
51