15
15
use OCP \EventDispatcher \IEventDispatcher ;
16
16
use OCP \IRequest ;
17
17
use OCP \Server ;
18
+ use OCP \Template \ITemplate ;
18
19
use Psr \Log \LoggerInterface ;
19
20
20
21
class TemplateManager {
@@ -24,6 +25,9 @@ public function __construct(
24
25
) {
25
26
}
26
27
28
+ /**
29
+ * @param TemplateResponse::RENDER_AS_* $renderAs
30
+ */
27
31
public function getTemplate (string $ app , string $ name , string $ renderAs = TemplateResponse::RENDER_AS_BLANK , bool $ registerCall = true ): ITemplate {
28
32
return new Template ($ app , $ name , $ renderAs , $ registerCall );
29
33
}
@@ -105,7 +109,7 @@ public function printExceptionErrorPage(\Throwable $exception, int $statusCode =
105
109
$ debug = false ;
106
110
http_response_code ($ statusCode );
107
111
try {
108
- $ debug = Server::get (\OC \SystemConfig::class)->getValue ('debug ' , false );
112
+ $ debug = ( bool ) Server::get (\OC \SystemConfig::class)->getValue ('debug ' , false );
109
113
$ serverLogsDocumentation = Server::get (\OC \SystemConfig::class)->getValue ('documentation_url.server_logs ' , '' );
110
114
$ request = Server::get (IRequest::class);
111
115
$ content = new Template ('' , 'exception ' , 'error ' , false );
@@ -122,7 +126,7 @@ public function printExceptionErrorPage(\Throwable $exception, int $statusCode =
122
126
$ content ->printPage ();
123
127
} catch (\Exception $ e ) {
124
128
try {
125
- $ logger = \ OCP \ Server::get (LoggerInterface::class);
129
+ $ logger = Server::get (LoggerInterface::class);
126
130
$ logger ->error ($ exception ->getMessage (), ['app ' => 'core ' , 'exception ' => $ exception ]);
127
131
$ logger ->error ($ e ->getMessage (), ['app ' => 'core ' , 'exception ' => $ e ]);
128
132
} catch (\Throwable $ e ) {
0 commit comments