Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | class Cleaner |
||
9 | { |
||
10 | use OptionalConstructor; |
||
11 | |||
12 | /** |
||
13 | * Dropped rows counter limit |
||
14 | */ |
||
15 | protected int $limit = 100; |
||
16 | |||
17 | /** |
||
18 | * Space name |
||
19 | */ |
||
20 | protected string $space = 'lock'; |
||
21 | |||
22 | 4 | protected function validateOptions() |
|
23 | { |
||
24 | 4 | if ($this->limit <= 0) { |
|
25 | 1 | $message = sprintf( |
|
26 | 1 | 'Limit expects a strictly positive. Got %d.', |
|
27 | 1 | $this->limit |
|
28 | ); |
||
29 | 1 | throw new InvalidArgumentException($message); |
|
30 | } |
||
31 | 3 | if ($this->space == '') { |
|
32 | 1 | throw new InvalidArgumentException("Space should be defined"); |
|
33 | } |
||
34 | 2 | } |
|
35 | |||
36 | 2 | public function process(): int |
|
56 | } |
||
57 | } |
||
58 |