Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/grid/GridAssets.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  */
18 18
 class GridAssets extends AssetBundle
19 19
 {
20
-	public $sourcePath = __DIR__ . '/assets';
20
+	public $sourcePath = __DIR__.'/assets';
21 21
 
22 22
 	public $js = [
23 23
 		(YII_DEBUG ? 'neon-grid.js' : 'neon-grid.build.js'),
Please login to merge, or discard this patch.
neon/core/grid/GridBase.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param string $name
376 376
 	 * @param callable $function
377 377
 	 */
378
-	public function addScope($key, $name, $function=null)
378
+	public function addScope($key, $name, $function = null)
379 379
 	{
380 380
 		$this->_scopes[$key] = compact('key', 'name', 'function');
381 381
 	}
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			$this->_filterForm = (new Form($this->getId()))
439 439
 				->setId($this->getId().'Filter')
440 440
 				->addSubForm('filter');
441
-			foreach($this->getColumns() as $key => $column) {
441
+			foreach ($this->getColumns() as $key => $column) {
442 442
 				if ($column->getFilter() && $column->getFilterField() !== false) {
443 443
 					$field = $column->getFilterField();
444 444
 					if (is_object($field))
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 */
549 549
 	public function setColumns($columns)
550 550
 	{
551
-		foreach($columns as $key => $config) {
551
+		foreach ($columns as $key => $config) {
552 552
 			$this->addColumn($key, $config);
553 553
 		}
554 554
 	}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	 * @throws \Exception on incorrect column config
562 562
 	 * @return \neon\core\grid\column\Text
563 563
 	 */
564
-	public function addTextColumn($key, $config=[])
564
+	public function addTextColumn($key, $config = [])
565 565
 	{
566 566
 		$config['class'] = isset($config['class']) ? $config['class'] : 'neon\core\grid\column\Text';
567 567
 		return $this->addColumn($key, $config);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 * @throws \Exception on incorrect column config
576 576
 	 * @return \neon\core\grid\column\Date
577 577
 	 */
578
-	public function addDateColumn($key, $config=[])
578
+	public function addDateColumn($key, $config = [])
579 579
 	{
580 580
 		$config['class'] = isset($config['class']) ? $config['class'] : 'neon\core\grid\column\Date';
581 581
 		return $this->addColumn($key, $config);
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 * @throws \Exception on incorrect column config
590 590
 	 * @return \neon\core\grid\column\IntColumn
591 591
 	 */
592
-	public function addIntColumn($key, $config=[])
592
+	public function addIntColumn($key, $config = [])
593 593
 	{
594 594
 		$config['class'] = isset($config['class']) ? $config['class'] : 'neon\core\grid\column\IntColumn';
595 595
 		return $this->addColumn($key, $config);
@@ -603,9 +603,9 @@  discard block
 block discarded – undo
603 603
 	 * @return \neon\core\grid\column\Check
604 604
 	 * @throws \Exception
605 605
 	 */
606
-	public function addCheckColumn($key, $config=[])
606
+	public function addCheckColumn($key, $config = [])
607 607
 	{
608
-		$config['class'] = isset($config['class']) ?  $config['class'] : 'neon\core\grid\column\Check';
608
+		$config['class'] = isset($config['class']) ? $config['class'] : 'neon\core\grid\column\Check';
609 609
 		return $this->addColumn($key, $config);
610 610
 	}
611 611
 
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
 	 * @throws \Exception on incorrect column config
618 618
 	 * @return \neon\core\grid\column\Button
619 619
 	 */
620
-	public function addButtonColumn($key, $config=[])
620
+	public function addButtonColumn($key, $config = [])
621 621
 	{
622
-		$config['class'] = isset($config['class']) ?  $config['class'] : 'neon\core\grid\column\Button';
622
+		$config['class'] = isset($config['class']) ? $config['class'] : 'neon\core\grid\column\Button';
623 623
 		return $this->addColumn($key, $config);
624 624
 	}
625 625
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 * @throws \Exception
635 635
 	 * @return Column
636 636
 	 */
637
-	public function addColumnFromDefinition($key, $class, $member=null, $phoebeType='daedalus')
637
+	public function addColumnFromDefinition($key, $class, $member = null, $phoebeType = 'daedalus')
638 638
 	{
639
-		static $formsDefinitionCache=[];
639
+		static $formsDefinitionCache = [];
640 640
 		$cacheKey = $class.$phoebeType;
641 641
 		if (!array_key_exists($cacheKey, $formsDefinitionCache)) {
642 642
 			$formDefinition = neon('phoebe')->getFormDefinition($phoebeType, $class);
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	 * @return \neon\core\grid\column\Column
684 684
 	 * @throws \Exception if no `$config['class']` is set
685 685
 	 */
686
-	public function addColumn($key, $config=[])
686
+	public function addColumn($key, $config = [])
687 687
 	{
688 688
 		if (!isset($config['class'])) {
689 689
 			// 99% of the time you just want the standard Column class
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	public function hasData()
747 747
 	{
748
-		return ! empty($this->_gridData);
748
+		return !empty($this->_gridData);
749 749
 	}
750 750
 
751 751
 	/**
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	 */
781 781
 	public function gridBoot()
782 782
 	{
783
-		if (! $this->hasData())
783
+		if (!$this->hasData())
784 784
 			$this->_gridData = Arr::get($_REQUEST, $this->id, null);
785 785
 		// load the active scope
786 786
 		$this->_scope = Arr::get($this->_gridData, "scope", []);
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	 *   and true if you want the data returned as an array
816 816
 	 * @return string | array  depending on value of $asRows
817 817
 	 */
818
-	public function exportCsv($page=0, $pageSize=1000, $asRows=false)
818
+	public function exportCsv($page = 0, $pageSize = 1000, $asRows = false)
819 819
 	{
820 820
 		// check we're allowed to do this
821 821
 		if (!$this->canExportCsv)
@@ -838,14 +838,14 @@  discard block
 block discarded – undo
838 838
 		// Render the rows
839 839
 		$dataProvider = $this->getDataProvider();
840 840
 		$pagination = $dataProvider->pagination;
841
-		$pagination->page=$page;
842
-		$pagination->pageSize = min(1000,$pageSize);
841
+		$pagination->page = $page;
842
+		$pagination->pageSize = min(1000, $pageSize);
843 843
 		$models = $dataProvider->getModels();
844 844
 		if (empty($models))
845 845
 			return null;
846 846
 
847 847
 		$rows = [];
848
-		foreach($models as $index => $row) {
848
+		foreach ($models as $index => $row) {
849 849
 			$singleRow = [];
850 850
 			// use the columns set as not all columns exists in row data e.g. derived ones
851 851
 			foreach ($columns as $colKey => $column) {
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 		$dataProvider->models = null;
859 859
 
860 860
 		// Add headers columns as the first row if we are on the first page
861
-		if ($page==0)
861
+		if ($page == 0)
862 862
 			array_unshift($rows, implode(',', $headerCols));
863 863
 
864 864
 		return $asRows ? $rows : implode("\n", $rows);
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	public function callScope($scope, IQuery $query)
1067 1067
 	{
1068 1068
 		if ($scope['function'] == null) {
1069
-			$func = 'scope' . ucfirst($scope['key']);
1069
+			$func = 'scope'.ucfirst($scope['key']);
1070 1070
 			if ($this->hasMethod($func, false)) {
1071 1071
 				call_user_func(array($this, $func), $query);
1072 1072
 			} else {
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 	public function getColumnsVisible()
1133 1133
 	{
1134 1134
 		$columns = [];
1135
-		foreach($this->getColumns() as $key => $column) {
1135
+		foreach ($this->getColumns() as $key => $column) {
1136 1136
 			if ($column->visible)
1137 1137
 				$columns[$key] = $column;
1138 1138
 		}
@@ -1219,8 +1219,8 @@  discard block
 block discarded – undo
1219 1219
 	{
1220 1220
 		$tags = [];
1221 1221
 		foreach ($row as $key => $val) {
1222
-			if (!is_array($val)){
1223
-				$tags['{{' . $key . '}}'] = $val;
1222
+			if (!is_array($val)) {
1223
+				$tags['{{'.$key.'}}'] = $val;
1224 1224
 			}
1225 1225
 		}
1226 1226
 		return $tags;
Please login to merge, or discard this patch.
neon/core/grid/GridRenderer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function getViewPath()
88 88
 	{
89
-		return __DIR__ . DIRECTORY_SEPARATOR . 'views';
89
+		return __DIR__.DIRECTORY_SEPARATOR.'views';
90 90
 	}
91 91
 
92 92
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 
114 114
 		$out = '<tr>';
115
-		foreach($this->_grid->getColumnGroups() as $groupLabel => $details) {
115
+		foreach ($this->_grid->getColumnGroups() as $groupLabel => $details) {
116 116
 			$colspan = count($details['columns']);
117 117
 			$out .= "<td colspan='$colspan'>$groupLabel</td>";
118 118
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$pagination = $this->_grid->getDataProvider()->getPagination();
134 134
 		$filters = [];
135
-		foreach($this->_grid->getFilterForm()->getFields() as $field) {
135
+		foreach ($this->_grid->getFilterForm()->getFields() as $field) {
136 136
 			if (!empty($field->getValue()))
137 137
 				$filters[$field->getInputName()] = $field->getValue();
138 138
 		}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		$models = array_values($this->_grid->getDataProvider()->getModels());
162 162
 		$out = '';
163
-		foreach($models as $index => $row) {
163
+		foreach ($models as $index => $row) {
164 164
 			$out .= $this->renderRow($row);
165 165
 		}
166 166
 		return $out;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		}
201 201
 		$first = true;
202 202
 		$filtersHTML = '';
203
-		foreach($this->_grid->getScopes() as $link => $scope) {
203
+		foreach ($this->_grid->getScopes() as $link => $scope) {
204 204
 
205 205
 			$count = $this->_grid->getScopeTotalCount($link);
206 206
 			$current = '';
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			$page = $pagination->getPage() + 1;
250 250
 			$pageCount = $pagination->pageCount;
251 251
 			$tagMessage = ' <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.';
252
-			return Html::tag($tag, \Yii::t('yii',  $tagMessage, [
252
+			return Html::tag($tag, \Yii::t('yii', $tagMessage, [
253 253
 				'begin' => $begin,
254 254
 				'end' => $end,
255 255
 				'count' => $count,
Please login to merge, or discard this patch.
neon/core/grid/PhoebeGrid.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * e.g. 'data' and 'deleted'. Set during construction via config.
43 43
 	 * @var array
44 44
 	 */
45
-	public $additionalColumns=[];
45
+	public $additionalColumns = [];
46 46
 
47 47
 	/**
48 48
 	 * Default page size
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 
71
-	public function __construct($config=[])
71
+	public function __construct($config = [])
72 72
 	{
73 73
 		if (empty($config['phoebeType']) || empty($config['classType'])) {
74 74
 			throw new \RuntimeException('You need to provide at least the phoebeType and classType on construction');
Please login to merge, or discard this patch.
neon/core/grid/query/YiiQuery.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @inheritDoc
24 24
 	 */
25
-	public function where($column, $operator=null, $value=null)
25
+	public function where($column, $operator = null, $value = null)
26 26
 	{
27 27
 		// If the column is an array, we will assume it is an array of key-value pairs
28 28
 		// and can add them each as a where clause. We will maintain the boolean we
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		if (is_array($column)) {
31 31
 			return $this->addArrayOfWheres($column);
32 32
 		}
33
-		if ($operator==='=')
33
+		if ($operator === '=')
34 34
 			$this->_activeQuery->andWhere([$column => $value]);
35 35
 		else
36 36
 			$this->_activeQuery->andWhere([$operator, $column, $value]);
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
 	 * @inheritDoc
42 42
 	 */
43
-	public function addOrderBy($column, $order='DESC')
43
+	public function addOrderBy($column, $order = 'DESC')
44 44
 	{
45
-		$this->_activeQuery->addOrderBy([$column => ($order=='DESC') ? SORT_DESC : SORT_ASC]);
45
+		$this->_activeQuery->addOrderBy([$column => ($order == 'DESC') ? SORT_DESC : SORT_ASC]);
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @inheritDoc
50 50
 	 */
51
-	public function orderBy($column, $order='DESC')
51
+	public function orderBy($column, $order = 'DESC')
52 52
 	{
53
-		$this->_activeQuery->orderBy([$column => ($order=='DESC') ? SORT_DESC : SORT_ASC]);
53
+		$this->_activeQuery->orderBy([$column => ($order == 'DESC') ? SORT_DESC : SORT_ASC]);
54 54
 	}
55 55
 
56 56
 	/**
Please login to merge, or discard this patch.
neon/core/grid/query/DdsQuery.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function addArrayOfWheres($columns)
55 55
 	{
56
-		foreach($columns as $key => $value) {
56
+		foreach ($columns as $key => $value) {
57 57
 			$this->_filters[] = [$key, '=', $value];
58 58
 		}
59 59
 		return $this;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * @inheritDoc
64 64
 	 */
65
-	public function addOrderBy($column, $order='DESC')
65
+	public function addOrderBy($column, $order = 'DESC')
66 66
 	{
67 67
 		$this->_order[$column] = $order;
68 68
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	/**
71 71
 	 * @inheritDoc
72 72
 	 */
73
-	public function orderBy($column, $order='DESC')
73
+	public function orderBy($column, $order = 'DESC')
74 74
 	{
75 75
 		$this->_order[$column] = $order;
76 76
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @inheritDoc
107 107
 	 */
108
-	public function orHaving($column, $operator=null, $value=null)
108
+	public function orHaving($column, $operator = null, $value = null)
109 109
 	{
110 110
 		throw new \Exception('Having clause is currently not supported by DDS - you need to be able to specify custom columns for a start');
111 111
 	}
Please login to merge, or discard this patch.
neon/core/grid/query/BaseQuery.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 	 * @var array
18 18
 	 */
19 19
 	public $operators = [
20
-		'=',        // equals or if passed an array an IN => value
21
-		'!=',       // not equals or for array NOT IN => value
22
-		'>',        // greater than,
23
-		'<',        // less than,
24
-		'>=',       // greater or equal to,
25
-		'<=',       // less than or equal to,
26
-		'in',       // value in following array
27
-		'not in',   // value not in following array
28
-		'like',     // value for a text search comparison
20
+		'=', // equals or if passed an array an IN => value
21
+		'!=', // not equals or for array NOT IN => value
22
+		'>', // greater than,
23
+		'<', // less than,
24
+		'>=', // greater or equal to,
25
+		'<=', // less than or equal to,
26
+		'in', // value in following array
27
+		'not in', // value not in following array
28
+		'like', // value for a text search comparison
29 29
 		'not like', // value for a text search comparison
30
-		'null',     // set if testing for null [value not required]
30
+		'null', // set if testing for null [value not required]
31 31
 		'not null'  // set if testing for not null [value not required]
32 32
 	];
33 33
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	protected function invalidOperatorAndValue($operator, $value)
65 65
 	{
66
-		return is_null($value) && ! $this->invalidOperator($operator) &&
67
-			! in_array($operator, ['=', '!=']);
66
+		return is_null($value) && !$this->invalidOperator($operator) &&
67
+			!in_array($operator, ['=', '!=']);
68 68
 	}
69 69
 
70 70
 	/**
@@ -75,6 +75,6 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function invalidOperator($operator)
77 77
 	{
78
-		return ! in_array(strtolower($operator), $this->operators, true);
78
+		return !in_array(strtolower($operator), $this->operators, true);
79 79
 	}
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
neon/core/grid/query/IQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param mixed $value
39 39
 	 * @return $this - provide a fluent chainable interface
40 40
 	 */
41
-	public function where($column, $operator=null, $value=null);
41
+	public function where($column, $operator = null, $value = null);
42 42
 
43 43
 	/**
44 44
 	 * Add an array of key (column) => values as simple equality filters
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $column
55 55
 	 * @param string $order - 'ASC' | 'DESC'
56 56
 	 */
57
-	public function addOrderBy($column, $order='DESC');
57
+	public function addOrderBy($column, $order = 'DESC');
58 58
 
59 59
 	/**
60 60
 	 * Sets the order by clause to existing clause
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param string $column
63 63
 	 * @param string $order - 'ASC' | 'DESC'
64 64
 	 */
65
-	public function orderBy($column, $order='DESC');
65
+	public function orderBy($column, $order = 'DESC');
66 66
 
67 67
 	/**
68 68
 	 * Add a having clause to the query builder
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param mixed $value
75 75
 	 * @return $this - provide a fluent chainable interface
76 76
 	 */
77
-	public function having($column, $operator=null, $value=null);
77
+	public function having($column, $operator = null, $value = null);
78 78
 
79 79
 	/**
80 80
 	 * Create an orHaving clause
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param mixed $value
85 85
 	 * @return $this - provide a fluent chainable interface
86 86
 	 */
87
-	public function orHaving($column, $operator=null, $value=null);
87
+	public function orHaving($column, $operator = null, $value = null);
88 88
 
89 89
 	/**
90 90
 	 * return information on the current filters applied - for mysql this may be the raw query string - for
Please login to merge, or discard this patch.
neon/core/db/Migration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $comment
55 55
 	 * @return \yii\db\ColumnSchemaBuilder
56 56
 	 */
57
-	public function uuid64($comment='A uuid using base 64')
57
+	public function uuid64($comment = 'A uuid using base 64')
58 58
 	{
59 59
 		return $this->getDb()->getSchema()
60 60
 			->createColumnSchemaBuilder('char(22) CHARACTER SET latin1 COLLATE latin1_general_cs')
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		echo "    > $action ...";
72 72
 		$time = microtime(true);
73 73
 		$function();
74
-		echo ' done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
74
+		echo ' done (time: '.sprintf('%.3f', microtime(true) - $time)."s)\n";
75 75
 	}
76 76
 
77 77
 	/**
Please login to merge, or discard this patch.