Compare commits
7 Commits
1397afb513
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dc414f6277 | |||
| 5e64879e75 | |||
| ad754c6806 | |||
| cd1f7ea350 | |||
| 5b76469ba1 | |||
| 26c233295f | |||
| 72adff3639 |
+2
-1
@@ -4,7 +4,7 @@
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Potter\\": "src/Potter/"
|
||||
"Potter\\Event\\": "src/Potter/Event/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
@@ -16,6 +16,7 @@
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"league/event": ">=3.0.3",
|
||||
"potter/container": ">=0.0.1",
|
||||
"psr/event-dispatcher": ">=1.0.0",
|
||||
"symfony/event-dispatcher": ">=8.1.2",
|
||||
"symfony/event-dispatcher-contracts": ">=3.7.1",
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Event;
|
||||
|
||||
use \Potter\Container;
|
||||
|
||||
trait Behaviour
|
||||
{
|
||||
private static function addDispatcher(Container $container): void
|
||||
{
|
||||
$container->addShared(Dispatcher::class);
|
||||
}
|
||||
|
||||
private static function addEventBehaviour(Container $container): void
|
||||
{
|
||||
self::addDispatcher($container);
|
||||
}
|
||||
|
||||
private static function getDispatcher(Container $container): Dispatcher
|
||||
{
|
||||
return $container->get(Dispatcher::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Event;
|
||||
|
||||
final class Dispatcher
|
||||
extends \League\Event\EventDispatcher
|
||||
{ }
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter;
|
||||
namespace Potter\Event;
|
||||
|
||||
final class Event
|
||||
extends \Symfony\Component\EventDispatcher\GenericEvent
|
||||
Reference in New Issue
Block a user