Failed Conditions
Pull Request — master (#292)
by
unknown
06:01 queued 02:17
created

JWKSets::getKeys()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2017 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\Object;
13
14
use Assert\Assertion;
15
16
/**
17
 * Class JWKSets.
18
 */
19
final class JWKSets extends BaseJWKSet implements JWKSetsInterface
20
{
21
    use JWKSetPEM;
22
23
    /**
24
     * @var \Jose\Object\JWKSetInterface[]
25
     */
26
    private $jwksets = [];
27
28
    /**
29
     * JWKSets constructor.
30
     *
31
     * @param \Jose\Object\JWKSetInterface[] $jwksets
32
     */
33
    public function __construct(array $jwksets = [])
34
    {
35
        Assertion::allIsInstanceOf($jwksets, JWKSetInterface::class);
36
37
        $this->jwksets = $jwksets;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function addKeySet(JWKSetInterface $jwkset)
44
    {
45
        $this->jwksets[] = $jwkset;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getKeys()
52
    {
53
        $keys = [];
54
55
        foreach ($this->jwksets as $jwkset) {
56
            $keys = array_merge(
57
                $keys,
58
                $jwkset->getKeys()
59
            );
60
        }
61
62
        return $keys;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function addKey(JWKInterface $key)
69
    {
70
        //Not available
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function prependKey(JWKInterface $key)
77
    {
78
        //Not available
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function removeKey($index)
85
    {
86
        //Not available
87
    }
88
}
89