Completed
Pull Request — master (#375)
by Dalibor
02:47
created
src/DataSource/DoctrineCollectionDataSource.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$exprs = [];
178 178
 
179 179
 		foreach ($filter->getCondition() as $column => $value) {
180
-			if($filter->isExactSearch()) {
180
+			if ($filter->isExactSearch()) {
181 181
 				$exprs[] = Criteria::expr()->eq($column, $value);
182 182
 				continue;
183 183
 			}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 		foreach ($this->aggregations as $column => $aggregation_type) {
312 312
 			if ($aggregation_type == ColumnAggregationFunction::$aggregation_type_avg) {
313
-				$result[$column] =  $result[$column] / $this->data_source->count();
313
+				$result[$column] = $result[$column] / $this->data_source->count();
314 314
 			}
315 315
 		}
316 316
 		return $result;
Please login to merge, or discard this patch.
src/DataSource/NetteDatabaseTableDataSource.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @var array
25 25
 	 */
26
-	protected  $aggregations =[];
26
+	protected  $aggregations = [];
27 27
 
28 28
 	/**
29 29
 	 * @var array
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		}
67 67
 
68 68
 		return $this->data_source->count(
69
-			$this->data_source->getName() . '.' . (is_array($primary) ? reset($primary) : $primary)
69
+			$this->data_source->getName().'.'.(is_array($primary) ? reset($primary) : $primary)
70 70
 		);
71 71
 	}
72 72
 
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 			$like = '(';
178 178
 			$args = [];
179 179
 
180
-			if($filter->isExactSearch()){
181
-				$like .=  "$column = ? OR ";
180
+			if ($filter->isExactSearch()) {
181
+				$like .= "$column = ? OR ";
182 182
 				$args[] = "$value";
183 183
 			} else {
184 184
 				if ($filter->hasSplitWordsSearch() === FALSE) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					$args[] = "%$word%";
192 192
 				}
193 193
 			}
194
-			$like = substr($like, 0, strlen($like) - 4) . ')';
194
+			$like = substr($like, 0, strlen($like) - 4).')';
195 195
 
196 196
 			$or[] = $like;
197 197
 			$big_or .= "$like OR ";
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		
230 230
 			foreach ($values as $value) {
231 231
 				if ($i == $length) {
232
-					$or .= $filter->getColumn() . ' = ?)';
232
+					$or .= $filter->getColumn().' = ?)';
233 233
 				} else {
234
-					$or .= $filter->getColumn() . ' = ? OR ';
234
+					$or .= $filter->getColumn().' = ? OR ';
235 235
 				}
236 236
 
237 237
 				$i++;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 			call_user_func_array([$this->data_source, 'where'], $values);
243 243
 		} else {
244
-			$this->data_source->where($filter->getColumn() . ' = ?', reset($values));
244
+			$this->data_source->where($filter->getColumn().' = ?', reset($values));
245 245
 		}
246 246
 	}
247 247
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		$result = [];
328 328
 		//there should really be some better way to do this and get all results in one query, this could be big performance issue on bigger tables
329 329
 		foreach ($this->aggregations as $column => $aggregation_type) {
330
-			$result[$column] = $this->data_source->aggregation($aggregation_type . '(' . $column . ')');
330
+			$result[$column] = $this->data_source->aggregation($aggregation_type.'('.$column.')');
331 331
 		}
332 332
 
333 333
 		return $result;
Please login to merge, or discard this patch.
src/DataSource/NextrasDataSource.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 			$date_end = clone $date;
108 108
 
109 109
 			$this->data_source = $this->data_source->findBy([
110
-				$this->prepareColumn($column) . '>=' => $date->setTime(0, 0, 0),
111
-				$this->prepareColumn($column) . '<=' => $date_end->setTime(23, 59, 59)
110
+				$this->prepareColumn($column).'>=' => $date->setTime(0, 0, 0),
111
+				$this->prepareColumn($column).'<=' => $date_end->setTime(23, 59, 59)
112 112
 			]);
113 113
 		}
114 114
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 		$dataCondition = [];
132 132
 		if ($value_from) {
133 133
 			$date_from = \DateTime::createFromFormat($filter->getPhpFormat(), $value_from);
134
-			$dataCondition[$this->prepareColumn($filter->getColumn()) . '>='] = $date_from->setTime(0, 0, 0);
134
+			$dataCondition[$this->prepareColumn($filter->getColumn()).'>='] = $date_from->setTime(0, 0, 0);
135 135
 		}
136 136
 
137 137
 		if ($value_to) {
138 138
 			$date_to = \DateTime::createFromFormat($filter->getPhpFormat(), $value_to);
139
-			$dataCondition[$this->prepareColumn($filter->getColumn()) . '<='] = $date_to->setTime(23, 59, 59);
139
+			$dataCondition[$this->prepareColumn($filter->getColumn()).'<='] = $date_to->setTime(23, 59, 59);
140 140
 		}
141 141
 
142 142
 		if (!empty($dataCondition)) {
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 		$dataCondition = [];
161 161
 
162 162
 		if ($value_from) {
163
-			$dataCondition[$this->prepareColumn($filter->getColumn()) . '>='] = $value_from;
163
+			$dataCondition[$this->prepareColumn($filter->getColumn()).'>='] = $value_from;
164 164
 		}
165 165
 
166 166
 		if ($value_to) {
167
-			$dataCondition[$this->prepareColumn($filter->getColumn()) . '<='] = $value_to;
167
+			$dataCondition[$this->prepareColumn($filter->getColumn()).'<='] = $value_to;
168 168
 		}
169 169
 
170 170
 		if (!empty($dataCondition)) {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	private function prepareColumn($column)
309 309
 	{
310 310
 	if (Strings::contains($column, '.')) {
311
-		return 'this->' . str_replace('.', '->', $column);
311
+		return 'this->'.str_replace('.', '->', $column);
312 312
 	}
313 313
 	return $column;
314 314
 	}
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 		}
335 335
 		$sql = 'SELECT ';
336 336
 		foreach ($this->aggregations as $column => $aggregation_type) {
337
-			$sql .= $aggregation_type . '(' . $column . ') as ' . $column . ',';
337
+			$sql .= $aggregation_type.'('.$column.') as '.$column.',';
338 338
 		}
339 339
 
340
-		$sql = rtrim($sql, ',') . ' FROM ( ' . $this->data_source->getQueryBuilder()->getQuerySql() . ' ) as data';
340
+		$sql = rtrim($sql, ',').' FROM ( '.$this->data_source->getQueryBuilder()->getQuerySql().' ) as data';
341 341
 
342 342
 		$params = $this->data_source->getQueryBuilder()->getQueryParameters();
343 343
 		array_unshift($params, $sql);
Please login to merge, or discard this patch.
src/DataSource/ArrayDataSource.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 						[$this->data, $filter->getValue()]
94 94
 					);
95 95
 				} else {
96
-					$this->data = array_filter($this->data, function ($row) use ($filter) {
96
+					$this->data = array_filter($this->data, function($row) use ($filter) {
97 97
 						return $this->applyFilter($row, $filter);
98 98
 					});
99 99
 				}
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 		foreach ($this->aggregations as $column => $aggregation_type) {
423 423
 			if ($aggregation_type == ColumnAggregationFunction::$aggregation_type_avg) {
424
-				$result[$column] =  $result[$column] / count($this->data);
424
+				$result[$column] = $result[$column] / count($this->data);
425 425
 			}
426 426
 		}
427 427
 		return $result;
Please login to merge, or discard this patch.
src/DataSource/DibiFluentDataSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
 	 */
312 312
 	public function addAggregationColumn($aggregation_type, $column)
313 313
 	{
314
-		$this->aggregation_data_source = $this->aggregation_data_source->select($aggregation_type .'(%n)', $column)->as($column);
314
+		$this->aggregation_data_source = $this->aggregation_data_source->select($aggregation_type.'(%n)', $column)->as($column);
315 315
 	}
316 316
 
317 317
 
Please login to merge, or discard this patch.
src/DataSource/DoctrineDataSource.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		foreach ($condition as $column => $value) {
236 236
 			$c = $this->checkAliases($column);
237 237
 
238
-			if($filter->isExactSearch()){
238
+			if ($filter->isExactSearch()) {
239 239
 				$exprs[] = $this->data_source->expr()->eq($c, $this->data_source->expr()->literal($value));
240 240
 				continue;
241 241
 			}
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 		}
371 371
 		$this->data_source->resetDQLPart('select');
372 372
 		foreach ($this->aggregations as $column => $aggregation_type) {
373
-			$query = $this->data_source->select("$aggregation_type(" . $this->checkAliases($column) . ") AS $column");
373
+			$query = $this->data_source->select("$aggregation_type(".$this->checkAliases($column).") AS $column");
374 374
 		}
375 375
 		return $query->getQuery()->getSingleResult();
376 376
 	}
Please login to merge, or discard this patch.