NotProcessableException::getSecondsBeforeRetry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hiapi\exceptions;
4
5
/**
6
 * Class NotProcessableException
7
 *
8
 * @author Dmytro Naumenko <[email protected]>
9
 */
10
class NotProcessableException extends \RuntimeException
11
{
12
    /**
13
     * @var int
14
     */
15
    protected $progressionMultiplier = 1;
16
    /**
17
     * @var int
18
     */
19
    private $secondsBeforeRetry;
20
21
    /**
22
     * @var int
23
     */
24
    private $maxTries;
25
26
    public function maxTries(int $maxTries): NotProcessableException
27
    {
28
        $this->maxTries = $maxTries;
29
30
        return $this;
31
    }
32
33
    /**
34
     * @param $delaySeconds
35
     * @param float $progressionMultiplier
36
     * @return self
37
     */
38
    public function retryProgressively($delaySeconds, $progressionMultiplier): NotProcessableException
39
    {
40
        $this->secondsBeforeRetry = $delaySeconds;
41
        $this->progressionMultiplier = $progressionMultiplier;
0 ignored issues
show
Documentation Bug introduced by
The property $progressionMultiplier was declared of type integer, but $progressionMultiplier is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return int
48
     */
49
    public function getSecondsBeforeRetry(): ?int
50
    {
51
        return $this->secondsBeforeRetry;
52
    }
53
54
    /**
55
     * @return int
56
     */
57
    public function getMaxTries(): ?int
58
    {
59
        return $this->maxTries;
60
    }
61
62
    /**
63
     * @return int
64
     */
65
    public function getProgressionMultiplier(): int
66
    {
67
        return $this->progressionMultiplier;
68
    }
69
}
70