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.

DatabaseStickyTimezoneServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
ccs 7
cts 7
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ZsSarkany\LaravelDatabaseStickyTimezone;
6
7
use Illuminate\Database\Connection;
8
use Illuminate\Support\ServiceProvider;
9
10
class DatabaseStickyTimezoneServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Boot the service provider.
14
     *
15
     * @return void
16
     */
17 3
    public function boot(): void
18
    {
19 3
        Connection::resolverFor(
20 3
            'mysql',
21
            function ($connection, $database, $prefix, $config) {
22
                $connector = (
23 2
                    $config['sticky_timezone'] ?? false
24 1
                    ? Connectors\MySqlConnection::class
25 2
                    : \Illuminate\Database\MySqlConnection::class
26
                );
27
28 2
                return new $connector($connection, $database, $prefix, $config);
29 3
            }
30
        );
31 3
    }
32
}
33