implement EventInterface
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Event;
|
||||
|
||||
final class Event extends AbstractEvent
|
||||
{
|
||||
use EventTrait;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Potter\Event;
|
||||
|
||||
trait EventTrait
|
||||
{
|
||||
final public function eventName(): string
|
||||
{
|
||||
return is_string($subject = $this->getSubject()) ?
|
||||
$subject : get_class($this);
|
||||
}
|
||||
|
||||
abstract public function getSubject(): mixed;
|
||||
}
|
||||
Reference in New Issue
Block a user