Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"homepage": "https://github.com/smoothphp/laravel-request-logger",
"require": {
"php": ">=7.0",
"php": ">=7.1",
"illuminate/bus": "^5.3",
"illuminate/routing": "^5.3",
"illuminate/queue": "^5.3",
Expand Down
4 changes: 2 additions & 2 deletions src/Job/LogRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class LogRequests implements ShouldQueue
* @param Store $store
* @return void
*/
public function handle(Router $router, Store $store)
public function handle(Router $router, Store $store) : void
{
$route = $router->getCurrentRoute();
$request = $router->getCurrentRequest();
Expand All @@ -42,4 +42,4 @@ public function handle(Router $router, Store $store)

$this->delete();
}
}
}
4 changes: 2 additions & 2 deletions src/Request/Adapter/DataStoreAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface DataStoreAdapter
* @param array $data
* @return void
*/
public function store(string $ip, array $data);
}
public function store(string $ip, array $data) : void;
}
5 changes: 3 additions & 2 deletions src/Request/Adapter/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class FilesystemAdapter implements DataStoreAdapter
{
/** @var Filesystem */
private $filesystem;

/** @var string */
private $filenameFormat;

Expand All @@ -32,11 +33,11 @@ public function __construct(Filesystem $filesystem, string $filenameFormat)
* @param array $data
* @return void
*/
public function store(string $ip, array $data)
public function store(string $ip, array $data) : void
{
$this->filesystem->put(vsprintf('%s/%s.json', [
$ip,
(new DateTime)->format($this->filenameFormat)
]), json_encode($data));
}
}
}
4 changes: 2 additions & 2 deletions src/Request/Adapter/MongoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function __construct(Connection $connection, string $collection)
* @param array $data
* @return void
*/
public function store(string $ip, array $data)
public function store(string $ip, array $data) : void
{
$data['ip'] = $ip;
$this->connection->collection($this->collection)->insert([$data]);
}
}
}
4 changes: 2 additions & 2 deletions src/Request/RequestStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function __construct(Adapter\DataStoreAdapter $adapter)
* @param array $data
* @return void
*/
public function log(string $ip, array $data)
public function log(string $ip, array $data) : void
{
$this->adapter->store($ip, $data);
}
}
}
4 changes: 2 additions & 2 deletions src/Request/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface Store
* @param array $data
* @return void
*/
public function log(string $ip, array $data);
}
public function log(string $ip, array $data) : void;
}
8 changes: 4 additions & 4 deletions src/RequestLoggerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class RequestLoggerServiceProvider extends ServiceProvider
/**
* Boot
*/
public function boot()
public function boot() : void
{
$this->publishes(
[
Expand All @@ -35,7 +35,7 @@ public function boot()
/**
* Register
*/
public function register()
public function register() : void
{
$app = $this->app;

Expand Down Expand Up @@ -63,7 +63,7 @@ public function register()
/**
* @return array
*/
public function provides()
public function provides() : array
{
return [
DataStoreAdapter::class,
Expand All @@ -73,4 +73,4 @@ public function provides()
Store::class,
];
}
}
}