PhpProperty   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

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