IController
in
Controller interface defining the contract for MVC controllers.
All controllers in the Neuron MVC framework must implement this interface to ensure consistent rendering capabilities across different response formats. Controllers handle request processing and response generation for HTML, JSON, and XML.
Table of Contents
Methods
- renderHtml() : string
- Renders an HTML response.
- renderJson() : string
- Renders a JSON response.
- renderMarkdown() : string
- Renders a Markdown response.
- renderXml() : string
- Renders an XML response.
Methods
renderHtml()
Renders an HTML response.
public
renderHtml(HttpResponseStatus $responseCode[, array<string|int, mixed> $data = [] ][, string $page = "index" ][, string $layout = "default" ][, bool|null $cacheEnabled = null ]) : string
Parameters
- $responseCode : HttpResponseStatus
-
The HTTP response status code.
- $data : array<string|int, mixed> = []
-
Data to be passed to the view.
- $page : string = "index"
-
The view page to render.
- $layout : string = "default"
-
The layout to use for rendering.
- $cacheEnabled : bool|null = null
-
Whether caching is enabled for this response.
Return values
string —The rendered HTML content.
renderJson()
Renders a JSON response.
public
renderJson(HttpResponseStatus $responseCode[, array<string|int, mixed> $data = [] ]) : string
Parameters
- $responseCode : HttpResponseStatus
-
The HTTP response status code.
- $data : array<string|int, mixed> = []
-
Data to be included in the JSON response.
Return values
string —The rendered JSON content.
renderMarkdown()
Renders a Markdown response.
public
renderMarkdown(HttpResponseStatus $responseCode[, array<string|int, mixed> $data = [] ][, string $page = "index" ][, string $layout = "default" ][, bool|null $cacheEnabled = null ]) : string
Parameters
- $responseCode : HttpResponseStatus
-
The HTTP response status code.
- $data : array<string|int, mixed> = []
-
Data to be passed to the view.
- $page : string = "index"
-
The view page to render.
- $layout : string = "default"
-
The layout to use for rendering.
- $cacheEnabled : bool|null = null
-
Whether caching is enabled for this response.
Return values
string —The rendered Markdown content.
renderXml()
Renders an XML response.
public
renderXml(HttpResponseStatus $responseCode[, array<string|int, mixed> $data = [] ]) : string
Parameters
- $responseCode : HttpResponseStatus
-
The HTTP response status code.
- $data : array<string|int, mixed> = []
-
Data to be included in the XML response.
Return values
string —The rendered XML content.