Passed
Push — master ( ef8f16...289635 )
by Adrian
02:21
created
src/Traits/Join.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,10 +116,11 @@
 block discarded – undo
116 116
 	{
117 117
 		$join = $typeJoin . ' ' . $tableJoin;
118 118
 
119
-		if ( is_null( $onRight ) )
120
-			$join .= " USING ( $onLeft )";
121
-		else
122
-			$join .= " ON $onLeft = $onRight";
119
+		if ( is_null( $onRight ) ) {
120
+					$join .= " USING ( $onLeft )";
121
+		} else {
122
+					$join .= " ON $onLeft = $onRight";
123
+		}
123 124
 
124 125
 		$this->queryStructure->setElement( QueryStructure::JOIN, $join );
125 126
 
Please login to merge, or discard this patch.
src/Traits/ColumnValidation.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@
 block discarded – undo
16 16
 
17 17
 	protected function validateColumn( $columnName, array $allowed )
18 18
 	{
19
-		if ( is_integer( $columnName ) )
20
-			return true;
19
+		if ( is_integer( $columnName ) ) {
20
+					return true;
21
+		}
21 22
 
22
-		if ( !count( $allowed ) )
23
-			return true;
23
+		if ( !count( $allowed ) ) {
24
+					return true;
25
+		}
24 26
 
25 27
 		return false;
26 28
 	}
Please login to merge, or discard this patch.
src/Traits/Replacement.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
27 27
 	{
28 28
 		$syntax = QueryHelper::clearMultipleSpaces( $syntax );
29 29
 
30
-		if ( !$withReplacement )
31
-			return $syntax;
30
+		if ( !$withReplacement ) {
31
+					return $syntax;
32
+		}
32 33
 
33 34
 		return $this->replaceValues( $syntax );
34 35
 	}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
 		$search = array();
44 44
 		$replace = array();
45 45
 		foreach ( $bindParams as $key => $value ) {
46
-			$search[] = ':' . $key;
47
-			$replace[] = DbConnect::getInstance()->quote( $value );
46
+			$search[ ] = ':' . $key;
47
+			$replace[ ] = DbConnect::getInstance()->quote( $value );
48 48
 		}
49 49
 		$syntax = str_ireplace( $search, $replace, $syntax );
50 50
 
Please login to merge, or discard this patch.
src/Traits/InsertMultiple.php 2 patches
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$this->setFieldsList( $fieldsList );
31 31
 
32
-		foreach ( $rowsForInsert as $row )
33
-			$this->addSingleRow( $row );
32
+		foreach ( $rowsForInsert as $row ) {
33
+					$this->addSingleRow( $row );
34
+		}
34 35
 
35 36
 		return $this;
36 37
 	}
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
 	{
46 47
 		$this->setFieldsList( $fieldsList );
47 48
 
48
-		foreach ( $query->getBindParams() as $key => $value )
49
-			$this->queryStructure->setParams( $key, $value );
49
+		foreach ( $query->getBindParams() as $key => $value ) {
50
+					$this->queryStructure->setParams( $key, $value );
51
+		}
50 52
 
51 53
 		$this->queryStructure->replaceElement( QueryStructure::SET_FIELDS, $query );
52 54
 
@@ -59,8 +61,9 @@  discard block
 block discarded – undo
59 61
 	 */
60 62
 	private function setFieldsList( $fieldList )
61 63
 	{
62
-		if ( !is_array( $fieldList ) )
63
-			$fieldList = QueryHelper::explode( $fieldList );
64
+		if ( !is_array( $fieldList ) ) {
65
+					$fieldList = QueryHelper::explode( $fieldList );
66
+		}
64 67
 
65 68
 		$this->queryStructure->replaceElement( QueryStructure::FIELDS, $fieldList );
66 69
 
@@ -74,13 +77,15 @@  discard block
 block discarded – undo
74 77
 	private function addSingleRow( array $rowValues )
75 78
 	{
76 79
 
77
-		if ( $this->getNumberOfFields() !== count( $rowValues ) )
78
-			throw new QueryException( 'Ivalid number of fields.', QueryException::QUERY_ERROR_INVALID_FIELDS_COUNT );
80
+		if ( $this->getNumberOfFields() !== count( $rowValues ) ) {
81
+					throw new QueryException( 'Ivalid number of fields.', QueryException::QUERY_ERROR_INVALID_FIELDS_COUNT );
82
+		}
79 83
 
80 84
 		$pdoRowValues = array();
81 85
 
82
-		foreach ( $rowValues as $value )
83
-			$pdoRowValues[] = $this->queryStructure->bindParam( 'value', $value );
86
+		foreach ( $rowValues as $value ) {
87
+					$pdoRowValues[] = $this->queryStructure->bindParam( 'value', $value );
88
+		}
84 89
 
85 90
 		$pdoRowValuesString = '( ' . QueryHelper::implode( $pdoRowValues, ', ' ) . ' )';
86 91
 
@@ -94,8 +99,9 @@  discard block
 block discarded – undo
94 99
 	 */
95 100
 	private function getInsertMultipleRowsSyntax()
96 101
 	{
97
-		if ( is_a( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ), QuerySelect::class ) )
98
-			return $this->getSyntaxWithSelect();
102
+		if ( is_a( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ), QuerySelect::class ) ) {
103
+					return $this->getSyntaxWithSelect();
104
+		}
99 105
 
100 106
 		$fields = '( ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::FIELDS ), ', ' ) . ' )';
101 107
 		$values = QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ), ', ' );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 		$pdoRowValues = array();
