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

PhpFunctionParameter::getAssignmentSign()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
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, ' '], '', var_export($value, true));
31
        }
32
33 44
        return parent::getAnyValue($value);
34
    }
35
}
36