Skip to content

Commit 09ef630

Browse files
committed
fix return types
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent ad94c68 commit 09ef630

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/Controller/LogController.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use OCA\LogReader\Log\SearchFilter;
2626
use OCP\AppFramework\Controller;
2727
use OCP\AppFramework\Http\JSONResponse;
28-
use OCP\AppFramework\Http\TemplateResponse;
2928
use OCP\IConfig;
3029
use OCP\IRequest;
3130

@@ -53,16 +52,16 @@ public function __construct($appName,
5352
* @param int $count
5453
* @param int $offset
5554
* @param string $levels
56-
* @return TemplateResponse
55+
* @return JSONResponse
5756
*/
58-
public function get($count = 50, $offset = 0, $levels = '11111') {
59-
$logType = $this->config->getSystemValue('log_type','file');
57+
public function get($count = 50, $offset = 0, $levels = '11111'): JSONResponse {
58+
$logType = $this->config->getSystemValue('log_type', 'file');
6059
if ($logType === 'file') { // we only support web access when `log_type` is set to `file` (the default)
6160
$iterator = $this->logIteratorFactory->getLogIterator($levels);
6261
return $this->responseFromIterator($iterator, $count, $offset);
6362
} else { // A log_type other than `file` seems to be configured so:
64-
// * Generate a dummy entry so we don't error out
65-
// * Use the dummy entry to inform the admin to look elsewhere and/or correct their configuration
63+
// * Generate a dummy entry so we don't error out
64+
// * Use the dummy entry to inform the admin to look elsewhere and/or correct their configuration
6665
$dummyLine["id"] = uniqid();
6766
$dummyLine["reqid"] = "00000000000000000000"; // irrelevant
6867
$dummyLine["level"] = 1; // INFO
@@ -113,7 +112,7 @@ public function poll(string $lastReqId, string $levels = '11111'): JSONResponse
113112
$cycles = 0;
114113
$maxCycles = 20;
115114

116-
$logType = $this->config->getSystemValue('log_type','file');
115+
$logType = $this->config->getSystemValue('log_type', 'file');
117116
if ($logType !== 'file') { // we only support access when `log_type` is set to `file` (the default)
118117
// TODO: Don't even attempt polling in the front-end
119118
sleep(20);
@@ -156,11 +155,11 @@ public function poll(string $lastReqId, string $levels = '11111'): JSONResponse
156155
* @param int $count
157156
* @param int $offset
158157
* @param string $levels
159-
* @return TemplateResponse
158+
* @return JSONResponse
160159
*
161160
* @NoCSRFRequired
162161
*/
163-
public function search($query = '', $count = 50, $offset = 0, $levels = '11111') {
162+
public function search($query = '', $count = 50, $offset = 0, $levels = '11111'): JSONResponse {
164163
$iterator = $this->logIteratorFactory->getLogIterator($levels);
165164
$iterator = new \LimitIterator($iterator, 0, 100000); // limit the number of message we search to avoid huge search times
166165
$iterator->rewind();
@@ -221,7 +220,7 @@ public function setLevels(string $levels): int {
221220
return $minLevel;
222221
}
223222

224-
protected function responseFromIterator(\Iterator $iterator, $count, $offset) {
223+
protected function responseFromIterator(\Iterator $iterator, $count, $offset): JSONResponse {
225224
$iterator->rewind();
226225
for ($i = 0; $i < $offset; $i++) {
227226
$iterator->next();

0 commit comments

Comments
 (0)