@@ -97,8 +97,9 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $this->syntaxEL = $this->init(); |
| 99 | 99 | |
| 100 | - foreach ( $this->syntaxEL as $name => $value ) |
|
| 101 | - $this->typeEL[ $name ] = gettype( $value ); |
|
| 100 | + foreach ( $this->syntaxEL as $name => $value ) { |
|
| 101 | + $this->typeEL[ $name ] = gettype( $value ); |
|
| 102 | + } |
|
| 102 | 103 | |
| 103 | 104 | } |
| 104 | 105 | |
@@ -184,16 +185,19 @@ discard block |
||
| 184 | 185 | */ |
| 185 | 186 | public function setElement( $name, $value ) |
| 186 | 187 | { |
| 187 | - if ( !array_key_exists( $name, $this->syntaxEL ) ) |
|
| 188 | - throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND ); |
|
| 188 | + if ( !array_key_exists( $name, $this->syntaxEL ) ) { |
|
| 189 | + throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND ); |
|
| 190 | + } |
|
| 189 | 191 | |
| 190 | - if ( $name == self::TABLE && is_a( $value, QueryStatement::class ) ) |
|
| 191 | - return true; |
|
| 192 | + if ( $name == self::TABLE && is_a( $value, QueryStatement::class ) ) { |
|
| 193 | + return true; |
|
| 194 | + } |
|
| 192 | 195 | |
| 193 | - if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) |
|
| 194 | - $this->syntaxEL[ $name ][] = $value; |
|
| 195 | - else |
|
| 196 | - $this->syntaxEL[ $name ] = $value; |
|
| 196 | + if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) { |
|
| 197 | + $this->syntaxEL[ $name ][] = $value; |
|
| 198 | + } else { |
|
| 199 | + $this->syntaxEL[ $name ] = $value; |
|
| 200 | + } |
|
| 197 | 201 | |
| 198 | 202 | return true; |
| 199 | 203 | } |
@@ -206,8 +210,9 @@ discard block |
||
| 206 | 210 | */ |
| 207 | 211 | public function replaceElement( $elementName, $elementValue ) |
| 208 | 212 | { |
| 209 | - if ( !array_key_exists( $elementName, $this->syntaxEL ) ) |
|
| 210 | - throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND ); |
|
| 213 | + if ( !array_key_exists( $elementName, $this->syntaxEL ) ) { |
|
| 214 | + throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND ); |
|
| 215 | + } |
|
| 211 | 216 | |
| 212 | 217 | $this->syntaxEL[ $elementName ] = $elementValue; |
| 213 | 218 | } |
@@ -240,11 +245,13 @@ discard block |
||
| 240 | 245 | */ |
| 241 | 246 | public function bindParamsExpression( $expression, array $params = [], $search = '?' ) |
| 242 | 247 | { |
| 243 | - if ( !count( $params ) ) |
|
| 244 | - return $expression; |
|
| 248 | + if ( !count( $params ) ) { |
|
| 249 | + return $expression; |
|
| 250 | + } |
|
| 245 | 251 | |
| 246 | - if ( strpos( $expression, $search ) === false ) |
|
| 247 | - return $expression; |
|
| 252 | + if ( strpos( $expression, $search ) === false ) { |
|
| 253 | + return $expression; |
|
| 254 | + } |
|
| 248 | 255 | |
| 249 | 256 | $params = array_slice( $params, 0, substr_count( $expression, $search ) ); |
| 250 | 257 | |
@@ -277,8 +284,9 @@ discard block |
||
| 277 | 284 | public function prepare( $fieldName = '' ) |
| 278 | 285 | { |
| 279 | 286 | $fieldName = trim( $fieldName ); |
| 280 | - if ( in_array( $fieldName, $this->reserved ) ) |
|
| 281 | - $fieldName = '`' . $fieldName . '`'; |
|
| 287 | + if ( in_array( $fieldName, $this->reserved ) ) { |
|
| 288 | + $fieldName = '`' . $fieldName . '`'; |
|
| 289 | + } |
|
| 282 | 290 | |
| 283 | 291 | return $fieldName; |
| 284 | 292 | } |