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 ( 50f2fa...d58e83 )
by Benjamin
04:39
created

Dbal::lastInsertId()   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
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lib\Db\Dbal;
4
5
class Dbal
6
{
7
    private $conn;
8
9
    public function __construct(?Connection $conn)
10
    {
11
        $this->conn = $conn ?? new Connection();
12
    }
13
14
    public function beginTransaction()
15
    {
16
        return $this->conn->beginTransaction();
17
    }
18
19
    public function commit()
20
    {
21
        return $this->conn->commit();
22
    }
23
24
    public function exec(string $statement)
25
    {
26
        return $this->conn->exec($statement);
27
    }
28
29
    public function lastInsertId(string $name = null)
30
    {
31
        return $this->conn->lastInsertId($name);
32
    }
33
34
    public function prepare(string $statement, array $driverOptions = [])
35
    {
36
        return $this->conn->prepare($statement, $driverOptions);
37
    }
38
39
    public function query(string $statement, int $fetch = null, $arg3 = null, $arg4 = null)
40
    {
41
        if ($fetch && $arg3 && $arg4) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $fetch of type null|integer is loosely compared to true; this is ambiguous if the integer can be 0. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
42
            return $this->conn->query($statement, $fetch, $arg3, $arg4);
43
        } elseif ($fetch && $arg3) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $fetch of type null|integer is loosely compared to true; this is ambiguous if the integer can be 0. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
44
            return $this->conn->query($statement, $fetch, $arg3);
45
        }
46
        return $this->conn->query($statement);
47
    }
48
49
    public function rollback($param)
0 ignored issues
show
Unused Code introduced by
The parameter $param is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

49
    public function rollback(/** @scrutinizer ignore-unused */ $param)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        return $this->conn->rollback();
52
    }
53
}
54