for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
/**
* Saito - The Threaded Web Forum
*
* @copyright Copyright (c) the Saito Project Developers
* @link https://github.com/Schlaefer/Saito
* @license http://opensource.org/licenses/MIT
*/
namespace Admin;
* @bogus the ability to see logs isn't in Saito 5 anymore; see also AdminHelper::formatCakeLog
class CakeLogEntry
{
* Constructor
* @param string $text log entry text
public function __construct($text)
$lines = explode("\n", trim($text));
$_firstLine = array_shift($lines);
preg_match(
'/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (.*?): (.*)/',
$_firstLine,
$matches
);
$this->_time = $matches[1];
_time
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->_type = $matches[2];
_type
$this->_message = trim($matches[3]);
_message
if (empty($this->_message)) {
$this->_message = array_shift($lines);
}
$this->_detail = implode($lines, '<br>');
_detail
* Gets log entry time
* @return string
public function time()
return $this->_time;
* Gets log entry type
public function type()
return $this->_type;
* Gets log entry message
public function message()
return $this->_message;
* Gets log entry details
public function details()
return $this->_detail;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: