Completed
Push — develop ( 8109ce...b15e90 )
by Alejandro
17s queued 12s
created

DomainRepository::findDomainsWithout()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Core\Domain\Repository;
6
7
use Doctrine\ORM\EntityRepository;
8
use Shlinkio\Shlink\Core\Entity\Domain;
9
10
class DomainRepository extends EntityRepository implements DomainRepositoryInterface
11
{
12
    /**
13
     * @return Domain[]
14
     */
15 2
    public function findDomainsWithout(?string $excludedAuthority = null): array
16
    {
17 2
        $qb = $this->createQueryBuilder('d')->orderBy('d.authority', 'ASC');
18
19 2
        if ($excludedAuthority !== null) {
20 2
            $qb->where($qb->expr()->neq('d.authority', ':excludedAuthority'))
21 2
               ->setParameter('excludedAuthority', $excludedAuthority);
22
        }
23
24 2
        return $qb->getQuery()->getResult();
25
    }
26
}
27