| 1 | <?php |
||
| 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): int |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Returns mapType. |
||
| 44 | * |
||
| 45 | * @return int mapType |
||
| 46 | */ |
||
| 47 | public function getMapType(): int |
||
| 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 | 3 | public function validateByteSequence($bytes, $size): int |
|
| 66 | { |
||
| 67 | 3 | $byte = reset($bytes); |
|
| 68 | if ( |
||
| 69 | 3 | 1 === count($bytes) |
|
| 70 | 3 | && |
|
| 71 | $byte >= 0x00 |
||
| 72 | 3 | && |
|
| 73 | $byte <= 0x7F |
||
| 74 | 3 | ) { |
|
| 75 | 1 | return 0; |
|
| 76 | } |
||
| 77 | |||
| 78 | 2 | return -1; |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Returns the number of bytes which should be read to start each character. |
||
| 83 | * |
||
| 84 | * @return int |
||
| 85 | */ |
||
| 86 | public function getInitialByteSize(): int |
||
| 90 | } |
||
| 91 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.