UnusedParameterArgvTicket14990109Test   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 53.33 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 16
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRuleDoesNotApplyToFunctionParameterNamedArgv() 8 8 1
A testRuleDoesNotApplyToMethodParameterNamedArgv() 8 8 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
 * This file is part of PHP Mess Detector.
4
 *
5
 * Copyright (c) Manuel Pichler <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * Licensed under BSD License
9
 * For full copyright and license information, please see the LICENSE file.
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @author Manuel Pichler <[email protected]>
13
 * @copyright Manuel Pichler. All rights reserved.
14
 * @license https://opensource.org/licenses/bsd-license.php BSD License
15
 * @link http://phpmd.org/
16
 */
17
18
namespace PHPMD\Regression;
19
20
use PHPMD\Rule\UnusedFormalParameter;
21
use PHPMD\RuleSet;
22
23
/**
24
 * Regression test for issue 14990109.
25
 *
26
 * @link       https://www.pivotaltracker.com/story/show/14990109
27
 * @since      1.1.0
28
 *
29
 * @covers \stdClass
30
 */
31
class UnusedParameterArgvTicket14990109Test extends AbstractTest
32
{
33
    /**
34
     * testRuleDoesNotApplyToFunctionParameterNamedArgv
35
     *
36
     * @return void
37
     */
38 View Code Duplication
    public function testRuleDoesNotApplyToFunctionParameterNamedArgv()
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...
39
    {
40
        $ruleSet = new RuleSet();
41
        $ruleSet->addRule(new UnusedFormalParameter());
42
        $ruleSet->setReport($this->getReportMock(0));
43
44
        $ruleSet->apply($this->getFunction());
45
    }
46
47
    /**
48
     * testRuleDoesNotApplyToMethodParameterNamedArgv
49
     *
50
     * @return void
51
     */
52 View Code Duplication
    public function testRuleDoesNotApplyToMethodParameterNamedArgv()
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...
53
    {
54
        $ruleSet = new RuleSet();
55
        $ruleSet->addRule(new UnusedFormalParameter());
56
        $ruleSet->setReport($this->getReportMock(0));
57
58
        $ruleSet->apply($this->getMethod());
59
    }
60
}
61