@@ -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 ] ); |
@@ -103,10 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | private function makeInCondition() |
105 | 105 | { |
106 | - if ( is_a( $this->temporaryParam[ 1 ], QuerySelect::class ) ) |
|
107 | - $this->inQuerySelect(); |
|
108 | - elseif ( is_array( $this->temporaryParam[ 1 ] ) ) |
|
109 | - $this->inArray(); |
|
106 | + if ( is_a( $this->temporaryParam[ 1 ], QuerySelect::class ) ) { |
|
107 | + $this->inQuerySelect(); |
|
108 | + } elseif ( is_array( $this->temporaryParam[ 1 ] ) ) { |
|
109 | + $this->inArray(); |
|
110 | + } |
|
110 | 111 | } |
111 | 112 | |
112 | 113 | private function inQuerySelect() |
@@ -182,8 +183,9 @@ discard block |
||
182 | 183 | */ |
183 | 184 | private function getWhereAndHavingSyntax( $clauseType ) |
184 | 185 | { |
185 | - if ( count( $this->queryStructure->getElement( $clauseType ) ) == 0 ) |
|
186 | - return ''; |
|
186 | + if ( count( $this->queryStructure->getElement( $clauseType ) ) == 0 ) { |
|
187 | + return ''; |
|
188 | + } |
|
187 | 189 | |
188 | 190 | $where = ''; |
189 | 191 | $last_type = 'where_start'; |
@@ -212,11 +214,13 @@ discard block |
||
212 | 214 | */ |
213 | 215 | private function validateWhereParam( $param ) |
214 | 216 | { |
215 | - if ( count( $param ) < 2 ) |
|
216 | - throw new QueryException( 'Invalid where array!', QueryException::QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY ); |
|
217 | + if ( count( $param ) < 2 ) { |
|
218 | + throw new QueryException( 'Invalid where array!', QueryException::QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY ); |
|
219 | + } |
|
217 | 220 | |
218 | - if ( count( $param ) == 2 ) |
|
219 | - $param[] = '='; |
|
221 | + if ( count( $param ) == 2 ) { |
|
222 | + $param[] = '='; |
|
223 | + } |
|
220 | 224 | |
221 | 225 | $param[ 2 ] = trim( strtoupper( $param[ 2 ] ) ); |
222 | 226 | $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' ) |