MethodRowParameter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Saxulum\PhpDocGenerator;
4
5
class MethodRowParameter
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $var;
11
12
    /**
13
     * @var string|null
14
     */
15
    protected $type;
16
17
    /**
18
     * @param string      $var
19
     * @param string|null $type
20
     */
21
    public function __construct($var, $type = null)
22
    {
23
        $this->var = $var;
24
        $this->type = $type;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function __toString()
31
    {
32
        if (null !== $this->type) {
33
            return $this->type.' $'.$this->var;
34
        }
35
36
        return '$'.$this->var;
37
    }
38
}
39