LicenseParam::parse()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 10
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 2
crap 12
1
<?php declare(strict_types=1);
2
3
namespace Bigwhoop\Trumpet\Config\Params;
4
5
use Bigwhoop\Trumpet\Config\ConfigException;
6
use Bigwhoop\Trumpet\Config\Presentation;
7
8
final class LicenseParam implements Param
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function parse($value, Presentation $presentation)
14
    {
15
        if (!is_string($value)) {
16
            throw new ConfigException('License must be a string.');
17
        }
18
19
        if (empty($value)) {
20
            throw new ConfigException('License must not be empty.');
21
        }
22
23
        $presentation->license = $value;
24
    }
25
}
26