Completed
Push — master ( 4d99f9...0234dd )
by Stefan
02:22
created

CtrlCharater::getMap()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 9.4285
cc 3
eloc 7
nc 3
nop 0
crap 3
1
<?php
2
/**
3
 * @author neun
4
 * @since  2016-07-10
5
 */
6
7
namespace OneSheet;
8
9
/**
10
 * Class CtrlCharater
11
 * @package OneSheet
12
 */
13
class CtrlCharater
14
{
15
    /**
16
     * Build and return the map containing the 39 ASCII
17
     * characters what should be escaped/converted.
18
     *
19
     * @return array
20
     */
21 3
    public static function getMap()
22
    {
23 3
        $map = array();
24 3
        foreach (range(0,255) as $int) {
25 3
            if (ctype_cntrl(chr($int))) {
26 3
                $map['from'][] = chr($int);
27 3
                $map['to'][] = sprintf('_x%04s_', strtoupper(dechex($int)));
28 3
            }
29 3
        }
30
31 3
        return $map;
32
    }
33
}