Primo Committ
This commit is contained in:
30
vendor/facade/ignition/src/Middleware/AddSolutions.php
vendored
Normal file
30
vendor/facade/ignition/src/Middleware/AddSolutions.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Facade\Ignition\Middleware;
|
||||
|
||||
use Facade\FlareClient\Report;
|
||||
use Facade\IgnitionContracts\SolutionProviderRepository;
|
||||
|
||||
class AddSolutions
|
||||
{
|
||||
/** @var \Facade\IgnitionContracts\SolutionProviderRepository */
|
||||
protected $solutionProviderRepository;
|
||||
|
||||
public function __construct(SolutionProviderRepository $solutionProviderRepository)
|
||||
{
|
||||
$this->solutionProviderRepository = $solutionProviderRepository;
|
||||
}
|
||||
|
||||
public function handle(Report $report, $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