Passed
Branch master (3a7502)
by Adrian
02:07
created
sample/select.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 //var_dump($_SERVER['DOCUMENT_ROOT']);
17 17
 
18 18
 
19
-$query = QueryBuild::select( 'employees' )
19
+$query = QueryBuild::select('employees')
20 20
 	->fields('lastName, jobTitle, officeCode')
21
-	->whereEqual( 'jobTitle', "Sales Rep" )
22
-	->whereIn( 'officeCode', [ 2, 3, 4 ] );
21
+	->whereEqual('jobTitle', "Sales Rep")
22
+	->whereIn('officeCode', [2, 3, 4]);
23 23
 
24 24
 
25
-echo "<pre>" . print_r( $query->getSyntax(), 1 ) . "</pre>";
26
-echo "<pre>" . print_r( $query->getBindParams(), 1 ) . "</pre>";
27
-echo "<pre>" . print_r( $query->getSyntax( 1 ), 1 ) . "</pre>";
28
-echo "<pre>" . print_r( $query->execute(), 1 ) . "</pre>";
25
+echo "<pre>" . print_r($query->getSyntax(), 1) . "</pre>";
26
+echo "<pre>" . print_r($query->getBindParams(), 1) . "</pre>";
27
+echo "<pre>" . print_r($query->getSyntax(1), 1) . "</pre>";
28
+echo "<pre>" . print_r($query->execute(), 1) . "</pre>";
29 29
 
30 30
 $a =
31 31
 	[
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 		],
77 77
 	];
78 78
 
79
-$tree = ( new Tree( $a ) )
80
-	->withIdName( 'id' )
81
-	->withParentIdName( 'parent' )
79
+$tree = (new Tree($a))
80
+	->withIdName('id')
81
+	->withParentIdName('parent')
82 82
 	->buildTree();
83 83
 
84 84
 
Please login to merge, or discard this patch.
sample/autoloader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 /**
11 11
  * @param $class
12 12
  */
