@@ -97,7 +97,7 @@ |
||
| 97 | 97 | { |
| 98 | 98 | parent::prepare(); |
| 99 | 99 | $visible = $this->getColumnsVisibility(); |
| 100 | - foreach($this->grid->getConfig()->getColumns() as $column) { |
|
| 100 | + foreach ($this->grid->getConfig()->getColumns() as $column) { |
|
| 101 | 101 | if (!$visible[$column->getName()]) { |
| 102 | 102 | $column->hide(); |
| 103 | 103 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | protected function setupPaginationForReading() |
| 25 | 25 | { |
| 26 | - Paginator::currentPageResolver(function () { |
|
| 26 | + Paginator::currentPageResolver(function() { |
|
| 27 | 27 | return Input::get("$this->input_key.page", 1); |
| 28 | 28 | }); |
| 29 | 29 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if (isset($input['page'])) { |
| 51 | 51 | unset($input['page']); |
| 52 | 52 | } |
| 53 | - return str_replace('/?', '?',$paginator->appends($this->input_key, $input)->render()); |
|
| 53 | + return str_replace('/?', '?', $paginator->appends($this->input_key, $input)->render()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function initialize(Grid $grid) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $field_names = $this->field_names; |
| 61 | 61 | $this->fields = $this->grid->getConfig()->getColumns()->filter( |
| 62 | - function (FieldConfig $field) use ($field_names) { |
|
| 62 | + function(FieldConfig $field) use ($field_names) { |
|
| 63 | 63 | return in_array($field->getName(), $field_names); |
| 64 | 64 | } |
| 65 | 65 | ); |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | Event::listen( |
| 78 | 78 | DataProvider::EVENT_FETCH_ROW, |
| 79 | - function (DataRow $row, DataProvider $currentProvider) use ($provider) { |
|
| 79 | + function(DataRow $row, DataProvider $currentProvider) use ($provider) { |
|
| 80 | 80 | if ($currentProvider !== $provider) return; |
| 81 | 81 | $this->rows_processed++; |
| 82 | 82 | foreach ($this->fields as $field) { |
| 83 | 83 | $name = $field->getName(); |
| 84 | 84 | $operation = $this->getFieldOperation($name); |
| 85 | - switch($operation) { |
|
| 85 | + switch ($operation) { |
|
| 86 | 86 | |
| 87 | 87 | case self::OPERATION_SUM: |
| 88 | 88 | $this->src[$name] += $row->getCellValue($field); |
@@ -217,6 +217,6 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getFieldOperation($fieldName) |
| 219 | 219 | { |
| 220 | - return isset($this->field_operations[$fieldName])?$this->field_operations[$fieldName]:self::OPERATION_SUM; |
|
| 220 | + return isset($this->field_operations[$fieldName]) ? $this->field_operations[$fieldName] : self::OPERATION_SUM; |
|
| 221 | 221 | } |
| 222 | 222 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $row = $this->getDataRow(); |
| 48 | 48 | $out = ''; |
| 49 | - foreach($this->grid->getConfig()->getColumns() as $column) { |
|
| 49 | + foreach ($this->grid->getConfig()->getColumns() as $column) { |
|
| 50 | 50 | $component = new TableCell($column); |
| 51 | 51 | $component->initialize($this->grid); |
| 52 | 52 | $component->setContent($column->getValue($row)); |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | */ |
| 150 | 150 | public function getLabel() |
| 151 | 151 | { |
| 152 | - return $this->label ? : ucwords(str_replace(array('-', '_', '.'), ' ', $this->name)); |
|
| 152 | + return $this->label ?: ucwords(str_replace(array('-', '_', '.'), ' ', $this->name)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function getVariants() |
| 34 | 34 | { |
| 35 | - return array_combine(array_values($this->variants),array_values($this->variants)); |
|
| 35 | + return array_combine(array_values($this->variants), array_values($this->variants)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($from_input === null) { |
| 74 | 74 | return $this->grid->getConfig()->getPageSize(); |
| 75 | 75 | } else { |
| 76 | - return (int) $from_input; |
|
| 76 | + return (int)$from_input; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -4,19 +4,19 @@ |
||
| 4 | 4 | * @var Nayjest\Grids\FieldConfig $column |
| 5 | 5 | */ |
| 6 | 6 | ?> |
| 7 | -<?php if($grid->getFiltering()->available()): ?> |
|
| 7 | +<?php if ($grid->getFiltering()->available()): ?> |
|
| 8 | 8 | <tr> |
| 9 | - <?php foreach($columns as $column): ?> |
|
| 9 | + <?php foreach ($columns as $column): ?> |
|
| 10 | 10 | <td |
| 11 | 11 | class="column-<?= $column->getName() ?>" |
| 12 | - <?= $column->isHidden()?'style="display:none"':'' ?> |
|
| 12 | + <?= $column->isHidden() ? 'style="display:none"' : '' ?> |
|
| 13 | 13 | > |
| 14 | 14 | <?php if ($column->hasFilters()): ?> |
| 15 | - <?php foreach($column->getFilters() as $filter): ?> |
|
| 15 | + <?php foreach ($column->getFilters() as $filter): ?> |
|
| 16 | 16 | <?= $grid->getFiltering()->render($filter) ?> |
| 17 | 17 | <?php endforeach ?> |
| 18 | 18 | <?php endif ?> |
| 19 | - <?= $component->renderComponents('filters_row_column_' . $column->getName()) ?> |
|
| 19 | + <?= $component->renderComponents('filters_row_column_'.$column->getName()) ?> |
|
| 20 | 20 | </td> |
| 21 | 21 | <?php endforeach ?> |
| 22 | 22 | <?= $grid->getInputProcessor()->getSortingHiddenInputsHtml() ?> |
@@ -121,6 +121,6 @@ |
||
| 121 | 121 | |
| 122 | 122 | public function getId() |
| 123 | 123 | { |
| 124 | - return $this->getName() . '-' . $this->getOperator(); |
|
| 124 | + return $this->getName().'-'.$this->getOperator(); |
|
| 125 | 125 | } |
| 126 | 126 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $b = new Blueprint(self::GRID_CLASS, [ |
| 84 | 84 | new BuildDataProvider(), |
| 85 | - new CustomInstruction(function (Scaffold $s) { |
|
| 85 | + new CustomInstruction(function(Scaffold $s) { |
|
| 86 | 86 | /** @var EloquentDataProvider $provider */ |
| 87 | 87 | $provider = $s->getInput('data_provider'); |
| 88 | 88 | $is_eloquent = $provider instanceof EloquentDataProvider; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $blueprint = new Blueprint(self::COMPONENT_CLASS, [ |
| 121 | 121 | |
| 122 | - new CustomInstruction(function (Scaffold $s) { |
|
| 122 | + new CustomInstruction(function(Scaffold $s) { |
|
| 123 | 123 | if ($s->input instanceof Closure) { |
| 124 | 124 | $s->class = 'Nayjest\Grids\Components\RenderFunc'; |
| 125 | 125 | $s->constructor_arguments = [$s->input]; |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | } elseif (is_string($s->input)) { |
| 128 | 128 | $s->class = 'Nayjest\Grids\Components\RenderFunc'; |
| 129 | 129 | $out = $s->input; |
| 130 | - $s->constructor_arguments = [function () use ($out) { |
|
| 130 | + $s->constructor_arguments = [function() use ($out) { |
|
| 131 | 131 | return $out; |
| 132 | 132 | }]; |
| 133 | 133 | $s->input = []; |
| 134 | 134 | } |
| 135 | 135 | }, Instruction::PHASE_PRE_INST), |
| 136 | - new CustomMapping('type', function ($type, Scaffold $s) { |
|
| 136 | + new CustomMapping('type', function($type, Scaffold $s) { |
|
| 137 | 137 | if (strpos($type, '\\') !== false) { |
| 138 | 138 | $s->class = $type; |
| 139 | 139 | } else { |
| 140 | - $s->class = 'Nayjest\Grids\Components\\' . str_replace( |
|
| 140 | + $s->class = 'Nayjest\Grids\Components\\'.str_replace( |
|
| 141 | 141 | ' ', |
| 142 | 142 | '', |
| 143 | 143 | ucwords(str_replace(array('-', '_'), ' ', $type)) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $blueprint->add(new Rename('component', 'add_component')); |
| 151 | 151 | $blueprint->add(new Build('add_component', $blueprint)); |
| 152 | - $blueprint->add(new CallMethodWith('add_component','addComponent')); |
|
| 152 | + $blueprint->add(new CallMethodWith('add_component', 'addComponent')); |
|
| 153 | 153 | |
| 154 | 154 | return $blueprint; |
| 155 | 155 | } |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | return new Blueprint(self::FILTER_CLASS, [ |
| 165 | 165 | new SimpleValueAsField('name'), |
| 166 | - new CustomMapping('type', function ($type, Scaffold $s) { |
|
| 167 | - switch($type) { |
|
| 166 | + new CustomMapping('type', function($type, Scaffold $s) { |
|
| 167 | + switch ($type) { |
|
| 168 | 168 | case 'select': |
| 169 | 169 | $s->class = 'Nayjest\Grids\SelectFilterConfig'; |
| 170 | 170 | break; |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | break; |
| 173 | 173 | } |
| 174 | 174 | }, null, Instruction::PHASE_PRE_INST), |
| 175 | - new Rename(0,'name'), |
|
| 176 | - new Rename(1,'operator'), |
|
| 175 | + new Rename(0, 'name'), |
|
| 176 | + new Rename(1, 'operator'), |
|
| 177 | 177 | ]); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | return new Blueprint(self::COLUMN_CLASS, [ |
| 194 | 194 | new SimpleValueAsField('name'), |
| 195 | - new Rename(0,'name'), |
|
| 195 | + new Rename(0, 'name'), |
|
| 196 | 196 | new BuildChildren('filters', $filter_blueprint), |
| 197 | 197 | |
| 198 | 198 | new Rename('filter', 'add_filter'), |
| 199 | 199 | new Build('add_filter', $filter_blueprint), |
| 200 | - new CallMethodWith('add_filter','addFilter'), |
|
| 200 | + new CallMethodWith('add_filter', 'addFilter'), |
|
| 201 | 201 | ]); |
| 202 | 202 | } |
| 203 | 203 | } |