Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
20.00% |
1 / 5 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SkewTransform | |
20.00% |
1 / 5 |
|
33.33% |
1 / 3 |
17.80 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toCss | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| trim | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Css\Value; |
| 6 | |
| 7 | final readonly class SkewTransform extends TransformFunction |
| 8 | { |
| 9 | public function __construct(public float $xDeg, public float $yDeg = 0.0) {} |
| 10 | |
| 11 | public function toCss(): string |
| 12 | { |
| 13 | if ($this->yDeg === 0.0) { |
| 14 | return sprintf('skew(%sdeg)', self::trim($this->xDeg)); |
| 15 | } |
| 16 | return sprintf('skew(%sdeg, %sdeg)', self::trim($this->xDeg), self::trim($this->yDeg)); |
| 17 | } |
| 18 | |
| 19 | private static function trim(float $v): string |
| 20 | { |
| 21 | return fmod($v, 1.0) === 0.0 ? (string) (int) $v : (string) $v; |
| 22 | } |
| 23 | } |