1 | <?php |
||
20 | class Request implements RequestInterface |
||
21 | { |
||
22 | private $resource; |
||
23 | private $urlBuilder; |
||
24 | private $factory; |
||
25 | |||
26 | private $options = array( |
||
27 | CURLOPT_HTTPHEADER => array(), |
||
28 | CURLOPT_RETURNTRANSFER => true, |
||
29 | CURLOPT_SSL_VERIFYPEER => false, |
||
30 | CURLOPT_TIMEOUT => 600, |
||
31 | CURLOPT_HEADER => true |
||
32 | ); |
||
33 | |||
34 | private $responseFormat = 'application/json'; |
||
35 | |||
36 | 11 | public function __construct(ResourceInterface $resource, UrlBuilderInterface $urlBuilder, FactoryInterface $factory) |
|
37 | { |
||
38 | 11 | $this->resource = $resource; |
|
39 | 11 | $this->urlBuilder = $urlBuilder; |
|
40 | 11 | $this->factory = $factory; |
|
41 | 11 | } |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | * |
||
46 | * @return Request |
||
47 | */ |
||
48 | 7 | public function setOptions(array $options) |
|
49 | { |
||
50 | 7 | if (!empty($options)) { |
|
51 | 7 | foreach($options as $index => $value) { |
|
52 | 7 | $this->options[$index] = $value; |
|
53 | 7 | } |
|
54 | 7 | } |
|
55 | |||
56 | 7 | return $this; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | * |
||
62 | * @return array |
||
63 | */ |
||
64 | 2 | public function getOptions() |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | * |
||
72 | * @deprecated Soundcloud does not support XML responses anymore. |
||
73 | * @see https://github.com/njasm/soundcloud/issues/16 |
||
74 | * |
||
75 | * @return Request |
||
76 | */ |
||
77 | public function asXml() |
||
78 | { |
||
79 | $this->asJson(); |
||
|
|||
80 | return $this; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | * |
||
86 | * @deprecated Soundcloud does not support XML responses anymore and calling this method is redundant. |
||
87 | * @see https://github.com/njasm/soundcloud/issues/16 |
||
88 | * |
||
89 | * @return Request |
||
90 | */ |
||
91 | 7 | public function asJson() |
|
92 | { |
||
93 | 7 | $this->responseFormat = 'application/json'; |
|
94 | 7 | return $this; |
|
95 | } |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | * |
||
100 | * @return ResponseInterface |
||
101 | */ |
||
102 | 7 | public function exec() |
|
135 | |||
136 | 2 | protected function getBodyContent() |
|
148 | |||
149 | 7 | protected function buildDefaultHeaders() |
|
176 | |||
177 | /** |
||
178 | * @return string the User-Agent string |
||
179 | */ |
||
180 | 8 | public function getUserAgent() |
|
189 | } |
||
190 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.