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

Job   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 67
ccs 9
cts 15
cp 0.6
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A maxAttempts() 0 4 1
A setMaxAttempts() 0 4 1
A reattemptDelay() 0 4 1
A setReattemptDelay() 0 4 1
A createdAt() 0 4 1
jobRunner() 0 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