1 | <?php |
||
12 | class DbConfig |
||
13 | { |
||
14 | /** |
||
15 | * Get the configuration key value pairs from database to merge with config |
||
16 | * |
||
17 | * @return array |
||
18 | */ |
||
19 | public function get(): array |
||
30 | |||
31 | /** |
||
32 | * Get all custom config from database |
||
33 | * |
||
34 | * @return \Illuminate\Database\Eloquent\Collection |
||
35 | */ |
||
36 | public function getCollection(): Collection |
||
40 | |||
41 | /** |
||
42 | * Get Eloquent query to operate on from controller |
||
43 | * |
||
44 | * @return \Illuminate\Database\Eloquent\Builder |
||
45 | */ |
||
46 | public function getQuery(): Builder |
||
50 | |||
51 | /** |
||
52 | * Get flattened array of config files |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getCachedData(): array |
||
71 | |||
72 | /** |
||
73 | * Set a new config to db |
||
74 | * |
||
75 | * @param string $name |
||
76 | * @param mixed $value |
||
77 | * @return \Nzsakib\DbConfig\Models\Configuration |
||
78 | * @throws InvalidArgumentException |
||
79 | */ |
||
80 | public function set(string $name, $value): Configuration |
||
99 | |||
100 | /** |
||
101 | * Update a config by its primary key `id` |
||
102 | * |
||
103 | * @param integer $id |
||
104 | * @param string $name |
||
105 | * @param mixed $newValue |
||
106 | * @return \Nzsakib\DbConfig\Models\Configuration |
||
107 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
108 | */ |
||
109 | public function updateById($id, string $name, $newValue) |
||
121 | |||
122 | /** |
||
123 | * Update configuration by config name |
||
124 | * |
||
125 | * @param string $name |
||
126 | * @param mixed $value |
||
127 | * @return \Nzsakib\DbConfig\Models\Configuration |
||
128 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
129 | */ |
||
130 | public function updateByName(string $name, $value) |
||
141 | |||
142 | /** |
||
143 | * Delete a config from db by name |
||
144 | * |
||
145 | * @param string $name |
||
146 | * @return \Nzsakib\DbConfig\Models\Configuration |
||
147 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
148 | */ |
||
149 | public function deleteByName(string $name): Configuration |
||
159 | |||
160 | /** |
||
161 | * Delete db config by its primary key `id` |
||
162 | * |
||
163 | * @param int $id |
||
164 | * @return Configuration |
||
165 | */ |
||
166 | public function deleteById($id): Configuration |
||
176 | |||
177 | /** |
||
178 | * we dont merge if same key exists in default |
||
179 | * Check each array key if existing configuration exists with same key |
||
180 | * |
||
181 | * @param string $name |
||
182 | * @param string|array $value |
||
183 | * @return void |
||
184 | * @throws InvalidArgumentException |
||
185 | */ |
||
186 | protected function checkExistingDefaultKeys(string $name, $value) |
||
199 | |||
200 | /** |
||
201 | * we allow merging with existing config keys |
||
202 | * 2nd argument must be an associative array when merging with existing config |
||
203 | * |
||
204 | * @param string $name |
||
205 | * @param string|array $value |
||
206 | * @return void |
||
207 | * @throws InvalidArgumentException |
||
208 | */ |
||
209 | protected function mustBeAssociativeArrayWhenMerging(string $name, $value) |
||
215 | |||
216 | /** |
||
217 | * Get Cache key name to store in cache |
||
218 | * |
||
219 | * @return string |
||
220 | */ |
||
221 | protected function cacheKey(): string |
||
225 | |||
226 | /** |
||
227 | * Invalidate the config cache |
||
228 | * |
||
229 | * @return boolean |
||
230 | */ |
||
231 | protected function invalidateCache(): bool |
||
235 | } |
||
236 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.