Statement   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 37
rs 10
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
use PDOStatement;
8
use PDO;
9
10
class Statement extends PDOStatement implements StatementInterface
11
{
12
    /**
13
     * @var int
14
     */
15
    public $offset = 0;
16
17
    /**
18
     * @var int
19
     */
20
    public $numRows = 0;
21
22
    /**
23
     * @inheritDoc
24
     */
25
    public function fetchAssoc()
26
    {
27
        return $this->fetch(PDO::FETCH_ASSOC);
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function fetchRow()
34
    {
35
        return $this->fetch(PDO::FETCH_NUM);
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function fetchField()
42
    {
43
        $row = $this->getColumnMeta($this->offset++);
44
        $flags = $row['flags'] ?? [];
45
        return new StatementFieldEntity($row['native_type'], in_array("blob", (array)$flags),
46
            $row['name'], $row['name'], $row['table'], $row['table']);
47
    }
48
}
49