1 | <?php namespace Arcanedev\LogViewer\Entities; |
||
14 | class LogCollection extends LazyCollection |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Properties |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** @var \Arcanedev\LogViewer\Contracts\Utilities\Filesystem */ |
||
22 | private $filesystem; |
||
23 | |||
24 | /* ----------------------------------------------------------------- |
||
25 | | Constructor |
||
26 | | ----------------------------------------------------------------- |
||
27 | */ |
||
28 | |||
29 | /** |
||
30 | * LogCollection constructor. |
||
31 | * |
||
32 | * @param mixed $source |
||
33 | */ |
||
34 | 114 | public function __construct($source = null) |
|
47 | |||
48 | /* ----------------------------------------------------------------- |
||
49 | | Getters & Setters |
||
50 | | ----------------------------------------------------------------- |
||
51 | */ |
||
52 | |||
53 | /** |
||
54 | * Set the filesystem instance. |
||
55 | * |
||
56 | * @param \Arcanedev\LogViewer\Contracts\Utilities\Filesystem $filesystem |
||
57 | * |
||
58 | * @return \Arcanedev\LogViewer\Entities\LogCollection |
||
59 | */ |
||
60 | 114 | public function setFilesystem(FilesystemContract $filesystem) |
|
66 | |||
67 | /* ----------------------------------------------------------------- |
||
68 | | Main Methods |
||
69 | | ----------------------------------------------------------------- |
||
70 | */ |
||
71 | |||
72 | /** |
||
73 | * Get a log. |
||
74 | * |
||
75 | * @param string $date |
||
76 | * @param mixed|null $default |
||
77 | * |
||
78 | * @return \Arcanedev\LogViewer\Entities\Log |
||
79 | * |
||
80 | * @throws \Arcanedev\LogViewer\Exceptions\LogNotFoundException |
||
81 | */ |
||
82 | 30 | public function get($date, $default = null) |
|
89 | |||
90 | /** |
||
91 | * Paginate logs. |
||
92 | * |
||
93 | * @param int $perPage |
||
94 | * |
||
95 | * @return \Illuminate\Pagination\LengthAwarePaginator |
||
96 | */ |
||
97 | 4 | public function paginate($perPage = 30) |
|
110 | |||
111 | /** |
||
112 | * Get a log (alias). |
||
113 | * |
||
114 | * @see get() |
||
115 | * |
||
116 | * @param string $date |
||
117 | * |
||
118 | * @return \Arcanedev\LogViewer\Entities\Log |
||
119 | */ |
||
120 | 14 | public function log($date) |
|
124 | |||
125 | |||
126 | /** |
||
127 | * Get log entries. |
||
128 | * |
||
129 | * @param string $date |
||
130 | * @param string $level |
||
131 | * |
||
132 | * @return \Arcanedev\LogViewer\Entities\LogEntryCollection |
||
133 | */ |
||
134 | 14 | public function entries($date, $level = 'all') |
|
138 | |||
139 | /** |
||
140 | * Get logs statistics. |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | 30 | public function stats() |
|
155 | |||
156 | /** |
||
157 | * List the log files (dates). |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | 8 | public function dates() |
|
165 | |||
166 | /** |
||
167 | * Get entries total. |
||
168 | * |
||
169 | * @param string $level |
||
170 | * |
||
171 | * @return int |
||
172 | */ |
||
173 | 10 | public function total($level = 'all') |
|
179 | |||
180 | /** |
||
181 | * Get logs tree. |
||
182 | * |
||
183 | * @param bool $trans |
||
184 | * |
||
185 | * @return array |
||
186 | */ |
||
187 | 8 | public function tree($trans = false) |
|
198 | |||
199 | /** |
||
200 | * Get logs menu. |
||
201 | * |
||
202 | * @param bool $trans |
||
203 | * |
||
204 | * @return array |
||
205 | */ |
||
206 | 8 | public function menu($trans = true) |
|
217 | } |
||
218 |