81 81
 
82 82
 		foreach ( $rowValues as $value )
83
-			$pdoRowValues[] = $this->queryStructure->bindParam( 'value', $value );
83
+			$pdoRowValues[ ] = $this->queryStructure->bindParam( 'value', $value );
84 84
 
85 85
 		$pdoRowValuesString = '( ' . QueryHelper::implode( $pdoRowValues, ', ' ) . ' )';
86 86
 
Please login to merge, or discard this patch.
src/Traits/SetFields.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function setFieldsByArray( array $updateFieldsArray )
50 50
 	{
51
-		foreach ( $updateFieldsArray as $fieldName => $fieldValue )
52
-			$this->setField( $fieldName, $fieldValue );
51
+		foreach ( $updateFieldsArray as $fieldName => $fieldValue ) {
52
+					$this->setField( $fieldName, $fieldValue );
53
+		}
53 54
 
54 55
 		return $this;
55 56
 	}
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	 */
60 61
 	private function getSettingFieldsSyntax()
61 62
 	{
62
-		if ( !count( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ) ) )
63
-			return '';
63
+		if ( !count( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ) ) ) {
64
+					return '';
65
+		}
64 66
 
65 67
 		return 'SET ' . implode( ', ', $this->queryStructure->getElement( QueryStructure::SET_FIELDS ) );
66 68
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 */
25 25
 	public function setField( $fieldName, $fieldValue )
26 26
 	{
27
-		$fieldName = $this->queryStructure->prepare($fieldName);
27
+		$fieldName = $this->queryStructure->prepare( $fieldName );
28 28
 		$valuePdoString = $this->queryStructure->bindParam( $fieldName, $fieldValue );
29 29
 		$this->queryStructure->setElement( QueryStructure::SET_FIELDS, "$fieldName = $valuePdoString" );
30 30
 
Please login to merge, or discard this patch.
src/Dependencies/QueryStructure.php 2 patches
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -85,8 +85,9 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$this->syntaxEL = $this->init();
87 87
 
88
-		foreach ( $this->syntaxEL as $name => $value )
89
-			$this->typeEL[ $name ] = gettype( $value );
88
+		foreach ( $this->syntaxEL as $name => $value ) {
89
+					$this->typeEL[ $name ] = gettype( $value );
90
+		}
90 91
 
91 92
 	}
92 93
 
@@ -172,16 +173,19 @@  discard block
 block discarded – undo
172 173
 	 */
173 174
 	public function setElement( $name, $value )
174 175
 	{
175
-		if ( !array_key_exists( $name, $this->syntaxEL ) )
176
-			throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
176
+		if ( !array_key_exists( $name, $this->syntaxEL ) ) {
177
+					throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
178
+		}
177 179
 
178
-		if ( $name == self::TABLE && is_a( $value, QueryStatement::class ) )
179
-			return true;
180
+		if ( $name == self::TABLE && is_a( $value, QueryStatement::class ) ) {
181
+					return true;
182
+		}
180 183
 
181
-		if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY )
182
-			$this->syntaxEL[ $name ][] = $value;
183
-		else
184
-			$this->syntaxEL[ $name ] = $value;
184
+		if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) {
185
+					$this->syntaxEL[ $name ][] = $value;
186
+		} else {
187
+					$this->syntaxEL[ $name ] = $value;
188
+		}
185 189
 
186 190
 		return true;
187 191
 	}
@@ -194,8 +198,9 @@  discard block
 block discarded – undo
194 198
 	 */
195 199
 	public function replaceElement( $elementName, $elementValue )
196 200
 	{
197
-		if ( !array_key_exists( $elementName, $this->syntaxEL ) )
198
-			throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
201
+		if ( !array_key_exists( $elementName, $this->syntaxEL ) ) {
202
+					throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
203
+		}
199 204
 
200 205
 		$this->syntaxEL[ $elementName ] = $elementValue;
201 206
 	}
