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   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 52
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResult() 0 4 1
A hasResult() 0 4 1
A isStale() 0 8 2
A __toString() 0 4 1
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