for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Suricate;
class ImageFont
{
const FONTTYPE_INTERNAL = 1;
const FONTTYPE_TTF = 2;
private $color;
private $text;
private $angle = 0;
private $size = 8;
private $fontType;
private $font;
private $image;
$image
public function __construct($text = '')
$this->text = $text;
}
public function font($fontFile)
if (is_int($fontFile)) {
$this->fontType = self::FONTTYPE_INTERNAL;
} else {
$this->fontType = self::FONTTYPE_TTF;
$this->font = $fontFile;
public function size($size)
$this->size = $size;
return $this;
public function angle($angle)
$this->angle = $angle;
public function color($color)
$this->color = $color;
private function createColor($image)
return imagecolorallocate(
$image,
$this->color[0],
$this->color[1],
$this->color[2]
);
public function align($align)
$align
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function align(/** @scrutinizer ignore-unused */ $align)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
public function text($text)
public function valign($align)
public function valign(/** @scrutinizer ignore-unused */ $align)
public function apply(&$image, $x = 0, $y = 0)
$colorResource = $this->createColor($image);
if ($this->fontType == self::FONTTYPE_INTERNAL) {
imagestring(
$this->font,
$x,
$y,
$this->text,
$colorResource
return;
imagettftext(
$this->size,
$this->angle,
$colorResource,
$this->text