Passed
Push — master ( ef8f16...289635 )
by Adrian
02:21
created
src/Traits/WhereAndHavingBuilder.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
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,
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
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[ 0 ] = $this->queryStructure->prepare( $param[ 0 ] );
222 222
 		$param[ 2 ] = trim( strtoupper( $param[ 2 ] ) );
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -103,10 +103,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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[ 0 ] = $this->queryStructure->prepare( $param[ 0 ] );
222 226
 		$param[ 2 ] = trim( strtoupper( $param[ 2 ] ) );
Please login to merge, or discard this patch.
src/Traits/OrderBy.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
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
-		$column = $this->queryStructure->prepare($column);
29
+		$column = $this->queryStructure->prepare( $column );
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 );
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
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
-		$column = $this->queryStructure->prepare($column);
48
+		$column = $this->queryStructure->prepare( $column );
49 49
 
50 50
 		if ( !$this->validateColumn( $column, $allowedColumns ) )
51 51
 			throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 	{
29 29
 		$column = $this->queryStructure->prepare($column);
30 30
 
31
-		if ( !$this->validateColumn( $column, $allowedColumns ) )
32
-			throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
31
+		if ( !$this->validateColumn( $column, $allowedColumns ) ) {
32
+					throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
33
+		}
33 34
 
34 35
 		$this->queryStructure->setElement( QueryStructure::ORDER_BY, $column );
35 36
 
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 	{
48 49
 		$column = $this->queryStructure->prepare($column);
49 50
 
50
-		if ( !$this->validateColumn( $column, $allowedColumns ) )
51
-			throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
51
+		if ( !$this->validateColumn( $column, $allowedColumns ) ) {
52
+					throw new QueryException( 'Invalid column name in ORDER BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
53
+		}
52 54
 
53 55
 		$this->queryStructure->setElement( QueryStructure::ORDER_BY, $column . ' DESC' );
54 56
 
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 	 */
74 76
 	private function getOrderBySyntax()
75 77
 	{
76
-		if ( count( $this->queryStructure->getElement( QueryStructure::ORDER_BY ) ) )
77
-			return 'ORDER BY ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::ORDER_BY ), ', ' );
78
+		if ( count( $this->queryStructure->getElement( QueryStructure::ORDER_BY ) ) ) {
79
+					return 'ORDER BY ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::ORDER_BY ), ', ' );
80
+		}
78 81
 
79 82
 		return '';
80 83
 	}
Please login to merge, or discard this patch.
src/Traits/GroupBy.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	 * @return $this
25 25
 	 * @throws QueryException
26 26
 	 */
27
-	public function groupBy( $column, array $allowedColumns = [] )
27
+	public function groupBy( $column, array $allowedColumns = [ ] )
28 28
 	{
29
-		$column = $this->queryStructure->prepare($column);
29
+		$column = $this->queryStructure->prepare( $column );
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 );
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 * @return $this
44 44
 	 * @throws QueryException
45 45
 	 */
46
-	public function groupByDesc( $column, array $allowedColumns = [] )
46
+	public function groupByDesc( $column, array $allowedColumns = [ ] )
47 47
 	{
48
-		$column = $this->queryStructure->prepare($column);
48
+		$column = $this->queryStructure->prepare( $column );
49 49
 
50 50
 		if ( !$this->validateColumn( $column, $allowedColumns ) )
51 51
 			throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 	{
29 29
 		$column = $this->queryStructure->prepare($column);
30 30
 
31
-		if ( !$this->validateColumn( $column, $allowedColumns ) )
32
-			throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
31
+		if ( !$this->validateColumn( $column, $allowedColumns ) ) {
32
+					throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
33
+		}
33 34
 
34 35
 		$this->queryStructure->setElement( QueryStructure::GROUP_BY, $column );
35 36
 
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 	{
48 49
 		$column = $this->queryStructure->prepare($column);
49 50
 
50
-		if ( !$this->validateColumn( $column, $allowedColumns ) )
51
-			throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
51
+		if ( !$this->validateColumn( $column, $allowedColumns ) ) {
52
+					throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME );
53
+		}
52 54
 
53 55
 		$this->queryStructure->setElement( QueryStructure::GROUP_BY, $column . ' DESC' );
54 56
 
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 	 */
74 76
 	private function getGroupBySyntax()
75 77
 	{
76
-		if ( count( $this->queryStructure->getElement( QueryStructure::GROUP_BY ) ) )
77
-			return 'GROUP BY ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::GROUP_BY ), ', ' );
78
+		if ( count( $this->queryStructure->getElement( QueryStructure::GROUP_BY ) ) ) {
79
+					return 'GROUP BY ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::GROUP_BY ), ', ' );
80
+		}
78 81
 
79 82
 		return '';
80 83
 	}
Please login to merge, or discard this patch.
src/Traits/TableValidation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 		if ( DbConfig::getInstance()->useTablePrefix() )
53 53
 			$table = str_ireplace( '::', DbConfig::getInstance()->getTablePrefix(), $table );
54 54
 
55
-		return QueryHelper::addBacktick($table);
55
+		return QueryHelper::addBacktick( $table );
56 56
 	}
57 57
 
58 58
 	private function validateTableSubQuery( $table )
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,22 +46,26 @@
 block discarded – undo
46 46
 	{
47 47
 		$table = trim( $table );
48 48
 
49
-		if ( '' === $table )
50
-			throw new QueryException( 'Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
49
+		if ( '' === $table ) {
50
+					throw new QueryException( 'Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
51
+		}
51 52
 
52
-		if ( DbConfig::getInstance()->useTablePrefix() )
53
-			$table = str_ireplace( '::', DbConfig::getInstance()->getTablePrefix(), $table );
53
+		if ( DbConfig::getInstance()->useTablePrefix() ) {
54
+					$table = str_ireplace( '::', DbConfig::getInstance()->getTablePrefix(), $table );
55
+		}
54 56
 
55 57
 		return QueryHelper::addBacktick($table);
56 58
 	}
57 59
 
58 60
 	private function validateTableSubQuery( $table )
59 61
 	{
60
-		if ( $this->statement !== QueryStatement::QUERY_STATEMENT_SELECT )
61
-			throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
62
+		if ( $this->statement !== QueryStatement::QUERY_STATEMENT_SELECT ) {
63
+					throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
64
+		}
62 65
 
63
-		if ( !is_a( $table, QuerySelect::class ) )
64
-			throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
66
+		if ( !is_a( $table, QuerySelect::class ) ) {
67
+					throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT );
68
+		}
65 69
 
66 70
 		return $table;
67 71
 	}
Please login to merge, or discard this patch.
src/Traits/Limit.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		if ( !QueryHelper::isInteger( $limit ) )
32 32
 			throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT );
33 33
 
34
-		$limit = $this->queryStructure->bindParam('lim', (int)$limit);
34
+		$limit = $this->queryStructure->bindParam( 'lim', ( int ) $limit );
35 35
 
36 36
 		if ( is_null( $offset ) ) {
37 37
 			$this->queryStructure->setElement( QueryStructure::LIMIT, $limit );
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		if ( !QueryHelper::isInteger( $offset ) )
45 45
 			throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET );
46 46
 
47
-		$offset = $this->queryStructure->bindParam('ofs', (int)$offset);
47
+		$offset = $this->queryStructure->bindParam( 'ofs', ( int ) $offset );
48 48
 
49 49
 		$this->queryStructure->setElement( QueryStructure::LIMIT, $offset . ', ' . $limit );
50 50
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 	{
29 29
 		$limit = trim( $limit );
30 30
 
31
-		if ( !QueryHelper::isInteger( $limit ) )
32
-			throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT );
31
+		if ( !QueryHelper::isInteger( $limit ) ) {
32
+					throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT );
33
+		}
33 34
 
34 35
 		$limit = $this->queryStructure->bindParam('lim', (int)$limit);
35 36
 
@@ -41,8 +42,9 @@  discard block
 block discarded – undo
41 42
 
42 43
 		$offset = trim( $offset );
43 44
 
44
-		if ( !QueryHelper::isInteger( $offset ) )
45
-			throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET );
45
+		if ( !QueryHelper::isInteger( $offset ) ) {
46
+					throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET );
47
+		}
46 48
 
47 49
 		$offset = $this->queryStructure->bindParam('ofs', (int)$offset);
48 50
 
@@ -53,8 +55,9 @@  discard block
 block discarded – undo
53 55
 
54 56
 	private function getLimitSyntax()
55 57
 	{
56
-		if ( !$this->queryStructure->getElement( QueryStructure::LIMIT ) )
57
-			return '';
58
+		if ( !$this->queryStructure->getElement( QueryStructure::LIMIT ) ) {
59
+					return '';
60
+		}
58 61
 
59 62
 		return 'LIMIT ' . $this->queryStructure->getElement( QueryStructure::LIMIT );
60 63
 	}
Please login to merge, or discard this patch.
src/Traits/AsSingleton.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@
 block discarded – undo
19 19
 	 */
20 20
 	public static function getInstance()
21 21
 	{
22
-		if ( is_null( self::$instance ) )
23
-			self::$instance = new self();
22
+		if ( is_null( self::$instance ) ) {
23
+					self::$instance = new self();
24
+		}
24 25
 
25 26
 		return self::$instance;
26 27
 	}
Please login to merge, or discard this patch.
src/Traits/SelectFields.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,19 +74,19 @@
 block discarded – undo
74 74
 	 */
75 75
 	private function prepareArrayFields( $fieldsArray = array() )
76 76
 	{
77
-		$prepareArray = [];
77
+		$prepareArray = [ ];
78 78
 
79 79
 		foreach ( $fieldsArray as $field ) {
80 80
 
81 81
 			switch ( gettype( $field ) ) {
82 82
 				case QueryStructure::ELEMENT_TYPE_STRING:
83
-					$prepareArray[] = $this->queryStructure->prepare( $field );
83
+					$prepareArray[ ] = $this->queryStructure->prepare( $field );
84 84
 					break;
85 85
 				case QueryStructure::ELEMENT_TYPE_ARRAY:
86
-					$prepareArray[] = $this->getFieldByArray( $field );
86
+					$prepareArray[ ] = $this->getFieldByArray( $field );
87 87
 					break;
88 88
 				default:
89
-					throw new QueryException('Invalid field description');
89
+					throw new QueryException( 'Invalid field description' );
90 90
 			}
91 91
 		}
92 92
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,10 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 				$fields = $this->prepareArrayFields( $fields );
33 33
 
34
-				if ( count( $fields ) )
35
-					$this->queryStructure->setElement( QueryStructure::FIELDS, implode( ', ', $fields ) );
36
-				else
37
-					$this->queryStructure->setElement( QueryStructure::FIELDS, '*' );
34
+				if ( count( $fields ) ) {
35
+									$this->queryStructure->setElement( QueryStructure::FIELDS, implode( ', ', $fields ) );
36
+				} else {
37
+									$this->queryStructure->setElement( QueryStructure::FIELDS, '*' );
38
+				}
38 39
 				break;
39 40
 
40 41
 			case QueryStructure::ELEMENT_TYPE_STRING:
@@ -44,9 +45,9 @@  discard block
 block discarded – undo
44 45
 					$fields = explode( ',', $fields );
45 46
 					$fields = $this->prepareArrayFields( $fields );
46 47
 					$this->queryStructure->setElement( QueryStructure::FIELDS, implode( ', ', $fields ) );
48
+				} else {
49
+									$this->queryStructure->setElement( QueryStructure::FIELDS, '*' );
47 50
 				}
48
-				else
49
-					$this->queryStructure->setElement( QueryStructure::FIELDS, '*' );
50 51
 				break;
51 52
 
52 53
 			default:
@@ -108,8 +109,7 @@  discard block
 block discarded – undo
108 109
 
109 110
 		if ( count( $fieldArray ) === 1 ) {
110 111
 			return $this->queryStructure->prepare( trim( $fieldArray[ 0 ] ) );
111
-		}
112
-		else {
112
+		} else {
113 113
 			return $this->queryStructure->prepare( trim( $fieldArray[ 0 ] ) ) . ' ' . $this->queryStructure->prepare( trim( $fieldArray[ 1 ] ) );
114 114
 		}
115 115
 
Please login to merge, or discard this patch.
src/Dependencies/QueryHelper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		foreach ( $brutArray as $value ) {
59 59
 			$value = trim( $value );
60 60
 			if ( '' !== $value )
61
-				$newArray[] = $value;
61
+				$newArray[ ] = $value;
62 62
 		}
63 63
 
64 64
 		return $newArray;
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	public static function addBacktick( $string )
121 121
 	{
122 122
 		$string = str_replace( '`', '', $string );
123
-		$stringArrayBacktick = [];
123
+		$stringArrayBacktick = [ ];
124 124
 		$string = self::clearMultipleSpaces( $string );
125 125
 		$stringArray = explode( '.', $string );
126 126
 		foreach ( $stringArray as $part ) {
127 127
 			$part = self::clearMultipleSpaces( $part );
128 128
 			if ( empty( $part ) )
129 129
 				continue;
130
-			$stringArrayBacktick[] = '`' . $part . '`';
130
+			$stringArrayBacktick[ ] = '`' . $part . '`';
131 131
 		}
132 132
 
133 133
 		return implode( '.', $stringArrayBacktick );
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 		$newArray = array();
58 58
 		foreach ( $brutArray as $value ) {
59 59
 			$value = trim( $value );
60
-			if ( '' !== $value )
61
-				$newArray[] = $value;
60
+			if ( '' !== $value ) {
61
+							$newArray[] = $value;
62
+			}
62 63
 		}
63 64
 
64 65
 		return $newArray;
@@ -110,8 +111,9 @@  discard block
 block discarded – undo
110 111
 		$characters = 'abcdefghijklmnopqrstuvwxyz';
111 112
 		$charactersLength = strlen( $characters );
112 113
 		$randomString = '';
113
-		for ( $i = 0; $i < $length; $i++ )
114
-			$randomString .= $characters[ rand( 0, $charactersLength - 1 ) ];
114
+		for ( $i = 0; $i < $length; $i++ ) {
115
+					$randomString .= $characters[ rand( 0, $charactersLength - 1 ) ];
116
+		}
115 117
 
116 118
 		return str_shuffle( $randomString );
117 119
 	}
@@ -125,8 +127,9 @@  discard block
 block discarded – undo
125 127
 		$stringArray = explode( '.', $string );
126 128
 		foreach ( $stringArray as $part ) {
127 129
 			$part = self::clearMultipleSpaces( $part );
128
-			if ( empty( $part ) )
129
-				continue;
130
+			if ( empty( $part ) ) {
131
+							continue;
132
+			}
130 133
 			$stringArrayBacktick[] = '`' . $part . '`';
131 134
 		}
132 135
 
Please login to merge, or discard this patch.
src/AbstractCruds/AbstractTableCrud.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @return array|bool
61 61
 	 * @throws QueryException
62 62
 	 */
63
-	public function getRowById( $id, array $fields = [] )
63
+	public function getRowById( $id, array $fields = [ ] )
64 64
 	{
65 65
 		$conditions = $this->getPrimaryKeyConditions( $id );
66 66
 		$result = QueryBuild::select( $this->table )->fields( $fields );
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 			throw new QueryException( 'Order field is not defined' );
138 138
 
139 139
 		$query = /** @lang text */
140
-			"UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[0]}` \r\n";
140
+			"UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[ 0 ]}` \r\n";
141 141
 		foreach ( $updates_ord as $position => $id ) {
142 142
 			$pos = $position + 1;
143 143
 			$query .= " WHEN '$id' THEN '$pos' \r\n";
144 144
 		}
145 145
 		$query .= "ELSE `{$this->orderField}` END";
146 146
 
147
-		return DbService::getInstance()->query( $query, [] );
147
+		return DbService::getInstance()->query( $query, [ ] );
148 148
 	}
149 149
 
150 150
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		if ( count( $this->primary ) !== count( $id ) )
162 162
 			throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY );
