repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.close
public function close() { if (!$this->freed) { $this->freed = true; if (isset($this->bev)) { $this->bev->free(); } $this->bev = null; //$this->eventLoop->interrupt(); } if ($this->pool) { $this->pool->det...
php
public function close() { if (!$this->freed) { $this->freed = true; if (isset($this->bev)) { $this->bev->free(); } $this->bev = null; //$this->eventLoop->interrupt(); } if ($this->pool) { $this->pool->det...
[ "public", "function", "close", "(", ")", "{", "if", "(", "!", "$", "this", "->", "freed", ")", "{", "$", "this", "->", "freed", "=", "true", ";", "if", "(", "isset", "(", "$", "this", "->", "bev", ")", ")", "{", "$", "this", "->", "bev", "->"...
Close the connection @return void
[ "Close", "the", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L734-L747
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.onReadEv
public function onReadEv($bev) { if (!$this->ready) { $this->wRead = true; return; } if ($this->finished) { return; } try { $this->onRead(); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); ...
php
public function onReadEv($bev) { if (!$this->ready) { $this->wRead = true; return; } if ($this->finished) { return; } try { $this->onRead(); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); ...
[ "public", "function", "onReadEv", "(", "$", "bev", ")", "{", "if", "(", "!", "$", "this", "->", "ready", ")", "{", "$", "this", "->", "wRead", "=", "true", ";", "return", ";", "}", "if", "(", "$", "this", "->", "finished", ")", "{", "return", "...
Called when the connection has got new data @param object $bev EventBufferEvent @return void
[ "Called", "when", "the", "connection", "has", "got", "new", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L774-L788
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.onWriteOnce
public function onWriteOnce($cb) { if (!$this->writing) { $cb($this); return; } $this->onWriteOnce->push($cb); }
php
public function onWriteOnce($cb) { if (!$this->writing) { $cb($this); return; } $this->onWriteOnce->push($cb); }
[ "public", "function", "onWriteOnce", "(", "$", "cb", ")", "{", "if", "(", "!", "$", "this", "->", "writing", ")", "{", "$", "cb", "(", "$", "this", ")", ";", "return", ";", "}", "$", "this", "->", "onWriteOnce", "->", "push", "(", "$", "cb", ")...
Push callback which will be called only once, when writing is available next time @param callable $cb Callback @return void
[ "Push", "callback", "which", "will", "be", "called", "only", "once", "when", "writing", "is", "available", "next", "time" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L811-L818
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.onWriteEv
public function onWriteEv($bev) { $this->writing = false; if ($this->finished) { if ($this->bev->output->length === 0) { $this->close(); } return; } if (!$this->ready) { $this->ready = true; while (!$this->on...
php
public function onWriteEv($bev) { $this->writing = false; if ($this->finished) { if ($this->bev->output->length === 0) { $this->close(); } return; } if (!$this->ready) { $this->ready = true; while (!$this->on...
[ "public", "function", "onWriteEv", "(", "$", "bev", ")", "{", "$", "this", "->", "writing", "=", "false", ";", "if", "(", "$", "this", "->", "finished", ")", "{", "if", "(", "$", "this", "->", "bev", "->", "output", "->", "length", "===", "0", ")...
Called when the connection is ready to accept new data @param object $bev EventBufferEvent @return void
[ "Called", "when", "the", "connection", "is", "ready", "to", "accept", "new", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L825-L864
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.onStateEv
public function onStateEv($bev, $events) { if ($events & \EventBufferEvent::CONNECTED) { $this->onWriteEv($bev); } elseif ($events & \EventBufferEvent::TIMEOUT) { $this->timedout = true; $this->finish(); } elseif ($events & (\EventBufferEvent::ERROR | \Eve...
php
public function onStateEv($bev, $events) { if ($events & \EventBufferEvent::CONNECTED) { $this->onWriteEv($bev); } elseif ($events & \EventBufferEvent::TIMEOUT) { $this->timedout = true; $this->finish(); } elseif ($events & (\EventBufferEvent::ERROR | \Eve...
[ "public", "function", "onStateEv", "(", "$", "bev", ",", "$", "events", ")", "{", "if", "(", "$", "events", "&", "\\", "EventBufferEvent", "::", "CONNECTED", ")", "{", "$", "this", "->", "onWriteEv", "(", "$", "bev", ")", ";", "}", "elseif", "(", "...
Called when the connection state changed @param object $bev EventBufferEvent @param integer $events Events @return void
[ "Called", "when", "the", "connection", "state", "changed" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L872-L902
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.moveToBuffer
public function moveToBuffer(\EventBuffer $dest, $n) { if (!isset($this->bev)) { return false; } return $dest->appendFrom($this->bev->input, $n); }
php
public function moveToBuffer(\EventBuffer $dest, $n) { if (!isset($this->bev)) { return false; } return $dest->appendFrom($this->bev->input, $n); }
[ "public", "function", "moveToBuffer", "(", "\\", "EventBuffer", "$", "dest", ",", "$", "n", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "bev", ")", ")", "{", "return", "false", ";", "}", "return", "$", "dest", "->", "appendFrom", "("...
Moves arbitrary number of bytes from input buffer to given buffer @param \EventBuffer $dest Destination nuffer @param integer $n Max. number of bytes to move @return integer|false
[ "Moves", "arbitrary", "number", "of", "bytes", "from", "input", "buffer", "to", "given", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L910-L916
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.writeFromBuffer
public function writeFromBuffer(\EventBuffer $src, $n) { if (!isset($this->bev)) { return false; } $this->writing = true; return $this->bev->output->appendFrom($src, $n); }
php
public function writeFromBuffer(\EventBuffer $src, $n) { if (!isset($this->bev)) { return false; } $this->writing = true; return $this->bev->output->appendFrom($src, $n); }
[ "public", "function", "writeFromBuffer", "(", "\\", "EventBuffer", "$", "src", ",", "$", "n", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "bev", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "writing", "=", "true", ...
Moves arbitrary number of bytes from given buffer to output buffer @param \EventBuffer $src Source buffer @param integer $n Max. number of bytes to move @return integer|false
[ "Moves", "arbitrary", "number", "of", "bytes", "from", "given", "buffer", "to", "output", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L924-L931
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.read
public function read($n) { if ($n <= 0) { return ''; } if (!isset($this->bev)) { return false; } $read = $this->bev->read($n); if ($read === null) { return false; } return $read; }
php
public function read($n) { if ($n <= 0) { return ''; } if (!isset($this->bev)) { return false; } $read = $this->bev->read($n); if ($read === null) { return false; } return $read; }
[ "public", "function", "read", "(", "$", "n", ")", "{", "if", "(", "$", "n", "<=", "0", ")", "{", "return", "''", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "bev", ")", ")", "{", "return", "false", ";", "}", "$", "read", "=",...
Read data from the connection's buffer @param integer $n Max. number of bytes to read @return string|false Readed data
[ "Read", "data", "from", "the", "connection", "s", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L938-L951
kakserpom/phpdaemon
PHPDaemon/Network/IOStream.php
IOStream.readUnlimited
public function readUnlimited() { if (!isset($this->bev)) { return false; } $read = $this->bev->read($this->bev->input->length); if ($read === null) { return false; } return $read; }
php
public function readUnlimited() { if (!isset($this->bev)) { return false; } $read = $this->bev->read($this->bev->input->length); if ($read === null) { return false; } return $read; }
[ "public", "function", "readUnlimited", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "bev", ")", ")", "{", "return", "false", ";", "}", "$", "read", "=", "$", "this", "->", "bev", "->", "read", "(", "$", "this", "->", "bev", "...
Reads all data from the connection's buffer @return string Readed data
[ "Reads", "all", "data", "from", "the", "connection", "s", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/IOStream.php#L957-L967
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.eventCall
public function eventCall($arg) { try { if ($this->state === Generic::STATE_FINISHED) { $this->finish(); $this->free(); return; } $this->state = Generic::STATE_RUNNING; $this->onWakeup(); $throw = fal...
php
public function eventCall($arg) { try { if ($this->state === Generic::STATE_FINISHED) { $this->finish(); $this->free(); return; } $this->state = Generic::STATE_RUNNING; $this->onWakeup(); $throw = fal...
[ "public", "function", "eventCall", "(", "$", "arg", ")", "{", "try", "{", "if", "(", "$", "this", "->", "state", "===", "Generic", "::", "STATE_FINISHED", ")", "{", "$", "this", "->", "finish", "(", ")", ";", "$", "this", "->", "free", "(", ")", ...
Event handler of Request, called by Evtimer @param $arg @return void
[ "Event", "handler", "of", "Request", "called", "by", "Evtimer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L203-L245
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.free
public function free() { if ($this->ev) { $this->ev->free(); $this->ev = null; } if (isset($this->upstream)) { $this->upstream->freeRequest($this); $this->upstream = null; } }
php
public function free() { if ($this->ev) { $this->ev->free(); $this->ev = null; } if (isset($this->upstream)) { $this->upstream->freeRequest($this); $this->upstream = null; } }
[ "public", "function", "free", "(", ")", "{", "if", "(", "$", "this", "->", "ev", ")", "{", "$", "this", "->", "ev", "->", "free", "(", ")", ";", "$", "this", "->", "ev", "=", "null", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "up...
Frees the request @return void
[ "Frees", "the", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L251-L261
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.setPriority
public function setPriority($p) { $this->priority = $p; if ($this->ev !== null) { $this->ev->priority = $p; } }
php
public function setPriority($p) { $this->priority = $p; if ($this->ev !== null) { $this->ev->priority = $p; } }
[ "public", "function", "setPriority", "(", "$", "p", ")", "{", "$", "this", "->", "priority", "=", "$", "p", ";", "if", "(", "$", "this", "->", "ev", "!==", "null", ")", "{", "$", "this", "->", "ev", "->", "priority", "=", "$", "p", ";", "}", ...
Sets the priority @param integer Priority @return void
[ "Sets", "the", "priority" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L268-L274
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.preinit
protected function preinit($req) { if ($req === null) { $req = new \stdClass; $req->attrs = new \stdClass; } $this->attrs = $req->attrs; }
php
protected function preinit($req) { if ($req === null) { $req = new \stdClass; $req->attrs = new \stdClass; } $this->attrs = $req->attrs; }
[ "protected", "function", "preinit", "(", "$", "req", ")", "{", "if", "(", "$", "req", "===", "null", ")", "{", "$", "req", "=", "new", "\\", "stdClass", ";", "$", "req", "->", "attrs", "=", "new", "\\", "stdClass", ";", "}", "$", "this", "->", ...
Preparing before init @param object Source request @return void
[ "Preparing", "before", "init" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L281-L289
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.getString
public static function getString(&$var, $values = null) { if (!is_string($var)) { $var = ''; } if ($values !== null) { return in_array($var, $values, true) ? $var : $values[0]; } return $var; }
php
public static function getString(&$var, $values = null) { if (!is_string($var)) { $var = ''; } if ($values !== null) { return in_array($var, $values, true) ? $var : $values[0]; } return $var; }
[ "public", "static", "function", "getString", "(", "&", "$", "var", ",", "$", "values", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "var", ")", ")", "{", "$", "var", "=", "''", ";", "}", "if", "(", "$", "values", "!==", "null",...
Get string value from the given variable @param Reference of variable. @param array Optional. Possible values. @return string Value.
[ "Get", "string", "value", "from", "the", "given", "variable" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L314-L324
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.getInteger
public static function getInteger(&$var, $values = null) { if (is_string($var) && ctype_digit($var)) { $var = (int)$var; } if (!is_int($var)) { return 0; } if ($values !== null) { return in_array($var, $values, true) ? $var : $values[0]; ...
php
public static function getInteger(&$var, $values = null) { if (is_string($var) && ctype_digit($var)) { $var = (int)$var; } if (!is_int($var)) { return 0; } if ($values !== null) { return in_array($var, $values, true) ? $var : $values[0]; ...
[ "public", "static", "function", "getInteger", "(", "&", "$", "var", ",", "$", "values", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "var", ")", "&&", "ctype_digit", "(", "$", "var", ")", ")", "{", "$", "var", "=", "(", "int", ")", ...
Get integer value from the given variable @param Reference of variable. @param array Optional. Possible values. @return string Value.
[ "Get", "integer", "value", "from", "the", "given", "variable" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L360-L373
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.unregisterShutdownFunction
public function unregisterShutdownFunction($callback) { if (($k = array_search($callback, $this->shutdownFuncs)) !== false) { unset($this->shutdownFuncs[$k]); } }
php
public function unregisterShutdownFunction($callback) { if (($k = array_search($callback, $this->shutdownFuncs)) !== false) { unset($this->shutdownFuncs[$k]); } }
[ "public", "function", "unregisterShutdownFunction", "(", "$", "callback", ")", "{", "if", "(", "(", "$", "k", "=", "array_search", "(", "$", "callback", ",", "$", "this", "->", "shutdownFuncs", ")", ")", "!==", "false", ")", "{", "unset", "(", "$", "th...
Remove the given callback @param callable $callback @return void
[ "Remove", "the", "given", "callback" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L398-L403
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.codepoint
public function codepoint($p) { if ($this->codepoint !== $p) { $this->codepoint = $p; return true; } return false; }
php
public function codepoint($p) { if ($this->codepoint !== $p) { $this->codepoint = $p; return true; } return false; }
[ "public", "function", "codepoint", "(", "$", "p", ")", "{", "if", "(", "$", "this", "->", "codepoint", "!==", "$", "p", ")", "{", "$", "this", "->", "codepoint", "=", "$", "p", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Helper for easy switching between several interruptable stages of request's execution @param string Name @return boolean Execute
[ "Helper", "for", "easy", "switching", "between", "several", "interruptable", "stages", "of", "request", "s", "execution" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L410-L418
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.sleep
public function sleep($time = 0, $set = false) { if ($this->state === Generic::STATE_FINISHED) { return; } if ($this->state !== Generic::STATE_RUNNING) { $set = true; } $this->sleepTime = $time; if (!$set) { throw new RequestSleep...
php
public function sleep($time = 0, $set = false) { if ($this->state === Generic::STATE_FINISHED) { return; } if ($this->state !== Generic::STATE_RUNNING) { $set = true; } $this->sleepTime = $time; if (!$set) { throw new RequestSleep...
[ "public", "function", "sleep", "(", "$", "time", "=", "0", ",", "$", "set", "=", "false", ")", "{", "if", "(", "$", "this", "->", "state", "===", "Generic", "::", "STATE_FINISHED", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "stat...
Delays the request execution for the given number of seconds @param integer $time Time to sleep in seconds @param boolean $set Set this parameter to true when use call it outside of Request->run() or if you don't want to interrupt execution now @throws RequestSleep @return void
[ "Delays", "the", "request", "execution", "for", "the", "given", "number", "of", "seconds" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L428-L447
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.wakeup
public function wakeup() { if ($this->state === Generic::STATE_WAITING) { $this->ev->del(); $this->ev->add(0); } }
php
public function wakeup() { if ($this->state === Generic::STATE_WAITING) { $this->ev->del(); $this->ev->add(0); } }
[ "public", "function", "wakeup", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "Generic", "::", "STATE_WAITING", ")", "{", "$", "this", "->", "ev", "->", "del", "(", ")", ";", "$", "this", "->", "ev", "->", "add", "(", "0", ")", "...
Cancel current sleep @return void
[ "Cancel", "current", "sleep" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L468-L474
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.onWakeup
public function onWakeup() { $this->running = true; Daemon::$req = $this; Daemon::$context = $this; Daemon::$process->setState(Daemon::WSTATE_BUSY); }
php
public function onWakeup() { $this->running = true; Daemon::$req = $this; Daemon::$context = $this; Daemon::$process->setState(Daemon::WSTATE_BUSY); }
[ "public", "function", "onWakeup", "(", ")", "{", "$", "this", "->", "running", "=", "true", ";", "Daemon", "::", "$", "req", "=", "$", "this", ";", "Daemon", "::", "$", "context", "=", "$", "this", ";", "Daemon", "::", "$", "process", "->", "setSta...
Called when the request wakes up @return void
[ "Called", "when", "the", "request", "wakes", "up" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L505-L511
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.onSleep
public function onSleep() { Daemon::$req = null; Daemon::$context = null; $this->running = false; Daemon::$process->setState(Daemon::WSTATE_IDLE); }
php
public function onSleep() { Daemon::$req = null; Daemon::$context = null; $this->running = false; Daemon::$process->setState(Daemon::WSTATE_IDLE); }
[ "public", "function", "onSleep", "(", ")", "{", "Daemon", "::", "$", "req", "=", "null", ";", "Daemon", "::", "$", "context", "=", "null", ";", "$", "this", "->", "running", "=", "false", ";", "Daemon", "::", "$", "process", "->", "setState", "(", ...
Called when the request starts sleep @return void
[ "Called", "when", "the", "request", "starts", "sleep" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L517-L523
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.abort
public function abort() { if ($this->aborted) { return; } $this->aborted = true; $this->onWakeup(); $this->onAbort(); if ((ignore_user_abort() === 1) && (($this->state === Generic::STATE_RUNNING) || ($this->state === Generic::STATE_WAITING)) ...
php
public function abort() { if ($this->aborted) { return; } $this->aborted = true; $this->onWakeup(); $this->onAbort(); if ((ignore_user_abort() === 1) && (($this->state === Generic::STATE_RUNNING) || ($this->state === Generic::STATE_WAITING)) ...
[ "public", "function", "abort", "(", ")", "{", "if", "(", "$", "this", "->", "aborted", ")", "{", "return", ";", "}", "$", "this", "->", "aborted", "=", "true", ";", "$", "this", "->", "onWakeup", "(", ")", ";", "$", "this", "->", "onAbort", "(", ...
Aborts the request @return void
[ "Aborts", "the", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L529-L549
kakserpom/phpdaemon
PHPDaemon/Request/Generic.php
Generic.finish
public function finish($status = 0, $zombie = false) { if ($this->state === Generic::STATE_FINISHED) { return; } if (!$zombie) { $this->state = Generic::STATE_FINISHED; } if (!($r = $this->running)) { $this->onWakeup(); } ...
php
public function finish($status = 0, $zombie = false) { if ($this->state === Generic::STATE_FINISHED) { return; } if (!$zombie) { $this->state = Generic::STATE_FINISHED; } if (!($r = $this->running)) { $this->onWakeup(); } ...
[ "public", "function", "finish", "(", "$", "status", "=", "0", ",", "$", "zombie", "=", "false", ")", "{", "if", "(", "$", "this", "->", "state", "===", "Generic", "::", "STATE_FINISHED", ")", "{", "return", ";", "}", "if", "(", "!", "$", "zombie", ...
Finish the request @param integer Optional. Status. 0 - normal, -1 - abort, -2 - termination @param boolean Optional. Zombie. Default is false @return void
[ "Finish", "the", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Request/Generic.php#L557-L611
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/XhrSend.php
XhrSend.run
public function run() { if ($this->stage++ > 0) { $this->header('500 Too Busy'); return; } if ($this->attrs->raw === '') { $this->header('500 Internal Server Error'); echo 'Payload expected.'; return; } if (!json_dec...
php
public function run() { if ($this->stage++ > 0) { $this->header('500 Too Busy'); return; } if ($this->attrs->raw === '') { $this->header('500 Internal Server Error'); echo 'Payload expected.'; return; } if (!json_dec...
[ "public", "function", "run", "(", ")", "{", "if", "(", "$", "this", "->", "stage", "++", ">", "0", ")", "{", "$", "this", "->", "header", "(", "'500 Too Busy'", ")", ";", "return", ";", "}", "if", "(", "$", "this", "->", "attrs", "->", "raw", "...
Called when request iterated @return void
[ "Called", "when", "request", "iterated" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/XhrSend.php#L18-L45
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicReturnFrame.php
BasicReturnFrame.create
public static function create( $replyCode = null, $replyText = null, $exchange = null, $routingKey = null ) { $frame = new self(); if (null !== $replyCode) { $frame->replyCode = $replyCode; } if (null !== $replyText) { $frame->replyText = $replyTe...
php
public static function create( $replyCode = null, $replyText = null, $exchange = null, $routingKey = null ) { $frame = new self(); if (null !== $replyCode) { $frame->replyCode = $replyCode; } if (null !== $replyText) { $frame->replyText = $replyTe...
[ "public", "static", "function", "create", "(", "$", "replyCode", "=", "null", ",", "$", "replyText", "=", "null", ",", "$", "exchange", "=", "null", ",", "$", "routingKey", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicReturnFrame.php#L23-L43
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleAsteriskClient.php
ExampleAsteriskClient.init
public function init() { if ($this->isEnabled()) { $this->asteriskclient = Pool::getInstance($this->config->asteriskclientname->value); } }
php
public function init() { if ($this->isEnabled()) { $this->asteriskclient = Pool::getInstance($this->config->asteriskclientname->value); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "$", "this", "->", "asteriskclient", "=", "Pool", "::", "getInstance", "(", "$", "this", "->", "config", "->", "asteriskclientname", "->", "valu...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleAsteriskClient.php#L24-L29
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeleteFrame.php
QueueDeleteFrame.create
public static function create( $queue = null, $ifUnused = null, $ifEmpty = null, $nowait = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $ifUnused) { $frame->ifUnused = $ifUnused; } if ...
php
public static function create( $queue = null, $ifUnused = null, $ifEmpty = null, $nowait = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $ifUnused) { $frame->ifUnused = $ifUnused; } if ...
[ "public", "static", "function", "create", "(", "$", "queue", "=", "null", ",", "$", "ifUnused", "=", "null", ",", "$", "ifEmpty", "=", "null", ",", "$", "nowait", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", ...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeleteFrame.php#L24-L44
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Htmlfile.php
Htmlfile.sendFrame
public function sendFrame($frame) { $this->outputFrame("<script>\np(" . htmlspecialchars(json_encode($frame, JSON_UNESCAPED_SLASHES), ENT_NOQUOTES | ENT_HTML401) . ");\n</script>\r\n"); parent::sendFrame($frame); }
php
public function sendFrame($frame) { $this->outputFrame("<script>\np(" . htmlspecialchars(json_encode($frame, JSON_UNESCAPED_SLASHES), ENT_NOQUOTES | ENT_HTML401) . ");\n</script>\r\n"); parent::sendFrame($frame); }
[ "public", "function", "sendFrame", "(", "$", "frame", ")", "{", "$", "this", "->", "outputFrame", "(", "\"<script>\\np(\"", ".", "htmlspecialchars", "(", "json_encode", "(", "$", "frame", ",", "JSON_UNESCAPED_SLASHES", ")", ",", "ENT_NOQUOTES", "|", "ENT_HTML401...
Send frame @param string $frame @return void
[ "Send", "frame" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Htmlfile.php#L22-L27
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Examples/Multi.php
Multi.onReady
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $this->redis->multi(function ($multi) { // "OK" D('start multi: ' . $multi->result); $multi->set('test1', 'value1', function ($redis) use ($multi) { // "QUEU...
php
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $this->redis->multi(function ($multi) { // "OK" D('start multi: ' . $multi->result); $multi->set('test1', 'value1', function ($redis) use ($multi) { // "QUEU...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "redis", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "::", "getInstance", "(", ")", ";", "$", "this", "->", "redis", "->", "multi", "(", "function", "(", "$"...
Called when the worker is ready to go @return void
[ "Called", "when", "the", "worker", "is", "ready", "to", "go" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Examples/Multi.php#L24-L55
kakserpom/phpdaemon
PHPDaemon/Config/Entry/ArraySet.php
ArraySet.humanToPlain
public static function humanToPlain($value) { if (is_array($value)) { return $value; } $value = preg_replace_callback('~(".*?")|(\'.*?\')|(\s*,\s*)~s', function ($m) { if (!empty($m[3])) { return "\x00"; } if (!empty($m[2])) { ...
php
public static function humanToPlain($value) { if (is_array($value)) { return $value; } $value = preg_replace_callback('~(".*?")|(\'.*?\')|(\s*,\s*)~s', function ($m) { if (!empty($m[3])) { return "\x00"; } if (!empty($m[2])) { ...
[ "public", "static", "function", "humanToPlain", "(", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "$", "value", "=", "preg_replace_callback", "(", "'~(\".*?\")|(\\'.*?\\')|(\\s*,\\s*)~s'", ...
Converts human-readable value to plain @param array|string $value @return array
[ "Converts", "human", "-", "readable", "value", "to", "plain" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Entry/ArraySet.php#L20-L38
kakserpom/phpdaemon
PHPDaemon/XMLStream/XMLStreamObject.php
XMLStreamObject.printObj
public function printObj($depth = 0) { $s = str_repeat("\t", $depth) . $this->name . " " . $this->ns . ' ' . $this->data . "\n"; foreach ($this->subs as $sub) { $s .= $sub->printObj($depth + 1); } return $s; }
php
public function printObj($depth = 0) { $s = str_repeat("\t", $depth) . $this->name . " " . $this->ns . ' ' . $this->data . "\n"; foreach ($this->subs as $sub) { $s .= $sub->printObj($depth + 1); } return $s; }
[ "public", "function", "printObj", "(", "$", "depth", "=", "0", ")", "{", "$", "s", "=", "str_repeat", "(", "\"\\t\"", ",", "$", "depth", ")", ".", "$", "this", "->", "name", ".", "\" \"", ".", "$", "this", "->", "ns", ".", "' '", ".", "$", "thi...
Dump this XML Object to output. @param integer $depth
[ "Dump", "this", "XML", "Object", "to", "output", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/XMLStream/XMLStreamObject.php#L69-L76
kakserpom/phpdaemon
PHPDaemon/XMLStream/XMLStreamObject.php
XMLStreamObject.toString
public function toString($str = '') { $str .= "<{$this->name} xmlns='{$this->ns}' "; foreach ($this->attrs as $key => $value) { if ($key !== 'xmlns') { $value = htmlspecialchars($value); $str .= "$key='$value' "; } } $str .= ">"...
php
public function toString($str = '') { $str .= "<{$this->name} xmlns='{$this->ns}' "; foreach ($this->attrs as $key => $value) { if ($key !== 'xmlns') { $value = htmlspecialchars($value); $str .= "$key='$value' "; } } $str .= ">"...
[ "public", "function", "toString", "(", "$", "str", "=", "''", ")", "{", "$", "str", ".=", "\"<{$this->name} xmlns='{$this->ns}' \"", ";", "foreach", "(", "$", "this", "->", "attrs", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "key",...
Return this XML Object in xml notation @param string $str
[ "Return", "this", "XML", "Object", "in", "xml", "notation" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/XMLStream/XMLStreamObject.php#L83-L99
kakserpom/phpdaemon
PHPDaemon/XMLStream/XMLStreamObject.php
XMLStreamObject.hasSub
public function hasSub($name, $ns = null) { foreach ($this->subs as $sub) { if (($name === "*" or $sub->name === $name) and ($ns === null or $sub->ns === $ns)) { return true; } } return false; }
php
public function hasSub($name, $ns = null) { foreach ($this->subs as $sub) { if (($name === "*" or $sub->name === $name) and ($ns === null or $sub->ns === $ns)) { return true; } } return false; }
[ "public", "function", "hasSub", "(", "$", "name", ",", "$", "ns", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "subs", "as", "$", "sub", ")", "{", "if", "(", "(", "$", "name", "===", "\"*\"", "or", "$", "sub", "->", "name", "===", ...
Has this XML Object the given sub? @param string $name @return boolean
[ "Has", "this", "XML", "Object", "the", "given", "sub?" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/XMLStream/XMLStreamObject.php#L107-L115
kakserpom/phpdaemon
PHPDaemon/XMLStream/XMLStreamObject.php
XMLStreamObject.sub
public function sub($name, $attrs = null, $ns = null) { //@TODO: attrs is ignored foreach ($this->subs as $sub) { if ($sub->name === $name and ($ns === null or $sub->ns === $ns)) { return $sub; } } return null; }
php
public function sub($name, $attrs = null, $ns = null) { //@TODO: attrs is ignored foreach ($this->subs as $sub) { if ($sub->name === $name and ($ns === null or $sub->ns === $ns)) { return $sub; } } return null; }
[ "public", "function", "sub", "(", "$", "name", ",", "$", "attrs", "=", "null", ",", "$", "ns", "=", "null", ")", "{", "//@TODO: attrs is ignored", "foreach", "(", "$", "this", "->", "subs", "as", "$", "sub", ")", "{", "if", "(", "$", "sub", "->", ...
Return a sub @param string $name @param string $attrs @param string $ns
[ "Return", "a", "sub" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/XMLStream/XMLStreamObject.php#L124-L133
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelOpenFrame.php
ChannelOpenFrame.create
public static function create( $outOfBand = null ) { $frame = new self(); if (null !== $outOfBand) { $frame->outOfBand = $outOfBand; } return $frame; }
php
public static function create( $outOfBand = null ) { $frame = new self(); if (null !== $outOfBand) { $frame->outOfBand = $outOfBand; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "outOfBand", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "outOfBand", ")", "{", "$", "frame", "->", "outOfBand", "=", "$", "outOfBand", "...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelOpenFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicGetEmptyFrame.php
BasicGetEmptyFrame.create
public static function create( $clusterId = null ) { $frame = new self(); if (null !== $clusterId) { $frame->clusterId = $clusterId; } return $frame; }
php
public static function create( $clusterId = null ) { $frame = new self(); if (null !== $clusterId) { $frame->clusterId = $clusterId; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "clusterId", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "clusterId", ")", "{", "$", "frame", "->", "clusterId", "=", "$", "clusterId", "...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicGetEmptyFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/Core/Debug.php
Debug.exportBytes
public static function exportBytes($str, $all = false) { return preg_replace_callback( '~' . ($all ? '.' : '[^A-Za-z\d\.\{\}$<>:;\-_/\\\\=+]') . '~s', function ($m) use ($all) { if (!$all) { if ($m[0] === "\r") { return "\n"...
php
public static function exportBytes($str, $all = false) { return preg_replace_callback( '~' . ($all ? '.' : '[^A-Za-z\d\.\{\}$<>:;\-_/\\\\=+]') . '~s', function ($m) use ($all) { if (!$all) { if ($m[0] === "\r") { return "\n"...
[ "public", "static", "function", "exportBytes", "(", "$", "str", ",", "$", "all", "=", "false", ")", "{", "return", "preg_replace_callback", "(", "'~'", ".", "(", "$", "all", "?", "'.'", ":", "'[^A-Za-z\\d\\.\\{\\}$<>:;\\-_/\\\\\\\\=+]'", ")", ".", "'~s'", ",...
Export binary data @param string $str String @param boolean $all Whether to replace all of chars with escaped sequences @return string Escaped string
[ "Export", "binary", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Debug.php#L20-L39
kakserpom/phpdaemon
PHPDaemon/Core/Debug.php
Debug.proxy
public static function proxy($cb, $name = null) { static $i = 0; $n = ++$i; Daemon::log('Debug::proxy #' . $n . ': SPAWNED (' . json_encode($name) . ')'); return function (...$args) use ($cb, $name, $n) { Daemon::log('Debug::proxy #' . $n . ': CALLED (' . json_encode($nam...
php
public static function proxy($cb, $name = null) { static $i = 0; $n = ++$i; Daemon::log('Debug::proxy #' . $n . ': SPAWNED (' . json_encode($name) . ')'); return function (...$args) use ($cb, $name, $n) { Daemon::log('Debug::proxy #' . $n . ': CALLED (' . json_encode($nam...
[ "public", "static", "function", "proxy", "(", "$", "cb", ",", "$", "name", "=", "null", ")", "{", "static", "$", "i", "=", "0", ";", "$", "n", "=", "++", "$", "i", ";", "Daemon", "::", "log", "(", "'Debug::proxy #'", ".", "$", "n", ".", "': SPA...
Returns a proxy callback function with logging for debugging purposes @param callable $cb Callback @param mixed $name Data @return callable
[ "Returns", "a", "proxy", "callback", "function", "with", "logging", "for", "debugging", "purposes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Debug.php#L67-L76
kakserpom/phpdaemon
PHPDaemon/Core/Debug.php
Debug.dump
public static function dump(...$args) { ob_start(); foreach ($args as $v) { var_dump($v); } $dump = ob_get_contents(); ob_end_clean(); return $dump; }
php
public static function dump(...$args) { ob_start(); foreach ($args as $v) { var_dump($v); } $dump = ob_get_contents(); ob_end_clean(); return $dump; }
[ "public", "static", "function", "dump", "(", "...", "$", "args", ")", "{", "ob_start", "(", ")", ";", "foreach", "(", "$", "args", "as", "$", "v", ")", "{", "var_dump", "(", "$", "v", ")", ";", "}", "$", "dump", "=", "ob_get_contents", "(", ")", ...
Wrapper of var_dump @return string Result of var_dump()
[ "Wrapper", "of", "var_dump" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Debug.php#L82-L94
kakserpom/phpdaemon
PHPDaemon/Core/Debug.php
Debug.zdump
public static function zdump(...$args) { ob_start(); foreach ($args as $v) { debug_zval_dump($v); } $dump = ob_get_contents(); ob_end_clean(); return $dump; }
php
public static function zdump(...$args) { ob_start(); foreach ($args as $v) { debug_zval_dump($v); } $dump = ob_get_contents(); ob_end_clean(); return $dump; }
[ "public", "static", "function", "zdump", "(", "...", "$", "args", ")", "{", "ob_start", "(", ")", ";", "foreach", "(", "$", "args", "as", "$", "v", ")", "{", "debug_zval_dump", "(", "$", "v", ")", ";", "}", "$", "dump", "=", "ob_get_contents", "(",...
Wrapper of debug_zval_dump @return string Result of debug_zval_dump()
[ "Wrapper", "of", "debug_zval_dump" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Debug.php#L114-L126
kakserpom/phpdaemon
PHPDaemon/Core/Debug.php
Debug.backtrace
public static function backtrace($bool = false) { if (Daemon::$obInStack || $bool) { try { throw new \Exception; } catch (\Exception $e) { $trace = $e->getTraceAsString(); $e = explode("\n", $trace); array_shift($e); ...
php
public static function backtrace($bool = false) { if (Daemon::$obInStack || $bool) { try { throw new \Exception; } catch (\Exception $e) { $trace = $e->getTraceAsString(); $e = explode("\n", $trace); array_shift($e); ...
[ "public", "static", "function", "backtrace", "(", "$", "bool", "=", "false", ")", "{", "if", "(", "Daemon", "::", "$", "obInStack", "||", "$", "bool", ")", "{", "try", "{", "throw", "new", "\\", "Exception", ";", "}", "catch", "(", "\\", "Exception",...
Returns textual backtrace @return string
[ "Returns", "textual", "backtrace" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Debug.php#L132-L153
kakserpom/phpdaemon
PHPDaemon/Clients/Valve/Connection.php
Connection.requestPlayers
public function requestPlayers($cb) { $this->request('challenge', null, function ($conn, $result) use ($cb) { if (is_array($result)) { $cb($conn, $result); return; } $conn->request('players', $result, $cb); }); }
php
public function requestPlayers($cb) { $this->request('challenge', null, function ($conn, $result) use ($cb) { if (is_array($result)) { $cb($conn, $result); return; } $conn->request('players', $result, $cb); }); }
[ "public", "function", "requestPlayers", "(", "$", "cb", ")", "{", "$", "this", "->", "request", "(", "'challenge'", ",", "null", ",", "function", "(", "$", "conn", ",", "$", "result", ")", "use", "(", "$", "cb", ")", "{", "if", "(", "is_array", "("...
Sends a request of type 'players' @param callable $cb Callback @callback $cb ( ) @return void
[ "Sends", "a", "request", "of", "type", "players" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Valve/Connection.php#L26-L35
kakserpom/phpdaemon
PHPDaemon/Clients/Valve/Connection.php
Connection.request
public function request($type, $data = null, $cb = null) { $packet = "\xFF\xFF\xFF\xFF"; if ($type === 'ping') { $packet .= Pool::A2A_PING; } elseif ($type === 'challenge') { //$packet .= ValveClient::A2S_SERVERQUERY_GETCHALLENGE; $packet .= Pool::A2S_PLAY...
php
public function request($type, $data = null, $cb = null) { $packet = "\xFF\xFF\xFF\xFF"; if ($type === 'ping') { $packet .= Pool::A2A_PING; } elseif ($type === 'challenge') { //$packet .= ValveClient::A2S_SERVERQUERY_GETCHALLENGE; $packet .= Pool::A2S_PLAY...
[ "public", "function", "request", "(", "$", "type", ",", "$", "data", "=", "null", ",", "$", "cb", "=", "null", ")", "{", "$", "packet", "=", "\"\\xFF\\xFF\\xFF\\xFF\"", ";", "if", "(", "$", "type", "===", "'ping'", ")", "{", "$", "packet", ".=", "P...
Sends a request @param string $type Type of request @param string $data Data @param callable $cb Callback @callback $cb ( ) @return void
[ "Sends", "a", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Valve/Connection.php#L56-L79
kakserpom/phpdaemon
PHPDaemon/Clients/Valve/Connection.php
Connection.onRead
protected function onRead() { start: if ($this->getInputLength() < 5) { return; } /* @TODO: refactoring Binary::* to support direct buffer calls */ $pct = $this->read(4096); $h = Binary::getDWord($pct); if ($h !== 0xFFFFFFFF) { $this->f...
php
protected function onRead() { start: if ($this->getInputLength() < 5) { return; } /* @TODO: refactoring Binary::* to support direct buffer calls */ $pct = $this->read(4096); $h = Binary::getDWord($pct); if ($h !== 0xFFFFFFFF) { $this->f...
[ "protected", "function", "onRead", "(", ")", "{", "start", ":", "if", "(", "$", "this", "->", "getInputLength", "(", ")", "<", "5", ")", "{", "return", ";", "}", "/* @TODO: refactoring Binary::* to support direct buffer calls */", "$", "pct", "=", "$", "this",...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Valve/Connection.php#L85-L114
kakserpom/phpdaemon
PHPDaemon/Clients/Valve/Connection.php
Connection.parsePlayers
public static function parsePlayers(&$st) { $playersn = Binary::getByte($st); $players = []; for ($i = 1; $i < $playersn; ++$i) { $n = Binary::getByte($st); $name = Binary::getString($st); $score = Binary::getDWord($st, true); if (mb_orig_strle...
php
public static function parsePlayers(&$st) { $playersn = Binary::getByte($st); $players = []; for ($i = 1; $i < $playersn; ++$i) { $n = Binary::getByte($st); $name = Binary::getString($st); $score = Binary::getDWord($st, true); if (mb_orig_strle...
[ "public", "static", "function", "parsePlayers", "(", "&", "$", "st", ")", "{", "$", "playersn", "=", "Binary", "::", "getByte", "(", "$", "st", ")", ";", "$", "players", "=", "[", "]", ";", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<", ...
Parses response to 'players' command into structure @param string &$st Data @return array Structure
[ "Parses", "response", "to", "players", "command", "into", "structure" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Valve/Connection.php#L121-L147
kakserpom/phpdaemon
PHPDaemon/Clients/Valve/Connection.php
Connection.parseInfo
public static function parseInfo(&$st, $type) { $info = []; if ($type === Pool::S2A_INFO) { $info['proto'] = Binary::getByte($st); $info['hostname'] = Binary::getString($st); $info['map'] = Binary::getString($st); $info['gamedir'] = Binary::getString($...
php
public static function parseInfo(&$st, $type) { $info = []; if ($type === Pool::S2A_INFO) { $info['proto'] = Binary::getByte($st); $info['hostname'] = Binary::getString($st); $info['map'] = Binary::getString($st); $info['gamedir'] = Binary::getString($...
[ "public", "static", "function", "parseInfo", "(", "&", "$", "st", ",", "$", "type", ")", "{", "$", "info", "=", "[", "]", ";", "if", "(", "$", "type", "===", "Pool", "::", "S2A_INFO", ")", "{", "$", "info", "[", "'proto'", "]", "=", "Binary", "...
Parses response to 'info' command into structure @param string &$st Data @param string $type Type of request @return array Structure
[ "Parses", "response", "to", "info", "command", "into", "structure" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Valve/Connection.php#L155-L203
kakserpom/phpdaemon
PHPDaemon/Servers/Socks/SlaveConnection.php
SlaveConnection.onRead
public function onRead() { if (!$this->client) { return; } do { $this->client->writeFromBuffer($this->bev->input, $this->bev->input->length); } while ($this->bev->input->length > 0); }
php
public function onRead() { if (!$this->client) { return; } do { $this->client->writeFromBuffer($this->bev->input, $this->bev->input->length); } while ($this->bev->input->length > 0); }
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "!", "$", "this", "->", "client", ")", "{", "return", ";", "}", "do", "{", "$", "this", "->", "client", "->", "writeFromBuffer", "(", "$", "this", "->", "bev", "->", "input", ",", "$", "th...
Called when new data received. @return void
[ "Called", "when", "new", "data", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/Socks/SlaveConnection.php#L25-L33
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Examples/SimpleRequest.php
SimpleRequest.init
public function init() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } $this->appInstance->httpclient->get( 'http://www.google.com/robots.txt', function ($conn, $success) { echo $conn->body; ...
php
public function init() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } $this->appInstance->httpclient->get( 'http://www.google.com/robots.txt', function ($conn, $success) { echo $conn->body; ...
[ "public", "function", "init", "(", ")", "{", "try", "{", "$", "this", "->", "header", "(", "'Content-Type: text/html'", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "}", "$", "this", "->", "appInstance", "->", "httpclient", "->",...
Constructor @return void
[ "Constructor" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Examples/SimpleRequest.php#L12-L29
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.applyConfig
protected function applyConfig() { parent::applyConfig(); if (isset($this->config->servers)) { $servers = array_filter(array_map('trim', explode(',', $this->config->servers->value)), 'mb_orig_strlen'); $this->servers = []; foreach ($servers as $s) { ...
php
protected function applyConfig() { parent::applyConfig(); if (isset($this->config->servers)) { $servers = array_filter(array_map('trim', explode(',', $this->config->servers->value)), 'mb_orig_strlen'); $this->servers = []; foreach ($servers as $s) { ...
[ "protected", "function", "applyConfig", "(", ")", "{", "parent", "::", "applyConfig", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "config", "->", "servers", ")", ")", "{", "$", "servers", "=", "array_filter", "(", "array_map", "(", "'tri...
Applies config @return void
[ "Applies", "config" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L74-L87
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.getConnection
public function getConnection($url = null, $cb = null, $pri = 0) { if (!is_string($url) && $url !== null && $cb === null) { // if called getConnection(function....) $cb = $url; $url = null; } if ($url === null) { if (isset($this->config->server->value)) { ...
php
public function getConnection($url = null, $cb = null, $pri = 0) { if (!is_string($url) && $url !== null && $cb === null) { // if called getConnection(function....) $cb = $url; $url = null; } if ($url === null) { if (isset($this->config->server->value)) { ...
[ "public", "function", "getConnection", "(", "$", "url", "=", "null", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "0", ")", "{", "if", "(", "!", "is_string", "(", "$", "url", ")", "&&", "$", "url", "!==", "null", "&&", "$", "cb", "===", ...
Returns available connection from the pool @param string $url Address @param callback $cb onConnected @param integer $pri Optional. Priority @call ( callable $cb ) @call ( string $url = null, callable $cb = null, integer $pri = 0 ) @return boolean Success|Connection
[ "Returns", "available", "connection", "from", "the", "pool" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L109-L167
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.markConnFree
public function markConnFree(ClientConnection $conn, $url) { if (!isset($this->servConnFree[$url])) { return; } $this->servConnFree[$url]->attach($conn); }
php
public function markConnFree(ClientConnection $conn, $url) { if (!isset($this->servConnFree[$url])) { return; } $this->servConnFree[$url]->attach($conn); }
[ "public", "function", "markConnFree", "(", "ClientConnection", "$", "conn", ",", "$", "url", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "servConnFree", "[", "$", "url", "]", ")", ")", "{", "return", ";", "}", "$", "this", "->", "ser...
Mark connection as free @param ClientConnection $conn Connection @param string $url URL @return void
[ "Mark", "connection", "as", "free" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L186-L192
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.markConnBusy
public function markConnBusy(ClientConnection $conn, $url) { if (!isset($this->servConnFree[$url])) { return; } $this->servConnFree[$url]->detach($conn); }
php
public function markConnBusy(ClientConnection $conn, $url) { if (!isset($this->servConnFree[$url])) { return; } $this->servConnFree[$url]->detach($conn); }
[ "public", "function", "markConnBusy", "(", "ClientConnection", "$", "conn", ",", "$", "url", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "servConnFree", "[", "$", "url", "]", ")", ")", "{", "return", ";", "}", "$", "this", "->", "ser...
Mark connection as busy @param ClientConnection $conn Connection @param string $url URL @return void
[ "Mark", "connection", "as", "busy" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L200-L206
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.detachConnFromUrl
public function detachConnFromUrl(ClientConnection $conn, $url) { if (isset($this->servConnFree[$url])) { $this->servConnFree[$url]->detach($conn); } if (isset($this->servConn[$url])) { $this->servConn[$url]->detach($conn); } }
php
public function detachConnFromUrl(ClientConnection $conn, $url) { if (isset($this->servConnFree[$url])) { $this->servConnFree[$url]->detach($conn); } if (isset($this->servConn[$url])) { $this->servConn[$url]->detach($conn); } }
[ "public", "function", "detachConnFromUrl", "(", "ClientConnection", "$", "conn", ",", "$", "url", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "servConnFree", "[", "$", "url", "]", ")", ")", "{", "$", "this", "->", "servConnFree", "[", "$", ...
Detaches connection from URL @param ClientConnection $conn Connection @param string $url URL @return void
[ "Detaches", "connection", "from", "URL" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L214-L222
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.touchPending
public function touchPending($url) { while (isset($this->pending[$url]) && !$this->pending[$url]->isEmpty()) { if (true === $this->getConnection($url, $this->pending[$url]->dequeue())) { return; } } }
php
public function touchPending($url) { while (isset($this->pending[$url]) && !$this->pending[$url]->isEmpty()) { if (true === $this->getConnection($url, $this->pending[$url]->dequeue())) { return; } } }
[ "public", "function", "touchPending", "(", "$", "url", ")", "{", "while", "(", "isset", "(", "$", "this", "->", "pending", "[", "$", "url", "]", ")", "&&", "!", "$", "this", "->", "pending", "[", "$", "url", "]", "->", "isEmpty", "(", ")", ")", ...
Touch pending "requests for connection" @param string $url URL @return void
[ "Touch", "pending", "requests", "for", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L229-L236
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.getConnectionByKey
public function getConnectionByKey($key, $cb = null) { if (is_object($key)) { return $key->onConnected($cb); } srand(crc32($key)); $addr = array_rand($this->servers); srand(); return $this->getConnection($addr, $cb); }
php
public function getConnectionByKey($key, $cb = null) { if (is_object($key)) { return $key->onConnected($cb); } srand(crc32($key)); $addr = array_rand($this->servers); srand(); return $this->getConnection($addr, $cb); }
[ "public", "function", "getConnectionByKey", "(", "$", "key", ",", "$", "cb", "=", "null", ")", "{", "if", "(", "is_object", "(", "$", "key", ")", ")", "{", "return", "$", "key", "->", "onConnected", "(", "$", "cb", ")", ";", "}", "srand", "(", "c...
Returns available connection from the pool by key @param string $key Key @param callable $cb Callback @callback $cb ( ) @return boolean Success
[ "Returns", "available", "connection", "from", "the", "pool", "by", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L245-L254
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.requestByServer
public function requestByServer($server, $data, $onResponse = null) { $this->getConnection($server, function ($conn) use ($data, $onResponse) { if (!$conn->isConnected()) { return; } $conn->onResponse($onResponse); $conn->write($data); ...
php
public function requestByServer($server, $data, $onResponse = null) { $this->getConnection($server, function ($conn) use ($data, $onResponse) { if (!$conn->isConnected()) { return; } $conn->onResponse($onResponse); $conn->write($data); ...
[ "public", "function", "requestByServer", "(", "$", "server", ",", "$", "data", ",", "$", "onResponse", "=", "null", ")", "{", "$", "this", "->", "getConnection", "(", "$", "server", ",", "function", "(", "$", "conn", ")", "use", "(", "$", "data", ","...
Sends a request to arbitrary server @param string $server Server @param string $data Data @param callable $onResponse Called when the request complete @callback $onResponse ( ) @return boolean Success
[ "Sends", "a", "request", "to", "arbitrary", "server" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L275-L285
kakserpom/phpdaemon
PHPDaemon/Network/Client.php
Client.requestByKey
public function requestByKey($key, $data, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($data, $onResponse) { if (!$conn->isConnected()) { return; } $conn->onResponse($onResponse); $conn->write($data); }); ...
php
public function requestByKey($key, $data, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($data, $onResponse) { if (!$conn->isConnected()) { return; } $conn->onResponse($onResponse); $conn->write($data); }); ...
[ "public", "function", "requestByKey", "(", "$", "key", ",", "$", "data", ",", "$", "onResponse", "=", "null", ")", "{", "$", "this", "->", "getConnectionByKey", "(", "$", "key", ",", "function", "(", "$", "conn", ")", "use", "(", "$", "data", ",", ...
Sends a request to server according to the key @param string $key Key @param string $data Data @param callable $onResponse Callback called when the request complete @callback $onResponse ( ) @return boolean Success
[ "Sends", "a", "request", "to", "server", "according", "to", "the", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Client.php#L295-L305
kakserpom/phpdaemon
PHPDaemon/Applications/CGIRequest.php
CGIRequest.init
public function init() { $this->header('Content-Type: text/html'); // default header. $this->proc = new \PHPDaemon\Core\ShellCommand(); $this->proc->readPacketSize = $this->appInstance->readPacketSize; $this->proc->onReadData([$this, 'onReadData']); $this->proc->onWrite([$th...
php
public function init() { $this->header('Content-Type: text/html'); // default header. $this->proc = new \PHPDaemon\Core\ShellCommand(); $this->proc->readPacketSize = $this->appInstance->readPacketSize; $this->proc->onReadData([$this, 'onReadData']); $this->proc->onWrite([$th...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "header", "(", "'Content-Type: text/html'", ")", ";", "// default header.", "$", "this", "->", "proc", "=", "new", "\\", "PHPDaemon", "\\", "Core", "\\", "ShellCommand", "(", ")", ";", "$", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Applications/CGIRequest.php#L28-L70
kakserpom/phpdaemon
PHPDaemon/Applications/CGIRequest.php
CGIRequest.run
public function run() { if (!$this->proc) { $this->out('Couldn\'t execute CGI proccess.'); $this->finish(); return; } if (!$this->proc->eof()) { $this->sleep(); } }
php
public function run() { if (!$this->proc) { $this->out('Couldn\'t execute CGI proccess.'); $this->finish(); return; } if (!$this->proc->eof()) { $this->sleep(); } }
[ "public", "function", "run", "(", ")", "{", "if", "(", "!", "$", "this", "->", "proc", ")", "{", "$", "this", "->", "out", "(", "'Couldn\\'t execute CGI proccess.'", ")", ";", "$", "this", "->", "finish", "(", ")", ";", "return", ";", "}", "if", "(...
Called when request iterated. @return void
[ "Called", "when", "request", "iterated", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Applications/CGIRequest.php#L76-L86
kakserpom/phpdaemon
PHPDaemon/Applications/CGIRequest.php
CGIRequest.stdin
public function stdin($c) { if ($c === '') { $this->onWrite($this->proc); } else { $this->proc->write($c); } }
php
public function stdin($c) { if ($c === '') { $this->onWrite($this->proc); } else { $this->proc->write($c); } }
[ "public", "function", "stdin", "(", "$", "c", ")", "{", "if", "(", "$", "c", "===", "''", ")", "{", "$", "this", "->", "onWrite", "(", "$", "this", "->", "proc", ")", ";", "}", "else", "{", "$", "this", "->", "proc", "->", "write", "(", "$", ...
Called when new piece of request's body is received. @param string $c Piece of request's body. @return void
[ "Called", "when", "new", "piece", "of", "request", "s", "body", "is", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Applications/CGIRequest.php#L115-L122
kakserpom/phpdaemon
PHPDaemon/Applications/CGIRequest.php
CGIRequest.onWrite
public function onWrite($process) { if ($this->attrs->stdin_done && ($this->proc->writeState === false)) { $this->proc->closeWrite(); } }
php
public function onWrite($process) { if ($this->attrs->stdin_done && ($this->proc->writeState === false)) { $this->proc->closeWrite(); } }
[ "public", "function", "onWrite", "(", "$", "process", ")", "{", "if", "(", "$", "this", "->", "attrs", "->", "stdin_done", "&&", "(", "$", "this", "->", "proc", "->", "writeState", "===", "false", ")", ")", "{", "$", "this", "->", "proc", "->", "cl...
Called when the request aborted. @param \PHPDaemon\Core\ShellCommand $process @return void
[ "Called", "when", "the", "request", "aborted", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Applications/CGIRequest.php#L129-L134
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.importParams
protected function importParams() { foreach ($this->uri['params'] as $key => $val) { if (isset($this->{$key}) && is_bool($this->{$key})) { $this->{$key} = (bool)$val; continue; } if (!property_exists($this, $key)) { Daemon::...
php
protected function importParams() { foreach ($this->uri['params'] as $key => $val) { if (isset($this->{$key}) && is_bool($this->{$key})) { $this->{$key} = (bool)$val; continue; } if (!property_exists($this, $key)) { Daemon::...
[ "protected", "function", "importParams", "(", ")", "{", "foreach", "(", "$", "this", "->", "uri", "[", "'params'", "]", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "{", "$", "key", "}", ")", "&&", "...
Import parameters @return void
[ "Import", "parameters" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L203-L248
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.initSecureContext
protected function initSecureContext() { if (!\EventUtil::sslRandPoll()) { Daemon::$process->log(get_class($this->pool) . ': EventUtil::sslRandPoll failed'); $this->erroneous = true; return; } if (!FileSystem::checkFileReadable($this->certfile) || !FileSys...
php
protected function initSecureContext() { if (!\EventUtil::sslRandPoll()) { Daemon::$process->log(get_class($this->pool) . ': EventUtil::sslRandPoll failed'); $this->erroneous = true; return; } if (!FileSystem::checkFileReadable($this->certfile) || !FileSys...
[ "protected", "function", "initSecureContext", "(", ")", "{", "if", "(", "!", "\\", "EventUtil", "::", "sslRandPoll", "(", ")", ")", "{", "Daemon", "::", "$", "process", "->", "log", "(", "get_class", "(", "$", "this", "->", "pool", ")", ".", "': EventU...
Initialize SSL/TLS context @return void
[ "Initialize", "SSL", "/", "TLS", "context" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L254-L304
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.attachTo
public function attachTo(\PHPDaemon\Network\Pool $pool) { $this->pool = $pool; $this->pool->attachBound($this); }
php
public function attachTo(\PHPDaemon\Network\Pool $pool) { $this->pool = $pool; $this->pool->attachBound($this); }
[ "public", "function", "attachTo", "(", "\\", "PHPDaemon", "\\", "Network", "\\", "Pool", "$", "pool", ")", "{", "$", "this", "->", "pool", "=", "$", "pool", ";", "$", "this", "->", "pool", "->", "attachBound", "(", "$", "this", ")", ";", "}" ]
Attach to ConnectionPool @param ConnectionPool @return void
[ "Attach", "to", "ConnectionPool" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L311-L315
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.enable
public function enable() { if ($this->enabled) { return; } if (!$this->fd) { return; } $this->enabled = true; if ($this->ev === null) { if ($this->eventLoop === null) { $this->eventLoop = EventLoop::$instance; ...
php
public function enable() { if ($this->enabled) { return; } if (!$this->fd) { return; } $this->enabled = true; if ($this->ev === null) { if ($this->eventLoop === null) { $this->eventLoop = EventLoop::$instance; ...
[ "public", "function", "enable", "(", ")", "{", "if", "(", "$", "this", "->", "enabled", ")", "{", "return", ";", "}", "if", "(", "!", "$", "this", "->", "fd", ")", "{", "return", ";", "}", "$", "this", "->", "enabled", "=", "true", ";", "if", ...
Enable socket events @return void
[ "Enable", "socket", "events" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L341-L365
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.disable
public function disable() { if (!$this->enabled) { return; } $this->enabled = false; if ($this->ev instanceof \Event) { $this->ev->del(); } elseif ($this->ev instanceof \EventListener) { $this->ev->disable(); } }
php
public function disable() { if (!$this->enabled) { return; } $this->enabled = false; if ($this->ev instanceof \Event) { $this->ev->del(); } elseif ($this->ev instanceof \EventListener) { $this->ev->disable(); } }
[ "public", "function", "disable", "(", ")", "{", "if", "(", "!", "$", "this", "->", "enabled", ")", "{", "return", ";", "}", "$", "this", "->", "enabled", "=", "false", ";", "if", "(", "$", "this", "->", "ev", "instanceof", "\\", "Event", ")", "{"...
Disable all events of sockets @return void
[ "Disable", "all", "events", "of", "sockets" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L398-L409
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.close
public function close() { if (isset($this->ev)) { $this->ev = null; } if ($this->pid !== posix_getpid()) { // preventing closing pre-bound sockets in workers return; } if (is_resource($this->fd)) { socket_close($this->fd); } }
php
public function close() { if (isset($this->ev)) { $this->ev = null; } if ($this->pid !== posix_getpid()) { // preventing closing pre-bound sockets in workers return; } if (is_resource($this->fd)) { socket_close($this->fd); } }
[ "public", "function", "close", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "ev", ")", ")", "{", "$", "this", "->", "ev", "=", "null", ";", "}", "if", "(", "$", "this", "->", "pid", "!==", "posix_getpid", "(", ")", ")", "{", "//...
Close each of binded sockets. @return void
[ "Close", "each", "of", "binded", "sockets", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L415-L426
kakserpom/phpdaemon
PHPDaemon/BoundSocket/Generic.php
Generic.netMatch
public static function netMatch($CIDR, $IP) { /* TODO: IPV6 */ if (is_array($CIDR)) { foreach ($CIDR as &$v) { if (self::netMatch($v, $IP)) { return true; } } return false; } $e = explode('/', $...
php
public static function netMatch($CIDR, $IP) { /* TODO: IPV6 */ if (is_array($CIDR)) { foreach ($CIDR as &$v) { if (self::netMatch($v, $IP)) { return true; } } return false; } $e = explode('/', $...
[ "public", "static", "function", "netMatch", "(", "$", "CIDR", ",", "$", "IP", ")", "{", "/* TODO: IPV6 */", "if", "(", "is_array", "(", "$", "CIDR", ")", ")", "{", "foreach", "(", "$", "CIDR", "as", "&", "$", "v", ")", "{", "if", "(", "self", "::...
Checks if the CIDR-mask matches the IP @param string CIDR-mask @param string IP @return boolean Result
[ "Checks", "if", "the", "CIDR", "-", "mask", "matches", "the", "IP" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/Generic.php#L460-L480
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicDeliverFrame.php
BasicDeliverFrame.create
public static function create( $consumerTag = null, $deliveryTag = null, $redelivered = null, $exchange = null, $routingKey = null ) { $frame = new self(); if (null !== $consumerTag) { $frame->consumerTag = $consumerTag; } if (null !== $deliveryTag) { ...
php
public static function create( $consumerTag = null, $deliveryTag = null, $redelivered = null, $exchange = null, $routingKey = null ) { $frame = new self(); if (null !== $consumerTag) { $frame->consumerTag = $consumerTag; } if (null !== $deliveryTag) { ...
[ "public", "static", "function", "create", "(", "$", "consumerTag", "=", "null", ",", "$", "deliveryTag", "=", "null", ",", "$", "redelivered", "=", "null", ",", "$", "exchange", "=", "null", ",", "$", "routingKey", "=", "null", ")", "{", "$", "frame", ...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicDeliverFrame.php#L25-L48
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueuePurgeFrame.php
QueuePurgeFrame.create
public static function create( $queue = null, $nowait = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $nowait) { $frame->nowait = $nowait; } return $frame; }
php
public static function create( $queue = null, $nowait = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $nowait) { $frame->nowait = $nowait; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "queue", "=", "null", ",", "$", "nowait", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "queue", ")", "{", "$", "frame", "->", "queue", ...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueuePurgeFrame.php#L22-L36
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Examples/Simple.php
Simple.onReady
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); /*$this->redis->eval("return {'a','b','c', {'d','e','f', {'g','h','i'}} }",0, function($redis) { Daemon::log(Debug::dump($redis->result)); });*/ $this->redis->subscribe('te3st', fun...
php
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); /*$this->redis->eval("return {'a','b','c', {'d','e','f', {'g','h','i'}} }",0, function($redis) { Daemon::log(Debug::dump($redis->result)); });*/ $this->redis->subscribe('te3st', fun...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "redis", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "::", "getInstance", "(", ")", ";", "/*$this->redis->eval(\"return {'a','b','c', {'d','e','f', {'g','h','i'}} }\",0, funct...
Called when the worker is ready to go. @return void
[ "Called", "when", "the", "worker", "is", "ready", "to", "go", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Examples/Simple.php#L24-L39
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionSecureOkFrame.php
ConnectionSecureOkFrame.create
public static function create( $response = null ) { $frame = new self(); if (null !== $response) { $frame->response = $response; } return $frame; }
php
public static function create( $response = null ) { $frame = new self(); if (null !== $response) { $frame->response = $response; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "response", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "response", ")", "{", "$", "frame", "->", "response", "=", "$", "response", ";", ...
longstr
[ "longstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionSecureOkFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/Config/Parser.php
Parser.parse
public static function parse($file, $target, $included = false) { if (in_array($file, static::$stack)) { throw new InfiniteRecursion; } static::$stack[] = $file; $parser = new static($file, $target, $included); array_pop(static::$stack); return $parser; ...
php
public static function parse($file, $target, $included = false) { if (in_array($file, static::$stack)) { throw new InfiniteRecursion; } static::$stack[] = $file; $parser = new static($file, $target, $included); array_pop(static::$stack); return $parser; ...
[ "public", "static", "function", "parse", "(", "$", "file", ",", "$", "target", ",", "$", "included", "=", "false", ")", "{", "if", "(", "in_array", "(", "$", "file", ",", "static", "::", "$", "stack", ")", ")", "{", "throw", "new", "InfiniteRecursion...
Parse config file @param string File path @param _Object Target @param boolean Included? Default is false @return \PHPDaemon\Config\Parser
[ "Parse", "config", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Parser.php#L142-L152
kakserpom/phpdaemon
PHPDaemon/Config/Parser.php
Parser.purgeScope
protected function purgeScope($scope) { foreach ($scope as $name => $obj) { if ($obj instanceof Generic) { if ($obj->source === 'config' && ($obj->revision < $this->revision)) { if (!$obj->resetToDefault()) { unset($scope->{$name}); ...
php
protected function purgeScope($scope) { foreach ($scope as $name => $obj) { if ($obj instanceof Generic) { if ($obj->source === 'config' && ($obj->revision < $this->revision)) { if (!$obj->resetToDefault()) { unset($scope->{$name}); ...
[ "protected", "function", "purgeScope", "(", "$", "scope", ")", "{", "foreach", "(", "$", "scope", "as", "$", "name", "=>", "$", "obj", ")", "{", "if", "(", "$", "obj", "instanceof", "Generic", ")", "{", "if", "(", "$", "obj", "->", "source", "===",...
Removes old config parts after updating. @return void
[ "Removes", "old", "config", "parts", "after", "updating", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Parser.php#L457-L476
kakserpom/phpdaemon
PHPDaemon/Config/Parser.php
Parser.raiseError
public function raiseError($msg, $level = 'emerg', $line = null, $col = null) { if ($level === 'emerg') { $this->erroneous = true; } if ($line === null) { $line = $this->line; } if ($col === null) { $col = $this->col - 1; } ...
php
public function raiseError($msg, $level = 'emerg', $line = null, $col = null) { if ($level === 'emerg') { $this->erroneous = true; } if ($line === null) { $line = $this->line; } if ($col === null) { $col = $this->col - 1; } ...
[ "public", "function", "raiseError", "(", "$", "msg", ",", "$", "level", "=", "'emerg'", ",", "$", "line", "=", "null", ",", "$", "col", "=", "null", ")", "{", "if", "(", "$", "level", "===", "'emerg'", ")", "{", "$", "this", "->", "erroneous", "=...
Raises error message. @param string Message. @param string Level. @param string $msg @return void
[ "Raises", "error", "message", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Parser.php#L496-L509
kakserpom/phpdaemon
PHPDaemon/Config/Parser.php
Parser.getCurrentChar
protected function getCurrentChar() { $c = substr($this->data, $this->p, 1); if ($c === "\n") { ++$this->line; $this->col = 1; } else { ++$this->col; } return $c; }
php
protected function getCurrentChar() { $c = substr($this->data, $this->p, 1); if ($c === "\n") { ++$this->line; $this->col = 1; } else { ++$this->col; } return $c; }
[ "protected", "function", "getCurrentChar", "(", ")", "{", "$", "c", "=", "substr", "(", "$", "this", "->", "data", ",", "$", "this", "->", "p", ",", "1", ")", ";", "if", "(", "$", "c", "===", "\"\\n\"", ")", "{", "++", "$", "this", "->", "line"...
Current character. @return string Character.
[ "Current", "character", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Parser.php#L525-L537
kakserpom/phpdaemon
PHPDaemon/FS/FileWatcher.php
FileWatcher.watch
public function watch() { if ($this->inotify) { $events = inotify_read($this->inotify); if (!$events) { return; } foreach ($events as $ev) { $path = $this->descriptors[$ev['wd']]; if (!isset($this->files[$path]))...
php
public function watch() { if ($this->inotify) { $events = inotify_read($this->inotify); if (!$events) { return; } foreach ($events as $ev) { $path = $this->descriptors[$ev['wd']]; if (!isset($this->files[$path]))...
[ "public", "function", "watch", "(", ")", "{", "if", "(", "$", "this", "->", "inotify", ")", "{", "$", "events", "=", "inotify_read", "(", "$", "this", "->", "inotify", ")", ";", "if", "(", "!", "$", "events", ")", "{", "return", ";", "}", "foreac...
Check the file system, triggered by timer @return void
[ "Check", "the", "file", "system", "triggered", "by", "timer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileWatcher.php#L58-L91
kakserpom/phpdaemon
PHPDaemon/FS/FileWatcher.php
FileWatcher.onFileChanged
public function onFileChanged($path) { if (!Daemon::lintFile($path)) { Daemon::log(__METHOD__ . ': Detected parse error in ' . $path); return; } foreach ($this->files[$path] as $cb) { if (is_callable($cb) || is_array($cb)) { $cb($path); ...
php
public function onFileChanged($path) { if (!Daemon::lintFile($path)) { Daemon::log(__METHOD__ . ': Detected parse error in ' . $path); return; } foreach ($this->files[$path] as $cb) { if (is_callable($cb) || is_array($cb)) { $cb($path); ...
[ "public", "function", "onFileChanged", "(", "$", "path", ")", "{", "if", "(", "!", "Daemon", "::", "lintFile", "(", "$", "path", ")", ")", "{", "Daemon", "::", "log", "(", "__METHOD__", ".", "': Detected parse error in '", ".", "$", "path", ")", ";", "...
Called when file $path is changed @param string $path Path @return void
[ "Called", "when", "file", "$path", "is", "changed" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileWatcher.php#L98-L111
kakserpom/phpdaemon
PHPDaemon/FS/FileWatcher.php
FileWatcher.rmWatch
public function rmWatch($path, $cb) { $path = realpath($path); if (!isset($this->files[$path])) { return false; } if (($k = array_search($cb, $this->files[$path], true)) !== false) { unset($this->files[$path][$k]); } if (sizeof($this->files[$p...
php
public function rmWatch($path, $cb) { $path = realpath($path); if (!isset($this->files[$path])) { return false; } if (($k = array_search($cb, $this->files[$path], true)) !== false) { unset($this->files[$path][$k]); } if (sizeof($this->files[$p...
[ "public", "function", "rmWatch", "(", "$", "path", ",", "$", "cb", ")", "{", "$", "path", "=", "realpath", "(", "$", "path", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "files", "[", "$", "path", "]", ")", ")", "{", "return", "...
Cancels your subscription on object in FS @param string $path Path @param mixed $cb Callback @return boolean
[ "Cancels", "your", "subscription", "on", "object", "in", "FS" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileWatcher.php#L119-L138
kakserpom/phpdaemon
PHPDaemon/FS/FileWatcher.php
FileWatcher.addWatch
public function addWatch($path, $cb, $flags = null) { $path = realpath($path); if (!isset($this->files[$path])) { $this->files[$path] = []; if ($this->inotify) { $this->descriptors[inotify_add_watch($this->inotify, $path, $flags ?: IN_MODIFY)] = $path; ...
php
public function addWatch($path, $cb, $flags = null) { $path = realpath($path); if (!isset($this->files[$path])) { $this->files[$path] = []; if ($this->inotify) { $this->descriptors[inotify_add_watch($this->inotify, $path, $flags ?: IN_MODIFY)] = $path; ...
[ "public", "function", "addWatch", "(", "$", "path", ",", "$", "cb", ",", "$", "flags", "=", "null", ")", "{", "$", "path", "=", "realpath", "(", "$", "path", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "files", "[", "$", "path", ...
Adds your subscription on object in FS @param string $path Path @param mixed $cb Callback @param integer $flags Look inotify_add_watch() @return true
[ "Adds", "your", "subscription", "on", "object", "in", "FS" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileWatcher.php#L147-L159
kakserpom/phpdaemon
PHPDaemon/SockJS/Examples/Simple.php
Simple.onReady
public function onReady() { \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute( '/sockjs', function ($client) { return new SimpleRoute($client, $this); } ); }
php
public function onReady() { \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute( '/sockjs', function ($client) { return new SimpleRoute($client, $this); } ); }
[ "public", "function", "onReady", "(", ")", "{", "\\", "PHPDaemon", "\\", "Servers", "\\", "WebSocket", "\\", "Pool", "::", "getInstance", "(", ")", "->", "addRoute", "(", "'/sockjs'", ",", "function", "(", "$", "client", ")", "{", "return", "new", "Simpl...
Called when the worker is ready to go. @return void
[ "Called", "when", "the", "worker", "is", "ready", "to", "go", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Examples/Simple.php#L38-L46
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.getAuthKey
public static function getAuthKey($username, $password, $nonce) { return md5($nonce . $username . md5($username . ':mongo:' . $password)); }
php
public static function getAuthKey($username, $password, $nonce) { return md5($nonce . $username . md5($username . ':mongo:' . $password)); }
[ "public", "static", "function", "getAuthKey", "(", "$", "username", ",", "$", "password", ",", "$", "nonce", ")", "{", "return", "md5", "(", "$", "nonce", ".", "$", "username", ".", "md5", "(", "$", "username", ".", "':mongo:'", ".", "$", "password", ...
Generates auth. key @param string $username Username @param string $password Password @param string $nonce Nonce @return string MD5 hash
[ "Generates", "auth", ".", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L135-L138
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.addServer
public function addServer($url, $weight = null, $mock = null) { $this->servers[$url] = $weight; }
php
public function addServer($url, $weight = null, $mock = null) { $this->servers[$url] = $weight; }
[ "public", "function", "addServer", "(", "$", "url", ",", "$", "weight", "=", "null", ",", "$", "mock", "=", "null", ")", "{", "$", "this", "->", "servers", "[", "$", "url", "]", "=", "$", "weight", ";", "}" ]
Adds mongo server @param string $url URL @param integer $weight Weight @param mixed $mock @deprecated @return void
[ "Adds", "mongo", "server" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L147-L150
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.request
public function request($opcode, $data, $reply = false, $conn = null, $sentcb = null) { $cb = $this->requestCbProducer($opcode, $data, $reply, $sentcb); if (is_object($conn) && ($conn instanceof Connection)) { if ($conn->isFinished()) { throw new ConnectionFinished; ...
php
public function request($opcode, $data, $reply = false, $conn = null, $sentcb = null) { $cb = $this->requestCbProducer($opcode, $data, $reply, $sentcb); if (is_object($conn) && ($conn instanceof Connection)) { if ($conn->isFinished()) { throw new ConnectionFinished; ...
[ "public", "function", "request", "(", "$", "opcode", ",", "$", "data", ",", "$", "reply", "=", "false", ",", "$", "conn", "=", "null", ",", "$", "sentcb", "=", "null", ")", "{", "$", "cb", "=", "$", "this", "->", "requestCbProducer", "(", "$", "o...
Gets the key @param integer $opcode Opcode (see constants above) @param string $data Data @param boolean $reply Is an answer expected? @param Connection $conn Connection. Optional @param callable $sentcb Sent callback @callback $sentcb ( ) @throws ConnectionFinished @return void
[ "Gets", "the", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L163-L176
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.findAll
public function findAll($p, $cb) { $this->find($p, function ($cursor) use ($cb) { if (!$cursor->isFinished()) { $cursor->getMore(); } else { $cb($cursor); } }); }
php
public function findAll($p, $cb) { $this->find($p, function ($cursor) use ($cb) { if (!$cursor->isFinished()) { $cursor->getMore(); } else { $cb($cursor); } }); }
[ "public", "function", "findAll", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "this", "->", "find", "(", "$", "p", ",", "function", "(", "$", "cursor", ")", "use", "(", "$", "cb", ")", "{", "if", "(", "!", "$", "cursor", "->", "isFinished", ...
Finds objects in collection and fires callback when got all objects @param array $p Hash of properties (offset, limit, opts, tailable, await, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Finds", "objects", "in", "collection", "and", "fires", "callback", "when", "got", "all", "objects" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L220-L229
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.find
public function find($p, $cb) { if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = 0; } if (!isset($p['opts'])) { $p['opts'] = '0'; } if (isset($p['tailable']) && $p['tailable']) { ...
php
public function find($p, $cb) { if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = 0; } if (!isset($p['opts'])) { $p['opts'] = '0'; } if (isset($p['tailable']) && $p['tailable']) { ...
[ "public", "function", "find", "(", "$", "p", ",", "$", "cb", ")", "{", "if", "(", "!", "isset", "(", "$", "p", "[", "'offset'", "]", ")", ")", "{", "$", "p", "[", "'offset'", "]", "=", "0", ";", "}", "if", "(", "!", "isset", "(", "$", "p"...
Finds objects in collection @param array $p Hash of properties (offset, limit, opts, tailable, await, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Finds", "objects", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L238-L327
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.findOne
public function findOne($p, $cb) { if (isset($p['cachekey'])) { $db = $this; $this->cache->get($p['cachekey'], function ($r) use ($db, $p, $cb) { if ($r->result !== null) { $cb(bson_decode($r->result)); } else { ...
php
public function findOne($p, $cb) { if (isset($p['cachekey'])) { $db = $this; $this->cache->get($p['cachekey'], function ($r) use ($db, $p, $cb) { if ($r->result !== null) { $cb(bson_decode($r->result)); } else { ...
[ "public", "function", "findOne", "(", "$", "p", ",", "$", "cb", ")", "{", "if", "(", "isset", "(", "$", "p", "[", "'cachekey'", "]", ")", ")", "{", "$", "db", "=", "$", "this", ";", "$", "this", "->", "cache", "->", "get", "(", "$", "p", "[...
Finds one object in collection @param array $p Hash of properties (offset, opts, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Finds", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L336-L414
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.findCount
public function findCount($p, $cb) { if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = -1; } if (!isset($p['opts'])) { $p['opts'] = 0; } if (!isset($p['where'])) { $p['wh...
php
public function findCount($p, $cb) { if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = -1; } if (!isset($p['opts'])) { $p['opts'] = 0; } if (!isset($p['where'])) { $p['wh...
[ "public", "function", "findCount", "(", "$", "p", ",", "$", "cb", ")", "{", "if", "(", "!", "isset", "(", "$", "p", "[", "'offset'", "]", ")", ")", "{", "$", "p", "[", "'offset'", "]", "=", "0", ";", "}", "if", "(", "!", "isset", "(", "$", ...
Counts objects in collection @param array $p Hash of properties (offset, limit, opts, where, col) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Counts", "objects", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L423-L495
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.auth
public function auth($p, $cb) { if (!isset($p['opts'])) { $p['opts'] = 0; } $query = [ 'authenticate' => 1, 'user' => $p['user'], 'nonce' => $p['nonce'], 'key' => self::getAuthKey($p['user'], $p['password'], $p['nonce']), ]...
php
public function auth($p, $cb) { if (!isset($p['opts'])) { $p['opts'] = 0; } $query = [ 'authenticate' => 1, 'user' => $p['user'], 'nonce' => $p['nonce'], 'key' => self::getAuthKey($p['user'], $p['password'], $p['nonce']), ]...
[ "public", "function", "auth", "(", "$", "p", ",", "$", "cb", ")", "{", "if", "(", "!", "isset", "(", "$", "p", "[", "'opts'", "]", ")", ")", "{", "$", "p", "[", "'opts'", "]", "=", "0", ";", "}", "$", "query", "=", "[", "'authenticate'", "=...
Sends authenciation packet @param array $p Hash of properties (dbname, user, password, nonce) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Sends", "authenciation", "packet" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L504-L544
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.ensureIndex
public function ensureIndex($ns, $keys, $options = [], $cb = null) { $e = explode('.', $ns, 2); $doc = [ 'ns' => $ns, 'key' => $keys, 'name' => isset($options['name']) ? $options['name'] : $this->getIndexName($keys), ]; if (isset($options['unique']...
php
public function ensureIndex($ns, $keys, $options = [], $cb = null) { $e = explode('.', $ns, 2); $doc = [ 'ns' => $ns, 'key' => $keys, 'name' => isset($options['name']) ? $options['name'] : $this->getIndexName($keys), ]; if (isset($options['unique']...
[ "public", "function", "ensureIndex", "(", "$", "ns", ",", "$", "keys", ",", "$", "options", "=", "[", "]", ",", "$", "cb", "=", "null", ")", "{", "$", "e", "=", "explode", "(", "'.'", ",", "$", "ns", ",", "2", ")", ";", "$", "doc", "=", "["...
Ensure index @param string $ns Collection @param array $keys Keys @param array $options Optional. Options @param callable $cb Optional. Callback called when response received @callback $cb ( ) @return void
[ "Ensure", "index" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L616-L640
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.lastError
public function lastError($db, $cb, $params = [], $conn = null) { $e = explode('.', $db, 2); $params['getlasterror'] = 1; $cb = CallbackWrapper::wrap($cb); try { $this->request( self::OP_QUERY, pack('V', 0) . $e[0] . '.$cmd' . "\x00" ...
php
public function lastError($db, $cb, $params = [], $conn = null) { $e = explode('.', $db, 2); $params['getlasterror'] = 1; $cb = CallbackWrapper::wrap($cb); try { $this->request( self::OP_QUERY, pack('V', 0) . $e[0] . '.$cmd' . "\x00" ...
[ "public", "function", "lastError", "(", "$", "db", ",", "$", "cb", ",", "$", "params", "=", "[", "]", ",", "$", "conn", "=", "null", ")", "{", "$", "e", "=", "explode", "(", "'.'", ",", "$", "db", ",", "2", ")", ";", "$", "params", "[", "'g...
Gets last error @param string $db Dbname @param callable $cb Callback called when response received @param array $params Parameters. @param Connection $conn Connection. Optional @callback $cb ( ) @return void
[ "Gets", "last", "error" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L651-L677
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.evaluate
public function evaluate($code, $cb) { $p = []; if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = -1; } if (!isset($p['opts'])) { $p['opts'] = 0; } if (!isset($p['db'])) { ...
php
public function evaluate($code, $cb) { $p = []; if (!isset($p['offset'])) { $p['offset'] = 0; } if (!isset($p['limit'])) { $p['limit'] = -1; } if (!isset($p['opts'])) { $p['opts'] = 0; } if (!isset($p['db'])) { ...
[ "public", "function", "evaluate", "(", "$", "code", ",", "$", "cb", ")", "{", "$", "p", "=", "[", "]", ";", "if", "(", "!", "isset", "(", "$", "p", "[", "'offset'", "]", ")", ")", "{", "$", "p", "[", "'offset'", "]", "=", "0", ";", "}", "...
Evaluates a code on the server side @param string $code Code @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Evaluates", "a", "code", "on", "the", "server", "side" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L775-L822
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.distinct
public function distinct($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'distinct' => $e[1], 'key' => $p['key'], ]; if (isset($p[$k = 'rp'])) { $v = $p[$k]; if (is_string($v)) { $v =...
php
public function distinct($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'distinct' => $e[1], 'key' => $p['key'], ]; if (isset($p[$k = 'rp'])) { $v = $p[$k]; if (is_string($v)) { $v =...
[ "public", "function", "distinct", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "this", "->", "_params", "(", "$", "p", ")", ";", "$", "e", "=", "explode", "(", "'.'", ",", "$", "p", "[", "'col'", "]", ",", "2", ")", ";", "$", "query", "=",...
Returns distinct values of the property @param array $p Hash of properties (offset, limit, opts, key, col, where) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Returns", "distinct", "values", "of", "the", "property" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L831-L868
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool._paramFields
protected function _paramFields($f) { if (is_string($f)) { $f = array_map('trim', explode(',', $f)); } if (!is_array($f) || sizeof($f) === 0) { return null; } if (!isset($f[0])) { return $f; } $p = []; foreach ($f as...
php
protected function _paramFields($f) { if (is_string($f)) { $f = array_map('trim', explode(',', $f)); } if (!is_array($f) || sizeof($f) === 0) { return null; } if (!isset($f[0])) { return $f; } $p = []; foreach ($f as...
[ "protected", "function", "_paramFields", "(", "$", "f", ")", "{", "if", "(", "is_string", "(", "$", "f", ")", ")", "{", "$", "f", "=", "array_map", "(", "'trim'", ",", "explode", "(", "','", ",", "$", "f", ")", ")", ";", "}", "if", "(", "!", ...
[_paramFields description] @param mixed $f @return array
[ "[", "_paramFields", "description", "]" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L875-L891
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool._params
protected function _params(&$p) { foreach ($p as $k => &$v) { if ($k === 'fields' || $k === 'sort') { $v = $this->_paramFields($v); } elseif ($k === 'where') { if (is_string($v)) { $v = new \MongoCode($v); } ...
php
protected function _params(&$p) { foreach ($p as $k => &$v) { if ($k === 'fields' || $k === 'sort') { $v = $this->_paramFields($v); } elseif ($k === 'where') { if (is_string($v)) { $v = new \MongoCode($v); } ...
[ "protected", "function", "_params", "(", "&", "$", "p", ")", "{", "foreach", "(", "$", "p", "as", "$", "k", "=>", "&", "$", "v", ")", "{", "if", "(", "$", "k", "===", "'fields'", "||", "$", "k", "===", "'sort'", ")", "{", "$", "v", "=", "$"...
[_params description] @param array &$p @return void
[ "[", "_params", "description", "]" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L898-L937
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.findAndModify
public function findAndModify($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'findAndModify' => $e[1], ]; if (isset($p[$k = 'rp'])) { $v = $p[$k]; if (is_string($v)) { $v = ['mode' => $v]; ...
php
public function findAndModify($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'findAndModify' => $e[1], ]; if (isset($p[$k = 'rp'])) { $v = $p[$k]; if (is_string($v)) { $v = ['mode' => $v]; ...
[ "public", "function", "findAndModify", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "this", "->", "_params", "(", "$", "p", ")", ";", "$", "e", "=", "explode", "(", "'.'", ",", "$", "p", "[", "'col'", "]", ",", "2", ")", ";", "$", "query", ...
Find and modify @param array $p Hash of properties @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Find", "and", "modify" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L946-L1012
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.aggregate
public function aggregate($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'aggregate' => $e[1] ]; if (isset($p['rp'])) { $query['$readPreference'] = $p['rp']; unset($p['rp']); } foreach ($p as $k...
php
public function aggregate($p, $cb) { $this->_params($p); $e = explode('.', $p['col'], 2); $query = [ 'aggregate' => $e[1] ]; if (isset($p['rp'])) { $query['$readPreference'] = $p['rp']; unset($p['rp']); } foreach ($p as $k...
[ "public", "function", "aggregate", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "this", "->", "_params", "(", "$", "p", ")", ";", "$", "e", "=", "explode", "(", "'.'", ",", "$", "p", "[", "'col'", "]", ",", "2", ")", ";", "$", "query", "="...
Aggregate function @param array $p Hash of properties (offset, limit, opts, key, col) @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Aggregate", "function" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1097-L1141
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.update
public function update($col, $cond, $data, $flags = 0, $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (is_string($cond)) { $cond = new \MongoCode($cond); } if ($flags) { //if...
php
public function update($col, $cond, $data, $flags = 0, $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (is_string($cond)) { $cond = new \MongoCode($cond); } if ($flags) { //if...
[ "public", "function", "update", "(", "$", "col", ",", "$", "cond", ",", "$", "data", ",", "$", "flags", "=", "0", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'....
Updates one object in collection @param string $col Collection's name @param array $cond Conditions @param array $data Data @param integer $flags Optional. Flags @param callable $cb Optional. Callback @param array $params Optional. Parameters @callback $cb ( ) @return void
[ "Updates", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1154-L1187
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.updateOne
public function updateOne($col, $cond, $data, $cb = null, $params = []) { $this->update($col, $cond, $data, 0, $cb, $params); }
php
public function updateOne($col, $cond, $data, $cb = null, $params = []) { $this->update($col, $cond, $data, 0, $cb, $params); }
[ "public", "function", "updateOne", "(", "$", "col", ",", "$", "cond", ",", "$", "data", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "$", "this", "->", "update", "(", "$", "col", ",", "$", "cond", ",", "$", "data"...
Updates one object in collection @param string $col Collection's name @param array $cond Conditions @param array $data Data @param callable $cb Optional. Callback @param array $params Optional. Parameters @callback $cb ( ) @return void
[ "Updates", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1199-L1202
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.upsert
public function upsert($col, $cond, $data, $multi = false, $cb = null, $params = []) { $this->update($col, $cond, $data, $multi ? 3 : 1, $cb, $params); }
php
public function upsert($col, $cond, $data, $multi = false, $cb = null, $params = []) { $this->update($col, $cond, $data, $multi ? 3 : 1, $cb, $params); }
[ "public", "function", "upsert", "(", "$", "col", ",", "$", "cond", ",", "$", "data", ",", "$", "multi", "=", "false", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "$", "this", "->", "update", "(", "$", "col", ",",...
Upserts an object (updates if exists, insert if not exists) @param string $col Collection's name @param array $cond Conditions @param array $data Data @param boolean $multi Optional. Multi @param callable $cb Optional. Callback @param array $params Optional. Parameters @callback $cb ( ) @return void
[ "Upserts", "an", "object", "(", "updates", "if", "exists", "insert", "if", "not", "exists", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1230-L1233