PHP Класс PHPDaemon\Request\Generic

Наследование: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog, use trait PHPDaemon\Traits\EventHandlers
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$appInstance PHPDaemon\Core\AppInstance Related Application instance
$attrs StdCLass Attributes

Защищенные свойства (Protected)

Свойство Тип Описание
$aborted boolean Is this request aborted?
$autoinit
$codepoint mixed Current code point
$ev object Event
$priority integer Priority
$running boolean Is this request running?
$shutdownFuncs array Registered shutdown functions
$sleepTime float Current sleep() time
$state State
$upstream object Upstream

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

Метод Описание
__construct ( AppInstance $appInstance, PHPDaemon\Request\IRequestUpstream $upstream, object $parent = null ) Constructor
__toString ( ) : string This magic method called when the object casts to string
abort ( ) : void Aborts the request
callInit ( )
checkIfReady ( ) : boolean Called to check if Request is ready
codepoint ( $p ) : boolean Helper for easy switching between several interruptable stages of request's execution
eventCall ( $arg ) : void Event handler of Request, called by Evtimer
finish ( $status, $zombie = false ) : void Finish the request
free ( ) : void Frees the request
getArray ( &$var, $filter = null ) : string Get array value from the given variable
getInteger ( &$var, $values = null ) : string Get integer value from the given variable
getMixed ( &$var ) : string Get string value from the given variable
getString ( &$var, $values = null ) : string Get string value from the given variable
handleException ( $e ) : boolean | null Uncaught exception handler
isAborted ( ) : boolean Is this request aborted?
isFinished ( ) : boolean Is this request finished?
isRunning ( ) : boolean Is this request running?
log ( string $msg ) : void Log
onAbort ( ) : void Called when the request aborted
onFinish ( ) : void Called when the request finished
onSleep ( ) : void Called when the request starts sleep
onWakeup ( ) : void Called when the request wakes up
onWrite ( ) : void Called when the connection is ready to accept new data
out ( string $s, boolean $flush = true ) : boolean | null Output some data
registerShutdownFunction ( callable $callback ) : void Adds new callback called before the request finished
setPriority ( $p ) : void Sets the priority
sleep ( integer $time, boolean $set = false ) : void Delays the request execution for the given number of seconds
terminate ( $s = null ) : void Throws terminating exception
unregisterShutdownFunction ( callable $callback ) : void Remove the given callback
wakeup ( ) : void Cancel current sleep

Защищенные методы

Метод Описание
init ( ) : void Called when request constructs
postFinishHandler ( callable $cb = null ) : void Called after request finish
preinit ( $req ) : void Preparing before init
run ( ) : integer Called when request iterated.

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

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

Constructor
public __construct ( AppInstance $appInstance, PHPDaemon\Request\IRequestUpstream $upstream, object $parent = null )
$appInstance PHPDaemon\Core\AppInstance Parent AppInstance.
$upstream PHPDaemon\Request\IRequestUpstream Upstream.
$parent object Source request.

__toString() публичный метод

This magic method called when the object casts to string
public __toString ( ) : string
Результат string Description

abort() публичный метод

Aborts the request
public abort ( ) : void
Результат void

callInit() публичный метод

public callInit ( )

checkIfReady() публичный метод

Called to check if Request is ready
public checkIfReady ( ) : boolean
Результат boolean Ready?

codepoint() публичный метод

Helper for easy switching between several interruptable stages of request's execution
public codepoint ( $p ) : boolean
Результат boolean Execute

eventCall() публичный метод

Event handler of Request, called by Evtimer
public eventCall ( $arg ) : void
$arg
Результат void

finish() публичный метод

Finish the request
public finish ( $status, $zombie = false ) : void
Результат void

free() публичный метод

Frees the request
public free ( ) : void
Результат void

getArray() публичный статический метод

Get array value from the given variable
public static getArray ( &$var, $filter = null ) : string
Результат string Value.

