PHP Class AsyncTask

Author: Dmitry Mamontov ([email protected])
ファイルを表示 Open project: dmamontov/asynctask Class Usage Examples

Public Methods

Method Description
__construct ( ) : void Creates a new asynchronous task
__destruct ( ) : void Finish create an asynchronous task
cancel ( ) : boolean Attempts to cancel execution of this task
execute ( mixed $parameters ) : void Executes the task with the specified parameters
getStatus ( ) : string Returns the current status of this task
isCancelled ( ) : boolean Returns true if this task was cancelled before it completed normally

Protected Methods

Method Description
doInBackground ( mixed $parameters ) : mixed Override this method to perform a computation on a background thread
getProperty ( string $key ) : mixed Returns the variable with the given key
onCancelled ( ) : void Runs on the thread after cancel()
onPostExecute ( mixed $result ) : void Runs on the thread after doInBackground($parameters)
onPreExecute ( ) : void Runs on the thread before doInBackground($parameters)
setProperty ( string $key, string $value ) : boolean Inserts or updates a variable with the given key

Private Methods

Method Description
getUid ( string $key ) : integer Returns a unique integer identifier for a given key

Method Details

__construct() final public method

Creates a new asynchronous task
final public __construct ( ) : void
return void

__destruct() final public method

Finish create an asynchronous task
final public __destruct ( ) : void
return void

cancel() final public method

Attempts to cancel execution of this task
final public cancel ( ) : boolean
return boolean

doInBackground() abstract protected method

Override this method to perform a computation on a background thread
abstract protected doInBackground ( mixed $parameters ) : mixed
$parameters mixed
return mixed

execute() final public method

Executes the task with the specified parameters
final public execute ( mixed $parameters ) : void
$parameters mixed
return void

getProperty() final protected static method

Returns the variable with the given key
final protected static getProperty ( string $key ) : mixed
$key string
return mixed

getStatus() final public method

Returns the current status of this task
final public getStatus ( ) : string
return string

isCancelled() final public method

Returns true if this task was cancelled before it completed normally
final public isCancelled ( ) : boolean
return boolean

onCancelled() protected method

Runs on the thread after cancel()
protected onCancelled ( ) : void
return void

onPostExecute() protected method

Runs on the thread after doInBackground($parameters)
protected onPostExecute ( mixed $result ) : void
$result mixed
return void

onPreExecute() protected method

Runs on the thread before doInBackground($parameters)
protected onPreExecute ( ) : void
return void

setProperty() final protected static method

Inserts or updates a variable with the given key
final protected static setProperty ( string $key, string $value ) : boolean
$key string
$value string
return boolean