Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 9 |
Ratio | 81.82 % |
Changes | 0 |
1 | <?php |
||
20 | View Code Duplication | public function paid_by($value) |
|
|
|||
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 |
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.