Completed
Pull Request — development (#546)
by Nick
06:25
created

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