JWKAnalyzerManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 6 1
A analyze() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2017 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace Jose\Component\KeyManagement\KeyAnalyzer;
15
16
use Jose\Component\Core\JWK;
17
18
/**
19
 * Class JWKAnalyzerManager.
20
 */
21
final class JWKAnalyzerManager
22
{
23
    /**
24
     * @var JWKAnalyzerInterface[]
25
     */
26
    private $analyzers = [];
27
28
    /**
29
     * @param JWKAnalyzerInterface $analyzer
30
     *
31
     * @return JWKAnalyzerManager
32
     */
33
    public function add(JWKAnalyzerInterface $analyzer): JWKAnalyzerManager
34
    {
35
        $this->analyzers[] = $analyzer;
36
37
        return $this;
38
    }
39
40
    /**
41
     * @param JWK $jwk
42
     *
43
     * @return string[]
44
     */
45
    public function analyze(JWK $jwk): array
46
    {
47
        $messages = [];
48
        foreach ($this->analyzers as $analyzer) {
49
            $analyzer->analyze($jwk, $messages);
50
        }
51
52
        return $messages;
53
    }
54
}
55