Failed Conditions
Push — 3.0.9-dev ( 4e695e...ec0f79 )
by chihiro
26:04
created

EventArgs::setRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/*
3
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
25
namespace Eccube\Event;
26
27
28
use Symfony\Component\EventDispatcher\GenericEvent;
29
use Symfony\Component\HttpFoundation\Request;
30
use Symfony\Component\HttpFoundation\Response;
31
32
class EventArgs extends GenericEvent
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
33
{
34
35
    /**
36
     * @var Request
37
     */
38
    private $request;
39
40
    /**
41
     * @var Response
42
     */
43
    private $response;
44
45
    /**
46
     * EventArgs constructor.
47
     * @param array $arguments
0 ignored issues
show
introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
48
     * @param Request $request
49
     */
50 9
    public function __construct(array $arguments = array(), Request $request)
0 ignored issues
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...
Coding Style introduced by
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
51
    {
52
        parent::__construct(null, $arguments);
53 9
        $this->request = $request;
54
    }
55
56
    /**
57
     * @param Request $request
58
     */
59
    public function setRequest(Request $request)
0 ignored issues
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...
60
    {
61
        $this->request = $request;
62
    }
63
64
    /**
65
     * @return Request
66
     */
67
    public function getRequest()
68
    {
69
        return $this->request;
70
    }
71
72
    /**
73
     * @param Response $response
74
     */
75
    public function setResponse(Response $response)
76
    {
77
        $this->response = $response;
78
    }
79
80
    /**
81
     * @return Response
82
     */
83 8
    public function getResponse()
84
    {
85 8
        return $this->response;
86
    }
87
88
}