com\setasign\SetaFramework\Controller

AbstractJsonController Class Controller Json

File: /SetaFramework/src/Controller/AbstractJsonController.php

Class hierarchy

Implements

Summary

Properties

$data

protected mixed AbstractJsonController::$data

Result data to convert to JSON.

$encodingOptions

Default JSON encoding is performed with the following options, which produces RFC4627-compliant JSON, capable of embedding into HTML.

default value of:

JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES

$response

protected ?\Psr\Http\Message\ResponseInterface AbstractController::$response

$textContentType

If true the response contentType will be 'text/html; charset=utf-8' instead of 'application/json'.

Needed for the IE. The IE will try to download 'application/json' responses from iframes.


Methods

getParam()

public AbstractController::getParam (
string $name,
mixed $default = null
): ?mixed

Returns a param if it exists otherwise this will return $default

Parameters
$name : string
 
$default : mixed
 

getParams()

public AbstractController::getParams (
void
): array

Get all existing params

getResponse()

public AbstractController::getResponse (
void
): \Psr\Http\Message\ResponseInterface

renderView()

protected AbstractJsonController::renderView (
void
): void
Exceptions

Throws \JsonException

resetResponse()

public AbstractController::resetResponse (
void
): void

setParam()

public AbstractController::setParam (
string $name,
mixed $value
): ControllerInterface

Sets a param

Parameters
$name : string
 
$value : mixed
 

setParams()

Set a array of params

Note: The params will be merged with the existing params!!

Parameters
$params : array