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

BlockService::fetchBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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