[ Index ]

MailPress 7.2

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

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/ -> UsAsciiReader.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   * Analyzes US-ASCII characters.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
  17  {
  18      /**
  19       * Returns the complete character map.
  20       *
  21       * @param string $string
  22       * @param int    $startOffset
  23       * @param array  $currentMap
  24       * @param string $ignoredChars
  25       *
  26       * @return int
  27       */
  28      public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
  29      {
  30          $strlen = strlen($string);
  31          $ignoredChars = '';
  32          for ($i = 0; $i < $strlen; ++$i) {
  33              if ($string[$i] > "\x07F") {
  34                  // Invalid char
  35                  $currentMap[$i + $startOffset] = $string[$i];
  36              }
  37          }
  38  
  39          return $strlen;
  40      }
  41  
  42      /**
  43       * Returns mapType.
  44       *
  45       * @return int mapType
  46       */
  47      public function getMapType()
  48      {
  49          return self::MAP_TYPE_INVALID;
  50      }
  51  
  52      /**
  53       * Returns an integer which specifies how many more bytes to read.
  54       *
  55       * A positive integer indicates the number of more bytes to fetch before invoking
  56       * this method again.
  57       * A value of zero means this is already a valid character.
  58       * A value of -1 means this cannot possibly be a valid character.
  59       *
  60       * @param string $bytes
  61       * @param int    $size
  62       *
  63       * @return int
  64       */
  65      public function validateByteSequence($bytes, $size)
  66      {
  67          $byte = reset($bytes);
  68          if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
  69              return 0;
  70          }
  71  
  72          return -1;
  73      }
  74  
  75      /**
  76       * Returns the number of bytes which should be read to start each character.
  77       *
  78       * @return int
  79       */
  80      public function getInitialByteSize()
  81      {
  82          return 1;
  83      }
  84  }


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