Completed
Push — master ( 9d1ab7...13f027 )
by Luis
04:13 queued 02:19
created

ClassDiagramConfiguration::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Configuration;
9
10
use RuntimeException;
11
12
class ClassDiagramConfiguration extends DigraphConfiguration
13
{
14
    /** @var string */
15
    private $imageProcessor;
16
17 18
    public function __construct(array $input)
18
    {
19 18
        parent::__construct($input);
20 18
        $this->setImageProcessor($input['processor']);
21 12
    }
22
23 9
    public function isDotProcessor(): bool
24
    {
25 9
        return $this->imageProcessor === 'dot';
26
    }
27
28 18
    private function setImageProcessor(?string $imageProcessor): void
29
    {
30 18
        if (!\in_array($imageProcessor, ['neato', 'dot'], true)) {
31 6
            throw new RuntimeException("Invalid processor '$imageProcessor' found, expected processors are neato and dot");
32
        }
33 12
        $this->imageProcessor = $imageProcessor;
34 12
    }
35
}
36