Completed
Pull Request — master (#2)
by Štefan
03:07
created

LengthRangeTrait::validateLengthRange()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
nc 2
cc 3
eloc 4
nop 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
    private function validateLengthRange($value, $start, $end)
14
    {
15
        $realLength = strlen($value);
16
        if ($realLength < $start || $realLength > $end) {
17
            $this->throwInvalidArgumentMustBe(" long in range between ".$start." and".$end);
18
        }
19
    }
20
}
21