Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| IdSelector | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| specificity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Selector; |
| 6 | |
| 7 | /** |
| 8 | * ID selector per Selectors 4 ยง7: `#identifier`. Specificity (1, 0, 0). |
| 9 | */ |
| 10 | final readonly class IdSelector extends SimpleSelector |
| 11 | { |
| 12 | public function __construct(public string $id) {} |
| 13 | |
| 14 | public function specificity(): Specificity |
| 15 | { |
| 16 | return new Specificity(1, 0, 0); |
| 17 | } |
| 18 | |
| 19 | public function toString(): string |
| 20 | { |
| 21 | return '#' . $this->id; |
| 22 | } |
| 23 | } |