PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.9.0
WP 2FA – Two-factor authentication for WordPress v2.9.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Renderer / Path / Path.php
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Renderer / Path Last commit date
Close.php 11 months ago Curve.php 11 months ago EllipticArc.php 11 months ago Line.php 11 months ago Move.php 11 months ago OperationInterface.php 11 months ago Path.php 11 months ago
Path.php
89 lines
1 <?php
2
3 declare (strict_types=1);
4 namespace WP2FA_Vendor\BaconQrCode\Renderer\Path;
5
6 use IteratorAggregate;
7 use Traversable;
8 /**
9 * Internal Representation of a vector path.
10 */
11 final class Path implements IteratorAggregate
12 {
13 /**
14 * @var OperationInterface[]
15 */
16 private $operations = [];
17 /**
18 * Moves the drawing operation to a certain position.
19 */
20 public function move(float $x, float $y) : self
21 {
22 $path = clone $this;
23 $path->operations[] = new Move($x, $y);
24 return $path;
25 }
26 /**
27 * Draws a line from the current position to another position.
28 */
29 public function line(float $x, float $y) : self
30 {
31 $path = clone $this;
32 $path->operations[] = new Line($x, $y);
33 return $path;
34 }
35 /**
36 * Draws an elliptic arc from the current position to another position.
37 */
38 public function ellipticArc(float $xRadius, float $yRadius, float $xAxisRotation, bool $largeArc, bool $sweep, float $x, float $y) : self
39 {
40 $path = clone $this;
41 $path->operations[] = new EllipticArc($xRadius, $yRadius, $xAxisRotation, $largeArc, $sweep, $x, $y);
42 return $path;
43 }
44 /**
45 * Draws a curve from the current position to another position.
46 */
47 public function curve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) : self
48 {
49 $path = clone $this;
50 $path->operations[] = new Curve($x1, $y1, $x2, $y2, $x3, $y3);
51 return $path;
52 }
53 /**
54 * Closes a sub-path.
55 */
56 public function close() : self
57 {
58 $path = clone $this;
59 $path->operations[] = Close::instance();
60 return $path;
61 }
62 /**
63 * Appends another path to this one.
64 */
65 public function append(self $other) : self
66 {
67 $path = clone $this;
68 $path->operations = \array_merge($this->operations, $other->operations);
69 return $path;
70 }
71 public function translate(float $x, float $y) : self
72 {
73 $path = new self();
74 foreach ($this->operations as $operation) {
75 $path->operations[] = $operation->translate($x, $y);
76 }
77 return $path;
78 }
79 /**
80 * @return OperationInterface[]|Traversable
81 */
82 public function getIterator() : Traversable
83 {
84 foreach ($this->operations as $operation) {
85 (yield $operation);
86 }
87 }
88 }
89