@@ -243,11 +248,13 @@  discard block
 block discarded – undo
243 248
 	 */
244 249
 	public function bindParamsExpression( $expression, array $params = [], $search = '?' )
245 250
 	{
246
-		if ( !count( $params ) )
247
-			return $expression;
251
+		if ( !count( $params ) ) {
252
+					return $expression;
253
+		}
248 254
 
249
-		if ( strpos( $expression, $search ) === false )
250
-			return $expression;
255
+		if ( strpos( $expression, $search ) === false ) {
256
+					return $expression;
257
+		}
251 258
 
252 259
 		$params = array_slice( $params, 0, substr_count( $expression, $search ) );
253 260
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * @var array
62 62
 	 */
63
-	private static $usedInstanceIds = [];
63
+	private static $usedInstanceIds = [ ];
64 64
 
65 65
 	/**
66 66
 	 * @var array
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		while ( in_array( $instance, self::$usedInstanceIds ) ) {
145 145
 			$instance = QueryHelper::random( 5 );
146 146
 		}
147
-		self::$usedInstanceIds[] = $instance;
147
+		self::$usedInstanceIds[ ] = $instance;
148 148
 
149 149
 		return $instance;
150 150
 	}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			return true;
192 192
 
193 193
 		if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY )
194
-			$this->syntaxEL[ $name ][] = $value;
194
+			$this->syntaxEL[ $name ][ ] = $value;
195 195
 		else
196 196
 			$this->syntaxEL[ $name ] = $value;
197 197
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @param string $search
239 239
 	 * @return string
240 240
 	 */
241
-	public function bindParamsExpression( $expression, array $params = [], $search = '?' )
241
+	public function bindParamsExpression( $expression, array $params = [ ], $search = '?' )
242 242
 	{
243 243
 		if ( !count( $params ) )
244 244
 			return $expression;
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 		$params = array_slice( $params, 0, substr_count( $expression, $search ) );
250 250
 
251 251
 		$i = 0;
252
-		$arrayReturn = [];
252
+		$arrayReturn = [ ];
253 253
 		$expressionToArray = explode( $search, $expression );
254 254
 
255 255
 		foreach ( $expressionToArray as $sub ) {
256
-			$arrayReturn[] = $sub;
257
-			$arrayReturn[] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : '';
256
+			$arrayReturn[ ] = $sub;
257
+			$arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : '';
258 258
 			$i++;
259 259
 		}
260 260
 
Please login to merge, or discard this patch.
src/DB/DbConnect.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function getMasterConnection()
44 44
 	{
45
-		if ( !is_a( $this->pdoMaster, \PDO::class ) )
46
-			$this->pdoMaster = $this->connect( $this->config->getMasterDataConnect() );
45
+		if ( !is_a( $this->pdoMaster, \PDO::class ) ) {
46
+					$this->pdoMaster = $this->connect( $this->config->getMasterDataConnect() );
47
+		}
47 48
 
48 49
 		return $this->pdoMaster;
49 50
 	}
@@ -53,11 +54,13 @@  discard block
 block discarded – undo
53 54
 	 */
54 55
 	public function getSlaveConnection()
55 56
 	{
56
-		if ( !$this->config->getReplicationEnable() )
57
-			return $this->getMasterConnection();
57
+		if ( !$this->config->getReplicationEnable() ) {
58
+					return $this->getMasterConnection();
59
+		}
58 60
 
59
-		if ( !is_a( $this->pdoSlave, \PDO::class ) )
60
-			$this->pdoSlave = $this->connect( $this->config->getSlaveDataConnect() );
61
+		if ( !is_a( $this->pdoSlave, \PDO::class ) ) {
62
+					$this->pdoSlave = $this->connect( $this->config->getSlaveDataConnect() );
63
+		}
61 64
 
62 65
 		return $this->pdoSlave;
63 66
 	}
@@ -70,8 +73,9 @@  discard block
 block discarded – undo
70 73
 	{
71 74
 		$statement = trim( strtolower( $statement ) );
72 75
 
73
-		if ( $statement === DbService::QUERY_TYPE_SELECT )
74
-			return $this->getSlaveConnection();
76
+		if ( $statement === DbService::QUERY_TYPE_SELECT ) {
77
+					return $this->getSlaveConnection();
78
+		}
75 79
 
76 80
 		return $this->getMasterConnection();
77 81
 	}
Please login to merge, or discard this patch.
src/Statements/QuerySelect.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
 			$this->queryStructure->setElement( QueryStructure::TABLE, $tableName );
56 56
 
57 57
 			$tableSelectParams = $table->getBindParams();
58
-			foreach ( $tableSelectParams as $key => $value )
59
-				$this->queryStructure->setParams( $key, $value );
58
+			foreach ( $tableSelectParams as $key => $value ) {
59
+							$this->queryStructure->setParams( $key, $value );
60
+			}
60 61
 
61 62
 		}
62 63
 	}
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
 			$this->queryStructure->setElement( QueryStructure::DISTINCT, 0 ); //???
