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

UrlTrait::validateUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 6
cp 0.8333
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2.0185
1
<?php
2
3
4
namespace Webcore\Validation\Rules;
5
6
7
use Webcore\Validation\AbstractRuleTrait;
8
9
trait UrlTrait
10
{
11
    use AbstractRuleTrait;
12
13 23
    private function validateUrl($value)
14
    {
15 23
        $isValid = filter_var($value, FILTER_VALIDATE_URL);
16 23
        if ($isValid === false) {
17 20
            $this->throwInvalidArgumentMustBe("valid url");
18
        }
19 3
    }
20
}
21