Failed Conditions
Pull Request — master (#191)
by Emanuele
03:09
created
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.
src/FacebookAds/Http/Exception/ClientException.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
- *
5
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
- * use, copy, modify, and distribute this software in source code or binary
7
- * form for use in connection with the web services and APIs provided by
8
- * Facebook.
9
- *
10
- * As with any software that integrates with the Facebook platform, your use
11
- * of this software is subject to the Facebook Developer Principles and
12
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
- * shall be included in all copies or substantial portions of the software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- * DEALINGS IN THE SOFTWARE.
22
- *
23
- */
3
+     * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
+     *
5
+     * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+     * use, copy, modify, and distribute this software in source code or binary
7
+     * form for use in connection with the web services and APIs provided by
8
+     * Facebook.
9
+     *
10
+     * As with any software that integrates with the Facebook platform, your use
11
+     * of this software is subject to the Facebook Developer Principles and
12
+     * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+     * shall be included in all copies or substantial portions of the software.
14
+     *
15
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+     * DEALINGS IN THE SOFTWARE.
22
+     *
23
+     */
24 24
 
25 25
 namespace FacebookAds\Object\Fields;
26 26
 
Please login to merge, or discard this 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 ClientException extends RequestException
28
-{
27
+class ClientException extends RequestException {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/ThrottleException.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 ThrottleException extends RequestException
28
-{
27
+class ThrottleException extends RequestException {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/RequestException.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 use FacebookAds\Exception\Exception;
28 28
 
29
-class RequestException extends Exception
30
-{
29
+class RequestException extends Exception {
31 30
     /**
32 31
      * @var int Status code for the response causing the exception
33 32
      */
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      * @param mixed $default
94 93
      * @return mixed
95 94
      */
96
-    protected static function idx(array $array, $key, $default = null)
97
-    {
95
+    protected static function idx(array $array, $key, $default = null) {
98 96
         return array_key_exists($key, $array)
99 97
             ? $array[$key]
100 98
             : $default;
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
      * @param array $response_data
105 103
      * @return array
106 104
      */
107
-    protected static function getErrorData(array $response_data)
108
-    {
105
+    protected static function getErrorData(array $response_data) {
109 106
         $error_data = static::idx($response_data, 'error', array());
110 107
 
111 108
         return array(
@@ -130,8 +127,7 @@  discard block
 block discarded – undo
130 127
      * @param int $status_code the HTTP response code
131 128
      * @return RequestException
132 129
      */
133
-    public static function create(array $response_data, $status_code)
134
-    {
130
+    public static function create(array $response_data, $status_code) {
135 131
         $error_data = static::getErrorData($response_data);
136 132
         if (in_array($error_data['error_subcode'], array(458, 459, 460, 463, 464, 467))
137 133
             || in_array($error_data['code'], array(100, 102, 190))
@@ -154,40 +150,35 @@  discard block
 block discarded – undo
154 150
     /**
155 151
      * @return int
156 152
      */
157
-    public function getHttpStatusCode()
158
-    {
153
+    public function getHttpStatusCode() {
159 154
         return $this->statusCode;
160 155
     }
161 156
 
162 157
     /**
163 158
      * @return int|null
164 159
      */
165
-    public function getErrorSubcode()
166
-    {
160
+    public function getErrorSubcode() {
167 161
         return $this->errorSubcode;
168 162
     }
169 163
 
170 164
     /**
171 165
      * @return string|null
172 166
      */
173
-    public function getErrorUserTitle()
174
-    {
167
+    public function getErrorUserTitle() {
175 168
         return $this->errorUserTitle;
176 169
     }
177 170
 
178 171
     /**
179 172
      * @return string|null
180 173
      */
181
-    public function getErrorUserMessage()
182
-    {
174
+    public function getErrorUserMessage() {
183 175
         return $this->errorUserMessage;
184 176
     }
185 177
 
186 178
     /**
187 179
      * @return array|null
188 180
      */
189
-    public function getErrorBlameFieldSpecs()
190
-    {
181
+    public function getErrorBlameFieldSpecs() {
191 182
         return $this->errorBlameFieldSpecs;
192 183
     }
193 184
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/PermissionException.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
- *
5
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
- * use, copy, modify, and distribute this software in source code or binary
7
- * form for use in connection with the web services and APIs provided by
8
- * Facebook.
9
- *
10
- * As with any software that integrates with the Facebook platform, your use
11
- * of this software is subject to the Facebook Developer Principles and
12
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
- * shall be included in all copies or substantial portions of the software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- * DEALINGS IN THE SOFTWARE.
22
- *
23
- */
3
+     * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
+     *
5
+     * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+     * use, copy, modify, and distribute this software in source code or binary
7
+     * form for use in connection with the web services and APIs provided by
8
+     * Facebook.
9
+     *
10
+     * As with any software that integrates with the Facebook platform, your use
11
+     * of this software is subject to the Facebook Developer Principles and
12
+     * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+     * shall be included in all copies or substantial portions of the software.
14
+     *
15
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+     * DEALINGS IN THE SOFTWARE.
22
+     *
23
+     */
24 24
 
25 25
 namespace FacebookAds\Object\Fields;
26 26
 
Please login to merge, or discard this 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 PermissionException extends RequestException
28
-{
27
+class PermissionException extends RequestException {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Exception/ServerException.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 ServerException extends RequestException
28
-{
27
+class ServerException extends RequestException {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Adapter/AdapterInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
 use FacebookAds\Http\RequestInterface;
29 29
 use FacebookAds\Http\ResponseInterface;
30 30
 
31
-interface AdapterInterface
32
-{
31
+interface AdapterInterface {
33 32
     /**
34 33
      * @param Client $client
35 34
      */
Please login to merge, or discard this patch.
src/FacebookAds/Http/Adapter/AbstractAdapter.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
- *
5
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
- * use, copy, modify, and distribute this software in source code or binary
7
- * form for use in connection with the web services and APIs provided by
8
- * Facebook.
9
- *
10
- * As with any software that integrates with the Facebook platform, your use
11
- * of this software is subject to the Facebook Developer Principles and
12
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
- * shall be included in all copies or substantial portions of the software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- * DEALINGS IN THE SOFTWARE.
22
- *
23
- */
3
+     * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
+     *
5
+     * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+     * use, copy, modify, and distribute this software in source code or binary
7
+     * form for use in connection with the web services and APIs provided by
8
+     * Facebook.
9
+     *
10
+     * As with any software that integrates with the Facebook platform, your use
11
+     * of this software is subject to the Facebook Developer Principles and
12
+     * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+     * shall be included in all copies or substantial portions of the software.
14
+     *
15
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+     * DEALINGS IN THE SOFTWARE.
22
+     *
23
+     */
24 24
 
25 25
 namespace FacebookAds\Object\Fields;
26 26
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 use FacebookAds\Http\Client;
28 28
 
29
-abstract class AbstractAdapter implements AdapterInterface
30
-{
29
+abstract class AbstractAdapter implements AdapterInterface {
31 30
     /**
32 31
      * @var Client
33 32
      */
@@ -36,24 +35,21 @@  discard block
 block discarded – undo
36 35
     /**
37 36
      * @param Client $client
38 37
      */
39
-    public function __construct(Client $client)
40
-    {
38
+    public function __construct(Client $client) {
41 39
         $this->client = $client;
42 40
     }
43 41
 
44 42
     /**
45 43
      * @return Client
46 44
      */
47
-    public function getClient()
48
-    {
45
+    public function getClient() {
49 46
         return $this->client;
50 47
     }
51 48
 
52 49
     /**
53 50
      * @return string
54 51
      */
55
-    public function getCaBundlePath()
56
-    {
52
+    public function getCaBundlePath() {
57 53
         return $this->getClient()->getCaBundlePath();
58 54
     }
59 55
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Adapter/CurlAdapter.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
- *
5
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
- * use, copy, modify, and distribute this software in source code or binary
7
- * form for use in connection with the web services and APIs provided by
8
- * Facebook.
9
- *
10
- * As with any software that integrates with the Facebook platform, your use
11
- * of this software is subject to the Facebook Developer Principles and
12
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
- * shall be included in all copies or substantial portions of the software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- * DEALINGS IN THE SOFTWARE.
22
- *
23
- */
3
+     * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
4
+     *
5
+     * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+     * use, copy, modify, and distribute this software in source code or binary
7
+     * form for use in connection with the web services and APIs provided by
8
+     * Facebook.
9
+     *
10
+     * As with any software that integrates with the Facebook platform, your use
11
+     * of this software is subject to the Facebook Developer Principles and
12
+     * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+     * shall be included in all copies or substantial portions of the software.
14
+     *
15
+     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+     * DEALINGS IN THE SOFTWARE.
22
+     *
23
+     */
24 24
 
25 25
 namespace FacebookAds\Object\Fields;
26 26
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
 use FacebookAds\Http\RequestInterface;
34 34
 use FacebookAds\Http\ResponseInterface;
35 35
 
36
-class CurlAdapter extends AbstractAdapter
37
-{
36
+class CurlAdapter extends AbstractAdapter {
38 37
     /**
39 38
      * @var CurlInterface
40 39
      */
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      * @param Client $client
50 49
      * @param CurlInterface $curl
51 50
      */
52
-    public function __construct(Client $client, CurlInterface $curl = null)
53
-    {
51
+    public function __construct(Client $client, CurlInterface $curl = null) {
54 52
         parent::__construct($client);
55 53
         $this->curl = $curl ?: AbstractCurl::createOptimalVersion();
56 54
         $this->curl->init();
@@ -59,16 +57,14 @@  discard block
 block discarded – undo
59 57
     /**
60 58
      * @return Curl
61 59
      */
62
-    public function getCurl()
63
-    {
60
+    public function getCurl() {
64 61
         return $this->curl;
65 62
     }
66 63
 
67 64
     /**
68 65
      * @return \ArrayObject
69 66
      */
70
-    public function getOpts()
71
-    {
67
+    public function getOpts() {
72 68
         if ($this->opts === null) {
73 69
             $this->opts = new \ArrayObject(array(
74 70
                 CURLOPT_CONNECTTIMEOUT => 10,
@@ -85,16 +81,14 @@  discard block
 block discarded – undo
85 81
     /**
86 82
      * @param \ArrayObject $opts
87 83
      */
88
-    public function setOpts(\ArrayObject $opts)
89
-    {
84
+    public function setOpts(\ArrayObject $opts) {
90 85
         $this->opts = $opts;
91 86
     }
92 87
 
93 88
     /**
94 89
      * @return int
95 90
      */
96
-    protected function getheaderSize()
97
-    {
91
+    protected function getheaderSize() {
98 92
         return $this->getCurl()->getInfo(CURLINFO_HEADER_SIZE);
99 93
     }
100 94
 
@@ -103,8 +97,7 @@  discard block
 block discarded – undo
103 97
      * @param string $raw_response
104 98
      * @return array
105 99
      */
106
-    protected function extractResponseHeadersAndBody($raw_response)
107
-    {
100
+    protected function extractResponseHeadersAndBody($raw_response) {
108 101
         $header_size = $this->getheaderSize();
109 102
 
110 103
         $raw_headers = mb_substr($raw_response, 0, $header_size);
@@ -117,8 +110,7 @@  discard block
 block discarded – undo
117 110
      * @param Headers $headers
118 111
      * @param string $raw_headers
119 112
      */
120
-    protected function parseHeaders(Headers $headers, $raw_headers)
121
-    {
113
+    protected function parseHeaders(Headers $headers, $raw_headers) {
122 114
         $raw_headers = str_replace("\r\n", "\n", $raw_headers);
123 115
 
124 116
         // There will be multiple headers if a 301 was followed
@@ -143,8 +135,7 @@  discard block
 block discarded – undo
143 135
      * @return ResponseInterface
144 136
      * @throws Exception
145 137
      */
146
-    public function sendRequest(RequestInterface $request)
147
-    {
138
+    public function sendRequest(RequestInterface $request) {
148 139
         $response = $this->getClient()->createResponse();
149 140
         $this->getCurl()->reset();
150 141
         $curlopts = array(
Please login to merge, or discard this patch.