Method   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 8
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 78
ccs 18
cts 18
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 3 1
A setParent() 0 8 2
A getParent() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A getTraitName() 0 4 1
A setTraitName() 0 5 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