From 83b211bf039ee92d76d6a06ce360fd8e2a50ec15 Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 12 Aug 2018 11:57:32 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Form/Element/NamedFormElement.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Form/Element/NamedFormElement.php b/src/Form/Element/NamedFormElement.php index be10f9b21..bda1410c5 100644 --- a/src/Form/Element/NamedFormElement.php +++ b/src/Form/Element/NamedFormElement.php @@ -16,7 +16,6 @@ abstract class NamedFormElement extends FormElement { - use HtmlAttributes; /** * @var string @@ -304,9 +303,9 @@ public function getValidationRules() */ public function resolvePath() { - $model = $this->getModel(); + $model = $this->getModel(); $relations = explode('.', $this->getPath()); - $count = count($relations); + $count = count($relations); if ($count === 1) { return $model; @@ -363,17 +362,15 @@ public function getValueFromModel() return $value; } - $model = $this->getModel(); - $path = $this->getPath(); + $path = $this->getPath(); $value = $this->getDefaultValue(); - - /** + /* * Implement json parsing */ if (strpos($path, '->') !== false) { - $casts = collect($model->getCasts()); + $casts = collect($model->getCasts()); $jsonParts = collect(explode('->', $path)); $jsonAttr = $model->{$jsonParts->first()}; @@ -394,7 +391,7 @@ public function getValueFromModel() } $relations = explode('.', $path); - $count = count($relations); + $count = count($relations); if ($count === 1) { $attribute = $model->getAttribute($this->getModelAttributeKey()); @@ -411,10 +408,10 @@ public function getValueFromModel() } if ($count === 2) { if (str_contains($relation, '->')) { - $parts = explode('->', $relation); + $parts = explode('->', $relation); $relationField = array_shift($array); - $jsonPath = implode('.', $parts); - $attribute = data_get($model->{$relationField}, $jsonPath); + $jsonPath = implode('.', $parts); + $attribute = data_get($model->{$relationField}, $jsonPath); } else { $attribute = $model->getAttribute($relation); } @@ -476,8 +473,8 @@ protected function getModelByPath($path) $model = $this->getModel(); $relations = explode('.', $path); - $count = count($relations); - $i = 1; + $count = count($relations); + $i = 1; if ($count > 1) { $i++;