Skip to content

Commit

Permalink
Changes for PHP 5.6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Oct 20, 2023
1 parent 882b634 commit 6bce590
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Type/Square/Datamatrix/EncodeTxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ class EncodeTxt extends \Com\Tecnick\Barcode\Type\Square\Datamatrix\Steps
*/
public function encodeTXTC40shift(&$chr, &$enc, &$temp_cw, &$ptr)
{
if (isset(Data::CHSET['SH1'][$chr])) {
if (array_key_exists($chr, Data::CHSET['SH1'])) {
$temp_cw[] = 0; // shift 1
$shiftset = Data::CHSET['SH1'];
} elseif (isset($chr, Data::CHSET['SH2'][$chr])) {
$temp_cw[] = 1; // shift 2
$shiftset = Data::CHSET['SH2'];
} elseif (($enc == Data::ENC_C40) && isset(Data::CHSET['S3C'][$chr])) {
} elseif (($enc == Data::ENC_C40) && array_key_exists($chr, Data::CHSET['S3C'])) {
$temp_cw[] = 2; // shift 3
$shiftset = Data::CHSET['S3C'];
} elseif (($enc == Data::ENC_TXT) && isset(Data::CHSET['S3T'][$chr])) {
} elseif (($enc == Data::ENC_TXT) && array_key_exists($chr, Data::CHSET['S3T'])) {
$temp_cw[] = 2; // shift 3
$shiftset = Data::CHSET['S3T'];
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Type/Square/QrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ protected function setParameters()
parent::setParameters();

// level
if (!isset($this->params[0]) || !isset(Data::ECC_LEVELS[$this->params[0]])) {
if (!isset($this->params[0]) || !array_key_exists($this->params[0], Data::ECC_LEVELS)) {
$this->params[0] = 'L';
}
$this->level = Data::ECC_LEVELS[$this->params[0]];

// hint
if (!isset($this->params[1]) || !isset(Data::ENC_MODES[$this->params[1]])) {
if (!isset($this->params[1]) || !array_key_exists($this->params[1], Data::ENC_MODES)) {
$this->params[1] = '8B';
}
$this->hint = Data::ENC_MODES[$this->params[1]];
Expand Down

0 comments on commit 6bce590

Please sign in to comment.