NewsHolderController::atom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
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
    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('CWP\\CWP\\PageTypes\\NewsHolder_rss');
23
        return $rss->outputToBrowser();
24
    }
25
26
    public function atom()
27
    {
28
        $atom = CwpAtomFeed::create(
29
            $this->Updates()->sort('Created DESC')->limit(20),
30
            $this->Link('atom'),
31
            $this->getSubscriptionTitle()
32
        );
33
        $atom->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_atom');
34
        return $atom->outputToBrowser();
35
    }
36
}
37