for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Service;
use Illuminate\Support\Facades\DB;
use LaravelEnso\Multitenancy\Enums\Connections;
class MixedConnection
{
public static function set($user, $tenant)
$user
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
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.
$tenant
public static function set($user, /** @scrutinizer ignore-unused */ $tenant)
// if ($tenant) {
// self::connection(Connections::Tenant);
// } else {
// self::connection('mysql');
// }
// // This is test for tenant db
// // self::connection(Connections::Tenant);
// // $key = 'database.default';
// // $value = Connections::Mixed;
// // config([$key => $value]);
// DB::purge(Connections::Mixed);
// DB::reconnect(Connections::Mixed);
}
private static function connection($connection)
connection()
This check looks for private methods that have been defined, but are not used inside the class.
$key = 'database.connections.'.Connections::Mixed.'.database';
$value = config("database.connections.{$connection}.database");
error_log('+++++++++++++++++++++++++++++++++++'.$value);
config([$key => $value]);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.