Completed
Push — master ( a3cce1...d6fbcc )
by Marcel
09:39
created

ApplicationRepository::findAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App\Repository;
4
5
use App\Entity\Application;
6
use Doctrine\ORM\EntityManagerInterface;
7
8
class ApplicationRepository implements ApplicationRepositoryInterface {
9
10
    private $em;
11
12 12
    public function __construct(EntityManagerInterface $entityManager) {
13 12
        $this->em = $entityManager;
14 12
    }
15
16
    /**
17
     * @inheritDoc
18
     */
19
    public function findAll() {
20
        return $this->em
21
            ->getRepository(Application::class)
22
            ->findBy([], [
23
                'name' => 'asc'
24
            ]);
25
    }
26
27
    public function persist(Application $application) {
28
        $this->em->persist($application);
29
        $this->em->flush();
30
    }
31
32
    public function remove(Application $application) {
33
        $this->em->remove($application);
34
        $this->em->flush();
35
    }
36
37 2
    public function findOneByApiKey($key): ?Application {
38 2
        return $this->em
39 2
            ->getRepository(Application::class)
40 2
            ->findOneBy(['apiKey' => $key]);
41
    }
42
}