Passed
Branch master (d3365f)
by Markus
04:57
created
src/HttpHandler.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -25,43 +25,43 @@  discard block
 block discarded – undo
25 25
 	/**
26 26
 	 * The http client instance.
27 27
 	 *
28
-     * @var \Http\Client\HttpClient
29
-     */
30
-    protected $client;
31
-
32
-    /**
33
-     * The message factory instance.
34
-     *
35
-     * @var \Http\Message\MessageFactory
36
-     */
37
-    protected $messageFactory;
38
-
39
-    /**
40
-     * The options array.
41
-     *
42
-     * @var array
43
-     */
44
-    protected $options = [
45
-    	'uri'             => null,
46
-    	'method'          => 'GET',
47
-    	'headers'         => [
48
-    		'Content-Type' => 'application/json'
49
-    	],
50
-    	'protocolVersion' => '1.1'
51
-    ];
52
-
53
-    /**
54
-     * Create a new monolog http client handler instance.
55
-     *
56
-     * @param  array                $options The array of options consisting of the uri, method, headers and protocol
57
-     *                                       version.
58
-     * @param  HttpAsyncClient|null $client  An instance of a psr-7 http async client implementation or null when the
59
-     *                                       HttpAsyncClientDiscovery should be used to find an instance.
60
-     * @param  MessageFactory|null  $factory An instance of a psr-7 message factory implementation or null when
61
-     *                                       the MessageFactoryDiscovery should be used to find an instance.
62
-     * @param  int                  $level   The minimum logging level at which this handler will be triggered.
63
-     * @param  boolean              $bubble  Whether the messages that are handled can bubble up the stack or not.
64
-     */
28
+	 * @var \Http\Client\HttpClient
29
+	 */
30
+	protected $client;
31
+
32
+	/**
33
+	 * The message factory instance.
34
+	 *
35
+	 * @var \Http\Message\MessageFactory
36
+	 */
37
+	protected $messageFactory;
38
+
39
+	/**
40
+	 * The options array.
41
+	 *
42
+	 * @var array
43
+	 */
44
+	protected $options = [
45
+		'uri'             => null,
46
+		'method'          => 'GET',
47
+		'headers'         => [
48
+			'Content-Type' => 'application/json'
49
+		],
50
+		'protocolVersion' => '1.1'
51
+	];
52
+
53
+	/**
54
+	 * Create a new monolog http client handler instance.
55
+	 *
56
+	 * @param  array                $options The array of options consisting of the uri, method, headers and protocol
57
+	 *                                       version.
58
+	 * @param  HttpAsyncClient|null $client  An instance of a psr-7 http async client implementation or null when the
59
+	 *                                       HttpAsyncClientDiscovery should be used to find an instance.
60
+	 * @param  MessageFactory|null  $factory An instance of a psr-7 message factory implementation or null when
61
+	 *                                       the MessageFactoryDiscovery should be used to find an instance.
62
+	 * @param  int                  $level   The minimum logging level at which this handler will be triggered.
63
+	 * @param  boolean              $bubble  Whether the messages that are handled can bubble up the stack or not.
64
+	 */
65 65
 	public function __construct(
66 66
 		array $options = [],
67 67
 		HttpAsyncClient $client = null,
@@ -183,57 +183,57 @@  discard block
 block discarded – undo
183 183
 	}
184 184
 
185 185
 	/**
186
-     * Gets the default formatter.
187
-     *
188
-     * @return \Monolog\Formatter\JsonFormatter
189
-     */
190
-    protected function getDefaultFormatter() : FormatterInterface
191
-    {
192
-        return new JsonFormatter();
193
-    }
194
-
195
-	/**
196
-     * Returns the HTTP adapter.
197
-     *
198
-     * @return \Http\Client\HttpAsyncClient
199
-     */
200
-    protected function getHttpClient(): HttpAsyncClient
201
-    {
202
-        return $this->client;
203
-    }
204
-
205
-    /**
206
-     * Returns the message factory.
207
-     *
208
-     * @return \Http\Message\MessageFactory
209
-     */
210
-    protected function getMessageFactory(): MessageFactory
211
-    {
212
-        return $this->messageFactory;
213
-    }
214
-
215
-    /**
216
-     * Writes the record.
217
-     *
218
-     * @param  array $record
219
-     * @return void
220
-     */
221
-    protected function write(array $record)
222
-    {
223
-    	$uri = $this->getUri();
224
-
225
-    	if (empty($uri)) {
226
-    		return;
227
-    	}
228
-
229
-    	$request = $this->getMessageFactory()->createRequest(
230
-    		$this->getMethod(),
231
-    		$this->getUri(),
232
-    		$this->getHeaders(),
233
-    		$record['formatted'],
234
-    		$this->getProtocolVersion()
235
-    	);
236
-
237
-        $this->getHttpClient()->sendAsyncRequest($request);
238
-    }
186
+	 * Gets the default formatter.
187
+	 *
188
+	 * @return \Monolog\Formatter\JsonFormatter
189
+	 */
190
+	protected function getDefaultFormatter() : FormatterInterface
191
+	{
192
+		return new JsonFormatter();
193
+	}
194
+
195
+	/**
196
+	 * Returns the HTTP adapter.
197
+	 *
198
+	 * @return \Http\Client\HttpAsyncClient
199
+	 */
200
+	protected function getHttpClient(): HttpAsyncClient
201
+	{
202
+		return $this->client;
203
+	}
204
+
205
+	/**
206
+	 * Returns the message factory.
207
+	 *
208
+	 * @return \Http\Message\MessageFactory
209
+	 */
210
+	protected function getMessageFactory(): MessageFactory
211
+	{
212
+		return $this->messageFactory;
213
+	}
214
+
215
+	/**
216
+	 * Writes the record.
217
+	 *
218
+	 * @param  array $record
219
+	 * @return void
220
+	 */
221
+	protected function write(array $record)
222
+	{
223
+		$uri = $this->getUri();
224
+
225
+		if (empty($uri)) {
226
+			return;
227
+		}
228
+
229
+		$request = $this->getMessageFactory()->createRequest(
230
+			$this->getMethod(),
231
+			$this->getUri(),
232
+			$this->getHeaders(),
233
+			$record['formatted'],
234
+			$this->getProtocolVersion()
235
+		);
236
+
237
+		$this->getHttpClient()->sendAsyncRequest($request);
238
+	}
239 239
 }
240 240
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 	 */
157 157
 	public function getHeaders() : array
158 158
 	{
159
-		return $this->options['headers'] ?: [ 'Content-Type' => 'application/json' ];
159
+		return $this->options['headers'] ?: ['Content-Type' => 'application/json'];
160 160
 	}
161 161
 
162 162
 	/**
Please login to merge, or discard this patch.