Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

Service/Rule/LocaleRuleService.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\LeadGenerationBundle\Service\Rule;
4
5
use Kunstmaan\LeadGenerationBundle\Entity\Rule\AbstractRule;
6
use Kunstmaan\LeadGenerationBundle\Service\RuleServiceInterface;
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\RequestStack;
9
10
class LocaleRuleService implements RuleServiceInterface
11
{
12
    /** @var Request */
13
    private $request;
14
15
    /**
16
     * LocaleRuleService constructor.
17
     */
18
    public function __construct(RequestStack $requestStack)
19
    {
20
        $this->request = $requestStack->getCurrentRequest();
21
    }
22
23
    /**
24
     * @return array
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,string>.

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...
25
     */
26
    public function getJsProperties(AbstractRule $rule)
27
    {
28
        return [
29
            'requestlocale' => $this->request->getLocale(),
30
        ];
31
    }
32
}
33