Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

LocaleRuleService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getJsProperties() 0 6 1
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 $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