CustomsBilling   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 42.86 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 9
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A paid_by() 9 11 4

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
 * Created by PhpStorm.
4
 * User: Ocean
5
 * Date: 8/25/2016
6
 * Time: 11:32 PM.
7
 */
8
9
namespace OceanApplications\Postmen\Models;
10
11
class CustomsBilling extends Billing
12
{
13
    /**
14
     * @param string $value shipper or third_party
15
     *
16
     * @throws \Exception
17
     *
18
     * @return $this
19
     */
20 View Code Duplication
    public function paid_by($value)
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...
21
    {
22
        if ($value == 'shipper' || $value == 'third_party' || $value == 'recipient') {
23
            $this->paid_by = $value;
24
        } else {
25
            $error = 'Paid by must be shipper or third_party';
26
            throw new \Exception($error);
27
        }
28
29
        return $this;
30
    }
31
}
32