IdArrayStore   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A has() 0 3 1
A set() 0 6 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\Id;
13
14
class IdArrayStore implements IdStoreInterface
15
{
16
    /** @var array */
17
    protected $store = [];
18
19
    /**
20
     * @param string $entityId
21
     * @param string $id
22
     *
23
     * @return void
24
     */
25
    public function set($entityId, $id, \DateTime $expiryTime)
26
    {
27
        if (false == isset($this->store[$entityId])) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
28
            $this->store[$entityId] = [];
29
        }
30
        $this->store[$entityId][$id] = $expiryTime;
31
    }
32
33
    /**
34
     * @param string $entityId
35
     * @param string $id
36
     *
37
     * @return bool
38
     */
39
    public function has($entityId, $id)
40
    {
41
        return isset($this->store[$entityId][$id]);
42
    }
43
}
44