Passed
Push — master ( 0a6ac4...650973 )
by Adrian
01:37
created
src/DB/DbService.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * @var array
48 48
 	 */
49
-	private $parameters = [];
49
+	private $parameters = [ ];
50 50
 
51 51
 	/**
52 52
 	 * @var string;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$column = null;
126 126
 
127 127
 		foreach ( $Columns as $cells ) {
128
-			$column[] = $cells[ 0 ];
128
+			$column[ ] = $cells[ 0 ];
129 129
 		}
130 130
 
131 131
 		return $column;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @param array $parameters
210 210
 	 * @throws DbException
211 211
 	 */
212
-	private function queryInit( $query, $parameters = [] )
212
+	private function queryInit( $query, $parameters = [ ] )
213 213
 	{
214 214
 		$this->lastStatement = self::getQueryStatement( $query );
215 215
 		$this->createPdoConnection();
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 				$this->bindMore( $parameters );
230 230
 			else
231 231
 				foreach ( $parameters as $key => $val )
232
-					$this->parameters[] = array( $key + 1, $val );
232
+					$this->parameters[ ] = array( $key + 1, $val );
233 233
 
234 234
 			if ( count( $this->parameters ) ) {
235 235
 				foreach ( $this->parameters as $param => $value ) {
Please login to merge, or discard this patch.
Braces   +25 added lines, -22 removed lines patch added patch discarded remove patch
@@ -117,8 +117,9 @@  discard block
 block discarded – undo
117 117
 	{
118 118
 		$this->queryInit( $query, $params );
119 119
 
120
-		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN )
121
-			return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
120
+		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) {
121
+					return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
122
+		}
122 123
 
123 124
 		$Columns = $this->sQuery->fetchAll( \PDO::FETCH_NUM );
124 125
 
@@ -141,8 +142,9 @@  discard block
 block discarded – undo
141 142
 	{
142 143
 		$this->queryInit( $query, $params );
143 144
 
144
-		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN )
145
-			return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
145
+		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) {
146
+					return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
147
+		}
146 148
 
147 149
 		$result = $this->sQuery->fetch( $fetchmode );
148 150
 		$this->sQuery->closeCursor(); // Frees up the connection to the server so that other SQL statements may be issued,
@@ -159,8 +161,9 @@  discard block
 block discarded – undo
159 161
 	{
160 162
 		$this->queryInit( $query, $params );
161 163
 
162
-		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN )
163
-			return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
164
+		if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) {
165
+					return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC );
166
+		}
164 167
 
165 168
 		$result = $this->sQuery->fetchColumn();
166 169
 		$this->sQuery->closeCursor(); // Frees up the connection to the server so that other SQL statements may be issued
@@ -225,24 +228,22 @@  discard block
 block discarded – undo
225 228
 			/**
226 229
 			 * Add parameters to the parameter array
227 230
 			 */
228
-			if ( self::isArrayAssoc( $parameters ) )
229
-				$this->bindMore( $parameters );
230
-			else
231
-				foreach ( $parameters as $key => $val )
231
+			if ( self::isArrayAssoc( $parameters ) ) {
232
+							$this->bindMore( $parameters );
233
+			} else {
234
+							foreach ( $parameters as $key => $val )
232 235
 					$this->parameters[] = array( $key + 1, $val );
236
+			}
233 237
 
234 238
 			if ( count( $this->parameters ) ) {
235 239
 				foreach ( $this->parameters as $param => $value ) {
236 240
 					if ( is_int( $value[ 1 ] ) ) {
237 241
 						$type = \PDO::PARAM_INT;
238
-					}
239
-					elseif ( is_bool( $value[ 1 ] ) ) {
242
+					} elseif ( is_bool( $value[ 1 ] ) ) {
240 243
 						$type = \PDO::PARAM_BOOL;
241
-					}
242
-					elseif ( is_null( $value[ 1 ] ) ) {
244
+					} elseif ( is_null( $value[ 1 ] ) ) {
243 245
 						$type = \PDO::PARAM_NULL;
244
-					}
245
-					else {
246
+					} else {
246 247
 						$type = \PDO::PARAM_STR;
247 248
 					}
248 249
 					$this->sQuery->bindValue( $value[ 0 ], $value[ 1 ], $type );
@@ -300,10 +301,11 @@  discard block
 block discarded – undo
300 301
 	{
301 302
 		$queryString = trim( $queryString );
302 303
 
303
-		if ( preg_match( '/^(select|insert|update|delete|replace|show|desc|explain)[\s]+/i', $queryString, $matches ) )
304
-			return strtoupper( $matches[ 1 ] );
305
-		else
306
-			return self::QUERY_TYPE_OTHER;
304
+		if ( preg_match( '/^(select|insert|update|delete|replace|show|desc|explain)[\s]+/i', $queryString, $matches ) ) {
305
+					return strtoupper( $matches[ 1 ] );
306
+		} else {
307
+					return self::QUERY_TYPE_OTHER;
308
+		}
307 309
 	}
308 310
 
309 311
 	/**
@@ -312,8 +314,9 @@  discard block
 block discarded – undo
312 314
 	 */
313 315
 	public static function isArrayAssoc( array $arr )
314 316
 	{
315
-		if ( array() === $arr )
316
-			return false;
317
+		if ( array() === $arr ) {
318
+					return false;
319
+		}
317 320
 
318 321
 		return array_keys( $arr ) !== range( 0, count( $arr ) - 1 );
319 322
 	}
Please login to merge, or discard this patch.