13
-	function ( $class ) {
13
+	function($class) {
14 14
 
15
-		$nameSpace = str_replace( '\\', '/', trim( $class, '\\' ) ) . '.php';
16
-		$nameSpace = str_replace( 'Qpdb/QueryBuilder/', '', $nameSpace );
15
+		$nameSpace = str_replace('\\', '/', trim($class, '\\')) . '.php';
16
+		$nameSpace = str_replace('Qpdb/QueryBuilder/', '', $nameSpace);
17 17
 		$includeFile = __DIR__ . '/../src/' . $nameSpace;
18 18
 
19
-		require_once( $includeFile );
19
+		require_once($includeFile);
20 20
 
21 21
 	}
22 22
 
Please login to merge, or discard this patch.
src/Traits/DefaultPriority.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 */
23 23
 	public function defaultPriority()
24 24
 	{
25
-		$this->queryStructure->setElement( QueryStructure::PRIORITY, '' );
25
+		$this->queryStructure->setElement(QueryStructure::PRIORITY, '');
26 26
 
27 27
 		return $this;
28 28
 	}
Please login to merge, or discard this patch.
src/Traits/Join.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * @param null $onRight
24 24
 	 * @return $this
25 25
 	 */
26
-	public function innerJoin( $tableJoin, $onLeft, $onRight = null )
26
+	public function innerJoin($tableJoin, $onLeft, $onRight = null)
27 27
 	{
28
-		return $this->makeJoin( 'INNER JOIN', $tableJoin, $onLeft, $onRight );
28
+		return $this->makeJoin('INNER JOIN', $tableJoin, $onLeft, $onRight);
29 29
 	}
30 30
 
31 31
 	/**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 * @param null $onRight
35 35
 	 * @return $this
36 36
 	 */
37
-	public function leftJoin( $tableJoin, $onLeft, $onRight = null )
37
+	public function leftJoin($tableJoin, $onLeft, $onRight = null)
38 38
 	{
39
-		return $this->makeJoin( 'LEFT JOIN', $tableJoin, $onLeft, $onRight );
39
+		return $this->makeJoin('LEFT JOIN', $tableJoin, $onLeft, $onRight);
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 * @param null $onRight
46 46
 	 * @return $this
47 47
 	 */
48
-	public function leftOuterJoin( $tableJoin, $onLeft, $onRight = null )
48
+	public function leftOuterJoin($tableJoin, $onLeft, $onRight = null)
49 49
 	{
50
-		return $this->makeJoin( 'LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight );
50
+		return $this->makeJoin('LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight);
51 51
 	}
52 52
 
53 53
 	/**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 * @param null $onRight
57 57
 	 * @return $this
58 58
 	 */
59
-	public function rightJoin( $tableJoin, $onLeft, $onRight = null )
59
+	public function rightJoin($tableJoin, $onLeft, $onRight = null)
60 60
 	{
61
-		return $this->makeJoin( 'RIGHT JOIN', $tableJoin, $onLeft, $onRight );
61
+		return $this->makeJoin('RIGHT JOIN', $tableJoin, $onLeft, $onRight);
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @param null $onRight
68 68
 	 * @return $this
69 69
 	 */
70
-	public function rightOuterJoin( $tableJoin, $onLeft, $onRight = null )
70
+	public function rightOuterJoin($tableJoin, $onLeft, $onRight = null)
71 71
 	{
72
-		return $this->makeJoin( 'RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight );
72
+		return $this->makeJoin('RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @param null $onRight
79 79
 	 * @return $this
80 80
 	 */
81
-	public function fullJoin( $tableJoin, $onLeft, $onRight = null )
81
+	public function fullJoin($tableJoin, $onLeft, $onRight = null)
82 82
 	{
83
-		return $this->makeJoin( 'FULL JOIN', $tableJoin, $onLeft, $onRight );
83
+		return $this->makeJoin('FULL JOIN', $tableJoin, $onLeft, $onRight);
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
 	 * @param null $onRight
90 90
 	 * @return $this
91 91
 	 */
92
-	public function fullOuterJoin( $tableJoin, $onLeft, $onRight = null )
92
+	public function fullOuterJoin($tableJoin, $onLeft, $onRight = null)
93 93
 	{
94
-		return $this->makeJoin( 'FULL OUTER JOIN', $tableJoin, $onLeft, $onRight );
94
+		return $this->makeJoin('FULL OUTER JOIN', $tableJoin, $onLeft, $onRight);
95 95
 	}
96 96
 
97 97
 	/**
98 98
 	 * @param $stringJoin
99 99
 	 * @return $this
100 100
 	 */
101
-	public function join( $stringJoin )
101
+	public function join($stringJoin)
102 102
 	{
103
-		$this->queryStructure->setElement( QueryStructure::JOIN, $stringJoin );
103
+		$this->queryStructure->setElement(QueryStructure::JOIN, $stringJoin);
104 104
 
105 105
 		return $this;
106 106
 	}
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 	 * @param null $onRight
113 113
 	 * @return $this
114 114
 	 */
115
-	private function makeJoin( $typeJoin, $tableJoin, $onLeft, $onRight = null )
115
+	private function makeJoin($typeJoin, $tableJoin, $onLeft, $onRight = null)
116 116
 	{
117 117
 		$join = $typeJoin . ' ' . $tableJoin;
118 118
 
119
-		if ( is_null( $onRight ) )
119
+		if (is_null($onRight))
120 120
 			$join .= " USING ( $onLeft )";
121 121
 		else
122 122
 			$join .= " ON $onLeft = $onRight";
123 123
 
124
-		$this->queryStructure->setElement( QueryStructure::JOIN, $join );
124
+		$this->queryStructure->setElement(QueryStructure::JOIN, $join);
125 125
 
126 126
 		return $this;
127 127
 	}
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	private function getJoinSyntax()
133 133
 	{
134
-		$joinString = implode( ' ', $this->queryStructure->getElement( QueryStructure::JOIN ) );
134
+		$joinString = implode(' ', $this->queryStructure->getElement(QueryStructure::JOIN));
135 135
 
136
-		return QueryHelper::clearMultipleSpaces( $joinString );
136
+		return QueryHelper::clearMultipleSpaces($joinString);
137 137
 	}
138 138
 
139 139
 }
140 140
\ No newline at end of file
Please login to merge, or discard this patch.
src/Traits/Limit.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,38 +24,38 @@
 block discarded – undo
24 24
 	 * @return $this
25 25
 	 * @throws QueryException
26 26
 	 */
27
-	public function limit( $limit = 0, $offset = null )
27
+	public function limit($limit = 0, $offset = null)
28 28
 	{
29
-		$limit = trim( $limit );
29
+		$limit = trim($limit);
30 30
 
31
-		if ( !QueryHelper::isInteger( $limit ) )
32
-			throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT );
31
+		if (!QueryHelper::isInteger($limit))
32
+			throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT);
33 33
 
34
-		if ( $limit == 0 )
35
-			throw new QueryException( 'Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO );
34
+		if ($limit == 0)
35
+			throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO);
36 36
 
37
-		if ( is_null( $offset ) ) {
38
-			$this->queryStructure->setElement( QueryStructure::LIMIT, $limit );
37
+		if (is_null($offset)) {
38
+			$this->queryStructure->setElement(QueryStructure::LIMIT, $limit);
39 39
 
40 40
 			return $this;
41 41
 		}
42 42
 
43
-		$offset = trim( $offset );
43
+		$offset = trim($offset);
44 44
 
45
-		if ( !QueryHelper::isInteger( $offset ) )
46
-			throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET );
45
+		if (!QueryHelper::isInteger($offset))
46
+			throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET);
47 47
 
48
-		$this->queryStructure->setElement( QueryStructure::LIMIT, $offset . ',' . $limit );
48
+		$this->queryStructure->setElement(QueryStructure::LIMIT, $offset . ',' . $limit);
49 49
 
50 50
 		return $this;
51 51
 	}
52 52
 
53 53
 	private function getLimitSyntax()
54 54
 	{
55
-		if ( !$this->queryStructure->getElement( QueryStructure::LIMIT ) )
55
+		if (!$this->queryStructure->getElement(QueryStructure::LIMIT))
56 56
 			return '';
57 57
 
58
-		return 'LIMIT ' . $this->queryStructure->getElement( QueryStructure::LIMIT );
58
+		return 'LIMIT ' . $this->queryStructure->getElement(QueryStructure::LIMIT);
59 59
 	}
60 60
 
61 61
 }
Please login to merge, or discard this patch.
src/Traits/Utilities.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	protected function getExplainSyntax()
30 30
 	{
31
-		if($this->queryStructure->getElement(QueryStructure::EXPLAIN))
31
+		if ($this->queryStructure->getElement(QueryStructure::EXPLAIN))
32 32
 			return 'EXPLAIN';
33 33
 
34 34
 		return '';
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @param string $comment
40 40
 	 * @return $this
41 41
 	 */
42
-	public function withComment( $comment = '' )
42
+	public function withComment($comment = '')
43 43
 	{
44
-		$this->queryStructure->setElement( QueryStructure::QUERY_COMMENT, $comment );
44
+		$this->queryStructure->setElement(QueryStructure::QUERY_COMMENT, $comment);
45 45
 
46 46
 		return $this;
47 47
 	}
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 * @param string $identifier
51 51
 	 * @return $this
52 52
 	 */
53
-	public function withLogIdentifier( $identifier = null )
53
+	public function withLogIdentifier($identifier = null)
54 54
 	{
55
-		$this->queryStructure->setElement( QueryStructure::QUERY_IDENTIFIER, $identifier );
55
+		$this->queryStructure->setElement(QueryStructure::QUERY_IDENTIFIER, $identifier);
56 56
 
57 57
 		return $this;
58 58
 	}
Please login to merge, or discard this patch.
src/Traits/ColumnValidation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
 
15 15
 	use Objects;
16 16
 
17
-	protected function validateColumn( $columnName, array $allowed )
17
+	protected function validateColumn($columnName, array $allowed)
18 18
 	{
19
-		if ( is_integer( $columnName ) )
19
+		if (is_integer($columnName))
20 20
 			return true;
21 21
 
22
-		if ( !count( $allowed ) )
22
+		if (!count($allowed))
23 23
 			return true;
24 24
 
25 25
 		return false;
Please login to merge, or discard this patch.
src/Traits/HighPriority.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 */
22 22
 	public function highPriority()
23 23
 	{
24
-		$this->queryStructure->setElement( QueryStructure::PRIORITY, 'HIGH_PRIORITY' );
24
+		$this->queryStructure->setElement(QueryStructure::PRIORITY, 'HIGH_PRIORITY');
25 25
 
26 26
 		return $this;
27 27
 	}
Please login to merge, or discard this patch.
src/Traits/Replacement.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@
 block discarded – undo
23 23
 	 * @param int $withReplacement
24 24
 	 * @return mixed|string
25 25
 	 */
26
-	private function getSyntaxReplace( $syntax, $withReplacement = QueryStatementInterface::REPLACEMENT_NONE )
26
+	private function getSyntaxReplace($syntax, $withReplacement = QueryStatementInterface::REPLACEMENT_NONE)
27 27
 	{
28
-		$syntax = QueryHelper::clearMultipleSpaces( $syntax );
28
+		$syntax = QueryHelper::clearMultipleSpaces($syntax);
29 29
 
30
-		if ( !$withReplacement )
30
+		if (!$withReplacement)
31 31
 			return $syntax;
32 32
 
33
-		return $this->replaceValues( $syntax );
33
+		return $this->replaceValues($syntax);
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @param $syntax
38 38
 	 * @return string
39 39
 	 */
40
-	private function replaceValues( $syntax )
40
+	private function replaceValues($syntax)
41 41
 	{
42
-		$bindParams = $this->queryStructure->getElement( QueryStructure::BIND_PARAMS );
42
+		$bindParams = $this->queryStructure->getElement(QueryStructure::BIND_PARAMS);
43 43
 		$search = array();
44 44
 		$replace = array();
45
-		foreach ( $bindParams as $key => $value ) {
45
+		foreach ($bindParams as $key => $value) {
46 46
 			$search[] = ':' . $key;
47
-			$replace[] = DbConnect::getInstance()->quote( $value );
47
+			$replace[] = DbConnect::getInstance()->quote($value);
48 48
 		}
49
-		$syntax = str_ireplace( $search, $replace, $syntax );
49
+		$syntax = str_ireplace($search, $replace, $syntax);
50 50
 
51 51
 		return $syntax;
52 52
 
Please login to merge, or discard this patch.