Completed
Push — develop ( ebc20b...a36a32 )
by Barry
01:39
created

Png::createFromState()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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