Passed
Push — main ( e7c4ee...cf347e )
by Thierry
01:52
created

Statement   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchRow() 0 3 1
A fetchField() 0 6 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
     * @inheritDoc
20
     */
21
    public function fetchAssoc()
22
    {
23
        return $this->fetch(PDO::FETCH_ASSOC);
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29
    public function fetchRow()
30
    {
31
        return $this->fetch(PDO::FETCH_NUM);
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public function fetchField()
38
    {
39
        $row = $this->getColumnMeta($this->offset++);
40
        $flags = $row['flags'] ?? [];
41
        return new StatementFieldEntity($row['native_type'], in_array("blob", (array)$flags),
42
            $row['name'], $row['name'], $row['table'], $row['table']);
43
    }
44
}
45