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