Passed
Push — master ( 4eed2e...471128 )
by Alexander
03:23
created

DebugExceptionRender::DebugHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * Lenevor Framework
5
 *
6
 * LICENSE
7
 *
8
 * This source file is subject to the new BSD license that is bundled
9
 * with this package in the file license.md.
10
 * It is also available through the world-wide-web at this URL:
11
 * https://lenevor.com/license
12
 * If you did not receive a copy of the license and are unable to
13
 * obtain it through the world-wide-web, please send an email
14
 * to [email protected] so we can send you a copy immediately.
15
 *
16
 * @package     Lenevor
17
 * @subpackage  Base
18
 * @link        https://lenevor.com
19
 * @copyright   Copyright (c) 2019 - 2023 Alexander Campo <[email protected]>
20
 * @license     https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md
21
 */
22
23
namespace Syscodes\Components\Core\Exceptions\Debugging;
24
25
use Syscodes\Components\Debug\GDebug;
26
use Syscodes\Components\Contracts\Core\ExceptionRender;
27
28
use function take;
29
30
/**
31
 * Creates a new Debug exception render instance.
32
 */
33
class DebugExceptionRender implements ExceptionRender
34
{
35
    /**
36
     * Renders the given exception as HTML.
37
     * 
38
     * @param  \Throwable  $exception
39
     * 
40
     * @return string
41
     */
42
    public function render($exception): string
43
    {
44
        return take(new GDebug, function ($debug) {
45
            
46
            $debug->appendHandler($this->DebugHandler());
47
48
            $debug->writeToOutput(false);
49
50
            $debug->allowQuit(false);
51
52
        })->handleException($exception);
0 ignored issues
show
Bug introduced by
The method handleException() does not exist on Syscodes\Components\Support\HigherOrderTakeProxy. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
        })->/** @scrutinizer ignore-call */ handleException($exception);
Loading history...
53
    }
54
    
55
    /**
56
     * Get the Debug handler for the application.
57
     *
58
     * @return \Syscodes\Components\Debug\Handlers\MainHandler
59
     */
60
    protected function DebugHandler()
61
    {
62
        return (new DebugHandler)->initDebug();
63
    }
64
}