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 ( 2a6b46...0d82f1 )
by joseph
20s queued 14s
created

DomainNameValidator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 64.29%

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 24
ccs 9
cts 14
cp 0.6429
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 14 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Validation\Constraints\FieldConstraints;
6
7
use Symfony\Component\Validator\Constraint;
8
use Symfony\Component\Validator\ConstraintValidator;
9
10
class DomainNameValidator extends ConstraintValidator
11
{
12
13
    /**
14
     * Checks if the passed value is valid.
15
     *
16
     * @param string     $domainName
17
     * @param Constraint $constraint The constraint for the validation
18
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
19
     */
20 10
    public function validate($domainName, Constraint $constraint): void
21
    {
22 10
        if (null === $domainName) {
0 ignored issues
show
introduced by
The condition null === $domainName is always false.
Loading history...
23
            return;
24
        }
25
        if (
26 10
            false === filter_var($domainName, FILTER_VALIDATE_DOMAIN)
27 10
            || false === \ts\stringContains($domainName, '.')
28 10
            || false !== \ts\stringContains($domainName, '//')
0 ignored issues
show
introduced by
The condition false !== stringContains($domainName, '//') is always true.
Loading history...
29
        ) {
30 6
            $this->context->buildViolation(sprintf(DomainName::MESSAGE, $this->formatValue($domainName)))
31 6
                          ->setParameter('{{ value }}', $this->formatValue($domainName))
32 6
                          ->setCode(DomainName::INVALID_DOMAIN_ERROR)
33 6
                          ->addViolation();
34
        }
35 10
    }
36
}
37