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
Pull Request — master (#109)
by joseph
33:02
created

Logger::stopQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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