From 2f32c9e22ba13431bc93757457ba601e3684c6e1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 10 Dec 2018 18:18:34 +0100 Subject: [PATCH] Fix increment order --- Utils/Barcode/C128Abstract.php | 4 ++-- Utils/Barcode/C25.php | 6 +++--- Utils/Barcode/C39.php | 2 +- Utils/Barcode/Codebar.php | 4 ++-- Utils/Encoding/XorEncoding.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index 984692138..938bdf11c 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -301,7 +301,7 @@ abstract class C128Abstract $length = \strlen($this->content); $checksum = static::$CHECKSUM; - for ($pos = 1; $pos <= $length; $pos++) { + for ($pos = 1; $pos <= $length; ++$pos) { $activeKey = \substr($this->content, ($pos - 1), 1); $codeString .= static::$CODEARRAY[$activeKey]; $checksum += $values[$activeKey] * $pos; @@ -336,7 +336,7 @@ abstract class C128Abstract $length = \strlen($codeString); \imagefill($image, 0, 0, $white); - for ($position = 1; $position <= $length; $position++) { + for ($position = 1; $position <= $length; ++$position) { $cur_size = $location + (int) (\substr($codeString, ($position - 1), 1)); if ($this->orientation === OrientationType::HORIZONTAL) { diff --git a/Utils/Barcode/C25.php b/Utils/Barcode/C25.php index 829c31677..0a8ac763f 100644 --- a/Utils/Barcode/C25.php +++ b/Utils/Barcode/C25.php @@ -113,8 +113,8 @@ class C25 extends C128Abstract $arrayLength = \count(self::$CODEARRAY); $temp = []; - for ($posX = 1; $posX <= $length; $posX++) { - for ($posY = 0; $posY < $arrayLength; $posY++) { + for ($posX = 1; $posX <= $length; ++$posX) { + for ($posY = 0; $posY < $arrayLength; ++$posY) { if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) { $temp[$posX] = self::$CODEARRAY2[$posY]; } @@ -127,7 +127,7 @@ class C25 extends C128Abstract $temp2 = \explode('-', $temp[($posX + 1)]); $count = \count($temp1); - for ($posY = 0; $posY < $count; $posY++) { + for ($posY = 0; $posY < $count; ++$posY) { $codeString .= $temp1[$posY] . $temp2[$posY]; } } diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php index 564b5a190..72de3260d 100644 --- a/Utils/Barcode/C39.php +++ b/Utils/Barcode/C39.php @@ -87,7 +87,7 @@ class C39 extends C128Abstract $codeString = ''; $length = \strlen($this->content); - for ($X = 1; $X <= $length; $X++) { + for ($X = 1; $X <= $length; ++$X) { $codeString .= self::$CODEARRAY[substr($this->content, ($X - 1), 1)] . '1'; } diff --git a/Utils/Barcode/Codebar.php b/Utils/Barcode/Codebar.php index 367c5fba0..5c509f46c 100644 --- a/Utils/Barcode/Codebar.php +++ b/Utils/Barcode/Codebar.php @@ -89,8 +89,8 @@ class Codebar extends C128Abstract $length = \strlen($this->content); $lenCodearr = \count(self::$CODEARRAY); - for ($posX = 1; $posX <= $length; $posX++) { - for ($posY = 0; $posY < $lenCodearr; $posY++) { + for ($posX = 1; $posX <= $length; ++$posX) { + for ($posY = 0; $posY < $lenCodearr; ++$posY) { if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) { $codeString .= self::$CODEARRAY2[$posY] . '1'; } diff --git a/Utils/Encoding/XorEncoding.php b/Utils/Encoding/XorEncoding.php index 4c5093d40..9f5d0d61e 100644 --- a/Utils/Encoding/XorEncoding.php +++ b/Utils/Encoding/XorEncoding.php @@ -56,7 +56,7 @@ final class XorEncoding $length = \strlen($source); $keyLength = \strlen($key) - 1; - for ($i = 0, $j = 0; $i < $length; ++$i, $j++) { + for ($i = 0, $j = 0; $i < $length; ++$i, ++$j) { if ($j > $keyLength) { $j = 0; }