PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / bacon / bacon-qr-code / src / Renderer / Path / Path.php
ameliabooking / vendor / bacon / bacon-qr-code / src / Renderer / Path Last commit date
Close.php 9 months ago Curve.php 9 months ago EllipticArc.php 9 months ago Line.php 9 months ago Move.php 9 months ago OperationInterface.php 9 months ago Path.php 9 months ago
Path.php
107 lines
1 <?php
2 declare(strict_types = 1);
3
4 namespace BaconQrCode\Renderer\Path;
5
6 use IteratorAggregate;
7 use Traversable;
8
9 /**
10 * Internal Representation of a vector path.
11 */
12 final class Path implements IteratorAggregate
13 {
14 /**
15 * @var OperationInterface[]
16 */
17 private $operations = [];
18
19 /**
20 * Moves the drawing operation to a certain position.
21 */
22 public function move(float $x, float $y) : self
23 {
24 $path = clone $this;
25 $path->operations[] = new Move($x, $y);
26 return $path;
27 }
28
29 /**
30 * Draws a line from the current position to another position.
31 */
32 public function line(float $x, float $y) : self
33 {
34 $path = clone $this;
35 $path->operations[] = new Line($x, $y);
36 return $path;
37 }
38
39 /**
40 * Draws an elliptic arc from the current position to another position.
41 */
42 public function ellipticArc(
43 float $xRadius,
44 float $yRadius,
45 float $xAxisRotation,
46 bool $largeArc,
47 bool $sweep,
48 float $x,
49 float $y
50 ) : self {
51 $path = clone $this;
52 $path->operations[] = new EllipticArc($xRadius, $yRadius, $xAxisRotation, $largeArc, $sweep, $x, $y);
53 return $path;
54 }
55
56 /**
57 * Draws a curve from the current position to another position.
58 */
59 public function curve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) : self
60 {
61 $path = clone $this;
62 $path->operations[] = new Curve($x1, $y1, $x2, $y2, $x3, $y3);
63 return $path;
64 }
65
66 /**
67 * Closes a sub-path.
68 */
69 public function close() : self
70 {
71 $path = clone $this;
72 $path->operations[] = Close::instance();
73 return $path;
74 }
75
76 /**
77 * Appends another path to this one.
78 */
79 public function append(self $other) : self
80 {
81 $path = clone $this;
82 $path->operations = array_merge($this->operations, $other->operations);
83 return $path;
84 }
85
86 public function translate(float $x, float $y) : self
87 {
88 $path = new self();
89
90 foreach ($this->operations as $operation) {
91 $path->operations[] = $operation->translate($x, $y);
92 }
93
94 return $path;
95 }
96
97 /**
98 * @return OperationInterface[]|Traversable
99 */
100 public function getIterator() : Traversable
101 {
102 foreach ($this->operations as $operation) {
103 yield $operation;
104 }
105 }
106 }
107