TableEntryASTNode   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 51
c 0
b 0
f 0
ccs 10
cts 12
cp 0.8333
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 3 1
A getKey() 0 3 1
A getValue() 0 3 1
A hasKey() 0 3 1
1
<?php
2
3
namespace Vlaswinkel\Lua\AST;
4
5
/**
6
 * Class TableEntryASTNode
7
 *
8
 * @author  Koen Vlaswinkel <[email protected]>
9
 * @package Vlaswinkel\Lua\AST
10
 */
11
class TableEntryASTNode extends ASTNode {
12
    const NAME = 'table_entry';
13
14
    /**
15
     * @var ASTNode|null
16
     */
17
    private $key;
18
    /**
19
     * @var ASTNode
20
     */
21
    private $value;
22
23
    /**
24
     * TableEntryASTNode constructor.
25
     *
26
     * @param null|ASTNode $key
27
     * @param ASTNode      $value
28
     */
29 12
    public function __construct(ASTNode $value, ASTNode $key = null) {
30 12
        $this->value = $value;
31 12
        $this->key   = $key;
32 12
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getName() {
38
        return self::NAME;
39
    }
40
41
    /**
42
     * @return null|ASTNode
43
     */
44 7
    public function getKey() {
45 7
        return $this->key;
46
    }
47
48
    /**
49
     * @return ASTNode
50
     */
51 7
    public function getValue() {
52 7
        return $this->value;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58 7
    public function hasKey() {
59 7
        return $this->key !== null;
60
    }
61
}