1 | <?php namespace Arcanedev\LogViewer; |
||
14 | class LogViewer implements LogViewerContract |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Constants |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | * LogViewer Version |
||
23 | */ |
||
24 | const VERSION = '4.6.2'; |
||
25 | |||
26 | /* ----------------------------------------------------------------- |
||
27 | | Properties |
||
28 | | ----------------------------------------------------------------- |
||
29 | */ |
||
30 | |||
31 | /** |
||
32 | * The factory instance. |
||
33 | * |
||
34 | * @var \Arcanedev\LogViewer\Contracts\Utilities\Factory |
||
35 | */ |
||
36 | protected $factory; |
||
37 | |||
38 | /** |
||
39 | * The filesystem instance. |
||
40 | * |
||
41 | * @var \Arcanedev\LogViewer\Contracts\Utilities\Filesystem |
||
42 | */ |
||
43 | protected $filesystem; |
||
44 | |||
45 | /** |
||
46 | * The log levels instance. |
||
47 | * |
||
48 | * @var \Arcanedev\LogViewer\Contracts\Utilities\LogLevels |
||
49 | */ |
||
50 | protected $levels; |
||
51 | |||
52 | /* ----------------------------------------------------------------- |
||
53 | | Constructor |
||
54 | | ----------------------------------------------------------------- |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * Create a new instance. |
||
59 | * |
||
60 | * @param \Arcanedev\LogViewer\Contracts\Utilities\Factory $factory |
||
61 | * @param \Arcanedev\LogViewer\Contracts\Utilities\Filesystem $filesystem |
||
62 | * @param \Arcanedev\LogViewer\Contracts\Utilities\LogLevels $levels |
||
63 | */ |
||
64 | 195 | public function __construct( |
|
73 | |||
74 | /* ----------------------------------------------------------------- |
||
75 | | Getters & Setters |
||
76 | | ----------------------------------------------------------------- |
||
77 | */ |
||
78 | |||
79 | /** |
||
80 | * Get the log levels. |
||
81 | * |
||
82 | * @param bool $flip |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | 105 | public function levels($flip = false) |
|
90 | |||
91 | /** |
||
92 | * Get the translated log levels. |
||
93 | * |
||
94 | * @param string|null $locale |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | 12 | public function levelsNames($locale = null) |
|
102 | |||
103 | /** |
||
104 | * Set the log storage path. |
||
105 | * |
||
106 | * @param string $path |
||
107 | * |
||
108 | * @return self |
||
109 | */ |
||
110 | 6 | public function setPath($path) |
|
116 | |||
117 | /** |
||
118 | * Get the log pattern. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 3 | public function getPattern() |
|
126 | |||
127 | /** |
||
128 | * Set the log pattern. |
||
129 | * |
||
130 | * @param string $date |
||
131 | * @param string $prefix |
||
132 | * @param string $extension |
||
133 | * |
||
134 | * @return self |
||
135 | */ |
||
136 | 3 | public function setPattern( |
|
145 | |||
146 | /* ----------------------------------------------------------------- |
||
147 | | Main Methods |
||
148 | | ----------------------------------------------------------------- |
||
149 | */ |
||
150 | |||
151 | /** |
||
152 | * Get all logs. |
||
153 | * |
||
154 | * @return \Arcanedev\LogViewer\Entities\LogCollection |
||
155 | */ |
||
156 | 3 | public function all() |
|
160 | |||
161 | /** |
||
162 | * Paginate all logs. |
||
163 | * |
||
164 | * @param int $perPage |
||
165 | * |
||
166 | * @return \Illuminate\Pagination\LengthAwarePaginator |
||
167 | */ |
||
168 | 3 | public function paginate($perPage = 30) |
|
172 | |||
173 | /** |
||
174 | * Get a log. |
||
175 | * |
||
176 | * @param string $date |
||
177 | * |
||
178 | * @return \Arcanedev\LogViewer\Entities\Log |
||
179 | */ |
||
180 | 15 | public function get($date) |
|
184 | |||
185 | /** |
||
186 | * Get the log entries. |
||
187 | * |
||
188 | * @param string $date |
||
189 | * @param string $level |
||
190 | * |
||
191 | * @return \Arcanedev\LogViewer\Entities\LogEntryCollection |
||
192 | */ |
||
193 | 9 | public function entries($date, $level = 'all') |
|
197 | |||
198 | /** |
||
199 | * Download a log file. |
||
200 | * |
||
201 | * @param string $date |
||
202 | * @param string|null $filename |
||
203 | * @param array $headers |
||
204 | * |
||
205 | * @return \Symfony\Component\HttpFoundation\BinaryFileResponse |
||
206 | */ |
||
207 | 6 | public function download($date, $filename = null, $headers = []) |
|
217 | |||
218 | /** |
||
219 | * Get logs statistics. |
||
220 | * |
||
221 | * @return array |
||
222 | */ |
||
223 | 33 | public function stats() |
|
227 | |||
228 | /** |
||
229 | * Get logs statistics table. |
||
230 | * |
||
231 | * @param string|null $locale |
||
232 | * |
||
233 | * @return \Arcanedev\LogViewer\Tables\StatsTable |
||
234 | */ |
||
235 | 12 | public function statsTable($locale = null) |
|
239 | |||
240 | /** |
||
241 | * Delete the log. |
||
242 | * |
||
243 | * @param string $date |
||
244 | * |
||
245 | * @return bool |
||
246 | */ |
||
247 | 9 | public function delete($date) |
|
251 | |||
252 | /** |
||
253 | * Clear the log files. |
||
254 | * |
||
255 | * @return bool |
||
256 | */ |
||
257 | 3 | public function clear() |
|
261 | |||
262 | /** |
||
263 | * Get all valid log files. |
||
264 | * |
||
265 | * @return array |
||
266 | */ |
||
267 | 3 | public function files() |
|
271 | |||
272 | /** |
||
273 | * List the log files (only dates). |
||
274 | * |
||
275 | * @return array |
||
276 | */ |
||
277 | 6 | public function dates() |
|
281 | |||
282 | /** |
||
283 | * Get logs count. |
||
284 | * |
||
285 | * @return int |
||
286 | */ |
||
287 | 6 | public function count() |
|
291 | |||
292 | /** |
||
293 | * Get entries total from all logs. |
||
294 | * |
||
295 | * @param string $level |
||
296 | * |
||
297 | * @return int |
||
298 | */ |
||
299 | 6 | public function total($level = 'all') |
|
303 | |||
304 | /** |
||
305 | * Get logs tree. |
||
306 | * |
||
307 | * @param bool $trans |
||
308 | * |
||
309 | * @return array |
||
310 | */ |
||
311 | 3 | public function tree($trans = false) |
|
315 | |||
316 | /** |
||
317 | * Get logs menu. |
||
318 | * |
||
319 | * @param bool $trans |
||
320 | * |
||
321 | * @return array |
||
322 | */ |
||
323 | 3 | public function menu($trans = true) |
|
327 | |||
328 | /* ----------------------------------------------------------------- |
||
329 | | Check Methods |
||
330 | | ----------------------------------------------------------------- |
||
331 | */ |
||
332 | |||
333 | /** |
||
334 | * Determine if the log folder is empty or not. |
||
335 | * |
||
336 | * @return bool |
||
337 | */ |
||
338 | 3 | public function isEmpty() |
|
342 | |||
343 | /* ----------------------------------------------------------------- |
||
344 | | Other Methods |
||
345 | | ----------------------------------------------------------------- |
||
346 | */ |
||
347 | |||
348 | /** |
||
349 | * Get the LogViewer version. |
||
350 | * |
||
351 | * @return string |
||
352 | */ |
||
353 | 36 | public function version() |
|
357 | } |
||
358 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: