Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| Limit | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| create | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| empty | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Projom\Storage\SQL\Component; |
| 6 | |
| 7 | use Projom\Storage\SQL\Component\ComponentInterface; |
| 8 | |
| 9 | class Limit implements ComponentInterface |
| 10 | { |
| 11 | private readonly null|int $limit; |
| 12 | |
| 13 | public function __construct(null|int $limit) |
| 14 | { |
| 15 | $this->limit = $limit; |
| 16 | } |
| 17 | |
| 18 | public static function create(null|int $limit): Limit |
| 19 | { |
| 20 | return new Limit($limit); |
| 21 | } |
| 22 | |
| 23 | public function __toString(): string |
| 24 | { |
| 25 | return (string) $this->limit; |
| 26 | } |
| 27 | |
| 28 | public function empty(): bool |
| 29 | { |
| 30 | return $this->limit === null; |
| 31 | } |
| 32 | } |