1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Core\Facade;
4:
5: use Salient\Contract\Core\Instantiable;
6: use Salient\Contract\Core\Unloadable;
7:
8: /**
9: * @api
10: *
11: * @template TService of Instantiable
12: */
13: interface FacadeAwareInterface
14: {
15: /**
16: * Get an instance to use behind the given facade
17: *
18: * @param class-string<FacadeInterface<TService>> $facade
19: * @return static
20: */
21: public function withFacade(string $facade);
22:
23: /**
24: * Get an instance to use independently of the given facade
25: *
26: * If `$unloading` is `true`:
27: *
28: * - the facade is being unloaded
29: * - the instance returned by this method will be removed from the facade
30: * - if the instance also implements {@see Unloadable}, the facade will call
31: * its {@see Unloadable::unload()} method before it is removed
32: *
33: * @param class-string<FacadeInterface<TService>> $facade
34: * @return static
35: */
36: public function withoutFacade(string $facade, bool $unloading);
37: }
38: