Primo Committ

This commit is contained in:
paoloar77
2024-05-07 12:17:25 +02:00
commit e73d0e5113
7204 changed files with 884387 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace Facade\FlareClient\Middleware;
use Facade\FlareClient\Glows\Recorder;
use Facade\FlareClient\Report;
class AddGlows
{
/** @var Recorder */
private $recorder;
public function __construct(Recorder $recorder)
{
$this->recorder = $recorder;
}
public function handle(Report $report, $next)
{
foreach ($this->recorder->glows() as $glow) {
$report->addGlow($glow);
}
return $next($report);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Facade\FlareClient\Middleware;
use Facade\FlareClient\Report;
class AnonymizeIp
{
public function handle(Report $report, $next)
{
$context = $report->allContext();
$context['request']['ip'] = null;
$report->userProvidedContext($context);
return $next($report);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Facade\FlareClient\Middleware;
use Facade\FlareClient\Report;
class CensorRequestBodyFields
{
protected $fieldNames = [];
public function __construct(array $fieldNames)
{
$this->fieldNames = $fieldNames;
}
public function handle(Report $report, $next)
{
$context = $report->allContext();
foreach ($this->fieldNames as $fieldName) {
if (isset($context['request_data']['body'][$fieldName])) {
$context['request_data']['body'][$fieldName] = '<CENSORED>';
}
}
$report->userProvidedContext($context);
return $next($report);
}
}