php-aidc /
label-printer
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of PhpAidc LabelPrinter package. |
||
| 5 | * |
||
| 6 | * © Appwilio (https://appwilio.com) |
||
| 7 | * © JhaoDa (https://github.com/jhaoda) |
||
| 8 | * |
||
| 9 | * For the full copyright and license information, please view the LICENSE |
||
| 10 | * file that was distributed with this source code. |
||
| 11 | */ |
||
| 12 | |||
| 13 | declare(strict_types=1); |
||
| 14 | |||
| 15 | namespace PhpAidc\LabelPrinter\Language\Fingerprint\Concerns; |
||
| 16 | |||
| 17 | use PhpAidc\LabelPrinter\Enum\Angle; |
||
| 18 | use PhpAidc\LabelPrinter\Contract\Command; |
||
| 19 | use PhpAidc\LabelPrinter\Language\Fingerprint; |
||
| 20 | use PhpAidc\LabelPrinter\Command\Concerns\Rotatable; |
||
| 21 | |||
| 22 | trait Rotate |
||
| 23 | { |
||
| 24 | public function rotate(Command $command) |
||
| 25 | { |
||
| 26 | /** @var Command|Rotatable $command */ |
||
| 27 | if (!$command->getRotation()->equals(Angle::_0())) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 28 | yield \sprintf('DIR %d', $command->getRotation()->getValue() + 1); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | public function resetRotate(Command $command) |
||
| 33 | { |
||
| 34 | /** @var Command|Rotatable $command */ |
||
| 35 | if (!$command->getRotation()->equals(Angle::_0())) { |
||
| 36 | yield 'DIR '.Fingerprint::DEFAULT_DIRECTION; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |