From 0acdfb2d58253ee1f1b851db63549234b79b2ee6 Mon Sep 17 00:00:00 2001 From: Robert Marney Date: Sat, 18 May 2024 08:40:50 -0600 Subject: [PATCH] Fix Styling --- src/Hierarchical.php | 6 +----- src/LaraHierarchy.php | 5 ----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Hierarchical.php b/src/Hierarchical.php index 65bab6b..501f95e 100644 --- a/src/Hierarchical.php +++ b/src/Hierarchical.php @@ -140,9 +140,7 @@ private function getParentKey(object $item): mixed */ public function is(mixed $itemOrId): static { - $item = $this->toItem($itemOrId); - - if (! $item) { + if (! $item = $this->toItem($itemOrId)) { throw new InvalidArgumentException('Item not found'); } @@ -240,7 +238,6 @@ public function depthOf(mixed $itemOrId): ?int private function depth(mixed $itemOrId, int $depth = 0): int { - if (! $item = $this->toItem($itemOrId)) { return $depth; } @@ -268,6 +265,5 @@ public function siblingOf(mixed $itemOrId): bool } return $this->getParentKey($this->testItem) === $this->getParentKey($target); - } } diff --git a/src/LaraHierarchy.php b/src/LaraHierarchy.php index d782194..9dcb092 100644 --- a/src/LaraHierarchy.php +++ b/src/LaraHierarchy.php @@ -6,11 +6,6 @@ class LaraHierarchy { - public function __construct() - { - - } - /** * @deprecated - Use Hierarchical::make($args)->toCollection() instead * Take a flat collection of objects and transform into a hierarchical collection