PHP Class PHPDaemon\Request\Generic

Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog, use trait PHPDaemon\Traits\EventHandlers
Afficher le fichier Open project: kakserpom/phpdaemon Class Usage Examples

Méthodes publiques

Свойство Type Description
$appInstance PHPDaemon\Core\AppInstance Related Application instance
$attrs StdCLass Attributes

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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.

Method Details

__construct() public méthode

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() public méthode

This magic method called when the object casts to string
public __toString ( ) : string
Résultat string Description

abort() public méthode

Aborts the request
public abort ( ) : void
Résultat void

callInit() public méthode

public callInit ( )

checkIfReady() public méthode

Called to check if Request is ready
public checkIfReady ( ) : boolean
Résultat boolean Ready?

codepoint() public méthode

Helper for easy switching between several interruptable stages of request's execution
public codepoint ( $p ) : boolean
Résultat boolean Execute

eventCall() public méthode

Event handler of Request, called by Evtimer
public eventCall ( $arg ) : void
$arg
Résultat void

finish() public méthode

Finish the request
public finish ( $status, $zombie = false ) : void
Résultat void

free() public méthode

Frees the request
public free ( ) : void
Résultat void

getArray() public static méthode

Get array value from the given variable
public static getArray ( &$var, $filter = null ) : string
Résultat string Value.

getInteger() public static méthode

Get integer value from the given variable
public static getInteger ( &$var, $values = null ) : string
Résultat string Value.

getMixed() public static méthode

Get string value from the given variable
public static getMixed ( &$var ) : string
Résultat string Value.

getString() public static méthode

Get string value from the given variable
public static getString ( &$var, $values = null ) : string
Résultat string Value.

handleException() public méthode

Uncaught exception handler
public handleException ( $e ) : boolean | null
$e
Résultat boolean | null Handled?

init() protected méthode

Called when request constructs
protected init ( ) : void
Résultat void

isAborted() public méthode

Is this request aborted?
public isAborted ( ) : boolean
Résultat boolean

isFinished() public méthode

Is this request finished?
public isFinished ( ) : boolean
Résultat boolean

isRunning() public méthode

Is this request running?
public isRunning ( ) : boolean
Résultat boolean

log() public méthode

Log
public log ( string $msg ) : void
$msg string Message
Résultat void

onAbort() public méthode

Called when the request aborted
public onAbort ( ) : void
Résultat void

onFinish() public méthode

Called when the request finished
public onFinish ( ) : void
Résultat void

onSleep() public méthode

Called when the request starts sleep
public onSleep ( ) : void
Résultat void

onWakeup() public méthode

Called when the request wakes up
public onWakeup ( ) : void
Résultat void

onWrite() public méthode

Called when the connection is ready to accept new data
public onWrite ( ) : void
Résultat void

out() public méthode

Output some data
public out ( string $s, boolean $flush = true ) : boolean | null
$s string String to out
$flush boolean
Résultat boolean | null Success

postFinishHandler() protected méthode

Called after request finish
protected postFinishHandler ( callable $cb = null ) : void
$cb callable
Résultat void

preinit() protected méthode

Preparing before init
protected preinit ( $req ) : void
Résultat void

registerShutdownFunction() public méthode

Adds new callback called before the request finished
public registerShutdownFunction ( callable $callback ) : void
$callback callable
Résultat void

run() protected méthode

Called when request iterated.
protected run ( ) : integer
Résultat integer Status.

setPriority() public méthode

Sets the priority
public setPriority ( $p ) : void
Résultat void

sleep() public méthode

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
Résultat void

terminate() public méthode

Throws terminating exception
public terminate ( $s = null ) : void
$s
Résultat void

unregisterShutdownFunction() public méthode

Remove the given callback
public unregisterShutdownFunction ( callable $callback ) : void
$callback callable
Résultat void

wakeup() public méthode

Cancel current sleep
public wakeup ( ) : void
Résultat void

Property Details

$aborted protected_oe property

Is this request aborted?
protected bool $aborted
Résultat boolean

$appInstance public_oe property

Related Application instance
public AppInstance,PHPDaemon\Core $appInstance
Résultat PHPDaemon\Core\AppInstance

$attrs public_oe property

Attributes
public StdCLass $attrs
Résultat StdCLass

$autoinit protected_oe property

protected $autoinit

$codepoint protected_oe property

Current code point
protected mixed $codepoint
Résultat mixed

$ev protected_oe property

Event
protected object $ev
Résultat object

$priority protected_oe property

Priority
protected int $priority
Résultat integer

$running protected_oe property

Is this request running?
protected bool $running
Résultat boolean

$shutdownFuncs protected_oe property

Registered shutdown functions
protected array $shutdownFuncs
Résultat array

$sleepTime protected_oe property

Current sleep() time
protected float $sleepTime
Résultat float

$state protected_oe property

State
protected $state

$upstream protected_oe property

Upstream
protected object $upstream
Résultat object