Completed
Branch develop (049341)
by Freddie
02:29
created

RepositoryMock::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace FlexPHP\Repositories\Tests\Mocks;
4
5
use FlexPHP\Repositories\Repository;
6
7
/**
8
 * Class RepositoryMock
9
 * @package FlexPHP\Repositories\Tests\Mocks
10
 * @method GatewayMock getGateway()
11
 */
12
class RepositoryMock extends Repository
13
{
14
    /**
15
     * @param array $item
16
     * @return int
17
     * @throws \FlexPHP\Repositories\Exception\UndefinedGatewayRepositoryException
18
     */
19
    public function push(array $item)
20
    {
21
        return $this->getGateway()->create($item);
22
    }
23
24
    /**
25
     * @param int $id
26
     * @return array|null
27
     * @throws \FlexPHP\Repositories\Exception\UndefinedGatewayRepositoryException
28
     */
29
    public function get(int $id)
30
    {
31
        return $this->getGateway()->read($id);
32
    }
33
34
    /**
35
     * @param int $id
36
     * @param array $item
37
     * @return bool
38
     * @throws \FlexPHP\Repositories\Exception\UndefinedGatewayRepositoryException
39
     */
40
    public function shift(int $id, array $item)
41
    {
42
        return $this->getGateway()->update($id, $item);
43
    }
44
45
    /**
46
     * @param int $id
47
     * @return bool
48
     * @throws \FlexPHP\Repositories\Exception\UndefinedGatewayRepositoryException
49
     */
50
    public function pop(int $id)
51
    {
52
        return $this->getGateway()->delete($id);
53
    }
54
}
55