Skip to content

Commit d8354c1

Browse files
committed
fix(TypeITF14): codestyle
1 parent 671552e commit d8354c1

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/Types/TypeTF14.php

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
<?php
2-
3-
namespace Picqer\Barcode\Types;
1+
<?php namespace Igor\BaseCode\Classes\Barcode\Types;
42

53
use Picqer\Barcode\Barcode;
64
use Picqer\Barcode\BarcodeBar;
75
use Picqer\Barcode\Exceptions\InvalidCharacterException;
86
use Picqer\Barcode\Exceptions\InvalidLengthException;
97
use Picqer\Barcode\Types\TypeInterface;
108

11-
/**
12-
* ITF-14 is the GS1 implementation of an Interleaved 2 of 5 (ITF) bar code
13-
* to encode a Global Trade Item Number. ITF-14 symbols are generally used
14-
* on packaging levels of a product, such as a case box of 24 cans of soup.
15-
* The ITF-14 will always encode 14 digits.
16-
*/
17-
18-
class TypeITF14 implements TypeInterface
9+
class TypeCodeITF14 implements TypeInterface
1910
{
2011
/**
2112
* @throws InvalidLengthException
@@ -37,8 +28,7 @@ public function getBarcodeData(string $code): Barcode
3728
$chr['8'] = '21121';
3829
$chr['9'] = '12121';
3930

40-
41-
if (strlen($code) == 13) {
31+
if (strlen($code) === 13) {
4232
$total = 0;
4333

4434
for ($i = 0; $i <= strlen($code) - 1; $i++) {
@@ -48,8 +38,9 @@ public function getBarcodeData(string $code): Barcode
4838

4939
$cs = $total % 10;
5040
$cs = 10 - $cs;
51-
if ($cs === 10)
41+
if ($cs === 10) {
5242
$cs = 0;
43+
}
5344

5445
$code .= (string) $cs;
5546
}
@@ -71,8 +62,7 @@ public function getBarcodeData(string $code): Barcode
7162
}
7263

7364
for ($i = 0; $i < strlen($code); $i += 2) {
74-
75-
if (!isset($chr[$code{$i}]) || !isset($chr[$code{$i + 1}])) {
65+
if (!isset($chr[$code[$i]]) || !isset($chr[$code[$i + 1]])) {
7666
throw new InvalidCharacterException();
7767
}
7868

@@ -93,14 +83,13 @@ public function getBarcodeData(string $code): Barcode
9383
foreach ($pmixedarr as $x) {
9484
if ($bars) {
9585
$t = true;
96-
$w = ($x === '1') ? '1' : '2';
9786
} else {
9887
$t = false;
99-
$w = ($x === '1') ? '1' : '2';
10088
}
89+
$w = ($x === '1') ? '1' : '2';
10190

10291
$barcode->addBar(new BarcodeBar($w, 1, $t));
103-
$bars = !$bars;
92+
$bars = !$bars;
10493
++$k;
10594
}
10695
}

0 commit comments

Comments
 (0)