-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathWhoopsConfiguration.php
More file actions
58 lines (50 loc) · 1.33 KB
/
WhoopsConfiguration.php
File metadata and controls
58 lines (50 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace Equip\Configuration;
use Auryn\Injector;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PlainTextHandler;
use Whoops\Run as Whoops;
class WhoopsConfiguration implements ConfigurationInterface
{
use EnvTrait;
/**
* @inheritDoc
*/
public function apply(Injector $injector)
{
$injector->prepare(Whoops::class, [$this, 'prepareWhoops']);
$injector->prepare(JsonResponseHandler::class, [$this, 'prepareJsonHandler']);
$injector->prepare(PlainTextHandler::class, [$this, 'preparePlainTextHandler']);
}
/**
* @param Whoops $whoops
*
* @return void
*/
public function prepareWhoops(Whoops $whoops)
{
if($this->env->getValue('DEBUG_STACKTRACE', false) == true) {
set_error_handler([$whoops, Whoops::ERROR_HANDLER]);
}
$whoops->writeToOutput(false);
$whoops->allowQuit(false);
}
/**
* @param JsonResponseHandler $handler
*
* @return void
*/
public function prepareJsonHandler(JsonResponseHandler $handler)
{
$handler->addTraceToOutput(true);
}
/**
* @param PlainTextHandler $handler
*
* @return void
*/
public function preparePlainTextHandler(PlainTextHandler $handler)
{
$handler->addTraceToOutput(true);
}
}