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.

TimezoneEnforcerTrait::getPdo()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ZsSarkany\LaravelDatabaseStickyTimezone\Connectors\Traits;
6
7
use ZsSarkany\LaravelDatabaseStickyTimezone\ChangeDetector;
8
9
trait TimezoneEnforcerTrait
10
{
11
    /**
12
     * Change detector for $pdo property
13
     *
14
     * @var ChangeDetector
15
     */
16
    protected $pdoChangeDetector;
17
18
    /**
19
     * Change detector for $readPdo property
20
     *
21
     * @var ChangeDetector
22
     */
23
    protected $readPdoChangeDetector;
24
25
    /**
26
     * Get the current PDO connection.
27
     *
28
     * @return \PDO|null
29
     */
30 2
    public function getPdo(): ?\PDO
31
    {
32 2
        if (!$this->pdoChangeDetector) {
33 2
            $this->pdoChangeDetector = new ChangeDetector;
34
        }
35
36 2
        return $this->enforcePdoTimezone(
0 ignored issues
show
Bug introduced by
It seems like enforcePdoTimezone() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

36
        return $this->/** @scrutinizer ignore-call */ enforcePdoTimezone(
Loading history...
37 2
            parent::getPdo(),
38 2
            $this->pdoChangeDetector
39
        );
40
    }
41
42
    /**
43
     * Get the current PDO connection used for reading.
44
     *
45
     * @return \PDO|null
46
     */
47 2
    public function getReadPdo(): ?\PDO
48
    {
49 2
        if (!$this->readPdoChangeDetector) {
50 2
            $this->readPdoChangeDetector = new ChangeDetector;
51
        }
52
53 2
        return $this->enforcePdoTimezone(
54 2
            parent::getReadPdo(),
55 2
            $this->readPdoChangeDetector
56
        );
57
    }
58
}
59