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.
Completed
Push — master ( 23c71a...dcb9a9 )
by Richard
11:04
created

DefaultController::announceAction()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 26
Code Lines 14

Duplication

Lines 26
Ratio 100 %

Importance

Changes 0
Metric Value
dl 26
loc 26
c 0
b 0
f 0
rs 8.8571
cc 3
eloc 14
nc 3
nop 1
1
<?php
2
3
namespace Phase\TakeATicketBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
7
8
class DefaultController extends BaseController
9
{
10
    public function indexAction()
11
    {
12
        $viewParams = $this->defaultViewParams();
13
        $viewParams['freeze'] = $this->getDataStore()->getSetting('freeze');
14
        $viewParams['freezeMessage'] = $this->getDataStore()->getSetting('freezeMessage');
15
16
        // replace this example code with whatever you need
17
        return $this->render('default/upcoming.html.twig', $viewParams);
18
    }
19
20
    public function songSearchAction()
21
    {
22
        $viewParams = $this->defaultViewParams();
23
        $viewParams['freeze'] = $this->getDataStore()->getSetting('freeze');
24
        return $this->render('default/songSearch.html.twig', $viewParams);
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    protected function defaultViewParams()
31
    {
32
        //$protocol = $_SERVER['HTTPS'] ? 'https' : 'http';
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
33
        $protocol = 'http'; // $_SERVER['HTTPS'] ? 'https' : 'http';
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
34
        /**
35
 * @noinspection RealpathInSteamContextInspection
36
*/
37
        $viewParams = [
38
            //'serverInfo' => $protocol . '://' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT'] . '/',
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39
            'serverInfo' => $protocol.'://127.0.0.1:8000/', //FIXME get server name (from config if not in request?)
40
            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
41
        ];
42
        $viewParams['displayOptions'] = $this->getDisplayOptions();
43
44
        return $viewParams;
45
    }
46
47 View Code Duplication
    public function announceAction($section)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        $rootDir = realpath(__DIR__.'/../../../../');
50
        $announceDir = $rootDir.'/docs/announcements';
51
52
        if (!preg_match('/^\w+$/', $section)) {
53
            throw new NotFoundHttpException(); // don't give access to anything but plain names
54
        }
55
56
        $candidateFile = $announceDir.'/'.$section.'.md';
57
58
        if (!file_exists($candidateFile)) {
59
            throw new NotFoundHttpException();
60
        }
61
62
        $markdown = file_get_contents($candidateFile);
63
64
        return $this->render(
65
            ':default:announce.html.twig',
66
            [
67
                'announcement' => $markdown,
68
                'messageClass' => $section,
69
                'displayOptions' => $this->getDisplayOptions(),
70
            ]
71
        );
72
    }
73
}
74