InvalidValueException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 12
nc 2
nop 5
dl 0
loc 15
ccs 0
cts 15
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Laravel Platfourm package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\Platfourm\Foundation\Exceptions;
12
13
use Symfony\Component\HttpKernel\Exception\HttpException;
14
15
class InvalidValueException extends HttpException
16
{
17
18
    public function __construct(
19
        $message = null,
20
        $statusCode = 400,
21
        \Exception $previous = null,
22
        array $headers = [],
23
        $code = 0
24
    ) {
25
        if (empty($message)) {
26
            $trace   = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
27
            $message = '"invalid value on ' . $trace[0]['file'] . ' line ' . $trace[0]['line'] . '"';
28
        } else {
29
            $message = '"' . $message . '"';
30
        }
31
        parent::__construct($statusCode, $message, $previous, $headers, $code);
32
    }
33
}
34