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

DomainService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Core\Domain;
6
7
use Doctrine\ORM\EntityManagerInterface;
8
use Shlinkio\Shlink\Core\Domain\Repository\DomainRepositoryInterface;
9
use Shlinkio\Shlink\Core\Entity\Domain;
10
11
class DomainService implements DomainServiceInterface
12
{
13
    private EntityManagerInterface $em;
14
15 5
    public function __construct(EntityManagerInterface $em)
16
    {
17 5
        $this->em = $em;
18 5
    }
19
20
    /**
21
     * @return Domain[]
22
     */
23 5
    public function listDomainsWithout(?string $excludeDomain = null): array
24
    {
25
        /** @var DomainRepositoryInterface $repo */
26 5
        $repo = $this->em->getRepository(Domain::class);
27 5
        return $repo->findDomainsWithout($excludeDomain);
28
    }
29
}
30