1 | <?php |
||
29 | class Provider |
||
30 | { |
||
31 | /** |
||
32 | * @var boolean |
||
33 | */ |
||
34 | private $singleton = true; |
||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $type; |
||
39 | /** |
||
40 | * @var mixed |
||
41 | */ |
||
42 | private $instance; |
||
43 | /** |
||
44 | * @var callable |
||
45 | */ |
||
46 | private $factory; |
||
47 | |||
48 | /** |
||
49 | * @internal |
||
50 | */ |
||
51 | 9 | public function __construct(string $type, $factory, bool $singleton = true) |
|
63 | |||
64 | /** |
||
65 | * Gets the value instance. |
||
66 | * |
||
67 | * @param \Caridea\Container\Container $container The owning container |
||
68 | * @return mixed The value instance |
||
69 | */ |
||
70 | 5 | public function get(Container $container) |
|
83 | |||
84 | /** |
||
85 | * Whether this provider always returns the same instance. |
||
86 | * |
||
87 | * @return bool True if this provider always returns the same instance |
||
88 | */ |
||
89 | 2 | public function isSingleton(): bool |
|
93 | |||
94 | /** |
||
95 | * Gets the type of instance. |
||
96 | * |
||
97 | * @return string gets the type of this instance |
||
98 | */ |
||
99 | 6 | public function getType(): string |
|
103 | } |
||
104 |