Method::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the ClassGeneration package.
5
 *
6
 * (c) Antonio Spinelli <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ClassGeneration\Composition;
13
14
use ClassGeneration\Element\ElementAbstract;
15
use ClassGeneration\Element\ElementInterface;
16
use ClassGeneration\PhpClass;
17
18
/**
19
 * Composition Method ClassGeneration
20
 * @author Antonio Spinelli <[email protected]>
21
 */
22
abstract class Method extends ElementAbstract implements MethodInterface
23
{
24
25
    /**
26
     * The class name.
27
     * @var string
28
     */
29
    protected $name;
30
31
    /**
32
     * @var string
33
     */
34
    protected $traitName;
35
36
    /**
37
     * @inheritdoc
38
     */
39 22
    public function init()
40
    {
41 22
    }
42
43
    /**
44
     * @inheritdoc
45
     * @return Method
46
     */
47 3
    public function setParent(ElementInterface $parent)
48
    {
49 3
        if (!$parent instanceof PhpClass) {
50 1
            throw new \InvalidArgumentException('Only accept instances from ClassGeneration\PhpClass');
51
        }
52
53 2
        return parent::setParent($parent);
54
    }
55
56
    /**
57
     * @inheritdoc
58
     * @return PhpClass
59
     */
60 1
    public function getParent()
61
    {
62 1
        return parent::getParent();
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68 22
    public function setName($name)
69
    {
70 22
        $this->name = (string)$name;
71
72 22
        return $this;
73
    }
74
75
    /**
76
     * @inheritdoc
77
     */
78 14
    public function getName()
79
    {
80 14
        return $this->name;
81
    }
82
83
    /**
84
     * @inheritdoc
85
     */
86 11
    public function getTraitName()
87
    {
88 11
        return $this->traitName;
89
    }
90
91
    /**
92
     * @inheritdoc
93
     */
94 22
    public function setTraitName($traitName)
95
    {
96 22
        $this->traitName = $traitName;
97 22
        return $this;
98
    }
99
}
100