pas
Static Public Member Functions | Static Public Attributes | List of all members
pas\pas Class Reference

Static Public Member Functions

static isWindows ()
 
static on (string $event, callable $function)
 
static fire (string $event, array $parameters=[])
 
static add (callable $function, float $interval_seconds=0.001, bool $call_immediately=false)
 
static remove (Loop $loop)
 
static whileLoop (callable $condition_function)
 
static exitLoop ()
 
static loop ()
 
static curl_exec (&$ch, callable $callback)
 
static init ()
 

Static Public Attributes

static $recalculate_loops = true
 

Member Function Documentation

◆ add()

static pas\pas::add ( callable  $function,
float  $interval_seconds = 0.001,
bool  $call_immediately = false 
)
static

Registers a function to be called every X seconds.

Parameters
callable$function
float$interval_seconds
bool$call_immediatelyTrue if the function should be called immediately, false if the interval should expire first.
Returns
Loop

◆ curl_exec()

static pas\pas::curl_exec ( $ch,
callable  $callback 
)
static

Drop-in replacement for curl_exec. Instead of blocking until the request has finished, this immediately returns and the result will be passed to the callback function when the request is finished.

Parameters
resource$ch
callable$callback

◆ exitLoop()

static pas\pas::exitLoop ( )
static

Causes the pas::loop() function to return, if it is currently running.

Returns
void

◆ fire()

static pas\pas::fire ( string  $event,
array  $parameters = [] 
)
static

Calls all event handlers for the given event.

Parameters
string$event
array$parameters
Returns
void

◆ init()

static pas\pas::init ( )
static

Used internally to initialize pas's default Condition.

◆ isWindows()

static pas\pas::isWindows ( )
static

Returns true if the code is running on a Windows machine.

Returns
boolean

◆ loop()

static pas\pas::loop ( )
static

Runs pas's loop. This should be the last call in your script.

Returns
void

◆ on()

static pas\pas::on ( string  $event,
callable  $function 
)
static

Registers an event handler.

Parameters
string$event
callable$function
Returns
void

◆ remove()

static pas\pas::remove ( Loop  $loop)
static

Removes the given loop from the default Condition.

Deprecated:
Use Loop::remove(), instead.
Parameters
Loop$loop
Returns
void

◆ whileLoop()

static pas\pas::whileLoop ( callable  $condition_function)
static

Registers a Condition.

Parameters
callable$condition_functionThe function that must return true for nested loops to run.
Returns
Condition

Member Data Documentation

◆ $recalculate_loops

pas\pas::$recalculate_loops = true
static