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

CtrlCharater   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMap() 0 12 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
}