Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 100 % |
Changes | 0 |
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 |
||
24 | View Code Duplication | trait Encryption |
|
|
|||
25 | { |
||
26 | |||
27 | /** |
||
28 | * The PGP key file URL. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $encryption = null; |
||
33 | |||
34 | |||
35 | /** |
||
36 | * Set the encryption. |
||
37 | * |
||
38 | * @param string $encryption |
||
39 | * |
||
40 | * @return SecurityTxt |
||
41 | */ |
||
42 | public function setEncryption(string $encryption): SecurityTxt |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Get the encryption. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getEncryption(): string |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Determines if encryption is valid. |
||
65 | * |
||
66 | * @param string $encryption |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function validEncryption(string $encryption): bool |
||
76 |
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.