| 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\HasServiceLifetime; |
| 8: | use Salient\Contract\Core\Chainable; |
| 9: | use Closure; |
| 10: | |
| 11: | /** |
| 12: | * A facade for the global service container |
| 13: | * |
| 14: | * @method static ContainerInterface addContextualBinding(class-string[]|class-string $context, class-string|non-empty-string $id, (Closure(ContainerInterface): object)|class-string|(object)|null $class = null) Add a contextual binding to the container (see {@see ContainerInterface::addContextualBinding()}) |
| 15: | * @method static ContainerInterface apply(callable(ContainerInterface): ContainerInterface $callback) Move to the next method in the chain after applying a callback to the object |
| 16: | * @method static ContainerInterface applyForEach(iterable<mixed,mixed> $items, callable(ContainerInterface, mixed, mixed): ContainerInterface $callback) Move to the next method in the chain after applying a callback to the object for each item in an array or iterator |
| 17: | * @method static ContainerInterface applyIf((callable(ContainerInterface): bool)|bool $condition, (callable(ContainerInterface): ContainerInterface)|null $then = null, (callable(ContainerInterface): ContainerInterface)|null $else = null) Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::applyIf()}) |
| 18: | * @method static ContainerInterface bind(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null) Bind a service to the container (see {@see ContainerInterface::bind()}) |
| 19: | * @method static ContainerInterface bindIf(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null) Bind a service to the container if it isn't already bound |
| 20: | * @method static object get(class-string $id, mixed[] $args = []) Resolve a service from the container (see {@see ContainerInterface::get()}) |
| 21: | * @method static object getAs(class-string $id, class-string $service, mixed[] $args = []) Resolve a partially-resolved service from the container (see {@see ContainerInterface::getAs()}) |
| 22: | * @method static class-string getClass(class-string $id) Resolve a service from the container without returning an instance (see {@see ContainerInterface::getClass()}) |
| 23: | * @method static ContainerInterface getGlobalContainer() Get the global container, creating it if necessary |
| 24: | * @method static array<class-string> getProviders() Get a list of service providers registered with the container |
| 25: | * @method static bool has(class-string $id) Check if a service is bound to the container (see {@see ContainerInterface::has()}) |
| 26: | * @method static bool hasGlobalContainer() Check if the global container is set |
| 27: | * @method static bool hasInstance(class-string $id) Check if a service resolves to a shared instance |
| 28: | * @method static bool hasProvider(class-string $provider) Check if a service provider is registered with the container |
| 29: | * @method static bool hasSingleton(class-string $id) Check if a shared service or instance is bound to the container |
| 30: | * @method static ContainerInterface inContextOf(class-string $id) Apply contextual bindings to a copy of the container |
| 31: | * @method static ContainerInterface instance(class-string $id, object $instance) Bind a shared instance to the container |
| 32: | * @method static ContainerInterface provider(class-string $provider, class-string[]|null $services = null, class-string[] $excludeServices = [], ContainerInterface::* $providerLifetime = ContainerInterface::LIFETIME_INHERIT) Register a service provider with the container, optionally specifying which of its services to bind or ignore (see {@see ContainerInterface::provider()}) |
| 33: | * @method static ContainerInterface providers(array<class-string|int,class-string> $providers, ContainerInterface::* $providerLifetime = ContainerInterface::LIFETIME_INHERIT) Register an array that maps services (usually interfaces) to service providers (classes that extend or implement the mapped service) (see {@see ContainerInterface::providers()}) |
| 34: | * @method static ContainerInterface removeInstance(class-string $id) Remove a shared instance from the container |
| 35: | * @method static void setGlobalContainer(ContainerInterface|null $container) Set or unset the global container (see {@see ContainerInterface::setGlobalContainer()}) |
| 36: | * @method static ContainerInterface singleton(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null) Bind a shared service to the container (see {@see ContainerInterface::singleton()}) |
| 37: | * @method static ContainerInterface singletonIf(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null) Bind a shared service to the container if it isn't already bound |
| 38: | * |
| 39: | * @api |
| 40: | * |
| 41: | * @extends Facade<ContainerInterface> |
| 42: | * |
| 43: | * @generated |
| 44: | */ |
| 45: | final class App extends Facade implements HasServiceLifetime |
| 46: | { |
| 47: | /** |
| 48: | * @internal |
| 49: | */ |
| 50: | protected static function getService() |
| 51: | { |
| 52: | return [ |
| 53: | ContainerInterface::class, |
| 54: | Container::class, |
| 55: | ]; |
| 56: | } |
| 57: | } |
| 58: |