TYPO3  7.6
SimpleKeyCacheInputStream.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 {
19  private $_keyCache;
20 
22  private $_nsKey;
23 
25  private $_itemKey;
26 
28  private $_writeThrough = null;
29 
35  public function setKeyCache(Swift_KeyCache $keyCache)
36  {
37  $this->_keyCache = $keyCache;
38  }
39 
46  {
47  $this->_writeThrough = $is;
48  }
49 
56  public function write($bytes, Swift_InputByteStream $is = null)
57  {
58  $this->_keyCache->setString(
59  $this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND
60  );
61  if (isset($is)) {
62  $is->write($bytes);
63  }
64  if (isset($this->_writeThrough)) {
65  $this->_writeThrough->write($bytes);
66  }
67  }
68 
72  public function commit()
73  {
74  }
75 
79  public function bind(Swift_InputByteStream $is)
80  {
81  }
82 
86  public function unbind(Swift_InputByteStream $is)
87  {
88  }
89 
94  public function flushBuffers()
95  {
96  $this->_keyCache->clearKey($this->_nsKey, $this->_itemKey);
97  }
98 
104  public function setNsKey($nsKey)
105  {
106  $this->_nsKey = $nsKey;
107  }
108 
114  public function setItemKey($itemKey)
115  {
116  $this->_itemKey = $itemKey;
117  }
118 
123  public function __clone()
124  {
125  $this->_writeThrough = null;
126  }
127 }