Completed
Push — master ( 7ed002...38409f )
by Philip
03:12
created

DelegatedCrudService::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Dontdrinkandroot\Service;
4
5
use Doctrine\ORM\Tools\Pagination\Paginator;
6
7
class DelegatedCrudService implements CrudServiceInterface
8
{
9
    /**
10
     * @var CrudServiceInterface
11
     */
12
    private $delegate;
13
14
    public function __construct(CrudServiceInterface $delegate)
15
    {
16
        $this->delegate = $delegate;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function find($id): ?object
23
    {
24
        return $this->delegate->find($id);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function findAll(): array
31
    {
32
        return $this->delegate->findAll();
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function findAllPaginated(int $page = 1, int $perPage = 50): Paginator
39
    {
40
        return $this->delegate->findAllPaginated($page, $perPage);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function create(object $entity): object
47
    {
48
        return $this->delegate->create($entity);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function update(object $entity): object
55
    {
56
        return $this->delegate->update($entity);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function remove(object $entity): void
63
    {
64
        $this->delegate->remove($entity);
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function save(object $entity): object
71
    {
72
        return $this->delegate->save($entity);
73
    }
74
75
    protected function getDelegate(): CrudServiceInterface
76
    {
77
        return $this->delegate;
78
    }
79
}
80