repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
kakserpom/phpdaemon
PHPDaemon/Network/Server.php
Server.bindSockets
public function bindSockets($addrs = [], $max = 0) { if (is_string($addrs)) { $addrs = array_map('trim', explode(',', $addrs)); } $n = 0; foreach ($addrs as $addr) { if ($this->bindSocket($addr)) { ++$n; } if ($max > 0 &...
php
public function bindSockets($addrs = [], $max = 0) { if (is_string($addrs)) { $addrs = array_map('trim', explode(',', $addrs)); } $n = 0; foreach ($addrs as $addr) { if ($this->bindSocket($addr)) { ++$n; } if ($max > 0 &...
[ "public", "function", "bindSockets", "(", "$", "addrs", "=", "[", "]", ",", "$", "max", "=", "0", ")", "{", "if", "(", "is_string", "(", "$", "addrs", ")", ")", "{", "$", "addrs", "=", "array_map", "(", "'trim'", ",", "explode", "(", "','", ",", ...
Bind given sockets @param mixed $addrs Addresses to bind @param integer $max Maximum @return integer Number of bound
[ "Bind", "given", "sockets" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Server.php#L46-L61
kakserpom/phpdaemon
PHPDaemon/Network/Server.php
Server.bindSocket
public function bindSocket($uri) { $u = \PHPDaemon\Config\_Object::parseCfgUri($uri); $scheme = $u['scheme']; if ($scheme === 'unix') { $socket = new \PHPDaemon\BoundSocket\UNIX($u); } elseif ($scheme === 'udp') { $socket = new \PHPDaemon\BoundSocket\UDP($u); ...
php
public function bindSocket($uri) { $u = \PHPDaemon\Config\_Object::parseCfgUri($uri); $scheme = $u['scheme']; if ($scheme === 'unix') { $socket = new \PHPDaemon\BoundSocket\UNIX($u); } elseif ($scheme === 'udp') { $socket = new \PHPDaemon\BoundSocket\UDP($u); ...
[ "public", "function", "bindSocket", "(", "$", "uri", ")", "{", "$", "u", "=", "\\", "PHPDaemon", "\\", "Config", "\\", "_Object", "::", "parseCfgUri", "(", "$", "uri", ")", ";", "$", "scheme", "=", "$", "u", "[", "'scheme'", "]", ";", "if", "(", ...
Bind given socket @param string $uri Address to bind @return boolean Success
[ "Bind", "given", "socket" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Server.php#L68-L96
kakserpom/phpdaemon
PHPDaemon/Network/Server.php
Server.attachBound
public function attachBound(\PHPDaemon\BoundSocket\Generic $bound, $inf = null) { $this->bound->attach($bound, $inf); if ($this->eventLoop !== null) { $bound->setEventLoop($this->eventLoop); } }
php
public function attachBound(\PHPDaemon\BoundSocket\Generic $bound, $inf = null) { $this->bound->attach($bound, $inf); if ($this->eventLoop !== null) { $bound->setEventLoop($this->eventLoop); } }
[ "public", "function", "attachBound", "(", "\\", "PHPDaemon", "\\", "BoundSocket", "\\", "Generic", "$", "bound", ",", "$", "inf", "=", "null", ")", "{", "$", "this", "->", "bound", "->", "attach", "(", "$", "bound", ",", "$", "inf", ")", ";", "if", ...
Attach Generic @param \PHPDaemon\BoundSocket\Generic $bound Generic @param mixed $inf Info @return void
[ "Attach", "Generic" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Server.php#L104-L110
kakserpom/phpdaemon
PHPDaemon/Network/Server.php
Server.inheritFromRequest
public function inheritFromRequest($req, $oldConn) { if (!$oldConn || !$req) { return false; } $class = $this->connectionClass; $conn = new $class(null, $this); $this->attach($conn); $conn->setFd($oldConn->getFd(), $oldConn->getBev()); $oldConn->un...
php
public function inheritFromRequest($req, $oldConn) { if (!$oldConn || !$req) { return false; } $class = $this->connectionClass; $conn = new $class(null, $this); $this->attach($conn); $conn->setFd($oldConn->getFd(), $oldConn->getBev()); $oldConn->un...
[ "public", "function", "inheritFromRequest", "(", "$", "req", ",", "$", "oldConn", ")", "{", "if", "(", "!", "$", "oldConn", "||", "!", "$", "req", ")", "{", "return", "false", ";", "}", "$", "class", "=", "$", "this", "->", "connectionClass", ";", ...
Called when a request to HTTP-server looks like another connection @param object $req Request @param object $oldConn Connection @return boolean Success
[ "Called", "when", "a", "request", "to", "HTTP", "-", "server", "looks", "like", "another", "connection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Server.php#L128-L144
kakserpom/phpdaemon
PHPDaemon/Network/Server.php
Server.applyConfig
protected function applyConfig() { parent::applyConfig(); foreach ($this->config as $k => $v) { if (is_object($v) && $v instanceof \PHPDaemon\Config\Entry\Generic) { $v = $v->getValue(); } $k = strtolower($k); if ($k === 'allowedclients...
php
protected function applyConfig() { parent::applyConfig(); foreach ($this->config as $k => $v) { if (is_object($v) && $v instanceof \PHPDaemon\Config\Entry\Generic) { $v = $v->getValue(); } $k = strtolower($k); if ($k === 'allowedclients...
[ "protected", "function", "applyConfig", "(", ")", "{", "parent", "::", "applyConfig", "(", ")", ";", "foreach", "(", "$", "this", "->", "config", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "is_object", "(", "$", "v", ")", "&&", "$", "v"...
Applies config @return void
[ "Applies", "config" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Server.php#L169-L181
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.onReady
public function onReady() { if ($this->pool->config->protologging->value) { Daemon::log("New connection\n\n"); } $e = explode('.', $this->protover); $packet = pack('nn', $e[0], $e[1]); if (strlen($this->user)) { $packet .= "user\x00" . $this->user . "...
php
public function onReady() { if ($this->pool->config->protologging->value) { Daemon::log("New connection\n\n"); } $e = explode('.', $this->protover); $packet = pack('nn', $e[0], $e[1]); if (strlen($this->user)) { $packet .= "user\x00" . $this->user . "...
[ "public", "function", "onReady", "(", ")", "{", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "protologging", "->", "value", ")", "{", "Daemon", "::", "log", "(", "\"New connection\\n\\n\"", ")", ";", "}", "$", "e", "=", "explode", "(", ...
Called when the stream is handshaked (at low-level), and peer is ready to recv. data @return void
[ "Called", "when", "the", "stream", "is", "handshaked", "(", "at", "low", "-", "level", ")", "and", "peer", "is", "ready", "to", "recv", ".", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L127-L152
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.onConnected
public function onConnected($cb) { if ($this->state === self::STATE_AUTH_ERROR) { $cb($this, false); } elseif ($this->state === self::STATE_AUTH_OK) { $cb($this, true); } else { if (!$this->onConnected) { $this->onConnected = new StackCallb...
php
public function onConnected($cb) { if ($this->state === self::STATE_AUTH_ERROR) { $cb($this, false); } elseif ($this->state === self::STATE_AUTH_OK) { $cb($this, true); } else { if (!$this->onConnected) { $this->onConnected = new StackCallb...
[ "public", "function", "onConnected", "(", "$", "cb", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_AUTH_ERROR", ")", "{", "$", "cb", "(", "$", "this", ",", "false", ")", ";", "}", "elseif", "(", "$", "this", "->", "...
Executes the given callback when/if the connection is handshaked. @param callable $cb Callback @callback $cb ( ) @return void
[ "Executes", "the", "given", "callback", "when", "/", "if", "the", "connection", "is", "handshaked", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L160-L172
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.sendPacket
public function sendPacket($type, $packet) { $header = $type . pack('N', mb_orig_strlen($packet) + 4); $this->write($header); $this->write($packet); if ($this->pool->config->protologging->value) { Daemon::log('Client --> Server: ' . Debug::exportBytes($header . $packet)...
php
public function sendPacket($type, $packet) { $header = $type . pack('N', mb_orig_strlen($packet) + 4); $this->write($header); $this->write($packet); if ($this->pool->config->protologging->value) { Daemon::log('Client --> Server: ' . Debug::exportBytes($header . $packet)...
[ "public", "function", "sendPacket", "(", "$", "type", ",", "$", "packet", ")", "{", "$", "header", "=", "$", "type", ".", "pack", "(", "'N'", ",", "mb_orig_strlen", "(", "$", "packet", ")", "+", "4", ")", ";", "$", "this", "->", "write", "(", "$"...
Send a packet @param string $type Data @param string $packet Packet @return boolean Success
[ "Send", "a", "packet" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L231-L243
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.buildLenEncodedBinary
public function buildLenEncodedBinary($s) { if ($s === null) { return "\251"; } $l = mb_orig_strlen($s); if ($l <= 250) { return chr($l) . $s; } if ($l <= 0xFFFF) { return "\252" . $this->int2bytes(2, $l) . $s; } ...
php
public function buildLenEncodedBinary($s) { if ($s === null) { return "\251"; } $l = mb_orig_strlen($s); if ($l <= 250) { return chr($l) . $s; } if ($l <= 0xFFFF) { return "\252" . $this->int2bytes(2, $l) . $s; } ...
[ "public", "function", "buildLenEncodedBinary", "(", "$", "s", ")", "{", "if", "(", "$", "s", "===", "null", ")", "{", "return", "\"\\251\"", ";", "}", "$", "l", "=", "mb_orig_strlen", "(", "$", "s", ")", ";", "if", "(", "$", "l", "<=", "250", ")"...
Builds length-encoded binary string @param string $s String @return string Resulting binary string
[ "Builds", "length", "-", "encoded", "binary", "string" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L250-L271
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.parseEncodedBinary
public function parseEncodedBinary(&$s, &$p) { $f = ord(mb_orig_substr($s, $p, 1)); ++$p; if ($f <= 250) { return $f; } if ($s === 251) { return null; } if ($s === 255) { return false; } if ($f === 252) {...
php
public function parseEncodedBinary(&$s, &$p) { $f = ord(mb_orig_substr($s, $p, 1)); ++$p; if ($f <= 250) { return $f; } if ($s === 251) { return null; } if ($s === 255) { return false; } if ($f === 252) {...
[ "public", "function", "parseEncodedBinary", "(", "&", "$", "s", ",", "&", "$", "p", ")", "{", "$", "f", "=", "ord", "(", "mb_orig_substr", "(", "$", "s", ",", "$", "p", ",", "1", ")", ")", ";", "++", "$", "p", ";", "if", "(", "$", "f", "<="...
Parses length-encoded binary @param string &$s Reference to source string @param integer &$p @return integer Result
[ "Parses", "length", "-", "encoded", "binary" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L279-L314
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.parseEncodedString
public function parseEncodedString(&$s, &$p) { $l = $this->parseEncodedBinary($s, $p); if ($l === null || $l === false) { return $l; } $o = $p; $p += $l; return mb_orig_substr($s, $o, $l); }
php
public function parseEncodedString(&$s, &$p) { $l = $this->parseEncodedBinary($s, $p); if ($l === null || $l === false) { return $l; } $o = $p; $p += $l; return mb_orig_substr($s, $o, $l); }
[ "public", "function", "parseEncodedString", "(", "&", "$", "s", ",", "&", "$", "p", ")", "{", "$", "l", "=", "$", "this", "->", "parseEncodedBinary", "(", "$", "s", ",", "$", "p", ")", ";", "if", "(", "$", "l", "===", "null", "||", "$", "l", ...
Parse length-encoded string @param string &$s Reference to source string @param integer &$p Reference to pointer @return integer Result
[ "Parse", "length", "-", "encoded", "string" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L322-L334
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.command
public function command($cmd, $q = '', $cb = null) { if ($this->state !== self::STATE_AUTH_OK) { return false; } $this->sendPacket($cmd, $q); $this->onResponse->push($cb); $this->checkFree(); return true; }
php
public function command($cmd, $q = '', $cb = null) { if ($this->state !== self::STATE_AUTH_OK) { return false; } $this->sendPacket($cmd, $q); $this->onResponse->push($cb); $this->checkFree(); return true; }
[ "public", "function", "command", "(", "$", "cmd", ",", "$", "q", "=", "''", ",", "$", "cb", "=", "null", ")", "{", "if", "(", "$", "this", "->", "state", "!==", "self", "::", "STATE_AUTH_OK", ")", "{", "return", "false", ";", "}", "$", "this", ...
Sends arbitrary command @param integer $cmd Command's code. See constants above. @param string $q Data @param callable $cb Optional. Callback called when response received. @callback $cb ( ) @return boolean Success
[ "Sends", "arbitrary", "command" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L390-L402
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.selectDB
public function selectDB($name) { $this->dbname = $name; if ($this->state !== 1) { return $this->query('USE `' . $name . '`'); } return true; }
php
public function selectDB($name) { $this->dbname = $name; if ($this->state !== 1) { return $this->query('USE `' . $name . '`'); } return true; }
[ "public", "function", "selectDB", "(", "$", "name", ")", "{", "$", "this", "->", "dbname", "=", "$", "name", ";", "if", "(", "$", "this", "->", "state", "!==", "1", ")", "{", "return", "$", "this", "->", "query", "(", "'USE `'", ".", "$", "name",...
Set default database name @param string $name Database name @return boolean Success
[ "Set", "default", "database", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L409-L418
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.decodeNULstrings
public function decodeNULstrings($data, $limit = 1, &$p = 0) { $r = []; for ($i = 0; $i < $limit; ++$i) { $pos = mb_orig_strpos($data, "\x00", $p); if ($pos === false) { break; } $r[] = mb_orig_substr($data, $p, $pos - $p); ...
php
public function decodeNULstrings($data, $limit = 1, &$p = 0) { $r = []; for ($i = 0; $i < $limit; ++$i) { $pos = mb_orig_strpos($data, "\x00", $p); if ($pos === false) { break; } $r[] = mb_orig_substr($data, $p, $pos - $p); ...
[ "public", "function", "decodeNULstrings", "(", "$", "data", ",", "$", "limit", "=", "1", ",", "&", "$", "p", "=", "0", ")", "{", "$", "r", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "limit", ";", "++", "$...
Decode strings from the NUL-terminated representation @param string $data Binary data @param integer $limit Optional. Limit of count. Default is 1. @param reference &$p Optional. Pointer. @return array Decoded strings
[ "Decode", "strings", "from", "the", "NUL", "-", "terminated", "representation" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L641-L658
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.onResultDone
public function onResultDone() { $this->instate = 0; $this->onResponse->executeOne($this, true); $this->resultRows = []; $this->resultFields = []; $this->checkFree(); if ($this->pool->config->protologging->value) { Daemon::log(__METHOD__); } }
php
public function onResultDone() { $this->instate = 0; $this->onResponse->executeOne($this, true); $this->resultRows = []; $this->resultFields = []; $this->checkFree(); if ($this->pool->config->protologging->value) { Daemon::log(__METHOD__); } }
[ "public", "function", "onResultDone", "(", ")", "{", "$", "this", "->", "instate", "=", "0", ";", "$", "this", "->", "onResponse", "->", "executeOne", "(", "$", "this", ",", "true", ")", ";", "$", "this", "->", "resultRows", "=", "[", "]", ";", "$"...
Called when the whole result received @return void
[ "Called", "when", "the", "whole", "result", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L664-L675
kakserpom/phpdaemon
PHPDaemon/Clients/PostgreSQL/Connection.php
Connection.onError
public function onError() { $this->instate = 0; $this->onResponse->executeOne($this, false); $this->resultRows = []; $this->resultFields = []; Daemon::log(__METHOD__ . ' #' . $this->errno . ': ' . $this->errmsg); if ($this->state === self::STATE_AUTH_PACKET_SENT) { ...
php
public function onError() { $this->instate = 0; $this->onResponse->executeOne($this, false); $this->resultRows = []; $this->resultFields = []; Daemon::log(__METHOD__ . ' #' . $this->errno . ': ' . $this->errmsg); if ($this->state === self::STATE_AUTH_PACKET_SENT) { ...
[ "public", "function", "onError", "(", ")", "{", "$", "this", "->", "instate", "=", "0", ";", "$", "this", "->", "onResponse", "->", "executeOne", "(", "$", "this", ",", "false", ")", ";", "$", "this", "->", "resultRows", "=", "[", "]", ";", "$", ...
Called when error occured @return void
[ "Called", "when", "error", "occured" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/PostgreSQL/Connection.php#L681-L697
kakserpom/phpdaemon
PHPDaemon/Utils/Encoding.php
Encoding.encode
public static function encode($encodingLabel, $text) { $encodingLabel = self::normalizeEncoding($encodingLabel); if ($encodingLabel === 'UTF-8') { return Encoding::toUTF8($text); } if ($encodingLabel === 'ISO-8859-1') { return Encoding::toLatin1($text); ...
php
public static function encode($encodingLabel, $text) { $encodingLabel = self::normalizeEncoding($encodingLabel); if ($encodingLabel === 'UTF-8') { return Encoding::toUTF8($text); } if ($encodingLabel === 'ISO-8859-1') { return Encoding::toLatin1($text); ...
[ "public", "static", "function", "encode", "(", "$", "encodingLabel", ",", "$", "text", ")", "{", "$", "encodingLabel", "=", "self", "::", "normalizeEncoding", "(", "$", "encodingLabel", ")", ";", "if", "(", "$", "encodingLabel", "===", "'UTF-8'", ")", "{",...
Encode @param string $str Any string @return string
[ "Encode" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/Encoding.php#L340-L349
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleIRCBot.php
ExampleIRCBot.init
public function init() { if ($this->isEnabled()) { $this->client = \PHPDaemon\Clients\IRC\Pool::getInstance(); } }
php
public function init() { if ($this->isEnabled()) { $this->client = \PHPDaemon\Clients\IRC\Pool::getInstance(); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "$", "this", "->", "client", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "IRC", "\\", "Pool", "::", "getInstance", "(", ")", ";", "}", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleIRCBot.php#L20-L25
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleIRCBot.php
ExampleIRCBot.onConfigUpdated
public function onConfigUpdated() { if ($this->client) { $this->client->config = $this->config; $this->client->onConfigUpdated(); } }
php
public function onConfigUpdated() { if ($this->client) { $this->client->config = $this->config; $this->client->onConfigUpdated(); } }
[ "public", "function", "onConfigUpdated", "(", ")", "{", "if", "(", "$", "this", "->", "client", ")", "{", "$", "this", "->", "client", "->", "config", "=", "$", "this", "->", "config", ";", "$", "this", "->", "client", "->", "onConfigUpdated", "(", "...
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/Examples/ExampleIRCBot.php#L67-L73
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.initSettings
public static function initSettings() { Daemon::$version = file_get_contents('VERSION', true); Daemon::$config = new Config\_Object; if (!defined('SO_REUSEPORT') && mb_orig_strpos(php_uname('s'), 'BSD') !== false) { // @TODO: better if-BSD check define('SO_REUSEPORT...
php
public static function initSettings() { Daemon::$version = file_get_contents('VERSION', true); Daemon::$config = new Config\_Object; if (!defined('SO_REUSEPORT') && mb_orig_strpos(php_uname('s'), 'BSD') !== false) { // @TODO: better if-BSD check define('SO_REUSEPORT...
[ "public", "static", "function", "initSettings", "(", ")", "{", "Daemon", "::", "$", "version", "=", "file_get_contents", "(", "'VERSION'", ",", "true", ")", ";", "Daemon", "::", "$", "config", "=", "new", "Config", "\\", "_Object", ";", "if", "(", "!", ...
Loads default setting. @return void
[ "Loads", "default", "setting", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L237-L247
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.glob
public static function glob($pattern, $flags = 0) { $r = []; foreach (explode(':', get_include_path()) as $path) { $r = array_merge($r, glob($p = $path . '/' . $pattern, $flags)); } return array_unique($r); }
php
public static function glob($pattern, $flags = 0) { $r = []; foreach (explode(':', get_include_path()) as $path) { $r = array_merge($r, glob($p = $path . '/' . $pattern, $flags)); } return array_unique($r); }
[ "public", "static", "function", "glob", "(", "$", "pattern", ",", "$", "flags", "=", "0", ")", "{", "$", "r", "=", "[", "]", ";", "foreach", "(", "explode", "(", "':'", ",", "get_include_path", "(", ")", ")", "as", "$", "path", ")", "{", "$", "...
Glob function with support of include_path @param string $pattern @param int $flags @return array
[ "Glob", "function", "with", "support", "of", "include_path" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L255-L262
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.uniqid
public static function uniqid() { static $n = 0; return str_shuffle( md5( str_shuffle( microtime(true) . chr(mt_rand(0, 0xFF)) . Daemon::$process->getPid() . chr(mt_rand(0, 0xFF)) . (++$n) . mt_rand(0, mt_getrand...
php
public static function uniqid() { static $n = 0; return str_shuffle( md5( str_shuffle( microtime(true) . chr(mt_rand(0, 0xFF)) . Daemon::$process->getPid() . chr(mt_rand(0, 0xFF)) . (++$n) . mt_rand(0, mt_getrand...
[ "public", "static", "function", "uniqid", "(", ")", "{", "static", "$", "n", "=", "0", ";", "return", "str_shuffle", "(", "md5", "(", "str_shuffle", "(", "microtime", "(", "true", ")", ".", "chr", "(", "mt_rand", "(", "0", ",", "0xFF", ")", ")", "....
Generate a unique ID. @return string Returns the unique identifier, as a string.
[ "Generate", "a", "unique", "ID", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L268-L280
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.loadModuleIfAbsent
public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=') { if (!extension_loaded($mod)) { if (!get_cfg_var('enable_dl')) { return false; } if (!@dl(basename($mod) . '.so')) { return false; } } ...
php
public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=') { if (!extension_loaded($mod)) { if (!get_cfg_var('enable_dl')) { return false; } if (!@dl(basename($mod) . '.so')) { return false; } } ...
[ "public", "static", "function", "loadModuleIfAbsent", "(", "$", "mod", ",", "$", "version", "=", "null", ",", "$", "compare", "=", "'>='", ")", "{", "if", "(", "!", "extension_loaded", "(", "$", "mod", ")", ")", "{", "if", "(", "!", "get_cfg_var", "(...
Load PHP extension (module) if absent @param string $mod @param string $version @param string $compare @return bool $success
[ "Load", "PHP", "extension", "(", "module", ")", "if", "absent" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L289-L308
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.checkAutoGC
public static function checkAutoGC() { if ((Daemon::$config->autogc->value > 0) && (Daemon::$process->counterGC > 0) && (Daemon::$process->counterGC >= Daemon::$config->autogc->value) ) { Daemon::$process->counterGC = 0; return true; } ...
php
public static function checkAutoGC() { if ((Daemon::$config->autogc->value > 0) && (Daemon::$process->counterGC > 0) && (Daemon::$process->counterGC >= Daemon::$config->autogc->value) ) { Daemon::$process->counterGC = 0; return true; } ...
[ "public", "static", "function", "checkAutoGC", "(", ")", "{", "if", "(", "(", "Daemon", "::", "$", "config", "->", "autogc", "->", "value", ">", "0", ")", "&&", "(", "Daemon", "::", "$", "process", "->", "counterGC", ">", "0", ")", "&&", "(", "Daem...
Check if we need to run automatic garbage collector @return bool
[ "Check", "if", "we", "need", "to", "run", "automatic", "garbage", "collector" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L325-L335
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.outputFilter
public static function outputFilter($s) { static $n = 0; // recursion counter if ($s === '') { return ''; } ++$n; Daemon::$obInStack = true; if (Daemon::$config->obfilterauto->value && Daemon::$context instanceof \PHPDaemon\Request\Generic) { ...
php
public static function outputFilter($s) { static $n = 0; // recursion counter if ($s === '') { return ''; } ++$n; Daemon::$obInStack = true; if (Daemon::$config->obfilterauto->value && Daemon::$context instanceof \PHPDaemon\Request\Generic) { ...
[ "public", "static", "function", "outputFilter", "(", "$", "s", ")", "{", "static", "$", "n", "=", "0", ";", "// recursion counter", "if", "(", "$", "s", "===", "''", ")", "{", "return", "''", ";", "}", "++", "$", "n", ";", "Daemon", "::", "$", "o...
Output filter @return string Output
[ "Output", "filter" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L341-L358
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.uncaughtExceptionHandler
public static function uncaughtExceptionHandler(\Exception $e) { if (Daemon::$context !== null) { if (Daemon::$context->handleException($e)) { return; } } $msg = $e->getMessage(); Daemon::log('Uncaught ' . get_class($e) . ' (' . $e->getCode() ....
php
public static function uncaughtExceptionHandler(\Exception $e) { if (Daemon::$context !== null) { if (Daemon::$context->handleException($e)) { return; } } $msg = $e->getMessage(); Daemon::log('Uncaught ' . get_class($e) . ' (' . $e->getCode() ....
[ "public", "static", "function", "uncaughtExceptionHandler", "(", "\\", "Exception", "$", "e", ")", "{", "if", "(", "Daemon", "::", "$", "context", "!==", "null", ")", "{", "if", "(", "Daemon", "::", "$", "context", "->", "handleException", "(", "$", "e",...
Uncaught exception handler @param \Exception $e @return void
[ "Uncaught", "exception", "handler" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L365-L377
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.errorHandler
public static function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { Daemon::$noError = false; $l = error_reporting(); if ($l === 0) { if (!Daemon::$restrictErrorControl) { return; } } elseif (!($l & $errno)) { re...
php
public static function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { Daemon::$noError = false; $l = error_reporting(); if ($l === 0) { if (!Daemon::$restrictErrorControl) { return; } } elseif (!($l & $errno)) { re...
[ "public", "static", "function", "errorHandler", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ",", "$", "errcontext", ")", "{", "Daemon", "::", "$", "noError", "=", "false", ";", "$", "l", "=", "error_reporting", "(",...
Error handler @param integer $errno @param string $errstr @param string $errfile @param integer $errline @param array $errcontext
[ "Error", "handler" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L387-L418
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.init
public static function init() { Daemon::$startTime = time(); set_time_limit(0); Daemon::$defaultErrorLevel = error_reporting(); Daemon::$restrictErrorControl = (bool)Daemon::$config->restricterrorcontrol->value; ob_start(['\PHPDaemon\Core\Daemon', 'outputFilter']); s...
php
public static function init() { Daemon::$startTime = time(); set_time_limit(0); Daemon::$defaultErrorLevel = error_reporting(); Daemon::$restrictErrorControl = (bool)Daemon::$config->restricterrorcontrol->value; ob_start(['\PHPDaemon\Core\Daemon', 'outputFilter']); s...
[ "public", "static", "function", "init", "(", ")", "{", "Daemon", "::", "$", "startTime", "=", "time", "(", ")", ";", "set_time_limit", "(", "0", ")", ";", "Daemon", "::", "$", "defaultErrorLevel", "=", "error_reporting", "(", ")", ";", "Daemon", "::", ...
Performs initial actions. @return void
[ "Performs", "initial", "actions", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L424-L440
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.checkSupports
protected static function checkSupports() { if (is_callable('runkit_lint_file')) { self::$support[self::SUPPORT_RUNKIT_SANDBOX] = true; } if (is_callable('runkit_function_add')) { self::$support[self::SUPPORT_RUNKIT_MODIFY] = true; } if (is_callable(...
php
protected static function checkSupports() { if (is_callable('runkit_lint_file')) { self::$support[self::SUPPORT_RUNKIT_SANDBOX] = true; } if (is_callable('runkit_function_add')) { self::$support[self::SUPPORT_RUNKIT_MODIFY] = true; } if (is_callable(...
[ "protected", "static", "function", "checkSupports", "(", ")", "{", "if", "(", "is_callable", "(", "'runkit_lint_file'", ")", ")", "{", "self", "::", "$", "support", "[", "self", "::", "SUPPORT_RUNKIT_SANDBOX", "]", "=", "true", ";", "}", "if", "(", "is_cal...
Method to fill $support array @return void
[ "Method", "to", "fill", "$support", "array" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L456-L473
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.lintFile
public static function lintFile($filename) { if (!file_exists($filename)) { return false; } if (self::supported(self::SUPPORT_RUNKIT_SANDBOX)) { /** @noinspection PhpUndefinedFunctionInspection */ return runkit_lint_file($filename); } $cm...
php
public static function lintFile($filename) { if (!file_exists($filename)) { return false; } if (self::supported(self::SUPPORT_RUNKIT_SANDBOX)) { /** @noinspection PhpUndefinedFunctionInspection */ return runkit_lint_file($filename); } $cm...
[ "public", "static", "function", "lintFile", "(", "$", "filename", ")", "{", "if", "(", "!", "file_exists", "(", "$", "filename", ")", ")", "{", "return", "false", ";", "}", "if", "(", "self", "::", "supported", "(", "self", "::", "SUPPORT_RUNKIT_SANDBOX"...
Check file syntax via runkit_lint_file if supported or via php -l @param string File name @return boolean
[ "Check", "file", "syntax", "via", "runkit_lint_file", "if", "supported", "or", "via", "php", "-", "l" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L480-L496
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.compatRunEmul
public static function compatRunEmul() { Daemon::$compatMode = true; Daemon::initSettings(); $argv = isset($_SERVER['CMD_ARGV']) ? $_SERVER['CMD_ARGV'] : ''; $args = \PHPDaemon\Core\Bootstrap::getArgs($argv); if (isset($args[$k = 'configfile'])) { Daemon::$conf...
php
public static function compatRunEmul() { Daemon::$compatMode = true; Daemon::initSettings(); $argv = isset($_SERVER['CMD_ARGV']) ? $_SERVER['CMD_ARGV'] : ''; $args = \PHPDaemon\Core\Bootstrap::getArgs($argv); if (isset($args[$k = 'configfile'])) { Daemon::$conf...
[ "public", "static", "function", "compatRunEmul", "(", ")", "{", "Daemon", "::", "$", "compatMode", "=", "true", ";", "Daemon", "::", "initSettings", "(", ")", ";", "$", "argv", "=", "isset", "(", "$", "_SERVER", "[", "'CMD_ARGV'", "]", ")", "?", "$", ...
It allows to run your simple web-apps in spawn-fcgi/php-fpm environment. @return boolean|null - Success.
[ "It", "allows", "to", "run", "your", "simple", "web", "-", "apps", "in", "spawn", "-", "fcgi", "/", "php", "-", "fpm", "environment", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L502-L558
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.loadConfig
public static function loadConfig($paths) { $apaths = explode(';', $paths); foreach ($apaths as $path) { if (is_file($p = realpath($path))) { $ext = strtolower(pathinfo($p, PATHINFO_EXTENSION)); if ($ext === 'conf') { return Daemon::$co...
php
public static function loadConfig($paths) { $apaths = explode(';', $paths); foreach ($apaths as $path) { if (is_file($p = realpath($path))) { $ext = strtolower(pathinfo($p, PATHINFO_EXTENSION)); if ($ext === 'conf') { return Daemon::$co...
[ "public", "static", "function", "loadConfig", "(", "$", "paths", ")", "{", "$", "apaths", "=", "explode", "(", "';'", ",", "$", "paths", ")", ";", "foreach", "(", "$", "apaths", "as", "$", "path", ")", "{", "if", "(", "is_file", "(", "$", "p", "=...
Load config-file @param string $paths Path @return boolean - Success.
[ "Load", "config", "-", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L565-L581
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.openLogs
public static function openLogs() { if (Daemon::$config->logging->value) { Daemon::$logpointer = fopen(Daemon::$config->logstorage->value, 'a'); if (isset(Daemon::$config->group->value)) { chgrp(Daemon::$config->logstorage->value, Daemon::$config->group->value); // @T...
php
public static function openLogs() { if (Daemon::$config->logging->value) { Daemon::$logpointer = fopen(Daemon::$config->logstorage->value, 'a'); if (isset(Daemon::$config->group->value)) { chgrp(Daemon::$config->logstorage->value, Daemon::$config->group->value); // @T...
[ "public", "static", "function", "openLogs", "(", ")", "{", "if", "(", "Daemon", "::", "$", "config", "->", "logging", "->", "value", ")", "{", "Daemon", "::", "$", "logpointer", "=", "fopen", "(", "Daemon", "::", "$", "config", "->", "logstorage", "->"...
Open logs @return void
[ "Open", "logs" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L587-L609
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.getStateOfWorkers
public static function getStateOfWorkers() { $offset = 0; $stat = [ 'idle' => 0, 'busy' => 0, 'alive' => 0, 'shutdown' => 0, 'preinit' => 0, 'init' => 0, 'reloading' => 0, ]; $readed = 0; whi...
php
public static function getStateOfWorkers() { $offset = 0; $stat = [ 'idle' => 0, 'busy' => 0, 'alive' => 0, 'shutdown' => 0, 'preinit' => 0, 'init' => 0, 'reloading' => 0, ]; $readed = 0; whi...
[ "public", "static", "function", "getStateOfWorkers", "(", ")", "{", "$", "offset", "=", "0", ";", "$", "stat", "=", "[", "'idle'", "=>", "0", ",", "'busy'", "=>", "0", ",", "'alive'", "=>", "0", ",", "'shutdown'", "=>", "0", ",", "'preinit'", "=>", ...
Get state of workers. @return array - information.
[ "Get", "state", "of", "workers", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L615-L670
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.log
public static function log(...$args) { if (sizeof($args) === 1) { $msg = is_scalar($args[0]) ? $args[0] : Debug::dump($args[0]); } else { $msg = Debug::dump($args); } $mt = explode(' ', microtime()); if (is_resource(STDERR)) { fwrite(STDE...
php
public static function log(...$args) { if (sizeof($args) === 1) { $msg = is_scalar($args[0]) ? $args[0] : Debug::dump($args[0]); } else { $msg = Debug::dump($args); } $mt = explode(' ', microtime()); if (is_resource(STDERR)) { fwrite(STDE...
[ "public", "static", "function", "log", "(", "...", "$", "args", ")", "{", "if", "(", "sizeof", "(", "$", "args", ")", "===", "1", ")", "{", "$", "msg", "=", "is_scalar", "(", "$", "args", "[", "0", "]", ")", "?", "$", "args", "[", "0", "]", ...
Send message to the log @param array ...$args
[ "Send", "message", "to", "the", "log" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L677-L699
kakserpom/phpdaemon
PHPDaemon/Core/Daemon.php
Daemon.spawnMaster
public static function spawnMaster() { Daemon::$masters->push($thread = new Thread\Master); $thread->start(); if (-1 === $thread->getPid()) { Daemon::log('could not start master'); exit(0); } return $thread->getPid(); }
php
public static function spawnMaster() { Daemon::$masters->push($thread = new Thread\Master); $thread->start(); if (-1 === $thread->getPid()) { Daemon::log('could not start master'); exit(0); } return $thread->getPid(); }
[ "public", "static", "function", "spawnMaster", "(", ")", "{", "Daemon", "::", "$", "masters", "->", "push", "(", "$", "thread", "=", "new", "Thread", "\\", "Master", ")", ";", "$", "thread", "->", "start", "(", ")", ";", "if", "(", "-", "1", "===",...
Spawn a master process @return null|integer - success
[ "Spawn", "a", "master", "process" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Daemon.php#L705-L716
kakserpom/phpdaemon
PHPDaemon/Applications/GibsonREST/App.php
App.init
public function init() { $this->gibson = \PHPDaemon\Clients\Gibson\Pool::getInstance($this->config->gibsonname->value); }
php
public function init() { $this->gibson = \PHPDaemon\Clients\Gibson\Pool::getInstance($this->config->gibsonname->value); }
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "gibson", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Gibson", "\\", "Pool", "::", "getInstance", "(", "$", "this", "->", "config", "->", "gibsonname", "->", "value", ")", ";", "}" ]
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Applications/GibsonREST/App.php#L19-L22
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Connection.php
Connection.arrayToHash
public function arrayToHash($array) { $hash = []; for ($i = 0, $s = sizeof($array) - 1; $i < $s; ++$i) { $hash[$array[$i]] = $array[++$i]; } return $hash; }
php
public function arrayToHash($array) { $hash = []; for ($i = 0, $s = sizeof($array) - 1; $i < $s; ++$i) { $hash[$array[$i]] = $array[++$i]; } return $hash; }
[ "public", "function", "arrayToHash", "(", "$", "array", ")", "{", "$", "hash", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ",", "$", "s", "=", "sizeof", "(", "$", "array", ")", "-", "1", ";", "$", "i", "<", "$", "s", ";", "++", "$...
Converts array into hash @param array $array @return array $hash
[ "Converts", "array", "into", "hash" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Connection.php#L230-L237
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Connection.php
Connection.autoscan
public function autoscan($cmd, $args = [], $cbEnd = null, $limit = null) { return new AutoScan($this, $cmd, $args, $cbEnd, $limit); }
php
public function autoscan($cmd, $args = [], $cbEnd = null, $limit = null) { return new AutoScan($this, $cmd, $args, $cbEnd, $limit); }
[ "public", "function", "autoscan", "(", "$", "cmd", ",", "$", "args", "=", "[", "]", ",", "$", "cbEnd", "=", "null", ",", "$", "limit", "=", "null", ")", "{", "return", "new", "AutoScan", "(", "$", "this", ",", "$", "cmd", ",", "$", "args", ",",...
Wrapper for scans commands @param string $cmd Command @param array $args Arguments @param cllable $cbEnd Callback @param integer $limit Limit @return AutoScan
[ "Wrapper", "for", "scans", "commands" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Connection.php#L268-L271
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Connection.php
Connection.onReady
public function onReady() { $this->ptr =& $this->result; if (!isset($this->password)) { if (isset($this->pool->config->select->value)) { $this->select($this->pool->config->select->value); } parent::onReady(); $this->setWatermark(null, $...
php
public function onReady() { $this->ptr =& $this->result; if (!isset($this->password)) { if (isset($this->pool->config->select->value)) { $this->select($this->pool->config->select->value); } parent::onReady(); $this->setWatermark(null, $...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "ptr", "=", "&", "$", "this", "->", "result", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "password", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "pool"...
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/Redis/Connection.php#L290-L312
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Connection.php
Connection.onFinish
public function onFinish() { parent::onFinish(); if ($this->subscribed) { unset($this->pool->servConnSub[$this->url]); } /* we should reassign subscriptions */ foreach ($this->subscribeCb as $sub => $cbs) { foreach ($cbs as $cb) { $this...
php
public function onFinish() { parent::onFinish(); if ($this->subscribed) { unset($this->pool->servConnSub[$this->url]); } /* we should reassign subscriptions */ foreach ($this->subscribeCb as $sub => $cbs) { foreach ($cbs as $cb) { $this...
[ "public", "function", "onFinish", "(", ")", "{", "parent", "::", "onFinish", "(", ")", ";", "if", "(", "$", "this", "->", "subscribed", ")", "{", "unset", "(", "$", "this", "->", "pool", "->", "servConnSub", "[", "$", "this", "->", "url", "]", ")",...
Called when connection finishes @return void
[ "Called", "when", "connection", "finishes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Connection.php#L584-L601
kakserpom/phpdaemon
PHPDaemon/Clients/Redis/Connection.php
Connection.onRead
protected function onRead() { start: if ($this->state === static::STATE_STANDBY) { // outside of packet while (($l = $this->readline()) !== null) { if ($l === '') { continue; } $char = $l{0}; $val = mb_or...
php
protected function onRead() { start: if ($this->state === static::STATE_STANDBY) { // outside of packet while (($l = $this->readline()) !== null) { if ($l === '') { continue; } $char = $l{0}; $val = mb_or...
[ "protected", "function", "onRead", "(", ")", "{", "start", ":", "if", "(", "$", "this", "->", "state", "===", "static", "::", "STATE_STANDBY", ")", "{", "// outside of packet", "while", "(", "(", "$", "l", "=", "$", "this", "->", "readline", "(", ")", ...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Redis/Connection.php#L688-L756
kakserpom/phpdaemon
PHPDaemon/SockJS/WebSocketConnectionProxy.php
WebSocketConnectionProxy.&
public function &__get($k) { if (!isset($this->realConn->{$k})) { return $dummy; } return $this->realConn->{$k}; }
php
public function &__get($k) { if (!isset($this->realConn->{$k})) { return $dummy; } return $this->realConn->{$k}; }
[ "public", "function", "&", "__get", "(", "$", "k", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "realConn", "->", "{", "$", "k", "}", ")", ")", "{", "return", "$", "dummy", ";", "}", "return", "$", "this", "->", "realConn", "->", ...
__get @param string $k @return mixed
[ "__get" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/WebSocketConnectionProxy.php#L33-L39
kakserpom/phpdaemon
PHPDaemon/SockJS/WebSocketConnectionProxy.php
WebSocketConnectionProxy.sendFrame
public function sendFrame($data, $type = null, $cb = null) { $this->realConn->sendFrame('a' . $this->toJson([$data]), $type, $cb); return true; }
php
public function sendFrame($data, $type = null, $cb = null) { $this->realConn->sendFrame('a' . $this->toJson([$data]), $type, $cb); return true; }
[ "public", "function", "sendFrame", "(", "$", "data", ",", "$", "type", "=", "null", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "realConn", "->", "sendFrame", "(", "'a'", ".", "$", "this", "->", "toJson", "(", "[", "$", "data", "]",...
Sends a frame. @param string $data Frame's data. @param integer $type Frame's type. See the constants. @param callback $cb Optional. Callback called when the frame is received by client. @callback $cb ( ) @return boolean Success.
[ "Sends", "a", "frame", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/WebSocketConnectionProxy.php#L94-L98
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.setRedis
public function setRedis(\PHPDaemon\Clients\Redis\Pool $redis) { $this->redis = $redis; return $this; }
php
public function setRedis(\PHPDaemon\Clients\Redis\Pool $redis) { $this->redis = $redis; return $this; }
[ "public", "function", "setRedis", "(", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "$", "redis", ")", "{", "$", "this", "->", "redis", "=", "$", "redis", ";", "return", "$", "this", ";", "}" ]
Set Redis instance @param \PHPDaemon\Clients\Redis\Pool $redis @return $this
[ "Set", "Redis", "instance" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L23-L27
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.getLocalSubscribersCount
public function getLocalSubscribersCount($chan) { return $this->redis->getLocalSubscribersCount($this->config->redisprefix->value . $chan); }
php
public function getLocalSubscribersCount($chan) { return $this->redis->getLocalSubscribersCount($this->config->redisprefix->value . $chan); }
[ "public", "function", "getLocalSubscribersCount", "(", "$", "chan", ")", "{", "return", "$", "this", "->", "redis", "->", "getLocalSubscribersCount", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "chan", ")", ";", "}" ]
getLocalSubscribersCount @param string $chan @return integer
[ "getLocalSubscribersCount" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L34-L37
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.setnx
public function setnx($key, $value, $cb = null) { $this->redis->setnx($this->config->redisprefix->value . $key, $value, $cb); }
php
public function setnx($key, $value, $cb = null) { $this->redis->setnx($this->config->redisprefix->value . $key, $value, $cb); }
[ "public", "function", "setnx", "(", "$", "key", ",", "$", "value", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "setnx", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "key", ",", "$", ...
setnx @param string $key [@todo description] @param mixed $value [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "setnx" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L61-L64
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.setkey
public function setkey($key, $value, $cb = null) { $this->redis->set($this->config->redisprefix->value . $key, $value, $cb); }
php
public function setkey($key, $value, $cb = null) { $this->redis->set($this->config->redisprefix->value . $key, $value, $cb); }
[ "public", "function", "setkey", "(", "$", "key", ",", "$", "value", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "set", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "key", ",", "$", ...
setkey @param string $key [@todo description] @param mixed $value [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "setkey" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L74-L77
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.getkey
public function getkey($key, $cb = null) { $this->redis->get($this->config->redisprefix->value . $key, $cb); }
php
public function getkey($key, $cb = null) { $this->redis->get($this->config->redisprefix->value . $key, $cb); }
[ "public", "function", "getkey", "(", "$", "key", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "get", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "key", ",", "$", "cb", ")", ";", "}...
getkey @param string $key [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "getkey" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L86-L89
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.expire
public function expire($key, $seconds, $cb = null) { $this->redis->expire($this->config->redisprefix->value . $key, $seconds, $cb); }
php
public function expire($key, $seconds, $cb = null) { $this->redis->expire($this->config->redisprefix->value . $key, $seconds, $cb); }
[ "public", "function", "expire", "(", "$", "key", ",", "$", "seconds", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "expire", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "key", ",", "...
expire @param string $key [@todo description] @param integer $seconds [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "expire" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L99-L102
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.unsubscribeReal
public function unsubscribeReal($chan, $opcb = null) { $this->redis->unsubscribeReal($this->config->redisprefix->value . $chan, $opcb); }
php
public function unsubscribeReal($chan, $opcb = null) { $this->redis->unsubscribeReal($this->config->redisprefix->value . $chan, $opcb); }
[ "public", "function", "unsubscribeReal", "(", "$", "chan", ",", "$", "opcb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "unsubscribeReal", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "chan", ",", "$", ...
unsubscribeReal @param string $chan [@todo description] @param callable $opcb [@todo description] @callback $opcb ( ) @return void
[ "unsubscribeReal" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L125-L128
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.publish
public function publish($chan, $cb, $opcb = null) { $this->redis->publish($this->config->redisprefix->value . $chan, $cb, $opcb); }
php
public function publish($chan, $cb, $opcb = null) { $this->redis->publish($this->config->redisprefix->value . $chan, $cb, $opcb); }
[ "public", "function", "publish", "(", "$", "chan", ",", "$", "cb", ",", "$", "opcb", "=", "null", ")", "{", "$", "this", "->", "redis", "->", "publish", "(", "$", "this", "->", "config", "->", "redisprefix", "->", "value", ".", "$", "chan", ",", ...
publish @param string $chan [@todo description] @param callable $cb [@todo description] @param callable $opcb [@todo description] @callback $cb ( ) @callback $opcb ( ) @return void
[ "publish" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L139-L142
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.onReady
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance($this->config->redisname->value); $this->sessions = new ObjectStorage; $this->wss = new ObjectStorage; foreach (preg_split('~\s*;\s*~', $this->config->wssname->value) as $wssname) { $thi...
php
public function onReady() { $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance($this->config->redisname->value); $this->sessions = new ObjectStorage; $this->wss = new ObjectStorage; foreach (preg_split('~\s*;\s*~', $this->config->wssname->value) as $wssname) { $thi...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "redis", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "Redis", "\\", "Pool", "::", "getInstance", "(", "$", "this", "->", "config", "->", "redisname", "->", "value", ")", ";", "$", ...
Called when the worker is ready to go @return void
[ "Called", "when", "the", "worker", "is", "ready", "to", "go" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L148-L156
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.attachWss
public function attachWss($wss) { if ($this->wss->contains($wss)) { return false; } $this->wss->attach($wss); $wss->bind('customTransport', [$this, 'wsHandler']); return true; }
php
public function attachWss($wss) { if ($this->wss->contains($wss)) { return false; } $this->wss->attach($wss); $wss->bind('customTransport', [$this, 'wsHandler']); return true; }
[ "public", "function", "attachWss", "(", "$", "wss", ")", "{", "if", "(", "$", "this", "->", "wss", "->", "contains", "(", "$", "wss", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "wss", "->", "attach", "(", "$", "wss", ")", ";...
attachWss @param \PHPDaemon\Network\Pool $wss @return boolean
[ "attachWss" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L163-L171
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.onFinish
public function onFinish() { foreach ($this->attachedTo as $wss) { $this->detachWss($wss); } parent::onFinish(); }
php
public function onFinish() { foreach ($this->attachedTo as $wss) { $this->detachWss($wss); } parent::onFinish(); }
[ "public", "function", "onFinish", "(", ")", "{", "foreach", "(", "$", "this", "->", "attachedTo", "as", "$", "wss", ")", "{", "$", "this", "->", "detachWss", "(", "$", "wss", ")", ";", "}", "parent", "::", "onFinish", "(", ")", ";", "}" ]
onFinish @return void
[ "onFinish" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L177-L183
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.detachWss
public function detachWss($wss) { if (!$this->wss->contains($wss)) { return false; } $this->wss->detach($wss); $wss->unbind('transport', [$this, 'wsHandler']); return true; }
php
public function detachWss($wss) { if (!$this->wss->contains($wss)) { return false; } $this->wss->detach($wss); $wss->unbind('transport', [$this, 'wsHandler']); return true; }
[ "public", "function", "detachWss", "(", "$", "wss", ")", "{", "if", "(", "!", "$", "this", "->", "wss", "->", "contains", "(", "$", "wss", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "wss", "->", "detach", "(", "$", "wss", ")...
detachWss @param object $wss [@todo description] @return boolean
[ "detachWss" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L190-L198
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.wsHandler
public function wsHandler($ws, $path, $client, $state) { $e = explode('/', $path); $method = array_pop($e); $serverId = null; $sessId = null; if ($method !== 'websocket') { return false; } if (sizeof($e) < 3 || !isset($e[sizeof($e) - 2]) || !ctype_...
php
public function wsHandler($ws, $path, $client, $state) { $e = explode('/', $path); $method = array_pop($e); $serverId = null; $sessId = null; if ($method !== 'websocket') { return false; } if (sizeof($e) < 3 || !isset($e[sizeof($e) - 2]) || !ctype_...
[ "public", "function", "wsHandler", "(", "$", "ws", ",", "$", "path", ",", "$", "client", ",", "$", "state", ")", "{", "$", "e", "=", "explode", "(", "'/'", ",", "$", "path", ")", ";", "$", "method", "=", "array_pop", "(", "$", "e", ")", ";", ...
wsHandler @param object $ws [@todo description] @param string $path [@todo description] @param object $client [@todo description] @param callable $state [@todo description] @callback $state ( object $route ) @return boolean
[ "wsHandler" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L209-L233
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.beginSession
public function beginSession($path, $sessId, $server) { $session = new Session($this, $sessId, $server); foreach ($this->wss as $wss) { if ($session->route = $wss->getRoute($path, $session)) { break; } } if (!$session->route) { retu...
php
public function beginSession($path, $sessId, $server) { $session = new Session($this, $sessId, $server); foreach ($this->wss as $wss) { if ($session->route = $wss->getRoute($path, $session)) { break; } } if (!$session->route) { retu...
[ "public", "function", "beginSession", "(", "$", "path", ",", "$", "sessId", ",", "$", "server", ")", "{", "$", "session", "=", "new", "Session", "(", "$", "this", ",", "$", "sessId", ",", "$", "server", ")", ";", "foreach", "(", "$", "this", "->", ...
beginSession @param string $path [@todo description] @param string $sessId [@todo description] @param string $server [@todo description] @return object
[ "beginSession" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L242-L256
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.getRouteOptions
public function getRouteOptions($path) { $opts = [ 'websocket' => true, 'origins' => ['*:*'], 'cookie_needed' => false, ]; foreach ($this->wss as $wss) { if ($wss->routeExists($path)) { foreach ($wss->getRouteOptions($path) as $...
php
public function getRouteOptions($path) { $opts = [ 'websocket' => true, 'origins' => ['*:*'], 'cookie_needed' => false, ]; foreach ($this->wss as $wss) { if ($wss->routeExists($path)) { foreach ($wss->getRouteOptions($path) as $...
[ "public", "function", "getRouteOptions", "(", "$", "path", ")", "{", "$", "opts", "=", "[", "'websocket'", "=>", "true", ",", "'origins'", "=>", "[", "'*:*'", "]", ",", "'cookie_needed'", "=>", "false", ",", "]", ";", "foreach", "(", "$", "this", "->",...
getRouteOptions @param string $path [@todo description] @return array
[ "getRouteOptions" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L263-L279
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.beginRequest
public function beginRequest($req, $upstream) { $e = array_map('rawurldecode', explode('/', $req->attrs->server['DOCUMENT_URI'])); $serverId = null; $sessId = null; /* Route discovery */ $path = null; $extra = []; do { foreach ($this->wss as $wss...
php
public function beginRequest($req, $upstream) { $e = array_map('rawurldecode', explode('/', $req->attrs->server['DOCUMENT_URI'])); $serverId = null; $sessId = null; /* Route discovery */ $path = null; $extra = []; do { foreach ($this->wss as $wss...
[ "public", "function", "beginRequest", "(", "$", "req", ",", "$", "upstream", ")", "{", "$", "e", "=", "array_map", "(", "'rawurldecode'", ",", "explode", "(", "'/'", ",", "$", "req", "->", "attrs", "->", "server", "[", "'DOCUMENT_URI'", "]", ")", ")", ...
Creates Request. @param object $req Request. @param object $upstream Upstream application instance. @return object Request.
[ "Creates", "Request", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L297-L357
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.callMethod
public function callMethod($method, $req, $upstream) { $method = strtr(ucwords(strtr($method, ['_' => ' '])), [' ' => '']); if (strtolower($method) === 'generic') { $method = 'NotFound'; } $class = __NAMESPACE__ . '\\Methods\\' . $method; if (!class_exists($class)...
php
public function callMethod($method, $req, $upstream) { $method = strtr(ucwords(strtr($method, ['_' => ' '])), [' ' => '']); if (strtolower($method) === 'generic') { $method = 'NotFound'; } $class = __NAMESPACE__ . '\\Methods\\' . $method; if (!class_exists($class)...
[ "public", "function", "callMethod", "(", "$", "method", ",", "$", "req", ",", "$", "upstream", ")", "{", "$", "method", "=", "strtr", "(", "ucwords", "(", "strtr", "(", "$", "method", ",", "[", "'_'", "=>", "' '", "]", ")", ")", ",", "[", "' '", ...
callMethod @param string $method [@todo description] @param object $req [@todo description] @param object $upstream [@todo description] @return object
[ "callMethod" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L366-L377
kakserpom/phpdaemon
PHPDaemon/SockJS/Application.php
Application.getConfigDefaults
protected function getConfigDefaults() { return [ /* [string] @todo redis-name */ 'redis-name' => '', /* [string] @todo redis-prefix */ 'redis-prefix' => 'sockjs:', /* [string] @todo wss-name */ 'wss-name' => '', /* [Doub...
php
protected function getConfigDefaults() { return [ /* [string] @todo redis-name */ 'redis-name' => '', /* [string] @todo redis-prefix */ 'redis-prefix' => 'sockjs:', /* [string] @todo wss-name */ 'wss-name' => '', /* [Doub...
[ "protected", "function", "getConfigDefaults", "(", ")", "{", "return", "[", "/* [string] @todo redis-name */", "'redis-name'", "=>", "''", ",", "/* [string] @todo redis-prefix */", "'redis-prefix'", "=>", "'sockjs:'", ",", "/* [string] @todo wss-name */", "'wss-name'", "=>", ...
Setting default config options @return array|bool
[ "Setting", "default", "config", "options" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Application.php#L383-L413
kakserpom/phpdaemon
PHPDaemon/BoundSocket/UNIX.php
UNIX.bindSocket
public function bindSocket() { if ($this->erroneous) { return false; } if ($this->path === null && isset($this->uri['path'])) { $this->path = $this->uri['path']; } if (pathinfo($this->path, PATHINFO_EXTENSION) !== 'sock') { Daemon::$proce...
php
public function bindSocket() { if ($this->erroneous) { return false; } if ($this->path === null && isset($this->uri['path'])) { $this->path = $this->uri['path']; } if (pathinfo($this->path, PATHINFO_EXTENSION) !== 'sock') { Daemon::$proce...
[ "public", "function", "bindSocket", "(", ")", "{", "if", "(", "$", "this", "->", "erroneous", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "path", "===", "null", "&&", "isset", "(", "$", "this", "->", "uri", "[", "'path'", ...
Bind socket @return boolean Success.
[ "Bind", "socket" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/UNIX.php#L55-L102
kakserpom/phpdaemon
PHPDaemon/BoundSocket/UNIX.php
UNIX.onBound
protected function onBound() { touch($this->path); chmod($this->path, 0770); if ($this->group === null && !empty($this->uri['pass'])) { $this->group = $this->uri['pass']; } if ($this->group === null && isset(Daemon::$config->group->value)) { $this->gro...
php
protected function onBound() { touch($this->path); chmod($this->path, 0770); if ($this->group === null && !empty($this->uri['pass'])) { $this->group = $this->uri['pass']; } if ($this->group === null && isset(Daemon::$config->group->value)) { $this->gro...
[ "protected", "function", "onBound", "(", ")", "{", "touch", "(", "$", "this", "->", "path", ")", ";", "chmod", "(", "$", "this", "->", "path", ",", "0770", ")", ";", "if", "(", "$", "this", "->", "group", "===", "null", "&&", "!", "empty", "(", ...
Called when socket is bound @return boolean Success
[ "Called", "when", "socket", "is", "bound" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/UNIX.php#L108-L139
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleICMPRequest.php
ExampleICMPRequest.init
public function init() { $req = $this; $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done $req->wakeup(); // wake up the request immediately }); $job('pingjob', function ($name, $job) use ($req) { // registering job named 'pingjob' ...
php
public function init() { $req = $this; $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done $req->wakeup(); // wake up the request immediately }); $job('pingjob', function ($name, $job) use ($req) { // registering job named 'pingjob' ...
[ "public", "function", "init", "(", ")", "{", "$", "req", "=", "$", "this", ";", "$", "job", "=", "$", "this", "->", "job", "=", "new", "\\", "PHPDaemon", "\\", "Core", "\\", "ComplexJob", "(", "function", "(", ")", "use", "(", "$", "req", ")", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleICMPRequest.php#L12-L32
kakserpom/phpdaemon
PHPDaemon/Clients/Memcache/Connection.php
Connection.onRead
protected function onRead() { start: if ($this->state === self::STATE_ROOT) { while (($l = $this->readLine()) !== null) { $e = explode(' ', $l); if ($e[0] === 'VALUE') { $this->key = $e[1]; $this->valueFlags = $e[2]...
php
protected function onRead() { start: if ($this->state === self::STATE_ROOT) { while (($l = $this->readLine()) !== null) { $e = explode(' ', $l); if ($e[0] === 'VALUE') { $this->key = $e[1]; $this->valueFlags = $e[2]...
[ "protected", "function", "onRead", "(", ")", "{", "start", ":", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_ROOT", ")", "{", "while", "(", "(", "$", "l", "=", "$", "this", "->", "readLine", "(", ")", ")", "!==", "null", ")"...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Memcache/Connection.php#L57-L100
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/Connection.php
Connection.onReady
public function onReady() { $this->createXMLStream(); $this->startXMLStream(); $this->keepaliveTimer = setTimeout(function ($timer) { $this->ping(); }, 1e6 * 30); }
php
public function onReady() { $this->createXMLStream(); $this->startXMLStream(); $this->keepaliveTimer = setTimeout(function ($timer) { $this->ping(); }, 1e6 * 30); }
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "createXMLStream", "(", ")", ";", "$", "this", "->", "startXMLStream", "(", ")", ";", "$", "this", "->", "keepaliveTimer", "=", "setTimeout", "(", "function", "(", "$", "timer", ")", "{...
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/XMPP/Connection.php#L66-L73
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/Connection.php
Connection.onFinish
public function onFinish() { parent::onFinish(); $this->event('disconnect'); if (isset($this->xml)) { $this->xml->finish(); } unset($this->roster); if ($this->keepaliveTimer) { Timer::remove($this->keepaliveTimer); } }
php
public function onFinish() { parent::onFinish(); $this->event('disconnect'); if (isset($this->xml)) { $this->xml->finish(); } unset($this->roster); if ($this->keepaliveTimer) { Timer::remove($this->keepaliveTimer); } }
[ "public", "function", "onFinish", "(", ")", "{", "parent", "::", "onFinish", "(", ")", ";", "$", "this", "->", "event", "(", "'disconnect'", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "xml", ")", ")", "{", "$", "this", "->", "xml", "->...
Called when session finishes @return void
[ "Called", "when", "session", "finishes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/XMPP/Connection.php#L79-L90
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/Connection.php
Connection.message
public function message($to, $body, $type = 'chat', $subject = null, $payload = null) { if ($type === null) { $type = 'chat'; } $to = htmlspecialchars($to); $body = htmlspecialchars($body); $subject = htmlspecialchars($subject); $out = '<message from="' ...
php
public function message($to, $body, $type = 'chat', $subject = null, $payload = null) { if ($type === null) { $type = 'chat'; } $to = htmlspecialchars($to); $body = htmlspecialchars($body); $subject = htmlspecialchars($subject); $out = '<message from="' ...
[ "public", "function", "message", "(", "$", "to", ",", "$", "body", ",", "$", "type", "=", "'chat'", ",", "$", "subject", "=", "null", ",", "$", "payload", "=", "null", ")", "{", "if", "(", "$", "type", "===", "null", ")", "{", "$", "type", "=",...
Send XMPP Message @param string $to @param string $body @param string $type @param string $subject
[ "Send", "XMPP", "Message" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/XMPP/Connection.php#L323-L344
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/Connection.php
Connection.presence
public function presence($status = null, $show = 'available', $to = null, $type = 'available', $priority = 0) { if ($type === 'available') { $type = ''; } $to = htmlspecialchars($to); $status = htmlspecialchars($status); $show = htmlspecialchars($show); $t...
php
public function presence($status = null, $show = 'available', $to = null, $type = 'available', $priority = 0) { if ($type === 'available') { $type = ''; } $to = htmlspecialchars($to); $status = htmlspecialchars($status); $show = htmlspecialchars($show); $t...
[ "public", "function", "presence", "(", "$", "status", "=", "null", ",", "$", "show", "=", "'available'", ",", "$", "to", "=", "null", ",", "$", "type", "=", "'available'", ",", "$", "priority", "=", "0", ")", "{", "if", "(", "$", "type", "===", "...
Set Presence @param string $status @param string $show @param string $to @param string $type @param integer $priority
[ "Set", "Presence" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/XMPP/Connection.php#L354-L393
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/Connection.php
Connection.onRead
public function onRead() { Timer::setTimeout($this->keepaliveTimer); if (isset($this->xml)) { $this->xml->feed($this->readUnlimited()); } }
php
public function onRead() { Timer::setTimeout($this->keepaliveTimer); if (isset($this->xml)) { $this->xml->feed($this->readUnlimited()); } }
[ "public", "function", "onRead", "(", ")", "{", "Timer", "::", "setTimeout", "(", "$", "this", "->", "keepaliveTimer", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "xml", ")", ")", "{", "$", "this", "->", "xml", "->", "feed", "(", "$", "t...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/XMPP/Connection.php#L434-L440
kakserpom/phpdaemon
Examples/ExampleIMAPClient.php
ExampleIMAPClient.onReady
public function onReady() { \PHPDaemon\Clients\IMAP\Pool::getInstance()->open( $this->config->host->value, $this->config->login->value, $this->config->password->value, function ($conn) { if (!$conn) { $this->log('Fail to ope...
php
public function onReady() { \PHPDaemon\Clients\IMAP\Pool::getInstance()->open( $this->config->host->value, $this->config->login->value, $this->config->password->value, function ($conn) { if (!$conn) { $this->log('Fail to ope...
[ "public", "function", "onReady", "(", ")", "{", "\\", "PHPDaemon", "\\", "Clients", "\\", "IMAP", "\\", "Pool", "::", "getInstance", "(", ")", "->", "open", "(", "$", "this", "->", "config", "->", "host", "->", "value", ",", "$", "this", "->", "confi...
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/Examples/ExampleIMAPClient.php#L25-L48
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionTuneOkFrame.php
ConnectionTuneOkFrame.create
public static function create( $channelMax = null, $frameMax = null, $heartbeat = null ) { $frame = new self(); if (null !== $channelMax) { $frame->channelMax = $channelMax; } if (null !== $frameMax) { $frame->frameMax = $frameMax; } ...
php
public static function create( $channelMax = null, $frameMax = null, $heartbeat = null ) { $frame = new self(); if (null !== $channelMax) { $frame->channelMax = $channelMax; } if (null !== $frameMax) { $frame->frameMax = $frameMax; } ...
[ "public", "static", "function", "create", "(", "$", "channelMax", "=", "null", ",", "$", "frameMax", "=", "null", ",", "$", "heartbeat", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "channel...
short
[ "short" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionTuneOkFrame.php#L22-L39
kakserpom/phpdaemon
PHPDaemon/Examples/TelnetHoneypot.php
TelnetHoneypotConnection.onRead
public function onRead() { while (!is_null($line = $this->readline())) { $finish = (mb_orig_strpos($line, $s = "\xff\xf4\xff\xfd\x06") !== false) || (mb_orig_strpos($line, $s = "\xff\xec") !== false) || (mb_orig_strpos($line, $s = "\x03") !== false...
php
public function onRead() { while (!is_null($line = $this->readline())) { $finish = (mb_orig_strpos($line, $s = "\xff\xf4\xff\xfd\x06") !== false) || (mb_orig_strpos($line, $s = "\xff\xec") !== false) || (mb_orig_strpos($line, $s = "\x03") !== false...
[ "public", "function", "onRead", "(", ")", "{", "while", "(", "!", "is_null", "(", "$", "line", "=", "$", "this", "->", "readline", "(", ")", ")", ")", "{", "$", "finish", "=", "(", "mb_orig_strpos", "(", "$", "line", ",", "$", "s", "=", "\"\\xff\...
Called when new data received. @return void
[ "Called", "when", "new", "data", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/TelnetHoneypot.php#L35-L66
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelOpenOkFrame.php
ChannelOpenOkFrame.create
public static function create( $channelId = null ) { $frame = new self(); if (null !== $channelId) { $frame->channelId = $channelId; } return $frame; }
php
public static function create( $channelId = null ) { $frame = new self(); if (null !== $channelId) { $frame->channelId = $channelId; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "channelId", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "channelId", ")", "{", "$", "frame", "->", "channelId", "=", "$", "channelId", "...
longstr
[ "longstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelOpenOkFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.convertFlags
public static function convertFlags($mode, $text = false) { $plus = mb_orig_strpos($mode, '+') !== false; $sync = mb_orig_strpos($mode, 's') !== false; $type = strtr($mode, ['b' => '', '+' => '', 's' => '', '!' => '']); if ($text) { return $type; } $types ...
php
public static function convertFlags($mode, $text = false) { $plus = mb_orig_strpos($mode, '+') !== false; $sync = mb_orig_strpos($mode, 's') !== false; $type = strtr($mode, ['b' => '', '+' => '', 's' => '', '!' => '']); if ($text) { return $type; } $types ...
[ "public", "static", "function", "convertFlags", "(", "$", "mode", ",", "$", "text", "=", "false", ")", "{", "$", "plus", "=", "mb_orig_strpos", "(", "$", "mode", ",", "'+'", ")", "!==", "false", ";", "$", "sync", "=", "mb_orig_strpos", "(", "$", "mod...
Converts string of flags to integer or standard text representation @param string $mode Mode @param boolean $text Text? @return mixed
[ "Converts", "string", "of", "flags", "to", "integer", "or", "standard", "text", "representation" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L105-L125
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.truncate
public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd || $this->fd === -1) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
php
public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd || $this->fd === -1) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
[ "public", "function", "truncate", "(", "$", "offset", "=", "0", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "...
Truncates this file @param integer $offset Offset. Default is 0 @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Truncates", "this", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L134-L152
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.stat
public function stat($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd || $this->fd === -1) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, F...
php
public function stat($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd || $this->fd === -1) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, F...
[ "public", "function", "stat", "(", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "this", "->", "fd", "||", "$", "this", "->", "fd...
Stat() @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Stat", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L160-L182
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.statvfs
public function statvfs($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { if ($cb) { $c...
php
public function statvfs($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { if ($cb) { $c...
[ "public", "function", "statvfs", "(", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "this", "->", "fd", ")", "{", "if", "(", "$",...
Statvfs() @param callable $cb Callback @param integer $pri Priority @return resource|boolean
[ "Statvfs", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L216-L239
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.sync
public function sync($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, true); re...
php
public function sync($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, true); re...
[ "public", "function", "sync", "(", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "this", "->", "fd", ")", "{", "if", "(", "$", ...
Sync() @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "Sync", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L247-L261
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.datasync
public function datasync($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, true); ...
php
public function datasync($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $cb($this, true); ...
[ "public", "function", "datasync", "(", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "this", "->", "fd", ")", "{", "if", "(", "$"...
Datasync() @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "Datasync", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L269-L283
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.write
public function write($data, $cb = null, $offset = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if ($data === '') { if ($cb) { ...
php
public function write($data, $cb = null, $offset = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if ($data === '') { if ($cb) { ...
[ "public", "function", "write", "(", "$", "data", ",", "$", "cb", "=", "null", ",", "$", "offset", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", ...
Writes data to file @param string $data Data @param callable $cb Callback @param integer $offset Offset @param integer $pri Priority @return resource|false
[ "Writes", "data", "to", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L293-L340
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.chown
public function chown($uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $r = ch...
php
public function chown($uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $r = ch...
[ "public", "function", "chown", "(", "$", "uid", ",", "$", "gid", "=", "-", "1", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", ...
Changes ownership of this file @param integer $uid User ID @param integer $gid Group ID @param callable $cb = null Callback @param integer $pri = EIO_PRI_DEFAULT Priority @return resource|false
[ "Changes", "ownership", "of", "this", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L350-L370
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.touch
public function touch($mtime, $atime = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $...
php
public function touch($mtime, $atime = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { $...
[ "public", "function", "touch", "(", "$", "mtime", ",", "$", "atime", "=", "null", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", ...
touch() @param integer $mtime Last modification time @param integer $atime Last access time @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "touch", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L380-L397
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.read
public function read($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
php
public function read($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
[ "public", "function", "read", "(", "$", "length", ",", "$", "offset", "=", "null", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if",...
Reads data from file @param integer $length Length @param integer $offset Offset @param callable $cb Callback @param integer $pri Priority @return boolean
[ "Reads", "data", "from", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L417-L444
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.sendfile
public function sendfile($outfd, $cb, $startCb = null, $offset = 0, $length = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::...
php
public function sendfile($outfd, $cb, $startCb = null, $offset = 0, $length = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::...
[ "public", "function", "sendfile", "(", "$", "outfd", ",", "$", "cb", ",", "$", "startCb", "=", "null", ",", "$", "offset", "=", "0", ",", "$", "length", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrappe...
sendfile() @param mixed $outfd File descriptor @param callable $cb Callback @param callable $startCb Start callback @param integer $offset Offset @param integer $length Length @param integer $pri Priority @return boolean Success
[ "sendfile", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L456-L537
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.readahead
public function readahead($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
php
public function readahead($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } if (!FileSystem::$supported) { ...
[ "public", "function", "readahead", "(", "$", "length", ",", "$", "offset", "=", "null", ",", "$", "cb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", ...
readahead() @param integer $length Length @param integer $offset Offset @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "readahead", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L547-L571
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.readAllGenHandler
protected function readAllGenHandler($cb, $size, &$offset, &$pri, &$buf) { return function ($file, $data) use ($cb, $size, &$offset, &$pri, &$buf) { $buf .= $data; $offset += mb_orig_strlen($data); $len = min($file->chunkSize, $size - $offset); if ($offset >= ...
php
protected function readAllGenHandler($cb, $size, &$offset, &$pri, &$buf) { return function ($file, $data) use ($cb, $size, &$offset, &$pri, &$buf) { $buf .= $data; $offset += mb_orig_strlen($data); $len = min($file->chunkSize, $size - $offset); if ($offset >= ...
[ "protected", "function", "readAllGenHandler", "(", "$", "cb", ",", "$", "size", ",", "&", "$", "offset", ",", "&", "$", "pri", ",", "&", "$", "buf", ")", "{", "return", "function", "(", "$", "file", ",", "$", "data", ")", "use", "(", "$", "cb", ...
Generates closure-callback for readAll @param callable $cb @param integer $size @param integer &$offset @param integer &$pri @param string &$buf @return callable
[ "Generates", "closure", "-", "callback", "for", "readAll" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L582-L596
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.readAll
public function readAll($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } $this->statRefresh( function ($file, $stat) use ($cb, $pri) ...
php
public function readAll($cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } $this->statRefresh( function ($file, $stat) use ($cb, $pri) ...
[ "public", "function", "readAll", "(", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "$", "this", "->", "fd", ")", "{", "if", "(", "$",...
Reads whole file @param callable $cb Callback @param integer $pri Priority @return boolean Success
[ "Reads", "whole", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L604-L639
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.readAllChunkedGenHandler
protected function readAllChunkedGenHandler($cb, $chunkcb, $size, &$offset, $pri) { return function ($file, $data) use ($cb, $chunkcb, $size, &$offset, $pri) { $chunkcb($file, $data); $offset += mb_orig_strlen($data); $len = min($file->chunkSize, $size - $offset); ...
php
protected function readAllChunkedGenHandler($cb, $chunkcb, $size, &$offset, $pri) { return function ($file, $data) use ($cb, $chunkcb, $size, &$offset, $pri) { $chunkcb($file, $data); $offset += mb_orig_strlen($data); $len = min($file->chunkSize, $size - $offset); ...
[ "protected", "function", "readAllChunkedGenHandler", "(", "$", "cb", ",", "$", "chunkcb", ",", "$", "size", ",", "&", "$", "offset", ",", "$", "pri", ")", "{", "return", "function", "(", "$", "file", ",", "$", "data", ")", "use", "(", "$", "cb", ",...
Generates closure-callback for readAllChunked @param callable $cb @param callable $chunkcb @param integer $size @param integer $offset @param integer $pri @return callable
[ "Generates", "closure", "-", "callback", "for", "readAllChunked" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L650-L671
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.readAllChunked
public function readAllChunked($cb = null, $chunkcb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } return $this->statRefresh( fu...
php
public function readAllChunked($cb = null, $chunkcb = null, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!$this->fd) { if ($cb) { $cb($this, false); } return false; } return $this->statRefresh( fu...
[ "public", "function", "readAllChunked", "(", "$", "cb", "=", "null", ",", "$", "chunkcb", "=", "null", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", ...
Reads file chunk-by-chunk @param callable $cb Callback @param callable $chunkcb Callback of chunk @param integer $pri Priority @return resource|false
[ "Reads", "file", "chunk", "-", "by", "-", "chunk" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L680-L710
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.seek
public function seek($offset, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!\EIO::$supported) { fseek($this->fd, $offset); return false; } return eio_seek($this->fd, $offset, $pri, $cb, $this); }
php
public function seek($offset, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!\EIO::$supported) { fseek($this->fd, $offset); return false; } return eio_seek($this->fd, $offset, $pri, $cb, $this); }
[ "public", "function", "seek", "(", "$", "offset", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "$", "cb", "=", "CallbackWrapper", "::", "forceWrap", "(", "$", "cb", ")", ";", "if", "(", "!", "\\", "EIO", "::", "$", "supported"...
Move pointer to arbitrary position @param integer $offset Offset @param callable $cb Callback @param integer $pri Priority @return resource|false
[ "Move", "pointer", "to", "arbitrary", "position" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L738-L746
kakserpom/phpdaemon
PHPDaemon/FS/File.php
File.close
public function close() { if ($this->closed) { return false; } $this->closed = true; if ($this->fdCacheKey !== null) { FileSystem::$fdCache->invalidate($this->fdCacheKey); } if ($this->fd === null) { return false; } ...
php
public function close() { if ($this->closed) { return false; } $this->closed = true; if ($this->fdCacheKey !== null) { FileSystem::$fdCache->invalidate($this->fdCacheKey); } if ($this->fd === null) { return false; } ...
[ "public", "function", "close", "(", ")", "{", "if", "(", "$", "this", "->", "closed", ")", "{", "return", "false", ";", "}", "$", "this", "->", "closed", "=", "true", ";", "if", "(", "$", "this", "->", "fdCacheKey", "!==", "null", ")", "{", "File...
Close the file @return resource|false
[ "Close", "the", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/FS/File.php#L764-L784
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.httpReadFirstline
protected function httpReadFirstline() { //D($this->look(2048)); if (($l = $this->readline()) === null) { return null; } $e = explode(' ', $l); $u = isset($e[1]) ? parse_url($e[1]) : false; if ($u === false) { $this->badRequest($this->req); ...
php
protected function httpReadFirstline() { //D($this->look(2048)); if (($l = $this->readline()) === null) { return null; } $e = explode(' ', $l); $u = isset($e[1]) ? parse_url($e[1]) : false; if ($u === false) { $this->badRequest($this->req); ...
[ "protected", "function", "httpReadFirstline", "(", ")", "{", "//D($this->look(2048));", "if", "(", "(", "$", "l", "=", "$", "this", "->", "readline", "(", ")", ")", "===", "null", ")", "{", "return", "null", ";", "}", "$", "e", "=", "explode", "(", "...
Read first line of HTTP request @return boolean|null Success
[ "Read", "first", "line", "of", "HTTP", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L88-L120
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.newRequest
protected function newRequest() { $req = new \stdClass; $req->attrs = new \stdClass(); $req->attrs->request = []; $req->attrs->get = []; $req->attrs->post = []; $req->attrs->cookie = []; $req->attrs->server = []; $req->attrs->files = []; $req->...
php
protected function newRequest() { $req = new \stdClass; $req->attrs = new \stdClass(); $req->attrs->request = []; $req->attrs->get = []; $req->attrs->post = []; $req->attrs->cookie = []; $req->attrs->server = []; $req->attrs->files = []; $req->...
[ "protected", "function", "newRequest", "(", ")", "{", "$", "req", "=", "new", "\\", "stdClass", ";", "$", "req", "->", "attrs", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "req", "->", "attrs", "->", "request", "=", "[", "]", ";", "$", "req...
Creates new Request object @return \stdClass
[ "Creates", "new", "Request", "object" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L152-L170
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.httpProcessHeaders
protected function httpProcessHeaders() { $this->req->attrs->paramsDone = true; if (isset($this->req->attrs->server['HTTP_CONNECTION']) && preg_match('~(?:^|\W)Upgrade(?:\W|$)~i', $this->req->attrs->server['HTTP_CONNECTION']) && isset($this->req->attrs->server['HTTP_UPGRADE']...
php
protected function httpProcessHeaders() { $this->req->attrs->paramsDone = true; if (isset($this->req->attrs->server['HTTP_CONNECTION']) && preg_match('~(?:^|\W)Upgrade(?:\W|$)~i', $this->req->attrs->server['HTTP_CONNECTION']) && isset($this->req->attrs->server['HTTP_UPGRADE']...
[ "protected", "function", "httpProcessHeaders", "(", ")", "{", "$", "this", "->", "req", "->", "attrs", "->", "paramsDone", "=", "true", ";", "if", "(", "isset", "(", "$", "this", "->", "req", "->", "attrs", "->", "server", "[", "'HTTP_CONNECTION'", "]", ...
Process HTTP headers @return boolean Success
[ "Process", "HTTP", "headers" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L176-L220
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.onRead
protected function onRead() { if (!$this->policyReqNotFound) { $d = $this->drainIfMatch("<policy-file-request/>\x00"); if ($d === null) { // partially match return; } if ($d) { $FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInsta...
php
protected function onRead() { if (!$this->policyReqNotFound) { $d = $this->drainIfMatch("<policy-file-request/>\x00"); if ($d === null) { // partially match return; } if ($d) { $FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInsta...
[ "protected", "function", "onRead", "(", ")", "{", "if", "(", "!", "$", "this", "->", "policyReqNotFound", ")", "{", "$", "d", "=", "$", "this", "->", "drainIfMatch", "(", "\"<policy-file-request/>\\x00\"", ")", ";", "if", "(", "$", "d", "===", "null", ...
onRead @return void
[ "onRead" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L243-L345
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.requestOut
public function requestOut($req, $s) { if ($this->write($s) === false) { $req->abort(); return false; } return true; }
php
public function requestOut($req, $s) { if ($this->write($s) === false) { $req->abort(); return false; } return true; }
[ "public", "function", "requestOut", "(", "$", "req", ",", "$", "s", ")", "{", "if", "(", "$", "this", "->", "write", "(", "$", "s", ")", "===", "false", ")", "{", "$", "req", "->", "abort", "(", ")", ";", "return", "false", ";", "}", "return", ...
Handles the output from downstream requests. @param object $req \PHPDaemon\Request\Generic. @param string $s The output. @return boolean Success
[ "Handles", "the", "output", "from", "downstream", "requests", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L353-L360
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.endRequest
public function endRequest($req, $appStatus, $protoStatus) { if ($protoStatus === -1) { $this->close(); } else { if ($req->attrs->chunked) { $this->write("0\r\n\r\n"); } if (isset($req->keepalive) && $req->keepalive && $this->pool->con...
php
public function endRequest($req, $appStatus, $protoStatus) { if ($protoStatus === -1) { $this->close(); } else { if ($req->attrs->chunked) { $this->write("0\r\n\r\n"); } if (isset($req->keepalive) && $req->keepalive && $this->pool->con...
[ "public", "function", "endRequest", "(", "$", "req", ",", "$", "appStatus", ",", "$", "protoStatus", ")", "{", "if", "(", "$", "protoStatus", "===", "-", "1", ")", "{", "$", "this", "->", "close", "(", ")", ";", "}", "else", "{", "if", "(", "$", ...
End request @return void
[ "End", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L366-L384
kakserpom/phpdaemon
PHPDaemon/Servers/HTTP/Connection.php
Connection.freeRequest
public function freeRequest($req) { if ($this->state !== self::STATE_PROCESSING) { $this->freedBeforeProcessing = true; return; } $req->attrs->input = null; $this->req = null; $this->state = self::STATE_ROOT; $this->unfreezeInput(); }
php
public function freeRequest($req) { if ($this->state !== self::STATE_PROCESSING) { $this->freedBeforeProcessing = true; return; } $req->attrs->input = null; $this->req = null; $this->state = self::STATE_ROOT; $this->unfreezeInput(); }
[ "public", "function", "freeRequest", "(", "$", "req", ")", "{", "if", "(", "$", "this", "->", "state", "!==", "self", "::", "STATE_PROCESSING", ")", "{", "$", "this", "->", "freedBeforeProcessing", "=", "true", ";", "return", ";", "}", "$", "req", "->"...
Frees this request @return void
[ "Frees", "this", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Connection.php#L390-L400