Lua   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 34
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 3 1
A deserialize() 0 4 1
1
<?php
2
3
namespace Vlaswinkel\Lua;
4
5
/**
6
 * Class Lua
7
 *
8
 * @author  Koen Vlaswinkel <[email protected]>
9
 * @package Vlaswinkel\Lua
10
 */
11
class Lua {
12
    public static $luaKeywords = [
13
        'and',
14
        'break',
15
        'do',
16
        'else',
17
        'elseif',
18
        'end',
19
        'false',
20
        'for',
21
        'function',
22
        'if',
23
        'in',
24
        'local',
25
        'nil',
26
        'not',
27
        'or',
28
        'repeat',
29
        'return',
30
        'then',
31
        'true',
32
        'until',
33
        'while',
34
    ];
35
36
    public static function serialize($data) {
37
        return Serializer::encode($data);
38
    }
39
40
    public static function deserialize($data) {
41
        $parser = new Parser(new TokenStream(new InputStream($data)));
42
        return LuaToPhpConverter::convertToPhpValue($parser->parse());
43
    }
44
}