PhpFunctionParameter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnyValue() 0 7 2
A getPhpDeclaration() 0 3 1
A __construct() 0 4 1
A endsWithSemicolon() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\PhpGenerator\Element;
6
7
class PhpFunctionParameter extends PhpVariable implements TypeHintedElementInterface
8
{
9
    use TypeHintedElementTrait;
10
11 76
    public function __construct(string $name, $value = null, $type = null)
12
    {
13 76
        parent::__construct($name, $value);
14 76
        $this->setType($type);
15 76
    }
16
17 70
    public function getPhpDeclaration(): string
18
    {
19 70
        return sprintf('%s%s', $this->getPhpType(), parent::getPhpDeclaration());
20
    }
21
22 70
    public function endsWithSemicolon(): bool
23
    {
24 70
        return false;
25
    }
26
27 46
    protected function getAnyValue($value): string
28
    {
29 46
        if (is_array($value)) {
30 2
            return str_replace([self::BREAK_LINE_CHAR, ' '], '', parent::getAnyValue($value));
31
        }
32
33 44
        return parent::getAnyValue($value);
34
    }
35
}
36