Close.php
8 months ago
Curve.php
8 months ago
EllipticArc.php
8 months ago
Line.php
8 months ago
Move.php
8 months ago
OperationInterface.php
8 months ago
Path.php
8 months ago
Move.php
42 lines
| 1 | <?php |
| 2 | declare(strict_types = 1); |
| 3 | |
| 4 | namespace BaconQrCode\Renderer\Path; |
| 5 | |
| 6 | final class Move implements OperationInterface |
| 7 | { |
| 8 | /** |
| 9 | * @var float |
| 10 | */ |
| 11 | private $x; |
| 12 | |
| 13 | /** |
| 14 | * @var float |
| 15 | */ |
| 16 | private $y; |
| 17 | |
| 18 | public function __construct(float $x, float $y) |
| 19 | { |
| 20 | $this->x = $x; |
| 21 | $this->y = $y; |
| 22 | } |
| 23 | |
| 24 | public function getX() : float |
| 25 | { |
| 26 | return $this->x; |
| 27 | } |
| 28 | |
| 29 | public function getY() : float |
| 30 | { |
| 31 | return $this->y; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @return self |
| 36 | */ |
| 37 | public function translate(float $x, float $y) : OperationInterface |
| 38 | { |
| 39 | return new self($this->x + $x, $this->y + $y); |
| 40 | } |
| 41 | } |
| 42 |