ConflictingMethod   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 4
c 4
b 0
f 1
lcom 1
cbo 1
dl 0
loc 49
ccs 19
cts 19
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A setInsteadOf() 0 6 1
A getInsteadOf() 0 4 1
A toString() 0 10 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
/**
15
 * Composition Trait Conflicting Method ClassGeneration
16
 * @author Antonio Spinelli <[email protected]>
17
 */
18
class ConflictingMethod extends Method implements ConflictingMethodInterface
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $insteadOf;
24
25 5
    public function __construct($traitName, $name, $insteadOf)
26
    {
27 5
        $this->setTraitName($traitName);
28 5
        $this->setName($name);
29 5
        $this->setInsteadOf($insteadOf);
30 5
        $this->init();
31 5
    }
32
33
    /**
34
     * @inheritdoc
35
     * @return ConflictingMethod
36
     */
37 5
    public function setInsteadOf($traitName)
38
    {
39 5
        $this->insteadOf = $traitName;
40
41 5
        return $this;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     * @return string
47
     */
48 3
    public function getInsteadOf()
49
    {
50 3
        return $this->insteadOf;
51
    }
52
53
    /**
54
     * @inheritdoc
55
     */
56 3
    public function toString()
57
    {
58 3
        $result = sprintf(
59 3
            '%s::%s insteadof %s;',
60 3
            $this->getTraitName(),
61 3
            $this->getName(),
62 3
            $this->getInsteadOf()
63 3
        );
64 3
        return $result . PHP_EOL;
65
    }
66
}
67