Skip to content

Commit 0fc559e

Browse files
docs(templates): refine ITemplateManager docs
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent 3dd62e1 commit 0fc559e

1 file changed

Lines changed: 16 additions & 26 deletions

File tree

lib/public/Template/ITemplateManager.php

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,68 +12,58 @@
1212
use OCP\AppFramework\Http\TemplateResponse;
1313

1414
/**
15-
* Provides template lookup and convenience helpers for rendering pages.
16-
*
17-
* @warning Callers are expected to handle HTTP status selection. Only error
18-
* related helpers manage status selection and execution termination.
15+
* Provides helpers for locating and rendering server-side templates.
1916
*
2017
* @since 32.0.0
2118
*/
2219
interface ITemplateManager {
2320
/**
24-
* Create a template instance for the given app/template pair.
25-
*
26-
* The returned template uses the given rendering mode and will include a
27-
* CSRF token when accessed by default.
21+
* Create a template for the given app and template name.
2822
*
2923
* @param string $app App identifier that owns the template
3024
* @param string $name Template name without extension
31-
* @param TemplateResponse::RENDER_AS_* $renderAs Template rendering mode
32-
* @param bool $registerCall Whether a CSRF request token should be included
33-
*
25+
* @param TemplateResponse::RENDER_AS_* $renderAs Rendering mode / layout wrapper
26+
* @param bool $registerCall Whether to register the request for CSRF token injection
3427
* @throws TemplateNotFoundException if the template cannot be found
35-
*
3628
* @since 32.0.0
3729
*/
3830
public function getTemplate(string $app, string $name, string $renderAs = TemplateResponse::RENDER_AS_BLANK, bool $registerCall = true): ITemplate;
3931

4032
/**
41-
* Render and print a simple guest page.
33+
* Render and print a guest page.
4234
*
43-
* Assigns the provided parameters to the template before rendering.
35+
* Assigns the provided parameters to the template before printing it.
36+
* This helper does not set an HTTP status code or terminate execution.
4437
*
4538
* @param string $application App identifier that owns the template
4639
* @param string $name Template name without extension
47-
* @param array $parameters Variables assigned to the template
48-
*
40+
* @param array $parameters Template variables to assign
4941
* @since 32.0.0
5042
*/
5143
public function printGuestPage(string $application, string $name, array $parameters = []): void;
5244

5345
/**
54-
* Render and print a fatal error page, then terminate execution.
46+
* Render and print an error page, then terminate execution.
5547
*
56-
* The implementation first tries a themed HTML response, then falls back to
57-
* an unthemed HTML template, and finally to a plain-text error response.
48+
* Sets the HTTP status code before rendering. Falls back from the themed
49+
* error page to an unthemed template and finally to plain-text output if
50+
* rendering fails.
5851
*
5952
* @param string $error_msg Error message to show
60-
* @param string $hint Optional hint shown below the message (needs to be escaped)
53+
* @param string $hint Optional hint shown with the error
6154
* @param int $statusCode HTTP status code to send
62-
*
6355
* @since 32.0.0
6456
*/
6557
public function printErrorPage(string $error_msg, string $hint = '', int $statusCode = 500): never;
6658

6759
/**
6860
* Render and print an exception error page, then terminate execution.
6961
*
70-
* The exception details are shown in the HTML template, with additional debug
71-
* information when debug mode is enabled. Falls back to a plain-text error
72-
* page if rendering fails.
62+
* Sets the HTTP status code before rendering. Uses the exception to populate
63+
* the error view and falls back to plain-text output if rendering fails.
7364
*
74-
* @param \Throwable $exception The exception to render
65+
* @param \Throwable $exception Exception to render
7566
* @param int $statusCode HTTP status code to send
76-
*
7767
* @since 32.0.0
7868
*/
7969
public function printExceptionErrorPage(\Throwable $exception, int $statusCode = 503): never;

0 commit comments

Comments
 (0)