DB   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 8 2
1
<?php
2
/**
3
 * m'Manager | Invoices Management System
4
 * 
5
 * This content is released under the Proprietary License (Proprietary)
6
 *
7
 * Copyright (c) 2017, Eric Claver AKAFFOU - All Rights Reserved
8
 * Unauthorized copying of this file, via any medium is strictly prohibited
9
 * Proprietary and confidential
10
 * 
11
 * @package m'Manager
12
 * @author  Eric Claver AKAFFOU
13
 * @copyright   Copyright (c) 2017, on'Eric Computing, Inc. (https://www.onericcomputing.com/)
14
 * @license https://www.mmanager.fr  Proprietary License
15
 * @link    https://codecanyon.net/item/mmanager-invoices-management-system/19866435?s_rank=1
16
 * @since   Version 1.0.0
17
 * @filesource
18
 */
19
20
namespace Mmanager\Extensions\Database;
21
22
final class DB {
23
	public static function connect($host, $usr, $pw, $db) { 
24
		try {
25
			$mysqli = new \Mysqli($host, $usr, $pw, $db);
0 ignored issues
show
Unused Code introduced by
$mysqli is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
			return true;
27
		} catch (mysqli_sql_exception $e) {
0 ignored issues
show
Bug introduced by
The class Mmanager\Extensions\Database\mysqli_sql_exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
28
			throw $e;
29
		} 
30
	}
31
}
32
33