1 | <?php |
||
7 | abstract class Manager |
||
8 | { |
||
9 | /** |
||
10 | * Driver aggregator instance. |
||
11 | * |
||
12 | * @var \DeGraciaMathieu\Manager\Aggregator |
||
13 | */ |
||
14 | protected $aggregator; |
||
15 | |||
16 | /** |
||
17 | * Use cached driver cache. |
||
18 | * |
||
19 | * @var boolean |
||
20 | */ |
||
21 | protected $cached = false; |
||
22 | |||
23 | /** |
||
24 | * Create a new Manager instance. |
||
25 | */ |
||
26 | 3 | public function __construct() |
|
30 | |||
31 | /** |
||
32 | * Get the default driver name. |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | abstract public function getDefaultDriver(); |
||
37 | |||
38 | /** |
||
39 | * Get a driver instance. |
||
40 | * |
||
41 | * @param string $name |
||
42 | * @return mixed |
||
43 | */ |
||
44 | 3 | public function driver($name = null) |
|
50 | |||
51 | /** |
||
52 | * Resolve the given driver instance. |
||
53 | * |
||
54 | * @param string $name |
||
55 | * @return mixed |
||
56 | * |
||
57 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverResolutionException |
||
58 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverOverwrittenException |
||
59 | */ |
||
60 | 3 | public function resolve(string $name) |
|
66 | |||
67 | /** |
||
68 | * Make a driver instance. |
||
69 | * |
||
70 | * @param string $name |
||
71 | * @return mixed |
||
72 | * |
||
73 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverResolutionException |
||
74 | */ |
||
75 | 3 | public function make(string $name) |
|
79 | |||
80 | /** |
||
81 | * Make a cached driver instance. |
||
82 | * |
||
83 | * @param string $name |
||
84 | * @return mixed |
||
85 | * |
||
86 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverResolutionException |
||
87 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverOverwrittenException |
||
88 | */ |
||
89 | 1 | public function makeCached(string $name) |
|
100 | |||
101 | /** |
||
102 | * Make a new driver instance. |
||
103 | * |
||
104 | * @param string $name |
||
105 | * @return mixed |
||
106 | * |
||
107 | * @throws \DeGraciaMathieu\Manager\Exceptions\DriverResolutionException |
||
108 | */ |
||
109 | 3 | protected function makeDriverInstance(string $name) |
|
119 | |||
120 | /** |
||
121 | * Dynamically call the default driver instance. |
||
122 | * |
||
123 | * @param string $method |
||
124 | * @param array $parameters |
||
125 | * @return mixed |
||
126 | */ |
||
127 | 1 | public function __call($method, $parameters) |
|
131 | |||
132 | /** |
||
133 | * Dynamically access driver. |
||
134 | * |
||
135 | * @param string $name |
||
136 | * @return mixed |
||
137 | */ |
||
138 | public function __get(string $name) |
||
142 | } |
||
143 |