| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Class WpStream_Log_Entry |
| 5 |
* |
| 6 |
* Represents a single log entry in the WpStream logging system. |
| 7 |
*/ |
| 8 |
class WpStream_Log_Entry { |
| 9 |
/** |
| 10 |
* The timestamp of the log entry |
| 11 |
* |
| 12 |
* @var int |
| 13 |
*/ |
| 14 |
public $timestamp; |
| 15 |
|
| 16 |
/** |
| 17 |
* The type of the log entry |
| 18 |
* |
| 19 |
* @var string |
| 20 |
*/ |
| 21 |
public $type; |
| 22 |
|
| 23 |
/* |
| 24 |
* The description of the log entry |
| 25 |
* |
| 26 |
* @var string |
| 27 |
*/ |
| 28 |
public $description; |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor of the log entry |
| 32 |
* |
| 33 |
* @param array|null $item Log data |
| 34 |
* |
| 35 |
* @return Wpstream_Log_Entry |
| 36 |
*/ |
| 37 |
|
| 38 |
public function __construct( $item = null ) { |
| 39 |
if ( $item ) { |
| 40 |
$this->timestamp = isset( $item['timestamp'] ) ? (int) $item['timestamp'] : time(); |
| 41 |
$this->type = isset( $item['type'] ) ? $item['type'] : ''; |
| 42 |
$this->description = $item['description']; |
| 43 |
} else { |
| 44 |
$this->timestamp = time(); |
| 45 |
$this->type = ''; |
| 46 |
$this->description = ''; |
| 47 |
} |
| 48 |
} |
| 49 |
} |