@@ -53,37 +53,37 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Explain |
| 55 | 55 | */ |
| 56 | - $syntax[] = $this->getExplainSyntax(); |
|
| 56 | + $syntax[ ] = $this->getExplainSyntax(); |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * UPDATE statement |
| 60 | 60 | */ |
| 61 | - $syntax[] = $this->statement; |
|
| 61 | + $syntax[ ] = $this->statement; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * PRIORITY |
| 65 | 65 | */ |
| 66 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 66 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * TABLE update |
| 70 | 70 | */ |
| 71 | - $syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 71 | + $syntax[ ] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * WHERE clause |
| 75 | 75 | */ |
| 76 | - $syntax[] = $this->getWhereSyntax(); |
|
| 76 | + $syntax[ ] = $this->getWhereSyntax(); |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * ORDER BY clause |
| 80 | 80 | */ |
| 81 | - $syntax[] = $this->getOrderBySyntax(); |
|
| 81 | + $syntax[ ] = $this->getOrderBySyntax(); |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * LIMIT clause |
| 85 | 85 | */ |
| 86 | - $syntax[] = $this->getLimitSyntax(); |
|
| 86 | + $syntax[ ] = $this->getLimitSyntax(); |
|
| 87 | 87 | |
| 88 | 88 | $syntax = implode( ' ', $syntax ); |
| 89 | 89 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) |
| 100 | 100 | throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
| 101 | 101 | |
| 102 | - return PdoWrapperService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS))->rowCount(); |
|
| 102 | + return PdoWrapperService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) )->rowCount(); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -62,32 +62,32 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * Explain |
| 64 | 64 | */ |
| 65 | - $syntax[] = $this->getExplainSyntax(); |
|
| 65 | + $syntax[ ] = $this->getExplainSyntax(); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * UPDATE statement |
| 69 | 69 | */ |
| 70 | - $syntax[] = $this->statement; |
|
| 70 | + $syntax[ ] = $this->statement; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * PRIORITY |
| 74 | 74 | */ |
| 75 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 75 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * IGNORE clause |
| 79 | 79 | */ |
| 80 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
| 80 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * INTO table |
| 84 | 84 | */ |
| 85 | - $syntax[] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 85 | + $syntax[ ] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * FIELDS update |
| 89 | 89 | */ |
| 90 | - $syntax[] = $this->getSettingFieldsSyntax(); |
|
| 90 | + $syntax[ ] = $this->getSettingFieldsSyntax(); |
|
| 91 | 91 | |
| 92 | 92 | $syntax = implode( ' ', $syntax ); |
| 93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return bool|mixed|\PDOStatement |
| 100 | 100 | */ |
| 101 | 101 | public function execute() { |
| 102 | - return PdoWrapperService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS))->rowCount(); |
|
| 102 | + return PdoWrapperService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) )->rowCount(); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -53,47 +53,47 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Explain |
| 55 | 55 | */ |
| 56 | - $syntax[] = $this->getExplainSyntax(); |
|
| 56 | + $syntax[ ] = $this->getExplainSyntax(); |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * UPDATE statement |
| 60 | 60 | */ |
| 61 | - $syntax[] = $this->statement; |
|
| 61 | + $syntax[ ] = $this->statement; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * PRIORITY |
| 65 | 65 | */ |
| 66 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 66 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * IGNORE clause |
| 70 | 70 | */ |
| 71 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
| 71 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * TABLE update |
| 75 | 75 | */ |
| 76 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 76 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * FIELDS update |
| 80 | 80 | */ |
| 81 | - $syntax[] = $this->getSettingFieldsSyntax(); |
|
| 81 | + $syntax[ ] = $this->getSettingFieldsSyntax(); |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * WHERE clause |
| 85 | 85 | */ |
| 86 | - $syntax[] = $this->getWhereSyntax(); |
|
| 86 | + $syntax[ ] = $this->getWhereSyntax(); |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * ORDER BY clause |
| 90 | 90 | */ |
| 91 | - $syntax[] = $this->getOrderBySyntax(); |
|
| 91 | + $syntax[ ] = $this->getOrderBySyntax(); |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * LIMIT clause |
| 95 | 95 | */ |
| 96 | - $syntax[] = $this->getLimitSyntax(); |
|
| 96 | + $syntax[ ] = $this->getLimitSyntax(); |
|
| 97 | 97 | |
| 98 | 98 | $syntax = implode( ' ', $syntax ); |
| 99 | 99 | |
@@ -110,6 +110,6 @@ discard block |
||
| 110 | 110 | if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) |
| 111 | 111 | throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
| 112 | 112 | |
| 113 | - return PdoWrapperService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS))->rowCount(); |
|
| 113 | + return PdoWrapperService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) )->rowCount(); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @return $this |
| 306 | 306 | * @throws \Qpdb\QueryBuilder\Dependencies\QueryException |
| 307 | 307 | */ |
| 308 | - public function havingExpression( $whereString, array $bindParams = [], $glue = 'AND' ) |
|
| 308 | + public function havingExpression( $whereString, array $bindParams = [ ], $glue = 'AND' ) |
|
| 309 | 309 | { |
| 310 | 310 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
| 311 | 311 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @return $this |
| 319 | 319 | * @throws \Qpdb\QueryBuilder\Dependencies\QueryException |
| 320 | 320 | */ |
| 321 | - public function orHavingExpression( $whereString, array $bindParams = [] ) |
|
| 321 | + public function orHavingExpression( $whereString, array $bindParams = [ ] ) |
|
| 322 | 322 | { |
| 323 | 323 | $whereString = $this->queryStructure->bindParamsExpression( $whereString, $bindParams ); |
| 324 | 324 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | if ( '' === $table ) |
| 53 | 53 | throw new QueryException( 'Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT ); |
| 54 | 54 | |
| 55 | - return QueryHelper::addBacktick($table); |
|
| 55 | + return QueryHelper::addBacktick( $table ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * @return $this |
| 27 | 27 | * @throws QueryException |
| 28 | 28 | */ |
| 29 | - public function orderBy( $column, array $allowedColumns = [] ) |
|
| 29 | + public function orderBy( $column, array $allowedColumns = [ ] ) |
|
| 30 | 30 | { |
| 31 | 31 | if ( !$this->validateColumn( $column, $allowedColumns ) ) |
| 32 | 32 | throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
| 33 | 33 | |
| 34 | - $column = $this->queryStructure->prepare($column); |
|
| 34 | + $column = $this->queryStructure->prepare( $column ); |
|
| 35 | 35 | $this->queryStructure->setElement( QueryStructure::ORDER_BY, $column ); |
| 36 | 36 | |
| 37 | 37 | return $this; |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @return $this |
| 45 | 45 | * @throws QueryException |
| 46 | 46 | */ |
| 47 | - public function orderByDesc( $column, array $allowedColumns = [] ) |
|
| 47 | + public function orderByDesc( $column, array $allowedColumns = [ ] ) |
|
| 48 | 48 | { |
| 49 | 49 | if ( !$this->validateColumn( $column, $allowedColumns ) ) |
| 50 | 50 | throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
| 51 | 51 | |
| 52 | - $column = $this->queryStructure->prepare($column); |
|
| 52 | + $column = $this->queryStructure->prepare( $column ); |
|
| 53 | 53 | $this->queryStructure->setElement( QueryStructure::ORDER_BY, $column . ' DESC' ); |
| 54 | 54 | |
| 55 | 55 | return $this; |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * @return $this |
| 27 | 27 | * @throws QueryException |
| 28 | 28 | */ |
| 29 | - public function groupBy( $column, array $allowedColumns = [] ) |
|
| 29 | + public function groupBy( $column, array $allowedColumns = [ ] ) |
|
| 30 | 30 | { |
| 31 | 31 | if ( !$this->validateColumn( $column, $allowedColumns ) ) |
| 32 | 32 | throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
| 33 | 33 | |
| 34 | - $column = $this->queryStructure->prepare($column); |
|
| 34 | + $column = $this->queryStructure->prepare( $column ); |
|
| 35 | 35 | $this->queryStructure->setElement( QueryStructure::ORDER_BY, $column ); |
| 36 | 36 | |
| 37 | 37 | $this->queryStructure->setElement( QueryStructure::GROUP_BY, $column ); |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * @return $this |
| 47 | 47 | * @throws QueryException |
| 48 | 48 | */ |
| 49 | - public function groupByDesc( $column, array $allowedColumns = [] ) |
|
| 49 | + public function groupByDesc( $column, array $allowedColumns = [ ] ) |
|
| 50 | 50 | { |
| 51 | 51 | if ( !$this->validateColumn( $column, $allowedColumns ) ) |
| 52 | 52 | throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
| 53 | 53 | |
| 54 | - $column = $this->queryStructure->prepare($column); |
|
| 54 | + $column = $this->queryStructure->prepare( $column ); |
|
| 55 | 55 | $this->queryStructure->setElement( QueryStructure::ORDER_BY, $column ); |
| 56 | 56 | |
| 57 | 57 | $this->queryStructure->setElement( QueryStructure::GROUP_BY, $column . ' DESC' ); |
@@ -120,62 +120,62 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * Explain |
| 122 | 122 | */ |
| 123 | - $syntax[] = $this->getExplainSyntax(); |
|
| 123 | + $syntax[ ] = $this->getExplainSyntax(); |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * SELECT statement |
| 127 | 127 | */ |
| 128 | - $syntax[] = $this->statement; |
|
| 128 | + $syntax[ ] = $this->statement; |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * PRIORITY |
| 132 | 132 | */ |
| 133 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 133 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * DISTINCT clause |
| 137 | 137 | */ |
| 138 | - $syntax[] = $this->getDistinctSyntax(); |
|
| 138 | + $syntax[ ] = $this->getDistinctSyntax(); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * FIELDS |
| 142 | 142 | */ |
| 143 | - $syntax[] = $this->getSelectFieldsSyntax(); |
|
| 143 | + $syntax[ ] = $this->getSelectFieldsSyntax(); |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * FROM table or queryStructure |
| 147 | 147 | */ |
| 148 | - $syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 148 | + $syntax[ ] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * JOIN CLAUSES |
| 152 | 152 | */ |
| 153 | - $syntax[] = $this->getJoinSyntax(); |
|
| 153 | + $syntax[ ] = $this->getJoinSyntax(); |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * WHERE clause |
| 157 | 157 | */ |
| 158 | - $syntax[] = $this->getWhereSyntax(); |
|
| 158 | + $syntax[ ] = $this->getWhereSyntax(); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * GROUP BY clause |
| 162 | 162 | */ |
| 163 | - $syntax[] = $this->getGroupBySyntax(); |
|
| 163 | + $syntax[ ] = $this->getGroupBySyntax(); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * HAVING clause |
| 167 | 167 | */ |
| 168 | - $syntax[] = $this->getHavingSyntax(); |
|
| 168 | + $syntax[ ] = $this->getHavingSyntax(); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * ORDER BY clause |
| 172 | 172 | */ |
| 173 | - $syntax[] = $this->getOrderBySyntax(); |
|
| 173 | + $syntax[ ] = $this->getOrderBySyntax(); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * LIMIT clause |
| 177 | 177 | */ |
| 178 | - $syntax[] = $this->getLimitSyntax(); |
|
| 178 | + $syntax[ ] = $this->getLimitSyntax(); |
|
| 179 | 179 | |
| 180 | 180 | $syntax = implode( ' ', $syntax ); |
| 181 | 181 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | case $this->queryStructure->getElement( QueryStructure::COLUMN ): |
| 201 | 201 | return PdoWrapperService::getInstance()->queryFetchAll( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ), \PDO::FETCH_COLUMN ); |
| 202 | 202 | default: |
| 203 | - return PdoWrapperService::getInstance()->queryFetchAll($this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ), \PDO::FETCH_ASSOC); |
|
| 203 | + return PdoWrapperService::getInstance()->queryFetchAll( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ), \PDO::FETCH_ASSOC ); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -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 |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | self::EXPLAIN => 0, |
| 98 | 98 | self::STATEMENT => '', |
| 99 | 99 | self::PRIORITY => '', |
| 100 | - self::FIELDS => [], |
|
| 100 | + self::FIELDS => [ ], |
|
| 101 | 101 | self::SET_FIELDS => array(), |
| 102 | 102 | self::WHERE => array(), |
| 103 | 103 | self::HAVING => array(), |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | while ( in_array( $instance, self::$usedInstanceIds ) ) { |
| 133 | 133 | $instance = QueryHelper::random( 5 ); |
| 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 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @param string $search |
| 227 | 227 | * @return string |
| 228 | 228 | */ |
| 229 | - public function bindParamsExpression( $expression, array $params = [], $search = '?' ) |
|
| 229 | + public function bindParamsExpression( $expression, array $params = [ ], $search = '?' ) |
|
| 230 | 230 | { |
| 231 | 231 | if ( !count( $params ) ) |
| 232 | 232 | return $expression; |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | $params = array_slice( $params, 0, substr_count( $expression, $search ) ); |
| 238 | 238 | |
| 239 | 239 | $i = 0; |
| 240 | - $arrayReturn = []; |
|
| 240 | + $arrayReturn = [ ]; |
|
| 241 | 241 | $expressionToArray = explode( $search, $expression ); |
| 242 | 242 | |
| 243 | 243 | foreach ( $expressionToArray as $sub ) { |
| 244 | - $arrayReturn[] = $sub; |
|
| 245 | - $arrayReturn[] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
| 244 | + $arrayReturn[ ] = $sub; |
|
| 245 | + $arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
| 246 | 246 | $i++; |
| 247 | 247 | } |
| 248 | 248 | |