Completed
Push — master ( a1763f...fff075 )
by Štefan
03:03
created

LengthRangeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateLengthRange() 0 7 3
1
<?php
2
3
4
namespace Webcore\Validation\Rules;
5
6
7
use Webcore\Validation\AbstractRuleTrait;
8
9
trait LengthRangeTrait
10
{
11
    use AbstractRuleTrait;
12
13 13
    private function validateLengthRange($value, $start, $end)
14
    {
15 13
        $realLength = strlen($value);
16 13
        if ($realLength < $start || $realLength > $end) {
17 4
            $this->throwInvalidArgumentMustBe(" long in range between ".$start." and".$end);
18
        }
19 9
    }
20
}
21