Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

LocaleRuleService::getJsProperties()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
     * @param RequestStack $requestStack
19
     */
20
    public function __construct(RequestStack $requestStack)
21
    {
22
        $this->request = $requestStack->getCurrentRequest();
23
    }
24
25
    /**
26
     * @param AbstractRule $rule
27
     *
28
     * @return array
0 ignored issues
show
Documentation introduced by
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...
29
     */
30
    public function getJsProperties(AbstractRule $rule)
31
    {
32
        return array(
33
            'requestlocale' => $this->request->getLocale(),
34
        );
35
    }
36
}
37