Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Translate | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toMatrix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Svg\Value\Transform; |
| 6 | |
| 7 | use Phpdftk\Svg\Value\TransformFunction; |
| 8 | |
| 9 | /** |
| 10 | * `translate(tx)` or `translate(tx, ty)`. `ty` defaults to 0 per SVG 2 ยง8.4. |
| 11 | */ |
| 12 | final class Translate implements TransformFunction |
| 13 | { |
| 14 | public function __construct( |
| 15 | public readonly float $tx, |
| 16 | public readonly float $ty = 0.0, |
| 17 | ) {} |
| 18 | |
| 19 | public function toMatrix(): array |
| 20 | { |
| 21 | return [1.0, 0.0, 0.0, 1.0, $this->tx, $this->ty]; |
| 22 | } |
| 23 | } |