1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Core\Facade; |
4: | |
5: | use Salient\Container\Container; |
6: | use Salient\Contract\Container\ContainerInterface; |
7: | use Salient\Contract\Container\ServiceLifetime; |
8: | use Salient\Contract\Core\Chainable; |
9: | use Salient\Core\AbstractFacade; |
10: | |
11: | /** |
12: | * A facade for the global service container |
13: | * |
14: | * @method static ContainerInterface addContextualBinding(class-string[]|class-string $context, class-string|string $dependency, (callable(ContainerInterface): mixed)|class-string|mixed $value) Register a contextual binding with the container (see {@see ContainerInterface::addContextualBinding()}) |
15: | * @method static ContainerInterface apply(callable(static): static $callback) Move to the next method in the chain after applying a callback to the object |
16: | * @method static ContainerInterface bind(class-string $id, class-string|null $class = null, mixed[] $args = []) Bind a service to the container (see {@see ContainerInterface::bind()}) |
17: | * @method static ContainerInterface bindIf(class-string $id, class-string|null $class = null, mixed[] $args = []) Bind a service to the container if it isn't already bound |
18: | * @method static object get(class-string $id, mixed[] $args = []) Resolve a service from the container (see {@see ContainerInterface::get()}) |
19: | * @method static object getAs(class-string $id, class-string $service, mixed[] $args = []) Resolve a partially-resolved service from the container (see {@see ContainerInterface::getAs()}) |
20: | * @method static ContainerInterface getGlobalContainer() Get the global container, creating it if necessary |
21: | * @method static class-string getName(class-string $id) Resolve a service to a concrete class name |
22: | * @method static array<class-string> getProviders() Get a list of service providers registered with the container |
23: | * @method static bool has(class-string $id) Check if a service is bound to the container (see {@see ContainerInterface::has()}) |
24: | * @method static bool hasGlobalContainer() Check if the global container is set |
25: | * @method static bool hasInstance(class-string $id) Check if a service resolves to a shared instance |
26: | * @method static bool hasProvider(class-string $id) Check if a service provider is registered with the container |
27: | * @method static bool hasSingleton(class-string $id) Check if a shared service is bound to the container |
28: | * @method static ContainerInterface if((callable(static): bool)|bool $condition, (callable(static): static)|null $then = null, (callable(static): static)|null $else = null) Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::if()}) |
29: | * @method static ContainerInterface inContextOf(class-string $id) Apply the contextual bindings of a service to a copy of the container |
30: | * @method static ContainerInterface instance(class-string $id, object $instance) Bind a shared instance to the container |
31: | * @method static ContainerInterface provider(class-string $id, class-string[]|null $services = null, class-string[] $exceptServices = [], ServiceLifetime::* $lifetime = ServiceLifetime::INHERIT) Register a service provider with the container, optionally specifying which of its services to bind or ignore (see {@see ContainerInterface::provider()}) |
32: | * @method static ContainerInterface providers(array<class-string,class-string> $serviceMap, ServiceLifetime::* $lifetime = ServiceLifetime::INHERIT) Register a service map with the container (see {@see ContainerInterface::providers()}) |
33: | * @method static ContainerInterface removeInstance(class-string $id) Remove a shared instance from the container |
34: | * @method static void setGlobalContainer(ContainerInterface|null $container) Set or unset the global container |
35: | * @method static ContainerInterface singleton(class-string $id, class-string|null $class = null, mixed[] $args = []) Bind a shared service to the container (see {@see ContainerInterface::singleton()}) |
36: | * @method static ContainerInterface singletonIf(class-string $id, class-string|null $class = null, mixed[] $args = []) Bind a shared service to the container if it isn't already bound |
37: | * @method static ContainerInterface unbind(class-string $id) Remove a binding from the container |
38: | * @method static ContainerInterface withEach(iterable<mixed,mixed> $list, callable(static, mixed, mixed): static $callback) Move to the next method in the chain after applying a callback to the object with each item in a list |
39: | * |
40: | * @api |
41: | * |
42: | * @extends AbstractFacade<ContainerInterface> |
43: | * |
44: | * @generated |
45: | */ |
46: | final class App extends AbstractFacade |
47: | { |
48: | /** |
49: | * @internal |
50: | */ |
51: | protected static function getService() |
52: | { |
53: | return [ |
54: | ContainerInterface::class => Container::class, |
55: | ]; |
56: | } |
57: | } |
58: |