Passed
Push — master ( a2bda9...787c53 )
by Derek Stephen
01:51
created

JpegStrategy   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A save() 0 3 1
A getContentType() 0 3 1
A render() 0 3 1
A handleTransparency() 0 3 1
1
<?php
2
3
namespace Del\Image\Strategy;
4
5
class JpegStrategy implements ImageTypeStrategyInterface
6
{
7
    /**
8
     * @param string $filename
9
     * @return resource
10
     */
11 5
    public function create($filename)
12
    {
13 5
        return imagecreatefromjpeg($filename);
14
    }
15
16 1
    public function save($resource, $filename, $compression)
17
    {
18 1
        imagejpeg($resource, $filename, $compression);
19 1
    }
20
21
    /**
22
     * @return string
23
     */
24 1
    public function getContentType()
25
    {
26 1
        return 'image/jpeg';
27
    }
28
29
    /**
30
     * @param $resource
31
     */
32 4
    public function render($resource)
33
    {
34 4
        imagejpeg($resource);
35 4
    }
36
37
    /**
38
     * @return void
39
     */
40 1
    public function handleTransparency($newImage, $image)
41
    {
42 1
        return;
43
    }
44
}