Skip to content

Commit

Permalink
fix return types
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed May 10, 2023
1 parent ad94c68 commit 0932289
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Controller/LogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ public function __construct($appName,
* @param int $count
* @param int $offset
* @param string $levels
* @return TemplateResponse
* @return JSONResponse
*/
public function get($count = 50, $offset = 0, $levels = '11111') {
public function get($count = 50, $offset = 0, $levels = '11111'): JSONResponse {
$logType = $this->config->getSystemValue('log_type','file');
if ($logType === 'file') { // we only support web access when `log_type` is set to `file` (the default)
$iterator = $this->logIteratorFactory->getLogIterator($levels);
return $this->responseFromIterator($iterator, $count, $offset);
} else { // A log_type other than `file` seems to be configured so:
// * Generate a dummy entry so we don't error out
// * Use the dummy entry to inform the admin to look elsewhere and/or correct their configuration
// * Generate a dummy entry so we don't error out
// * Use the dummy entry to inform the admin to look elsewhere and/or correct their configuration
$dummyLine["id"] = uniqid();
$dummyLine["reqid"] = "00000000000000000000"; // irrelevant
$dummyLine["level"] = 1; // INFO
Expand Down Expand Up @@ -156,11 +156,11 @@ public function poll(string $lastReqId, string $levels = '11111'): JSONResponse
* @param int $count
* @param int $offset
* @param string $levels
* @return TemplateResponse
* @return JSONResponse
*
* @NoCSRFRequired
*/
public function search($query = '', $count = 50, $offset = 0, $levels = '11111') {
public function search($query = '', $count = 50, $offset = 0, $levels = '11111'): JSONResponse {
$iterator = $this->logIteratorFactory->getLogIterator($levels);
$iterator = new \LimitIterator($iterator, 0, 100000); // limit the number of message we search to avoid huge search times
$iterator->rewind();
Expand Down Expand Up @@ -221,7 +221,7 @@ public function setLevels(string $levels): int {
return $minLevel;
}

protected function responseFromIterator(\Iterator $iterator, $count, $offset) {
protected function responseFromIterator(\Iterator $iterator, $count, $offset): JSONResponse {
$iterator->rewind();
for ($i = 0; $i < $offset; $i++) {
$iterator->next();
Expand Down

0 comments on commit 0932289

Please sign in to comment.