Passed
Push — main ( 9d67f9...af7fe2 )
by Thierry
02:49
created

Statement   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 44
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchRow() 0 3 1
A rowCount() 0 3 1
A fetchField() 0 5 1
A fetchAssoc() 0 3 1
1
<?php
2
3
namespace Lagdo\DbAdmin\Driver\Db\Pdo;
4
5
use Lagdo\DbAdmin\Driver\Db\StatementInterface;
6
use Lagdo\DbAdmin\Driver\Entity\StatementFieldEntity;
7
8
use PDOStatement;
9
use PDO;
10
11
class Statement extends PDOStatement implements StatementInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    public $offset = 0;
17
18
    /**
19
     * @var int
20
     */
21
    public $numRows = 0;
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function rowCount()
27
    {
28
        return $this->numRows;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function fetchAssoc()
35
    {
36
        return $this->fetch(PDO::FETCH_ASSOC);
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function fetchRow()
43
    {
44
        return $this->fetch(PDO::FETCH_NUM);
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function fetchField()
51
    {
52
        $row = $this->getColumnMeta($this->offset++);
53
        return new StatementFieldEntity($row['native_type'], in_array("blob", (array)$row['flags']),
54
            $row['name'], $row['name'], $row['table'], $row['table']);
55
    }
56
}
57