1 | <?php |
||
24 | abstract class IntegrationConnections extends Component |
||
25 | { |
||
26 | /** |
||
27 | * The app connection handle |
||
28 | */ |
||
29 | const CONNECTION = 'app'; |
||
30 | |||
31 | /** |
||
32 | * The default connection identifier |
||
33 | */ |
||
34 | const DEFAULT_CONNECTION = 'DEFAULT'; |
||
35 | |||
36 | /** |
||
37 | * The override file |
||
38 | */ |
||
39 | public $overrideFile; |
||
40 | |||
41 | /** |
||
42 | * @var array|null |
||
43 | */ |
||
44 | private $overrides; |
||
45 | |||
46 | /** |
||
47 | * @var array |
||
48 | */ |
||
49 | private $connections = []; |
||
50 | |||
51 | /** |
||
52 | * @var array |
||
53 | */ |
||
54 | private $enabled = []; |
||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | abstract protected static function tableName(): string; |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | abstract protected static function connectionInstance(): string; |
||
65 | |||
66 | /** |
||
67 | * Load override cache configurations |
||
68 | */ |
||
69 | protected function loadOverrides() |
||
79 | |||
80 | /** |
||
81 | * Returns any configurations from the config file. |
||
82 | * |
||
83 | * @param string $handle |
||
84 | * @return array|null |
||
85 | */ |
||
86 | public function getOverrides(string $handle) |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | protected function getDefaultConnection(): string |
||
99 | |||
100 | /** |
||
101 | * @param string $handle |
||
102 | * @throws ConnectionNotFound |
||
103 | */ |
||
104 | protected function handleConnectionNotFound(string $handle) |
||
105 | { |
||
106 | throw new ConnectionNotFound( |
||
107 | sprintf( |
||
108 | "Unable to find connection '%s'.", |
||
109 | $handle |
||
110 | ) |
||
111 | ); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * @param string $handle |
||
116 | * @param bool $enabledOnly |
||
117 | * @return mixed|null |
||
118 | */ |
||
119 | public function find( |
||
158 | |||
159 | /** |
||
160 | * @param string $handle |
||
161 | * @param bool $enabledOnly |
||
162 | * @return mixed |
||
163 | * @throws ConnectionNotFound |
||
164 | */ |
||
165 | public function get( |
||
175 | |||
176 | /** |
||
177 | * @param $config |
||
178 | * @return mixed|null |
||
179 | */ |
||
180 | protected function create(array $config) |
||
203 | |||
204 | /** |
||
205 | * @return array |
||
206 | */ |
||
207 | public function all(): array |
||
231 | } |
||
232 |