Browse Source

Remove some old code coupling and boilerplate

Timothy J. Warren 10 months ago
parent
commit
73e4c35163
2 changed files with 8 additions and 28 deletions
  1. 1
    1
      phpdox.xml
  2. 7
    27
      src/QueryBuilder.php

+ 1
- 1
phpdox.xml View File

@@ -35,7 +35,7 @@
35 35
          -->
36 36
 
37 37
         <!--  Additional configuration for the collecting process (parsing of php code, generation of xml data) -->
38
-        <collector publiconly="false" backend="parser" encoding="auto">
38
+        <collector publiconly="true" backend="parser" encoding="auto">
39 39
             <!--  @publiconly - Flag to disable/enable processing of non public methods and members -->
40 40
             <!--  @backend    - The collector backend to use, currently only shipping with 'parser' -->
41 41
             <!--  @encoding   - Charset encoding of source files (overwrite default 'auto' if detection fails) -->

+ 7
- 27
src/QueryBuilder.php View File

@@ -16,11 +16,7 @@ namespace Query;
16 16
 
17 17
 use BadMethodCallException;
18 18
 use PDOStatement;
19
-use Query\Drivers\{
20
-	AbstractUtil,
21
-	DriverInterface,
22
-	SQLInterface
23
-};
19
+use Query\Drivers\DriverInterface;
24 20
 
25 21
 /**
26 22
  * Convenience class for creating sql queries
@@ -37,7 +33,9 @@ class QueryBuilder implements QueryBuilderInterface {
37 33
 	 * List of queries executed
38 34
 	 * @var array
39 35
 	 */
40
-	public $queries;
36
+	public $queries = [
37
+		'total_time' => 0
38
+	];
41 39
 
42 40
 	/**
43 41
 	 * Whether to do only an explain on the query
@@ -57,18 +55,6 @@ class QueryBuilder implements QueryBuilderInterface {
57 55
 	 */
58 56
 	protected $parser;
59 57
 
60
-	/**
61
-	 * Alias to driver util class
62
-	 * @var AbstractUtil
63
-	 */
64
-	protected $util;
65
-
66
-	/**
67
-	 * Alias to driver sql class
68
-	 * @var SQLInterface
69
-	 */
70
-	protected $sql;
71
-
72 58
 	/**
73 59
 	 * Query Builder state
74 60
 	 * @var State
@@ -93,12 +79,6 @@ class QueryBuilder implements QueryBuilderInterface {
93 79
 
94 80
 		// Create new State object
95 81
 		$this->state = new State();
96
-
97
-		$this->queries['total_time'] = 0;
98
-
99
-		// Alias driver sql and util classes
100
-		$this->sql = $this->driver->getSql();
101
-		$this->util = $this->driver->getUtil();
102 82
 	}
103 83
 
104 84
 	/**
@@ -543,7 +523,7 @@ class QueryBuilder implements QueryBuilderInterface {
543 523
 		// doesn't support random ordering
544 524
 		if (stripos($type, 'rand') !== FALSE)
545 525
 		{
546
-			$rand = $this->sql->random();
526
+			$rand = $this->driver->getSql()->random();
547 527
 			$type = $rand ?? 'ASC';
548 528
 		}
549 529
 
@@ -1306,14 +1286,14 @@ class QueryBuilder implements QueryBuilderInterface {
1306 1286
 		$limit = $this->state->getLimit();
1307 1287
 		if (is_numeric($limit))
1308 1288
 		{
1309
-			$sql = $this->sql->limit($sql, $limit, $this->state->getOffset());
1289
+			$sql = $this->driver->getSql()->limit($sql, $limit, $this->state->getOffset());
1310 1290
 		}
1311 1291
 
1312 1292
 		// See if the query plan, rather than the
1313 1293
 		// query data should be returned
1314 1294
 		if ($this->explain === TRUE)
1315 1295
 		{
1316
-			$sql = $this->sql->explain($sql);
1296
+			$sql = $this->driver->getSql()->explain($sql);
1317 1297
 		}
1318 1298
 
1319 1299
 		return $sql;