Failed Conditions
Push — JWKSet ( 3580c0...03e3f0 )
by Florent
02:43
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
use Assert\Assertion;
14
15
/**
16
 * Class JWKSets
17
 */
18
final class JWKSets implements JWKSetInterface
19
{
20
    use BaseJWKSet;
21
22
    /**
23
     * @var \Jose\Object\JWKSetInterface[]
24
     */
25
    private $jwksets = [];
26
27
    /**
28
     * JWKSets constructor.
29
     *
30
     * @param \Jose\Object\JWKSetInterface[] $jwksets
31
     */
32
    public function __construct(array $jwksets)
33
    {
34
        Assertion::allIsInstanceOf($jwksets, JWKSetInterface::class);
35
36
        $this->jwksets = $jwksets;
37
    }
38
39
    /**
40
     * PublicJWKSet constructor.
41
     *
42
     * @param \Jose\Object\JWKSetInterface $jwkset
43
     */
44
    public function addKeySet(JWKSetInterface $jwkset)
45
    {
46
        $this->jwksets[] = $jwkset;
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function getKeys()
53
    {
54
        $keys = [];
55
56
        foreach ($this->jwksets as $jwkset) {
57
            $keys =array_merge(
58
                $keys,
59
                $jwkset->getKeys()
60
            );
61
        }
62
63
        return $keys;
64
    }
65
66
    /**
67
     * @inheritdoc
68
     */
69
    public function addKey(JWKInterface $key)
70
    {
71
        //Not available
72
    }
73
74
    /**
75
     * @inheritdoc
76
     */
77
    public function removeKey($index)
78
    {
79
        //Not available
80
    }
81
}
82