-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathContext.php
97 lines (81 loc) · 1.62 KB
/
Context.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace Autobus\Bundle\BusBundle;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class Context
{
/**
* @var Request
*/
protected $request;
/**
* @var Response
*/
protected $response;
/**
* @var string
*/
protected $message;
/**
* @param mixed $message
*
* @return Context
*/
public function setMessage($message)
{
$this->message = $message;
return $this;
}
/**
* @return mixed
*/
public function getMessage()
{
return $this->message;
}
/**
* @return array
*/
public function getJsonMessageAsArray()
{
$messageAsArray = json_decode($this->getMessage(), true);
if (!is_array($messageAsArray)) {
return [];
}
return $messageAsArray;
}
/**
* @param \Symfony\Component\HttpFoundation\Response $response
*
* @return Context
*/
public function setResponse($response)
{
$this->response = $response;
return $this;
}
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getResponse()
{
return $this->response;
}
/**
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return Context
*/
public function setRequest($request)
{
$this->request = $request;
return $this;
}
/**
* @return \Symfony\Component\HttpFoundation\Request
*/
public function getRequest()
{
return $this->request;
}
}