PhpProperty::getPhpDeclaration()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 9
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 11
ccs 9
cts 9
cp 1
crap 2
rs 9.9666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\PhpGenerator\Element;
6
7
class PhpProperty extends PhpVariable implements AccessRestrictedElementInterface, TypeHintedElementInterface
8
{
9
    use AccessRestrictedElementTrait;
10
    use TypeHintedElementTrait;
11
12 54
    public function __construct(string $name, $value = null, string $access = self::ACCESS_PUBLIC, $type = null)
13
    {
14 54
        parent::__construct($name, $value);
15
        $this->setType($type);
16 54
        $this->setAccess($access);
17 54
    }
18
19 54
    public function getPhpDeclaration(): string
20
    {
21 38
        return implode('', [
22
            $this->getPhpAccess(),
23 38
            $this->getPhpType(),
24 38
            $this->getAssignmentDeclarator(),
25 38
            $this->getPhpName(),
26 38
            $this->getAssignmentSign(),
27 38
            $this->getPhpValue(),
28 38
            $this->getAssignmentFinishing(),
29 38
            $this->endsWithSemicolon() ? ';' : '',
30 38
        ]);
31 38
    }
32
}
33