From 229b1bcc8c63aaa7fd8285aaf681a27879031220 Mon Sep 17 00:00:00 2001 From: Mostafa Maklad Date: Sun, 18 Mar 2018 00:10:36 +0300 Subject: [PATCH] fix code smells for codeclimate --- src/Traits/HasRoles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Traits/HasRoles.php b/src/Traits/HasRoles.php index 7443e04..c7a7200 100644 --- a/src/Traits/HasRoles.php +++ b/src/Traits/HasRoles.php @@ -172,7 +172,7 @@ public function hasRole($roles): bool break; } } - } else { + } elseif($roles instanceof Collection) { $hasRole = ! $roles->intersect($this->roles)->isEmpty(); } @@ -208,7 +208,7 @@ public function hasAllRoles($roles): bool $hasRoles = $this->roles->contains('name', $roles); } elseif ($roles instanceof Role) { $hasRoles = $this->roles->contains('id', $roles->id); - } else { + } elseif(\is_array($roles) || $roles instanceof Collection) { $roles = \collect()->make($roles)->map(function ($role) { return $role instanceof Role ? $role->name : $role; });