Completed
Pull Request — master (#2282)
by ྅༻ Ǭɀħ
01:46
created

includes/ezSQL/ez_sql_mysqli_yourls.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3 View Code Duplication
class ezSQL_mysqli_YOURLS extends ezSQL_mysqli {
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4
5
	/**
6
	 * Return MySQL server version
7
	 *
8
	 * @since 1.7
9
	 */
10
	function mysql_version() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
		return  mysqli_get_server_info( $this->dbh ) ;
0 ignored issues
show
The property dbh does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12
	}
13
    
14
    /**
15
     * Comply to YOURLS debug mode
16
     *
17
     * @since 1.7.1
18
     */
19
    function __construct( $user, $pass, $name, $host ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
        $this->show_errors = defined( 'YOURLS_DEBUG' ) && YOURLS_DEBUG;
21
        parent::__construct( $user, $pass, $name, $host );
22
    }
23
	
24
	/**
25
	 * Perform mySQL query
26
	 *
27
	 * Added to the original function: logging of all queries
28
	 *
29
	 * @since 1.7
30
	 */
31
	function query( $query ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
32
	
33
		// Keep history of all queries
34
		$this->debug_log[] = $query;
0 ignored issues
show
The property debug_log does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
35
36
		// Original function
37
		return parent::query( $query );
38
	}
39
	
40
}
41
42