1 | <?php |
||
28 | class GenericConfiguration implements ConfigurationInterface |
||
29 | { |
||
30 | /** |
||
31 | * The country |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $country; |
||
36 | |||
37 | /** |
||
38 | * The accesskey |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $accessKey; |
||
43 | |||
44 | /** |
||
45 | * The string |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $secretKey; |
||
50 | |||
51 | /** |
||
52 | * The associate Tag |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $associateTag; |
||
57 | |||
58 | /** |
||
59 | * The requestclass |
||
60 | * By default its set to the provided restful request |
||
61 | * |
||
62 | * @var RequestInterface |
||
63 | */ |
||
64 | protected $request; |
||
65 | |||
66 | /** |
||
67 | * The responsetransformerclass |
||
68 | * By default its set to null which means that no transformer will be applied |
||
69 | * |
||
70 | * @var ResponseTransformerInterface |
||
71 | */ |
||
72 | protected $responseTransformer; |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 3 | public function getCountry() |
|
81 | |||
82 | /** |
||
83 | * Sets and validates the country |
||
84 | * |
||
85 | * @param string $country |
||
86 | * |
||
87 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
88 | */ |
||
89 | 4 | public function setCountry($country) |
|
90 | { |
||
91 | 4 | if (!Country::isValidCountry($country)) { |
|
92 | 1 | throw new \InvalidArgumentException( |
|
93 | sprintf( |
||
94 | 1 | "Invalid Country-Code: %s! Possible Country-Codes: %s", |
|
95 | $country, |
||
96 | 1 | implode(', ', Country::getCountries()) |
|
97 | ) |
||
98 | ); |
||
99 | } |
||
100 | |||
101 | 3 | $this->country = strtolower($country); |
|
102 | |||
103 | 3 | return $this; |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 3 | public function getAccessKey() |
|
113 | |||
114 | /** |
||
115 | * Sets the accesskey |
||
116 | * |
||
117 | * @param string $accessKey |
||
118 | * |
||
119 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
120 | */ |
||
121 | 3 | public function setAccessKey($accessKey) |
|
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | 3 | public function getSecretKey() |
|
135 | |||
136 | /** |
||
137 | * Sets the secretkey |
||
138 | * |
||
139 | * @param string $secretKey |
||
140 | * |
||
141 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
142 | */ |
||
143 | 3 | public function setSecretKey($secretKey) |
|
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | 3 | public function getAssociateTag() |
|
157 | |||
158 | /** |
||
159 | * Sets the associatetag |
||
160 | * |
||
161 | * @param string $associateTag |
||
162 | * |
||
163 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
164 | */ |
||
165 | 3 | public function setAssociateTag($associateTag) |
|
171 | |||
172 | /** |
||
173 | * {@inheritdoc} |
||
174 | */ |
||
175 | 3 | public function getRequest() |
|
179 | |||
180 | /** |
||
181 | * Sets the Request. |
||
182 | * |
||
183 | * @param RequestInterface $request |
||
184 | * |
||
185 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
186 | */ |
||
187 | 3 | public function setRequest(RequestInterface $request) |
|
193 | |||
194 | /** |
||
195 | * {@inheritdoc} |
||
196 | */ |
||
197 | 3 | public function getResponseTransformer() |
|
201 | |||
202 | /** |
||
203 | * Sets the ResponseTransformer |
||
204 | * |
||
205 | * @param ResponseTransformerInterface $responseTransformer |
||
206 | * |
||
207 | * @return \ApaiIO\Configuration\GenericConfiguration |
||
208 | */ |
||
209 | 2 | public function setResponseTransformer(ResponseTransformerInterface $responseTransformer) |
|
215 | } |
||
216 |