PhpVariable::getAssignmentDeclarator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 158
    public function __construct(string $name, $value = null)
12
    {
13 158
        parent::__construct($name);
14 158
        $this->setValue($value);
15 158
    }
16
17 134
    public function getAssignmentDeclarator(): string
18
    {
19 134
        return '$';
20
    }
21
22 134
    public function getAssignmentSign(): string
23
    {
24 134
        return $this->hasValue() ? ' = ' : '';
25
    }
26
27 134
    public function getAssignmentFinishing(): string
28
    {
29 134
        return '';
30
    }
31
32 158
    public function getAcceptNonScalarValue(): bool
33
    {
34 158
        return true;
35
    }
36
37 6
    public function getChildrenTypes(): array
38
    {
39 6
        return [];
40
    }
41
42 84
    public function endsWithSemicolon(): bool
43
    {
44 84
        return true;
45
    }
46
}
47