Png   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 12
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromState() 0 3 1
A save() 0 5 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