@@ -49,32 +49,32 @@ |
||
49 | 49 | /** |
50 | 50 | * Explain |
51 | 51 | */ |
52 | - $syntax[] = $this->getExplainSyntax(); |
|
52 | + $syntax[ ] = $this->getExplainSyntax(); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * UPDATE statement |
56 | 56 | */ |
57 | - $syntax[] = $this->statement; |
|
57 | + $syntax[ ] = $this->statement; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * PRIORITY |
61 | 61 | */ |
62 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
62 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * IGNORE clause |
66 | 66 | */ |
67 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
67 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * INTO table |
71 | 71 | */ |
72 | - $syntax[] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
72 | + $syntax[ ] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * FIELDS update |
76 | 76 | */ |
77 | - $syntax[] = $this->getInsertMultipleRowsSyntax(); |
|
77 | + $syntax[ ] = $this->getInsertMultipleRowsSyntax(); |
|
78 | 78 | |
79 | 79 | $syntax = implode( ' ', $syntax ); |
80 | 80 |
@@ -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 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | while ( in_array( $instance, self::$usedInstanceIds ) ) { |
133 | 133 | $instance = QueryHelper::random( 7 ); |
134 | 134 | } |
135 | - self::$usedInstanceIds[] = $instance; |
|
135 | + self::$usedInstanceIds[ ] = $instance; |
|
136 | 136 | |
137 | 137 | return $instance; |
138 | 138 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return true; |
180 | 180 | |
181 | 181 | if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) |
182 | - $this->syntaxEL[ $name ][] = $value; |
|
182 | + $this->syntaxEL[ $name ][ ] = $value; |
|
183 | 183 | else |
184 | 184 | $this->syntaxEL[ $name ] = $value; |
185 | 185 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param string $search |
242 | 242 | * @return string |
243 | 243 | */ |
244 | - public function bindParamsExpression( $expression, array $params = [], $search = '?' ) |
|
244 | + public function bindParamsExpression( $expression, array $params = [ ], $search = '?' ) |
|
245 | 245 | { |
246 | 246 | if ( !count( $params ) ) |
247 | 247 | return $expression; |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | $params = array_slice( $params, 0, substr_count( $expression, $search ) ); |
253 | 253 | |
254 | 254 | $i = 0; |
255 | - $arrayReturn = []; |
|
255 | + $arrayReturn = [ ]; |
|
256 | 256 | $expressionToArray = explode( $search, $expression ); |
257 | 257 | |
258 | 258 | foreach ( $expressionToArray as $sub ) { |
259 | - $arrayReturn[] = $sub; |
|
260 | - $arrayReturn[] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
259 | + $arrayReturn[ ] = $sub; |
|
260 | + $arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
261 | 261 | $i++; |
262 | 262 | } |
263 | 263 |
@@ -88,7 +88,7 @@ |
||
88 | 88 | foreach ( $brutArray as $value ) { |
89 | 89 | $value = trim( $value ); |
90 | 90 | if ( '' !== $value ) |
91 | - $newArray[] = $value; |
|
91 | + $newArray[ ] = $value; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $newArray; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param string $glue |
279 | 279 | * @return $this |
280 | 280 | */ |
281 | - public function whereExpression( $whereString, array $bindParams = [], $glue = 'AND' ) |
|
281 | + public function whereExpression( $whereString, array $bindParams = [ ], $glue = 'AND' ) |
|
282 | 282 | { |
283 | 283 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
284 | 284 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param array $bindParams |
291 | 291 | * @return $this |
292 | 292 | */ |
293 | - public function orWhereExpression( $whereString, array $bindParams = [] ) |
|
293 | + public function orWhereExpression( $whereString, array $bindParams = [ ] ) |
|
294 | 294 | { |
295 | 295 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
296 | 296 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return $this |
25 | 25 | * @throws QueryException |
26 | 26 | */ |
27 | - public function orderBy( $column, array $allowedColumns = [] ) |
|
27 | + public function orderBy( $column, array $allowedColumns = [ ] ) |
|
28 | 28 | { |
29 | 29 | $column = trim( $column ); |
30 | 30 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return $this |
44 | 44 | * @throws QueryException |
45 | 45 | */ |
46 | - public function orderByDesc( $column, array $allowedColumns = [] ) |
|
46 | + public function orderByDesc( $column, array $allowedColumns = [ ] ) |
|
47 | 47 | { |
48 | 48 | $column = trim( $column ); |
49 | 49 |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param string $glue |
279 | 279 | * @return $this |
280 | 280 | */ |
281 | - public function havingExpression( $whereString, array $bindParams = [], $glue = 'AND' ) |
|
281 | + public function havingExpression( $whereString, array $bindParams = [ ], $glue = 'AND' ) |
|
282 | 282 | { |
283 | 283 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
284 | 284 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param array $bindParams |
291 | 291 | * @return $this |
292 | 292 | */ |
293 | - public function orHavingExpression( $whereString, array $bindParams = [] ) |
|
293 | + public function orHavingExpression( $whereString, array $bindParams = [ ] ) |
|
294 | 294 | { |
295 | 295 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
296 | 296 |
@@ -46,7 +46,7 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * Prepare query |
221 | 221 | */ |
222 | 222 | $this->sQuery = $this->pdo->prepare( $query ); |
223 | - $this->prepareParams($parameters); |
|
223 | + $this->prepareParams( $parameters ); |
|
224 | 224 | $this->pdoBindValues(); |
225 | 225 | $this->sQuery->execute(); |
226 | 226 | if ( DbConfig::getInstance()->isEnableLogQueryDuration() ) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->bindMore( $parameters ); |
247 | 247 | else |
248 | 248 | foreach ( $parameters as $key => $val ) |
249 | - $this->parameters[] = array( $key + 1, $val ); |
|
249 | + $this->parameters[ ] = array( $key + 1, $val ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | private function pdoBindValues() |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function bind( $para, $value ) |
290 | 290 | { |
291 | - $this->parameters[] = [ ":" . $para, $value ]; |
|
291 | + $this->parameters[ ] = [ ":" . $para, $value ]; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | public function CloseConnection() |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | default: |
78 | 78 | $valuePdoString = $this->queryStructure->bindParam( $this->temporaryParam[ 0 ], $this->temporaryParam[ 1 ] ); |
79 | 79 | $body = $this->temporaryParam[ 0 ] . ' ' . $operator . ' ' . $valuePdoString; |
80 | - $this->registerCondition($body); |
|
80 | + $this->registerCondition( $body ); |
|
81 | 81 | break; |
82 | 82 | } |
83 | 83 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->queryStructure->bindParam( 'max', $max ) |
99 | 99 | ]; |
100 | 100 | $body = implode( ' ', $body ); |
101 | - $this->registerCondition($body); |
|
101 | + $this->registerCondition( $body ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | private function makeInCondition() |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | |
112 | 112 | private function inQuerySelect() |
113 | 113 | { |
114 | - $field = $this->temporaryParam[0]; |
|
114 | + $field = $this->temporaryParam[ 0 ]; |
|
115 | 115 | /** @var QuerySelect $subquerySelect */ |
116 | - $subquerySelect = $this->temporaryParam[1]; |
|
117 | - $operator = $this->temporaryParam[2]; |
|
116 | + $subquerySelect = $this->temporaryParam[ 1 ]; |
|
117 | + $operator = $this->temporaryParam[ 2 ]; |
|
118 | 118 | $subquerySelectParams = $subquerySelect->getBindParams(); |
119 | 119 | foreach ( $subquerySelectParams as $key => $value ) { |
120 | 120 | $this->queryStructure->setParams( $key, $value ); |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | ' )' |
128 | 128 | ]; |
129 | 129 | $body = implode( ' ', $body ); |
130 | - $this->registerCondition($body); |
|
130 | + $this->registerCondition( $body ); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | 134 | private function inArray() |
135 | 135 | { |
136 | - $field = $this->temporaryParam[0]; |
|
137 | - $value = $this->temporaryParam[1]; |
|
138 | - $operator = $this->temporaryParam[2]; |
|
136 | + $field = $this->temporaryParam[ 0 ]; |
|
137 | + $value = $this->temporaryParam[ 1 ]; |
|
138 | + $operator = $this->temporaryParam[ 2 ]; |
|
139 | 139 | |
140 | 140 | $pdoArray = array(); |
141 | 141 | foreach ( $value as $item ) { |
142 | - $pdoArray[] = $this->queryStructure->bindParam( 'a', $item ); |
|
142 | + $pdoArray[ ] = $this->queryStructure->bindParam( 'a', $item ); |
|
143 | 143 | } |
144 | 144 | $body = [ |
145 | 145 | $field, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ]; |
149 | 149 | $body = implode( ' ', $body ); |
150 | 150 | $body = QueryHelper::clearMultipleSpaces( $body ); |
151 | - $this->registerCondition($body); |
|
151 | + $this->registerCondition( $body ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | throw new QueryException( 'Invalid where array!', QueryException::QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY ); |
217 | 217 | |
218 | 218 | if ( count( $param ) == 2 ) |
219 | - $param[] = '='; |
|
219 | + $param[ ] = '='; |
|
220 | 220 | |
221 | 221 | $param[ 2 ] = trim( strtoupper( $param[ 2 ] ) ); |
222 | 222 | $param[ 2 ] = QueryHelper::clearMultipleSpaces( $param[ 2 ] ); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | use Qpdb\QueryBuilder\QueryBuild; |
10 | 10 | |
11 | -include_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'; |
|
11 | +include_once $_SERVER[ 'DOCUMENT_ROOT' ] . '/vendor/autoload.php'; |
|
12 | 12 | |
13 | 13 | |
14 | 14 | $query = QueryBuild::select( 'employees' ) |