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 |
||
33 | class Recordings extends AriClientAware |
||
34 | { |
||
35 | /** |
||
36 | * List recordings that are complete. |
||
37 | * |
||
38 | * @return StoredRecording[] |
||
39 | */ |
||
40 | 1 | View Code Duplication | public function getRecordings() |
52 | |||
53 | /** |
||
54 | * Get a stored recording's details. |
||
55 | * |
||
56 | * @param string $recordingName The name of the recording |
||
57 | * @return StoredRecording |
||
58 | * @throws NotFoundException |
||
59 | */ |
||
60 | 1 | View Code Duplication | public function getRecording($recordingName) |
71 | |||
72 | /** |
||
73 | * Delete a stored recording. |
||
74 | * |
||
75 | * @param string $recordingName The name of the recording |
||
76 | * @return StoredRecording |
||
77 | * @throws NotFoundException |
||
78 | */ |
||
79 | 1 | public function deleteRecording($recordingName) |
|
88 | |||
89 | /** |
||
90 | * Copy a stored recording. |
||
91 | * |
||
92 | * @param string $recordingName The name of the recording to copy |
||
93 | * @param string $destinationRecordingName (required) The destination name of the recording |
||
94 | * @return StoredRecording |
||
95 | * @throws ConflictException |
||
96 | * @throws NotFoundException |
||
97 | */ |
||
98 | 1 | public function copyRecording($recordingName, $destinationRecordingName) |
|
113 | |||
114 | /** |
||
115 | * Get live recording |
||
116 | * |
||
117 | * @param string $recordingName The name of the recording |
||
118 | * @return LiveRecording |
||
119 | * @throws NotFoundException |
||
120 | */ |
||
121 | View Code Duplication | public function getLiveRecording($recordingName) |
|
132 | |||
133 | /** |
||
134 | * Stop a live recording and discard it. |
||
135 | * |
||
136 | * @param string $recordingName The name of the recording |
||
137 | * @throws NotFoundException |
||
138 | */ |
||
139 | public function deleteLiveRecording($recordingName) |
||
148 | |||
149 | /** |
||
150 | * Stop a live recording and discard it. |
||
151 | * |
||
152 | * @param string $recordingName The name of the recording |
||
153 | * @throws NotFoundException |
||
154 | */ |
||
155 | public function cancelLiveRecording($recordingName) |
||
164 | |||
165 | /** |
||
166 | * Stop a live recording and store it. |
||
167 | * |
||
168 | * @param string $recordingName The name of the recording |
||
169 | * @throws NotFoundException |
||
170 | */ |
||
171 | public function stopLiveRecording($recordingName) |
||
180 | |||
181 | /** |
||
182 | * Pause a live recording. Pausing a recording suspends silence detection, which will be restarted |
||
183 | * when the recording is unpaused. Paused time is not included in the accounting for |
||
184 | * maxDurationSeconds. |
||
185 | * |
||
186 | * @param string $recordingName The name of the recording |
||
187 | * @throws ConflictException |
||
188 | * @throws NotFoundException |
||
189 | */ |
||
190 | public function pauseLiveRecording($recordingName) |
||
199 | |||
200 | /** |
||
201 | * Unause a live recording. |
||
202 | * |
||
203 | * @param string $recordingName The name of the recording |
||
204 | * @throws ConflictException |
||
205 | * @throws NotFoundException |
||
206 | */ |
||
207 | public function unpauseLiveRecording($recordingName) |
||
216 | |||
217 | /** |
||
218 | * Mute a live recording. Muting a recording suspends silence detection, which will be restarted when the recording is unmuted. |
||
219 | * |
||
220 | * @param string $recordingName The name of the recording |
||
221 | * @throws ConflictException |
||
222 | * @throws NotFoundException |
||
223 | */ |
||
224 | public function muteLiveRecording($recordingName) |
||
233 | |||
234 | /** |
||
235 | * Unmute a live recording. |
||
236 | * |
||
237 | * @param string $recordingName The name of the recording |
||
238 | * @throws ConflictException |
||
239 | * @throws NotFoundException |
||
240 | */ |
||
241 | public function unmuteLiveRecording($recordingName) |
||
250 | } |
||
251 |