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.

DefaultController::announceAction()   B
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 14
nc 3
nop 1
1
<?php
2
3
namespace Phase\TakeATicketBundle\Controller;
4
5
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
6
7
class DefaultController extends BaseController
8
{
9
    public function indexAction()
10
    {
11
        $viewParams = $this->defaultViewParams();
12
        $viewParams['freeze'] = $this->getDataStore()->fetchSetting('freeze');
13
        $viewParams['freezeMessage'] = $this->getDataStore()->fetchSetting('freezeMessage');
14
15
        // replace this example code with whatever you need
16
        return $this->render('default/upcoming.html.twig', $viewParams);
17
    }
18
19
    public function songSearchAction()
20
    {
21
        $viewParams = $this->defaultViewParams();
22
        $viewParams['freeze'] = $this->getDataStore()->fetchSetting('freeze');
23
        return $this->render('default/songSearch.html.twig', $viewParams);
24
    }
25
26
    public function announceAction($section)
27
    {
28
        /** @noinspection RealpathInSteamContextInspection */
29
        $rootDir = realpath(__DIR__.'/../../../../'); // FIXME get from Kernel
30
        $announceDir = $rootDir.'/docs/announcements';
31
32
        if (!preg_match('/^\w+$/', $section)) {
33
            throw new NotFoundHttpException(); // don't give access to anything but plain names
34
        }
35
36
        $candidateFile = $announceDir.'/'.$section.'.md';
37
38
        if (!file_exists($candidateFile)) {
39
            throw new NotFoundHttpException();
40
        }
41
42
        $markdown = file_get_contents($candidateFile);
43
44
        return $this->render(
45
            ':default:announce.html.twig',
46
            [
47
                'announcement' => $markdown,
48
                'messageClass' => $section,
49
                'displayOptions' => $this->getDisplayOptions(),
50
            ]
51
        );
52
    }
53
}
54