AppendagesTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 85.71 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 4
Bugs 3 Features 2
Metric Value
wmc 4
c 4
b 3
f 2
lcom 1
cbo 6
dl 42
loc 49
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testBasic() 10 10 1
A testLateAdded() 10 10 1
A testBasicExisting() 11 11 1
A testLateAddedExisting() 11 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/*
3
 * Copyright (C) 2014 Michael Herold <[email protected]>
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 */
19
20
/**
21
 * Description of AppendagesTest
22
 *
23
 * @author Michael Herold <[email protected]>
24
 */
25
class AppendagesTest extends Helpers
26
{
27
28 View Code Duplication
    public function testBasic()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $doc = new hemio\html\Document(new hemio\html\Str(''));
31
        $doc->addInheritableAppendage('axkdw_sda2', '-lsk3jfl#1-');
32
        $div = new \hemio\html\Div;
33
        $doc->getHtml()->getBody()->addChild($div);
34
35
        $this->assertEquals('-lsk3jfl#1-',
36
                            $div->getInheritableAppendage('axkdw_sda2'));
37
    }
38
39 View Code Duplication
    public function testLateAdded()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
    {
41
        $doc = new hemio\html\Document(new hemio\html\Str(''));
42
        $div = new \hemio\html\Div;
43
        $doc->getHtml()->getBody()->addChild($div);
44
        $doc->addInheritableAppendage('axkdw_sda2', '-lsk3jfl#1-');
45
46
        $this->assertEquals('-lsk3jfl#1-',
47
                            $div->getInheritableAppendage('axkdw_sda2'));
48
    }
49
50 View Code Duplication
    public function testBasicExisting()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $doc = new hemio\html\Document(new hemio\html\Str(''));
53
        $doc->addInheritableAppendage('key', 'overwritten-value');
54
        $div = new \hemio\html\Div;
55
        $div->addInheritableAppendage('key', 'existing-value');
56
        $doc->getHtml()->getBody()->addChild($div);
57
58
        $this->assertEquals('existing-value',
59
                            $div->getInheritableAppendage('key'));
60
    }
61
62 View Code Duplication
    public function testLateAddedExisting()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
    {
64
        $doc = new hemio\html\Document(new hemio\html\Str(''));
65
        $div = new \hemio\html\Div;
66
        $div->addInheritableAppendage('key', 'existing-value');
67
        $doc->getHtml()->getBody()->addChild($div);
68
        $doc->addInheritableAppendage('key', 'overwritten-value');
69
70
        $this->assertEquals('existing-value',
71
                            $div->getInheritableAppendage('key'));
72
    }
73
}
74