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 |
||
| 11 | class TextToSpeech |
||
| 12 | { |
||
| 13 | private $cacheDir = null; |
||
| 14 | private $driver = null; |
||
| 15 | private $voice = 'famale'; |
||
|
|
|||
| 16 | |||
| 17 | private $lines = array(); |
||
| 18 | private $files = array(); |
||
| 19 | |||
| 20 | protected $text = ''; |
||
| 21 | |||
| 22 | public function __construct($options = null) |
||
| 36 | |||
| 37 | View Code Duplication | public function setText($text) |
|
| 46 | |||
| 47 | public function clear() |
||
| 53 | |||
| 54 | public function process() |
||
| 60 | |||
| 61 | private function textToFile($text) |
||
| 87 | |||
| 88 | protected function getTempFile() |
||
| 92 | |||
| 93 | public function getFiles() |
||
| 97 | |||
| 98 | private function getCacheDir() |
||
| 104 | |||
| 105 | private function prepareFileName($text) |
||
| 114 | |||
| 115 | private function prepareUiq($text) |
||
| 119 | } |
||
| 120 |
This check marks private properties in classes that are never used. Those properties can be removed.