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.
Passed
Push — master ( d586a6...c7c802 )
by Malte
03:09
created

GuideController::detailAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
namespace Webfactory\ShortcodeBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Symfony\Component\DependencyInjection\Container;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10
11
/**
12
 * Guide for the configured shortcodes showing a list overview and detail pages with the rendered shortcode.
13
 */
14
final class GuideController
15
{
16
    /**
17
     * @var array [
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()
34
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string,array>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
35
     */
36
    public function listAction()
37
    {
38
        return [
39
            'shortcodeTags' => $this->shortcodeTags
40
        ];
41
    }
42
43
    /**
44
     * @Template()
45
     * @return array
46
     */
47
    public function detailAction($shortcode)
48
    {
49
        foreach ($this->shortcodeTags as $shortcodeTag) {
50
            if ($shortcodeTag['shortcode'] === $shortcode) {
51
                return [
52
                    'shortcodeTag' => $shortcodeTag,
53
                ];
54
            }
55
        }
56
57
        throw new NotFoundHttpException();
58
    }
59
}
60