getInteger() публичный статический метод

Get integer value from the given variable
public static getInteger ( &$var, $values = null ) : string
Результат string Value.

getMixed() публичный статический метод

Get string value from the given variable
public static getMixed ( &$var ) : string
Результат string Value.

getString() публичный статический метод

Get string value from the given variable
public static getString ( &$var, $values = null ) : string
Результат string Value.

handleException() публичный метод

Uncaught exception handler
public handleException ( $e ) : boolean | null
$e
Результат boolean | null Handled?

init() защищенный метод

Called when request constructs
protected init ( ) : void
Результат void

isAborted() публичный метод

Is this request aborted?
public isAborted ( ) : boolean
Результат boolean

isFinished() публичный метод

Is this request finished?
public isFinished ( ) : boolean
Результат boolean

isRunning() публичный метод

Is this request running?
public isRunning ( ) : boolean
Результат boolean

log() публичный метод

Log
public log ( string $msg ) : void
$msg string Message
Результат void

onAbort() публичный метод

Called when the request aborted
public onAbort ( ) : void
Результат void

onFinish() публичный метод

Called when the request finished
public onFinish ( ) : void
Результат void

onSleep() публичный метод

Called when the request starts sleep
public onSleep ( ) : void
Результат void

onWakeup() публичный метод

Called when the request wakes up
public onWakeup ( ) : void
Результат void

onWrite() публичный метод

Called when the connection is ready to accept new data
public onWrite ( ) : void
Результат void

out() публичный метод

Output some data
public out ( string $s, boolean $flush = true ) : boolean | null
$s string String to out
$flush boolean
Результат boolean | null Success

postFinishHandler() защищенный метод

Called after request finish
protected postFinishHandler ( callable $cb = null ) : void
$cb callable
Результат void

preinit() защищенный метод

Preparing before init
protected preinit ( $req ) : void
Результат void

registerShutdownFunction() публичный метод

Adds new callback called before the request finished
public registerShutdownFunction ( callable $callback ) : void
$callback callable
Результат void

run() защищенный метод

Called when request iterated.
protected run ( ) : integer
Результат integer Status.

setPriority() публичный метод

Sets the priority
public setPriority ( $p ) : void
Результат void

sleep() публичный метод

Delays the request execution for the given number of seconds
public sleep ( integer $time, boolean $set = false ) : void
$time integer Time to sleep in seconds
$set boolean Set this parameter to true when use call it outside of Request->run() or if you don't want to interrupt execution now
Результат void

terminate() публичный метод

Throws terminating exception
public terminate ( $s = null ) : void
$s
Результат void

unregisterShutdownFunction() публичный метод

Remove the given callback
public unregisterShutdownFunction ( callable $callback ) : void
$callback callable
Результат void

wakeup() публичный метод

Cancel current sleep
public wakeup ( ) : void
Результат void

Описание свойств

$aborted защищенное свойство

Is this request aborted?
protected bool $aborted
Результат boolean

$appInstance публичное свойство

Related Application instance
public AppInstance,PHPDaemon\Core $appInstance
Результат PHPDaemon\Core\AppInstance

$attrs публичное свойство

Attributes
public StdCLass $attrs
Результат StdCLass

$autoinit защищенное свойство

protected $autoinit

$codepoint защищенное свойство

Current code point
protected mixed $codepoint
Результат mixed

$ev защищенное свойство

Event
protected object $ev
Результат object

$priority защищенное свойство

Priority
protected int $priority
Результат integer

$running защищенное свойство

Is this request running?
protected bool $running
Результат boolean

$shutdownFuncs защищенное свойство

Registered shutdown functions
protected array $shutdownFuncs
Результат array

$sleepTime защищенное свойство

Current sleep() time
protected float $sleepTime
Результат float

$state защищенное свойство

State
protected $state

$upstream защищенное свойство

Upstream
protected object $upstream
Результат object