Failed Conditions
Pull Request — master (#191)
by Emanuele
03:09
created
src/FacebookAds/Http/Util.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-abstract class Util
28
-{
27
+abstract class Util {
29 28
     /**
30 29
      * Avoid parse_str() for HHVM compatibility
31 30
      * This implementation is not a complete sobstitute, but covers all the
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
      * @param $query_string
36 35
      * @return array
37 36
      */
38
-    public static function parseUrlQuery($query_string)
39
-    {
37
+    public static function parseUrlQuery($query_string) {
40 38
         $query = array();
41 39
         $pairs = explode('&', $query_string);
42 40
         foreach ($pairs as $pair) {
Please login to merge, or discard this patch.
src/FacebookAds/Http/Client.php 1 patch
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Http\Exception\EmptyResponseException;
31 31
 use FacebookAds\Http\Exception\RequestException;
32 32
 
33
-class Client
34
-{
33
+class Client {
35 34
     /**
36 35
      * @var string
37 36
      */
@@ -75,8 +74,7 @@  discard block
 block discarded – undo
75 74
     /**
76 75
      * @return RequestInterface
77 76
      */
78
-    public function getRequestPrototype()
79
-    {
77
+    public function getRequestPrototype() {
80 78
         if ($this->requestPrototype === null) {
81 79
             $this->requestPrototype = new Request($this);
82 80
         }
@@ -87,24 +85,21 @@  discard block
 block discarded – undo
87 85
     /**
88 86
      * @param RequestInterface $prototype
89 87
      */
90
-    public function setRequestPrototype(RequestInterface $prototype)
91
-    {
88
+    public function setRequestPrototype(RequestInterface $prototype) {
92 89
         $this->requestPrototype = $prototype;
93 90
     }
94 91
 
95 92
     /**
96 93
      * @return RequestInterface
97 94
      */
98
-    public function createRequest()
99
-    {
95
+    public function createRequest() {
100 96
         return $this->getRequestPrototype()->createClone();
101 97
     }
102 98
 
103 99
     /**
104 100
      * @return ResponseInterface
105 101
      */
106
-    public function getResponsePrototype()
107
-    {
102
+    public function getResponsePrototype() {
108 103
         if ($this->responsePrototype === null) {
109 104
             $this->responsePrototype = new Response();
110 105
         }
@@ -115,24 +110,21 @@  discard block
 block discarded – undo
115 110
     /**
116 111
      * @param ResponseInterface $prototype
117 112
      */
118
-    public function setResponsePrototype(ResponseInterface $prototype)
119
-    {
113
+    public function setResponsePrototype(ResponseInterface $prototype) {
120 114
         $this->responsePrototype = $prototype;
121 115
     }
122 116
 
123 117
     /**
124 118
      * @return ResponseInterface
125 119
      */
126
-    public function createResponse()
127
-    {
120
+    public function createResponse() {
128 121
         return clone $this->getResponsePrototype();
129 122
     }
130 123
 
131 124
     /**
132 125
      * @return Headers
133 126
      */
134
-    public function getDefaultRequestHeaderds()
135
-    {
127
+    public function getDefaultRequestHeaderds() {
136 128
         if ($this->defaultRequestHeaders === null) {
137 129
             $this->defaultRequestHeaders = new Headers(array(
138 130
                 'User-Agent' => 'fb-php-ads-'.Api::VERSION,
@@ -146,32 +138,28 @@  discard block
 block discarded – undo
146 138
     /**
147 139
      * @param Headers $headers
148 140
      */
149
-    public function setDefaultRequestHeaders(Headers $headers)
150
-    {
141
+    public function setDefaultRequestHeaders(Headers $headers) {
151 142
         $this->defaultRequestHeaders = $headers;
152 143
     }
153 144
 
154 145
     /**
155 146
      * @return string
156 147
      */
157
-    public function getDefaultGraphBaseDomain()
158
-    {
148
+    public function getDefaultGraphBaseDomain() {
159 149
         return $this->defaultGraphBaseDomain;
160 150
     }
161 151
 
162 152
     /**
163 153
      * @param string $domain
164 154
      */
165
-    public function setDefaultGraphBaseDomain($domain)
166
-    {
155
+    public function setDefaultGraphBaseDomain($domain) {
167 156
         $this->defaultGraphBaseDomain = $domain;
168 157
     }
169 158
 
170 159
     /**
171 160
      * @return AdapterInterface
172 161
      */
173
-    public function getAdapter()
174
-    {
162
+    public function getAdapter() {
175 163
         if ($this->adapter === null) {
176 164
             $this->adapter = new CurlAdapter($this);
177 165
         }
@@ -182,16 +170,14 @@  discard block
 block discarded – undo
182 170
     /**
183 171
      * @param AdapterInterface $adapter
184 172
      */
185
-    public function setAdapter(AdapterInterface $adapter)
186
-    {
173
+    public function setAdapter(AdapterInterface $adapter) {
187 174
         $this->adapter = $adapter;
188 175
     }
189 176
 
190 177
     /**
191 178
      * @return string
192 179
      */
193
-    public function getCaBundlePath()
194
-    {
180
+    public function getCaBundlePath() {
195 181
         if ($this->caBundlePath === null) {
196 182
             $this->caBundlePath = __DIR__.DIRECTORY_SEPARATOR
197 183
                 .str_repeat('..'.DIRECTORY_SEPARATOR, 3)
@@ -204,8 +190,7 @@  discard block
 block discarded – undo
204 190
     /**
205 191
      * @param string $path
206 192
      */
207
-    public function setCaBundlePath($path)
208
-    {
193
+    public function setCaBundlePath($path) {
209 194
         $this->caBundlePath = $path;
210 195
     }
211 196
 
@@ -214,8 +199,7 @@  discard block
 block discarded – undo
214 199
      * @return ResponseInterface
215 200
      * @throws RequestException
216 201
      */
217
-    public function sendRequest(RequestInterface $request)
218
-    {
202
+    public function sendRequest(RequestInterface $request) {
219 203
         $response = $this->getAdapter()->sendRequest($request);
220 204
         $response->setRequest($request);
221 205
         $response_content = $response->getContent();
Please login to merge, or discard this patch.
src/FacebookAds/Http/Headers.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,6 +24,5 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-class Headers extends \ArrayObject
28
-{
27
+class Headers extends \ArrayObject {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Response.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-class Response implements ResponseInterface
28
-{
27
+class Response implements ResponseInterface {
29 28
     /**
30 29
      * @var RequestInterface
31 30
      */
@@ -54,40 +53,35 @@  discard block
 block discarded – undo
54 53
     /**
55 54
      * @return RequestInterface
56 55
      */
57
-    public function getRequest()
58
-    {
56
+    public function getRequest() {
59 57
         return $this->request;
60 58
     }
61 59
 
62 60
     /**
63 61
      * @param RequestInterface $request
64 62
      */
65
-    public function setRequest(RequestInterface $request)
66
-    {
63
+    public function setRequest(RequestInterface $request) {
67 64
         $this->request = $request;
68 65
     }
69 66
 
70 67
     /**
71 68
      * @return int
72 69
      */
73
-    public function getStatusCode()
74
-    {
70
+    public function getStatusCode() {
75 71
         return $this->statusCode;
76 72
     }
77 73
 
78 74
     /**
79 75
      * @param int $status_code
80 76
      */
81
-    public function setStatusCode($status_code)
82
-    {
77
+    public function setStatusCode($status_code) {
83 78
         $this->statusCode = $status_code;
84 79
     }
85 80
 
86 81
     /**
87 82
      * @return Headers
88 83
      */
89
-    public function getHeaders()
90
-    {
84
+    public function getHeaders() {
91 85
         if ($this->headers === null) {
92 86
             $this->headers = new Headers();
93 87
         }
@@ -98,24 +92,21 @@  discard block
 block discarded – undo
98 92
     /**
99 93
      * @param Headers $headers
100 94
      */
101
-    public function setHeaders(Headers $headers)
102
-    {
95
+    public function setHeaders(Headers $headers) {
103 96
         $this->headers = $headers;
104 97
     }
105 98
 
106 99
     /**
107 100
      * @return string
108 101
      */
109
-    public function getBody()
110
-    {
102
+    public function getBody() {
111 103
         return $this->body;
112 104
     }
113 105
 
114 106
     /**
115 107
      * @param string $body
116 108
      */
117
-    public function setBody($body)
118
-    {
109
+    public function setBody($body) {
119 110
         $this->body = $body;
120 111
         $this->content = null;
121 112
     }
@@ -123,8 +114,7 @@  discard block
 block discarded – undo
123 114
     /**
124 115
      * @return array|null
125 116
      */
126
-    public function getContent()
127
-    {
117
+    public function getContent() {
128 118
         if ($this->content === null) {
129 119
             $this->content = json_decode($this->getBody(), true);
130 120
         }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Request.php 1 patch
Braces   +26 added lines, -52 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-class Request implements RequestInterface
28
-{
27
+class Request implements RequestInterface {
29 28
     /**
30 29
      * @var string
31 30
      */
@@ -89,13 +88,11 @@  discard block
 block discarded – undo
89 88
     /**
90 89
      * @param Client $client
91 90
      */
92
-    public function __construct(Client $client)
93
-    {
91
+    public function __construct(Client $client) {
94 92
         $this->client = $client;
95 93
     }
96 94
 
97
-    public function __clone()
98
-    {
95
+    public function __clone() {
99 96
         $this->queryParams && $this->queryParams = clone $this->queryParams;
100 97
         $this->bodyParams && $this->bodyParams = clone $this->bodyParams;
101 98
         $this->fileParams && $this->fileParams = clone $this->fileParams;
@@ -104,32 +101,28 @@  discard block
 block discarded – undo
104 101
     /**
105 102
      * @return Client
106 103
      */
107
-    public function getClient()
108
-    {
104
+    public function getClient() {
109 105
         return $this->client;
110 106
     }
111 107
 
112 108
     /**
113 109
      * @return string
114 110
      */
115
-    public function getProtocol()
116
-    {
111
+    public function getProtocol() {
117 112
         return $this->protocol;
118 113
     }
119 114
 
120 115
     /**
121 116
      * @param string $protocol
122 117
      */
123
-    public function setProtocol($protocol)
124
-    {
118
+    public function setProtocol($protocol) {
125 119
         $this->protocol = $protocol;
126 120
     }
127 121
 
128 122
     /**
129 123
      * @return string
130 124
      */
131
-    public function getDomain()
132
-    {
125
+    public function getDomain() {
133 126
         if ($this->domain === null) {
134 127
             $this->domain = sprintf(
135 128
                 "%s.%s",
@@ -144,16 +137,14 @@  discard block
 block discarded – undo
144 137
     /**
145 138
      * @param string $domain
146 139
      */
147
-    public function setDomain($domain)
148
-    {
140
+    public function setDomain($domain) {
149 141
         $this->domain = $domain;
150 142
     }
151 143
 
152 144
     /**
153 145
      * @param string $last_level_domain
154 146
      */
155
-    public function setLastLevelDomain($last_level_domain)
156
-    {
147
+    public function setLastLevelDomain($last_level_domain) {
157 148
         $this->domain = sprintf(
158 149
             "%s.%s",
159 150
             $last_level_domain,
@@ -164,8 +155,7 @@  discard block
 block discarded – undo
164 155
     /**
165 156
      * @return Headers
166 157
      */
167
-    public function getHeaders()
168
-    {
158
+    public function getHeaders() {
169 159
         if ($this->headers === null) {
170 160
             $this->headers = clone $this->getClient()->getDefaultRequestHeaderds();
171 161
         }
@@ -176,64 +166,56 @@  discard block
 block discarded – undo
176 166
     /**
177 167
      * @param Headers $headers
178 168
      */
179
-    public function setHeaders(Headers $headers)
180
-    {
169
+    public function setHeaders(Headers $headers) {
181 170
         $this->headers = $headers;
182 171
     }
183 172
 
184 173
     /**
185 174
      * @return string
186 175
      */
187
-    public function getMethod()
188
-    {
176
+    public function getMethod() {
189 177
         return $this->method;
190 178
     }
191 179
 
192 180
     /**
193 181
      * @param string $method
194 182
      */
195
-    public function setMethod($method)
196
-    {
183
+    public function setMethod($method) {
197 184
         $this->method = $method;
198 185
     }
199 186
 
200 187
     /**
201 188
      * @return string
202 189
      */
203
-    public function getPath()
204
-    {
190
+    public function getPath() {
205 191
         return $this->path;
206 192
     }
207 193
 
208 194
     /**
209 195
      * @param string $path
210 196
      */
211
-    public function setPath($path)
212
-    {
197
+    public function setPath($path) {
213 198
         $this->path = $path;
214 199
     }
215 200
 
216 201
     /**
217 202
      * @return string
218 203
      */
219
-    public function getGraphVersion()
220
-    {
204
+    public function getGraphVersion() {
221 205
         return $this->graphVersion;
222 206
     }
223 207
 
224 208
     /**
225 209
      * @param string $version
226 210
      */
227
-    public function setGraphVersion($version)
228
-    {
211
+    public function setGraphVersion($version) {
229 212
         $this->graphVersion = $version;
230 213
     }
231 214
 
232 215
     /**
233 216
      * @return Parameters
234 217
      */
235
-    public function getQueryParams()
236
-    {
218
+    public function getQueryParams() {
237 219
         if ($this->queryParams === null) {
238 220
             $this->queryParams = new Parameters();
239 221
         }
@@ -244,16 +226,14 @@  discard block
 block discarded – undo
244 226
     /**
245 227
      * @param Parameters $params
246 228
      */
247
-    public function setQueryParams(Parameters $params)
248
-    {
229
+    public function setQueryParams(Parameters $params) {
249 230
         $this->queryParams = $params;
250 231
     }
251 232
 
252 233
     /**
253 234
      * @return string
254 235
      */
255
-    public function getUrl()
256
-    {
236
+    public function getUrl() {
257 237
         return $this->getProtocol().$this->getDomain()
258 238
             .'/v'.$this->getGraphVersion().$this->getPath()
259 239
             .($this->getQueryParams()->count() ? '?' : null)
@@ -263,8 +243,7 @@  discard block
 block discarded – undo
263 243
     /**
264 244
      * @return Parameters
265 245
      */
266
-    public function getBodyParams()
267
-    {
246
+    public function getBodyParams() {
268 247
         if ($this->bodyParams === null) {
269 248
             $this->bodyParams = new Parameters();
270 249
         }
@@ -275,16 +254,14 @@  discard block
 block discarded – undo
275 254
     /**
276 255
      * @param Parameters $params
277 256
      */
278
-    public function setBodyParams(Parameters $params)
279
-    {
257
+    public function setBodyParams(Parameters $params) {
280 258
         $this->bodyParams = $params;
281 259
     }
282 260
 
283 261
     /**
284 262
      * @return Parameters
285 263
      */
286
-    public function getFileParams()
287
-    {
264
+    public function getFileParams() {
288 265
         if ($this->fileParams === null) {
289 266
             $this->fileParams = new Parameters();
290 267
         }
@@ -295,16 +272,14 @@  discard block
 block discarded – undo
295 272
     /**
296 273
      * @param Parameters $params
297 274
      */
298
-    public function setFileParams(Parameters $params)
299
-    {
275
+    public function setFileParams(Parameters $params) {
300 276
         $this->fileParams = $params;
301 277
     }
302 278
 
303 279
     /**
304 280
      * @return ResponseInterface
305 281
      */
306
-    public function execute()
307
-    {
282
+    public function execute() {
308 283
         return $this->getClient()->sendRequest($this);
309 284
     }
310 285
 
@@ -312,8 +287,7 @@  discard block
 block discarded – undo
312 287
      * @return Request
313 288
      * @see RequestInterface::createClone()
314 289
      */
315
-    public function createClone()
316
-    {
290
+    public function createClone() {
317 291
         return clone $this;
318 292
     }
319 293
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/RequestInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-interface RequestInterface
28
-{
27
+interface RequestInterface {
29 28
     /**
30 29
      * @var string
31 30
      */
Please login to merge, or discard this patch.
src/FacebookAds/Http/ResponseInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-interface ResponseInterface
28
-{
27
+interface ResponseInterface {
29 28
     /**
30 29
      * @return RequestInterface
31 30
      */
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/AuthorizationException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,6 +24,5 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http\Exception;
26 26
 
27
-class AuthorizationException extends RequestException
28
-{
27
+class AuthorizationException extends RequestException {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/EmptyResponseException.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,13 +24,11 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http\Exception;
26 26
 
27
-class EmptyResponseException extends RequestException
28
-{
27
+class EmptyResponseException extends RequestException {
29 28
     /**
30 29
      * @param int $status_code
31 30
      */
32
-    public function __construct($status_code)
33
-    {
31
+    public function __construct($status_code) {
34 32
         parent::__construct(array(
35 33
             'error' => array(
36 34
                 'message' => 'Empty Response',
Please login to merge, or discard this patch.