Update   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadPage() 6 6 1
A savePlan() 7 7 1
A updatePlan() 6 6 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
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\tests\_support\Page\plan;
12
13
use hipanel\helpers\Url;
14
15 View Code Duplication
class Update extends Create
0 ignored issues
show
Duplication introduced by Pavlo
This class 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...
16
{
17
    protected function loadPage()
18
    {
19
        $I = $this->tester;
20
21
        $I->needPage(Url::to(['@plan/update', 'id' => $this->id]));
22
    }
23
24
    protected function savePlan()
25
    {
26
        $I = $this->tester;
27
28
        $I->click('Save');
29
        $I->closeNotification('Plan was successfully updated');
30
    }
31
32
    public function updatePlan($id)
33
    {
34
        $this->id = $id;
35
36
        return $this->createPlan();
37
    }
38
}
39