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 |
||
26 | class FirebaseLogs |
||
27 | { |
||
28 | |||
29 | private $logger; |
||
|
|||
30 | |||
31 | private $folderToStoreLog; |
||
32 | /** |
||
33 | */ |
||
34 | public function __construct($folderToStoreLog) |
||
40 | |||
41 | /** |
||
42 | * Write log of current event |
||
43 | * |
||
44 | * @param Logger $logger |
||
45 | * @param array $eventData |
||
46 | * @param mixed $event |
||
47 | * @param string $path |
||
48 | */ |
||
49 | View Code Duplication | public function writeEventLogs($logger, $eventData, $event, $path) |
|
62 | |||
63 | /** |
||
64 | * |
||
65 | * Create logger instance for save stream log |
||
66 | * |
||
67 | * @param string $folderToStoreLog |
||
68 | * @return Logger $logger |
||
69 | */ |
||
70 | View Code Duplication | private function createLogger($folderToStoreLog) |
|
91 | } |
||
92 | |||
93 |
This check marks private properties in classes that are never used. Those properties can be removed.