Passed
Push — master ( cb5e40...2f1917 )
by Derek Stephen
03:12
created

TransparentStrategy   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleTransparency() 0 13 1
1
<?php
2
3
namespace Del\Image\Strategy;
4
5
abstract class TransparentStrategy
6
{
7
    /**
8
     * @param resource $newImage
9
     * @param resource $image
10
     */
11 4
    public function handleTransparency($newImage, $image): void
0 ignored issues
show
Unused Code introduced by
The parameter $image is not used and could be removed. ( Ignorable by Annotation )

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

11
    public function handleTransparency($newImage, /** @scrutinizer ignore-unused */ $image): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        // Set blending mode as false
14 4
        imagealphablending($newImage, false);
15
16
        // Tell it we want to save alpha channel info
17 4
        imagesavealpha($newImage, true);
18
19
        // Set the transparent color
20 4
        $color = imagecolorallocatealpha($newImage, 0, 0, 0, 127);
21
22
        // Fill the image with nothingness
23 4
        imagefill($newImage, 0, 0, $color);
24
    }
25
}