StaticTrustOptionsStore::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the LightSAML-Core 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 LightSaml\Store\TrustOptions;
13
14
use LightSaml\Meta\TrustOptions\TrustOptions;
15
16
class StaticTrustOptionsStore implements TrustOptionsStoreInterface
17
{
18
    /** @var TrustOptions[] */
19
    protected $options = [];
20
21
    /**
22
     * @param string $entityId
23
     *
24
     * @return StaticTrustOptionsStore
25
     */
26
    public function add($entityId, TrustOptions $options)
27
    {
28
        $this->options[$entityId] = $options;
29
30
        return $this;
31
    }
32
33
    /**
34
     * @param string $entityId
35
     *
36
     * @return TrustOptions|null
37
     */
38
    public function get($entityId)
39
    {
40
        return isset($this->options[$entityId]) ? $this->options[$entityId] : null;
41
    }
42
43
    /**
44
     * @param string $entityId
45
     *
46
     * @return bool
47
     */
48
    public function has($entityId)
49
    {
50
        return isset($this->options[$entityId]);
51
    }
52
}
53