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; }