1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Messenger\Curl; |
4
|
|
|
|
5
|
|
|
use Cronario\AbstractJob; |
6
|
|
|
|
7
|
|
|
class Job extends AbstractJob |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
const P_PARAM_URL = 'url'; |
11
|
|
|
const P_PARAM_METHOD = 'method'; |
12
|
|
|
const P_PARAM_REQUEST_PARAMS = 'requestParams'; |
13
|
|
|
const P_PARAM_EXPECT_CONTENT = 'expectContent'; |
14
|
|
|
const P_PARAM_EXPECT_CODE = 'expectCode'; |
15
|
|
|
const P_PARAM_SAVE_CONTENT = 'saveContent'; |
16
|
|
|
const P_PARAM_SAVE_INFO = 'saveInfo'; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @return null |
21
|
|
|
*/ |
22
|
7 |
|
public function getUrl() |
23
|
|
|
{ |
24
|
7 |
|
return $this->getParam(self::P_PARAM_URL); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param $url |
29
|
|
|
* |
30
|
|
|
* @return $this |
31
|
|
|
*/ |
32
|
7 |
|
public function setUrl($url) |
33
|
|
|
{ |
34
|
7 |
|
return $this->setParam(self::P_PARAM_URL, $url); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return null |
39
|
|
|
*/ |
40
|
7 |
|
public function getMethod() |
41
|
|
|
{ |
42
|
7 |
|
return $this->getParam(self::P_PARAM_METHOD); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param $method |
47
|
|
|
* |
48
|
|
|
* @return $this |
49
|
|
|
*/ |
50
|
7 |
|
public function setMethod($method) |
51
|
|
|
{ |
52
|
7 |
|
return $this->setParam(self::P_PARAM_METHOD, $method); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return null|array |
57
|
|
|
*/ |
58
|
6 |
|
public function getRequestParams() |
59
|
|
|
{ |
60
|
6 |
|
return $this->getParam(self::P_PARAM_REQUEST_PARAMS); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param $requestParams |
65
|
|
|
* |
66
|
|
|
* @return $this |
67
|
|
|
*/ |
68
|
1 |
|
public function setRequestParams($requestParams) |
69
|
|
|
{ |
70
|
1 |
|
return $this->setParam(self::P_PARAM_REQUEST_PARAMS, $requestParams); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return null |
75
|
|
|
*/ |
76
|
5 |
|
public function getExpectContent() |
77
|
|
|
{ |
78
|
5 |
|
return $this->getParam(self::P_PARAM_EXPECT_CONTENT); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param $text |
83
|
|
|
* |
84
|
|
|
* @return $this |
85
|
|
|
*/ |
86
|
4 |
|
public function setExpectContent($text) |
87
|
|
|
{ |
88
|
4 |
|
return $this->setParam(self::P_PARAM_EXPECT_CONTENT, $text); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return null |
93
|
|
|
*/ |
94
|
5 |
|
public function getExpectCode() |
95
|
|
|
{ |
96
|
5 |
|
return $this->getParam(self::P_PARAM_EXPECT_CODE); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param $text |
101
|
|
|
* |
102
|
|
|
* @return $this |
103
|
|
|
*/ |
104
|
3 |
|
public function setExpectCode($text) |
105
|
|
|
{ |
106
|
3 |
|
return $this->setParam(self::P_PARAM_EXPECT_CODE, $text); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return null |
111
|
|
|
*/ |
112
|
5 |
|
public function getSaveContent() |
113
|
|
|
{ |
114
|
5 |
|
return $this->getParam(self::P_PARAM_SAVE_CONTENT); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param $boo |
119
|
|
|
* |
120
|
|
|
* @return $this |
121
|
|
|
*/ |
122
|
3 |
|
public function setSaveContent($boo) |
123
|
|
|
{ |
124
|
3 |
|
return $this->setParam(self::P_PARAM_SAVE_CONTENT, $boo); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return null |
129
|
|
|
*/ |
130
|
5 |
|
public function getSaveInfo() |
131
|
|
|
{ |
132
|
5 |
|
return $this->getParam(self::P_PARAM_SAVE_INFO); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @param $boo |
137
|
|
|
* |
138
|
|
|
* @return $this |
139
|
|
|
*/ |
140
|
3 |
|
public function setSaveInfo($boo) |
141
|
|
|
{ |
142
|
3 |
|
return $this->setParam(self::P_PARAM_SAVE_INFO, $boo); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
} |