size = $size; } /** * Add a log entry. * * @param string $entry */ public function add($entry) { $this->log[] = $entry; while (\count($this->log) > $this->size) { array_shift($this->log); } } /** * Clear the log contents. */ public function clear() { $this->log = []; } /** * Get this log as a string. * * @return string */ public function dump() { return implode(PHP_EOL, $this->log); } }