SandboxErrorHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleException() 0 7 3
1
<?php
2
3
namespace nystudio107\crafttwigsandbox\console;
4
5
use craft\console\ErrorHandler;
6
use Twig\Sandbox\SecurityError;
7
8
class SandboxErrorHandler extends ErrorHandler
9
{
10
    // Public Methods
11
    // =========================================================================
12
13
    /**
14
     * @inheritDoc
15
     */
16
    public function handleException($exception): void
17
    {
18
        // If this is a Twig Runtime exception, use the previous one instead
19
        if ($exception instanceof SecurityError && ($previousException = $exception->getPrevious()) !== null) {
20
            $exception = $previousException;
21
        }
22
        parent::handleException($exception);
23
    }
24
}
25