-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathServiceProvider.php
50 lines (43 loc) · 1.08 KB
/
ServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
namespace Dhii\Container;
use Interop\Container\ServiceProviderInterface;
use Psr\Container\ContainerInterface;
/**
* A value object capable of providing services.
*
* @psalm-type Factory = callable(ContainerInterface): mixed
* @psalm-type Extension = callable(ContainerInterface, mixed): mixed
*/
class ServiceProvider implements ServiceProviderInterface
{
/** @var callable[] */
protected array $factories;
/**
* @var callable[]
*/
protected array $extensions;
/**
* @param callable[] $factories A map of service name to service factory.
* @param callable[] $extensions A map of service name to service extension.
*/
public function __construct(array $factories, array $extensions)
{
$this->factories = $factories;
$this->extensions = $extensions;
}
/**
* {@inheritDoc}
*/
public function getFactories()
{
return $this->factories;
}
/**
* {@inheritDoc}
*/
public function getExtensions()
{
return $this->extensions;
}
}