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

ServiceProviderRepository::findOneByToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
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
}