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

PhpProperty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 25
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPhpDeclaration() 0 11 2
A __construct() 0 6 1
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