Skip to content

Commit bca09b0

Browse files
authored
Merge pull request #11 from bilfeldt/analysis-J2R6lk
Apply fixes from StyleCI
2 parents 417efee + 96c2f2f commit bca09b0

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

config/http-client-logger.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
| Note that these settings are only used by the default logger.
8080
|
8181
*/
82-
'disk' => env('HTTP_CLIENT_LOGGER_DISK', false),
82+
'disk' => env('HTTP_CLIENT_LOGGER_DISK', false),
8383
'disk_separate_files' => true,
84-
'prefix_timestamp' => 'Y-m-d-Hisu', // Leaving empty will remove the timestamp
85-
'filename' => '',
84+
'prefix_timestamp' => 'Y-m-d-Hisu', // Leaving empty will remove the timestamp
85+
'filename' => '',
8686
];

src/HttpLoggingFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function shouldLog(
1414
array $context = [],
1515
array $config = []
1616
): bool {
17-
if (! config('http-client-logger.enabled')) {
17+
if (!config('http-client-logger.enabled')) {
1818
return false;
1919
}
2020

src/HttpLoggingFilterInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
namespace Bilfeldt\LaravelHttpClientLogger;
54

65
use Psr\Http\Message\RequestInterface;

src/LaravelHttpClientLoggerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class LaravelHttpClientLoggerServiceProvider extends PackageServiceProvider
1414
*
1515
* More info: https://github.com/spatie/laravel-package-tools
1616
*
17-
* @param Package $package
17+
* @param Package $package
1818
*/
1919
public function configurePackage(Package $package): void
2020
{

src/Middleware/LoggingMiddleware.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function __construct(HttpLoggerInterface $logger, HttpLoggingFilterInterf
2424
* Called when the middleware is handled by the client.
2525
*
2626
* @param array $context
27+
*
2728
* @return callable
2829
*/
2930
public function __invoke($context = [], $config = []): callable

tests/HttpLoggerTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public function setUp(): void
2020
{
2121
parent::setUp();
2222

23-
$this->logger = new HttpLogger(new PsrMessageToStringConverter);
23+
$this->logger = new HttpLogger(new PsrMessageToStringConverter());
2424
$this->request = new Request('GET', 'https://example.com/path?query=ABCDEF', ['header1' => 'HIJKL'], 'TestRequestBody');
2525
}
2626

2727
public function test_response_code_200_logs_debug_level()
2828
{
29-
Log::swap(new LogFake);
29+
Log::swap(new LogFake());
3030

3131
$this->logger->log($this->request, new Response(200), 0.2);
3232

@@ -35,7 +35,7 @@ public function test_response_code_200_logs_debug_level()
3535

3636
public function test_response_code_300_logs_info_level()
3737
{
38-
Log::swap(new LogFake);
38+
Log::swap(new LogFake());
3939

4040
$this->logger->log($this->request, new Response(300), 0.2);
4141

@@ -44,7 +44,7 @@ public function test_response_code_300_logs_info_level()
4444

4545
public function test_response_code_400_logs_error_level()
4646
{
47-
Log::swap(new LogFake);
47+
Log::swap(new LogFake());
4848

4949
$this->logger->log($this->request, new Response(400), 0.2);
5050

@@ -53,7 +53,7 @@ public function test_response_code_400_logs_error_level()
5353

5454
public function test_response_code_400_logs_critical_level()
5555
{
56-
Log::swap(new LogFake);
56+
Log::swap(new LogFake());
5757

5858
$this->logger->log($this->request, new Response(500), 0.2);
5959

@@ -62,7 +62,7 @@ public function test_response_code_400_logs_critical_level()
6262

6363
public function test_log_contains_request_header()
6464
{
65-
Log::swap(new LogFake);
65+
Log::swap(new LogFake());
6666

6767
$this->logger->log($this->request, new Response(200), 0.2);
6868

@@ -73,7 +73,7 @@ public function test_log_contains_request_header()
7373

7474
public function test_log_contains_request_body()
7575
{
76-
Log::swap(new LogFake);
76+
Log::swap(new LogFake());
7777

7878
$this->logger->log($this->request, new Response(200), 0.2);
7979

@@ -84,7 +84,7 @@ public function test_log_contains_request_body()
8484

8585
public function test_log_contains_response_header()
8686
{
87-
Log::swap(new LogFake);
87+
Log::swap(new LogFake());
8888

8989
$this->logger->log($this->request, new Response(200, ['header2' => 'XYZ']), 0.2);
9090

@@ -95,7 +95,7 @@ public function test_log_contains_response_header()
9595

9696
public function test_log_contains_response_body()
9797
{
98-
Log::swap(new LogFake);
98+
Log::swap(new LogFake());
9999

100100
$this->logger->log($this->request, new Response(200, [], 'TestResponseBody'), 0.2);
101101

@@ -106,7 +106,7 @@ public function test_log_contains_response_body()
106106

107107
public function test_logs_context()
108108
{
109-
Log::swap(new LogFake);
109+
Log::swap(new LogFake());
110110

111111
$this->logger->log($this->request, new Response(200), 0.2, ['context']);
112112

@@ -117,26 +117,26 @@ public function test_logs_context()
117117

118118
public function test_replaces_placeholders_from_request()
119119
{
120-
Log::swap(new LogFake);
120+
Log::swap(new LogFake());
121121

122122
$this->logger->log($this->request, new Response(200), 0.2, ['test123'], ['replace' => ['example.com' => 'mock.org']]);
123123

124124
Log::assertLogged('debug', function ($message, $context) {
125125
return Str::contains($message, 'mock.org')
126-
&& ! Str::contains($message, 'example.com')
126+
&& !Str::contains($message, 'example.com')
127127
&& $context == ['test123'];
128128
});
129129
}
130130

131131
public function test_replaces_placeholders_from_response()
132132
{
133-
Log::swap(new LogFake);
133+
Log::swap(new LogFake());
134134

135135
$this->logger->log($this->request, new Response(200, [], 'My name is John Doe'), 0.2, ['test123'], ['replace' => ['Doe' => 'Smith']]);
136136

137137
Log::assertLogged('debug', function ($message, $context) {
138138
return Str::contains($message, 'Smith')
139-
&& ! Str::contains($message, 'Doe')
139+
&& !Str::contains($message, 'Doe')
140140
&& $context == ['test123'];
141141
});
142142
}

0 commit comments

Comments
 (0)