Test Failed
Push — master ( ad3b13...7d634a )
by Hirofumi
02:22
created

Job::fifoGroupId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
    /**
25
     * @var bool
26
     */
27
    protected $isExpendable = false;
28
29
    /**
30
     * @var null|string
31
     */
32
    protected $fifoGroupId;
33
34
    /**
35
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
36
     */
37 2
    public function __construct()
38
    {
39
        /** @noinspection PhpUnhandledExceptionInspection */
40 2
        $this->createdAt = new DateTimeImmutable;
41 2
        $this->setFifoGroupId();
42 2
    }
43
44
    /**
45
     * @return int
46
     */
47 2
    public function maxAttempts(): int
48
    {
49 2
        return $this->maxAttempts;
50
    }
51
52
    /**
53
     * @param int $maxAttempts
54
     */
55 1
    public function setMaxAttempts(int $maxAttempts): void
56
    {
57 1
        $this->maxAttempts = $maxAttempts;
58 1
    }
59
60
    /**
61
     * @return int
62
     */
63 2
    public function reattemptDelay(): int
64
    {
65 2
        return $this->reattemptDelay;
66
    }
67
68
    /**
69
     * @param int $reattemptDelay
70
     */
71 1
    public function setReattemptDelay(int $reattemptDelay): void
72
    {
73 1
        $this->reattemptDelay = $reattemptDelay;
74 1
    }
75
76
    /**
77
     * @return DateTimeImmutable
78
     */
79 3
    public function createdAt(): DateTimeImmutable
80
    {
81 3
        return $this->createdAt;
82
    }
83
84
    /**
85
     * @return bool
86
     */
87 2
    public function isExpendable(): bool
88
    {
89 2
        return $this->isExpendable;
90
    }
91
92
    /**
93
     * @return null|string
94
     */
95
    public function fifoGroupId(): ?string
96
    {
97
        return $this->fifoGroupId;
98
    }
99
100
    /**
101
     * @return void
102
     */
103 2
    protected function setFifoGroupId(): void
104
    {
105 2
        $this->fifoGroupId = null;
106 2
    }
107
108
    /**
109
     * @return Job[]
110
     */
111
    public function dependentJobs(): array
112
    {
113
        return [];
114
    }
115
}
116