Lines
68.42%
13 / 19
Methods
57.14%
8 / 14
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| register | 100.00% | 6 / 6 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] boot | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] provides | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Lucent\Container\ServiceProvider] isDeferred | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] call | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Lucent\Container\ServiceProvider] make | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] bind | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Lucent\Container\ServiceProvider] singleton | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] instance | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] alias | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Lucent\Container\ServiceProvider] when | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Lucent\Container\ServiceProvider] tag | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Lucent\Container\ServiceProvider] tagged | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| 15 | class EventDispatcherServiceProvider extends ServiceProvider | |
| 16 | { | |
| 17 | /** | |
| 18 | * Register the listener provider and event dispatcher as shared instances. | |
| 19 | * | |
| 20 | * The dispatcher is constructed with the listener provider and the | |
| 21 | * container (for resolving class-string listeners). | |
| 22 | */ | |
| 23 | public function register(): void | |
| 24 | { | |
| 25 | $provider = new ListenerProvider(); | |
| 26 | $dispatcher = new EventDispatcher($provider, $this->container); | |
| 27 | ||
| 28 | // Register the concrete classes as the shared instances and alias the | |
| 29 | // PSR interfaces to them, so consumers can resolve either and always | |
| 30 | // get the same single registration. | |
| 31 | $this->instance(ListenerProvider::class, $provider); | |
| 32 | $this->alias(ListenerProvider::class, ListenerProviderInterface::class); | |
| 33 | ||
| 34 | $this->instance(EventDispatcher::class, $dispatcher); | |
| 35 | $this->alias(EventDispatcher::class, EventDispatcherInterface::class); | |
| 36 | } | |
| 37 | } |
Inherited from Lucent\Container\ServiceProvider
| 53 | public function __construct(Container $container) | |
| 54 | { | |
| 55 | $this->container = $container; | |
| 56 | } |
| 75 | public function boot(): void | |
| 76 | { | |
| 77 | } |
| 87 | public function provides(): array | |
| 88 | { | |
| 89 | return []; | |
| 90 | } |
| 97 | public function isDeferred(): bool | |
| 98 | { | |
| 99 | return $this->defer; | |
| 100 | } |
| 112 | protected function call(callable|string|array $callback, array $parameters = [], ?string $defaultMethod = null): mixed | |
| 113 | { | |
| 114 | return $this->container->call($callback, $parameters, $defaultMethod); | |
| 115 | } |
| 126 | protected function make(string $abstract, array $parameters = []): mixed | |
| 127 | { | |
| 128 | return $this->container->make($abstract, $parameters); | |
| 129 | } |
| 140 | protected function bind(string|callable $abstract, string|callable|null $concrete = null): void | |
| 141 | { | |
| 142 | $this->container->bind($abstract, $concrete); | |
| 143 | } |
| 154 | protected function singleton(string|callable $abstract, string|callable|null $concrete = null): void | |
| 155 | { | |
| 156 | $this->container->singleton($abstract, $concrete); | |
| 157 | } |
| 168 | protected function instance(string|object $abstract, ?object $instance = null): object | |
| 169 | { | |
| 170 | return $this->container->instance($abstract, $instance); | |
| 171 | } |
| 183 | protected function alias(string $abstract, string $alias): void | |
| 184 | { | |
| 185 | $this->container->alias($abstract, $alias); | |
| 186 | } |
| 196 | protected function when(string $concrete): ContextualBindingBuilder | |
| 197 | { | |
| 198 | return $this->container->when($concrete); | |
| 199 | } |
| 210 | protected function tag(string|array $abstracts, array $tags): void | |
| 211 | { | |
| 212 | $this->container->tag($abstracts, $tags); | |
| 213 | } |
| 223 | protected function tagged(string $tag): array | |
| 224 | { | |
| 225 | return $this->container->tagged($tag); | |
| 226 | } |