Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CssFunction | |
33.33% |
1 / 3 |
|
50.00% |
1 / 2 |
3.19 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toCss | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Value; |
| 6 | |
| 7 | /** |
| 8 | * Catch-all for value-position function calls that don't have a typed |
| 9 | * representation (yet). Calc, transform, gradients, etc. have their own |
| 10 | * dedicated value subclasses; everything else falls here. |
| 11 | */ |
| 12 | final readonly class CssFunction extends Value |
| 13 | { |
| 14 | /** @param list<Value> $arguments */ |
| 15 | public function __construct(public string $name, public array $arguments) {} |
| 16 | |
| 17 | public function toCss(): string |
| 18 | { |
| 19 | $args = implode(', ', array_map(static fn(Value $v): string => $v->toCss(), $this->arguments)); |
| 20 | return $this->name . '(' . $args . ')'; |
| 21 | } |
| 22 | } |