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

Png   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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