|
1
|
|
|
<?php |
|
2
|
|
|
namespace Michaels\Manager; |
|
3
|
|
|
|
|
4
|
|
|
use ArrayAccess; |
|
5
|
|
|
use Countable; |
|
6
|
|
|
use Interop\Container\ContainerInterface; |
|
7
|
|
|
use IteratorAggregate; |
|
8
|
|
|
use JsonSerializable; |
|
9
|
|
|
use Michaels\Manager\Contracts\ChainsNestedItemsInterface; |
|
10
|
|
|
use Michaels\Manager\Contracts\LoadsFilesInterface; |
|
11
|
|
|
use Michaels\Manager\Contracts\ManagesIocInterface; |
|
12
|
|
|
use Michaels\Manager\Contracts\ManagesItemsInterface; |
|
13
|
|
|
use Michaels\Manager\Traits\ArrayableTrait; |
|
14
|
|
|
use Michaels\Manager\Traits\ChainsNestedItemsTrait; |
|
15
|
|
|
use Michaels\Manager\Traits\LoadsFilesTrait; |
|
16
|
|
|
use Michaels\Manager\Traits\ManagesIocTrait; |
|
17
|
|
|
use Michaels\Manager\Traits\ManagesItemsTrait; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Manages deeply nested, complex data. |
|
21
|
|
|
* |
|
22
|
|
|
* This manager class does it all, and is more a proof of concept than anything else. |
|
23
|
|
|
* It manages dependencies, loads files, uses magic methods, is arrayable, and all the rest. |
|
24
|
|
|
* |
|
25
|
|
|
* @package Michaels\Manager |
|
26
|
|
|
*/ |
|
27
|
|
|
class UberManager implements |
|
28
|
|
|
ManagesItemsInterface, |
|
29
|
|
|
ChainsNestedItemsInterface, |
|
30
|
|
|
ManagesIocInterface, |
|
31
|
|
|
LoadsFilesInterface, |
|
32
|
|
|
|
|
33
|
|
|
// Array Access |
|
34
|
|
|
ArrayAccess, |
|
35
|
|
|
Countable, |
|
36
|
|
|
IteratorAggregate, |
|
37
|
|
|
JsonSerializable, |
|
38
|
|
|
|
|
39
|
|
|
// Standards |
|
40
|
|
|
ContainerInterface |
|
41
|
|
|
|
|
42
|
|
|
{ |
|
|
|
|
|
|
43
|
|
|
use ManagesItemsTrait, ChainsNestedItemsTrait, ArrayableTrait, ManagesIocTrait, LoadsFilesTrait; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* The items stored in the manager |
|
47
|
|
|
* @var array $items Items governed by manager |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $items; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Build a new manager instance |
|
53
|
|
|
* @param array $items |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __construct($items = []) |
|
56
|
|
|
{ |
|
57
|
|
|
$this->initManager($items); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|