Failed Conditions
Push — JWKSet ( 3580c0...03e3f0 )
by Florent
02:43
created

JWKSets   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 3
dl 0
loc 64
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A addKeySet() 0 4 1
A getKeys() 0 13 2
A addKey() 0 4 1
A removeKey() 0 4 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