ImageFactory::read()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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