GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f20003...f7764e )
by Ross
17s queued 11s
created

DomainNameValidator::validate()   A

Complexity

Conditions 5
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5.7283

Importance

Changes 0
Metric Value
cc 5
eloc 9
nc 3
nop 2
dl 0
loc 13
ccs 9
cts 13
cp 0.6923
crap 5.7283
rs 9.6111
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\FieldConstraints;
4
5
use Symfony\Component\Validator\Constraint;
6
use Symfony\Component\Validator\ConstraintValidator;
7
8
class DomainNameValidator extends ConstraintValidator
9
{
10
11
    /**
12
     * Checks if the passed value is valid.
13
     *
14
     * @param string     $domainName
15
     * @param Constraint $constraint The constraint for the validation
16
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
17
     */
18 10
    public function validate($domainName, Constraint $constraint): void
19
    {
20 10
        if (null === $domainName) {
0 ignored issues
show
introduced by
The condition null === $domainName is always false.
Loading history...
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
        }
32 10
    }
33
}
34