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/Servers/WebSocket/Protocols/V13.php
V13.mask
public function mask($data, $mask) { for ($i = 0, $l = mb_orig_strlen($data), $ml = mb_orig_strlen($mask); $i < $l; $i++) { $data[$i] = $data[$i] ^ $mask[$i % $ml]; } return $data; }
php
public function mask($data, $mask) { for ($i = 0, $l = mb_orig_strlen($data), $ml = mb_orig_strlen($mask); $i < $l; $i++) { $data[$i] = $data[$i] ^ $mask[$i % $ml]; } return $data; }
[ "public", "function", "mask", "(", "$", "data", ",", "$", "mask", ")", "{", "for", "(", "$", "i", "=", "0", ",", "$", "l", "=", "mb_orig_strlen", "(", "$", "data", ")", ",", "$", "ml", "=", "mb_orig_strlen", "(", "$", "mask", ")", ";", "$", "...
Apply mask @param $data @param string|false $mask @return mixed
[ "Apply", "mask" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V13.php#L169-L175
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V13.php
V13.onRead
public function onRead() { if ($this->state === self::STATE_PREHANDSHAKE) { if (!$this->handshake()) { return; } } if ($this->state === self::STATE_HANDSHAKED) { while (($buflen = $this->getInputLength()) >= 2) { $first = or...
php
public function onRead() { if ($this->state === self::STATE_PREHANDSHAKE) { if (!$this->handshake()) { return; } } if ($this->state === self::STATE_HANDSHAKED) { while (($buflen = $this->getInputLength()) >= 2) { $first = or...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_PREHANDSHAKE", ")", "{", "if", "(", "!", "$", "this", "->", "handshake", "(", ")", ")", "{", "return", ";", "}", "}", "if", "(", "$"...
Called when new data received @see http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10#page-16 @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V13.php#L182-L261
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Parser/Frame.php
Frame.feed
public function feed($buffer, &$requiredBytes = 0) { $this->buffer .= $buffer; $availableBytes = \strlen($this->buffer); // not enough bytes for a frame ... if ($availableBytes < $this->requiredBytes) { $requiredBytes = $this->requiredBytes; return null; ...
php
public function feed($buffer, &$requiredBytes = 0) { $this->buffer .= $buffer; $availableBytes = \strlen($this->buffer); // not enough bytes for a frame ... if ($availableBytes < $this->requiredBytes) { $requiredBytes = $this->requiredBytes; return null; ...
[ "public", "function", "feed", "(", "$", "buffer", ",", "&", "$", "requiredBytes", "=", "0", ")", "{", "$", "this", "->", "buffer", ".=", "$", "buffer", ";", "$", "availableBytes", "=", "\\", "strlen", "(", "$", "this", "->", "buffer", ")", ";", "//...
Retrieve the next frame from the internal buffer. @param string $buffer Binary data to feed to the parser. @param int &$requiredBytes The minimum number of bytes that must be read to produce the next frame. @return ProtocolFrameInterface|null The frame parsed from the start of the buffer. @throws AMQPProtocolE...
[ "Retrieve", "the", "next", "frame", "from", "the", "internal", "buffer", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Parser/Frame.php#L76-L175
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Access/AccessRequestFrame.php
AccessRequestFrame.create
public static function create( $realm = null, $exclusive = null, $passive = null, $active = null, $write = null, $read = null ) { $frame = new self(); if (null !== $realm) { $frame->realm = $realm; } if (null !== $exclusive) { $frame->exclusive = ...
php
public static function create( $realm = null, $exclusive = null, $passive = null, $active = null, $write = null, $read = null ) { $frame = new self(); if (null !== $realm) { $frame->realm = $realm; } if (null !== $exclusive) { $frame->exclusive = ...
[ "public", "static", "function", "create", "(", "$", "realm", "=", "null", ",", "$", "exclusive", "=", "null", ",", "$", "passive", "=", "null", ",", "$", "active", "=", "null", ",", "$", "write", "=", "null", ",", "$", "read", "=", "null", ")", "...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Access/AccessRequestFrame.php#L25-L51
kakserpom/phpdaemon
PHPDaemon/Config/Entry/ConfigFile.php
ConfigFile.onUpdate
public function onUpdate($old) { if (!Daemon::$process instanceof Master || (Daemon::$config->autoreload->value === 0) || !$old) { return; } $e = explode(';', $old); foreach ($e as $path) { Daemon::$process->fileWatcher->rmWatch($path, [Daemon::$process, 'sig...
php
public function onUpdate($old) { if (!Daemon::$process instanceof Master || (Daemon::$config->autoreload->value === 0) || !$old) { return; } $e = explode(';', $old); foreach ($e as $path) { Daemon::$process->fileWatcher->rmWatch($path, [Daemon::$process, 'sig...
[ "public", "function", "onUpdate", "(", "$", "old", ")", "{", "if", "(", "!", "Daemon", "::", "$", "process", "instanceof", "Master", "||", "(", "Daemon", "::", "$", "config", "->", "autoreload", "->", "value", "===", "0", ")", "||", "!", "$", "old", ...
Called when entry is updated @param $old @return void
[ "Called", "when", "entry", "is", "updated" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Entry/ConfigFile.php#L23-L38
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelFlowOkFrame.php
ChannelFlowOkFrame.create
public static function create( $active = null ) { $frame = new self(); if (null !== $active) { $frame->active = $active; } return $frame; }
php
public static function create( $active = null ) { $frame = new self(); if (null !== $active) { $frame->active = $active; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "active", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "active", ")", "{", "$", "frame", "->", "active", "=", "$", "active", ";", "}", ...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelFlowOkFrame.php#L21-L32
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Examples/Iterator.php
Iterator.onReady
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $this->redis->hmset('myset', 'field1', 'value1', 'field2', 'value2', 'field3', 'value3', 'field4', 'value4', 'field5', 'value5', function ($redis) { $this->redis->hgetall('myset', fu...
php
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $this->redis->hmset('myset', 'field1', 'value1', 'field2', 'value2', 'field3', 'value3', 'field4', 'value4', 'field5', 'value5', function ($redis) { $this->redis->hgetall('myset', fu...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "redis", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "::", "getInstance", "(", ")", ";", "$", "this", "->", "redis", "->", "hmset", "(", "'myset'", ",", "'fi...
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/Iterator.php#L24-L74
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/MultiEval.php
MultiEval.execute
public function execute() { if (!count($this->stack)) { foreach ($this->listeners as $cb) { $cb($this->pool); } return; } $params = $this->getParams(); $params[] = function ($redis) { foreach ($this->listeners as $cb) {...
php
public function execute() { if (!count($this->stack)) { foreach ($this->listeners as $cb) { $cb($this->pool); } return; } $params = $this->getParams(); $params[] = function ($redis) { foreach ($this->listeners as $cb) {...
[ "public", "function", "execute", "(", ")", "{", "if", "(", "!", "count", "(", "$", "this", "->", "stack", ")", ")", "{", "foreach", "(", "$", "this", "->", "listeners", "as", "$", "cb", ")", "{", "$", "cb", "(", "$", "this", "->", "pool", ")", ...
Runs the stack of commands
[ "Runs", "the", "stack", "of", "commands" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/MultiEval.php#L89-L105
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/MultiEval.php
MultiEval.getParams
public function getParams() { if ($this->cachedParams) { return $this->cachedParams; } $CMDS = []; $KEYS = []; $ARGV = []; $KEYNUM = 0; $ARGNUM = 0; foreach ($this->stack as $part) { list($cmd, $keys, $argv) = $part; ...
php
public function getParams() { if ($this->cachedParams) { return $this->cachedParams; } $CMDS = []; $KEYS = []; $ARGV = []; $KEYNUM = 0; $ARGNUM = 0; foreach ($this->stack as $part) { list($cmd, $keys, $argv) = $part; ...
[ "public", "function", "getParams", "(", ")", "{", "if", "(", "$", "this", "->", "cachedParams", ")", "{", "return", "$", "this", "->", "cachedParams", ";", "}", "$", "CMDS", "=", "[", "]", ";", "$", "KEYS", "=", "[", "]", ";", "$", "ARGV", "=", ...
Return params for eval command @return array
[ "Return", "params", "for", "eval", "command" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/MultiEval.php#L111-L154
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/MultiEval.php
MultiEval.add
public function add($cmd, $keys = null, $argv = null) { if ($keys !== null) { if (is_scalar($keys)) { $keys = [(string)$keys]; } elseif (!is_array($keys)) { throw new \Exception("Keys must be an array or scalar"); } } if ($a...
php
public function add($cmd, $keys = null, $argv = null) { if ($keys !== null) { if (is_scalar($keys)) { $keys = [(string)$keys]; } elseif (!is_array($keys)) { throw new \Exception("Keys must be an array or scalar"); } } if ($a...
[ "public", "function", "add", "(", "$", "cmd", ",", "$", "keys", "=", "null", ",", "$", "argv", "=", "null", ")", "{", "if", "(", "$", "keys", "!==", "null", ")", "{", "if", "(", "is_scalar", "(", "$", "keys", ")", ")", "{", "$", "keys", "=", ...
Adds eval command in stack @param string $cmd Lua script @param mixed $keys Keys @param mixed $argv Arguments
[ "Adds", "eval", "command", "in", "stack" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/MultiEval.php#L162-L181
kakserpom/phpdaemon
PHPDaemon/Clients/IRC/Connection.php
Connection.onReady
public function onReady() { if ($this->pool->identd) { /** @noinspection PhpParamsInspection */ $this->getSocketName(); $this->pool->identd->registerPair($this->locAddr, $this->locPort, ['UNIX', $this->user]); } list($this->nick, $this->realname) = explode...
php
public function onReady() { if ($this->pool->identd) { /** @noinspection PhpParamsInspection */ $this->getSocketName(); $this->pool->identd->registerPair($this->locAddr, $this->locPort, ['UNIX', $this->user]); } list($this->nick, $this->realname) = explode...
[ "public", "function", "onReady", "(", ")", "{", "if", "(", "$", "this", "->", "pool", "->", "identd", ")", "{", "/** @noinspection PhpParamsInspection */", "$", "this", "->", "getSocketName", "(", ")", ";", "$", "this", "->", "pool", "->", "identd", "->", ...
Called when the connection is handshaked (at low-level), and peer is ready to recv. data @return void
[ "Called", "when", "the", "connection", "is", "handshaked", "(", "at", "low", "-", "level", ")", "and", "peer", "is", "ready", "to", "recv", ".", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IRC/Connection.php#L85-L98
kakserpom/phpdaemon
PHPDaemon/Clients/IRC/Connection.php
Connection.onFinish
public function onFinish() { if ($this->pool->identd) { $this->pool->identd->unregisterPair($this->locPort, $this->port); } $this->event('disconnect'); parent::onFinish(); }
php
public function onFinish() { if ($this->pool->identd) { $this->pool->identd->unregisterPair($this->locPort, $this->port); } $this->event('disconnect'); parent::onFinish(); }
[ "public", "function", "onFinish", "(", ")", "{", "if", "(", "$", "this", "->", "pool", "->", "identd", ")", "{", "$", "this", "->", "pool", "->", "identd", "->", "unregisterPair", "(", "$", "this", "->", "locPort", ",", "$", "this", "->", "port", "...
Called when connection finishes @return void
[ "Called", "when", "connection", "finishes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IRC/Connection.php#L184-L191
kakserpom/phpdaemon
PHPDaemon/Clients/IRC/Connection.php
Connection.onRead
public function onRead() { while (($line = $this->readline()) !== null) { if ($line === '') { continue; } if (mb_orig_strlen($line) > 512) { Daemon::$process->log('IRCClientConnection error: buffer overflow.'); $this->finish...
php
public function onRead() { while (($line = $this->readline()) !== null) { if ($line === '') { continue; } if (mb_orig_strlen($line) > 512) { Daemon::$process->log('IRCClientConnection error: buffer overflow.'); $this->finish...
[ "public", "function", "onRead", "(", ")", "{", "while", "(", "(", "$", "line", "=", "$", "this", "->", "readline", "(", ")", ")", "!==", "null", ")", "{", "if", "(", "$", "line", "===", "''", ")", "{", "continue", ";", "}", "if", "(", "mb_orig_...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IRC/Connection.php#L397-L436
kakserpom/phpdaemon
PHPDaemon/Clients/MySQL/Pool.php
Pool.values
public static function values($arr) { if (!is_array($arr)) { return ''; } $arr = array_values($arr); foreach ($arr as &$v) { $v = static::value($v); } return implode(',', $arr); }
php
public static function values($arr) { if (!is_array($arr)) { return ''; } $arr = array_values($arr); foreach ($arr as &$v) { $v = static::value($v); } return implode(',', $arr); }
[ "public", "static", "function", "values", "(", "$", "arr", ")", "{", "if", "(", "!", "is_array", "(", "$", "arr", ")", ")", "{", "return", "''", ";", "}", "$", "arr", "=", "array_values", "(", "$", "arr", ")", ";", "foreach", "(", "$", "arr", "...
[values description] @param array $arr @return string
[ "[", "values", "description", "]" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/MySQL/Pool.php#L296-L306
kakserpom/phpdaemon
PHPDaemon/Clients/MySQL/Pool.php
Pool.value
public static function value($mixed) { if (is_string($mixed)) { return '\'' . static::escape($mixed) . '\''; } elseif (is_integer($mixed)) { return (string)$mixed; } elseif (is_float($mixed)) { return '\'' . $mixed . '\''; } return 'null'; ...
php
public static function value($mixed) { if (is_string($mixed)) { return '\'' . static::escape($mixed) . '\''; } elseif (is_integer($mixed)) { return (string)$mixed; } elseif (is_float($mixed)) { return '\'' . $mixed . '\''; } return 'null'; ...
[ "public", "static", "function", "value", "(", "$", "mixed", ")", "{", "if", "(", "is_string", "(", "$", "mixed", ")", ")", "{", "return", "'\\''", ".", "static", "::", "escape", "(", "$", "mixed", ")", ".", "'\\''", ";", "}", "elseif", "(", "is_int...
[value description] @param mixed $mixed @return string
[ "[", "value", "description", "]" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/MySQL/Pool.php#L313-L323
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.sighandler
public function sighandler($signo) { if (!isset(self::$signals[$signo])) { $this->log('caught unknown signal #' . $signo); return; } if (method_exists($this, $m = strtolower(self::$signals[$signo]))) { $this->$m(); } elseif (method_exists($this, 's...
php
public function sighandler($signo) { if (!isset(self::$signals[$signo])) { $this->log('caught unknown signal #' . $signo); return; } if (method_exists($this, $m = strtolower(self::$signals[$signo]))) { $this->$m(); } elseif (method_exists($this, 's...
[ "public", "function", "sighandler", "(", "$", "signo", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "signals", "[", "$", "signo", "]", ")", ")", "{", "$", "this", "->", "log", "(", "'caught unknown signal #'", ".", "$", "signo", ")", ...
Called when the signal is caught @param integer Signal's number @return void
[ "Called", "when", "the", "signal", "is", "caught" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L185-L196
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.start
public function start($clearstack = true) { $pid = \pcntl_fork(); if ($pid === -1) { throw new \Exception('Could not fork'); } elseif ($pid === 0) { // we are the child $thread = $this; $thread->pid = \posix_getpid(); if (!$thread->delayedSigR...
php
public function start($clearstack = true) { $pid = \pcntl_fork(); if ($pid === -1) { throw new \Exception('Could not fork'); } elseif ($pid === 0) { // we are the child $thread = $this; $thread->pid = \posix_getpid(); if (!$thread->delayedSigR...
[ "public", "function", "start", "(", "$", "clearstack", "=", "true", ")", "{", "$", "pid", "=", "\\", "pcntl_fork", "(", ")", ";", "if", "(", "$", "pid", "===", "-", "1", ")", "{", "throw", "new", "\\", "Exception", "(", "'Could not fork'", ")", ";"...
Starts the process @return void
[ "Starts", "the", "process" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L202-L223
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.registerSignals
protected function registerSignals() { foreach (self::$signals as $no => $name) { if (($name === 'SIGKILL') || ($name == 'SIGSTOP')) { continue; } if (!\pcntl_signal($no, [$this, 'sighandler'], true)) { $this->log('Cannot assign ' . $name ...
php
protected function registerSignals() { foreach (self::$signals as $no => $name) { if (($name === 'SIGKILL') || ($name == 'SIGSTOP')) { continue; } if (!\pcntl_signal($no, [$this, 'sighandler'], true)) { $this->log('Cannot assign ' . $name ...
[ "protected", "function", "registerSignals", "(", ")", "{", "foreach", "(", "self", "::", "$", "signals", "as", "$", "no", "=>", "$", "name", ")", "{", "if", "(", "(", "$", "name", "===", "'SIGKILL'", ")", "||", "(", "$", "name", "==", "'SIGSTOP'", ...
Registers signals @return void
[ "Registers", "signals" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L229-L240
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.sleep
public function sleep($s) { static $interval = 0.2; $n = $s / $interval; for ($i = 0; $i < $n; ++$i) { if ($this->shutdown) { return false; } \usleep($interval * 1000000); } return true; }
php
public function sleep($s) { static $interval = 0.2; $n = $s / $interval; for ($i = 0; $i < $n; ++$i) { if ($this->shutdown) { return false; } \usleep($interval * 1000000); } return true; }
[ "public", "function", "sleep", "(", "$", "s", ")", "{", "static", "$", "interval", "=", "0.2", ";", "$", "n", "=", "$", "s", "/", "$", "interval", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "n", ";", "++", "$", "i", ")"...
Delays the process execution for the given number of seconds @param integer Sleep time in seconds @return boolean Success
[ "Delays", "the", "process", "execution", "for", "the", "given", "number", "of", "seconds" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L247-L261
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.stop
public function stop($kill = false) { $this->shutdown = true; \posix_kill($this->pid, $kill ? SIGKILL : SIGTERM); }
php
public function stop($kill = false) { $this->shutdown = true; \posix_kill($this->pid, $kill ? SIGKILL : SIGTERM); }
[ "public", "function", "stop", "(", "$", "kill", "=", "false", ")", "{", "$", "this", "->", "shutdown", "=", "true", ";", "\\", "posix_kill", "(", "$", "this", "->", "pid", ",", "$", "kill", "?", "SIGKILL", ":", "SIGTERM", ")", ";", "}" ]
Terminates the process @param boolean Kill? @return void
[ "Terminates", "the", "process" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L268-L272
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.registerEventSignals
protected function registerEventSignals() { if (!EventLoop::$instance) { return; } foreach (self::$signals as $no => $name) { if ($name === 'SIGKILL' || $name == 'SIGSTOP') { continue; } $ev = EventLoop::$instance->signal($no, ...
php
protected function registerEventSignals() { if (!EventLoop::$instance) { return; } foreach (self::$signals as $no => $name) { if ($name === 'SIGKILL' || $name == 'SIGSTOP') { continue; } $ev = EventLoop::$instance->signal($no, ...
[ "protected", "function", "registerEventSignals", "(", ")", "{", "if", "(", "!", "EventLoop", "::", "$", "instance", ")", "{", "return", ";", "}", "foreach", "(", "self", "::", "$", "signals", "as", "$", "no", "=>", "$", "name", ")", "{", "if", "(", ...
Register signals. @return void
[ "Register", "signals", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L297-L314
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.unregisterSignals
protected function unregisterSignals() { foreach ($this->sigEvents as $no => $ev) { $ev->free(); unset($this->sigEvents[$no]); } }
php
protected function unregisterSignals() { foreach ($this->sigEvents as $no => $ev) { $ev->free(); unset($this->sigEvents[$no]); } }
[ "protected", "function", "unregisterSignals", "(", ")", "{", "foreach", "(", "$", "this", "->", "sigEvents", "as", "$", "no", "=>", "$", "ev", ")", "{", "$", "ev", "->", "free", "(", ")", ";", "unset", "(", "$", "this", "->", "sigEvents", "[", "$",...
Unregister signals. @return void
[ "Unregister", "signals", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L320-L326
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.waitPid
protected function waitPid() { start: $pid = \pcntl_waitpid(-1, $status, WNOHANG); if ($pid > 0) { foreach ($this->collections as $col) { foreach ($col->threads as $k => $t) { if ($t->pid === $pid) { $t->setTerminated();...
php
protected function waitPid() { start: $pid = \pcntl_waitpid(-1, $status, WNOHANG); if ($pid > 0) { foreach ($this->collections as $col) { foreach ($col->threads as $k => $t) { if ($t->pid === $pid) { $t->setTerminated();...
[ "protected", "function", "waitPid", "(", ")", "{", "start", ":", "$", "pid", "=", "\\", "pcntl_waitpid", "(", "-", "1", ",", "$", "status", ",", "WNOHANG", ")", ";", "if", "(", "$", "pid", ">", "0", ")", "{", "foreach", "(", "$", "this", "->", ...
Checks for SIGCHLD @return boolean Success
[ "Checks", "for", "SIGCHLD" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L351-L368
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.waitAll
protected function waitAll($check) { do { $n = 0; foreach ($this->collections as &$col) { $n += $col->removeTerminated($check); } if (!$this->waitPid()) { $this->sigwait(0, 20000); } } while ($n > 0); }
php
protected function waitAll($check) { do { $n = 0; foreach ($this->collections as &$col) { $n += $col->removeTerminated($check); } if (!$this->waitPid()) { $this->sigwait(0, 20000); } } while ($n > 0); }
[ "protected", "function", "waitAll", "(", "$", "check", ")", "{", "do", "{", "$", "n", "=", "0", ";", "foreach", "(", "$", "this", "->", "collections", "as", "&", "$", "col", ")", "{", "$", "n", "+=", "$", "col", "->", "removeTerminated", "(", "$"...
Waits until children is alive @param boolean $check @return void
[ "Waits", "until", "children", "is", "alive" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L411-L423
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.sigwait
protected function sigwait($sec = 0, $nano = 0.3e9) { $siginfo = null; if (!function_exists('pcntl_sigtimedwait')) { $signo = $this->sigtimedwait(array_keys(static::$signals), $siginfo, $sec, $nano); } else { $signo = @\pcntl_sigtimedwait(array_keys(static::$signals)...
php
protected function sigwait($sec = 0, $nano = 0.3e9) { $siginfo = null; if (!function_exists('pcntl_sigtimedwait')) { $signo = $this->sigtimedwait(array_keys(static::$signals), $siginfo, $sec, $nano); } else { $signo = @\pcntl_sigtimedwait(array_keys(static::$signals)...
[ "protected", "function", "sigwait", "(", "$", "sec", "=", "0", ",", "$", "nano", "=", "0.3e9", ")", "{", "$", "siginfo", "=", "null", ";", "if", "(", "!", "function_exists", "(", "'pcntl_sigtimedwait'", ")", ")", "{", "$", "signo", "=", "$", "this", ...
Waits for signals, with a timeout @param int Seconds @param int Nanoseconds @return boolean Success
[ "Waits", "for", "signals", "with", "a", "timeout" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L431-L452
kakserpom/phpdaemon
PHPDaemon/Thread/Generic.php
Generic.sigtimedwait
protected function sigtimedwait($signals, $siginfo, $sec, $nano) { \pcntl_signal_dispatch(); if (\time_nanosleep($sec, $nano) === true) { return false; } \pcntl_signal_dispatch(); return true; }
php
protected function sigtimedwait($signals, $siginfo, $sec, $nano) { \pcntl_signal_dispatch(); if (\time_nanosleep($sec, $nano) === true) { return false; } \pcntl_signal_dispatch(); return true; }
[ "protected", "function", "sigtimedwait", "(", "$", "signals", ",", "$", "siginfo", ",", "$", "sec", ",", "$", "nano", ")", "{", "\\", "pcntl_signal_dispatch", "(", ")", ";", "if", "(", "\\", "time_nanosleep", "(", "$", "sec", ",", "$", "nano", ")", "...
Implementation of pcntl_sigtimedwait for Mac. @param array Signal @param null|array SigInfo @param int Seconds @param int Nanoseconds @param integer $sec @param double $nano @return boolean Success
[ "Implementation", "of", "pcntl_sigtimedwait", "for", "Mac", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Generic.php#L465-L473
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.setPeername
public function setPeername($host, $port) { $this->host = $host; $this->port = $port; $this->addr = '[' . $this->host . ']:' . $this->port; if ($this->pool->allowedClients !== null) { if (!TCP::netMatch($this->pool->allowedClients, $this->host)) { Daemon::...
php
public function setPeername($host, $port) { $this->host = $host; $this->port = $port; $this->addr = '[' . $this->host . ']:' . $this->port; if ($this->pool->allowedClients !== null) { if (!TCP::netMatch($this->pool->allowedClients, $this->host)) { Daemon::...
[ "public", "function", "setPeername", "(", "$", "host", ",", "$", "port", ")", "{", "$", "this", "->", "host", "=", "$", "host", ";", "$", "this", "->", "port", "=", "$", "port", ";", "$", "this", "->", "addr", "=", "'['", ".", "$", "this", "->"...
Sets peer name @param string $host Hostname @param integer $port Port @return void
[ "Sets", "peer", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L179-L191
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.getSocketName
public function getSocketName(&$addr, &$port) { if (func_num_args() === 0) { \EventUtil::getSocketName($this->bev->fd, $this->locAddr, $this->locPort); return; } \EventUtil::getSocketName($this->bev->fd, $addr, $port); }
php
public function getSocketName(&$addr, &$port) { if (func_num_args() === 0) { \EventUtil::getSocketName($this->bev->fd, $this->locAddr, $this->locPort); return; } \EventUtil::getSocketName($this->bev->fd, $addr, $port); }
[ "public", "function", "getSocketName", "(", "&", "$", "addr", ",", "&", "$", "port", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "\\", "EventUtil", "::", "getSocketName", "(", "$", "this", "->", "bev", "->", "fd", ",", "$"...
Get socket name @param string &$addr Addr @param srting &$port Port @return void
[ "Get", "socket", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L216-L223
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.onReady
public function onReady() { $this->connected = true; if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } }
php
public function onReady() { $this->connected = true; if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } }
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "connected", "=", "true", ";", "if", "(", "$", "this", "->", "onConnected", ")", "{", "$", "this", "->", "onConnected", "->", "executeAll", "(", "$", "this", ")", ";", "$", "this", ...
Called when the connection is handshaked (at low-level), and peer is ready to recv. data @return void
[ "Called", "when", "the", "connection", "is", "handshaked", "(", "at", "low", "-", "level", ")", "and", "peer", "is", "ready", "to", "recv", ".", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L248-L255
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.onFailure
public function onFailure() { if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } }
php
public function onFailure() { if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } }
[ "public", "function", "onFailure", "(", ")", "{", "if", "(", "$", "this", "->", "onConnected", ")", "{", "$", "this", "->", "onConnected", "->", "executeAll", "(", "$", "this", ")", ";", "$", "this", "->", "onConnected", "=", "null", ";", "}", "}" ]
Called when the connection failed to be established @return void
[ "Called", "when", "the", "connection", "failed", "to", "be", "established" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L270-L276
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.onFailureEv
public function onFailureEv($bev = null) { try { if (!$this->connected && !$this->failed) { $this->failed = true; $this->onFailure(); } $this->connected = false; } catch (\Exception $e) { Daemon::uncaughtExceptionHandler...
php
public function onFailureEv($bev = null) { try { if (!$this->connected && !$this->failed) { $this->failed = true; $this->onFailure(); } $this->connected = false; } catch (\Exception $e) { Daemon::uncaughtExceptionHandler...
[ "public", "function", "onFailureEv", "(", "$", "bev", "=", "null", ")", "{", "try", "{", "if", "(", "!", "$", "this", "->", "connected", "&&", "!", "$", "this", "->", "failed", ")", "{", "$", "this", "->", "failed", "=", "true", ";", "$", "this",...
Called when the connection failed @param EventBufferEvent $bev @return void
[ "Called", "when", "the", "connection", "failed" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L283-L294
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.write
public function write($data) { if ($this->dgram) { return $this->parentSocket->sendTo($data, $this->finished ? MSG_EOF : 0, $this->host, $this->port); } return parent::write($data); }
php
public function write($data) { if ($this->dgram) { return $this->parentSocket->sendTo($data, $this->finished ? MSG_EOF : 0, $this->host, $this->port); } return parent::write($data); }
[ "public", "function", "write", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "dgram", ")", "{", "return", "$", "this", "->", "parentSocket", "->", "sendTo", "(", "$", "data", ",", "$", "this", "->", "finished", "?", "MSG_EOF", ":", "0",...
Send data to the connection. Note that it just writes to buffer that flushes at every baseloop @param string $data Data to send @return boolean Success
[ "Send", "data", "to", "the", "connection", ".", "Note", "that", "it", "just", "writes", "to", "buffer", "that", "flushes", "at", "every", "baseloop" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L312-L318
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.onConnected
public function onConnected($cb) { if ($this->connected) { $cb($this); } else { if (!$this->onConnected) { $this->onConnected = new StackCallbacks; } $this->onConnected->push($cb); } }
php
public function onConnected($cb) { if ($this->connected) { $cb($this); } else { if (!$this->onConnected) { $this->onConnected = new StackCallbacks; } $this->onConnected->push($cb); } }
[ "public", "function", "onConnected", "(", "$", "cb", ")", "{", "if", "(", "$", "this", "->", "connected", ")", "{", "$", "cb", "(", "$", "this", ")", ";", "}", "else", "{", "if", "(", "!", "$", "this", "->", "onConnected", ")", "{", "$", "this"...
Executes the given callback when/if the connection is handshaked @param callable $cb Callback @return void
[ "Executes", "the", "given", "callback", "when", "/", "if", "the", "connection", "is", "handshaked" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L325-L335
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.initSSLContext
protected function initSSLContext() { if (!\EventUtil::sslRandPoll()) { Daemon::$process->log(get_class($this->pool) . ': EventUtil::sslRandPoll failed'); return false; } $params = [ \EventSslContext::OPT_VERIFY_PEER => $this->verifypeer, \Even...
php
protected function initSSLContext() { if (!\EventUtil::sslRandPoll()) { Daemon::$process->log(get_class($this->pool) . ': EventUtil::sslRandPoll failed'); return false; } $params = [ \EventSslContext::OPT_VERIFY_PEER => $this->verifypeer, \Even...
[ "protected", "function", "initSSLContext", "(", ")", "{", "if", "(", "!", "\\", "EventUtil", "::", "sslRandPoll", "(", ")", ")", "{", "Daemon", "::", "$", "process", "->", "log", "(", "get_class", "(", "$", "this", "->", "pool", ")", ".", "': EventUtil...
Initialize SSL context @return object|false Context
[ "Initialize", "SSL", "context" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L376-L404
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.connect
public function connect($url, $cb = null) { $this->uri = Config\_Object::parseCfgUri($url); $u =& $this->uri; if (!$u) { return false; } $this->importParams(); if (!isset($u['port'])) { if ($this->ssl) { if (isset($this->pool->c...
php
public function connect($url, $cb = null) { $this->uri = Config\_Object::parseCfgUri($url); $u =& $this->uri; if (!$u) { return false; } $this->importParams(); if (!isset($u['port'])) { if ($this->ssl) { if (isset($this->pool->c...
[ "public", "function", "connect", "(", "$", "url", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "uri", "=", "Config", "\\", "_Object", "::", "parseCfgUri", "(", "$", "url", ")", ";", "$", "u", "=", "&", "$", "this", "->", "uri", ";"...
Connects to URL @param string $url URL @param callable $cb Callback @return boolean Success
[ "Connects", "to", "URL" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L439-L497
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.connectUnix
public function connectUnix($path) { $this->type = 'unix'; if (!$this->bevConnectEnabled) { $fd = socket_create(AF_UNIX, SOCK_STREAM, 0); if (!$fd) { return false; } socket_set_nonblock($fd); @socket_connect($fd, $path, 0);...
php
public function connectUnix($path) { $this->type = 'unix'; if (!$this->bevConnectEnabled) { $fd = socket_create(AF_UNIX, SOCK_STREAM, 0); if (!$fd) { return false; } socket_set_nonblock($fd); @socket_connect($fd, $path, 0);...
[ "public", "function", "connectUnix", "(", "$", "path", ")", "{", "$", "this", "->", "type", "=", "'unix'", ";", "if", "(", "!", "$", "this", "->", "bevConnectEnabled", ")", "{", "$", "fd", "=", "socket_create", "(", "AF_UNIX", ",", "SOCK_STREAM", ",", ...
Establish UNIX socket connection @param string $path Path @return boolean Success
[ "Establish", "UNIX", "socket", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L504-L522
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.connectRaw
public function connectRaw($host) { $this->type = 'raw'; if (@inet_pton($host) === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host) { if ($result === false) { Daemon::log(get_class($this)...
php
public function connectRaw($host) { $this->type = 'raw'; if (@inet_pton($host) === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host) { if ($result === false) { Daemon::log(get_class($this)...
[ "public", "function", "connectRaw", "(", "$", "host", ")", "{", "$", "this", "->", "type", "=", "'raw'", ";", "if", "(", "@", "inet_pton", "(", "$", "host", ")", "===", "false", ")", "{", "// dirty check", "\\", "PHPDaemon", "\\", "Clients", "\\", "D...
Establish raw socket connection @param string $host Hostname @return boolean Success
[ "Establish", "raw", "socket", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L529-L567
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.connectUdp
public function connectUdp($host, $port) { $this->type = 'udp'; $pton = @inet_pton($host); if ($pton === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host, $port) { if (!$result) { ...
php
public function connectUdp($host, $port) { $this->type = 'udp'; $pton = @inet_pton($host); if ($pton === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host, $port) { if (!$result) { ...
[ "public", "function", "connectUdp", "(", "$", "host", ",", "$", "port", ")", "{", "$", "this", "->", "type", "=", "'udp'", ";", "$", "pton", "=", "@", "inet_pton", "(", "$", "host", ")", ";", "if", "(", "$", "pton", "===", "false", ")", "{", "/...
Establish UDP connection @param string $host Hostname @param integer $port Port @return boolean Success
[ "Establish", "UDP", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L575-L624
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.connectTcp
public function connectTcp($host, $port) { $this->type = 'tcp'; $pton = @inet_pton($host); $fd = null; if ($pton === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($this->host, function ($result) use ($host, $port) { if (!$resu...
php
public function connectTcp($host, $port) { $this->type = 'tcp'; $pton = @inet_pton($host); $fd = null; if ($pton === false) { // dirty check \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($this->host, function ($result) use ($host, $port) { if (!$resu...
[ "public", "function", "connectTcp", "(", "$", "host", ",", "$", "port", ")", "{", "$", "this", "->", "type", "=", "'tcp'", ";", "$", "pton", "=", "@", "inet_pton", "(", "$", "host", ")", ";", "$", "fd", "=", "null", ";", "if", "(", "$", "pton",...
Establish TCP connection @param string $host Hostname @param integer $port Port @return boolean Success
[ "Establish", "TCP", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L632-L700
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.setKeepalive
public function setKeepalive($bool) { $this->keepalive = (bool)$bool; $this->setOption(\EventUtil::SOL_SOCKET, \EventUtil::SO_KEEPALIVE, $this->keepalive ? true : false); }
php
public function setKeepalive($bool) { $this->keepalive = (bool)$bool; $this->setOption(\EventUtil::SOL_SOCKET, \EventUtil::SO_KEEPALIVE, $this->keepalive ? true : false); }
[ "public", "function", "setKeepalive", "(", "$", "bool", ")", "{", "$", "this", "->", "keepalive", "=", "(", "bool", ")", "$", "bool", ";", "$", "this", "->", "setOption", "(", "\\", "EventUtil", "::", "SOL_SOCKET", ",", "\\", "EventUtil", "::", "SO_KEE...
Set keepalive @param boolean $bool @return void
[ "Set", "keepalive" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L707-L711
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.setTimeouts
public function setTimeouts($read, $write) { parent::setTimeouts($read, $write); if ($this->fd !== null) { $this->setOption( \EventUtil::SOL_SOCKET, \EventUtil::SO_SNDTIMEO, ['sec' => $this->timeoutWrite, 'usec' => 0] ); ...
php
public function setTimeouts($read, $write) { parent::setTimeouts($read, $write); if ($this->fd !== null) { $this->setOption( \EventUtil::SOL_SOCKET, \EventUtil::SO_SNDTIMEO, ['sec' => $this->timeoutWrite, 'usec' => 0] ); ...
[ "public", "function", "setTimeouts", "(", "$", "read", ",", "$", "write", ")", "{", "parent", "::", "setTimeouts", "(", "$", "read", ",", "$", "write", ")", ";", "if", "(", "$", "this", "->", "fd", "!==", "null", ")", "{", "$", "this", "->", "set...
Set timeouts @param integer $read Read timeout in seconds @param integer $write Write timeout in seconds @return void
[ "Set", "timeouts" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L731-L746
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.setOption
public function setOption($level, $optname, $val) { if (is_resource($this->fd)) { socket_set_option($this->fd, $level, $optname, $val); } else { \EventUtil::setSocketOption($this->fd, $level, $optname, $val); } }
php
public function setOption($level, $optname, $val) { if (is_resource($this->fd)) { socket_set_option($this->fd, $level, $optname, $val); } else { \EventUtil::setSocketOption($this->fd, $level, $optname, $val); } }
[ "public", "function", "setOption", "(", "$", "level", ",", "$", "optname", ",", "$", "val", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "fd", ")", ")", "{", "socket_set_option", "(", "$", "this", "->", "fd", ",", "$", "level", ",", ...
Set socket option @param integer $level Level @param integer $optname Option @param mixed $val Value @return void
[ "Set", "socket", "option" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L755-L762
kakserpom/phpdaemon
PHPDaemon/Network/Connection.php
Connection.onFinish
public function onFinish() { if (!$this->connected) { if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } } parent::onFinish(); }
php
public function onFinish() { if (!$this->connected) { if ($this->onConnected) { $this->onConnected->executeAll($this); $this->onConnected = null; } } parent::onFinish(); }
[ "public", "function", "onFinish", "(", ")", "{", "if", "(", "!", "$", "this", "->", "connected", ")", "{", "if", "(", "$", "this", "->", "onConnected", ")", "{", "$", "this", "->", "onConnected", "->", "executeAll", "(", "$", "this", ")", ";", "$",...
Called when connection finishes @return void
[ "Called", "when", "connection", "finishes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Connection.php#L768-L777
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWithPostgreSQL.php
ExampleWithPostgreSQLRequest.init
public function init() { $this->appInstance->pgsql->getConnection(function ($sql) { if (!$sql->connected) { // failed to connect $this->wakeup(); // wake up the request immediately $sql->release(); return; } $sql->query('SEL...
php
public function init() { $this->appInstance->pgsql->getConnection(function ($sql) { if (!$sql->connected) { // failed to connect $this->wakeup(); // wake up the request immediately $sql->release(); return; } $sql->query('SEL...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "appInstance", "->", "pgsql", "->", "getConnection", "(", "function", "(", "$", "sql", ")", "{", "if", "(", "!", "$", "sql", "->", "connected", ")", "{", "// failed to connect", "$", "this...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWithPostgreSQL.php#L50-L65
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWithPostgreSQL.php
ExampleWithPostgreSQLRequest.run
public function run() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http:/...
php
public function run() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http:/...
[ "public", "function", "run", "(", ")", "{", "try", "{", "$", "this", "->", "header", "(", "'Content-Type: text/html'", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "}", "?>\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional/...
Called when request iterated. @return integer Status.
[ "Called", "when", "request", "iterated", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWithPostgreSQL.php#L71-L103
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.renameSection
public function renameSection($old, $new, $log = false) { Daemon::$config->{$new} = Daemon::$config->{$old}; unset(Daemon::$config->{$old}); if ($log) { Daemon::log('Config section \'' . $old . '\' -> \'' . $new . '\''); } }
php
public function renameSection($old, $new, $log = false) { Daemon::$config->{$new} = Daemon::$config->{$old}; unset(Daemon::$config->{$old}); if ($log) { Daemon::log('Config section \'' . $old . '\' -> \'' . $new . '\''); } }
[ "public", "function", "renameSection", "(", "$", "old", ",", "$", "new", ",", "$", "log", "=", "false", ")", "{", "Daemon", "::", "$", "config", "->", "{", "$", "new", "}", "=", "Daemon", "::", "$", "config", "->", "{", "$", "old", "}", ";", "u...
Renames section @param string $old @param string $new @param boolean $log Log? @return void
[ "Renames", "section" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L358-L365
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.loadFile
public function loadFile($path) { $parser = Parser::parse($path, $this); $this->onLoad(); return !$parser->isErroneous(); }
php
public function loadFile($path) { $parser = Parser::parse($path, $this); $this->onLoad(); return !$parser->isErroneous(); }
[ "public", "function", "loadFile", "(", "$", "path", ")", "{", "$", "parser", "=", "Parser", "::", "parse", "(", "$", "path", ",", "$", "this", ")", ";", "$", "this", "->", "onLoad", "(", ")", ";", "return", "!", "$", "parser", "->", "isErroneous", ...
Load config file @param string Path @return boolean Success
[ "Load", "config", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L372-L377
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.onLoad
protected function onLoad() { if (isset($this->minspareworkers->value) && $this->minspareworkers->value > 0 && isset($this->maxspareworkers->value) && $this->maxspareworkers->value > 0 ) { if ($this->minspareworkers->value > $this->maxspareworkers->value) { Da...
php
protected function onLoad() { if (isset($this->minspareworkers->value) && $this->minspareworkers->value > 0 && isset($this->maxspareworkers->value) && $this->maxspareworkers->value > 0 ) { if ($this->minspareworkers->value > $this->maxspareworkers->value) { Da...
[ "protected", "function", "onLoad", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "minspareworkers", "->", "value", ")", "&&", "$", "this", "->", "minspareworkers", "->", "value", ">", "0", "&&", "isset", "(", "$", "this", "->", "maxsparewo...
Called when config is loaded @return void
[ "Called", "when", "config", "is", "loaded" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L383-L399
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.offsetGet
public function offsetGet($prop) { $prop = $this->getRealPropertyName($prop); return isset($this->{$prop}) ? $this->{$prop}->value : null; }
php
public function offsetGet($prop) { $prop = $this->getRealPropertyName($prop); return isset($this->{$prop}) ? $this->{$prop}->value : null; }
[ "public", "function", "offsetGet", "(", "$", "prop", ")", "{", "$", "prop", "=", "$", "this", "->", "getRealPropertyName", "(", "$", "prop", ")", ";", "return", "isset", "(", "$", "this", "->", "{", "$", "prop", "}", ")", "?", "$", "this", "->", ...
Get property by name @param string Property name @return mixed
[ "Get", "property", "by", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L428-L432
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.offsetSet
public function offsetSet($prop, $value) { $prop = $this->getRealPropertyName($prop); $this->{$prop} = $value; }
php
public function offsetSet($prop, $value) { $prop = $this->getRealPropertyName($prop); $this->{$prop} = $value; }
[ "public", "function", "offsetSet", "(", "$", "prop", ",", "$", "value", ")", "{", "$", "prop", "=", "$", "this", "->", "getRealPropertyName", "(", "$", "prop", ")", ";", "$", "this", "->", "{", "$", "prop", "}", "=", "$", "value", ";", "}" ]
Set property @param string Property name @param mixed Value @return void
[ "Set", "property" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L440-L444
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.parseCfgUri
public static function parseCfgUri($uri, $source = null) { if (mb_orig_strpos($uri, '://') === false) { if (strncmp($uri, 'unix:', 5) === 0) { $e = explode(':', $uri); if (sizeof($e) === 4) { $uri = 'unix://' . $e[1] . ':' . $e[2] . '@localhost...
php
public static function parseCfgUri($uri, $source = null) { if (mb_orig_strpos($uri, '://') === false) { if (strncmp($uri, 'unix:', 5) === 0) { $e = explode(':', $uri); if (sizeof($e) === 4) { $uri = 'unix://' . $e[1] . ':' . $e[2] . '@localhost...
[ "public", "static", "function", "parseCfgUri", "(", "$", "uri", ",", "$", "source", "=", "null", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "uri", ",", "'://'", ")", "===", "false", ")", "{", "if", "(", "strncmp", "(", "$", "uri", ",", "'unix...
Checks if property exists @param string Property name @return boolean Exists?
[ "Checks", "if", "property", "exists" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L462-L523
kakserpom/phpdaemon
PHPDaemon/Config/_Object.php
_Object.loadCmdLineArgs
public static function loadCmdLineArgs($settings) { $error = false; static $ktr = [ '-' => '', ]; foreach ($settings as $k => $v) { $k = strtolower(strtr($k, $ktr)); if ($k === 'config') { $k = 'configfile'; } ...
php
public static function loadCmdLineArgs($settings) { $error = false; static $ktr = [ '-' => '', ]; foreach ($settings as $k => $v) { $k = strtolower(strtr($k, $ktr)); if ($k === 'config') { $k = 'configfile'; } ...
[ "public", "static", "function", "loadCmdLineArgs", "(", "$", "settings", ")", "{", "$", "error", "=", "false", ";", "static", "$", "ktr", "=", "[", "'-'", "=>", "''", ",", "]", ";", "foreach", "(", "$", "settings", "as", "$", "k", "=>", "$", "v", ...
Imports parameters from command line args @param array Settings. @return boolean - Success.
[ "Imports", "parameters", "from", "command", "line", "args" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/_Object.php#L530-L560
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Pool.php
Pool.prepareEnv
public static function prepareEnv($data) { $result = []; $rows = explode("\n", $data); for ($i = 0, $s = sizeof($rows); $i < $s; ++$i) { $e = self::extract($rows[$i]); $result[$e[0]] = $e[1]; } return $result; }
php
public static function prepareEnv($data) { $result = []; $rows = explode("\n", $data); for ($i = 0, $s = sizeof($rows); $i < $s; ++$i) { $e = self::extract($rows[$i]); $result[$e[0]] = $e[1]; } return $result; }
[ "public", "static", "function", "prepareEnv", "(", "$", "data", ")", "{", "$", "result", "=", "[", "]", ";", "$", "rows", "=", "explode", "(", "\"\\n\"", ",", "$", "data", ")", ";", "for", "(", "$", "i", "=", "0", ",", "$", "s", "=", "sizeof", ...
Prepares environment scope @param string $data Address @return array
[ "Prepares", "environment", "scope" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Pool.php#L27-L36
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Pool.php
Pool.extract
public static function extract($line) { $e = explode(': ', $line, 2); $header = strtolower(trim($e[0])); $value = isset($e[1]) ? trim($e[1]) : null; $safe = false; foreach (self::$safeCaseValues as $item) { if (strncasecmp($header, $item, mb_orig_strlen($item)) =...
php
public static function extract($line) { $e = explode(': ', $line, 2); $header = strtolower(trim($e[0])); $value = isset($e[1]) ? trim($e[1]) : null; $safe = false; foreach (self::$safeCaseValues as $item) { if (strncasecmp($header, $item, mb_orig_strlen($item)) =...
[ "public", "static", "function", "extract", "(", "$", "line", ")", "{", "$", "e", "=", "explode", "(", "': '", ",", "$", "line", ",", "2", ")", ";", "$", "header", "=", "strtolower", "(", "trim", "(", "$", "e", "[", "0", "]", ")", ")", ";", "$...
Extract key and value pair from line. @param string $line @return array
[ "Extract", "key", "and", "value", "pair", "from", "line", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Pool.php#L43-L66
kakserpom/phpdaemon
PHPDaemon/Servers/FlashPolicy/Pool.php
Pool.onConfigUpdated
public function onConfigUpdated() { parent::onConfigUpdated(); if (Daemon::$process instanceof \PHPDaemon\Thread\Worker) { $pool = $this; FileSystem::readfile($this->config->file->value, function ($file, $data) use ($pool) { $pool->policyData = $data; ...
php
public function onConfigUpdated() { parent::onConfigUpdated(); if (Daemon::$process instanceof \PHPDaemon\Thread\Worker) { $pool = $this; FileSystem::readfile($this->config->file->value, function ($file, $data) use ($pool) { $pool->policyData = $data; ...
[ "public", "function", "onConfigUpdated", "(", ")", "{", "parent", "::", "onConfigUpdated", "(", ")", ";", "if", "(", "Daemon", "::", "$", "process", "instanceof", "\\", "PHPDaemon", "\\", "Thread", "\\", "Worker", ")", "{", "$", "pool", "=", "$", "this",...
Called when worker is going to update configuration @return void
[ "Called", "when", "worker", "is", "going", "to", "update", "configuration" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/FlashPolicy/Pool.php#L48-L58
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.labels
public static function labels($q) { $e = explode('.', $q); $r = ''; for ($i = 0, $s = sizeof($e); $i < $s; ++$i) { $r .= chr(mb_orig_strlen($e[$i])) . $e[$i]; } if (mb_orig_substr($r, -1) !== "\x00") { $r .= "\x00"; } return $r; }
php
public static function labels($q) { $e = explode('.', $q); $r = ''; for ($i = 0, $s = sizeof($e); $i < $s; ++$i) { $r .= chr(mb_orig_strlen($e[$i])) . $e[$i]; } if (mb_orig_substr($r, -1) !== "\x00") { $r .= "\x00"; } return $r; }
[ "public", "static", "function", "labels", "(", "$", "q", ")", "{", "$", "e", "=", "explode", "(", "'.'", ",", "$", "q", ")", ";", "$", "r", "=", "''", ";", "for", "(", "$", "i", "=", "0", ",", "$", "s", "=", "sizeof", "(", "$", "e", ")", ...
Build structure of labels @param string $q Dot-separated labels list @return string
[ "Build", "structure", "of", "labels" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L22-L33
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.parseLabels
public static function parseLabels(&$data, $orig = null) { $str = ''; while (mb_orig_strlen($data) > 0) { $l = ord($data[0]); if ($l >= 192) { $pos = Binary::bytes2int(chr($l - 192) . mb_orig_substr($data, 1, 1)); $data = mb_orig_substr($data,...
php
public static function parseLabels(&$data, $orig = null) { $str = ''; while (mb_orig_strlen($data) > 0) { $l = ord($data[0]); if ($l >= 192) { $pos = Binary::bytes2int(chr($l - 192) . mb_orig_substr($data, 1, 1)); $data = mb_orig_substr($data,...
[ "public", "static", "function", "parseLabels", "(", "&", "$", "data", ",", "$", "orig", "=", "null", ")", "{", "$", "str", "=", "''", ";", "while", "(", "mb_orig_strlen", "(", "$", "data", ")", ">", "0", ")", "{", "$", "l", "=", "ord", "(", "$"...
Parse structure of labels @param string &$data Binary data @param string $orig Original packet @return string Dot-separated labels list
[ "Parse", "structure", "of", "labels" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L41-L62
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.bytes2int
public static function bytes2int($str, $l = false) { if ($l) { $str = strrev($str); } $dec = 0; $len = mb_orig_strlen($str); for ($i = 0; $i < $len; ++$i) { $dec += ord(mb_orig_substr($str, $i, 1)) * pow(0x100, $len - $i - 1); } return ...
php
public static function bytes2int($str, $l = false) { if ($l) { $str = strrev($str); } $dec = 0; $len = mb_orig_strlen($str); for ($i = 0; $i < $len; ++$i) { $dec += ord(mb_orig_substr($str, $i, 1)) * pow(0x100, $len - $i - 1); } return ...
[ "public", "static", "function", "bytes2int", "(", "$", "str", ",", "$", "l", "=", "false", ")", "{", "if", "(", "$", "l", ")", "{", "$", "str", "=", "strrev", "(", "$", "str", ")", ";", "}", "$", "dec", "=", "0", ";", "$", "len", "=", "mb_o...
Convert bytes into integer @param string $str Bytes @param boolean $l Little endian? Default is false @return integer
[ "Convert", "bytes", "into", "integer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L70-L81
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getByte
public static function getByte(&$p) { $r = static::bytes2int($p{0}); $p = mb_orig_substr($p, 1); return (int)$r; }
php
public static function getByte(&$p) { $r = static::bytes2int($p{0}); $p = mb_orig_substr($p, 1); return (int)$r; }
[ "public", "static", "function", "getByte", "(", "&", "$", "p", ")", "{", "$", "r", "=", "static", "::", "bytes2int", "(", "$", "p", "{", "0", "}", ")", ";", "$", "p", "=", "mb_orig_substr", "(", "$", "p", ",", "1", ")", ";", "return", "(", "i...
Parse byte, and remove it @param string &$p Data @return integer
[ "Parse", "byte", "and", "remove", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L226-L231
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getWord
public static function getWord(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 2), !!$l); $p = mb_orig_substr($p, 2); return (int)$r; }
php
public static function getWord(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 2), !!$l); $p = mb_orig_substr($p, 2); return (int)$r; }
[ "public", "static", "function", "getWord", "(", "&", "$", "p", ",", "$", "l", "=", "false", ")", "{", "$", "r", "=", "static", "::", "bytes2int", "(", "mb_orig_substr", "(", "$", "p", ",", "0", ",", "2", ")", ",", "!", "!", "$", "l", ")", ";"...
Parse word (2 bytes) @param string &$p Data @param boolean $l Little endian? @return integer
[ "Parse", "word", "(", "2", "bytes", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L251-L256
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getStrWord
public static function getStrWord(&$p, $l = false) { $r = mb_orig_substr($p, 0, 2); $p = mb_orig_substr($p, 2); if ($l) { $r = strrev($r); } return $r; }
php
public static function getStrWord(&$p, $l = false) { $r = mb_orig_substr($p, 0, 2); $p = mb_orig_substr($p, 2); if ($l) { $r = strrev($r); } return $r; }
[ "public", "static", "function", "getStrWord", "(", "&", "$", "p", ",", "$", "l", "=", "false", ")", "{", "$", "r", "=", "mb_orig_substr", "(", "$", "p", ",", "0", ",", "2", ")", ";", "$", "p", "=", "mb_orig_substr", "(", "$", "p", ",", "2", "...
Get word (2 bytes) @param string &$p Data @param boolean $l Little endian? @return string
[ "Get", "word", "(", "2", "bytes", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L264-L272
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getDWord
public static function getDWord(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 4), !!$l); $p = mb_orig_substr($p, 4); return (int)$r; }
php
public static function getDWord(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 4), !!$l); $p = mb_orig_substr($p, 4); return (int)$r; }
[ "public", "static", "function", "getDWord", "(", "&", "$", "p", ",", "$", "l", "=", "false", ")", "{", "$", "r", "=", "static", "::", "bytes2int", "(", "mb_orig_substr", "(", "$", "p", ",", "0", ",", "4", ")", ",", "!", "!", "$", "l", ")", ";...
Get double word (4 bytes) @param string &$p Data @param boolean $l Little endian? @return integer
[ "Get", "double", "word", "(", "4", "bytes", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L280-L285
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getQword
public static function getQword(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 8), !!$l); $p = mb_orig_substr($p, 8); return (int)$r; }
php
public static function getQword(&$p, $l = false) { $r = static::bytes2int(mb_orig_substr($p, 0, 8), !!$l); $p = mb_orig_substr($p, 8); return (int)$r; }
[ "public", "static", "function", "getQword", "(", "&", "$", "p", ",", "$", "l", "=", "false", ")", "{", "$", "r", "=", "static", "::", "bytes2int", "(", "mb_orig_substr", "(", "$", "p", ",", "0", ",", "8", ")", ",", "!", "!", "$", "l", ")", ";...
Parse quadro word (8 bytes) @param string &$p Data @param boolean $l Little endian? @return integer
[ "Parse", "quadro", "word", "(", "8", "bytes", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L293-L298
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getStrQWord
public static function getStrQWord(&$p, $l = false) { $r = mb_orig_substr($p, 0, 8); if ($l) { $r = strrev($r); } $p = mb_orig_substr($p, 8); return $r; }
php
public static function getStrQWord(&$p, $l = false) { $r = mb_orig_substr($p, 0, 8); if ($l) { $r = strrev($r); } $p = mb_orig_substr($p, 8); return $r; }
[ "public", "static", "function", "getStrQWord", "(", "&", "$", "p", ",", "$", "l", "=", "false", ")", "{", "$", "r", "=", "mb_orig_substr", "(", "$", "p", ",", "0", ",", "8", ")", ";", "if", "(", "$", "l", ")", "{", "$", "r", "=", "strrev", ...
Get quadro word (8 bytes) @param string &$p Data @param boolean $l Little endian? @return string
[ "Get", "quadro", "word", "(", "8", "bytes", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L306-L314
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getString
public static function getString(&$str) { $p = mb_orig_strpos($str, "\x00"); if ($p === false) { return ''; } $r = mb_orig_substr($str, 0, $p); $str = mb_orig_substr($str, $p + 1); return $r; }
php
public static function getString(&$str) { $p = mb_orig_strpos($str, "\x00"); if ($p === false) { return ''; } $r = mb_orig_substr($str, 0, $p); $str = mb_orig_substr($str, $p + 1); return $r; }
[ "public", "static", "function", "getString", "(", "&", "$", "str", ")", "{", "$", "p", "=", "mb_orig_strpos", "(", "$", "str", ",", "\"\\x00\"", ")", ";", "if", "(", "$", "p", "===", "false", ")", "{", "return", "''", ";", "}", "$", "r", "=", "...
Parse nul-terminated string @param string &$str Data @return string
[ "Parse", "nul", "-", "terminated", "string" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L321-L330
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.getLV
public static function getLV(&$p, $l = 1, $nul = false, $lrev = false) { $s = static::b2i(mb_orig_substr($p, 0, $l), !!$lrev); $p = mb_orig_substr($p, $l); if ($s === 0) { return ''; } $r = ''; if (mb_orig_strlen($p) < $s) { Daemon::log('getLV ...
php
public static function getLV(&$p, $l = 1, $nul = false, $lrev = false) { $s = static::b2i(mb_orig_substr($p, 0, $l), !!$lrev); $p = mb_orig_substr($p, $l); if ($s === 0) { return ''; } $r = ''; if (mb_orig_strlen($p) < $s) { Daemon::log('getLV ...
[ "public", "static", "function", "getLV", "(", "&", "$", "p", ",", "$", "l", "=", "1", ",", "$", "nul", "=", "false", ",", "$", "lrev", "=", "false", ")", "{", "$", "s", "=", "static", "::", "b2i", "(", "mb_orig_substr", "(", "$", "p", ",", "0...
Parse length-value structure @param string &$p Data @param integer $l Number of length bytes @param boolean $nul Nul-terminated? Default is false @param boolean $lrev Length is little endian? @return string
[ "Parse", "length", "-", "value", "structure" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L340-L368
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.flags2bitarray
public static function flags2bitarray($flags, $len = 4) { $ret = 0; foreach ($flags as $v) { $ret |= $v; } return static::i2b($len, $ret); }
php
public static function flags2bitarray($flags, $len = 4) { $ret = 0; foreach ($flags as $v) { $ret |= $v; } return static::i2b($len, $ret); }
[ "public", "static", "function", "flags2bitarray", "(", "$", "flags", ",", "$", "len", "=", "4", ")", "{", "$", "ret", "=", "0", ";", "foreach", "(", "$", "flags", "as", "$", "v", ")", "{", "$", "ret", "|=", "$", "v", ";", "}", "return", "static...
Convert array of flags into bit array @param array $flags Flags @param integer $len Length. Default is 4 @return string
[ "Convert", "array", "of", "flags", "into", "bit", "array" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L388-L395
kakserpom/phpdaemon
PHPDaemon/Utils/Binary.php
Binary.bitmap2bytes
public static function bitmap2bytes($bitmap, $check_len = 0) { $r = ''; $bitmap = str_pad($bitmap, ceil(mb_orig_strlen($bitmap) / 8) * 8, '0', STR_PAD_LEFT); for ($i = 0, $n = mb_orig_strlen($bitmap) / 8; $i < $n; ++$i) { $r .= chr((int)bindec(mb_orig_substr($bitmap, $i * 8, 8)))...
php
public static function bitmap2bytes($bitmap, $check_len = 0) { $r = ''; $bitmap = str_pad($bitmap, ceil(mb_orig_strlen($bitmap) / 8) * 8, '0', STR_PAD_LEFT); for ($i = 0, $n = mb_orig_strlen($bitmap) / 8; $i < $n; ++$i) { $r .= chr((int)bindec(mb_orig_substr($bitmap, $i * 8, 8)))...
[ "public", "static", "function", "bitmap2bytes", "(", "$", "bitmap", ",", "$", "check_len", "=", "0", ")", "{", "$", "r", "=", "''", ";", "$", "bitmap", "=", "str_pad", "(", "$", "bitmap", ",", "ceil", "(", "mb_orig_strlen", "(", "$", "bitmap", ")", ...
Convert bitmap into bytes @param string $bitmap Bitmap @param integer $check_len Check length? @return string|false
[ "Convert", "bitmap", "into", "bytes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Binary.php#L403-L414
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionStartOkFrame.php
ConnectionStartOkFrame.create
public static function create( $clientProperties = null, $mechanism = null, $response = null, $locale = null ) { $frame = new self(); if (null !== $clientProperties) { $frame->clientProperties = $clientProperties; } if (null !== $mechanism) { $fra...
php
public static function create( $clientProperties = null, $mechanism = null, $response = null, $locale = null ) { $frame = new self(); if (null !== $clientProperties) { $frame->clientProperties = $clientProperties; } if (null !== $mechanism) { $fra...
[ "public", "static", "function", "create", "(", "$", "clientProperties", "=", "null", ",", "$", "mechanism", "=", "null", ",", "$", "response", "=", "null", ",", "$", "locale", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", ...
shortstr
[ "shortstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionStartOkFrame.php#L23-L43
kakserpom/phpdaemon
PHPDaemon/Core/ClassFinder.php
ClassFinder.find
public static function find($class, $namespace = null, $rootns = null) { $e = explode('\\', $class); if ($e[0] === '') { return $class; } if ('Pool' === $class || 'TransportContext' === $class) { return '\\PHPDaemon\\Core\\' . $class; } if (str...
php
public static function find($class, $namespace = null, $rootns = null) { $e = explode('\\', $class); if ($e[0] === '') { return $class; } if ('Pool' === $class || 'TransportContext' === $class) { return '\\PHPDaemon\\Core\\' . $class; } if (str...
[ "public", "static", "function", "find", "(", "$", "class", ",", "$", "namespace", "=", "null", ",", "$", "rootns", "=", "null", ")", "{", "$", "e", "=", "explode", "(", "'\\\\'", ",", "$", "class", ")", ";", "if", "(", "$", "e", "[", "0", "]", ...
Find class @param string $class Class @param string $namespace Namespace @param string $rootns Root namespace @return string
[ "Find", "class" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/ClassFinder.php#L43-L82
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Examples/Scan.php
Scan.onReady
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $params = []; foreach (range(0, 100) as $i) { $params[] = 'myset' . $i; $params[] = 'value' . $i; } $params[] = function ($redis) { $params = [ ...
php
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance(); $params = []; foreach (range(0, 100) as $i) { $params[] = 'myset' . $i; $params[] = 'value' . $i; } $params[] = function ($redis) { $params = [ ...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "redis", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "::", "getInstance", "(", ")", ";", "$", "params", "=", "[", "]", ";", "foreach", "(", "range", "(", "...
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/Scan.php#L24-L51
kakserpom/phpdaemon
PHPDaemon/Examples/MongoNode.php
MongoNode.init
public function init() { $this->db = \PHPDaemon\Clients\Mongo\Pool::getInstance($this->config->mongoclientname->value); $this->cache = \PHPDaemon\Clients\Memcache\Pool::getInstance($this->config->memcacheclientname->value); if (!isset($this->config->limitinstances)) { $this->log(...
php
public function init() { $this->db = \PHPDaemon\Clients\Mongo\Pool::getInstance($this->config->mongoclientname->value); $this->cache = \PHPDaemon\Clients\Memcache\Pool::getInstance($this->config->memcacheclientname->value); if (!isset($this->config->limitinstances)) { $this->log(...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "db", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Mongo", "\\", "Pool", "::", "getInstance", "(", "$", "this", "->", "config", "->", "mongoclientname", "->", "value", ")", ";", "$", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/MongoNode.php#L24-L31
kakserpom/phpdaemon
PHPDaemon/Examples/MongoNode.php
MongoNode.onReady
public function onReady() { if ($this->config->enable->value) { $this->timer = setTimeout(function ($timer) { $this->touchCursor(); }, 0.3e6); } }
php
public function onReady() { if ($this->config->enable->value) { $this->timer = setTimeout(function ($timer) { $this->touchCursor(); }, 0.3e6); } }
[ "public", "function", "onReady", "(", ")", "{", "if", "(", "$", "this", "->", "config", "->", "enable", "->", "value", ")", "{", "$", "this", "->", "timer", "=", "setTimeout", "(", "function", "(", "$", "timer", ")", "{", "$", "this", "->", "touchC...
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/Examples/MongoNode.php#L37-L44
kakserpom/phpdaemon
PHPDaemon/Examples/MongoNode.php
MongoNode.initSlave
public function initSlave($point) { $this->db->{'local.oplog.$main'}->find( /** * @param \MongoTimestamp $cursor */ function ($cursor) { $this->cursor = $cursor; $cursor->state = 1; $cursor->lastOpId = null; ...
php
public function initSlave($point) { $this->db->{'local.oplog.$main'}->find( /** * @param \MongoTimestamp $cursor */ function ($cursor) { $this->cursor = $cursor; $cursor->state = 1; $cursor->lastOpId = null; ...
[ "public", "function", "initSlave", "(", "$", "point", ")", "{", "$", "this", "->", "db", "->", "{", "'local.oplog.$main'", "}", "->", "find", "(", "/**\n * @param \\MongoTimestamp $cursor\n */", "function", "(", "$", "cursor", ")", "{", "$", "thi...
Initializes slave session. @param object Object. @param \MongoTimestamp $point @return void
[ "Initializes", "slave", "session", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/MongoNode.php#L91-L152
kakserpom/phpdaemon
PHPDaemon/Examples/MongoNode.php
MongoNode.cacheObject
public function cacheObject($o) { if (\PHPDaemon\Core\Daemon::$config->logevents->value) { \PHPDaemon\Core\Daemon::log(__METHOD__ . '(' . json_encode($o) . ')'); } if (isset($o['_key'])) { $this->cache->set($o['_key'], bson_encode($o)); $this->cache->set(...
php
public function cacheObject($o) { if (\PHPDaemon\Core\Daemon::$config->logevents->value) { \PHPDaemon\Core\Daemon::log(__METHOD__ . '(' . json_encode($o) . ')'); } if (isset($o['_key'])) { $this->cache->set($o['_key'], bson_encode($o)); $this->cache->set(...
[ "public", "function", "cacheObject", "(", "$", "o", ")", "{", "if", "(", "\\", "PHPDaemon", "\\", "Core", "\\", "Daemon", "::", "$", "config", "->", "logevents", "->", "value", ")", "{", "\\", "PHPDaemon", "\\", "Core", "\\", "Daemon", "::", "log", "...
Method called when object received. @param object Object. @return void
[ "Method", "called", "when", "object", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/MongoNode.php#L159-L177
kakserpom/phpdaemon
PHPDaemon/Examples/MongoNode.php
MongoNode.deleteObject
public function deleteObject($o) { if (\PHPDaemon\Core\Daemon::$config->logevents->value) { \PHPDaemon\Core\Daemon::log(__METHOD__ . '(' . json_encode($o) . ')'); } $this->cache->get('_id.' . ((string)$o['_id']), function ($mc) use ($o) { if (is_strin...
php
public function deleteObject($o) { if (\PHPDaemon\Core\Daemon::$config->logevents->value) { \PHPDaemon\Core\Daemon::log(__METHOD__ . '(' . json_encode($o) . ')'); } $this->cache->get('_id.' . ((string)$o['_id']), function ($mc) use ($o) { if (is_strin...
[ "public", "function", "deleteObject", "(", "$", "o", ")", "{", "if", "(", "\\", "PHPDaemon", "\\", "Core", "\\", "Daemon", "::", "$", "config", "->", "logevents", "->", "value", ")", "{", "\\", "PHPDaemon", "\\", "Core", "\\", "Daemon", "::", "log", ...
Method called when object deleted. @param object Object. @return void
[ "Method", "called", "when", "object", "deleted", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/MongoNode.php#L184-L198
kakserpom/phpdaemon
PHPDaemon/Servers/FlashPolicy/Connection.php
Connection.onRead
public function onRead() { if (false === ($pct = $this->readExact($this->lowMark))) { return; // not readed yet } if ($pct === "<policy-file-request/>\x00") { if ($this->pool->policyData) { $this->write($p = $this->pool->policyData . "\x00"); ...
php
public function onRead() { if (false === ($pct = $this->readExact($this->lowMark))) { return; // not readed yet } if ($pct === "<policy-file-request/>\x00") { if ($this->pool->policyData) { $this->write($p = $this->pool->policyData . "\x00"); ...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "false", "===", "(", "$", "pct", "=", "$", "this", "->", "readExact", "(", "$", "this", "->", "lowMark", ")", ")", ")", "{", "return", ";", "// not readed yet", "}", "if", "(", "$", "pct", ...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/FlashPolicy/Connection.php#L25-L38
kakserpom/phpdaemon
PHPDaemon/Thread/Collection.php
Collection.push
public function push(Generic $thread) { $id = ++$this->spawnCounter; $thread->setId($id); $this->threads[$id] = $thread; }
php
public function push(Generic $thread) { $id = ++$this->spawnCounter; $thread->setId($id); $this->threads[$id] = $thread; }
[ "public", "function", "push", "(", "Generic", "$", "thread", ")", "{", "$", "id", "=", "++", "$", "this", "->", "spawnCounter", ";", "$", "thread", "->", "setId", "(", "$", "id", ")", ";", "$", "this", "->", "threads", "[", "$", "id", "]", "=", ...
Pushes certain thread to the collection @param Generic Generic to push @return void
[ "Pushes", "certain", "thread", "to", "the", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Collection.php#L33-L38
kakserpom/phpdaemon
PHPDaemon/Thread/Collection.php
Collection.stop
public function stop($kill = false) { foreach ($this->threads as $thread) { $thread->stop($kill); } }
php
public function stop($kill = false) { foreach ($this->threads as $thread) { $thread->stop($kill); } }
[ "public", "function", "stop", "(", "$", "kill", "=", "false", ")", "{", "foreach", "(", "$", "this", "->", "threads", "as", "$", "thread", ")", "{", "$", "thread", "->", "stop", "(", "$", "kill", ")", ";", "}", "}" ]
Stop all collected threads @param boolean Kill? @return void
[ "Stop", "all", "collected", "threads" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Collection.php#L56-L61
kakserpom/phpdaemon
PHPDaemon/Thread/Collection.php
Collection.removeTerminated
public function removeTerminated() { // @TODO: remove $n = 0; foreach ($this->threads as $id => $thread) { if (!$thread->getPid() || !$thread->ifExists()) { $thread->setTerminated(); unset($this->threads[$id]); continue; ...
php
public function removeTerminated() { // @TODO: remove $n = 0; foreach ($this->threads as $id => $thread) { if (!$thread->getPid() || !$thread->ifExists()) { $thread->setTerminated(); unset($this->threads[$id]); continue; ...
[ "public", "function", "removeTerminated", "(", ")", "{", "// @TODO: remove", "$", "n", "=", "0", ";", "foreach", "(", "$", "this", "->", "threads", "as", "$", "id", "=>", "$", "thread", ")", "{", "if", "(", "!", "$", "thread", "->", "getPid", "(", ...
Remove terminated threads from the collection @return integer Rest threads count
[ "Remove", "terminated", "threads", "from", "the", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Collection.php#L76-L89
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.init
public static function init() { if (!Daemon::$config->eioenabled->value) { self::$supported = false; return; } if (!self::$supported = Daemon::loadModuleIfAbsent('eio', self::$eioVer)) { Daemon::log('FS: missing pecl-eio >= ' . self::$eioVer . '. Filesyste...
php
public static function init() { if (!Daemon::$config->eioenabled->value) { self::$supported = false; return; } if (!self::$supported = Daemon::loadModuleIfAbsent('eio', self::$eioVer)) { Daemon::log('FS: missing pecl-eio >= ' . self::$eioVer . '. Filesyste...
[ "public", "static", "function", "init", "(", ")", "{", "if", "(", "!", "Daemon", "::", "$", "config", "->", "eioenabled", "->", "value", ")", "{", "self", "::", "$", "supported", "=", "false", ";", "return", ";", "}", "if", "(", "!", "self", "::", ...
Initialize FS driver @return void
[ "Initialize", "FS", "driver" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L73-L85
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.initEvent
public static function initEvent() { if (!self::$supported) { return; } self::updateConfig(); self::$fd = eio_get_event_stream(); self::$ev = EventLoop::$instance->event(self::$fd, \Event::READ | \Event::PERSIST, function ($fd, $events, $ar...
php
public static function initEvent() { if (!self::$supported) { return; } self::updateConfig(); self::$fd = eio_get_event_stream(); self::$ev = EventLoop::$instance->event(self::$fd, \Event::READ | \Event::PERSIST, function ($fd, $events, $ar...
[ "public", "static", "function", "initEvent", "(", ")", "{", "if", "(", "!", "self", "::", "$", "supported", ")", "{", "return", ";", "}", "self", "::", "updateConfig", "(", ")", ";", "self", "::", "$", "fd", "=", "eio_get_event_stream", "(", ")", ";"...
Initialize main FS event @return void
[ "Initialize", "main", "FS", "event" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L96-L112
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.updateConfig
public static function updateConfig() { if (Daemon::$config->eiosetmaxidle->value !== null) { eio_set_max_idle(Daemon::$config->eiosetmaxidle->value); } if (Daemon::$config->eiosetmaxparallel->value !== null) { eio_set_max_parallel(Daemon::$config->eiosetmaxparallel->...
php
public static function updateConfig() { if (Daemon::$config->eiosetmaxidle->value !== null) { eio_set_max_idle(Daemon::$config->eiosetmaxidle->value); } if (Daemon::$config->eiosetmaxparallel->value !== null) { eio_set_max_parallel(Daemon::$config->eiosetmaxparallel->...
[ "public", "static", "function", "updateConfig", "(", ")", "{", "if", "(", "Daemon", "::", "$", "config", "->", "eiosetmaxidle", "->", "value", "!==", "null", ")", "{", "eio_set_max_idle", "(", "Daemon", "::", "$", "config", "->", "eiosetmaxidle", "->", "va...
Called when config is updated @return void
[ "Called", "when", "config", "is", "updated" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L142-L159
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.stat
public static function stat($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, FileSystem::statPrepare(@stat($path))); return true; } return eio_stat($path, $pri, function ($path, $stat) use ($cb) {...
php
public static function stat($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, FileSystem::statPrepare(@stat($path))); return true; } return eio_stat($path, $pri, function ($path, $stat) use ($cb) {...
[ "public", "static", "function", "stat", "(", "$", "path", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::", "$", "support...
Gets stat() information @param string $path Path @param callable $cb Callback @param integer $pri Priority @return resource|true
[ "Gets", "stat", "()", "information" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L192-L202
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.unlink
public static function unlink($path, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $r = unlink($path); if ($cb) { $cb($path, $r); } return $r; } return eio_unlink($...
php
public static function unlink($path, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $r = unlink($path); if ($cb) { $cb($path, $r); } return $r; } return eio_unlink($...
[ "public", "static", "function", "unlink", "(", "$", "path", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::"...
Unlink file @param string $path Path @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Unlink", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L211-L222
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.rename
public static function rename($path, $newpath, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $r = rename($path, $newpath); if ($cb) { $cb($path, $newpath, $r); } return $r; ...
php
public static function rename($path, $newpath, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $r = rename($path, $newpath); if ($cb) { $cb($path, $newpath, $r); } return $r; ...
[ "public", "static", "function", "rename", "(", "$", "path", ",", "$", "newpath", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "...
Rename @param string $path Path @param string $newpath New path @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Rename" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L232-L243
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.statvfs
public static function statvfs($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, false); return false; } return eio_statvfs($path, $pri, $cb, $path); }
php
public static function statvfs($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, false); return false; } return eio_statvfs($path, $pri, $cb, $path); }
[ "public", "static", "function", "statvfs", "(", "$", "path", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::", "$", "supp...
statvfs() @param string $path Path @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "statvfs", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L252-L260
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.realpath
public static function realpath($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, realpath($path)); return true; } return eio_realpath($path, $pri, $cb, $path); }
php
public static function realpath($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, realpath($path)); return true; } return eio_realpath($path, $pri, $cb, $path); }
[ "public", "static", "function", "realpath", "(", "$", "path", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::", "$", "sup...
realpath() @param string $path Path @param callable $cb Callback @param integer $pri Priority @return resource|true
[ "realpath", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L288-L296
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.sync
public static function sync($cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { if ($cb) { $cb(false); } return false; } return eio_sync($pri, $cb); }
php
public static function sync($cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { if ($cb) { $cb(false); } return false; } return eio_sync($pri, $cb); }
[ "public", "static", "function", "sync", "(", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::", "$", "supported", ...
sync() @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "sync", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L304-L314
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.syncfs
public static function syncfs($cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { if ($cb) { $cb(false); } return false; } return eio_syncfs($pri, $cb); }
php
public static function syncfs($cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { if ($cb) { $cb(false); } return false; } return eio_syncfs($pri, $cb); }
[ "public", "static", "function", "syncfs", "(", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "self", "::", "$", "supported", ...
statfs() @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "statfs", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L322-L332
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.touch
public static function touch($path, $mtime, $atime = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = touch($path, $mtime, $atime); if ($cb) { $cb($r); } return $r; ...
php
public static function touch($path, $mtime, $atime = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = touch($path, $mtime, $atime); if ($cb) { $cb($r); } return $r; ...
[ "public", "static", "function", "touch", "(", "$", "path", ",", "$", "mtime", ",", "$", "atime", "=", "null", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", ...
touch() @param string $path Path @param integer $mtime Last modification time @param integer $atime Last access time @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "touch", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L343-L354
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.rmdir
public static function rmdir($path, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = rmdir($path); if ($cb) { $cb($path, $r); } return $r; } return eio_rmdi...
php
public static function rmdir($path, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = rmdir($path); if ($cb) { $cb($path, $r); } return $r; } return eio_rmdi...
[ "public", "static", "function", "rmdir", "(", "$", "path", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "FileSystem", ...
Removes empty directory @param string $path Path @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Removes", "empty", "directory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L363-L374
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.mkdir
public static function mkdir($path, $mode, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = mkdir($path, $mode); if ($cb) { $cb($path, $r); } return $r; } r...
php
public static function mkdir($path, $mode, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = mkdir($path, $mode); if ($cb) { $cb($path, $r); } return $r; } r...
[ "public", "static", "function", "mkdir", "(", "$", "path", ",", "$", "mode", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", ...
Creates directory @param string $path Path @param integer $mode Mode (octal) @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Creates", "directory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L384-L395
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.readdir
public static function readdir($path, $cb = null, $flags = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = glob($path); if ($cb) { $cb($path, $r); } return true; } ...
php
public static function readdir($path, $cb = null, $flags = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = glob($path); if ($cb) { $cb($path, $r); } return true; } ...
[ "public", "static", "function", "readdir", "(", "$", "path", ",", "$", "cb", "=", "null", ",", "$", "flags", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ...
Readdir() @param string $path Path @param callable $cb = null Callback @param integer $flags = null Flags @param integer $pri = EIO_PRI_DEFAULT Priority @return resource|true
[ "Readdir", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L405-L416
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.truncate
public static function truncate($path, $offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $fp = fopen($path, 'r+'); $r = $fp && ftruncate($fp, $offset); if ($cb) { $cb($path, $r)...
php
public static function truncate($path, $offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $fp = fopen($path, 'r+'); $r = $fp && ftruncate($fp, $offset); if ($cb) { $cb($path, $r)...
[ "public", "static", "function", "truncate", "(", "$", "path", ",", "$", "offset", "=", "0", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", "...
Truncate file @param string $path Path @param integer $offset Offset @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Truncate", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L426-L438
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.sendfile
public static function sendfile( $outfd, $path, $cb, $startCb = null, $offset = 0, $length = null, $pri = EIO_PRI_DEFAULT ) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, false); return fals...
php
public static function sendfile( $outfd, $path, $cb, $startCb = null, $offset = 0, $length = null, $pri = EIO_PRI_DEFAULT ) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { $cb($path, false); return fals...
[ "public", "static", "function", "sendfile", "(", "$", "outfd", ",", "$", "path", ",", "$", "cb", ",", "$", "startCb", "=", "null", ",", "$", "offset", "=", "0", ",", "$", "length", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "...
sendfile() @param mixed $outfd File descriptor @param string $path Path @param callable $cb Callback @param callable $startCb Start callback @param integer $offset Offset @param integer $length Length @param integer $pri Priority @return true Success
[ "sendfile", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L451-L495
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.chown
public static function chown($path, $uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = chown($path, $uid); if ($gid !== -1) { $r = $r && chgrp($path, $gid); } ...
php
public static function chown($path, $uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $r = chown($path, $uid); if ($gid !== -1) { $r = $r && chgrp($path, $gid); } ...
[ "public", "static", "function", "chown", "(", "$", "path", ",", "$", "uid", ",", "$", "gid", "=", "-", "1", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", ...
Changes ownership of file/directory @param string $path Path @param integer $uid User ID @param integer $gid Group ID @param callable $cb = null Callback @param integer $pri = EIO_PRI_DEFAULT Priority @return resource|boolean
[ "Changes", "ownership", "of", "file", "/", "directory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L506-L519
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.readfile
public static function readfile($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $cb($path, file_get_contents($path)); return true; } return FileSystem::open($path, 'r!', function ($file) use ($path, $...
php
public static function readfile($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $cb($path, file_get_contents($path)); return true; } return FileSystem::open($path, 'r!', function ($file) use ($path, $...
[ "public", "static", "function", "readfile", "(", "$", "path", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "FileSystem", "::", "$", ...
Reads whole file @param string $path Path @param callable $cb Callback (Path, Contents) @param integer $pri Priority @return resource|true
[ "Reads", "whole", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L528-L542
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.readfileChunked
public static function readfileChunked($path, $cb, $chunkcb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $chunkcb($path, $r = readfile($path)); $cb($r !== false); return; } FileSystem::open($path,...
php
public static function readfileChunked($path, $cb, $chunkcb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!FileSystem::$supported) { $chunkcb($path, $r = readfile($path)); $cb($r !== false); return; } FileSystem::open($path,...
[ "public", "static", "function", "readfileChunked", "(", "$", "path", ",", "$", "cb", ",", "$", "chunkcb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!...
Reads file chunk-by-chunk @param string $path Path @param callable $cb Callback (Path, Success) @param callable $chunkcb Chunk callback (Path, Chunk) @param integer $pri Priority @return resource
[ "Reads", "file", "chunk", "-", "by", "-", "chunk" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L552-L567
kakserpom/phpdaemon
PHPDaemon/FS/FileSystem.php
FileSystem.genRndTempnam
public static function genRndTempnam($dir = null, $prefix = 'php') { if (!$dir) { $dir = sys_get_temp_dir(); } static $n = 0; return $dir . '/' . $prefix . str_shuffle( md5( str_shuffle( microtime(true) . chr(mt_rand(0, 0x...
php
public static function genRndTempnam($dir = null, $prefix = 'php') { if (!$dir) { $dir = sys_get_temp_dir(); } static $n = 0; return $dir . '/' . $prefix . str_shuffle( md5( str_shuffle( microtime(true) . chr(mt_rand(0, 0x...
[ "public", "static", "function", "genRndTempnam", "(", "$", "dir", "=", "null", ",", "$", "prefix", "=", "'php'", ")", "{", "if", "(", "!", "$", "dir", ")", "{", "$", "dir", "=", "sys_get_temp_dir", "(", ")", ";", "}", "static", "$", "n", "=", "0"...
Returns random temporary file name @param string $dir Directory @param string $prefix Prefix @return string Path
[ "Returns", "random", "temporary", "file", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/FileSystem.php#L575-L592