Code Duplication    Length = 51-51 lines in 3 locations

src/Jwe/JweAlgorithmCollection.php 1 location

@@ 16-66 (lines=51) @@
13
14
use Tmilos\JoseJwt\Util\ParameterBag;
15
16
class JweAlgorithmCollection
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 JweAlgorithm $algorithm
29
     *
30
     * @return JweAlgorithmCollection
31
     */
32
    public function add($id, JweAlgorithm $algorithm)
33
    {
34
        $this->bag->set($id, $algorithm);
35
36
        return $this;
37
    }
38
39
    /**
40
     * @param string $id
41
     *
42
     * @return JweAlgorithm
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 JweAlgorithm[] id => JwsAlgorithm
61
     */
62
    public function all()
63
    {
64
        return $this->bag->all();
65
    }
66
}
67

src/Jwe/JweEncryptionCollection.php 1 location

@@ 16-66 (lines=51) @@
13
14
use Tmilos\JoseJwt\Util\ParameterBag;
15
16
class JweEncryptionCollection
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

src/Jws/JwsAlgorithmCollection.php 1 location

@@ 16-66 (lines=51) @@
13
14
use Tmilos\JoseJwt\Util\ParameterBag;
15
16
class JwsAlgorithmCollection
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 JwsAlgorithm $algorithm
29
     *
30
     * @return JwsAlgorithmCollection
31
     */
32
    public function add($id, JwsAlgorithm $algorithm)
33
    {
34
        $this->bag->set($id, $algorithm);
35
36
        return $this;
37
    }
38
39
    /**
40
     * @param string $id
41
     *
42
     * @return JwsAlgorithm
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 JwsAlgorithm[] id => JwsAlgorithm
61
     */
62
    public function all()
63
    {
64
        return $this->bag->all();
65
    }
66
}
67