108 109
 		}
109 110
 
110
-		if ( $this->queryStructure->getElement( QueryStructure::FIRST ) )
111
-			$this->queryStructure->setElement( QueryStructure::LIMIT, 1 );
111
+		if ( $this->queryStructure->getElement( QueryStructure::FIRST ) ) {
112
+					$this->queryStructure->setElement( QueryStructure::LIMIT, 1 );
113
+		}
112 114
 
113 115
 		$syntax = array();
114 116
 
@@ -190,8 +192,9 @@  discard block
 block discarded – undo
190 192
 				return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
191 193
 				break;
192 194
 			case $this->queryStructure->getElement( QueryStructure::FIRST ):
193
-				if ( $this->queryStructure->getElement( QueryStructure::COLUMN ) )
194
-					return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
195
+				if ( $this->queryStructure->getElement( QueryStructure::COLUMN ) ) {
196
+									return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
197
+				}
195 198
 
196 199
 				return DbService::getInstance()->row( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
197 200
 				break;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -115,62 +115,62 @@
 block discarded – undo
115 115
 		/**
116 116
 		 *  Explain
117 117
 		 */
118
-		$syntax[] = $this->getExplainSyntax();
118
+		$syntax[ ] = $this->getExplainSyntax();
119 119
 
120 120
 		/**
121 121
 		 * SELECT statement
122 122
 		 */
123
-		$syntax[] = $this->statement;
123
+		$syntax[ ] = $this->statement;
124 124
 
125 125
 		/**
126 126
 		 * PRIORITY
127 127
 		 */
128
-		$syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY );
128
+		$syntax[ ] = $this->queryStructure->getElement( QueryStructure::PRIORITY );
129 129
 
130 130
 		/**
131 131
 		 * DISTINCT clause
132 132
 		 */
133
-		$syntax[] = $this->getDistinctSyntax();
133
+		$syntax[ ] = $this->getDistinctSyntax();
134 134
 
135 135
 		/**
136 136
 		 * FIELDS
137 137
 		 */
138
-		$syntax[] = $this->queryStructure->getElement( QueryStructure::FIELDS );
138
+		$syntax[ ] = $this->queryStructure->getElement( QueryStructure::FIELDS );
139 139
 
140 140
 		/**
141 141
 		 * FROM table or queryStructure
142 142
 		 */
143
-		$syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE );
143
+		$syntax[ ] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE );
144 144
 
145 145
 		/**
146 146
 		 * JOIN CLAUSES
147 147
 		 */
148
-		$syntax[] = $this->getJoinSyntax();
148
+		$syntax[ ] = $this->getJoinSyntax();
149 149
 
150 150
 		/**
151 151
 		 * WHERE clause
152 152
 		 */
153
-		$syntax[] = $this->getWhereSyntax();
153
+		$syntax[ ] = $this->getWhereSyntax();
154 154
 
155 155
 		/**
156 156
 		 * GROUP BY clause
157 157
 		 */
158
-		$syntax[] = $this->getGroupBySyntax();
158
+		$syntax[ ] = $this->getGroupBySyntax();
159 159
 
160 160
 		/**
161 161
 		 * HAVING clause
162 162
 		 */
163
-		$syntax[] = $this->getHavingSyntax();
163
+		$syntax[ ] = $this->getHavingSyntax();
164 164
 
165 165
 		/**
166 166
 		 * ORDER BY clause
167 167
 		 */
168
-		$syntax[] = $this->getOrderBySyntax();
168
+		$syntax[ ] = $this->getOrderBySyntax();
169 169
 
170 170
 		/**
171 171
 		 * LIMIT clause
172 172
 		 */
173
-		$syntax[] = $this->getLimitSyntax();
173
+		$syntax[ ] = $this->getLimitSyntax();
174 174
 
175 175
 		$syntax = implode( ' ', $syntax );
176 176
 
Please login to merge, or discard this patch.
src/DB/DbLog.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,12 +85,10 @@
 block discarded – undo
85 85
 				$fh = fopen( $log, 'a+' );
86 86
 				fwrite( $fh, $messageFormat );
87 87
 				fclose( $fh );
88
-			}
89
-			else {
88
+			} else {
90 89
 				$this->edit( $log, $messageFormat );
91 90
 			}
92
-		}
93
-		else {
91
+		} else {
94 92
 			if ( mkdir( $this->path, 0777 ) === true ) {
95 93
 				$this->write( $message );
96 94
 			}
Please login to merge, or discard this patch.