Completed
Pull Request — master (#76)
by Thibaud
04:14
created
src/PhraseanetSDK/Orders/OrderRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
     {
22 22
         // 't' param is used for cache busting
23 23
         $parameters = [ 
24
-            'includes' => [ 'elements' ],
24
+            'includes' => ['elements'],
25 25
             't' => time() 
26 26
         ];
27 27
 
28
-        $response = $this->query('GET', 'v2/orders/' . $orderId, $parameters);
28
+        $response = $this->query('GET', 'v2/orders/'.$orderId, $parameters);
29 29
 
30 30
         if ($response->isEmpty()) {
31 31
             throw new RuntimeException('Response content is empty');
32 32
         }
33 33
 
34
-        if (! $response->hasProperty('data')) {
34
+        if (!$response->hasProperty('data')) {
35 35
             throw new RuntimeException('Missing \'data\' property in response');
36 36
         }
37 37
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $parameters = [
45 45
             'page' => max($pageIndex, 0),
46 46
             'per_page' => max($pageSize, 1),
47
-            'includes' => [ 'elements' ],
47
+            'includes' => ['elements'],
48 48
             't' => time()
49 49
         ];
50 50
 
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
             throw new RuntimeException('Response content is empty');
55 55
         }
56 56
 
57
-        if (! $response->hasProperty('data')) {
57
+        if (!$response->hasProperty('data')) {
58 58
             throw new RuntimeException('Missing \'data\' property in response');
59 59
         }
60 60
 
61
-        if (! $response->hasProperty('meta')) {
61
+        if (!$response->hasProperty('meta')) {
62 62
             throw new RuntimeException('Missing \'meta\' property in response');
63 63
         }
64 64
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             'records' => $recordsIds
75 75
         ];
76 76
 
77
-        $response = $this->query('POST', 'v2/orders/', [], [ 'data' => $parameters ], [
77
+        $response = $this->query('POST', 'v2/orders/', [], ['data' => $parameters], [
78 78
             'Accept' => 'application/json',
79 79
             'Content-Type' => 'application/json'
80 80
         ]);
Please login to merge, or discard this patch.
src/PhraseanetSDK/Application.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     }
54 54
 
55 55
     /**
56
-     * @param $token
56
+     * @param string $token
57 57
      */
58 58
     private static function assertValidToken($token)
59 59
     {
@@ -188,6 +188,9 @@  discard block
 block discarded – undo
188 188
         return $this->adapter;
189 189
     }
190 190
 
191
+    /**
192
+     * @param string $token
193
+     */
191 194
     private function getAdapterByToken($token)
192 195
     {
193 196
         if (!isset($this->adapters[$token])) {
Please login to merge, or discard this patch.
src/PhraseanetSDK/EntityManager.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use PhraseanetSDK\Http\ApiClient;
15 15
 use PhraseanetSDK\Http\APIGuzzleAdapter;
16 16
 use PhraseanetSDK\AbstractRepository;
17
-use PhraseanetSDK\Http\Client;
18 17
 use PhraseanetSDK\Orders\OrderRepository;
19 18
 use PhraseanetSDK\Search\SearchRepository;
20 19
 use Psr\Log\LoggerInterface;
Please login to merge, or discard this patch.
src/PhraseanetSDK/Http/AuthenticatedClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         array $files = array(),
60 60
         array $headers = array()
61 61
     ) {
62
-        $query = array_replace($query, [ 'oauth_token' => $this->token ]);
62
+        $query = array_replace($query, ['oauth_token' => $this->token]);
63 63
 
64 64
         return $this->client->call($method, $path, $query, $postFields, $files, $headers);
65 65
     }
Please login to merge, or discard this patch.
src/PhraseanetSDK/Http/ApiClient.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         array $files = array(),
85 85
         array $headers = array()
86 86
     ) {
87
-        $headers = array_replace($headers, [ 'Accept' => $this->getAcceptHeader() ]);
87
+        $headers = array_replace($headers, ['Accept' => $this->getAcceptHeader()]);
88 88
         $responseBody = $this->client->call($method, $path, $query, $postFields, $files, $headers);
89 89
 
90 90
         $decodedResponse = @json_decode($responseBody);
@@ -104,7 +104,6 @@  discard block
 block discarded – undo
104 104
     private function getAcceptHeader()
105 105
     {
106 106
         return $this->isExtendedModeEnabled() ?
107
-            'application/vnd.phraseanet.record-extended+json' :
108
-            'application/json';
107
+            'application/vnd.phraseanet.record-extended+json' : 'application/json';
109 108
     }
110 109
 }
Please login to merge, or discard this patch.
src/PhraseanetSDK/Http/ApiResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     public function getStatusCode()
56 56
     {
57
-        return (int)$this->meta->http_code;
57
+        return (int) $this->meta->http_code;
58 58
     }
59 59
 
60 60
     /**
Please login to merge, or discard this patch.
src/PhraseanetSDK/Http/ClientFactory.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     /**
35 35
      * @param Endpoint $endpoint
36
-     * @return Client|\GuzzleHttp\ClientInterface
36
+     * @return GuzzleClient
37 37
      */
38 38
     private function createGuzzleClient(Endpoint $endpoint)
39 39
     {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     /**
44 44
      * @param $endpoint
45
-     * @return \Guzzle\Http\Client|Client
45
+     * @return GuzzleHttpClient
46 46
      */
47 47
     private function createLegacyGuzzleClient(Endpoint $endpoint)
48 48
     {
Please login to merge, or discard this patch.
src/PhraseanetSDK/AbstractRepository.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,6 @@
 block discarded – undo
18 18
 use PhraseanetSDK\Exception\RuntimeException;
19 19
 use PhraseanetSDK\Http\ApiClient;
20 20
 use PhraseanetSDK\Http\ApiResponse;
21
-use PhraseanetSDK\Http\APIGuzzleAdapter;
22
-use PhraseanetSDK\Http\Client;
23 21
 
24 22
 abstract class AbstractRepository
25 23
 {
Please login to merge, or discard this patch.
src/PhraseanetSDK/Exception/BadResponseException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      */
53 53
     public function setResponseBody($body)
54 54
     {
55
-        $this->responseBody = (string)$body;
55
+        $this->responseBody = (string) $body;
56 56
 
57 57
         return $this;
58 58
     }
Please login to merge, or discard this patch.