GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

OnePageExtension::getOnePageContent()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 17
rs 9.9332
cc 4
nc 3
nop 0
1
<?php
2
3
namespace Kmedia\Onepage;
4
5
6
use SilverStripe\CMS\Controllers\ModelAsController;
7
use SilverStripe\CMS\Model\SiteTree;
8
use SilverStripe\ORM\DataExtension;
9
use SilverStripe\View\SSViewer;
10
11
class OnePageExtension extends DataExtension
12
{
13
    public function getOnePageContent()
14
    {
15
        $templateNames = SSViewer::get_templates_by_class(
16
            $this->owner->Classname,
17
            '_onepage',
18
            SiteTree::class
19
        )
20
            ?: ['Page_onepage', 'type' => 'Layout'];
21
22
        foreach ($templateNames as $templateName) {
23
            if (!is_array($templateName)) {
24
                $templateNames[] = [$templateName, 'type' => 'Layout'];
25
            }
26
        }
27
28
        $controller = ModelAsController::controller_for($this->owner);
29
        return $controller->renderWith($templateNames);
30
    }
31
}
32