mirror of
https://github.com/friendica/friendica
synced 2025-05-05 10:24:09 +02:00
Fix review points
- Fix headers hierarchy - Improve accessibility: - set mouse pointer - make rows focusable - open on key press - add tooltip with "title" - add role and aria attributes - Rename `ParsedLog` to `ParsedLogLine` - Add docs to `ReversedFileReader`'s implementation of `Iterator`'s methods - Add docs to `ParsedLogIterator`'s implementation of `Iterator`'s methods - Remove unnecessary comment - Add more test for parsing log lines and fix some edge cases - Fix function name in snake-case to camelCase - Remove `DIRECTORY_SEPARATOR`
This commit is contained in:
parent
5520f100b2
commit
7f695197aa
10 changed files with 280 additions and 54 deletions
|
@ -70,6 +70,11 @@ class ReversedFileReader implements \Iterator
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read $size bytes behind last position
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _read($size)
|
||||
{
|
||||
$this->pos -= $size;
|
||||
|
@ -77,6 +82,12 @@ class ReversedFileReader implements \Iterator
|
|||
return fread($this->fh, $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read next line from end of file
|
||||
* Return null if no lines are left to read
|
||||
*
|
||||
* @return ?string
|
||||
*/
|
||||
private function _readline()
|
||||
{
|
||||
$buffer = & $this->buffer;
|
||||
|
@ -91,12 +102,24 @@ class ReversedFileReader implements \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch next line from end and set it as current iterator value.
|
||||
*
|
||||
* @see Iterator::next()
|
||||
* @return void
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
++$this->key;
|
||||
$this->value = $this->_readline();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewind iterator to the first line at the end of file
|
||||
*
|
||||
* @see Iterator::rewind()
|
||||
* @return void
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
if ($this->filesize > 0) {
|
||||
|
@ -108,16 +131,34 @@ class ReversedFileReader implements \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current line number, starting from zero at the end of file
|
||||
*
|
||||
* @see Iterator::key()
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current line
|
||||
*
|
||||
* @see Iterator::current()
|
||||
* @return string
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current iterator value is valid, that is, we readed all lines in files
|
||||
*
|
||||
* @see Iterator::valid()
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return ! is_null($this->value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue