Completed
Push — master ( 4aa817...260b19 )
by smiley
04:39
created
src/Drivers/SQLite/SQLite3Driver.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
 	 * @param string $sql    The SQL statement to prepare
169 169
 	 * @param array  $values a multidimensional array with the values, each row represents one line to insert.
170 170
 	 *
171
-	 * @return bool true query success, otherwise false
171
+	 * @return boolean|null true query success, otherwise false
172 172
 	 */
173 173
 	public function multi($sql, array $values){
174 174
 		// TODO: Implement multi() method.
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Class SQLite3Driver
4
- *
5
- * @filesource   SQLite3Driver.php
6
- * @created      21.02.2016
7
- * @package      chillerlan\Database\Drivers\SQLite
8
- * @author       Smiley <[email protected]>
9
- * @copyright    2016 Smiley
10
- * @license      MIT
11
- */
3
+	 * Class SQLite3Driver
4
+	 *
5
+	 * @filesource   SQLite3Driver.php
6
+	 * @created      21.02.2016
7
+	 * @package      chillerlan\Database\Drivers\SQLite
8
+	 * @author       Smiley <[email protected]>
9
+	 * @copyright    2016 Smiley
10
+	 * @license      MIT
11
+	 */
12 12
 
13 13
 namespace chillerlan\Database\Drivers\SQLite;
14 14
 
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\Database\Drivers\SQLite;
14 14
 
15
-use chillerlan\Database\DBException;
16
-use chillerlan\Database\Drivers\DBDriverAbstract;
17 15
 use Exception;
18 16
 use SQLite3;
17
+use chillerlan\Database\DBException;
18
+use chillerlan\Database\Drivers\DBDriverAbstract;
19 19
 
20 20
 /**
21 21
  *
Please login to merge, or discard this patch.
src/Drivers/DBDriverInterface.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -86,6 +86,7 @@
 block discarded – undo
86 86
 	 *
87 87
 	 * @param array $stats
88 88
 	 * @internal
89
+	 * @return void
89 90
 	 */
90 91
 	public function addStats(array $stats);
91 92
 
Please login to merge, or discard this patch.
src/Drivers/PostgreSQL/PostgreSQLDriver.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
 	 * @param string $sql    The SQL statement to prepare
169 169
 	 * @param array  $values a multidimensional array with the values, each row represents one line to insert.
170 170
 	 *
171
-	 * @return bool true query success, otherwise false
171
+	 * @return boolean|null true query success, otherwise false
172 172
 	 */
173 173
 	public function multi($sql, array $values){
174 174
 		// TODO: Implement multi() method.
Please login to merge, or discard this patch.
src/Traits/ClassLoaderTrait.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 * @param string $class     FQCN
27 27
 	 * @param string $interface FQCN
28 28
 	 *
29
-	 * @param mixed  $params    [optional] the following arguments are optional and will be passed to the class constructor if present.
29
+	 * @param \chillerlan\Database\DBOptions  $params    [optional] the following arguments are optional and will be passed to the class constructor if present.
30 30
 	 *
31 31
 	 * @return object of type $interface
32 32
 	 * @throws \chillerlan\Database\DBException
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\Database\Traits;
14 14
 
15
-use chillerlan\Database\DBException;
16 15
 use ReflectionClass;
16
+use chillerlan\Database\DBException;
17 17
 
18 18
 /**
19 19
  * A simple class loader
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 		if(class_exists($class)){
37 37
 			$reflectionClass = new ReflectionClass($class);
38 38
 
39
-			if(!$reflectionClass->implementsInterface($interface)) {
39
+			if(!$reflectionClass->implementsInterface($interface)){
40 40
 				throw new DBException($class.' does not implement '.$interface);
41 41
 			}
42 42
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,12 +31,13 @@
 block discarded – undo
31 31
 	 * @return object of type $interface
32 32
 	 * @throws \chillerlan\Database\DBException
33 33
 	 */
34
-	protected function __loadClass($class, $interface, ...$params){ // phpDocumentor stumbles across the ... syntax
34
+	protected function __loadClass($class, $interface, ...$params){
35
+// phpDocumentor stumbles across the ... syntax
35 36
 
36 37
 		if(class_exists($class)){
37 38
 			$reflectionClass = new ReflectionClass($class);
38 39
 
39
-			if(!$reflectionClass->implementsInterface($interface)) {
40
+			if(!$reflectionClass->implementsInterface($interface)){
40 41
 				throw new DBException($class.' does not implement '.$interface);
41 42
 			}
42 43
 
Please login to merge, or discard this patch.
tests/DBInstanceTest.php 2 patches
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,15 +9,14 @@
 block discarded – undo
9 9
 
10 10
 namespace chillerlan\DatabaseTest;
11 11
 
12
+use Dotenv\Dotenv;
12 13
 use chillerlan\Database\DBOptions;
13 14
 use chillerlan\Database\Drivers\MySQLi\MySQLiDriver;
14
-use chillerlan\Database\Drivers\PDO\PDOFirebirdDriver;
15 15
 use chillerlan\Database\Drivers\PDO\PDOMySQLDriver;
16 16
 use chillerlan\Database\Drivers\PDO\PDOPostgresDriver;
17 17
 use chillerlan\Database\Drivers\PDO\PDOSQLiteDriver;
18 18
 use chillerlan\Database\Drivers\PostgreSQL\PostgreSQLDriver;
19 19
 use chillerlan\Database\Drivers\SQLite\SQLite3Driver;
20
-use Dotenv\Dotenv;
21 20
 
22 21
 class DBInstanceTest extends \PHPUnit_Framework_TestCase{
23 22
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@
 block discarded – undo
39 39
 	public function driverDataProvider(){
40 40
 		return [
41 41
 			// native
42
-			['MYSQLI',       MySQLiDriver::class,       'mysqli'],
43
-			['POSTGRESQL',   PostgreSQLDriver::class, 'resource'],
44
-			['SQLITE3',      SQLite3Driver::class,     'SQLite3'],
42
+			['MYSQLI', MySQLiDriver::class, 'mysqli'],
43
+			['POSTGRESQL', PostgreSQLDriver::class, 'resource'],
44
+			['SQLITE3', SQLite3Driver::class, 'SQLite3'],
45 45
 
46 46
 			// PDO (obviously)
47
-			['PDO_MYSQL',    PDOMySQLDriver::class,    'PDO'],
47
+			['PDO_MYSQL', PDOMySQLDriver::class, 'PDO'],
48 48
 			['PDO_POSTGRES', PDOPostgresDriver::class, 'PDO'],
49 49
 #			['PDO_FIREBIRD', PDOFirebirdDriver::class, 'PDO'], // https://github.com/asfernandes/firebird/blob/master/.travis.yml
50
-			['PDO_SQLITE',   PDOSQLiteDriver::class,   'PDO'],
50
+			['PDO_SQLITE', PDOSQLiteDriver::class, 'PDO'],
51 51
 		];
52 52
 	}
53 53
 
Please login to merge, or discard this patch.
src/DBOptions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
 	 * 
130 130
 	 * @var int
131 131
 	 */
132
-	public $sqlite_flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE;
132
+	public $sqlite_flags = SQLITE3_OPEN_READWRITE|SQLITE3_OPEN_CREATE;
133 133
 	/**
134 134
 	 * An optional encryption key used when encrypting and decrypting an SQLite database.
135 135
 	 *
Please login to merge, or discard this patch.
src/Drivers/PDO/PDODriver.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 	 * @return array
193 193
 	 * @internal
194 194
 	 */
195
-	protected function getResult(PDOStatement &$stmt, $index, $assoc, $fetch_array){
195
+	protected function getResult(PDOStatement&$stmt, $index, $assoc, $fetch_array){
196 196
 		$out = [];
197 197
 		$method = $assoc ? ($fetch_array ? PDO::FETCH_ASSOC : PDO::FETCH_OBJ) : PDO::FETCH_NUM;
198
-		$i = 0 ;
198
+		$i = 0;
199 199
 
200 200
 		// ok, we have a result with one or more rows, loop out the rows and output as array
201 201
 		while($row = $stmt->fetch($method)){
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 	 * @param array         $values
226 226
 	 * @internal
227 227
 	 */
228
-	protected function bindParams(PDOStatement &$stmt, array $values){
228
+	protected function bindParams(PDOStatement&$stmt, array $values){
229 229
 		$param_no = 1;
230 230
 
231 231
 		foreach($values as $v){
232 232
 
233 233
 			switch(gettype($v)){
234 234
 				case 'boolean': $type = PDO::PARAM_BOOL; break;
235
-				case 'integer': $type = PDO::PARAM_INT;  break;
235
+				case 'integer': $type = PDO::PARAM_INT; break;
236 236
 				case 'NULL':    $type = PDO::PARAM_NULL; break;
237
-				default:        $type = PDO::PARAM_STR;  break;
237
+				default:        $type = PDO::PARAM_STR; break;
238 238
 			}
239 239
 
240 240
 			$stmt->bindValue($param_no, $v, $type);
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 
12 12
 namespace chillerlan\Database\Drivers\PDO;
13 13
 
14
-use chillerlan\Database\DBException;
15
-use chillerlan\Database\Drivers\DBDriverAbstract;
16 14
 use PDO;
17 15
 use PDOException;
18 16
 use PDOStatement;
17
+use chillerlan\Database\DBException;
18
+use chillerlan\Database\Drivers\DBDriverAbstract;
19 19
 
20 20
 /**
21 21
  * Class PDODriver
Please login to merge, or discard this patch.
tests/Traits/ClassLoaderTraitTest.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * @filesource   ClassLoaderTraitTest.php
5
- * @created      29.02.2016
6
- * @package      chillerlan\DatabaseTest\Traits
7
- * @author       Smiley <[email protected]>
8
- * @copyright    2015 Smiley
9
- * @license      MIT
10
- */
3
+	 *
4
+	 * @filesource   ClassLoaderTraitTest.php
5
+	 * @created      29.02.2016
6
+	 * @package      chillerlan\DatabaseTest\Traits
7
+	 * @author       Smiley <[email protected]>
8
+	 * @copyright    2015 Smiley
9
+	 * @license      MIT
10
+	 */
11 11
 
12 12
 namespace chillerlan\DatabaseTest\Traits;
13 13
 
Please login to merge, or discard this patch.
src/Drivers/MySQLi/MySQLiDriver.php 2 patches
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,6 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\Database\Drivers\MySQLi;
14 14
 
15
+use ReflectionMethod;
15 16
 use chillerlan\Database\DBException;
16 17
 use chillerlan\Database\Drivers\DBBaseDriver;
17 18
 use chillerlan\Database\Drivers\DBDriverInterface;
@@ -19,8 +20,6 @@  discard block
 block discarded – undo
19 20
 use mysqli_result;
20 21
 use mysqli_sql_exception;
21 22
 use mysqli_stmt;
22
-use ReflectionClass;
23
-use ReflectionMethod;
24 23
 use stdClass;
25 24
 
26 25
 /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
 			$out = [];
189 189
 			$method = 'fetch_'.($assoc ? ($fetch_array ? 'assoc' : 'object') : 'row');
190
-			$i = 0 ;
190
+			$i = 0;
191 191
 
192 192
 			// ok, we have a result with one or more rows, loop out the rows and output as array
193 193
 			while($row = $result->{$method}()){
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @param \ReflectionMethod $reflectionMethod
352 352
 	 * @param array             $row
353 353
 	 */
354
-	protected function insertPreparedRow(mysqli_stmt &$stmt, ReflectionMethod &$reflectionMethod, array &$row){
354
+	protected function insertPreparedRow(mysqli_stmt&$stmt, ReflectionMethod&$reflectionMethod, array &$row){
355 355
 		$references = $this->getReferences($row);
356 356
 		array_unshift($references, $this->getTypes($references));
357 357
 		$reflectionMethod->invokeArgs($stmt, $references);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @return array|bool
368 368
 	 */
369
-	protected function getResult(mysqli_stmt &$stmt, mysqli_result &$result, $assoc, $fetch_array){
369
+	protected function getResult(mysqli_stmt&$stmt, mysqli_result&$result, $assoc, $fetch_array){
370 370
 		// get the columns and their references
371 371
 		// http://php.net/manual/mysqli-stmt.bind-result.php
372 372
 		$cols = $refs = [];
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		foreach($values as &$v){
423 423
 			switch(gettype($v)){
424 424
 				case 'integer': $types[] = 'i'; break;
425
-				case 'double': $types[] ='d'; break;
425
+				case 'double': $types[] = 'd'; break;
426 426
 				default: $types[] = 's'; break;
427 427
 			}
428 428
 		}
Please login to merge, or discard this patch.