1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Core\Concern; |
4: | |
5: | use Salient\Contract\Container\ContainerInterface; |
6: | use Salient\Contract\Core\Buildable; |
7: | use Salient\Contract\Core\BuilderInterface; |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | trait HasBuilder |
21: | { |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | protected static function getBuilder(): string |
28: | { |
29: | |
30: | return static::class . 'Builder'; |
31: | } |
32: | |
33: | |
34: | |
35: | |
36: | final public static function build(?ContainerInterface $container = null): BuilderInterface |
37: | { |
38: | return static::getBuilder()::create($container); |
39: | } |
40: | |
41: | |
42: | |
43: | |
44: | final public static function resolve($object) |
45: | { |
46: | |
47: | return static::getBuilder()::resolve($object); |
48: | } |
49: | } |
50: | |