ImageFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 5 1
A create() 0 5 1
A supported() 0 3 1
1
<?php
2
3
namespace AmaTeam\Image\Projection\Image\Adapter\Imagick;
4
5
use AmaTeam\Image\Projection\API\Image\ImageFactoryInterface;
6
use Imagick;
7
8
class ImageFactory implements ImageFactoryInterface
9
{
10
    public function read($blob)
11
    {
12
        $resource = new Imagick();
13
        $resource->readImageBlob($blob);
14
        return new Image($resource);
15
    }
16
17
    public function create($width, $height)
18
    {
19
        $resource = new Imagick();
20
        $resource->newImage($width, $height, 'none');
21
        return new Image($resource);
22
    }
23
24
    public function supported()
25
    {
26
        return class_exists('\Imagick');
27
    }
28
}
29