Completed
Pull Request — master (#4)
by Woody
02:33
created

Text   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A value() 0 4 1
1
<?php
2
3
namespace Equip\ValueObject;
4
5
use InvalidArgumentException;
6
7
use function Assert\that;
8
9
class Text
10
{
11
    /**
12
     * @var string|null
13
     */
14
    private $value;
15
16 12
    public function __construct($value, $regex = null)
17
    {
18 12
        $assert = that($value)->nullOr()->string();
19
20 7
        if ($regex) {
21 4
            $assert->regex($regex);
22 2
        }
23
24 5
        $this->value = $value;
25 5
    }
26
27 5
    public function value()
28
    {
29 5
        return $this->value;
30
    }
31
}
32