TYPO3  7.6
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 
17 {
23  private $_log = array();
24 
30  private $_size = 0;
31 
37  public function __construct($size = 50)
38  {
39  $this->_size = $size;
40  }
41 
47  public function add($entry)
48  {
49  $this->_log[] = $entry;
50  while (count($this->_log) > $this->_size) {
51  array_shift($this->_log);
52  }
53  }
54 
58  public function clear()
59  {
60  $this->_log = array();
61  }
62 
68  public function dump()
69  {
70  return implode(PHP_EOL, $this->_log);
71  }
72 }