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

UuidEntityService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 27
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findByUuid() 0 4 1
A fetchByUuid() 0 9 2
A getRepository() 0 4 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