1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Contract\Container; |
4: | |
5: | /** |
6: | * Service lifetimes relative to the container |
7: | * |
8: | * @api |
9: | */ |
10: | interface ServiceLifetime |
11: | { |
12: | /** |
13: | * A new instance of the class is always created |
14: | */ |
15: | public const TRANSIENT = 1; |
16: | |
17: | /** |
18: | * One instance of the class is created |
19: | */ |
20: | public const SINGLETON = 2; |
21: | |
22: | /** |
23: | * Service lifetime interfaces inherited by the class are honoured |
24: | * |
25: | * Specifically: |
26: | * |
27: | * - If the class does not implement {@see SingletonInterface}, |
28: | * {@see ServiceLifetime::TRANSIENT} applies. |
29: | * - If the class implements {@see SingletonInterface}, |
30: | * {@see ServiceLifetime::SINGLETON} applies. |
31: | */ |
32: | public const INHERIT = 3; |
33: | } |
34: |