ColorUtils   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A colorIdentifier() 0 7 2
1
<?php
2
3
namespace Jackal\ImageMerge\Utils;
4
5
use Jackal\ImageMerge\Model\Color;
6
7
/**
8
 * Class ColorUtils
9
 * @package Jackal\ImageMerge\Utils
10
 */
11
class ColorUtils
12
{
13
    /**
14
     * @param $resource
15
     * @param Color $color
16
     * @param bool $alpha
17
     * @return int
18
     */
19
    public static function colorIdentifier($resource, Color $color, $alpha = false)
20
    {
21
        if (!$alpha) {
22
            return imagecolorallocate($resource, $color->red(), $color->green(), $color->blue());
0 ignored issues
show
Bug introduced by
$color->blue() of type string is incompatible with the type integer expected by parameter $blue of imagecolorallocate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            return imagecolorallocate($resource, $color->red(), $color->green(), /** @scrutinizer ignore-type */ $color->blue());
Loading history...
Bug introduced by
$color->red() of type string is incompatible with the type integer expected by parameter $red of imagecolorallocate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            return imagecolorallocate($resource, /** @scrutinizer ignore-type */ $color->red(), $color->green(), $color->blue());
Loading history...
Bug introduced by
$color->green() of type string is incompatible with the type integer expected by parameter $green of imagecolorallocate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            return imagecolorallocate($resource, $color->red(), /** @scrutinizer ignore-type */ $color->green(), $color->blue());
Loading history...
23
        }
24
25
            return imagecolorallocatealpha($resource, $color->red(), $color->green(), $color->blue(), 127);
0 ignored issues
show
Bug introduced by
$color->red() of type string is incompatible with the type integer expected by parameter $red of imagecolorallocatealpha(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
            return imagecolorallocatealpha($resource, /** @scrutinizer ignore-type */ $color->red(), $color->green(), $color->blue(), 127);
Loading history...
Bug introduced by
$color->green() of type string is incompatible with the type integer expected by parameter $green of imagecolorallocatealpha(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
            return imagecolorallocatealpha($resource, $color->red(), /** @scrutinizer ignore-type */ $color->green(), $color->blue(), 127);
Loading history...
Bug introduced by
$color->blue() of type string is incompatible with the type integer expected by parameter $blue of imagecolorallocatealpha(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
            return imagecolorallocatealpha($resource, $color->red(), $color->green(), /** @scrutinizer ignore-type */ $color->blue(), 127);
Loading history...
26
27
    }
28
}
29