Completed
Push — master ( 093324...8fee6e )
by Philip
24:18
created

UuidEntityService::findByUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Dontdrinkandroot\Service;
4
5
use Dontdrinkandroot\Exception\NoResultFoundException;
6
use Dontdrinkandroot\Repository\UuidEntityRepositoryInterface;
7
8
class UuidEntityService extends EntityService
9
{
10
11
    public function findByUuid($uuid)
12
    {
13
        return $this->getRepository()->findByUuid($uuid);
14
    }
15
16
    public function fetchByUuid($uuid)
17
    {
18
        $entity = $this->findByUuid($uuid);
19
        if (null === $entity) {
20
            throw new NoResultFoundException('No entity with uuiid: ' . $uuid);
21
        }
22
23
        return $entity;
24
    }
25
26
    /**
27
     * @return UuidEntityRepositoryInterface
28
     */
29
    protected function getRepository()
30
    {
31
        return $this->repository;
32
    }
33
34
}
35