SafeDemoController
in package
Table of Contents
Methods
- displaySession() : string
- Display complete Safe session contents with formatted output
- index() : string
- Demo overview page with navigation links
- setupSession() : string
- Setup comprehensive demo session data
- formatBytes() : string
- Helper method to format bytes in human readable format
- formatValueForDisplay() : string
- Helper method to format values for display in HTML
- getDisplayStyles() : string
- Get CSS styles for the display page
- renderErrorPage() : string
- Render error page with formatted output
- renderSuccessPage() : string
- Render success page with formatted output
Methods
displaySession()
Display complete Safe session contents with formatted output
public
displaySession() : string
ROUTE: GET /safe/demo/display
Retrieves and displays all session data including regular data and flash messages. Provides both human-readable output and structured data for debugging purposes. Flash messages are consumed (removed) when displayed.
Tags
Return values
string —Formatted HTML output showing all Safe contents
index()
Demo overview page with navigation links
public
index() : string
ROUTE: GET /safe/demo
Tags
Return values
string —HTML page with demo navigation and instructions
setupSession()
Setup comprehensive demo session data
public
setupSession() : string
ROUTE: GET /safe/demo/setup
Populates the Safe session with realistic application data including user authentication, preferences, shopping cart, flash messages, and security tokens to demonstrate the full capabilities of the Safe session system.
Tags
Return values
string —HTML response confirming setup completion
formatBytes()
Helper method to format bytes in human readable format
private
formatBytes(int $bytes[, int $precision = 2 ]) : string
Parameters
- $bytes : int
-
Number of bytes
- $precision : int = 2
-
Decimal precision
Return values
string —Formatted string with units
formatValueForDisplay()
Helper method to format values for display in HTML
private
formatValueForDisplay(mixed $value) : string
Parameters
- $value : mixed
-
The value to format
Return values
string —Formatted HTML string
getDisplayStyles()
Get CSS styles for the display page
private
getDisplayStyles() : string
Return values
string —CSS style block
renderErrorPage()
Render error page with formatted output
private
renderErrorPage(string $title, string $message) : string
Parameters
- $title : string
-
Error title
- $message : string
-
Error message
Return values
string —HTML error page
renderSuccessPage()
Render success page with formatted output
private
renderSuccessPage(string $title[, array<string|int, mixed> $details = [] ]) : string
Parameters
- $title : string
-
Success message title
- $details : array<string|int, mixed> = []
-
Additional details to display
Return values
string —HTML success page