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

PhpProperty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 6
ccs 4
cts 4
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 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
16 54
            ->setAccess($access)
17 54
            ->setType($type)
18
        ;
19 54
    }
20
21 38
    public function getPhpDeclaration(): string
22
    {
23 38
        return implode('', [
24 38
            $this->getPhpAccess(),
25 38
            $this->getPhpType(),
26 38
            $this->getAssignmentDeclarator(),
27 38
            $this->getPhpName(),
28 38
            $this->getAssignmentSign(),
29 38
            $this->getPhpValue(),
30 38
            $this->getAssignmentFinishing(),
31 38
            $this->endsWithSemicolon() ? ';' : '',
32
        ]);
33
    }
34
}
35