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