NewsHolderController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A atom() 0 9 1
A rss() 0 9 1
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