| 1 | <?php |
||
| 7 | abstract class Manager |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Get the default driver name. |
||
| 11 | * |
||
| 12 | * @return string |
||
| 13 | */ |
||
| 14 | abstract public function getDefaultDriver(); |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Dynamically call the default driver instance. |
||
| 18 | * |
||
| 19 | * @param string $method |
||
| 20 | * @param array $parameters |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | 1 | public function __call($method, $parameters) |
|
| 24 | { |
||
| 25 | 1 | return $this->driver()->$method(...$parameters); |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get a driver instance. |
||
| 30 | * |
||
| 31 | * @param string $name |
||
| 32 | * @return mixed |
||
| 33 | * |
||
| 34 | * @throws \InvalidArgumentException |
||
| 35 | */ |
||
| 36 | 2 | public function driver($name = null) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Load a new driver instance. |
||
| 47 | * |
||
| 48 | * @param string $name |
||
| 49 | * @throws \InvalidArgumentException |
||
| 50 | * |
||
| 51 | * @return mixed |
||
| 52 | */ |
||
| 53 | 2 | protected function load(string $name) |
|
| 63 | } |
||
| 64 |