Passed
Push — master ( 13ce29...e039be )
by Adrian
02:19
created
src/Traits/SelectFields.php 1 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 1 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 1 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.