<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Object\Log\ParsedLogLine;
/**
- * An iterator which returns `\Friendica\Objec\Log\ParsedLogLine` instances
+ * An iterator which returns `\Friendica\Object\Log\ParsedLogLine` instances
*
* Uses `\Friendica\Util\ReversedFileReader` to fetch log lines
* from newest to oldest.
private $filters = [];
/** @var string search term */
- private $search = "";
+ private $search = '';
/**
$match = true;
foreach ($this->filters as $filter => $filtervalue) {
switch ($filter) {
- case "level":
+ case 'level':
$match = $match && ($parsedlogline->level == strtoupper($filtervalue));
break;
- case "context":
+
+ case 'context':
$match = $match && ($parsedlogline->context == $filtervalue);
break;
}
*/
private function search(ParsedLogLine $parsedlogline): bool
{
- if ($this->search != "") {
+ if ($this->search != '') {
return strstr($parsedlogline->logline, $this->search) !== false;
}
return true;
* Read a line from reader and parse.
* Returns null if limit is reached or the reader is invalid.
*
- * @param ParsedLogLine $parsedlogline
* @return ?ParsedLogLine
*/
private function read()
* @see Iterator::next()
* @return void
*/
- public function next()
+ public function next(): void
{
$parsed = $this->read();
* @see Iterator::rewind()
* @return void
*/
- public function rewind()
+ public function rewind(): void
{
$this->value = null;
$this->reader->rewind();
* @see ReversedFileReader::key()
* @return int
*/
- public function key()
+ public function key(): int
{
return $this->reader->key();
}
* Return current iterator value
*
* @see Iterator::current()
- * @return ?ParsedLogLing
+ * @return ?ParsedLogLine
*/
- public function current()
+ public function current(): ?ParsedLogLine
{
return $this->value;
}
* @see Iterator::valid()
* @return bool
*/
- public function valid()
+ public function valid(): bool
{
- return ! is_null($this->value);
+ return !is_null($this->value);
}
}