Passed
Pull Request — next (#84)
by Bas
15:17 queued 11:12
created

QueryException::formatMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 4
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Exceptions;
6
7
use Illuminate\Database\QueryException as IlluminateQueryException;
8
use Throwable;
9
10
class QueryException extends IlluminateQueryException
11
{
12
    /**
13
     * Format the SQL error message.
14
     *
15
     * @param  string  $sql
16
     * @param  array<mixed>  $bindings
17
     * @return string
18
     */
19 7
    protected function formatMessage($connectionName, $sql, $bindings, Throwable $previous)
20
    {
21 7
        return $previous->getMessage()
22 7
            . ' (Connection: ' . $connectionName
23 7
            . ',AQL: ' . $sql
24 7
            . ' - Bindings: ' . var_export($bindings, true)
25 7
            . ')';
26
    }
27
}
28