@@ -52,47 +52,47 @@ |
||
52 | 52 | /** |
53 | 53 | * Explain |
54 | 54 | */ |
55 | - $syntax[] = $this->getExplainSyntax(); |
|
55 | + $syntax[ ] = $this->getExplainSyntax(); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * UPDATE statement |
59 | 59 | */ |
60 | - $syntax[] = $this->statement; |
|
60 | + $syntax[ ] = $this->statement; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * PRIORITY |
64 | 64 | */ |
65 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
65 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * IGNORE clause |
69 | 69 | */ |
70 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
70 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * TABLE update |
74 | 74 | */ |
75 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
75 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * FIELDS update |
79 | 79 | */ |
80 | - $syntax[] = $this->getSettingFieldsSyntax(); |
|
80 | + $syntax[ ] = $this->getSettingFieldsSyntax(); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * WHERE clause |
84 | 84 | */ |
85 | - $syntax[] = $this->getWhereSyntax(); |
|
85 | + $syntax[ ] = $this->getWhereSyntax(); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * ORDER BY clause |
89 | 89 | */ |
90 | - $syntax[] = $this->getOrderBySyntax(); |
|
90 | + $syntax[ ] = $this->getOrderBySyntax(); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * LIMIT clause |
94 | 94 | */ |
95 | - $syntax[] = $this->getLimitSyntax(); |
|
95 | + $syntax[ ] = $this->getLimitSyntax(); |
|
96 | 96 | |
97 | 97 | $syntax = implode( ' ', $syntax ); |
98 | 98 |
@@ -106,8 +106,9 @@ |
||
106 | 106 | */ |
107 | 107 | public function execute() |
108 | 108 | { |
109 | - if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) |
|
110 | - throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
109 | + if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) { |
|
110 | + throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
111 | + } |
|
111 | 112 | |
112 | 113 | return DbService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
113 | 114 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - protected $usedInstanceIds = []; |
|
38 | + protected $usedInstanceIds = [ ]; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param array $params |
62 | 62 | * @return $this |
63 | 63 | */ |
64 | - public function withBindParams( array $params = [] ) |
|
64 | + public function withBindParams( array $params = [ ] ) |
|
65 | 65 | { |
66 | 66 | $this->queryStructure->replaceElement( QueryStructure::BIND_PARAMS, $params ); |
67 | 67 |
@@ -52,37 +52,37 @@ |
||
52 | 52 | /** |
53 | 53 | * Explain |
54 | 54 | */ |
55 | - $syntax[] = $this->getExplainSyntax(); |
|
55 | + $syntax[ ] = $this->getExplainSyntax(); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * UPDATE statement |
59 | 59 | */ |
60 | - $syntax[] = $this->statement; |
|
60 | + $syntax[ ] = $this->statement; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * PRIORITY |
64 | 64 | */ |
65 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
65 | + $syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * TABLE update |
69 | 69 | */ |
70 | - $syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
70 | + $syntax[ ] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * WHERE clause |
74 | 74 | */ |
75 | - $syntax[] = $this->getWhereSyntax(); |
|
75 | + $syntax[ ] = $this->getWhereSyntax(); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * ORDER BY clause |
79 | 79 | */ |
80 | - $syntax[] = $this->getOrderBySyntax(); |
|
80 | + $syntax[ ] = $this->getOrderBySyntax(); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * LIMIT clause |
84 | 84 | */ |
85 | - $syntax[] = $this->getLimitSyntax(); |
|
85 | + $syntax[ ] = $this->getLimitSyntax(); |
|
86 | 86 | |
87 | 87 | $syntax = implode( ' ', $syntax ); |
88 | 88 |
@@ -96,8 +96,9 @@ |
||
96 | 96 | public function execute() |
97 | 97 | { |
98 | 98 | |
99 | - if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) |
|
100 | - throw new QueryException( 'Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
99 | + if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) ) { |
|
100 | + throw new QueryException( 'Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
101 | + } |
|
101 | 102 | |
102 | 103 | return DbService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
103 | 104 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** |
50 | 50 | * @var array |
51 | 51 | */ |
52 | - protected $usedInstanceIds = []; |
|
52 | + protected $usedInstanceIds = [ ]; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var string |
@@ -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,10 +60,11 @@ discard block |
||
60 | 60 | private function __construct() |
61 | 61 | { |
62 | 62 | $vendorCfg = __DIR__ . '/../../../../../vendor-cfg/qpdb_db_config.php'; |
63 | - if ( file_exists( $vendorCfg ) ) |
|
64 | - $this->dbConfig = require $vendorCfg; |
|
65 | - else |
|
66 | - $this->dbConfig = require __DIR__ . '/../../config/qpdb_db_config.php'; |
|
63 | + if ( file_exists( $vendorCfg ) ) { |
|
64 | + $this->dbConfig = require $vendorCfg; |
|
65 | + } else { |
|
66 | + $this->dbConfig = require __DIR__ . '/../../config/qpdb_db_config.php'; |
|
67 | + } |
|
67 | 68 | |
68 | 69 | $this->buildConfig(); |
69 | 70 | } |
@@ -146,8 +147,9 @@ discard block |
||
146 | 147 | |
147 | 148 | public function useTablePrefix() |
148 | 149 | { |
149 | - if ( !empty( $this->dbConfig[ 'use_table_prefix' ] ) ) |
|
150 | - return $this->dbConfig[ 'use_table_prefix' ]; |
|
150 | + if ( !empty( $this->dbConfig[ 'use_table_prefix' ] ) ) { |
|
151 | + return $this->dbConfig[ 'use_table_prefix' ]; |
|
152 | + } |
|
151 | 153 | |
152 | 154 | return false; |
153 | 155 | } |
@@ -182,8 +184,9 @@ discard block |
||
182 | 184 | private function readMasterDataConnect() |
183 | 185 | { |
184 | 186 | |
185 | - if ( !isset( $this->dbConfig[ 'master_data_connect' ][ 0 ] ) ) |
|
186 | - throw new DbException( 'Master data connect is missing', DbException::DB_ERROR_MASTER_DATA_CONNECTION_MISSING ); |
|
187 | + if ( !isset( $this->dbConfig[ 'master_data_connect' ][ 0 ] ) ) { |
|
188 | + throw new DbException( 'Master data connect is missing', DbException::DB_ERROR_MASTER_DATA_CONNECTION_MISSING ); |
|
189 | + } |
|
187 | 190 | |
188 | 191 | $dataConnection = $this->dbConfig[ 'master_data_connect' ]; |
189 | 192 |
@@ -97,7 +97,7 @@ |
||
97 | 97 | * @param array $dbConfig |
98 | 98 | * @return $this |
99 | 99 | */ |
100 | - public function withConfigArray ( array $dbConfig ) |
|
100 | + public function withConfigArray( array $dbConfig ) |
|
101 | 101 | { |
102 | 102 | $this->dbConfig = $dbConfig; |
103 | 103 | $this->buildConfig(); |
@@ -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 |
@@ -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 |
@@ -28,8 +28,9 @@ |
||
28 | 28 | |
29 | 29 | protected function getExplainSyntax() |
30 | 30 | { |
31 | - if ( $this->queryStructure->getElement( QueryStructure::EXPLAIN ) ) |
|
32 | - return 'EXPLAIN'; |
|
31 | + if ( $this->queryStructure->getElement( QueryStructure::EXPLAIN ) ) { |
|
32 | + return 'EXPLAIN'; |
|
33 | + } |
|
33 | 34 | |
34 | 35 | return ''; |
35 | 36 | } |