Sender::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php declare(strict_types=1);
2
namespace Loevgaard\Linkmobility\ValueObject;
3
4
use Assert\Assert;
5
6
class Sender extends StringValueObject
7
{
8 6
    public function __construct(string $value)
9
    {
10
        // if the sender is alphanumeric, test the length
11 6
        if (!preg_match('/^\+[0-9]+$/i', $value)) {
12 5
            Assert::that($value)->maxLength(11);
13
        }
14
15 5
        parent::__construct($value);
16 5
    }
17
}
18