XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
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 
11 //@require 'Swift/CharacterReader.php';
12 
20  implements Swift_CharacterReader
21 {
29  public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
30  {
31  $strlen=strlen($string);
32  $ignoredChars='';
33  for( $i = 0; $i < $strlen; ++$i)
34  {
35  if ($string[$i]>"\x07F")
36  { // Invalid char
37  $currentMap[$i+$startOffset]=$string[$i];
38  }
39  }
40  return $strlen;
41  }
42 
47  public function getMapType()
48  {
49  return self::MAP_TYPE_INVALID;
50  }
51 
61  public function validateByteSequence($bytes, $size)
62  {
63  $byte = reset($bytes);
64  if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F)
65  {
66  return 0;
67  }
68  else
69  {
70  return -1;
71  }
72  }
73 
78  public function getInitialByteSize()
79  {
80  return 1;
81  }
82 
83 }