BarcodeBar.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\librarys\Picqer\Barcode;
  8. class BarcodeBar
  9. {
  10. protected $width;
  11. protected $height;
  12. protected $positionVertical;
  13. protected $type;
  14. const TYPE_BAR = 1;
  15. const TYPE_SPACING = 0;
  16. public function __construct(int $width, int $height, bool $drawBar = true, int $positionVertical = 0)
  17. {
  18. $this->width = $width;
  19. $this->height = $height;
  20. $this->positionVertical = $positionVertical;
  21. $this->type = $drawBar ? self::TYPE_BAR : self::TYPE_SPACING;
  22. }
  23. public function getWidth(): int
  24. {
  25. return $this->width;
  26. }
  27. public function getHeight(): int
  28. {
  29. return $this->height;
  30. }
  31. public function getPositionVertical(): int
  32. {
  33. return $this->positionVertical;
  34. }
  35. public function isBar(): bool
  36. {
  37. return $this->type === self::TYPE_BAR;
  38. }
  39. }