Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Filter
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toCss
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Css\Value;
6
7/**
8 * The `filter:` value as a typed list of CSS Filter Effects 1 §5
9 * primitives. The painter dispatches per
10 * {@see FilterFunction::$kind} rather than re-parsing the function
11 * name from a generic {@see CssFunction}.
12 *
13 * `filter: none` (the initial value) is represented by
14 * `Keyword('none')` and not by an empty Filter — the cascade keeps
15 * the keyword and the painter no-ops without walking a list.
16 */
17final readonly class Filter extends Value
18{
19    /**
20     * @param list<FilterFunction> $functions
21     */
22    public function __construct(public array $functions) {}
23
24    public function toCss(): string
25    {
26        return implode(' ', array_map(
27            static fn(FilterFunction $f): string => $f->toCss(),
28            $this->functions,
29        ));
30    }
31}