Completed
Push — master ( 30ef78...8f8c1f )
by Niels
16s queued 10s
created

BadJsonRequestHttpException::getErrors()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the OpenapiBundle package.
5
 *
6
 * (c) Niels Nijens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Nijens\OpenapiBundle\Exception;
13
14
use Exception;
15
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
16
17
/**
18
 * BadJsonRequestHttpException.
19
 *
20
 * @author Niels Nijens <[email protected]>
21
 */
22
class BadJsonRequestHttpException extends BadRequestHttpException implements HttpExceptionInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getErrors(): array
28
    {
29
        $errors = array();
30
31
        $previousException = $this->getPrevious();
32
        if ($previousException instanceof Exception) {
0 ignored issues
show
introduced by
$previousException is always a sub-type of Exception.
Loading history...
33
            $errors[] = $previousException->getMessage();
34
        }
35
36
        return $errors;
37
    }
38
}
39