Total Complexity | 7 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class Result implements ResultInterface |
||
14 | { |
||
15 | protected $data; |
||
16 | |||
17 | protected $type = \PDO::FETCH_ASSOC; |
||
18 | |||
19 | 24 | public function __construct($data) |
|
20 | { |
||
21 | 24 | $this->data = $data; |
|
22 | 24 | } |
|
23 | |||
24 | /** |
||
25 | * Returns a number of affected rows. |
||
26 | * |
||
27 | * @return integer |
||
28 | */ |
||
29 | 6 | public function affected() |
|
30 | { |
||
31 | 6 | return $this->data; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Sets the fetch type for PDO. |
||
36 | * |
||
37 | * @param integer $type |
||
38 | * @return self |
||
39 | */ |
||
40 | 3 | public function type($type) |
|
41 | { |
||
42 | 3 | $this->type = $type; |
|
43 | |||
44 | 3 | return $this; |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Returns the first row from result. |
||
49 | * |
||
50 | * @return mixed |
||
51 | */ |
||
52 | 9 | public function first() |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * Returns all items from the result. |
||
64 | * |
||
65 | * @return mixed |
||
66 | */ |
||
67 | 9 | public function items() |
|
75 | } |
||
76 | } |
||
77 |