| 1 |
<?php |
| 2 |
|
| 3 |
namespace WCPOS\Vendor\Picqer\Barcode; |
| 4 |
|
| 5 |
class Barcode |
| 6 |
{ |
| 7 |
protected $barcode; |
| 8 |
protected $width = 0; |
| 9 |
protected $height = 0; |
| 10 |
protected $bars = []; |
| 11 |
public function __construct(string $barcode) |
| 12 |
{ |
| 13 |
$this->barcode = $barcode; |
| 14 |
} |
| 15 |
public function addBar(BarcodeBar $bar) |
| 16 |
{ |
| 17 |
$this->bars[] = $bar; |
| 18 |
$this->width += $bar->getWidth(); |
| 19 |
$this->height = \max($this->height, $bar->getHeight()); |
| 20 |
} |
| 21 |
public function getBarcode() : string |
| 22 |
{ |
| 23 |
return $this->barcode; |
| 24 |
} |
| 25 |
public function getWidth() : int |
| 26 |
{ |
| 27 |
return $this->width; |
| 28 |
} |
| 29 |
public function getHeight() : int |
| 30 |
{ |
| 31 |
return $this->height; |
| 32 |
} |
| 33 |
public function getBars() : array |
| 34 |
{ |
| 35 |
return $this->bars; |
| 36 |
} |
| 37 |
} |
| 38 |
|