1 | <?php |
||
11 | final class NumericEnsurance implements EnsuranceInterface |
||
12 | { |
||
13 | use EnsuranceTrait; |
||
14 | |||
15 | /** |
||
16 | * NumericEnsurance constructor. |
||
17 | * |
||
18 | * @param EnsuranceInterface $ensurance |
||
19 | */ |
||
20 | public function __construct(EnsuranceInterface $ensurance) |
||
24 | |||
25 | /** |
||
26 | * @return NumericEnsurance |
||
27 | */ |
||
28 | public function isInt(): self |
||
34 | |||
35 | 12 | /** |
|
36 | 12 | * @return NumericEnsurance |
|
37 | */ |
||
38 | public function isFloat(): self |
||
44 | |||
45 | 1 | /** |
|
46 | * @param float $value |
||
47 | * |
||
48 | * @return NumericEnsurance |
||
49 | */ |
||
50 | public function isGreaterThan(float $value): self |
||
56 | |||
57 | /** |
||
58 | * @param float $value |
||
59 | * |
||
60 | * @return NumericEnsurance |
||
61 | */ |
||
62 | public function isGreaterThanOrEqualTo(float $value): self |
||
68 | |||
69 | /** |
||
70 | * @param float $value |
||
71 | * |
||
72 | * @return NumericEnsurance |
||
73 | */ |
||
74 | public function isLessThan(float $value): self |
||
80 | |||
81 | /** |
||
82 | * @param float $value |
||
83 | * |
||
84 | * @return NumericEnsurance |
||
85 | */ |
||
86 | public function isLessThanOrEqualTo(float $value): self |
||
92 | |||
93 | /** |
||
94 | * @return NumericEnsurance |
||
95 | */ |
||
96 | public function isPositive(): self |
||
100 | |||
101 | 1 | /** |
|
102 | * @return NumericEnsurance |
||
103 | 1 | */ |
|
104 | public function isNegative(): self |
||
108 | |||
109 | 1 | /** |
|
110 | * @return NumericEnsurance |
||
111 | 1 | */ |
|
112 | public function isEven(): self |
||
118 | |||
119 | 1 | /** |
|
120 | * @return NumericEnsurance |
||
121 | */ |
||
122 | public function isOdd(): self |
||
128 | |||
129 | 2 | /** |
|
130 | * @param float $value |
||
131 | * |
||
132 | * @return NumericEnsurance |
||
133 | */ |
||
134 | public function isEqualTo(float $value): self |
||
140 | |||
141 | /** |
||
142 | * @param float $value |
||
143 | * |
||
144 | * @return NumericEnsurance |
||
145 | */ |
||
146 | public function isNotEqualTo(float $value): self |
||
152 | |||
153 | /** |
||
154 | * @param float $lhs |
||
155 | * @param float $rhs |
||
156 | * |
||
157 | * @return NumericEnsurance |
||
158 | */ |
||
159 | public function isBetween(float $lhs, float $rhs): self |
||
166 | |||
167 | /** |
||
168 | * @param float $lhs |
||
169 | * @param float $rhs |
||
170 | * |
||
171 | * @return NumericEnsurance |
||
172 | 1 | */ |
|
173 | public function isNotBetween(float $lhs, float $rhs): self |
||
180 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.