@@ -20,15 +20,22 @@ public function __invoke(ContainerInterface $container): ProblemDetailsResponseF
20
20
{
21
21
$ config = $ container ->has ('config ' ) ? $ container ->get ('config ' ) : [];
22
22
Assert::isArrayAccessible ($ config );
23
- $ debug = isset ($ config ['debug ' ]) && is_bool ($ config ['debug ' ]) ? $ config ['debug ' ] : null ;
24
- $ includeThrowableDetail = $ debug ?? ProblemDetailsResponseFactory::EXCLUDE_THROWABLE_DETAILS ;
23
+ $ debug = isset ($ config ['debug ' ]) && is_bool ($ config ['debug ' ]) ? $ config ['debug ' ] : null ;
24
+ $ debug ??= ProblemDetailsResponseFactory::EXCLUDE_THROWABLE_DETAILS ;
25
25
26
26
$ problemDetailsConfig = $ config ['problem-details ' ] ?? [];
27
27
Assert::isArrayAccessible ($ problemDetailsConfig );
28
+
29
+ $ includeThrowableDetail = isset ($ problemDetailsConfig ['include-throwable-details ' ])
30
+ && is_bool ($ problemDetailsConfig ['include-throwable-details ' ])
31
+ ? $ problemDetailsConfig ['include-throwable-details ' ] : null ;
32
+ $ includeThrowableDetail ??= $ debug ;
33
+
28
34
$ jsonFlags = $ problemDetailsConfig ['json_flags ' ] ?? null ;
29
35
assert ($ jsonFlags === null || is_int ($ jsonFlags ));
30
36
$ defaultTypesMap = $ problemDetailsConfig ['default_types_map ' ] ?? [];
31
37
Assert::isArray ($ defaultTypesMap );
38
+
32
39
foreach ($ defaultTypesMap as $ key => $ value ) {
33
40
assert (is_int ($ key ));
34
41
assert (is_string ($ value ));
@@ -38,7 +45,7 @@ public function __invoke(ContainerInterface $container): ProblemDetailsResponseF
38
45
39
46
return new ProblemDetailsResponseFactory (
40
47
$ this ->detectResponseFactory ($ container ),
41
- $ includeThrowableDetail ,
48
+ $ debug ,
42
49
$ jsonFlags ,
43
50
$ includeThrowableDetail ,
44
51
ProblemDetailsResponseFactory::DEFAULT_DETAIL_MESSAGE ,
0 commit comments