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 Failed
Push — master ( 6a0f46...ee4e74 )
by Matthias
03:03
created

EndToEndTestHelper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Webfactory\ShortcodeBundle\Test;
4
5
use Symfony\Component\DependencyInjection\ContainerInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpFoundation\RequestStack;
8
use Thunder\Shortcode\Processor\Processor;
9
10
/**
11
 * Helper class that you can use in functional (end-to-end) tests to verify that a given
12
 * content with shortcodes is processed as expected.
13
 */
14
class EndToEndTestHelper
15
{
16
    /**
17
     * @var Processor
18
     */
19
    private $processor;
20
21
    /**
22
     * @var RequestStack
23
     */
24
    private $requestStack;
25
26
    public static function createFromContainer(ContainerInterface $container): self
27
    {
28
        return new self($container->get(Processor::class), $container->get(RequestStack::class));
0 ignored issues
show
Bug introduced by
It seems like $container->get(Symfony\...on\RequestStack::class) can also be of type null; however, parameter $requestStack of Webfactory\ShortcodeBund...stHelper::__construct() does only seem to accept Symfony\Component\HttpFoundation\RequestStack, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        return new self($container->get(Processor::class), /** @scrutinizer ignore-type */ $container->get(RequestStack::class));
Loading history...
Bug introduced by
It seems like $container->get(Thunder\...essor\Processor::class) can also be of type null; however, parameter $processor of Webfactory\ShortcodeBund...stHelper::__construct() does only seem to accept Thunder\Shortcode\Processor\Processor, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        return new self(/** @scrutinizer ignore-type */ $container->get(Processor::class), $container->get(RequestStack::class));
Loading history...
29
    }
30
31
    public function __construct(Processor $processor, RequestStack $requestStack)
32
    {
33
        $this->processor = $processor;
34
        $this->requestStack = $requestStack;
35
    }
36
37
    public function processShortcode(string $shortcode): string
38
    {
39
        // The fragment handler used by EmbeddedShortcodeHandler requires a request to be active, so let's make sure that is the case
40
        if (null === $this->requestStack->getCurrentRequest()) {
41
            $this->requestStack->push(new Request());
42
        }
43
44
        return $this->processor->process($shortcode);
45
    }
46
}
47