This repository was archived by the owner on May 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCachingContainer.php
98 lines (85 loc) · 2.57 KB
/
CachingContainer.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace Dhii\Di;
use ArrayAccess;
use stdClass;
use Psr\Container\ContainerInterface as BaseContainerInterface;
use Dhii\Data\Container\CreateContainerExceptionCapableTrait;
use Dhii\Exception\CreateInvalidArgumentExceptionCapableTrait;
use Dhii\Exception\CreateOutOfRangeExceptionCapableTrait;
use Dhii\Exception\CreateRuntimeExceptionCapableTrait;
use Dhii\Exception\CreateInternalExceptionCapableTrait;
use Dhii\Invocation\CreateInvocationExceptionCapableTrait;
use Dhii\Validation\CreateValidationFailedExceptionCapableTrait;
use Dhii\I18n\StringTranslatingTrait;
use Dhii\Cache\ContainerInterface as CacheContainerInterface;
use Dhii\Util\Normalization\NormalizeIntCapableTrait;
/**
* A basic DI container.
*
* Will resolve callable definitions, and cache the result.
*
* @since [*next-version*]
*/
class CachingContainer extends AbstractBaseCachingContainer
{
/*
* Basic ability to i18n strings.
*
* @since [*next-version*]
*/
use StringTranslatingTrait;
/* Ability to normalize into an integer.
*
* @since [*next-version*]
*/
use NormalizeIntCapableTrait;
/* Factory of Validation Failed exception.
*
* @since [*next-version*]
*/
use CreateValidationFailedExceptionCapableTrait;
/* Factory of Runtime exception.
*
* @since [*next-version*]
*/
use CreateRuntimeExceptionCapableTrait;
/* Factory of Invalid Argument exception.
*
* @since [*next-version*]
*/
use CreateInvalidArgumentExceptionCapableTrait;
/* Factory of Out of Range exception.
*
* @since [*next-version*]
*/
use CreateOutOfRangeExceptionCapableTrait;
/* Factory of Invocation exception.
*
* @since [*next-version*]
*/
use CreateInvocationExceptionCapableTrait;
/* Factory of Internal exception.
*
* @since [*next-version*]
*/
use CreateInternalExceptionCapableTrait;
/* Factory of CachingContainer exception.
*
* @since [*next-version*]
*/
use CreateContainerExceptionCapableTrait;
/**
* @since [*next-version*]
*
* @param array|ArrayAccess|stdClass|BaseContainerInterface $services The services container.
* @param CacheContainerInterface $serviceCache The cache for resolved services.
*/
public function __construct($services, CacheContainerInterface $serviceCache)
{
if (is_array($services)) {
$services = (object) $services;
}
$this->_setDataStore($services);
$this->_setServiceCache($serviceCache);
}
}