From ca6669850c785cdd82f0393caf756f68e28693e2 Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Fri, 10 Jan 2025 18:22:34 -0300 Subject: [PATCH] fix symbol --- src/ControllerName.php | 9 +++++++-- .../{ControllerNameTrait.php => ActionNameTrait.php} | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) rename src/Traits/{ControllerNameTrait.php => ActionNameTrait.php} (81%) diff --git a/src/ControllerName.php b/src/ControllerName.php index 4097d2b..b5f50a2 100644 --- a/src/ControllerName.php +++ b/src/ControllerName.php @@ -15,11 +15,16 @@ use Chevere\Action\Interfaces\ControllerInterface; use Chevere\Action\Interfaces\ControllerNameInterface; -use Chevere\Action\Traits\ControllerNameTrait; +use Chevere\Action\Traits\ActionNameTrait; final class ControllerName implements ControllerNameInterface { - use ControllerNameTrait; + use ActionNameTrait; + + public static function symbol(): string + { + return 'Controller'; + } public static function interface(): string { diff --git a/src/Traits/ControllerNameTrait.php b/src/Traits/ActionNameTrait.php similarity index 81% rename from src/Traits/ControllerNameTrait.php rename to src/Traits/ActionNameTrait.php index 853e848..1c90f40 100644 --- a/src/Traits/ControllerNameTrait.php +++ b/src/Traits/ActionNameTrait.php @@ -16,7 +16,7 @@ use InvalidArgumentException; use function Chevere\Message\message; -trait ControllerNameTrait +trait ActionNameTrait { public function __construct( private string $name @@ -27,7 +27,8 @@ public function __construct( throw new InvalidArgumentException( (string) message( - "Controller `{{ name }}` doesn't implement `{{ interface }}`", + "{{ action }} `{{ name }}` doesn't implement `{{ interface }}`", + action: $this::symbol(), name: $this->name, interface: $this->interface() ) @@ -45,5 +46,10 @@ public function isSubclassOf(string $class): bool return is_subclass_of($this->name, $class, true); } + public static function symbol(): string + { + return 'Action'; + } + abstract public static function interface(): string; }