Bitrix API

AjaxJson extends Json implements Errorable

Table of Contents

Interfaces

Errorable

Constants

STATUS_DENIED  = 'denied'
STATUS_ERROR  = 'error'
STATUS_SUCCESS  = 'success'
STORE_COOKIE_NAME  = 'STORE_COOKIES'

Methods

__construct()  : mixed
addCookie()  : $this
Adds a cookie to the response.
addHeader()  : $this
Adds an HTTP header field to the response.
allowPersistentCookies()  : mixed
Remembers user's choice about storing persistent cookies.
appendContent()  : $this
Appends content.
clear()  : mixed
copyHeadersTo()  : HttpResponse
createDenied()  : mixed
createError()  : mixed
createSuccess()  : mixed
flush()  : mixed
Flushes the content to the output buffer. All following output will be ignored.
getContent()  : string
Returns content of response.
getCookies()  : array<string|int, Cookie>
getErrorByCode()  : Error
Getting once error with the necessary code.
getErrors()  : array<string|int, Error>
Getting array of errors.
getHeaders()  : HttpHeaders
getStatus()  : int
Returns the HTTP status of the response.
redirectTo()  : Redirect
send()  : void
Sends content to the output.
setContent()  : $this
Sets content.
setData()  : mixed
setHeaders()  : $this
Sets a collection of HTTP headers.
setLastModified()  : $this
Sets the latest time for the Last-Modified header field.
setStatus()  : $this
Sets the HTTP status of the response.
writeHeaders()  : mixed
Flushes all headers and cookies

Constants

STATUS_DENIED

public mixed STATUS_DENIED = 'denied'

STATUS_ERROR

public mixed STATUS_ERROR = 'error'

STATUS_SUCCESS

public mixed STATUS_SUCCESS = 'success'
public mixed STORE_COOKIE_NAME = 'STORE_COOKIES'

Methods

__construct()

public __construct([mixed $data = null ][, mixed $status = \self::STATUS_SUCCESS ][, ErrorCollection $errorCollection = null ]) : mixed
Parameters
$data : mixed = null
$status : mixed = \self::STATUS_SUCCESS
$errorCollection : ErrorCollection = null

addCookie()

Adds a cookie to the response.

public addCookie(Cookie $cookie[, bool $replace = true ][, bool $checkExpires = true ]) : $this
Parameters
$cookie : Cookie

The cookie.

$replace : bool = true

Replace an existing cookie or not.

$checkExpires : bool = true

Check expires value of the cookie or not.

Return values
$this

addHeader()

Adds an HTTP header field to the response.

public addHeader(string $name[, string $value = '' ]) : $this
Parameters
$name : string

Header field name

$value : string = ''

Header field value

Tags
throws
ArgumentNullException
Return values
$this

allowPersistentCookies()

Remembers user's choice about storing persistent cookies.

public allowPersistentCookies(bool $mode) : mixed
Parameters
$mode : bool

appendContent()

Appends content.

public appendContent(mixed $content) : $this

Valid types are strings, numbers, null, and objects that implement a __toString() method.

Parameters
$content : mixed

Content that can be cast to string.

Tags
throws
ArgumentTypeException
Return values
$this

createDenied()

public final static createDenied([ErrorCollection $errorCollection = null ][, mixed $data = null ]) : mixed
Parameters
$errorCollection : ErrorCollection = null
$data : mixed = null

createError()

public final static createError([ErrorCollection $errorCollection = null ][, mixed $data = null ]) : mixed
Parameters
$errorCollection : ErrorCollection = null
$data : mixed = null

createSuccess()

public final static createSuccess([mixed $data = null ]) : mixed
Parameters
$data : mixed = null

flush()

Flushes the content to the output buffer. All following output will be ignored.

public flush([string $text = '' ]) : mixed
Parameters
$text : string = ''

getContent()

Returns content of response.

public getContent() : string
Return values
string

getErrorByCode()

Getting once error with the necessary code.

public final getErrorByCode(string $code) : Error
Parameters
$code : string

Code of error.

Return values
Error

getErrors()

Getting array of errors.

public final getErrors() : array<string|int, Error>
Return values
array<string|int, Error>

getStatus()

Returns the HTTP status of the response.

public getStatus() : int
Return values
int

send()

Sends content to the output.

public send() : void

setContent()

Sets content.

public setContent(mixed $content) : $this

Valid types are strings, numbers, null, and objects that implement a __toString() method.

Parameters
$content : mixed

Content that can be cast to string.

Tags
throws
ArgumentTypeException
Return values
$this

setData()

public final setData(mixed $data) : mixed
Parameters
$data : mixed

setHeaders()

Sets a collection of HTTP headers.

public setHeaders(HttpHeaders $headers) : $this
Parameters
$headers : HttpHeaders

Headers collection.

Return values
$this

setLastModified()

Sets the latest time for the Last-Modified header field.

public setLastModified(DateTime $time) : $this
Parameters
$time : DateTime
Return values
$this

setStatus()

Sets the HTTP status of the response.

public setStatus(string|int $status) : $this
Parameters
$status : string|int
Return values
$this

writeHeaders()

Flushes all headers and cookies

public writeHeaders() : mixed

        
On this page

Search results