@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | /** |
3 | 3 | * This file is part of GitterApi package. |
4 | 4 | * |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | $options = $this->prepareRequestOptions($route); |
79 | 79 | |
80 | 80 | // Log request |
81 | - $this->debugLog($this->client, ' -> ' . $method . ' ' . $uri); |
|
81 | + $this->debugLog($this->client, ' -> '.$method.' '.$uri); |
|
82 | 82 | if ($options['body'] ?? false) { |
83 | - $this->debugLog($this->client, ' -> body ' . $options['body']); |
|
83 | + $this->debugLog($this->client, ' -> body '.$options['body']); |
|
84 | 84 | } |
85 | 85 | // End log request |
86 | 86 | |
87 | 87 | $response = $this->guzzle->request($method, $uri, $options); |
88 | 88 | |
89 | 89 | // Log response |
90 | - $this->debugLog($this->client, ' <- ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase()); |
|
91 | - $this->debugLog($this->client, ' <- ' . (string)$response->getBody()); |
|
90 | + $this->debugLog($this->client, ' <- '.$response->getStatusCode().' '.$response->getReasonPhrase()); |
|
91 | + $this->debugLog($this->client, ' <- '.(string) $response->getBody()); |
|
92 | 92 | // End log response |
93 | 93 | |
94 | 94 | return $this->parseResponse($response); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function parseResponse(ResponseInterface $response): array |
118 | 118 | { |
119 | - $data = json_decode((string)$response->getBody(), true); |
|
119 | + $data = json_decode((string) $response->getBody(), true); |
|
120 | 120 | |
121 | 121 | if (json_last_error() !== JSON_ERROR_NONE) { |
122 | 122 | throw new \RuntimeException(json_last_error_msg()); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $observer = new Observer(); |
73 | 73 | |
74 | - $this->promise($route)->then(function (ResponseInterface $response) use ($observer) { |
|
74 | + $this->promise($route)->then(function(ResponseInterface $response) use ($observer) { |
|
75 | 75 | $this->onConnect($response, $observer); |
76 | 76 | }); |
77 | 77 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | list($method, $uri) = [$route->method(), $route->build()]; |
89 | 89 | |
90 | 90 | // Log request |
91 | - $this->debugLog($this->client, ' -> ' . $method . ' ' . $uri); |
|
91 | + $this->debugLog($this->client, ' -> '.$method.' '.$uri); |
|
92 | 92 | |
93 | 93 | return $this->browser |
94 | 94 | ->withOptions(['streaming' => true]) |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | $json = new JsonStream(); |
105 | 105 | |
106 | 106 | // Log response |
107 | - $this->debugLog($this->client, ' <- ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase()); |
|
107 | + $this->debugLog($this->client, ' <- '.$response->getStatusCode().' '.$response->getReasonPhrase()); |
|
108 | 108 | |
109 | 109 | /* @var $body ReadableStreamInterface */ |
110 | 110 | $body = $response->getBody(); |
111 | 111 | |
112 | - $body->on('data', function ($chunk) use ($json, $observer) { |
|
112 | + $body->on('data', function($chunk) use ($json, $observer) { |
|
113 | 113 | // Log response chunk |
114 | - $this->debugLog($this->client, ' <- ' . $chunk); |
|
114 | + $this->debugLog($this->client, ' <- '.$chunk); |
|
115 | 115 | |
116 | - $json->push($chunk, function ($object) use ($observer) { |
|
116 | + $json->push($chunk, function($object) use ($observer) { |
|
117 | 117 | $observer->fire($object); |
118 | 118 | }); |
119 | 119 | }); |