Passed
Push — feature/issue-11 ( b7a9d0 )
by Mikaël
03:18
created

PhpProperty::getPhpDeclaration()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 1
nop 0
dl 0
loc 11
ccs 10
cts 10
cp 1
crap 2
rs 9.9666
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 52
    public function __construct(string $name, $value = null, string $access = self::ACCESS_PUBLIC, $type = null)
13
    {
14 52
        parent::__construct($name, $value);
15
        $this
16 52
            ->setAccess($access)
17 52
            ->setType($type)
18
        ;
19 52
    }
20
21 36
    public function getPhpDeclaration(): string
22
    {
23 36
        return implode('', [
24 36
            $this->getPhpAccess(),
25 36
            $this->getPhpType(),
26 36
            $this->getAssignmentDeclarator(),
27 36
            $this->getPhpName(),
28 36
            $this->getAssignmentSign(),
29 36
            $this->getPhpValue(),
30 36
            $this->getAssignmentFinishing(),
31 36
            true === $this->endsWithSemicolon() ? ';' : '',
0 ignored issues
show
introduced by
The condition true === $this->endsWithSemicolon() is always true.
Loading history...
32
        ]);
33
    }
34
}
35