Conditions | 5 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5.7283 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
18 | 10 | public function validate($domainName, Constraint $constraint): void |
|
19 | { |
||
20 | 10 | if (null === $domainName) { |
|
|
|||
21 | return; |
||
22 | } |
||
23 | 10 | if (false === filter_var($domainName, FILTER_VALIDATE_DOMAIN) |
|
24 | 10 | || false === \ts\stringContains($domainName, '.') |
|
25 | 10 | || false !== \ts\stringContains($domainName, '//') |
|
26 | ) { |
||
27 | 6 | $this->context->buildViolation(sprintf(DomainName::MESSAGE, $this->formatValue($domainName))) |
|
28 | 6 | ->setParameter('{{ value }}', $this->formatValue($domainName)) |
|
29 | 6 | ->setCode(DomainName::INVALID_DOMAIN_ERROR) |
|
30 | 6 | ->addViolation(); |
|
31 | } |
||
34 |