Completed
Push — master ( 95a6e8...b8af6d )
by Filipe
07:12
created

Parameter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 39
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getId() 0 7 2
1
<?php
2
3
/**
4
 * This file is part of slick/di package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Di\DependencyInspector;
11
12
use ReflectionClass;
13
use Slick\Common\Base;
14
15
/**
16
 * Parameter definition structure
17
 *
18
 * @package Slick\Di\DependencyInspector
19
 * @author  Filipe Silva <[email protected]>
20
 *
21
 * @property string|null $id      The parameter type hint class name
22
 * @property string      $name    Parameter name
23
 * @property bool        $options Parameter optional flag
24
 * @property mixed       $default Default value
25
 *
26
 * @method bool isOptional() Check whenever parameter is optional
27
 */
28
class Parameter extends Base
29
{
30
31
    /**
32
     * @readwrite
33
     * @var string|null
34
     */
35
    protected $id;
36
37
    /**
38
     * @readwrite
39
     * @var string
40
     */
41
    protected $name;
42
43
    /**
44
     * @readwrite
45
     * @var bool
46
     */
47
    protected $optional;
48
49
    /**
50
     * @readwrite
51
     * @var mixed
52
     */
53
    protected $default = null;
54
55
    /**
56
     * Gets
57
     * @return null|string
58
     */
59 28
    public function getId()
60
    {
61 28
        if ($this->id instanceof ReflectionClass) {
62 28
            $this->id = $this->id->getName();
63 28
        }
64 28
        return $this->id;
65
    }
66
}
67