Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 10 |
Ratio | 90.91 % |
Changes | 0 |
1 | <?php |
||
43 | View Code Duplication | public function country($value) |
|
|
|||
44 | { |
||
45 | if (in_array($value, $this->acceptedCountries)) { |
||
46 | $this->country = $value; |
||
47 | } else { |
||
48 | $error = 'Country code invalid or not serviceable'; |
||
49 | throw new \Exception($error); |
||
50 | } |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | } |
||
55 |
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.