Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| StepsEasing | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toCss | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Value; |
| 6 | |
| 7 | /** |
| 8 | * `steps(<int>, <jump-term>?)` per CSS Easing 1 ยง3.5. Discrete |
| 9 | * easing function that snaps to the nearest of N evenly-spaced |
| 10 | * stops. The optional {@see StepsJumpTerm} selects which stops |
| 11 | * "jump" (move from input to output instantaneously). |
| 12 | */ |
| 13 | final readonly class StepsEasing extends Value |
| 14 | { |
| 15 | public function __construct( |
| 16 | public int $count, |
| 17 | public StepsJumpTerm $jumpTerm = StepsJumpTerm::End, |
| 18 | ) {} |
| 19 | |
| 20 | public function toCss(): string |
| 21 | { |
| 22 | if ($this->jumpTerm === StepsJumpTerm::End) { |
| 23 | return 'steps(' . $this->count . ')'; |
| 24 | } |
| 25 | return 'steps(' . $this->count . ', ' . $this->jumpTerm->value . ')'; |
| 26 | } |
| 27 | } |