@@ -257,7 +257,9 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function fields($names = null) |
259 | 259 | { |
260 | - if (is_null($names)) return $this->fields; |
|
260 | + if (is_null($names)) { |
|
261 | + return $this->fields; |
|
262 | + } |
|
261 | 263 | |
262 | 264 | return array_filter($this->fields, function($field) use ($names) { |
263 | 265 | return array_key_exists($field->name, $names); |
@@ -440,7 +442,9 @@ discard block |
||
440 | 442 | */ |
441 | 443 | public function addNamespaceForClass($class) |
442 | 444 | { |
443 | - if (is_object($class)) $class = get_class($class); |
|
445 | + if (is_object($class)) { |
|
446 | + $class = get_class($class); |
|
447 | + } |
|
444 | 448 | |
445 | 449 | $reflector = new \ReflectionClass($class); |
446 | 450 | |
@@ -475,7 +479,9 @@ discard block |
||
475 | 479 | $class = '\\Fields\\'.ucwords($class).'\\'.ucwords($class); |
476 | 480 | |
477 | 481 | foreach ($this->namespaces as $namespace) { |
478 | - if (class_exists($namespace.$class)) return $namespace.$class; |
|
482 | + if (class_exists($namespace.$class)) { |
|
483 | + return $namespace.$class; |
|
484 | + } |
|
479 | 485 | } |
480 | 486 | } |
481 | 487 | |
@@ -488,9 +494,13 @@ discard block |
||
488 | 494 | */ |
489 | 495 | public function errors($name = null) |
490 | 496 | { |
491 | - if ($this->submitted()) $this->validate(); |
|
497 | + if ($this->submitted()) { |
|
498 | + $this->validate(); |
|
499 | + } |
|
492 | 500 | |
493 | - if ( ! is_null($name)) return $this->field($name)->errors(); |
|
501 | + if ( ! is_null($name)) { |
|
502 | + return $this->field($name)->errors(); |
|
503 | + } |
|
494 | 504 | |
495 | 505 | $errors = []; |
496 | 506 | |
@@ -682,8 +692,12 @@ discard block |
||
682 | 692 | $message = $this->translate($error, $field); |
683 | 693 | |
684 | 694 | foreach($parameters as $key => $value) { |
685 | - if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value; |
|
686 | - if (is_array($value)) $value = implode(', ', $value); |
|
695 | + if (is_object($value) && method_exists($value, '__toString')) { |
|
696 | + $value = (string) $value; |
|
697 | + } |
|
698 | + if (is_array($value)) { |
|
699 | + $value = implode(', ', $value); |
|
700 | + } |
|
687 | 701 | $message = str_replace('['.$key.']', $value, $message); |
688 | 702 | } |
689 | 703 | $properties['errors'][] = ['error' => $message]; |
@@ -703,7 +717,9 @@ discard block |
||
703 | 717 | */ |
704 | 718 | public function renderField($field, $properties = null) |
705 | 719 | { |
706 | - if (is_null($properties)) $properties = $this->fieldProperties($field); |
|
720 | + if (is_null($properties)) { |
|
721 | + $properties = $this->fieldProperties($field); |
|
722 | + } |
|
707 | 723 | |
708 | 724 | return $this->renderTemplate($field->type, $properties, $field); |
709 | 725 | } |
@@ -717,7 +733,9 @@ discard block |
||
717 | 733 | */ |
718 | 734 | public function renderFieldErrors($field, $properties = null) |
719 | 735 | { |
720 | - if (is_null($properties)) $properties = $this->fieldProperties($field); |
|
736 | + if (is_null($properties)) { |
|
737 | + $properties = $this->fieldProperties($field); |
|
738 | + } |
|
721 | 739 | |
722 | 740 | return $this->renderTemplate('errors', $properties, $field); |
723 | 741 | } |
@@ -734,9 +752,13 @@ discard block |
||
734 | 752 | |
735 | 753 | $this->setValues(); |
736 | 754 | |
737 | - if ($this->submitted()) $this->validate(); |
|
755 | + if ($this->submitted()) { |
|
756 | + $this->validate(); |
|
757 | + } |
|
738 | 758 | |
739 | - if ( ! is_null($template)) $this->setTemplate($template); |
|
759 | + if ( ! is_null($template)) { |
|
760 | + $this->setTemplate($template); |
|
761 | + } |
|
740 | 762 | |
741 | 763 | $properties = []; |
742 | 764 | $properties['id'] = $this->id; |
@@ -990,7 +1012,9 @@ discard block |
||
990 | 1012 | */ |
991 | 1013 | public function pathForClass($class) |
992 | 1014 | { |
993 | - if (is_object($class)) $class = get_class($class); |
|
1015 | + if (is_object($class)) { |
|
1016 | + $class = get_class($class); |
|
1017 | + } |
|
994 | 1018 | |
995 | 1019 | $reflector = new \ReflectionClass($class); |
996 | 1020 | $path = dirname($reflector->getFileName()); |