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.

MySqlConnection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A enforcePdoTimezone() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ZsSarkany\LaravelDatabaseStickyTimezone\Connectors;
6
7
use Illuminate\Database\MySqlConnection as BaseMySqlConnection;
8
use ZsSarkany\LaravelDatabaseStickyTimezone\ChangeDetector;
9
10
class MySqlConnection extends BaseMySqlConnection
11
{
12
    use Traits\TimezoneEnforcerTrait;
13
14
    /**
15
     * Enforcing timezone for PDO instance by execution of "SET timezone = xxxx"
16
     * if needed.
17
     *
18
     * @param \PDO|null      $pdo
19
     * @param ChangeDetector $changeDetector
20
     *
21
     * @return \PDO|null
22
     */
23 3
    protected function enforcePdoTimezone(
24
        ?\PDO $pdo,
25
        ChangeDetector $changeDetector
26
    ): ?\PDO {
27 3
        if (is_null($pdo) || $this->pretending()) {
28 1
            return $pdo;
29
        }
30
31
        $changeDetector->handle($pdo, function (string $offset) use ($pdo) {
32 2
            $pdo->exec('SET time_zone = "' . $offset . '"');
33 2
        });
34
35 2
        return $pdo;
36
    }
37
}
38