| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\librarys\Picqer\Barcode;
- class Barcode
- {
- protected $barcode;
- protected $width = 0;
- protected $height = 0;
- protected $bars = [];
- public function __construct(string $barcode)
- {
- $this->barcode = $barcode;
- }
- public function addBar(BarcodeBar $bar)
- {
- $this->bars[] = $bar;
- $this->width += $bar->getWidth();
- $this->height = max($this->height, $bar->getHeight());
- }
- public function getBarcode(): string
- {
- return $this->barcode;
- }
- public function getWidth(): int
- {
- return $this->width;
- }
- public function getHeight(): int
- {
- return $this->height;
- }
- public function getBars(): array
- {
- return $this->bars;
- }
- }
|