PHP Класс Piwik\API\ResponseBuilder

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $outputFormat, array $request = [] )
disableDataTablePostProcessor ( )
disableSendHeader ( )
getResponse ( mixed $value = null, boolean | string $apiModule = false, boolean | string $apiMethod = false ) : mixed This method processes the data resulting from the API call.
getResponseException ( Exceptio\Exception | Throwable $e ) : string Returns an error $message in the requested $format

Приватные методы

Метод Описание
decorateExceptionWithDebugTrace ( Exceptio\Exception | Throwable $e ) : Exception
formatExceptionMessage ( Exceptio\Exception | Throwable $exception ) : string
handleArray ( $array )
handleDataTable ( Piwik\DataTable\DataTableInterface $datatable )
sendHeaderIfEnabled ( )

Описание методов

__construct() публичный Метод

public __construct ( string $outputFormat, array $request = [] )
$outputFormat string
$request array

disableDataTablePostProcessor() публичный Метод

disableSendHeader() публичный Метод

public disableSendHeader ( )

getResponse() публичный Метод

- If the data resulted from the API call is a DataTable then - we apply the standard filters if the parameters have been found in the URL. For example to offset,limit the Table you can add the following parameters to any API call that returns a DataTable: filter_limit=10&filter_offset=20 - we apply the filters that have been previously queued on the DataTable
См. также: DataTable::queueFilter() - we apply the renderer that generate the DataTable in a given format (XML, PHP, HTML, JSON, etc.) the format can be changed using the 'format' parameter in the request. Example: format=xml - If there is nothing returned (void) we display a standard success message - If there is a PHP array returned, we try to convert it to a dataTable It is then possible to convert this datatable to any requested format (xml/etc) - If a bool is returned we convert to a string (true is displayed as 'true' false as 'false') - If an integer / float is returned, we simply return it
public getResponse ( mixed $value = null, boolean | string $apiModule = false, boolean | string $apiMethod = false ) : mixed
$value mixed The initial returned value, before post process. If set to null, success response is returned.
$apiModule boolean | string The API module that was called
$apiMethod boolean | string The API method that was called
Результат mixed Usually a string, but can still be a PHP data structure if the format requested is 'original'

getResponseException() публичный Метод

Returns an error $message in the requested $format
public getResponseException ( Exceptio\Exception | Throwable $e ) : string
$e Exceptio\Exception | Throwable
Результат string