We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | $relationFields = []; |
103 | 103 | |
104 | - foreach($fields as $field){ |
|
105 | - if(isset($field['model']) || isset($field['dependencies'])){ |
|
104 | + foreach ($fields as $field) { |
|
105 | + if (isset($field['model']) || isset($field['dependencies'])) { |
|
106 | 106 | array_push($relationFields, $field); |
107 | 107 | } |
108 | 108 | } |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | |
119 | 119 | foreach ($relations as $key => $relation) |
120 | 120 | { |
121 | - if ( (isset($relation['pivot']) && $relation['pivot'] ) || isset($relation['dependencies']) ){ |
|
122 | - if(is_array($relation['name'])){ |
|
123 | - foreach($relation['name'] as $relation){ |
|
124 | - if(isset($data[$relation])){ |
|
121 | + if ((isset($relation['pivot']) && $relation['pivot']) || isset($relation['dependencies'])) { |
|
122 | + if (is_array($relation['name'])) { |
|
123 | + foreach ($relation['name'] as $relation) { |
|
124 | + if (isset($data[$relation])) { |
|
125 | 125 | $model->{$relation}()->sync($data[$relation]); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | $model->{$relation}()->sync([]); |
128 | 128 | } |
129 | 129 | } |
130 | - }else{ |
|
130 | + } else { |
|
131 | 131 | $model->{$relation['name']}()->sync($data[$relation['name']]); |
132 | 132 | } |
133 | 133 | |
134 | - if( isset($relation['pivotFields']) ){ |
|
135 | - foreach($relation['pivotFields'] as $pivotField){ |
|
136 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
134 | + if (isset($relation['pivotFields'])) { |
|
135 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
136 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
137 | 137 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
138 | 138 | } |
139 | 139 | } |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | // set the value |
299 | 299 | if (!isset($fields[$k]['value'])) |
300 | 300 | { |
301 | - if(is_array($field['name'])){ |
|
301 | + if (is_array($field['name'])) { |
|
302 | 302 | |
303 | 303 | $fields[$k]['value'] = []; |
304 | - foreach($field['name'] as $key => $relation){ |
|
304 | + foreach ($field['name'] as $key => $relation) { |
|
305 | 305 | $fields[$k]['value'][] = $entry->{$relation}; |
306 | 306 | } |
307 | 307 | |
308 | - }else{ |
|
308 | + } else { |
|
309 | 309 | $fields[$k]['value'] = $entry->{$field['name']}; |
310 | 310 | } |
311 | 311 | } |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | public function allowAccess($access) |
425 | 425 | { |
426 | 426 | // $this->addButtons((array)$access); |
427 | - return $this->access = array_merge(array_diff((array)$access, $this->access), $this->access); |
|
427 | + return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | public function denyAccess($access) |
431 | 431 | { |
432 | 432 | // $this->removeButtons((array)$access); |
433 | - return $this->access = array_diff($this->access, (array)$access); |
|
433 | + return $this->access = array_diff($this->access, (array) $access); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function addDefaultTypeToColumn($column) |
645 | 645 | { |
646 | - if (array_key_exists('name', (array)$column)) |
|
646 | + if (array_key_exists('name', (array) $column)) |
|
647 | 647 | { |
648 | 648 | $default_type = $this->getFieldTypeFromDbColumnType($column['name']); |
649 | 649 | return array_merge(['type' => $default_type], $column); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * @param [field or column] |
660 | 660 | */ |
661 | 661 | public function addDefaultLabel($array) { |
662 | - if (!array_key_exists('label', (array)$array) && array_key_exists('name', (array)$array)) { |
|
662 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
663 | 663 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
664 | 664 | return $array; |
665 | 665 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * @param [array] $options Field-type-specific information. |
736 | 736 | * @param string $form The form to add the field to (create/update/both) |
737 | 737 | */ |
738 | - public function addField($field, $form='both') |
|
738 | + public function addField($field, $form = 'both') |
|
739 | 739 | { |
740 | 740 | // if the field_defition_array array is a string, it means the programmer was lazy and has only passed the name |
741 | 741 | // set some default values, so the field will still work |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @param string $name Field name (as defined with the addField() procedure) |
779 | 779 | * @param string $form update/create/both |
780 | 780 | */ |
781 | - public function removeField($name, $form='both') |
|
781 | + public function removeField($name, $form = 'both') |
|
782 | 782 | { |
783 | 783 | switch (strtolower($form)) { |
784 | 784 | case 'create': |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * @param array $array_of_names A simple array of the names of the fields to be removed. |
802 | 802 | * @param string $form update/create/both |
803 | 803 | */ |
804 | - public function removeFields($array_of_names, $form='both') |
|
804 | + public function removeFields($array_of_names, $form = 'both') |
|
805 | 805 | { |
806 | 806 | if (!empty($array_of_names)) { |
807 | 807 | foreach ($array_of_names as $name) { |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | array_map(function($field) { |
923 | 923 | // $this->labels[$field] = $this->makeLabel($field); |
924 | 924 | |
925 | - $new_field = [ |
|
925 | + $new_field = [ |
|
926 | 926 | 'name' => $field, |
927 | 927 | 'label' => ucfirst($field), |
928 | 928 | 'value' => '', 'default' => $this->field_types[$field]['default'], |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | public function orderColumns($order) |
1265 | 1265 | { |
1266 | - $this->setSort('columns', (array)$order); |
|
1266 | + $this->setSort('columns', (array) $order); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | public function orderFields($order) |
1340 | 1340 | { |
1341 | - $this->setSort('fields', (array)$order); |
|
1341 | + $this->setSort('fields', (array) $order); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | if (!empty($this->{$type})) |
1385 | 1385 | { |
1386 | 1386 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
1387 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
1387 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
1388 | 1388 | |
1389 | 1389 | return $field; |
1390 | 1390 | }, $this->{$type}); |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
1415 | 1415 | } |
1416 | 1416 | |
1417 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
1417 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | return $this->{$items}; |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | // cred ca ia valorile din tabela de legatura ca sa ti le afiseze in select |
1428 | 1428 | public function getRelationValues($model, $field, $where = [], $order = []) |
1429 | 1429 | { |
1430 | - $order = (array)$order; |
|
1430 | + $order = (array) $order; |
|
1431 | 1431 | $values = $model->select('*'); |
1432 | 1432 | |
1433 | 1433 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |