Completed
Pull Request — master (#244)
by Łukasz
11:47
created

RequestStackWorker   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A mount() 0 6 2
1
<?php
2
3
namespace FSi\Bundle\AdminBundle\Factory\Worker;
4
5
use Doctrine\Common\Persistence\ManagerRegistry;
6
use FSi\Bundle\AdminBundle\Admin\Element;
7
use FSi\Bundle\AdminBundle\Admin\RequestStackAware;
8
use FSi\Bundle\AdminBundle\Factory\Worker;
9
use Symfony\Component\HttpFoundation\RequestStack;
10
11
class RequestStackWorker implements Worker
12
{
13
    /**
14
     * @var RequestStack
15
     */
16
    private $requestStack;
17
18
    /**
19
     * @param RequestStack $requestStack
20
     */
21
    function __construct(RequestStack $requestStack)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
22
    {
23
        $this->requestStack = $requestStack;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function mount(Element $element)
30
    {
31
        if ($element instanceof RequestStackAware) {
32
            $element->setRequestStack($this->requestStack);
33
        }
34
    }
35
}
36