Failed Conditions
Pull Request — master (#130)
by Florent
11:16 queued 08:33
created

JWKSets::removeKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
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\Object;
13
14
use Assert\Assertion;
15
16
/**
17
 * Class JWKSets.
18
 */
19
final class JWKSets implements JWKSetInterface
20
{
21
    use BaseJWKSet;
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
     * PublicJWKSet constructor.
42
     *
43
     * @param \Jose\Object\JWKSetInterface $jwkset
44
     */
45
    public function addKeySet(JWKSetInterface $jwkset)
46
    {
47
        $this->jwksets[] = $jwkset;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getKeys()
54
    {
55
        $keys = [];
56
57
        foreach ($this->jwksets as $jwkset) {
58
            $keys = array_merge(
59
                $keys,
60
                $jwkset->getKeys()
61
            );
62
        }
63
64
        return $keys;
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function addKey(JWKInterface $key)
71
    {
72
        //Not available
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function removeKey($index)
79
    {
80
        //Not available
81
    }
82
}
83