Issues (1574)

src/Exception/ExceptionMiddleware.php (17 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace DMT\Insolvency\Exception;
4
5
use DMT\CommandBus\Validator\ValidationException;
6
use DMT\Insolvency\Http\Request\GetReport;
7
use DMT\Insolvency\Http\Response\GetReportResponse;
8
use DMT\Insolvency\Soap\Request;
9
use DMT\Insolvency\Soap\Response;
10
use JMS\Serializer\Exception\Exception as SerializerException;
11
use League\Tactician\Middleware;
12
use Psr\Http\Client\ClientExceptionInterface;
13
14
/**
15
 * Class ExceptionMiddleware
16
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
17
class ExceptionMiddleware implements Middleware
18
{
19
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
20
     * @param Request|GetReport $command
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
21
     * @param callable $next
0 ignored issues
show
Missing parameter comment
Loading history...
Expected 10 spaces after parameter type; 1 found
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
22
     * @return Response|GetReportResponse
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
23
     * @throws Exception
0 ignored issues
show
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
24
     */
25 16
    public function execute($command, callable $next)
26
    {
27
        try {
28
            /** @var Response|GetReportResponse $response */
0 ignored issues
show
The open comment tag must be the only content on the line
Loading history...
Missing short description in doc comment
Loading history...
The close comment tag must be the only content on the line
Loading history...
29 16
            return $next($command);
30 5
        } catch (Exception $exception) {
31 2
            throw $exception;
32 3
        } catch (ClientExceptionInterface $exception) {
33 1
            throw new UnavailableException($exception->getMessage(), 0, $exception);
34 2
        } catch (ValidationException $exception) {
35 1
            throw new RequestException($exception->getMessage(), 0, $exception);
36 1
        } catch (SerializerException $exception) {
37 1
            throw new UnavailableException($exception->getMessage(), 0, $exception);
38
        }
39
    }
40
}
41