| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 70.37 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
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 |
||
| 8 | class NewsHolderController extends DatedUpdateHolderController |
||
| 9 | { |
||
| 10 | private static $allowed_actions = [ |
||
|
|
|||
| 11 | 'rss', |
||
| 12 | 'atom', |
||
| 13 | ]; |
||
| 14 | |||
| 15 | View Code Duplication | public function rss() |
|
| 16 | { |
||
| 17 | $rss = RSSFeed::create( |
||
| 18 | $this->Updates()->sort('Created DESC')->limit(20), |
||
| 19 | $this->Link('rss'), |
||
| 20 | $this->getSubscriptionTitle() |
||
| 21 | ); |
||
| 22 | $rss->setTemplate('NewsHolder_rss'); |
||
| 23 | return $rss->outputToBrowser(); |
||
| 24 | } |
||
| 25 | |||
| 26 | View Code Duplication | public function atom() |
|
| 35 | } |
||
| 36 | } |
||
| 37 |