diff --git a/kiri-engine/Abstracts/Component.php b/kiri-engine/Abstracts/Component.php index c8689d95..3ed525a2 100644 --- a/kiri-engine/Abstracts/Component.php +++ b/kiri-engine/Abstracts/Component.php @@ -14,11 +14,16 @@ use Exception; use JetBrains\PhpStorm\Pure; use Kiri; use Kiri\Error\StdoutLogger; -use ReflectionException; +use Kiri\Events\EventDispatch; +use Kiri\Events\EventProvider; +use Psr\Container\ContainerInterface; /** * Class Component * @package Kiri\Base + * @property ContainerInterface $container + * @property EventDispatch $dispatch + * @property EventProvider $provider */ class Component implements Configure { @@ -96,4 +101,29 @@ class Component implements Configure } + /** + * @return EventDispatch + */ + public function getDispatch(): EventDispatch + { + return Kiri::getDi()->get(EventDispatch::class); + } + + + /** + * @return EventProvider + */ + public function getProvider(): EventProvider + { + return Kiri::getDi()->get(EventProvider::class); + } + + + /** + * @return ContainerInterface + */ + public function getContainer(): ContainerInterface + { + return Kiri::getDi(); + } } diff --git a/kiri-engine/Abstracts/Providers.php b/kiri-engine/Abstracts/Providers.php index 23520f40..59fa3a90 100644 --- a/kiri-engine/Abstracts/Providers.php +++ b/kiri-engine/Abstracts/Providers.php @@ -4,24 +4,11 @@ declare(strict_types=1); namespace Kiri\Abstracts; -use Kiri; -use Psr\Container\ContainerInterface; - /** * Class Providers * @package Kiri\Abstracts - * @property-read ContainerInterface $container */ abstract class Providers extends Component implements Provider { - - /** - * @return ContainerInterface - */ - public function getContainer(): ContainerInterface - { - return Kiri::getDi(); - } - }