163 163
 
164
-		$conditions = [];
164
+		$conditions = [ ];
165 165
 
166 166
 		foreach ( $this->primary as $index => $key )
167 167
 			$conditions[ $key ] = $id[ $index ];
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 		$this->setPrimaryKey();
51 51
 		$this->setOrderField();
52 52
 
53
-		if ( !is_array( $this->primary ) )
54
-			$this->primary = [ $this->primary ];
53
+		if ( !is_array( $this->primary ) ) {
54
+					$this->primary = [ $this->primary ];
55
+		}
55 56
 	}
56 57
 
57 58
 	/**
@@ -64,8 +65,9 @@  discard block
 block discarded – undo
64 65
 	{
65 66
 		$conditions = $this->getPrimaryKeyConditions( $id );
66 67
 		$result = QueryBuild::select( $this->table )->fields( $fields );
67
-		foreach ( $conditions as $field => $value )
68
-			$result->whereEqual( $field, $value );
68
+		foreach ( $conditions as $field => $value ) {
69
+					$result->whereEqual( $field, $value );
70
+		}
69 71
 
70 72
 		return $result->first()->execute();
71 73
 	}
@@ -80,8 +82,9 @@  discard block
 block discarded – undo
80 82
 	{
81 83
 		$conditions = $this->getPrimaryKeyConditions( $id );
82 84
 		$result = QueryBuild::delete( $this->table );
83
-		foreach ( $conditions as $field => $value )
84
-			$result->whereEqual( $field, $value );
85
+		foreach ( $conditions as $field => $value ) {
86
+					$result->whereEqual( $field, $value );
87
+		}
85 88
 
86 89
 		return $result->execute();
87 90
 	}
@@ -96,8 +99,9 @@  discard block
 block discarded – undo
96 99
 	{
97 100
 		$conditions = $this->getPrimaryKeyConditions( $id );
98 101
 		$result = QueryBuild::update( $this->table );
99
-		foreach ( $conditions as $field => $value )
100
-			$result->whereEqual( $field, $value );
102
+		foreach ( $conditions as $field => $value ) {
103
+					$result->whereEqual( $field, $value );
104
+		}
101 105
 		$result->setFieldsByArray( $arrayUpdater );
102 106
 
103 107
 		return $result->execute();
@@ -133,8 +137,9 @@  discard block
 block discarded – undo
133 137
 	 */
