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.
Test Setup Failed
Push — master ( aeed96...e25155 )
by Malte
03:19
created

GuideController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
eloc 13
c 2
b 0
f 0
dl 0
loc 54
rs 10
ccs 0
cts 13
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A detailAction() 0 17 4
A listAction() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace Webfactory\ShortcodeBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
0 ignored issues
show
Bug introduced by
The type Sensio\Bundle\FrameworkE...\Configuration\Template was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
8
9
/**
10
 * Guide for the configured shortcodes showing a list overview and detail pages with the rendered shortcode.
11
 */
12
final class GuideController
13
{
14
    /**
15
     * @var array
16
     *
17
     * Example structure: [
18
     *     [
19
     *         'shortcode' => 'img'
20
     *         'example' (optional key) => '[img src="https://upload.wikimedia.org/wikipedia/en/f/f7/RickRoll.png"]'
21
     *         'description' (optional key) => 'Embeds the imgage located at {src}.'
22
     *     ]
23
     * ]
24
     */
25
    private $shortcodeTags;
26
27
    public function __construct(array $shortcodeTags)
28
    {
29
        $this->shortcodeTags = $shortcodeTags;
30
    }
31
32
    /**
33
     * @Template(template="@WebfactoryShortcode/Guide/list.html.twig")
34
     *
35
     * @return array
36
     */
37
    public function listAction()
38
    {
39
        return [
40
            'shortcodeTags' => $this->shortcodeTags,
41
        ];
42
    }
43
44
    /**
45
     * @Template(template="@WebfactoryShortcode/Guide/detail.html.twig")
46
     *
47
     * @return array
48
     */
49
    public function detailAction($shortcode, Request $request)
50
    {
51
        foreach ($this->shortcodeTags as $shortcodeTag) {
52
            if ($shortcodeTag['shortcode'] === $shortcode) {
53
                // if custom parameters are provided, replace the example
54
                $customParameters = $request->get('customParameters');
55
                if ($customParameters) {
56
                    $shortcodeTag['example'] = $shortcode.' '.$customParameters;
57
                }
58
59
                return [
60
                    'shortcodeTag' => $shortcodeTag,
61
                ];
62
            }
63
        }
64
65
        throw new NotFoundHttpException();
66
    }
67
}
68