|
22 | 22 | use PhpAidc\LabelPrinter\Command\TextBlock;
|
23 | 23 | use PhpAidc\LabelPrinter\Command\InternalImage;
|
24 | 24 | use PhpAidc\LabelPrinter\Contract\Label;
|
| 25 | +use PhpAidc\LabelPrinter\Contract\Media; |
25 | 26 | use PhpAidc\LabelPrinter\Contract\Command;
|
26 | 27 | use PhpAidc\LabelPrinter\Contract\Language;
|
27 | 28 | use PhpAidc\LabelPrinter\Enum\Unit;
|
@@ -83,20 +84,18 @@ private function translateCharset(?Charset $charset): iterable
|
83 | 84 | }
|
84 | 85 | }
|
85 | 86 |
|
86 |
| - private function translateMedia(array $media): iterable |
| 87 | + private function translateMedia(Media $media): iterable |
87 | 88 | {
|
88 |
| - ['unit' => $unit, 'width' => $width, 'height' => $height] = $media; |
89 |
| - |
90 |
| - if ($width && $height === null) { |
91 |
| - yield \sprintf('SIZE %s'.self::EOC, $this->valueWithUnit($width, $unit)); |
| 89 | + if ($media->getWidth() && $media->getHeight() === null) { |
| 90 | + yield \sprintf('SIZE %s'.self::EOC, $this->valueWithUnit($media->getWidth(), $media->getUnit())); |
92 | 91 |
|
93 | 92 | return;
|
94 | 93 | }
|
95 | 94 |
|
96 |
| - if ($width && $height) { |
| 95 | + if ($media->getWidth() && $media->getHeight()) { |
97 | 96 | yield \vsprintf('SIZE %s,%s'.self::EOC, [
|
98 |
| - $this->valueWithUnit($width, $unit), |
99 |
| - $this->valueWithUnit($height, $unit), |
| 97 | + $this->valueWithUnit($media->getWidth(), $media->getUnit()), |
| 98 | + $this->valueWithUnit($media->getHeight(), $media->getUnit()), |
100 | 99 | ]);
|
101 | 100 | }
|
102 | 101 | }
|
|
0 commit comments