TYPO3  7.6
UsAsciiReader.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 {
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 
47  public function getMapType()
48  {
49  return self::MAP_TYPE_INVALID;
50  }
51 
65  public function validateByteSequence($bytes, $size)
66  {
67  $byte = reset($bytes);
68  if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
69  return 0;
70  } else {
71  return -1;
72  }
73  }
74 
80  public function getInitialByteSize()
81  {
82  return 1;
83  }
84 }