Completed
Pull Request — master (#82)
by
unknown
06:37
created
src/PhraseanetSDK/Http/GuzzleAdapter.php 3 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -20,11 +20,8 @@
 block discarded – undo
20 20
 use PhraseanetSDK\Exception\InvalidArgumentException;
21 21
 use PhraseanetSDK\Exception\RuntimeException;
22 22
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
23
-
24
-use GuzzleHttp\Psr7\Request;
25 23
 use Psr\Http\Message\RequestInterface;
26 24
 use GuzzleHttp\RequestOptions;
27
-
28 25
 use GuzzleLogMiddleware\LogMiddleware;
29 26
 use GuzzleHttp\HandlerStack;
30 27
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function getBaseUrl()
83 83
     {
84 84
         // return $this->guzzleClient->getBaseUrl();  // removed
85
-        return $this->baseUri ;
85
+        return $this->baseUri;
86 86
     }
87 87
 
88 88
     /**
@@ -156,29 +156,29 @@  discard block
 block discarded – undo
156 156
             ];
157 157
 
158 158
             // files -- receiving files has no usage found in the code, so format of $files is unknown, so... not implmented
159
-            if(count($files) > 0) {
160
-                throw new \GuzzleHttp\Exception\InvalidArgumentException('request with "files" is not implemented' );
159
+            if (count($files) > 0) {
160
+                throw new \GuzzleHttp\Exception\InvalidArgumentException('request with "files" is not implemented');
161 161
             }
162 162
 
163 163
             // postFields
164
-            if(count($postFields) > 0) {
165
-                if($method !== 'POST') {
164
+            if (count($postFields) > 0) {
165
+                if ($method !== 'POST') {
166 166
                     throw new InvalidArgumentException('postFields are only allowed with "POST" method');
167 167
                 }
168
-                if(count($files) > 0) {
168
+                if (count($files) > 0) {
169 169
                     // this will not happen while "files" is not implemented
170
-                    throw new \GuzzleHttp\Exception\InvalidArgumentException('request can\'t contain both postFields and files' );
170
+                    throw new \GuzzleHttp\Exception\InvalidArgumentException('request can\'t contain both postFields and files');
171 171
                 }
172 172
                 $options[RequestOptions::FORM_PARAMS] = $postFields;
173 173
             }
174 174
 
175 175
             // headers
176 176
             $h = array_merge($acceptHeader, $headers);
177
-            if($this->userAgent !== '' && !array_key_exists('User-Agent', $h)) {
177
+            if ($this->userAgent !== '' && !array_key_exists('User-Agent', $h)) {
178 178
                 // use the defaut user-agent if none is provided in headers
179 179
                 $h['User-Agent'] = sprintf('%s version %s', ApplicationInterface::USER_AGENT, ApplicationInterface::VERSION);
180 180
             }
181
-            if(count($h) > 0) {
181
+            if (count($h) > 0) {
182 182
                 $options[RequestOptions::HEADERS] = $h;
183 183
             }
184 184
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -188,11 +188,9 @@
 block discarded – undo
188 188
 
189 189
 //            $this->addRequestParameters($request, $query, $postFields, $files);
190 190
 //            $response = $request->send();
191
-        }
192
-        catch (GuzzleBadResponse $e) {
191
+        } catch (GuzzleBadResponse $e) {
193 192
             throw BadResponseException::fromGuzzleResponse($e);
194
-        }
195
-        catch (GuzzleException $e) {
193
+        } catch (GuzzleException $e) {
196 194
             throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
197 195
         }
198 196
 
Please login to merge, or discard this patch.
src/PhraseanetSDK/AbstractRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@
 block discarded – undo
67 67
     {
68 68
         try {
69 69
             $response = $this->getAdapter()->call($method, $path, $query, $postFields, array(), $headers);
70
-        }
71
-        catch (BadResponseException $e) {
70
+        } catch (BadResponseException $e) {
72 71
             $statusCode = $e->getStatusCode();
73 72
             switch ($statusCode) {
74 73
                 case 404:
Please login to merge, or discard this patch.
src/PhraseanetSDK/PhraseanetSDKServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public function register(SilexApplication $app)
26 26
     {
27
-        $app['phraseanet-sdk.config'] = $app->share(function () use ($app) {
27
+        $app['phraseanet-sdk.config'] = $app->share(function() use ($app) {
28 28
             return array_replace(
29 29
                 array(
30 30
                     'client-id' => null,
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
             );
36 36
         });
37 37
 
38
-        $app['phraseanet-sdk.guzzle.plugins'] = $app->share(function ($app) {
38
+        $app['phraseanet-sdk.guzzle.plugins'] = $app->share(function($app) {
39 39
             return [];
40 40
         });
41 41
 
42
-        $app['phraseanet-sdk.guzzle-adapter'] = $app->share(function (SilexApplication $app) {
42
+        $app['phraseanet-sdk.guzzle-adapter'] = $app->share(function(SilexApplication $app) {
43 43
             return GuzzleAdapter::create(
44 44
                 $app['phraseanet-sdk.config']['url'],
45 45
                 $app['phraseanet-sdk.guzzle.plugins']
46 46
             );
47 47
         });
48 48
 
49
-        $app['phraseanet-sdk.guzzle-connected-adapter'] = $app->protect(function ($token) use ($app) {
49
+        $app['phraseanet-sdk.guzzle-connected-adapter'] = $app->protect(function($token) use ($app) {
50 50
             return new ConnectedGuzzleAdapter($token, $app['phraseanet-sdk.guzzle-adapter']);
51 51
         });
52 52
 
53
-        $app['phraseanet-sdk.guzzle-api-adapter'] = $app->protect(function ($token) use ($app) {
53
+        $app['phraseanet-sdk.guzzle-api-adapter'] = $app->protect(function($token) use ($app) {
54 54
             return new APIGuzzleAdapter($app['phraseanet-sdk.guzzle-connected-adapter']($token));
55 55
         });
56 56
 
57
-        $app['phraseanet-sdk'] = $app->share(function (SilexApplication $app) {
57
+        $app['phraseanet-sdk'] = $app->share(function(SilexApplication $app) {
58 58
             return Application::create($app['phraseanet-sdk.config'], $app['phraseanet-sdk.guzzle-adapter']);
59 59
         });
60 60
     }
Please login to merge, or discard this patch.