CompositeEye.php
1 week ago
EyeInterface.php
1 week ago
ModuleEye.php
1 week ago
SimpleCircleEye.php
1 week ago
SquareEye.php
1 week ago
index.php
1 week ago
SimpleCircleEye.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace WP2FA_Vendor\BaconQrCode\Renderer\Eye; |
| 5 | |
| 6 | use WP2FA_Vendor\BaconQrCode\Renderer\Path\Path; |
| 7 | /** |
| 8 | * Renders the inner eye as a circle. |
| 9 | */ |
| 10 | final class SimpleCircleEye implements EyeInterface |
| 11 | { |
| 12 | /** |
| 13 | * @var self|null |
| 14 | */ |
| 15 | private static $instance; |
| 16 | private function __construct() |
| 17 | { |
| 18 | } |
| 19 | public static function instance() : self |
| 20 | { |
| 21 | return self::$instance ?: (self::$instance = new self()); |
| 22 | } |
| 23 | public function getExternalPath() : Path |
| 24 | { |
| 25 | return (new Path())->move(-3.5, -3.5)->line(3.5, -3.5)->line(3.5, 3.5)->line(-3.5, 3.5)->close()->move(-2.5, -2.5)->line(-2.5, 2.5)->line(2.5, 2.5)->line(2.5, -2.5)->close(); |
| 26 | } |
| 27 | public function getInternalPath() : Path |
| 28 | { |
| 29 | return (new Path())->move(1.5, 0)->ellipticArc(1.5, 1.5, 0.0, \false, \true, 0.0, 1.5)->ellipticArc(1.5, 1.5, 0.0, \false, \true, -1.5, 0.0)->ellipticArc(1.5, 1.5, 0.0, \false, \true, 0.0, -1.5)->ellipticArc(1.5, 1.5, 0.0, \false, \true, 1.5, 0.0)->close(); |
| 30 | } |
| 31 | } |
| 32 |