JweEncryptionCollection::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the tmilos/jose-jwt package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Tmilos\JoseJwt\Jwe;
13
14
use Tmilos\JoseJwt\Util\ParameterBag;
15
16 View Code Duplication
class JweEncryptionCollection
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /** @var ParameterBag */
19
    private $bag;
20
21
    public function __construct()
22
    {
23
        $this->bag = new ParameterBag();
24
    }
25
26
    /**
27
     * @param string        $id
28
     * @param JweEncryption $algorithm
29
     *
30
     * @return JweEncryptionCollection
31
     */
32
    public function add($id, JweEncryption $algorithm)
33
    {
34
        $this->bag->set($id, $algorithm);
35
36
        return $this;
37
    }
38
39
    /**
40
     * @param string $id
41
     *
42
     * @return JweEncryption
43
     */
44
    public function get($id)
45
    {
46
        return $this->bag->get($id, null);
47
    }
48
49
    /**
50
     * @param string $id
51
     *
52
     * @return bool
53
     */
54
    public function has($id)
55
    {
56
        return $this->bag->has($id);
57
    }
58
59
    /**
60
     * @return JweEncryption[] id => JweEncryption
61
     */
62
    public function all()
63
    {
64
        return $this->bag->all();
65
    }
66
}
67