@@ -52,7 +52,7 @@ |
||
52 | 52 | if ( DbConfig::getInstance()->useTablePrefix() ) |
53 | 53 | $table = str_ireplace( '::', DbConfig::getInstance()->getTablePrefix(), $table ); |
54 | 54 | |
55 | - return QueryHelper::addBacktick($table); |
|
55 | + return QueryHelper::addBacktick( $table ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | private function validateTableSubQuery( $table ) |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if ( !QueryHelper::isInteger( $limit ) ) |
32 | 32 | throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT ); |
33 | 33 | |
34 | - $limit = $this->queryStructure->bindParam('lim', (int)$limit); |
|
34 | + $limit = $this->queryStructure->bindParam( 'lim', ( int ) $limit ); |
|
35 | 35 | |
36 | 36 | if ( is_null( $offset ) ) { |
37 | 37 | $this->queryStructure->setElement( QueryStructure::LIMIT, $limit ); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if ( !QueryHelper::isInteger( $offset ) ) |
45 | 45 | throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET ); |
46 | 46 | |
47 | - $offset = $this->queryStructure->bindParam('ofs', (int)$offset); |
|
47 | + $offset = $this->queryStructure->bindParam( 'ofs', ( int ) $offset ); |
|
48 | 48 | |
49 | 49 | $this->queryStructure->setElement( QueryStructure::LIMIT, $offset . ', ' . $limit ); |
50 | 50 |
@@ -74,19 +74,19 @@ |
||
74 | 74 | */ |
75 | 75 | private function prepareArrayFields( $fieldsArray = array() ) |
76 | 76 | { |
77 | - $prepareArray = []; |
|
77 | + $prepareArray = [ ]; |
|
78 | 78 | |
79 | 79 | foreach ( $fieldsArray as $field ) { |
80 | 80 | |
81 | 81 | switch ( gettype( $field ) ) { |
82 | 82 | case QueryStructure::ELEMENT_TYPE_STRING: |
83 | - $prepareArray[] = $this->queryStructure->prepare( $field ); |
|
83 | + $prepareArray[ ] = $this->queryStructure->prepare( $field ); |
|
84 | 84 | break; |
85 | 85 | case QueryStructure::ELEMENT_TYPE_ARRAY: |
86 | - $prepareArray[] = $this->getFieldByArray( $field ); |
|
86 | + $prepareArray[ ] = $this->getFieldByArray( $field ); |
|
87 | 87 | break; |
88 | 88 | default: |
89 | - throw new QueryException('Invalid field description'); |
|
89 | + throw new QueryException( 'Invalid field description' ); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | foreach ( $brutArray as $value ) { |
59 | 59 | $value = trim( $value ); |
60 | 60 | if ( '' !== $value ) |
61 | - $newArray[] = $value; |
|
61 | + $newArray[ ] = $value; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $newArray; |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | public static function addBacktick( $string ) |
121 | 121 | { |
122 | 122 | $string = str_replace( '`', '', $string ); |
123 | - $stringArrayBacktick = []; |
|
123 | + $stringArrayBacktick = [ ]; |
|
124 | 124 | $string = self::clearMultipleSpaces( $string ); |
125 | 125 | $stringArray = explode( '.', $string ); |
126 | 126 | foreach ( $stringArray as $part ) { |
127 | 127 | $part = self::clearMultipleSpaces( $part ); |
128 | 128 | if ( empty( $part ) ) |
129 | 129 | continue; |
130 | - $stringArrayBacktick[] = '`' . $part . '`'; |
|
130 | + $stringArrayBacktick[ ] = '`' . $part . '`'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return implode( '.', $stringArrayBacktick ); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @var array |
62 | 62 | */ |
63 | - private static $usedInstanceIds = []; |
|
63 | + private static $usedInstanceIds = [ ]; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * @var array |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | while ( in_array( $instance, self::$usedInstanceIds ) ) { |
145 | 145 | $instance = QueryHelper::random( 5 ); |
146 | 146 | } |
147 | - self::$usedInstanceIds[] = $instance; |
|
147 | + self::$usedInstanceIds[ ] = $instance; |
|
148 | 148 | |
149 | 149 | return $instance; |
150 | 150 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return true; |
192 | 192 | |
193 | 193 | if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) |
194 | - $this->syntaxEL[ $name ][] = $value; |
|
194 | + $this->syntaxEL[ $name ][ ] = $value; |
|
195 | 195 | else |
196 | 196 | $this->syntaxEL[ $name ] = $value; |
197 | 197 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param string $search |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public function bindParamsExpression( $expression, array $params = [], $search = '?' ) |
|
241 | + public function bindParamsExpression( $expression, array $params = [ ], $search = '?' ) |
|
242 | 242 | { |
243 | 243 | if ( !count( $params ) ) |
244 | 244 | return $expression; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | $params = array_slice( $params, 0, substr_count( $expression, $search ) ); |
250 | 250 | |
251 | 251 | $i = 0; |
252 | - $arrayReturn = []; |
|
252 | + $arrayReturn = [ ]; |
|
253 | 253 | $expressionToArray = explode( $search, $expression ); |
254 | 254 | |
255 | 255 | foreach ( $expressionToArray as $sub ) { |
256 | - $arrayReturn[] = $sub; |
|
257 | - $arrayReturn[] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
256 | + $arrayReturn[ ] = $sub; |
|
257 | + $arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
258 | 258 | $i++; |
259 | 259 | } |
260 | 260 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return array|bool |
61 | 61 | * @throws QueryException |
62 | 62 | */ |
63 | - public function getRowById( $id, array $fields = [] ) |
|
63 | + public function getRowById( $id, array $fields = [ ] ) |
|
64 | 64 | { |
65 | 65 | $conditions = $this->getPrimaryKeyConditions( $id ); |
66 | 66 | $result = QueryBuild::select( $this->table )->fields( $fields ); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | throw new QueryException( 'Order field is not defined' ); |
138 | 138 | |
139 | 139 | $query = /** @lang text */ |
140 | - "UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[0]}` \r\n"; |
|
140 | + "UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[ 0 ]}` \r\n"; |
|
141 | 141 | foreach ( $updates_ord as $position => $id ) { |
142 | 142 | $pos = $position + 1; |
143 | 143 | $query .= " WHEN '$id' THEN '$pos' \r\n"; |
144 | 144 | } |
145 | 145 | $query .= "ELSE `{$this->orderField}` END"; |
146 | 146 | |
147 | - return DbService::getInstance()->query( $query, [] ); |
|
147 | + return DbService::getInstance()->query( $query, [ ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ( count( $this->primary ) !== count( $id ) ) |
162 | 162 | throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY ); |
163 | 163 | |
164 | - $conditions = []; |
|
164 | + $conditions = [ ]; |
|
165 | 165 | |
166 | 166 | foreach ( $this->primary as $index => $key ) |
167 | 167 | $conditions[ $key ] = $id[ $index ]; |