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 |
||
| 17 | class Default_UnavailableSuccessView extends SampleAppDefaultBaseView |
||
| 18 | { |
||
| 19 | public function executeHtml(RequestDataHolder $rd) |
||
| 20 | { |
||
| 21 | $this->setupHtml($rd); |
||
| 22 | |||
| 23 | // set the title |
||
| 24 | $this->setAttribute('_title', $this->tm->_('This Application is Unavailable', 'default.ErrorActions')); |
||
| 25 | |||
| 26 | $this->getResponse()->setHttpStatusCode('503'); |
||
| 27 | } |
||
| 28 | |||
| 29 | } |
||
| 30 | |||
| 31 | ?> |