[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ -> SimpleKeyCacheInputStream.php (source)

   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  
  11  /**
  12   * Writes data to a KeyCache using a stream.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream
  17  {
  18      /** The KeyCache being written to */
  19      private $keyCache;
  20  
  21      /** The nsKey of the KeyCache being written to */
  22      private $nsKey;
  23  
  24      /** The itemKey of the KeyCache being written to */
  25      private $itemKey;
  26  
  27      /** A stream to write through on each write() */
  28      private $writeThrough = null;
  29  
  30      /**
  31       * Set the KeyCache to wrap.
  32       */
  33      public function setKeyCache(Swift_KeyCache $keyCache)
  34      {
  35          $this->keyCache = $keyCache;
  36      }
  37  
  38      /**
  39       * Specify a stream to write through for each write().
  40       */
  41      public function setWriteThroughStream(Swift_InputByteStream $is)
  42      {
  43          $this->writeThrough = $is;
  44      }
  45  
  46      /**
  47       * Writes $bytes to the end of the stream.
  48       *
  49       * @param string                $bytes
  50       * @param Swift_InputByteStream $is    optional
  51       */
  52      public function write($bytes, Swift_InputByteStream $is = null)
  53      {
  54          $this->keyCache->setString(
  55              $this->nsKey, $this->itemKey, $bytes, Swift_KeyCache::MODE_APPEND
  56              );
  57          if (isset($is)) {
  58              $is->write($bytes);
  59          }
  60          if (isset($this->writeThrough)) {
  61              $this->writeThrough->write($bytes);
  62          }
  63      }
  64  
  65      /**
  66       * Not used.
  67       */
  68      public function commit()
  69      {
  70      }
  71  
  72      /**
  73       * Not used.
  74       */
  75      public function bind(Swift_InputByteStream $is)
  76      {
  77      }
  78  
  79      /**
  80       * Not used.
  81       */
  82      public function unbind(Swift_InputByteStream $is)
  83      {
  84      }
  85  
  86      /**
  87       * Flush the contents of the stream (empty it) and set the internal pointer
  88       * to the beginning.
  89       */
  90      public function flushBuffers()
  91      {
  92          $this->keyCache->clearKey($this->nsKey, $this->itemKey);
  93      }
  94  
  95      /**
  96       * Set the nsKey which will be written to.
  97       *
  98       * @param string $nsKey
  99       */
 100      public function setNsKey($nsKey)
 101      {
 102          $this->nsKey = $nsKey;
 103      }
 104  
 105      /**
 106       * Set the itemKey which will be written to.
 107       *
 108       * @param string $itemKey
 109       */
 110      public function setItemKey($itemKey)
 111      {
 112          $this->itemKey = $itemKey;
 113      }
 114  
 115      /**
 116       * Any implementation should be cloneable, allowing the clone to access a
 117       * separate $nsKey and $itemKey.
 118       */
 119      public function __clone()
 120      {
 121          $this->writeThrough = null;
 122      }
 123  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1