Completed
Pull Request — development (#546)
by Nick
07:54 queued 01:05
created

PageService   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 4 1
A update() 0 4 1
A remove() 0 4 1
A fetchOneBy() 0 4 1
1
<?php
2
3
namespace Oc\Page;
4
5
/**
6
 * Class PageService
7
 *
8
 * @package Oc\Page
9
 * @author Nick Lubisch <[email protected]>
10
 */
11
class PageService
12
{
13
    /**
14
     * @var PageRepository
15
     */
16
    private $pageRepository;
17
18
    /**
19
     * PageService constructor.
20
     *
21
     * @param PageRepository $pageRepository
22
     */
23
    public function __construct(PageRepository $pageRepository)
24
    {
25
        $this->pageRepository = $pageRepository;
26
    }
27
28
    /**
29
     * Fetches a page by slug.
30
     *
31
     * @param array $where
32
     *
33
     * @return null|PageEntity
34
     */
35
    public function fetchOneBy(array $where = [])
36
    {
37
        return $this->pageRepository->fetchOneBy($where);
38
    }
39
40
    /**
41
     * Creates a page in the database.
42
     *
43
     * @param PageEntity $entity
44
     *
45
     * @return PageEntity
46
     */
47
    public function create(PageEntity $entity)
48
    {
49
        return $this->pageRepository->create($entity);
50
    }
51
52
    /**
53
     * Update a page in the database.
54
     *
55
     * @param PageEntity $entity
56
     *
57
     * @return PageEntity
58
     */
59
    public function update(PageEntity $entity)
60
    {
61
        return $this->pageRepository->update($entity);
62
    }
63
64
    /**
65
     * Removes a page from the database.
66
     *
67
     * @param PageEntity $entity
68
     *
69
     * @return PageEntity
70
     */
71
    public function remove(PageEntity $entity)
72
    {
73
        return $this->pageRepository->remove($entity);
74
    }
75
}
76