We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -348,16 +348,16 @@ |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | protected function hasColumn($table, $name) |
351 | - { |
|
352 | - static $cache = []; |
|
351 | + { |
|
352 | + static $cache = []; |
|
353 | 353 | |
354 | - if(isset($cache[$table])){ |
|
355 | - $columns = $cache[$table]; |
|
356 | - }else{ |
|
357 | - $columns = $cache[$table] = \Schema::getColumnListing($table); |
|
358 | - } |
|
359 | - |
|
360 | - return in_array($name, $columns); |
|
361 | - } |
|
354 | + if(isset($cache[$table])){ |
|
355 | + $columns = $cache[$table]; |
|
356 | + }else{ |
|
357 | + $columns = $cache[$table] = \Schema::getColumnListing($table); |
|
358 | + } |
|
359 | + |
|
360 | + return in_array($name, $columns); |
|
361 | + } |
|
362 | 362 | |
363 | 363 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function addColumn($column) |
65 | 65 | { |
66 | 66 | // if a string was passed, not an array, change it to an array |
67 | - if (! is_array($column)) { |
|
67 | + if (!is_array($column)) { |
|
68 | 68 | $column = ['name' => $column]; |
69 | 69 | } |
70 | 70 | |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | $column_with_details = $this->addDefaultLabel($column); |
73 | 73 | |
74 | 74 | // make sure the column has a name |
75 | - if (! array_key_exists('name', $column_with_details)) { |
|
75 | + if (!array_key_exists('name', $column_with_details)) { |
|
76 | 76 | $column_with_details['name'] = 'anonymous_column_'.str_random(5); |
77 | 77 | } |
78 | 78 | |
79 | 79 | // make sure the column has a type |
80 | - if (! array_key_exists('type', $column_with_details)) { |
|
80 | + if (!array_key_exists('type', $column_with_details)) { |
|
81 | 81 | $column_with_details['type'] = 'text'; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // make sure the column has a key |
85 | - if (! array_key_exists('key', $column_with_details)) { |
|
85 | + if (!array_key_exists('key', $column_with_details)) { |
|
86 | 86 | $column_with_details['key'] = $column_with_details['name']; |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
101 | 101 | // defined in the main model |
102 | - if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) { |
|
102 | + if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) { |
|
103 | 103 | $column_with_details['model'] = $this->getRelationModel($column_with_details['entity']); |
104 | 104 | } |
105 | 105 | |
@@ -153,8 +153,7 @@ discard block |
||
153 | 153 | $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn; |
154 | 154 | |
155 | 155 | if (array_key_exists($targetColumnName, $this->columns)) { |
156 | - $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : |
|
157 | - array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
156 | + $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
158 | 157 | |
159 | 158 | $element = array_pop($this->columns); |
160 | 159 | $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true); |
@@ -188,7 +187,7 @@ discard block |
||
188 | 187 | */ |
189 | 188 | public function addDefaultLabel($array) |
190 | 189 | { |
191 | - if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
190 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
192 | 191 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
193 | 192 | |
194 | 193 | return $array; |
@@ -214,7 +213,7 @@ discard block |
||
214 | 213 | */ |
215 | 214 | public function removeColumns($columns) |
216 | 215 | { |
217 | - if (! empty($columns)) { |
|
216 | + if (!empty($columns)) { |
|
218 | 217 | foreach ($columns as $columnName) { |
219 | 218 | $this->removeColumn($columnName); |
220 | 219 | } |
@@ -235,8 +234,8 @@ discard block |
||
235 | 234 | */ |
236 | 235 | public function remove($entity, $fields) |
237 | 236 | { |
238 | - return array_values(array_filter($this->{$entity}, function ($field) use ($fields) { |
|
239 | - return ! in_array($field['name'], (array) $fields); |
|
237 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { |
|
238 | + return !in_array($field['name'], (array) $fields); |
|
240 | 239 | })); |
241 | 240 | } |
242 | 241 | |
@@ -281,7 +280,7 @@ discard block |
||
281 | 280 | { |
282 | 281 | $columns = $this->getColumns(); |
283 | 282 | |
284 | - return collect($columns)->pluck('entity')->reject(function ($value, $key) { |
|
283 | + return collect($columns)->pluck('entity')->reject(function($value, $key) { |
|
285 | 284 | return $value == null; |
286 | 285 | })->toArray(); |
287 | 286 | } |
@@ -351,9 +350,9 @@ discard block |
||
351 | 350 | { |
352 | 351 | static $cache = []; |
353 | 352 | |
354 | - if(isset($cache[$table])){ |
|
353 | + if (isset($cache[$table])) { |
|
355 | 354 | $columns = $cache[$table]; |
356 | - }else{ |
|
355 | + } else { |
|
357 | 356 | $columns = $cache[$table] = \Schema::getColumnListing($table); |
358 | 357 | } |
359 | 358 |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(isset($cache[$table])){ |
355 | 355 | $columns = $cache[$table]; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $columns = $cache[$table] = \Schema::getColumnListing($table); |
358 | 358 | } |
359 | 359 |