Issues (3627)

app/bundles/CoreBundle/Helper/TemplatingHelper.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2016 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\CoreBundle\Helper;
13
14
use Mautic\CoreBundle\Templating\TemplateNameParser;
15
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
16
use Symfony\Component\DependencyInjection\Container;
17
use Symfony\Component\HttpKernel\Kernel;
18
19
class TemplatingHelper
20
{
21
    /**
22
     * @var Container
23
     */
24
    protected $container;
25
26
    public function __construct(Kernel $kernel)
27
    {
28
        $this->container = $kernel->getContainer();
29
    }
30
31
    /**
32
     * Retrieve the templating service.
33
     *
34
     * @return DelegatingEngine
35
     *
36
     *  @throws \Exception
37
     */
38
    public function getTemplating()
39
    {
40
        return $this->container->get('templating');
41
    }
42
43
    /**
44
     * @return TemplateNameParser
45
     */
46
    public function getTemplateNameParser()
47
    {
48
        return new TemplateNameParser($this->container->get('kernel'));
0 ignored issues
show
It seems like $this->container->get('kernel') can also be of type null; however, parameter $kernel of Mautic\CoreBundle\Templa...meParser::__construct() does only seem to accept Symfony\Component\HttpKernel\KernelInterface, 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

48
        return new TemplateNameParser(/** @scrutinizer ignore-type */ $this->container->get('kernel'));
Loading history...
49
    }
50
}
51