forked from cordoval/MailChimpBundle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Request.php
87 lines (78 loc) · 1.51 KB
/
Request.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
<?php
namespace Jirafe\Bundle\MailChimpBundle;
/**
* Represents a MailChimp API request
*/
class Request
{
protected $method;
protected $params;
/**
* Constructor
*
* @param string $method The API method
* @param array $params An array of params
*/
public function __construct($method, array $params)
{
$this->method = $method;
$this->params = $params;
}
/**
* Defines the method
*
* @param string $method
*/
public function setMethod($method)
{
$this->method = $method;
}
/**
* Returns the method
*
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* Defines the params, the existing params are cleared
*
* @param array $params An array of parameters
*/
public function setParams(array $params)
{
$this->params = $params;
}
/**
* Defines a param
*
* @param string $name The name of the param
* @param string $value The value of the param
*/
public function setParam($name, $value)
{
$this->params[$name] = $value;
}
/**
* Returns a param
*
* @param string $name
*
* @return string
*/
public function getParam($name)
{
return $this->params[$name];
}
/**
* Returns all the params
*
* @return array
*/
public function getParams()
{
return $this->params;
}
}