| Total Complexity | 8 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | trait ProductVariantTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string|null |
||
| 13 | */ |
||
| 14 | protected $barcode; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The date where the barcode was checked |
||
| 18 | * |
||
| 19 | * @var DateTime|null |
||
| 20 | */ |
||
| 21 | protected $barcodeChecked; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var bool |
||
| 25 | */ |
||
| 26 | protected $barcodeValid = false; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | public function getBarcode(): ?string |
||
| 32 | { |
||
| 33 | return $this->barcode; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | public function setBarcode(?string $barcode): void |
||
| 40 | { |
||
| 41 | $this->barcode = $barcode; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | public function isBarcodeChecked(): bool |
||
| 48 | { |
||
| 49 | return $this->barcodeChecked instanceof DateTime; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * {@inheritdoc} |
||
| 54 | */ |
||
| 55 | public function getBarcodeChecked(): ?DateTime |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | public function setBarcodeChecked(?DateTime $barcodeChecked): void |
||
| 64 | { |
||
| 65 | $this->barcodeChecked = $barcodeChecked; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | public function isBarcodeValid(): bool |
||
| 72 | { |
||
| 73 | return $this->barcodeValid; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @param bool $barcodeValid |
||
| 78 | */ |
||
| 79 | public function setBarcodeValid(bool $barcodeValid): void |
||
| 80 | { |
||
| 81 | $this->barcodeValid = $barcodeValid; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * {@inheritdoc} |
||
| 86 | */ |
||
| 87 | public function markBarcodeAsChecked(bool $valid): void |
||
| 91 | } |
||
| 92 | } |
||
| 93 |