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

includes/ezSQL/ez_sql_pdo_yourls.php (6 issues)

all properties have been explicitly declared.

Bug Major

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
class ezSQL_pdo_YOURLS extends ezSQL_pdo {
4
5
	/**
6
	* Constructor - Overwrite original to use MySQL and handle custom port
7
	* 
8
	* @since 1.7
9
	*/
10
	function __construct( $dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $encoding='' ) {
11
        $this->show_errors = defined( 'YOURLS_DEBUG' ) && YOURLS_DEBUG; // comply to YOURLS debug mode
12
		$this->dbuser = $dbuser;
0 ignored issues
show
The property dbuser 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...
13
		$this->dbpassword = $dbpassword;
14
		$this->dbname = $dbname;
0 ignored issues
show
The property dbname 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...
15
		// Get custom port if any
16
		if ( false !== strpos( $dbhost, ':' ) ) {
17
			list( $dbhost, $dbport ) = explode( ':', $dbhost );
18
			$dbhost = sprintf( '%1$s;port=%2$d', $dbhost, $dbport );
19
		}
20
		$this->dbhost = $dbhost;
0 ignored issues
show
The property dbhost 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...
21
		$this->encoding = $encoding;
0 ignored issues
show
The property encoding 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...
22
		$dsn = 'mysql:host=' . $dbhost . ';dbname=' . $dbname ;
23
		$this->dsn = $dsn;
24
		
25
		// Turn on track errors 
26
		ini_set('track_errors',1);
27
		
28
		$this->connect( $dsn, $dbuser, $dbpassword );
29
		
30
	}
31
32
	/**
33
	 * Return MySQL server version
34
	 *
35
	 * @since 1.7
36
	 */
37
	function mysql_version() {
38
		return ( $this->dbh->getAttribute(PDO::ATTR_SERVER_VERSION) );
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...
39
	}
40
	
41
	/**
42
	 * Perform mySQL query
43
	 *
44
	 * Added to the original function: logging of all queries
45
	 *
46
	 * @since 1.7
47
	 */
48
	function query( $query ) {
49
	
50
		// Keep history of all queries
51
		$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...
52
53
		// Original function
54
		return parent::query( $query );
55
	}
56
57
	/**
58
	* Disconnect
59
	* 
60
	* Actually not needed for PDO it seems, the function is there only for consistency with
61
	* other classes
62
	*
63
	* @since 1.7
64
	*/
65
	function disconnect() {
66
		// bleh
67
	}	
68
	
69
70
}
71
72