Passed
Push — feature/issue-11 ( b7a9d0 )
by Mikaël
03:18
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 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