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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 47
ccs 12
cts 12
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReadPdo() 0 9 2
A getPdo() 0 9 2
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