ImageFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 4 1
A create() 0 4 1
A supported() 0 3 1
1
<?php
2
3
namespace AmaTeam\Image\Projection\Image\Adapter\Gd;
4
5
use AmaTeam\Image\Projection\API\Image\ImageFactoryInterface;
6
7
class ImageFactory implements ImageFactoryInterface
8
{
9
    /**
10
     * @inheritDoc
11
     */
12
    public function read($blob)
13
    {
14
        $resource = imagecreatefromstring($blob);
15
        return new Image($resource);
16
    }
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function create($width, $height)
22
    {
23
        $resource = imagecreatetruecolor($width, $height);
24
        return new Image($resource);
25
    }
26
27
    public static function supported()
28
    {
29
        return function_exists('imagecreatetruecolor');
30
    }
31
}
32