Skip to content

Commit

Permalink
try compatibility with php 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Dec 8, 2021
1 parent 98d6e79 commit a2aef6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ workflows:
- unittest:
matrix:
parameters:
php-version: ["8.1", "8.0"]
php-version: ["8.1", "8.0", "5.6"]
25 changes: 10 additions & 15 deletions src/BaseColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
class BaseColor
{
const COLOR_ROUNDING_COEFF = 0x33;
private $r;
private $g;
private $b;
private $a;
public $r;
public $g;
public $b;
public $a;

function __construct($r = null, $g = null, $b = null, $a = null)
{
$this->r = $r ?? 0;
$this->g = $g ?? 0;
$this->b = $b ?? 0;
$this->a = $a ?? 0;
$this->r = $r ? $r : 0;
$this->g = $g ? $g : 0;
$this->b = $b ? $b : 0;
$this->a = $a ? $a : 0;
}

function getClone()
Expand Down Expand Up @@ -58,7 +58,7 @@ function toArray()
];
}

function toString()
protected function toString()
{
return join(',', $this->toArray());
}
Expand Down Expand Up @@ -94,12 +94,7 @@ function toGd($image, $toAlpha = null)
$this->a
);
} else {
return imagecolorallocate(
$oGd,
$this->r,
$this->g,
$this->b
);
return imagecolorallocate($oGd, $this->r, $this->g, $this->b);
}
}
}

0 comments on commit a2aef6d

Please sign in to comment.