XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
ArrayLogger.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2004-2009 Chris Corbyn
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
18 {
19 
25  private $_log = array();
26 
32  private $_size = 0;
33 
38  public function __construct($size = 50)
39  {
40  $this->_size = $size;
41  }
42 
47  public function add($entry)
48  {
49  $this->_log[] = $entry;
50  while (count($this->_log) > $this->_size)
51  {
52  array_shift($this->_log);
53  }
54  }
55 
59  public function clear()
60  {
61  $this->_log = array();
62  }
63 
68  public function dump()
69  {
70  return implode(PHP_EOL, $this->_log);
71  }
72 
73 }