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 |
||
10 | class Jws implements SignerInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var EncryptionInterface |
||
14 | */ |
||
15 | private $encryption; |
||
16 | |||
17 | /** |
||
18 | * @var EncoderInterface |
||
19 | */ |
||
20 | private $encoder; |
||
21 | |||
22 | public function __construct(EncryptionInterface $encryption, EncoderInterface $encoder) |
||
27 | |||
28 | View Code Duplication | public function getUnsignedValue(Token $token) |
|
38 | |||
39 | public function sign(Token $token) |
||
49 | } |
||
50 |