Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| FilterFunction | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toCss | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Value; |
| 6 | |
| 7 | /** |
| 8 | * One CSS Filter Effects 1 ยง5 filter primitive. The {@see FilterKind} |
| 9 | * tag identifies which primitive; `args` holds the parsed arguments |
| 10 | * in their declared order. For most primitives the args are a |
| 11 | * single numeric / percentage / length / color value; `drop-shadow` |
| 12 | * has up to four. |
| 13 | */ |
| 14 | final readonly class FilterFunction extends Value |
| 15 | { |
| 16 | /** |
| 17 | * @param list<Value> $args |
| 18 | */ |
| 19 | public function __construct( |
| 20 | public FilterKind $kind, |
| 21 | public array $args, |
| 22 | ) {} |
| 23 | |
| 24 | public function toCss(): string |
| 25 | { |
| 26 | return $this->kind->value . '(' . implode(' ', array_map( |
| 27 | static fn(Value $v): string => $v->toCss(), |
| 28 | $this->args, |
| 29 | )) . ')'; |
| 30 | } |
| 31 | } |