@@ -253,7 +253,9 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function fields($names = null) |
255 | 255 | { |
256 | - if (is_null($names)) return $this->fields; |
|
256 | + if (is_null($names)) { |
|
257 | + return $this->fields; |
|
258 | + } |
|
257 | 259 | |
258 | 260 | return array_filter($this->fields, function($field) use ($names) { |
259 | 261 | return array_key_exists($field->name, $names); |
@@ -473,7 +475,9 @@ discard block |
||
473 | 475 | $class = '\\Fields\\'.ucwords($class).'\\'.ucwords($class); |
474 | 476 | |
475 | 477 | foreach ($this->namespaces as $namespace) { |
476 | - if (class_exists($namespace.$class)) return $namespace.$class; |
|
478 | + if (class_exists($namespace.$class)) { |
|
479 | + return $namespace.$class; |
|
480 | + } |
|
477 | 481 | } |
478 | 482 | } |
479 | 483 | |
@@ -486,9 +490,13 @@ discard block |
||
486 | 490 | */ |
487 | 491 | public function errors($name = null) |
488 | 492 | { |
489 | - if ($this->submitted()) $this->validate(); |
|
493 | + if ($this->submitted()) { |
|
494 | + $this->validate(); |
|
495 | + } |
|
490 | 496 | |
491 | - if ( ! is_null($name)) return $this->field($name)->errors(); |
|
497 | + if ( ! is_null($name)) { |
|
498 | + return $this->field($name)->errors(); |
|
499 | + } |
|
492 | 500 | |
493 | 501 | $errors = []; |
494 | 502 | |
@@ -680,8 +688,12 @@ discard block |
||
680 | 688 | $message = $this->translate($error, $field); |
681 | 689 | |
682 | 690 | foreach($parameters as $key => $value) { |
683 | - if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value; |
|
684 | - if (is_array($value)) $value = implode(', ', $value); |
|
691 | + if (is_object($value) && method_exists($value, '__toString')) { |
|
692 | + $value = (string) $value; |
|
693 | + } |
|
694 | + if (is_array($value)) { |
|
695 | + $value = implode(', ', $value); |
|
696 | + } |
|
685 | 697 | $message = str_replace('['.$key.']', $value, $message); |
686 | 698 | } |
687 | 699 | $properties['errors'][] = ['error' => $message]; |
@@ -701,7 +713,9 @@ discard block |
||
701 | 713 | */ |
702 | 714 | public function renderField($field, $properties = null) |
703 | 715 | { |
704 | - if (is_null($properties)) $properties = $this->fieldProperties($field); |
|
716 | + if (is_null($properties)) { |
|
717 | + $properties = $this->fieldProperties($field); |
|
718 | + } |
|
705 | 719 | |
706 | 720 | return $this->renderTemplate($field->type, $properties, $field); |
707 | 721 | } |
@@ -715,7 +729,9 @@ discard block |
||
715 | 729 | */ |
716 | 730 | public function renderFieldErrors($field, $properties = null) |
717 | 731 | { |
718 | - if (is_null($properties)) $properties = $this->fieldProperties($field); |
|
732 | + if (is_null($properties)) { |
|
733 | + $properties = $this->fieldProperties($field); |
|
734 | + } |
|
719 | 735 | |
720 | 736 | return $this->renderTemplate('errors', $properties, $field); |
721 | 737 | } |
@@ -732,9 +748,13 @@ discard block |
||
732 | 748 | |
733 | 749 | $this->setValues(); |
734 | 750 | |
735 | - if ($this->submitted()) $this->validate(); |
|
751 | + if ($this->submitted()) { |
|
752 | + $this->validate(); |
|
753 | + } |
|
736 | 754 | |
737 | - if ( ! is_null($template)) $this->setTemplate($template); |
|
755 | + if ( ! is_null($template)) { |
|
756 | + $this->setTemplate($template); |
|
757 | + } |
|
738 | 758 | |
739 | 759 | $properties = []; |
740 | 760 | $properties['id'] = $this->id; |