Passed
Push — master ( c939c5...988421 )
by Adrian
02:18
created
src/DB/DbService.php 1 patch
Braces   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -66,14 +66,12 @@  discard block
 block discarded – undo
66 66
 			$statement === self::QUERY_TYPE_EXPLAIN
67 67
 		) {
68 68
 			return $this->sQuery->fetchAll( $fetchMode );
69
-		}
70
-		elseif ( $statement === self::QUERY_TYPE_INSERT ||
69
+		} elseif ( $statement === self::QUERY_TYPE_INSERT ||
71 70
 			$statement === self::QUERY_TYPE_UPDATE ||
72 71
 			$statement === self::QUERY_TYPE_DELETE
73 72
 		) {
74 73
 			return $this->sQuery->rowCount();
75
-		}
76
-		else {
74
+		} else {
77 75
 
78 76
 			return NULL;
79 77
 		}
@@ -91,8 +89,9 @@  discard block
 block discarded – undo
91 89
 		$query = trim( str_replace( "\r", " ", $query ) );
92 90
 		$statement = self::getQueryStatement( $query );
93 91
 
94
-		if ( $statement === self::QUERY_TYPE_EXPLAIN )
95
-			return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
92
+		if ( $statement === self::QUERY_TYPE_EXPLAIN ) {
93
+					return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
94
+		}
96 95
 
97 96
 		$Columns = $this->sQuery->fetchAll( \PDO::FETCH_NUM );
98 97
 
@@ -112,8 +111,9 @@  discard block
 block discarded – undo
112 111
 		$query = trim( str_replace( "\r", " ", $query ) );
113 112
 		$statement = self::getQueryStatement( $query );
114 113
 
115
-		if ( $statement === self::QUERY_TYPE_EXPLAIN )
116
-			return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
114
+		if ( $statement === self::QUERY_TYPE_EXPLAIN ) {
115
+					return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
116
+		}
117 117
 
118 118
 		$result = $this->sQuery->fetch( $fetchmode );
119 119
 		$this->sQuery->closeCursor(); // Frees up the connection to the server so that other SQL statements may be issued,
@@ -150,24 +150,22 @@  discard block
 block discarded – undo
150 150
 			/**
151 151
 			 * Add parameters to the parameter array
152 152
 			 */
153
-			if ( self::isArrayAssoc( $parameters ) )
154
-				$this->bindMore( $parameters );
155
-			else
156
-				foreach ( $parameters as $key => $val )
153
+			if ( self::isArrayAssoc( $parameters ) ) {
154
+							$this->bindMore( $parameters );
155
+			} else {
156
+							foreach ( $parameters as $key => $val )
157 157
 					$this->parameters[] = array( $key + 1, $val );
158
+			}
158 159
 
159 160
 			if ( count( $this->parameters ) ) {
160 161
 				foreach ( $this->parameters as $param => $value ) {
161 162
 					if ( is_int( $value[1] ) ) {
162 163
 						$type = \PDO::PARAM_INT;
163
-					}
164
-					elseif ( is_bool( $value[1] ) ) {
164
+					} elseif ( is_bool( $value[1] ) ) {
165 165
 						$type = \PDO::PARAM_BOOL;
166
-					}
167
-					elseif ( is_null( $value[1] ) ) {
166
+					} elseif ( is_null( $value[1] ) ) {
168 167
 						$type = \PDO::PARAM_NULL;
169
-					}
170
-					else {
168
+					} else {
171 169
 						$type = \PDO::PARAM_STR;
172 170
 					}
173 171
 					$this->sQuery->bindValue( $value[0], $value[1], $type );
@@ -246,8 +244,7 @@  discard block
 block discarded – undo
246 244
 				default:
247 245
 					return self::QUERY_TYPE_OTHER;
248 246
 			}
249
-		}
250
-		else {
247
+		} else {
251 248
 			return self::QUERY_TYPE_OTHER;
252 249
 		}
253 250
 	}
@@ -258,7 +255,9 @@  discard block
 block discarded – undo
258 255
 	 */
259 256
 	public static function isArrayAssoc( array $arr )
260 257
 	{
261
-		if ( array() === $arr ) return false;
258
+		if ( array() === $arr ) {
259
+			return false;
260
+		}
262 261
 
263 262
 		return array_keys( $arr ) !== range( 0, count( $arr ) - 1 );
264 263
 	}
Please login to merge, or discard this patch.