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 ( c22d50...0bd9a0 )
by joseph
18s queued 11s
created

Logger::run()   B

Complexity

Conditions 9
Paths 11

Size

Total Lines 33
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 90

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 33
ccs 0
cts 26
cp 0
rs 8.0555
c 0
b 0
f 0
cc 9
nc 11
nop 1
crap 90
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Testing\Fixtures;
4
5
use Doctrine\DBAL\Connection;
6
use Doctrine\DBAL\Logging\SQLLogger;
7
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
8
9
class Logger implements SQLLogger
10
{
11
    private $queries = [];
12
13
    public function startQuery($sql, array $params = null, array $types = null)
14
    {
15
        $this->queries[$sql][] = [$params, $types];
16
    }
17
18
    public function stopQuery()
19
    {
20
        return;
21
    }
22
23
    public function run(Connection $connection): void
24
    {
25
        foreach ($this->queries as $query => $paramsArray) {
26
            if ('"START TRANSACTION"' === $query) {
27
                $connection->beginTransaction();
28
                continue;
29
            }
30
            if ('"COMMIT"' === $query) {
31
                $connection->commit();
32
                continue;
33
            }
34
            if ([[[], []]] === $paramsArray) {
35
                $connection->prepare($query)->execute();
36
                continue;
37
            }
38
            $stmt = $connection->prepare($query);
39
            foreach ($paramsArray as $paramsTypes) {
40
                try {
41
                    list($params, $types) = $paramsTypes;
42
                    $colNum = 1;
43
                    foreach ($params as $key => $value) {
44
                        $stmt->bindValue($colNum++, $value, $types[$key]);
45
                    }
46
                    $stmt->execute();
47
                } catch (\Exception $e) {
48
                    if ($connection->isTransactionActive()) {
49
                        $connection->rollBack();
50
                    }
51
                    throw new DoctrineStaticMetaException(
52
                        'Failed running logged query ' . $query . 'with params and types: '
53
                        . print_r($paramsTypes, true),
54
                        $e->getCode(),
55
                        $e
56
                    );
57
                }
58
            }
59
        }
60
    }
61
}
62