GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a6816c...6bbc5d )
by Carsten
07:55 queued 12s
created

PdoItemCodes   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 47
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 24 3
1
<?php
2
namespace Germania\Nav\ItemCodes;
3
4
use Psr\Log\LoggerInterface;
5
use Psr\Log\NullLogger;
6
7
class PdoItemCodes extends ItemCodes
8
{
9
10
    /**
11
     * @var string
12
     */
13
    public $table_name;
14
15
    /**
16
     * @var \PDO
17
     */
18
    public $pdo;
19
20
    /**
21
     * @var LoggerInterface
22
     */
23
    public $logger;
24
25
    /**
26
     * @param \PDO   $pdo        PDO instance
27
     * @param string $table_name The table to work on
28
     */
29 12
    public function __construct( \PDO $pdo, $table_name, ItemCodeInterface $itemcode = null, LoggerInterface $logger = null )
30
    {
31 12
        $this->table_name = $table_name;
32 12
        $this->pdo = $pdo;
33 12
        $this->logger = $logger ?: new NullLogger;
34
35
        $sql = "SELECT
36
        -- This is the unique key
37
        code,
38
        -- and here the instance data
39
        code,
40
        name,
41
        enabled,
42
        display
43 12
        FROM {$this->table_name}
44
        WHERE 1";
45
46 12
        $stmt = $pdo->prepare($sql);
47 12
        $stmt->setFetchMode( \PDO::FETCH_CLASS, $itemcode ? get_class($itemcode) : ItemCode::class );
48 12
        $stmt->execute();
49
50 12
        $this->item_codes = $stmt->fetchAll( \PDO::FETCH_UNIQUE );
51
52 12
    }
53
}
54