Total Complexity | 8 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class LimitQualifier extends QualifierAbstract |
||
19 | { |
||
20 | /** |
||
21 | * @var int|null |
||
22 | */ |
||
23 | protected $limit; |
||
24 | |||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | protected $count = 0; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $target; |
||
34 | |||
35 | public function __construct(?int $limit = null, string $target = InterrupterInterface::TARGET_SELF) |
||
36 | { |
||
37 | parent::__construct(); |
||
38 | |||
39 | $this->setLimit($limit) |
||
40 | ->setTarget($target); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param int|null $limit |
||
45 | * |
||
46 | * @return LimitQualifier |
||
47 | */ |
||
48 | public function setLimit(?int $limit): LimitQualifier |
||
49 | { |
||
50 | $this->limit = $limit; |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getTarget(): string |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param string $target |
||
65 | * |
||
66 | * @return LimitQualifier |
||
67 | */ |
||
68 | public function setTarget(string $target): LimitQualifier |
||
73 | } |
||
74 | |||
75 | public function qualify($param) |
||
84 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: