MixedConnection::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 2
rs 10
1
<?php
2
3
namespace App\Service;
4
5
use Illuminate\Support\Facades\DB;
6
use LaravelEnso\Multitenancy\Enums\Connections;
7
8
class MixedConnection
9
{
10
    public static function set($user, $tenant)
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

10
    public static function set(/** @scrutinizer ignore-unused */ $user, $tenant)

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...
Unused Code introduced by
The parameter $tenant 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

10
    public static function set($user, /** @scrutinizer ignore-unused */ $tenant)

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...
11
    {
12
        // if ($tenant) {
13
        //     self::connection(Connections::Tenant);
14
        // } else {
15
        //     self::connection('mysql');
16
        // }
17
        // // This is test for tenant db
18
        // // self::connection(Connections::Tenant);
19
20
        // // $key = 'database.default';
21
        // // $value = Connections::Mixed;
22
        // // config([$key => $value]);
23
24
        // DB::purge(Connections::Mixed);
25
26
        // DB::reconnect(Connections::Mixed);
27
    }
28
29
    private static function connection($connection)
0 ignored issues
show
Unused Code introduced by
The method connection() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
30
    {
31
        $key = 'database.connections.'.Connections::Mixed.'.database';
32
        $value = config("database.connections.{$connection}.database");
33
        error_log('+++++++++++++++++++++++++++++++++++'.$value);
34
        config([$key => $value]);
35
    }
36
}
37