Png::createFromState()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Barryvanveen\CCA\Generators;
6
7
use Barryvanveen\CCA\Config;
8
use Barryvanveen\CCA\State;
9
10
class Png extends Image
11
{
12 3
    public static function createFromState(Config $config, State $state)
13
    {
14 3
        return new self($config, $state);
15
    }
16
17 3
    public function save(string $destination = 'image.png')
18
    {
19 3
        imagetruecolortopalette($this->image, false, $this->config->states());
20
21 3
        return imagepng($this->image, $destination);
22
    }
23
}
24