Completed
Pull Request — master (#27)
by Matthew
16:48
created

JobTiming::setStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
cc 1
eloc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Dtc\QueueBundle\Model;
4
5
class JobTiming
6
{
7
    const STATUS_INSERT = 0;
8
    const STATUS_INSERT_DELAYED = 1;
9
    const STATUS_FINISHED_SUCCESS = 100;
10
    const STATUS_FINISHED_ERROR = 101;
11
    const STATUS_FINISHED_EXPIRED = 102;
12 1
    const STATUS_FINISHED_STALLED = 103;
13
14 1
    protected $finishedAt;
15
    protected $status;
16
17
    /**
18
     * A list of all the states and descriptions for them.
19
     *
20 3
     * @return array
21
     */
22 3
    public static function getStates()
23 3
    {
24
        return [self::STATUS_FINISHED_SUCCESS => ['label' => 'Finished: SUCCESS', 'color' => 'green'],
25
            self::STATUS_FINISHED_ERROR => ['label' => 'Finished: ERROR', 'color' => 'red'],
26
            self::STATUS_FINISHED_EXPIRED => ['label' => 'Finished: EXPIRED', 'color' => 'orange'],
27
            self::STATUS_FINISHED_STALLED => ['label' => 'Finished: STALLED', 'color' => 'gold'],
28
            self::STATUS_INSERT => ['label' => 'INSERT', 'color' => 'purple'],
29
            self::STATUS_INSERT_DELAYED => ['label' => 'INSERT (Delayed)', 'color' => 'navy'], ];
30
    }
31
32
    /**
33
     * @return mixed
34
     */
35
    public function getFinishedAt()
36
    {
37
        return $this->finishedAt;
38
    }
39
40
    /**
41
     * @param mixed $finishedAt
42
     */
43
    public function setFinishedAt($finishedAt)
44
    {
45
        $this->finishedAt = $finishedAt;
46
    }
47
48
    /**
49
     * @return int
50
     */
51
    public function getStatus()
52
    {
53
        return $this->status;
54
    }
55
56
    /**
57
     * @param int $status
58
     */
59
    public function setStatus($status)
60
    {
61
        $this->status = $status;
62
    }
63
}
64