Passed
Push — master ( 7da4f0...e73242 )
by Hirofumi
04:58
created

Job::maxAttempts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Shippinno\Job\Domain\Model;
4
5
use DateTimeImmutable;
6
7
abstract class Job
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $maxAttempts = 1;
13
14
    /**
15
     * @var int
16
     */
17
    protected $reattemptDelay = 0;
18
19
    /**
20
     * @var DateTimeImmutable
21
     */
22
    protected $createdAt;
23
24 2
    public function __construct()
25
    {
26 2
        $this->createdAt = new DateTimeImmutable;
27 2
    }
28
29
    /**
30
     * @return int
31
     */
32 3
    public function maxAttempts(): int
33
    {
34 3
        return $this->maxAttempts;
35
    }
36
37
    /**
38
     * @param int $maxAttempts
39
     */
40
    public function setMaxAttempts(int $maxAttempts): void
41
    {
42
        $this->maxAttempts = $maxAttempts;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 1
    public function reattemptDelay(): int
49
    {
50 1
        return $this->reattemptDelay;
51
    }
52
53
    /**
54
     * @param int $reattemptDelay
55
     */
56
    public function setReattemptDelay(int $reattemptDelay): void
57
    {
58
        $this->reattemptDelay = $reattemptDelay;
59
    }
60
61
    /**
62
     * @return DateTimeImmutable
63
     */
64 2
    public function createdAt(): DateTimeImmutable
65
    {
66 2
        return $this->createdAt;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    abstract public function jobRunner(): string;
73
}
74