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

TransparentStrategy::handleTransparency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
crap 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
}