Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
ByteEncoding | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
parseData | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Pdf\Build\Font\TrueType\Table\Cmap; |
15 | |
16 | use Pop\Pdf\Build\Font; |
17 | |
18 | use Pop\Utils\ArrayObject as Data; |
19 | |
20 | /** |
21 | * CMAP byte-encoding class |
22 | * |
23 | * @category Pop |
24 | * @package Pop\Pdf |
25 | * @author Nick Sagona, III <dev@nolainteractive.com> |
26 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
27 | * @license http://www.popphp.org/license New BSD License |
28 | * @version 5.0.0 |
29 | */ |
30 | class ByteEncoding |
31 | { |
32 | |
33 | /** |
34 | * Method to parse the Byte Encoding (Format 0) CMAP data |
35 | * |
36 | * @param string $data |
37 | * @return array |
38 | */ |
39 | public static function parseData(string $data): array |
40 | { |
41 | $ary = array(); |
42 | |
43 | for ($i = 0; $i < strlen($data); $i++) { |
44 | $ary[$i] = new Data(array( |
45 | 'hex' => bin2hex($data[$i]), |
46 | 'ascii' => ord($data[$i]), |
47 | 'char' => chr(ord($data[$i])) |
48 | )); |
49 | } |
50 | |
51 | return $ary; |
52 | } |
53 | |
54 | } |