XMLGoogleShoppingFeedController::getExtension()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 2
b 0
f 0
1
<?php
2
3
namespace Sunnysideup\EcommerceGoogleShoppingFeed\Controllers;
4
5
use SilverStripe\Core\Config\Config;
6
use SilverStripe\SiteConfig\SiteConfig;
7
8
/**
9
 * Controller for displaying the xml feed.
10
 *
11
 * <code>
12
 * http://site.com/shoppingfeed.xml
13
 * </code>
14
 *
15
 */
16
class XMLGoogleShoppingFeedController extends GoogleShoppingFeedController
17
{
18
    /**
19
     * @var array
20
     */
21
    private static $allowed_actions = [
22
        'index',
23
    ];
24
25
    public function SiteConfig()
26
    {
27
        return SiteConfig::current_site_config();
28
    }
29
30
    public function Items()
31
    {
32
        $apiClassName = Config::inst()->get(GoogleShoppingFeedController::class, 'api_class');
33
        $apiClass = new $apiClassName();
34
35
        return $apiClass->getArrayList();
36
    }
37
38
    protected function getExtension(): string
39
    {
40
        return 'xml';
41
    }
42
43
    protected function getContentType(): string
44
    {
45
        return 'application/xml; charset="utf-8"';
46
    }
47
}
48