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 | ||
| 7 | class LDAPDebugController extends ContentController | ||
|  | |||
| 8 | { | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @var array | ||
| 12 | */ | ||
| 13 | private static $allowed_actions = array( | ||
| 14 | 'index', | ||
| 15 | ); | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @var array | ||
| 19 | */ | ||
| 20 | private static $dependencies = array( | ||
| 21 | 'ldapService' => '%$LDAPService' | ||
| 22 | ); | ||
| 23 | |||
| 24 | /** | ||
| 25 | * @var LDAPService | ||
| 26 | */ | ||
| 27 | public $ldapService; | ||
| 28 | |||
| 29 | public function init() | ||
| 37 | |||
| 38 | /** | ||
| 39 | * @param SS_HTTPRequest $request | ||
| 40 | * | ||
| 41 | * @return string | ||
| 42 | */ | ||
| 43 |     public function index(\SS_HTTPRequest $request) { | ||
| 46 | |||
| 47 | public function Options() | ||
| 58 | |||
| 59 | View Code Duplication | public function UsersSearchLocations() | |
| 75 | |||
| 76 | View Code Duplication | public function GroupsSearchLocations() | |
| 92 | |||
| 93 | public function DefaultGroup() | ||
| 110 | |||
| 111 | public function MappedGroups() | ||
| 115 | |||
| 116 | View Code Duplication | public function Nodes() | |
| 127 | |||
| 128 | View Code Duplication | public function Groups() | |
| 139 | |||
| 140 | public function Users() | ||
| 144 | } | ||
| 145 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.