Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
20.00% |
1 / 5 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| GradientStop | |
20.00% |
1 / 5 |
|
50.00% |
1 / 2 |
7.61 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toCss | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Value; |
| 6 | |
| 7 | /** |
| 8 | * One stop in a gradient: a colour plus an optional position. When the |
| 9 | * position is null the renderer interpolates based on neighbour stops. |
| 10 | */ |
| 11 | final readonly class GradientStop |
| 12 | { |
| 13 | public function __construct(public Color $color, public Length|Percentage|null $position) {} |
| 14 | |
| 15 | public function toCss(): string |
| 16 | { |
| 17 | $out = $this->color->toCss(); |
| 18 | if ($this->position !== null) { |
| 19 | $out .= ' ' . $this->position->toCss(); |
| 20 | } |
| 21 | return $out; |
| 22 | } |
| 23 | } |