Upgrade framework
This commit is contained in:
30
vendor/spatie/flare-client-php/src/FlareMiddleware/AddSolutions.php
vendored
Normal file
30
vendor/spatie/flare-client-php/src/FlareMiddleware/AddSolutions.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\FlareClient\FlareMiddleware;
|
||||
|
||||
use Closure;
|
||||
use Spatie\FlareClient\Report;
|
||||
use Spatie\Ignition\Contracts\SolutionProviderRepository;
|
||||
|
||||
class AddSolutions implements FlareMiddleware
|
||||
{
|
||||
protected SolutionProviderRepository $solutionProviderRepository;
|
||||
|
||||
public function __construct(SolutionProviderRepository $solutionProviderRepository)
|
||||
{
|
||||
$this->solutionProviderRepository = $solutionProviderRepository;
|
||||
}
|
||||
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
if ($throwable = $report->getThrowable()) {
|
||||
$solutions = $this->solutionProviderRepository->getSolutionsForThrowable($throwable);
|
||||
|
||||
foreach ($solutions as $solution) {
|
||||
$report->addSolution($solution);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user