Completed
Pull Request — master (#13)
by Robbie
02:33
created

NewsHolderController::atom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 9
loc 9
rs 9.6666
c 1
b 0
f 0
1
<?php
2
3
namespace CWP\CWP\PageTypes;
4
5
use CWP\Core\Feed\CwpAtomFeed;
6
use SilverStripe\Control\RSS\RSSFeed;
7
8
class NewsHolderController extends DatedUpdateHolderController
9
{
10
    private static $allowed_actions = [
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
11
        'rss',
12
        'atom',
13
    ];
14
15 View Code Duplication
    public function rss()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        $atom = CwpAtomFeed::create(
29
            $this->Updates()->sort('Created DESC')->limit(20),
30
            $this->Link('atom'),
31
            $this->getSubscriptionTitle()
32
        );
33
        $atom->setTemplate('NewsHolder_atom');
34
        return $atom->outputToBrowser();
35
    }
36
}
37