134 138
 	public function saveOrder( $updates_ord = array() )
135 139
 	{
136
-		if ( empty( $this->orderField ) )
137
-			throw new QueryException( 'Order field is not defined' );
140
+		if ( empty( $this->orderField ) ) {
141
+					throw new QueryException( 'Order field is not defined' );
142
+		}
138 143
 
139 144
 		$query = /** @lang text */
140 145
 			"UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[0]}` \r\n";
@@ -155,16 +160,19 @@  discard block
 block discarded – undo
155 160
 	 */
156 161
 	protected function getPrimaryKeyConditions( $id )
157 162
 	{
158
-		if ( !is_array( $id ) )
159
-			$id = [ $id ];
163
+		if ( !is_array( $id ) ) {
164
+					$id = [ $id ];
165
+		}
160 166
 
161
-		if ( count( $this->primary ) !== count( $id ) )
162
-			throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY );
167
+		if ( count( $this->primary ) !== count( $id ) ) {
168
+					throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY );
169
+		}
163 170
 
164 171
 		$conditions = [];
165 172
 
166
-		foreach ( $this->primary as $index => $key )
167
-			$conditions[ $key ] = $id[ $index ];
173
+		foreach ( $this->primary as $index => $key ) {
174
+					$conditions[ $key ] = $id[ $index ];
175
+		}
168 176
 
169 177
 		return $conditions;
170 178
 	}
Please login to merge, or discard this patch.