Passed
Pull Request — master (#23)
by
unknown
13:36 queued 10:51
created

ImageProcessorName::isDot()   A

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Processors;
7
8
final class ImageProcessorName
9
{
10
    /** @var string[] */
11
    private const NAMES = ['neato', 'dot'];
12
13
    private readonly string $name;
14
15 13
    public function __construct(string $name)
16
    {
17 13
        if (! \in_array($name, self::NAMES, true)) {
18 1
            throw UnknownImageProcessor::named($name, self::NAMES);
19
        }
20 12
        $this->name = $name;
0 ignored issues
show
Bug introduced by
The property name is declared read-only in PhUml\Processors\ImageProcessorName.
Loading history...
21
    }
22
23 9
    public function command(): string
24
    {
25 9
        return $this->name;
26
    }
27
28 9
    public function value(): string
29
    {
30 9
        return ucfirst($this->name);
31
    }
32
33 7
    public function isDot(): bool
34
    {
35 7
        return $this->name === 'dot';
36
    }
37
}
38