Completed
Push — master ( 628046...f549a5 )
by WEBEWEB
02:08
created

RequestTrait::setRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Model;
13
14
use Symfony\Component\HttpFoundation\Request;
15
16
/**
17
 * Request trait.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\CoreBundle\Model
21
 */
22
trait RequestTrait {
23
24
    /**
25
     * Request.
26
     *
27
     * @var Request
28
     */
29
    private $request;
30
31
    /**
32
     * Get the request.
33
     *
34
     * @return Request Returns the request.
35
     */
36
    public function getRequest() {
37
        return $this->request;
38
    }
39
40
    /**
41
     * Set the request.
42
     *
43
     * @param Request $request The request.
44
     */
45
    protected function setRequest(Request $request) {
1 ignored issue
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
46
        $this->request = $request;
47
        return $this;
48
    }
49
50
}
51