GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Value::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
namespace Metaphore;
3
4
/**
5
 * Cache value object (stored in cache store).
6
 */
7
class Value
8
{
9
    /*** @var mixed */
10
    protected $result;
11
12
    /*** @var int */
13
    protected $expirationTimestamp;
14
15
    /**
16
     * @param mixed
17
     * @param int
18
     */
19
    public function __construct($result, $expirationTimestamp)
20
    {
21
        $this->result = $result;
22
        $this->expirationTimestamp = $expirationTimestamp;
23
    }
24
25
    /**
26
     * @return mixed
27
     */
28
    public function getResult()
29
    {
30
        return $this->result;
31
    }
32
33
    /**
34
     * @return bool
35
     */
36
    public function hasResult()
37
    {
38
        return ($this->getResult() !== false);
39
    }
40
41
    /**
42
     * @param int (optional)
43
     * @param bool
44
     */
45
    public function isStale($nowTimestamp = null)
46
    {
47
        if (!$nowTimestamp) {
48
            $nowTimestamp = time();
49
        }
50
51
        return ($nowTimestamp > $this->expirationTimestamp);
52
    }
53
54
    public function __toString()
55
    {
56
        return $this->getResult();
57
    }
58
}
59