Passed
Push — master ( 2edb7f...e9650c )
by Adrian
01:27
created
src/Abstracts/AbstractTableDao.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function __construct() {
44 44
 		$this->table = $this->getTableName();
45
-		$this->primary = (array)$this->getPrimaryKey();
45
+		$this->primary = ( array ) $this->getPrimaryKey();
46 46
 		$this->orderField = $this->getOrderField();
47 47
 	}
48 48
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return array|bool
70 70
 	 * @throws QueryException
71 71
 	 */
72
-	public function getRowById( $id, array $fields = [] ) {
72
+	public function getRowById( $id, array $fields = [ ] ) {
73 73
 		$conditions = $this->getPrimaryKeyConditions( $id );
74 74
 		$result = QueryBuild::select( $this->table )->fields( $fields );
75 75
 		foreach ( $conditions as $field => $value )
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return array
86 86
 	 * @throws QueryException
87 87
 	 */
88
-	public function getFirstRowByCondition( $fieldName, $fieldValue, $fields = [] ) {
88
+	public function getFirstRowByCondition( $fieldName, $fieldValue, $fields = [ ] ) {
89 89
 		return QueryBuild::select( $this->table )
90 90
 			->fields( $fields )
91 91
 			->whereEqual( $fieldName, $fieldValue )
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	 * @throws QueryException
133 133
 	 */
134 134
 	public function updateRowsByFieldFilter( $fieldName, $fieldValue, array $arrayUpdater ) {
135
-		return QueryBuild::update($this->table)
136
-			->whereEqual($fieldName, $fieldValue)
137
-			->setFieldsByArray($arrayUpdater)
135
+		return QueryBuild::update( $this->table )
136
+			->whereEqual( $fieldName, $fieldValue )
137
+			->setFieldsByArray( $arrayUpdater )
138 138
 			->execute();
139 139
 	}
140 140
 
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 			throw new QueryException( 'Order field is not defined' );
184 184
 
185 185
 		$query = /** @lang text */
186
-			"UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[0]}` \r\n";
186
+			"UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[ 0 ]}` \r\n";
187 187
 		foreach ( $updates_ord as $position => $id ) {
188 188
 			$pos = $position + 1;
189 189
 			$query .= " WHEN '$id' THEN '$pos' \r\n";
190 190
 		}
191 191
 		$query .= "ELSE `{$this->orderField}` END";
192 192
 
193
-		return PdoWrapperService::getInstance()->query( $query, [] );
193
+		return PdoWrapperService::getInstance()->query( $query, [ ] );
194 194
 	}
195 195
 
196 196
 
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	protected function getPrimaryKeyConditions( $id ) {
203 203
 
204
-		$id = (array)$id;
204
+		$id = ( array ) $id;
205 205
 
206 206
 		if ( count( $this->primary ) !== count( $id ) )
207 207
 			throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY );
208 208
 
209
-		$conditions = [];
209
+		$conditions = [ ];
210 210
 
211 211
 		foreach ( $this->primary as $index => $key )
212 212
 			$conditions[ $key ] = $id[ $index ];
Please login to merge, or discard this patch.