Passed
Push — master ( 77290b...f3fb78 )
by Marcel
09:09
created

ServiceProviderRepository   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 25%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 30
ccs 3
cts 12
cp 0.25
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A remove() 0 3 1
A __construct() 0 2 1
A persist() 0 3 1
A findOneByEntityId() 0 3 1
A findAll() 0 3 1
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\SamlServiceProvider;
6
use App\Entity\ServiceProvider;
7
use Doctrine\ORM\EntityManagerInterface;
8
9
class ServiceProviderRepository implements ServiceProviderRepositoryInterface {
10
11
    public function __construct(private EntityManagerInterface $em)
12
    {
13 14
    }
14 14
15 14
    /**
16
     * @inheritDoc
17
     */
18
    public function findAll(): array {
19
        return $this->em->getRepository(ServiceProvider::class)
20
            ->findAll();
21
    }
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function findOneByEntityId(string $entityId): ?SamlServiceProvider {
27
        return $this->em->getRepository(SamlServiceProvider::class)
28
            ->findOneBy(['entityId' => $entityId]);
29
    }
30
31
    public function persist(ServiceProvider $provider): void {
32
        $this->em->persist($provider);
33
        $this->em->flush();
34
    }
35
36
    public function remove(ServiceProvider $provider): void {
37
        $this->em->remove($provider);
38
        $this->em->flush();
39
    }
40
}