Passed
Push — develop ( 6b3bb3...b964e0 )
by Mikaël
01:53 queued 11s
created

PhpVariable   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 38
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getAssignmentFinishing() 0 3 1
A getAssignmentDeclarator() 0 3 1
A __construct() 0 4 1
A endsWithSemicolon() 0 3 1
A getAssignmentSign() 0 3 2
A getAcceptNonScalarValue() 0 3 1
A getChildrenTypes() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\PhpGenerator\Element;
6
7
class PhpVariable extends AbstractElement implements AssignedValueElementInterface
8
{
9
    use AssignedValueElementTrait;
10
11 156
    public function __construct(string $name, $value = null)
12
    {
13 156
        parent::__construct($name);
14 156
        $this->setValue($value);
15 156
    }
16
17 132
    public function getAssignmentDeclarator(): string
18
    {
19 132
        return '$';
20
    }
21
22 132
    public function getAssignmentSign(): string
23
    {
24 132
        return $this->hasValue() ? ' = ' : '';
25
    }
26
27 132
    public function getAssignmentFinishing(): string
28
    {
29 132
        return '';
30
    }
31
32 156
    public function getAcceptNonScalarValue(): bool
33
    {
34 156
        return true;
35
    }
36
37 6
    public function getChildrenTypes(): array
38
    {
39 6
        return [];
40
    }
41
42 82
    public function endsWithSemicolon(): bool
43
    {
44 82
        return true;
45
    }
46
}
47