HandlerIdentifier::ensureNotEmpty()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mcustiel\OneHundredFour;
6
7
class HandlerIdentifier
8
{
9
    /**
10
     * @var string
11
     */
12
    private $identifier;
13
14 2
    public function __construct(string $identifier)
15
    {
16 2
        $this->ensureNotEmpty($identifier);
17 1
        $this->identifier = $identifier;
18 1
    }
19
20 1
    public function get(): string
21
    {
22 1
        return $this->identifier;
23
    }
24
25
    /** @throws \InvalidArgumentException */
26 2
    private function ensureNotEmpty(string $identifier): void
27
    {
28 2
        if (empty($identifier)) {
29 1
            throw new \InvalidArgumentException('Empty identifier name');
30
        }
31 1
    }
32
}
33