ImageFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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