ExceptionHandler::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the Koriym.Baracoa package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Koriym\Baracoa;
8
9
final class ExceptionHandler implements ExceptionHandlerInterface
10
{
11 1
    public function __invoke(\V8JsScriptException $e) : string
12
    {
13 1
        $erroCode = mb_strimwidth($e->getJsSourceLine(), $e->getJsStartColumn(), 240, '...');
14 1
        $errorMsg = sprintf(
15 1
            "%s\n%s\nJS Stack trace:\n%s",
16 1
            $e->getMessage(),
17
            $erroCode,
18 1
            $e->getJsTrace()
19
        );
20 1
        throw new \V8JsScriptException($errorMsg);
21
    }
22
}
23