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/Clients/IMAP/Connection.php
Connection.renameFolder
public function renameFolder($cb, $oldName, $newName) { $this->onResponse->push($cb); $this->writeln(self::TAG_RENAMEFOLDER . " RENAME " .$this->escapeString($oldName)." ".$this->escapeString($newName)); }
php
public function renameFolder($cb, $oldName, $newName) { $this->onResponse->push($cb); $this->writeln(self::TAG_RENAMEFOLDER . " RENAME " .$this->escapeString($oldName)." ".$this->escapeString($newName)); }
[ "public", "function", "renameFolder", "(", "$", "cb", ",", "$", "oldName", ",", "$", "newName", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "writeln", "(", "self", "::", "TAG_RENAMEFOLDER", "....
rename and/or move folder @param string $oldName name or instance of folder @param string $newName new global name of folder
[ "rename", "and", "/", "or", "move", "folder" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L585-L590
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.removeMessage
public function removeMessage($cb, $uid) { $this->onResponse->push($cb); $this->store([self::FLAG_DELETED], $uid, null, '+', true, self::TAG_DELETEMESSAGE); }
php
public function removeMessage($cb, $uid) { $this->onResponse->push($cb); $this->store([self::FLAG_DELETED], $uid, null, '+', true, self::TAG_DELETEMESSAGE); }
[ "public", "function", "removeMessage", "(", "$", "cb", ",", "$", "uid", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "$", "this", "->", "store", "(", "[", "self", "::", "FLAG_DELETED", "]", ",", "$", "uid", "...
Remove a message from server. @param int $uid unique number of message
[ "Remove", "a", "message", "from", "server", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L596-L600
kakserpom/phpdaemon
PHPDaemon/Clients/IMAP/Connection.php
Connection.logout
public function logout($cb = null) { if ($cb) { $this->onResponse->push($cb); } $this->writeln(self::TAG_LOGOUT . " LOGOUT"); }
php
public function logout($cb = null) { if ($cb) { $this->onResponse->push($cb); } $this->writeln(self::TAG_LOGOUT . " LOGOUT"); }
[ "public", "function", "logout", "(", "$", "cb", "=", "null", ")", "{", "if", "(", "$", "cb", ")", "{", "$", "this", "->", "onResponse", "->", "push", "(", "$", "cb", ")", ";", "}", "$", "this", "->", "writeln", "(", "self", "::", "TAG_LOGOUT", ...
logout of imap server
[ "logout", "of", "imap", "server" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/IMAP/Connection.php#L605-L611
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.onConnected
public function onConnected($cb) { if ($this->state === self::CONN_STATE_HANDSHAKED_ERROR) { $cb($this); } elseif ($this->state === self::CONN_STATE_HANDSHAKED_OK) { $cb($this); } else { if (!$this->onConnected) { $this->onConnected = new S...
php
public function onConnected($cb) { if ($this->state === self::CONN_STATE_HANDSHAKED_ERROR) { $cb($this); } elseif ($this->state === self::CONN_STATE_HANDSHAKED_OK) { $cb($this); } else { if (!$this->onConnected) { $this->onConnected = new S...
[ "public", "function", "onConnected", "(", "$", "cb", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "CONN_STATE_HANDSHAKED_ERROR", ")", "{", "$", "cb", "(", "$", "this", ")", ";", "}", "elseif", "(", "$", "this", "->", "state",...
Execute the given callback when/if the connection is handshaked @param callable Callback @return void
[ "Execute", "the", "given", "callback", "when", "/", "if", "the", "connection", "is", "handshaked" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L127-L140
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.onReady
public function onReady() { if ($this->url === null) { return; } if ($this->connected && !$this->busy) { $this->pool->servConnFree[$this->url]->attach($this); } $url = parse_url($this->url); $this->username = $url['user']; $this->sec...
php
public function onReady() { if ($this->url === null) { return; } if ($this->connected && !$this->busy) { $this->pool->servConnFree[$this->url]->attach($this); } $url = parse_url($this->url); $this->username = $url['user']; $this->sec...
[ "public", "function", "onReady", "(", ")", "{", "if", "(", "$", "this", "->", "url", "===", "null", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "connected", "&&", "!", "$", "this", "->", "busy", ")", "{", "$", "this", "->", "poo...
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/Asterisk/Connection.php#L146-L160
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.gracefulShutdown
public function gracefulShutdown() { if ($this->finished) { return !$this->writing; } $this->logoff(); $this->finish(); return false; }
php
public function gracefulShutdown() { if ($this->finished) { return !$this->writing; } $this->logoff(); $this->finish(); return false; }
[ "public", "function", "gracefulShutdown", "(", ")", "{", "if", "(", "$", "this", "->", "finished", ")", "{", "return", "!", "$", "this", "->", "writing", ";", "}", "$", "this", "->", "logoff", "(", ")", ";", "$", "this", "->", "finish", "(", ")", ...
Called when the worker is going to shutdown @return boolean Ready to shutdown?
[ "Called", "when", "the", "worker", "is", "going", "to", "shutdown" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L166-L177
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.onRead
public function onRead() { if ($this->state === self::CONN_STATE_START) { if (($ver = $this->readline()) === null) { return; } $this->pool->setAmiVersion($this->addr, $ver); $this->state = self::CONN_STATE_GOT_INITIAL_PACKET; $this-...
php
public function onRead() { if ($this->state === self::CONN_STATE_START) { if (($ver = $this->readline()) === null) { return; } $this->pool->setAmiVersion($this->addr, $ver); $this->state = self::CONN_STATE_GOT_INITIAL_PACKET; $this-...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "CONN_STATE_START", ")", "{", "if", "(", "(", "$", "ver", "=", "$", "this", "->", "readline", "(", ")", ")", "===", "null", ")", "{", "retu...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L196-L309
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.auth
protected function auth() { if ($this->state !== self::CONN_STATE_GOT_INITIAL_PACKET) { return; } if ($this->pool->config->authtype->value === 'md5') { $this->challenge(function ($conn, $challenge) { $packet = "Action: Login\r\n" ....
php
protected function auth() { if ($this->state !== self::CONN_STATE_GOT_INITIAL_PACKET) { return; } if ($this->pool->config->authtype->value === 'md5') { $this->challenge(function ($conn, $challenge) { $packet = "Action: Login\r\n" ....
[ "protected", "function", "auth", "(", ")", "{", "if", "(", "$", "this", "->", "state", "!==", "self", "::", "CONN_STATE_GOT_INITIAL_PACKET", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "pool", "->", "config", "->", "authtype", "->", "va...
Send authentication packet @return void
[ "Send", "authentication", "packet" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L315-L335
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.login
protected function login() { $this->state = self::CONN_STATE_LOGIN_PACKET_SENT; $this->write( "Action: login\r\n" . "Username: " . $this->username . "\r\n" . "Secret: " . $this->secret . "\r\n" . "Events: on\r\n" . "\r\n" ); }
php
protected function login() { $this->state = self::CONN_STATE_LOGIN_PACKET_SENT; $this->write( "Action: login\r\n" . "Username: " . $this->username . "\r\n" . "Secret: " . $this->secret . "\r\n" . "Events: on\r\n" . "\r\n" ); }
[ "protected", "function", "login", "(", ")", "{", "$", "this", "->", "state", "=", "self", "::", "CONN_STATE_LOGIN_PACKET_SENT", ";", "$", "this", "->", "write", "(", "\"Action: login\\r\\n\"", ".", "\"Username: \"", ".", "$", "this", "->", "username", ".", "...
Action: Login Synopsis: Login Manager Privilege: <none> @return void
[ "Action", ":", "Login", "Synopsis", ":", "Login", "Manager", "Privilege", ":", "<none", ">" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L344-L354
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.challenge
protected function challenge($cb) { $this->onChallenge = $cb; $this->state = self::CONN_STATE_CHALLENGE_PACKET_SENT; $this->write( "Action: Challenge\r\n" . "AuthType: MD5\r\n" . "\r\n" ); }
php
protected function challenge($cb) { $this->onChallenge = $cb; $this->state = self::CONN_STATE_CHALLENGE_PACKET_SENT; $this->write( "Action: Challenge\r\n" . "AuthType: MD5\r\n" . "\r\n" ); }
[ "protected", "function", "challenge", "(", "$", "cb", ")", "{", "$", "this", "->", "onChallenge", "=", "$", "cb", ";", "$", "this", "->", "state", "=", "self", "::", "CONN_STATE_CHALLENGE_PACKET_SENT", ";", "$", "this", "->", "write", "(", "\"Action: Chall...
Action: Challenge Synopsis: Generate Challenge for MD5 Auth Privilege: <none> @param callable $cb @return void
[ "Action", ":", "Challenge", "Synopsis", ":", "Generate", "Challenge", "for", "MD5", "Auth", "Privilege", ":", "<none", ">" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L364-L373
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.setVar
public function setVar($channel, $variable, $value, $cb) { $cmd = "Action: SetVar\r\n"; if ($channel) { $cmd .= "Channel: " . trim($channel) . "\r\n"; } if (isset($variable, $value)) { $cmd .= "Variable: " . trim($variable) . "\r\n" . "Value:...
php
public function setVar($channel, $variable, $value, $cb) { $cmd = "Action: SetVar\r\n"; if ($channel) { $cmd .= "Channel: " . trim($channel) . "\r\n"; } if (isset($variable, $value)) { $cmd .= "Variable: " . trim($variable) . "\r\n" . "Value:...
[ "public", "function", "setVar", "(", "$", "channel", ",", "$", "variable", ",", "$", "value", ",", "$", "cb", ")", "{", "$", "cmd", "=", "\"Action: SetVar\\r\\n\"", ";", "if", "(", "$", "channel", ")", "{", "$", "cmd", ".=", "\"Channel: \"", ".", "tr...
Action: Setvar Synopsis: Set Channel Variable Privilege: call,all Description: Set a global or local channel variable. Variables: (Names marked with * are required) Channel: Channel to set variable for *Variable: Variable name *Value: Value @param string $channel @param string $variable @param string $value @param cal...
[ "Action", ":", "Setvar", "Synopsis", ":", "Set", "Channel", "Variable", "Privilege", ":", "call", "all", "Description", ":", "Set", "a", "global", "or", "local", "channel", "variable", ".", "Variables", ":", "(", "Names", "marked", "with", "*", "are", "req...
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L465-L479
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.status
public function status($cb, $channel = null) { $cmd = "Action: Status\r\n"; if ($channel !== null) { $cmd .= 'Channel: ' . trim($channel) . "\r\n"; } $this->command($cmd, $cb, ['event' => 'statuscomplete']); }
php
public function status($cb, $channel = null) { $cmd = "Action: Status\r\n"; if ($channel !== null) { $cmd .= 'Channel: ' . trim($channel) . "\r\n"; } $this->command($cmd, $cb, ['event' => 'statuscomplete']); }
[ "public", "function", "status", "(", "$", "cb", ",", "$", "channel", "=", "null", ")", "{", "$", "cmd", "=", "\"Action: Status\\r\\n\"", ";", "if", "(", "$", "channel", "!==", "null", ")", "{", "$", "cmd", ".=", "'Channel: '", ".", "trim", "(", "$", ...
Action: Status Synopsis: Lists channel status Privilege: system,call,reporting,all Description: Lists channel status along with requested channel vars. Variables: (Names marked with * are required) Channel: Name of the channel to query for status Variables: Comma ',' separated list of variables to include ActionID: Opt...
[ "Action", ":", "Status", "Synopsis", ":", "Lists", "channel", "status", "Privilege", ":", "system", "call", "reporting", "all", "Description", ":", "Lists", "channel", "status", "along", "with", "requested", "channel", "vars", ".", "Variables", ":", "(", "Name...
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L520-L529
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.originate
public function originate(array $params, $cb) { $params['Async'] = 1; $this->command("Action: Originate\r\n" . $this->implodeParams($params), $cb); }
php
public function originate(array $params, $cb) { $params['Async'] = 1; $this->command("Action: Originate\r\n" . $this->implodeParams($params), $cb); }
[ "public", "function", "originate", "(", "array", "$", "params", ",", "$", "cb", ")", "{", "$", "params", "[", "'Async'", "]", "=", "1", ";", "$", "this", "->", "command", "(", "\"Action: Originate\\r\\n\"", ".", "$", "this", "->", "implodeParams", "(", ...
Action: Originate Synopsis: Originate a call Privilege: call,all Description: first the Channel is rung. Then, when that answers, the Extension is dialled within the Context to initiate the other end of the call. Variables: (Names marked with * are required) *Channel: Channel on which to originate the call (The same as...
[ "Action", ":", "Originate", "Synopsis", ":", "Originate", "a", "call", "Privilege", ":", "call", "all", "Description", ":", "first", "the", "Channel", "is", "rung", ".", "Then", "when", "that", "answers", "the", "Extension", "is", "dialled", "within", "the",...
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L578-L583
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.action
public function action($action, $cb, array $params = null, array $assertion = null) { $action = trim($action); $this->command("Action: {$action}\r\n" . ($params ? $this->implodeParams($params) : ''), $cb, $assertion); }
php
public function action($action, $cb, array $params = null, array $assertion = null) { $action = trim($action); $this->command("Action: {$action}\r\n" . ($params ? $this->implodeParams($params) : ''), $cb, $assertion); }
[ "public", "function", "action", "(", "$", "action", ",", "$", "cb", ",", "array", "$", "params", "=", "null", ",", "array", "$", "assertion", "=", "null", ")", "{", "$", "action", "=", "trim", "(", "$", "action", ")", ";", "$", "this", "->", "com...
For almost any actions in Action: ListCommands Privilege: depends on $action @param string $action Action @param callable $cb Callback called when response received @param array $params Parameters @param array $assertion If more events may follow as response this is a main part or full an action complete event indicat...
[ "For", "almost", "any", "actions", "in", "Action", ":", "ListCommands", "Privilege", ":", "depends", "on", "$action" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L630-L635
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.command
protected function command($packet, $cb, $assertion = null) { if ($this->finished) { throw new ConnectionFinished; } if ($this->state !== self::CONN_STATE_HANDSHAKED_OK) { return; } $actionId = Daemon::uniqid(); if (!is_callable($cb, true)) ...
php
protected function command($packet, $cb, $assertion = null) { if ($this->finished) { throw new ConnectionFinished; } if ($this->state !== self::CONN_STATE_HANDSHAKED_OK) { return; } $actionId = Daemon::uniqid(); if (!is_callable($cb, true)) ...
[ "protected", "function", "command", "(", "$", "packet", ",", "$", "cb", ",", "$", "assertion", "=", "null", ")", "{", "if", "(", "$", "this", "->", "finished", ")", "{", "throw", "new", "ConnectionFinished", ";", "}", "if", "(", "$", "this", "->", ...
Sends arbitrary command @param string $packet A packet for sending by the connected client to Asterisk @param callable $cb Callback called when response received @param array $assertion If more events may follow as response this is a main part or full an action complete event indicating that all data has been sent
[ "Sends", "arbitrary", "command" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L670-L694
kakserpom/phpdaemon
PHPDaemon/Clients/Asterisk/Connection.php
Connection.implodeParams
protected function implodeParams(array $params) { $s = ''; foreach ($params as $header => $value) { $s .= trim($header) . ": " . trim($value) . "\r\n"; } return $s; }
php
protected function implodeParams(array $params) { $s = ''; foreach ($params as $header => $value) { $s .= trim($header) . ": " . trim($value) . "\r\n"; } return $s; }
[ "protected", "function", "implodeParams", "(", "array", "$", "params", ")", "{", "$", "s", "=", "''", ";", "foreach", "(", "$", "params", "as", "$", "header", "=>", "$", "value", ")", "{", "$", "s", ".=", "trim", "(", "$", "header", ")", ".", "\"...
Generate AMI packet string from associative array provided @param array $params @return string
[ "Generate", "AMI", "packet", "string", "from", "associative", "array", "provided" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Asterisk/Connection.php#L701-L710
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.unfreeze
public function unfreeze($at_front = false) { $f = $this->frozen; $this->frozen = false; //parent::unfreeze($at_front); // @TODO: discuss related pecl-event/libevent bug $this->onRead(); if ($f && $this->EOF) { $this->onEOF(); } $this->req->checkIf...
php
public function unfreeze($at_front = false) { $f = $this->frozen; $this->frozen = false; //parent::unfreeze($at_front); // @TODO: discuss related pecl-event/libevent bug $this->onRead(); if ($f && $this->EOF) { $this->onEOF(); } $this->req->checkIf...
[ "public", "function", "unfreeze", "(", "$", "at_front", "=", "false", ")", "{", "$", "f", "=", "$", "this", "->", "frozen", ";", "$", "this", "->", "frozen", "=", "false", ";", "//parent::unfreeze($at_front); // @TODO: discuss related pecl-event/libevent bug", "$"...
Unfreeze input @param boolean $at_front At front. Default is true. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until...
[ "Unfreeze", "input" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L100-L110
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.onRead
protected function onRead() { if (!empty($this->boundary)) { $this->req->attrs->input->parseMultipart(); } if (($this->req->attrs->contentLength <= $this->readed) && !$this->EOF) { $this->sendEOF(); } }
php
protected function onRead() { if (!empty($this->boundary)) { $this->req->attrs->input->parseMultipart(); } if (($this->req->attrs->contentLength <= $this->readed) && !$this->EOF) { $this->sendEOF(); } }
[ "protected", "function", "onRead", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "boundary", ")", ")", "{", "$", "this", "->", "req", "->", "attrs", "->", "input", "->", "parseMultipart", "(", ")", ";", "}", "if", "(", "(", "$",...
onRead @return void
[ "onRead" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L116-L124
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.onEOF
protected function onEOF() { if (!$this->req) { return; } if ($this->frozen) { return; } if ($this->req->attrs->inputDone) { return; } $this->curPart =& $foo; $this->req->attrs->inputDone = true; $this->req->...
php
protected function onEOF() { if (!$this->req) { return; } if ($this->frozen) { return; } if ($this->req->attrs->inputDone) { return; } $this->curPart =& $foo; $this->req->attrs->inputDone = true; $this->req->...
[ "protected", "function", "onEOF", "(", ")", "{", "if", "(", "!", "$", "this", "->", "req", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "frozen", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "req", "->", "attrs", ...
onEOF @return void
[ "onEOF" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L142-L167
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.readFromBuffer
public function readFromBuffer(\EventBuffer $buf) { if (!$this->req) { return false; } $n = min($this->req->attrs->contentLength - $this->readed, $buf->length); if ($n > 0) { $m = $this->appendFrom($buf, $n); $this->readed += $m; if ($m...
php
public function readFromBuffer(\EventBuffer $buf) { if (!$this->req) { return false; } $n = min($this->req->attrs->contentLength - $this->readed, $buf->length); if ($n > 0) { $m = $this->appendFrom($buf, $n); $this->readed += $m; if ($m...
[ "public", "function", "readFromBuffer", "(", "\\", "EventBuffer", "$", "buf", ")", "{", "if", "(", "!", "$", "this", "->", "req", ")", "{", "return", "false", ";", "}", "$", "n", "=", "min", "(", "$", "this", "->", "req", "->", "attrs", "->", "co...
Moves $n bytes from input buffer to arbitrary buffer @param \EventBuffer $buf Source nuffer @return integer
[ "Moves", "$n", "bytes", "from", "input", "buffer", "to", "arbitrary", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L202-L219
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.readFromString
public function readFromString($chunk, $final = true) { $this->add($chunk); $this->readed += mb_orig_strlen($chunk); if ($final) { $this->onRead(); } }
php
public function readFromString($chunk, $final = true) { $this->add($chunk); $this->readed += mb_orig_strlen($chunk); if ($final) { $this->onRead(); } }
[ "public", "function", "readFromString", "(", "$", "chunk", ",", "$", "final", "=", "true", ")", "{", "$", "this", "->", "add", "(", "$", "chunk", ")", ";", "$", "this", "->", "readed", "+=", "mb_orig_strlen", "(", "$", "chunk", ")", ";", "if", "(",...
Append string to input buffer @param string $chunk Piece of request input @param boolean $final Final call is THIS SEQUENCE of calls (not mandatory final in request)? @return void
[ "Append", "string", "to", "input", "buffer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L227-L234
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.look
public function look($n, $o = 0) { if ($this->length <= $o) { return ''; } return $this->substr($o, $n); }
php
public function look($n, $o = 0) { if ($this->length <= $o) { return ''; } return $this->substr($o, $n); }
[ "public", "function", "look", "(", "$", "n", ",", "$", "o", "=", "0", ")", "{", "if", "(", "$", "this", "->", "length", "<=", "$", "o", ")", "{", "return", "''", ";", "}", "return", "$", "this", "->", "substr", "(", "$", "o", ",", "$", "n",...
Read from buffer without draining @param integer $n Number of bytes to read @param integer $o Offset @return string
[ "Read", "from", "buffer", "without", "draining" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L243-L249
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.parseMultipart
public function parseMultipart() { start: if ($this->frozen) { return; } if ($this->state === self::STATE_SEEKBOUNDARY) { // seek to the nearest boundary if (($p = $this->search('--' . $this->boundary . "\r\n")) === false) { return;...
php
public function parseMultipart() { start: if ($this->frozen) { return; } if ($this->state === self::STATE_SEEKBOUNDARY) { // seek to the nearest boundary if (($p = $this->search('--' . $this->boundary . "\r\n")) === false) { return;...
[ "public", "function", "parseMultipart", "(", ")", "{", "start", ":", "if", "(", "$", "this", "->", "frozen", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_SEEKBOUNDARY", ")", "{", "// seek to the nearest...
Parses multipart @return void
[ "Parses", "multipart" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L256-L394
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.getChunkString
public function getChunkString() { if (!$this->curChunkSize) { return false; } $chunk = $this->read($this->curChunkSize); $this->curChunkSize = null; return $chunk; }
php
public function getChunkString() { if (!$this->curChunkSize) { return false; } $chunk = $this->read($this->curChunkSize); $this->curChunkSize = null; return $chunk; }
[ "public", "function", "getChunkString", "(", ")", "{", "if", "(", "!", "$", "this", "->", "curChunkSize", ")", "{", "return", "false", ";", "}", "$", "chunk", "=", "$", "this", "->", "read", "(", "$", "this", "->", "curChunkSize", ")", ";", "$", "t...
Get current upload chunk as string @return string Chunk body
[ "Get", "current", "upload", "chunk", "as", "string" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L410-L418
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Input.php
Input.writeChunkToFd
public function writeChunkToFd($fd, $cb = null) { return false; // It is not supported yet (callback missing in EventBuffer->write()) if (!$this->curChunkSize) { return false; } $this->write($fd, $this->curChunkSize); $this->curChunkSize = null; return tru...
php
public function writeChunkToFd($fd, $cb = null) { return false; // It is not supported yet (callback missing in EventBuffer->write()) if (!$this->curChunkSize) { return false; } $this->write($fd, $this->curChunkSize); $this->curChunkSize = null; return tru...
[ "public", "function", "writeChunkToFd", "(", "$", "fd", ",", "$", "cb", "=", "null", ")", "{", "return", "false", ";", "// It is not supported yet (callback missing in EventBuffer->write())", "if", "(", "!", "$", "this", "->", "curChunkSize", ")", "{", "return", ...
Write current upload chunk to file descriptor @todo It is not supported yet (callback missing in EventBuffer->write()) @param mixed $fd File destriptor @param callable $cb Callback @return boolean Success
[ "Write", "current", "upload", "chunk", "to", "file", "descriptor" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Input.php#L427-L436
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelCloseFrame.php
ChannelCloseFrame.create
public static function create( $replyCode = null, $replyText = null, $classId = null, $methodId = null ) { $frame = new self(); if (null !== $replyCode) { $frame->replyCode = $replyCode; } if (null !== $replyText) { $frame->replyText = $replyText;...
php
public static function create( $replyCode = null, $replyText = null, $classId = null, $methodId = null ) { $frame = new self(); if (null !== $replyCode) { $frame->replyCode = $replyCode; } if (null !== $replyText) { $frame->replyText = $replyText;...
[ "public", "static", "function", "create", "(", "$", "replyCode", "=", "null", ",", "$", "replyText", "=", "null", ",", "$", "classId", "=", "null", ",", "$", "methodId", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", ...
short
[ "short" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Channel/ChannelCloseFrame.php#L24-L44
kakserpom/phpdaemon
PHPDaemon/Clients/DNS/Pool.php
Pool.applyConfig
public function applyConfig() { parent::applyConfig(); $pool = $this; if (!isset($this->preloading)) { $this->preloading = new ComplexJob(); } $job = $this->preloading; $job->addJob('resolvfile', function ($jobname, $job) use ($pool) { FileSyst...
php
public function applyConfig() { parent::applyConfig(); $pool = $this; if (!isset($this->preloading)) { $this->preloading = new ComplexJob(); } $job = $this->preloading; $job->addJob('resolvfile', function ($jobname, $job) use ($pool) { FileSyst...
[ "public", "function", "applyConfig", "(", ")", "{", "parent", "::", "applyConfig", "(", ")", ";", "$", "pool", "=", "$", "this", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "preloading", ")", ")", "{", "$", "this", "->", "preloading", "="...
Applies config @return void
[ "Applies", "config" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/DNS/Pool.php#L158-L201
kakserpom/phpdaemon
PHPDaemon/Clients/DNS/Pool.php
Pool.resolve
public function resolve($hostname, $cb, $noncache = false, $nameServers = []) { if (!$this->preloading->hasCompleted()) { $pool = $this; $this->preloading->addListener(function ($job) use ($hostname, $cb, $noncache, $pool, $nameServers) { $pool->resolve($hostname, $cb...
php
public function resolve($hostname, $cb, $noncache = false, $nameServers = []) { if (!$this->preloading->hasCompleted()) { $pool = $this; $this->preloading->addListener(function ($job) use ($hostname, $cb, $noncache, $pool, $nameServers) { $pool->resolve($hostname, $cb...
[ "public", "function", "resolve", "(", "$", "hostname", ",", "$", "cb", ",", "$", "noncache", "=", "false", ",", "$", "nameServers", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "preloading", "->", "hasCompleted", "(", ")", ")", "{", ...
Resolves the host @param string $hostname Hostname @param callable $cb Callback @param boolean $noncache Noncache? @param array $nameServers @callback $cb ( array|string $addrs ) @return void
[ "Resolves", "the", "host" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/DNS/Pool.php#L212-L275
kakserpom/phpdaemon
PHPDaemon/Clients/DNS/Pool.php
Pool.get
public function get($hostname, $cb, $noncache = false, $nameServers = [], $proto = 'udp') { $pool = $this; if (!$nameServers) { $nameServers = $this->nameServers; } if (!$this->preloading->hasCompleted()) { $this->preloading->addListener(function ($job) use ( ...
php
public function get($hostname, $cb, $noncache = false, $nameServers = [], $proto = 'udp') { $pool = $this; if (!$nameServers) { $nameServers = $this->nameServers; } if (!$this->preloading->hasCompleted()) { $this->preloading->addListener(function ($job) use ( ...
[ "public", "function", "get", "(", "$", "hostname", ",", "$", "cb", ",", "$", "noncache", "=", "false", ",", "$", "nameServers", "=", "[", "]", ",", "$", "proto", "=", "'udp'", ")", "{", "$", "pool", "=", "$", "this", ";", "if", "(", "!", "$", ...
Gets the host information @param string $hostname Hostname @param callable $cb Callback @param boolean $noncache Noncache? @param array $nameServers @param string $proto @callback $cb ( ) @return void
[ "Gets", "the", "host", "information" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/DNS/Pool.php#L287-L346
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.preinit
protected function preinit($req) { if ($req === null) { $req = new \stdClass; $req->attrs = new \stdClass; $req->attrs->inputDone = true; $req->attrs->paramsDone = true; $req->attrs->chunked = false; } $this->attrs = $req->attrs; ...
php
protected function preinit($req) { if ($req === null) { $req = new \stdClass; $req->attrs = new \stdClass; $req->attrs->inputDone = true; $req->attrs->paramsDone = true; $req->attrs->chunked = false; } $this->attrs = $req->attrs; ...
[ "protected", "function", "preinit", "(", "$", "req", ")", "{", "if", "(", "$", "req", "===", "null", ")", "{", "$", "req", "=", "new", "\\", "stdClass", ";", "$", "req", "->", "attrs", "=", "new", "\\", "stdClass", ";", "$", "req", "->", "attrs",...
Preparing before init @param object $req Source request @return void
[ "Preparing", "before", "init" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L140-L159
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.sendfile
public function sendfile($path, $cb, $pri = EIO_PRI_DEFAULT) { if ($this->state === self::STATE_FINISHED) { return false; } try { $this->header('Content-Type: ' . MIME::get($path)); } catch (RequestHeadersAlreadySent $e) { } if ($this->upstream...
php
public function sendfile($path, $cb, $pri = EIO_PRI_DEFAULT) { if ($this->state === self::STATE_FINISHED) { return false; } try { $this->header('Content-Type: ' . MIME::get($path)); } catch (RequestHeadersAlreadySent $e) { } if ($this->upstream...
[ "public", "function", "sendfile", "(", "$", "path", ",", "$", "cb", ",", "$", "pri", "=", "EIO_PRI_DEFAULT", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_FINISHED", ")", "{", "return", "false", ";", "}", "try", "{", ...
Output whole contents of file @param string $path Path @param callable $cb Callback @param integer $pri Priority @return boolean Success
[ "Output", "whole", "contents", "of", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L177-L224
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.checkIfReady
public function checkIfReady() { if (!$this->attrs->paramsDone || !$this->attrs->inputDone) { return false; } if (isset($this->appInstance->passphrase)) { if (!isset($this->attrs->server['PASSPHRASE']) || ($this->appInstance->passphrase !== $this->attr...
php
public function checkIfReady() { if (!$this->attrs->paramsDone || !$this->attrs->inputDone) { return false; } if (isset($this->appInstance->passphrase)) { if (!isset($this->attrs->server['PASSPHRASE']) || ($this->appInstance->passphrase !== $this->attr...
[ "public", "function", "checkIfReady", "(", ")", "{", "if", "(", "!", "$", "this", "->", "attrs", "->", "paramsDone", "||", "!", "$", "this", "->", "attrs", "->", "inputDone", ")", "{", "return", "false", ";", "}", "if", "(", "isset", "(", "$", "thi...
Called to check if Request is ready @return boolean Ready?
[ "Called", "to", "check", "if", "Request", "is", "ready" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L240-L264
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.parseParams
protected function parseParams() { if (!isset($this->attrs->server['HTTP_CONTENT_LENGTH'])) { $this->attrs->contentLength = 0; } else { $this->attrs->contentLength = (int)$this->attrs->server['HTTP_CONTENT_LENGTH']; } if (isset($this->attrs->server['CONTENT_T...
php
protected function parseParams() { if (!isset($this->attrs->server['HTTP_CONTENT_LENGTH'])) { $this->attrs->contentLength = 0; } else { $this->attrs->contentLength = (int)$this->attrs->server['HTTP_CONTENT_LENGTH']; } if (isset($this->attrs->server['CONTENT_T...
[ "protected", "function", "parseParams", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "attrs", "->", "server", "[", "'HTTP_CONTENT_LENGTH'", "]", ")", ")", "{", "$", "this", "->", "attrs", "->", "contentLength", "=", "0", ";", "}", ...
Parses GET-query string and other request's headers @return void
[ "Parses", "GET", "-", "query", "string", "and", "other", "request", "s", "headers" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L279-L339
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.postPrepare
public function postPrepare() { if (!$this->attrs->server['REQUEST_METHOD_POST']) { return; } if (isset($this->attrs->server['REQUEST_PREPARED_UPLOADS']) && $this->attrs->server['REQUEST_PREPARED_UPLOADS'] === 'nginx') { if (isset($this->attrs->server['REQUEST_PREPARE...
php
public function postPrepare() { if (!$this->attrs->server['REQUEST_METHOD_POST']) { return; } if (isset($this->attrs->server['REQUEST_PREPARED_UPLOADS']) && $this->attrs->server['REQUEST_PREPARED_UPLOADS'] === 'nginx') { if (isset($this->attrs->server['REQUEST_PREPARE...
[ "public", "function", "postPrepare", "(", ")", "{", "if", "(", "!", "$", "this", "->", "attrs", "->", "server", "[", "'REQUEST_METHOD_POST'", "]", ")", "{", "return", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "attrs", "->", "server", "[",...
Prepares the request body @return void
[ "Prepares", "the", "request", "body" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L345-L402
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.ensureSentHeaders
public function ensureSentHeaders() { if ($this->headers_sent) { return true; } if (isset($this->headers['STATUS'])) { $h = (isset($this->attrs->noHttpVer) && ($this->attrs->noHttpVer) ? 'Status: ' : $this->attrs->server['SERVER_PROTOCOL']) . ' ' . $this->headers['STA...
php
public function ensureSentHeaders() { if ($this->headers_sent) { return true; } if (isset($this->headers['STATUS'])) { $h = (isset($this->attrs->noHttpVer) && ($this->attrs->noHttpVer) ? 'Status: ' : $this->attrs->server['SERVER_PROTOCOL']) . ' ' . $this->headers['STA...
[ "public", "function", "ensureSentHeaders", "(", ")", "{", "if", "(", "$", "this", "->", "headers_sent", ")", "{", "return", "true", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "headers", "[", "'STATUS'", "]", ")", ")", "{", "$", "h", "=",...
Ensure that headers are sent @return boolean Were already sent?
[ "Ensure", "that", "headers", "are", "sent" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L408-L452
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.out
public function out($s, $flush = true) { if ($flush) { if (!Daemon::$obInStack) { // preventing recursion ob_flush(); } } if ($this->aborted) { return false; } if (!isset($this->upstream)) { return false; ...
php
public function out($s, $flush = true) { if ($flush) { if (!Daemon::$obInStack) { // preventing recursion ob_flush(); } } if ($this->aborted) { return false; } if (!isset($this->upstream)) { return false; ...
[ "public", "function", "out", "(", "$", "s", ",", "$", "flush", "=", "true", ")", "{", "if", "(", "$", "flush", ")", "{", "if", "(", "!", "Daemon", "::", "$", "obInStack", ")", "{", "// preventing recursion", "ob_flush", "(", ")", ";", "}", "}", "...
Output some data @param string $s String to out @param boolean $flush ob_flush? @return boolean Success
[ "Output", "some", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L460-L510
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.combinedOut
public function combinedOut($s) { if (!$this->headers_sent) { $e = explode("\r\n\r\n", $s, 2); $h = explode("\r\n", $e[0]); foreach ($h as $l) { $this->header($l); } if (isset($e[1])) { return $this->out($e[1]); ...
php
public function combinedOut($s) { if (!$this->headers_sent) { $e = explode("\r\n\r\n", $s, 2); $h = explode("\r\n", $e[0]); foreach ($h as $l) { $this->header($l); } if (isset($e[1])) { return $this->out($e[1]); ...
[ "public", "function", "combinedOut", "(", "$", "s", ")", "{", "if", "(", "!", "$", "this", "->", "headers_sent", ")", "{", "$", "e", "=", "explode", "(", "\"\\r\\n\\r\\n\"", ",", "$", "s", ",", "2", ")", ";", "$", "h", "=", "explode", "(", "\"\\r...
Outputs data with headers (split by \r\n\r\n) @param string $s Data @return boolean Success
[ "Outputs", "data", "with", "headers", "(", "split", "by", "\\", "r", "\\", "n", "\\", "r", "\\", "n", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L525-L543
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.onWakeup
public function onWakeup() { parent::onWakeup(); if (!Daemon::$obInStack) { // preventing recursion @ob_flush(); } $_GET = &$this->attrs->get; $_POST = &$this->attrs->post; $_COOKIE = &$this->attrs->cookie; $_REQUEST = &$this->attrs->request; ...
php
public function onWakeup() { parent::onWakeup(); if (!Daemon::$obInStack) { // preventing recursion @ob_flush(); } $_GET = &$this->attrs->get; $_POST = &$this->attrs->post; $_COOKIE = &$this->attrs->cookie; $_REQUEST = &$this->attrs->request; ...
[ "public", "function", "onWakeup", "(", ")", "{", "parent", "::", "onWakeup", "(", ")", ";", "if", "(", "!", "Daemon", "::", "$", "obInStack", ")", "{", "// preventing recursion", "@", "ob_flush", "(", ")", ";", "}", "$", "_GET", "=", "&", "$", "this"...
Called when the request wakes up @return void
[ "Called", "when", "the", "request", "wakes", "up" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L559-L572
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.onSleep
public function onSleep() { if (!Daemon::$obInStack) { // preventing recursion @ob_flush(); } unset($_GET); unset($_POST); unset($_COOKIE); unset($_REQUEST); unset($_SESSION); unset($_FILES); unset($_SERVER); parent::onSleep...
php
public function onSleep() { if (!Daemon::$obInStack) { // preventing recursion @ob_flush(); } unset($_GET); unset($_POST); unset($_COOKIE); unset($_REQUEST); unset($_SESSION); unset($_FILES); unset($_SERVER); parent::onSleep...
[ "public", "function", "onSleep", "(", ")", "{", "if", "(", "!", "Daemon", "::", "$", "obInStack", ")", "{", "// preventing recursion", "@", "ob_flush", "(", ")", ";", "}", "unset", "(", "$", "_GET", ")", ";", "unset", "(", "$", "_POST", ")", ";", "...
Called when the request starts sleep @return void
[ "Called", "when", "the", "request", "starts", "sleep" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L578-L591
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.status
public function status($code = 200) { if (!isset(self::$codes[$code])) { return false; } $this->header($code . ' ' . self::$codes[$code]); return true; }
php
public function status($code = 200) { if (!isset(self::$codes[$code])) { return false; } $this->header($code . ' ' . self::$codes[$code]); return true; }
[ "public", "function", "status", "(", "$", "code", "=", "200", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "codes", "[", "$", "code", "]", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "header", "(", "$", "code", ...
Send HTTP-status @param integer $code Code @throws RequestHeadersAlreadySent @return boolean Success
[ "Send", "HTTP", "-", "status" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L599-L606
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.headersSent
public function headersSent(&$file, &$line) { $file = $this->headers_sent_file; $line = $this->headers_sent_line; return $this->headers_sent; }
php
public function headersSent(&$file, &$line) { $file = $this->headers_sent_file; $line = $this->headers_sent_line; return $this->headers_sent; }
[ "public", "function", "headersSent", "(", "&", "$", "file", ",", "&", "$", "line", ")", "{", "$", "file", "=", "$", "this", "->", "headers_sent_file", ";", "$", "line", "=", "$", "this", "->", "headers_sent_line", ";", "return", "$", "this", "->", "h...
Checks if headers have been sent @param string &$file File name @param integer &$line Line in file @return boolean Success
[ "Checks", "if", "headers", "have", "been", "sent" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L614-L619
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.setcookie
public function setcookie( $name, $value = '', $maxage = 0, $path = '', $domain = '', $secure = false, $HTTPOnly = false ) { $this->header( 'Set-Cookie: ' . $name . '=' . rawurlencode($value) . (empty($domain) ? '' : '; Domain='...
php
public function setcookie( $name, $value = '', $maxage = 0, $path = '', $domain = '', $secure = false, $HTTPOnly = false ) { $this->header( 'Set-Cookie: ' . $name . '=' . rawurlencode($value) . (empty($domain) ? '' : '; Domain='...
[ "public", "function", "setcookie", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "maxage", "=", "0", ",", "$", "path", "=", "''", ",", "$", "domain", "=", "''", ",", "$", "secure", "=", "false", ",", "$", "HTTPOnly", "=", "false", "...
Set the cookie @param string $name Name of cookie @param string $value Value @param integer $maxage Optional. Max-Age. Default is 0 @param string $path Optional. Path. Default is empty string @param string $domain Optional. Domain. Default is empty string @param boolean $secure Optional. Secure. Default is false @param...
[ "Set", "the", "cookie" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L641-L659
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.parseSize
public static function parseSize($value) { $l = substr($value, -1); if ($l === 'b' || $l === 'B') { return ((int)substr($value, 0, -1)); } if ($l === 'k') { return ((int)substr($value, 0, -1) * 1000); } if ($l === 'K') { return (...
php
public static function parseSize($value) { $l = substr($value, -1); if ($l === 'b' || $l === 'B') { return ((int)substr($value, 0, -1)); } if ($l === 'k') { return ((int)substr($value, 0, -1) * 1000); } if ($l === 'K') { return (...
[ "public", "static", "function", "parseSize", "(", "$", "value", ")", "{", "$", "l", "=", "substr", "(", "$", "value", ",", "-", "1", ")", ";", "if", "(", "$", "l", "===", "'b'", "||", "$", "l", "===", "'B'", ")", "{", "return", "(", "(", "int...
Converts human-readable representation of size to number of bytes @param string $value String of size @return integer
[ "Converts", "human", "-", "readable", "representation", "of", "size", "to", "number", "of", "bytes" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L742-L775
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.onUploadFileStart
public function onUploadFileStart($in) { $this->freezeInput(); FileSystem::tempnam(ini_get('upload_tmp_dir'), 'php', function ($fp) use ($in) { if (!$fp) { $in->curPart['fp'] = false; $in->curPart['error'] = UPLOAD_ERR_NO_TMP_DIR; } else { ...
php
public function onUploadFileStart($in) { $this->freezeInput(); FileSystem::tempnam(ini_get('upload_tmp_dir'), 'php', function ($fp) use ($in) { if (!$fp) { $in->curPart['fp'] = false; $in->curPart['error'] = UPLOAD_ERR_NO_TMP_DIR; } else { ...
[ "public", "function", "onUploadFileStart", "(", "$", "in", ")", "{", "$", "this", "->", "freezeInput", "(", ")", ";", "FileSystem", "::", "tempnam", "(", "ini_get", "(", "'upload_tmp_dir'", ")", ",", "'php'", ",", "function", "(", "$", "fp", ")", "use", ...
Called when file upload started @param Input $in Input buffer @return void
[ "Called", "when", "file", "upload", "started" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L782-L795
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.onUploadFileChunk
public function onUploadFileChunk($in, $last = false) { if ($in->curPart['error'] !== UPLOAD_ERR_OK) { // just drop the chunk return; } $cb = function ($fp, $result) use ($last, $in) { if ($last) { unset($in->curPart['fp']); } ...
php
public function onUploadFileChunk($in, $last = false) { if ($in->curPart['error'] !== UPLOAD_ERR_OK) { // just drop the chunk return; } $cb = function ($fp, $result) use ($last, $in) { if ($last) { unset($in->curPart['fp']); } ...
[ "public", "function", "onUploadFileChunk", "(", "$", "in", ",", "$", "last", "=", "false", ")", "{", "if", "(", "$", "in", "->", "curPart", "[", "'error'", "]", "!==", "UPLOAD_ERR_OK", ")", "{", "// just drop the chunk", "return", ";", "}", "$", "cb", ...
Called when chunk of incoming file has arrived @param Input $in Input buffer @param boolean $last Last? @return void
[ "Called", "when", "chunk", "of", "incoming", "file", "has", "arrived" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L803-L826
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.unfreezeInput
protected function unfreezeInput() { $this->upstream->unfreezeInput(); if (isset($this->attrs->input)) { $this->attrs->input->unfreeze(); } }
php
protected function unfreezeInput() { $this->upstream->unfreezeInput(); if (isset($this->attrs->input)) { $this->attrs->input->unfreeze(); } }
[ "protected", "function", "unfreezeInput", "(", ")", "{", "$", "this", "->", "upstream", "->", "unfreezeInput", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "attrs", "->", "input", ")", ")", "{", "$", "this", "->", "attrs", "->", "input"...
Unfreeze input @return void
[ "Unfreeze", "input" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L842-L848
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.isUploadedFile
public function isUploadedFile($path) { if (!$path) { return false; } if (mb_orig_strpos($path, $this->getUploadTempDir() . '/') !== 0) { return false; } foreach ($this->attrs->files as $file) { if ($file['tmp_name'] === $path) { ...
php
public function isUploadedFile($path) { if (!$path) { return false; } if (mb_orig_strpos($path, $this->getUploadTempDir() . '/') !== 0) { return false; } foreach ($this->attrs->files as $file) { if ($file['tmp_name'] === $path) { ...
[ "public", "function", "isUploadedFile", "(", "$", "path", ")", "{", "if", "(", "!", "$", "path", ")", "{", "return", "false", ";", "}", "if", "(", "mb_orig_strpos", "(", "$", "path", ",", "$", "this", "->", "getUploadTempDir", "(", ")", ".", "'/'", ...
Tells whether the file was uploaded via HTTP POST @param string $path The filename being checked @return boolean Whether if this is uploaded file
[ "Tells", "whether", "the", "file", "was", "uploaded", "via", "HTTP", "POST" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L867-L881
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.moveUploadedFile
public function moveUploadedFile($filename, $dest) { if (!$this->isUploadedFile($filename)) { return false; } return FileSystem::rename($filename, $dest); }
php
public function moveUploadedFile($filename, $dest) { if (!$this->isUploadedFile($filename)) { return false; } return FileSystem::rename($filename, $dest); }
[ "public", "function", "moveUploadedFile", "(", "$", "filename", ",", "$", "dest", ")", "{", "if", "(", "!", "$", "this", "->", "isUploadedFile", "(", "$", "filename", ")", ")", "{", "return", "false", ";", "}", "return", "FileSystem", "::", "rename", "...
Moves an uploaded file to a new location @param string $filename The filename of the uploaded file @param string $dest The destination of the moved file @return boolean Success
[ "Moves", "an", "uploaded", "file", "to", "a", "new", "location" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L889-L895
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.readBodyFile
public function readBodyFile() { if (!isset($this->attrs->server['REQUEST_BODY_FILE'])) { return false; } FileSystem::readfileChunked( $this->attrs->server['REQUEST_BODY_FILE'], function ($file, $success) { $this->attrs->inputDone = true; ...
php
public function readBodyFile() { if (!isset($this->attrs->server['REQUEST_BODY_FILE'])) { return false; } FileSystem::readfileChunked( $this->attrs->server['REQUEST_BODY_FILE'], function ($file, $success) { $this->attrs->inputDone = true; ...
[ "public", "function", "readBodyFile", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "attrs", "->", "server", "[", "'REQUEST_BODY_FILE'", "]", ")", ")", "{", "return", "false", ";", "}", "FileSystem", "::", "readfileChunked", "(", "$", ...
Read request body from the file given in REQUEST_BODY_FILE parameter @return boolean Success
[ "Read", "request", "body", "from", "the", "file", "given", "in", "REQUEST_BODY_FILE", "parameter" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L901-L922
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.parseStr
public static function parseStr($s, &$var, $header = false) { static $cb; if ($cb === null) { $cb = function ($m) { return urlencode(html_entity_decode('&#' . hexdec($m[1]) . ';', ENT_NOQUOTES, 'utf-8')); }; } if ($header) { $s = st...
php
public static function parseStr($s, &$var, $header = false) { static $cb; if ($cb === null) { $cb = function ($m) { return urlencode(html_entity_decode('&#' . hexdec($m[1]) . ';', ENT_NOQUOTES, 'utf-8')); }; } if ($header) { $s = st...
[ "public", "static", "function", "parseStr", "(", "$", "s", ",", "&", "$", "var", ",", "$", "header", "=", "false", ")", "{", "static", "$", "cb", ";", "if", "(", "$", "cb", "===", "null", ")", "{", "$", "cb", "=", "function", "(", "$", "m", "...
Replacement for default parse_str(), it supoorts UCS-2 like this: %uXXXX @param string $s String to parse @param array &$var Reference to the resulting array @param boolean $header Header-style string @return void
[ "Replacement", "for", "default", "parse_str", "()", "it", "supoorts", "UCS", "-", "2", "like", "this", ":", "%uXXXX" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L931-L948
kakserpom/phpdaemon
PHPDaemon/HTTPRequest/Generic.php
Generic.postFinishHandler
protected function postFinishHandler($cb = null) { if (!$this->headers_sent) { $this->out(''); } $this->sendfp = null; if (isset($this->attrs->files)) { foreach ($this->attrs->files as $f) { if (isset($f['tmp_name'])) { File...
php
protected function postFinishHandler($cb = null) { if (!$this->headers_sent) { $this->out(''); } $this->sendfp = null; if (isset($this->attrs->files)) { foreach ($this->attrs->files as $f) { if (isset($f['tmp_name'])) { File...
[ "protected", "function", "postFinishHandler", "(", "$", "cb", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "headers_sent", ")", "{", "$", "this", "->", "out", "(", "''", ")", ";", "}", "$", "this", "->", "sendfp", "=", "null", ";", "...
Called after request finish @param callable $cb Callback @return void
[ "Called", "after", "request", "finish" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/HTTPRequest/Generic.php#L955-L973
kakserpom/phpdaemon
PHPDaemon/Cache/CappedStorage.php
CappedStorage.put
public function put($key, $value, $ttl = null) { $k = $this->hash($key); if (isset($this->cache[$k])) { $item = $this->cache[$k]; $item->setValue($value); if ($ttl !== null) { $item->expire = microtime(true) + $ttl; } return...
php
public function put($key, $value, $ttl = null) { $k = $this->hash($key); if (isset($this->cache[$k])) { $item = $this->cache[$k]; $item->setValue($value); if ($ttl !== null) { $item->expire = microtime(true) + $ttl; } return...
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "null", ")", "{", "$", "k", "=", "$", "this", "->", "hash", "(", "$", "key", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "cache", "[", "$", "k"...
Puts element in cache @param string $key Key @param mixed $value Value @param integer $ttl Time to live @return mixed
[ "Puts", "element", "in", "cache" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Cache/CappedStorage.php#L61-L85
kakserpom/phpdaemon
PHPDaemon/Cache/CappedStorage.php
CappedStorage.get
public function get($key) { $k = $this->hash($key); if (!isset($this->cache[$k])) { return null; } $item = $this->cache[$k]; if (isset($item->expire)) { if (microtime(true) >= $item->expire) { unset($this->cache[$k]); re...
php
public function get($key) { $k = $this->hash($key); if (!isset($this->cache[$k])) { return null; } $item = $this->cache[$k]; if (isset($item->expire)) { if (microtime(true) >= $item->expire) { unset($this->cache[$k]); re...
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "k", "=", "$", "this", "->", "hash", "(", "$", "key", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "cache", "[", "$", "k", "]", ")", ")", "{", "return", "null", ";",...
Gets element by key @param string $key Key @return object Item
[ "Gets", "element", "by", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Cache/CappedStorage.php#L113-L127
kakserpom/phpdaemon
PHPDaemon/PubSub/PubSub.php
PubSub.sub
public function sub($id, $obj, $cb) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->sub($obj, $cb); }
php
public function sub($id, $obj, $cb) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->sub($obj, $cb); }
[ "public", "function", "sub", "(", "$", "id", ",", "$", "obj", ",", "$", "cb", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "events", "[", "$", "id", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", ...
Subcribe to event @param string $id Event ID @param object $obj Subscriber @param callable $cb Callback @return boolean Success
[ "Subcribe", "to", "event" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/PubSub/PubSub.php#L36-L42
kakserpom/phpdaemon
PHPDaemon/PubSub/PubSub.php
PubSub.unsub
public function unsub($id, $obj) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->unsub($obj); }
php
public function unsub($id, $obj) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->unsub($obj); }
[ "public", "function", "unsub", "(", "$", "id", ",", "$", "obj", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "events", "[", "$", "id", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "events", "[", ...
Unsubscribe object from event @param string $id Event ID @param object $obj Subscriber @return boolean Success
[ "Unsubscribe", "object", "from", "event" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/PubSub/PubSub.php#L71-L77
kakserpom/phpdaemon
PHPDaemon/PubSub/PubSub.php
PubSub.pub
public function pub($id, $data) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->pub($data); }
php
public function pub($id, $data) { if (!isset($this->events[$id])) { return false; } return $this->events[$id]->pub($data); }
[ "public", "function", "pub", "(", "$", "id", ",", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "events", "[", "$", "id", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "events", "[", "...
Publish @param string $id Event ID @param mixed $data Data @return boolean Success
[ "Publish" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/PubSub/PubSub.php#L85-L91
kakserpom/phpdaemon
PHPDaemon/PubSub/PubSub.php
PubSub.unsubFromAll
public function unsubFromAll($obj) { foreach ($this->events as $event) { $event->unsub($obj); } return true; }
php
public function unsubFromAll($obj) { foreach ($this->events as $event) { $event->unsub($obj); } return true; }
[ "public", "function", "unsubFromAll", "(", "$", "obj", ")", "{", "foreach", "(", "$", "this", "->", "events", "as", "$", "event", ")", "{", "$", "event", "->", "unsub", "(", "$", "obj", ")", ";", "}", "return", "true", ";", "}" ]
Unsubscribe object from all events @param object $obj Subscriber @return boolean Success
[ "Unsubscribe", "object", "from", "all", "events" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/PubSub/PubSub.php#L98-L104
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.isEnabled
public function isEnabled() { return isset($this->config->enable->value) && $this->config->enable->value; }
php
public function isEnabled() { return isset($this->config->enable->value) && $this->config->enable->value; }
[ "public", "function", "isEnabled", "(", ")", "{", "return", "isset", "(", "$", "this", "->", "config", "->", "enable", "->", "value", ")", "&&", "$", "this", "->", "config", "->", "enable", "->", "value", ";", "}" ]
Returns whether if this application is enabled @return boolean
[ "Returns", "whether", "if", "this", "application", "is", "enabled" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L125-L128
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.RPCall
public function RPCall($method, $args) { if (!$this->enableRPC || !is_callable([$this, $method])) { return false; } $func = [$this, $method]; return $func(...$args); }
php
public function RPCall($method, $args) { if (!$this->enableRPC || !is_callable([$this, $method])) { return false; } $func = [$this, $method]; return $func(...$args); }
[ "public", "function", "RPCall", "(", "$", "method", ",", "$", "args", ")", "{", "if", "(", "!", "$", "this", "->", "enableRPC", "||", "!", "is_callable", "(", "[", "$", "this", ",", "$", "method", "]", ")", ")", "{", "return", "false", ";", "}", ...
Function handles incoming Remote Procedure Calls You can override it @param string $method Method name @param array $args Arguments @return mixed Result
[ "Function", "handles", "incoming", "Remote", "Procedure", "Calls", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L173-L180
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.broadcastCall
public function broadcastCall($method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendBroadcastCall( '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
php
public function broadcastCall($method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendBroadcastCall( '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
[ "public", "function", "broadcastCall", "(", "$", "method", ",", "$", "args", "=", "[", "]", ",", "$", "cb", "=", "null", ")", "{", "return", "Daemon", "::", "$", "process", "->", "IPCManager", "->", "sendBroadcastCall", "(", "'\\\\'", ".", "get_class", ...
Send broadcast RPC You can override it @param string $method Method name @param array $args Arguments @param callable $cb Callback @return boolean Success
[ "Send", "broadcast", "RPC", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L208-L216
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.singleCall
public function singleCall($method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendSingleCall( '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
php
public function singleCall($method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendSingleCall( '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
[ "public", "function", "singleCall", "(", "$", "method", ",", "$", "args", "=", "[", "]", ",", "$", "cb", "=", "null", ")", "{", "return", "Daemon", "::", "$", "process", "->", "IPCManager", "->", "sendSingleCall", "(", "'\\\\'", ".", "get_class", "(", ...
Send RPC, executed once in any worker You can override it @param string $method Method name @param array $args Arguments @param mixed $cb Callback @return boolean Success
[ "Send", "RPC", "executed", "once", "in", "any", "worker", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L226-L234
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.directCall
public function directCall($workerId, $method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendDirectCall( $workerId, '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
php
public function directCall($workerId, $method, $args = [], $cb = null) { return Daemon::$process->IPCManager->sendDirectCall( $workerId, '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''), $method, $args, $cb ); }
[ "public", "function", "directCall", "(", "$", "workerId", ",", "$", "method", ",", "$", "args", "=", "[", "]", ",", "$", "cb", "=", "null", ")", "{", "return", "Daemon", "::", "$", "process", "->", "IPCManager", "->", "sendDirectCall", "(", "$", "wor...
Send RPC, executed once in certain worker You can override it @param integer $workerId Worker Id @param string $method Method name @param array $args Arguments @param mixed $cb Callback @return boolean Success
[ "Send", "RPC", "executed", "once", "in", "certain", "worker", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L245-L254
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.handleRequest
public function handleRequest($parent, $upstream) { $req = $this->beginRequest($parent, $upstream); return $req ?: $parent; }
php
public function handleRequest($parent, $upstream) { $req = $this->beginRequest($parent, $upstream); return $req ?: $parent; }
[ "public", "function", "handleRequest", "(", "$", "parent", ",", "$", "upstream", ")", "{", "$", "req", "=", "$", "this", "->", "beginRequest", "(", "$", "parent", ",", "$", "upstream", ")", ";", "return", "$", "req", "?", ":", "$", "parent", ";", "...
Handle the request @param object $parent Parent request @param object $upstream Upstream application @return object Request
[ "Handle", "the", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L272-L276
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.beginRequest
public function beginRequest($req, $upstream) { if (!$this->requestClass) { return false; } $className = $this->requestClass; return new $className($this, $upstream, $req); }
php
public function beginRequest($req, $upstream) { if (!$this->requestClass) { return false; } $className = $this->requestClass; return new $className($this, $upstream, $req); }
[ "public", "function", "beginRequest", "(", "$", "req", ",", "$", "upstream", ")", "{", "if", "(", "!", "$", "this", "->", "requestClass", ")", "{", "return", "false", ";", "}", "$", "className", "=", "$", "this", "->", "requestClass", ";", "return", ...
Create Request instance @param object $req Generic @param object $upstream Upstream application instance @return object Request
[ "Create", "Request", "instance" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L284-L291
kakserpom/phpdaemon
PHPDaemon/Core/AppInstance.php
AppInstance.handleStatus
public function handleStatus($ret) { if ($ret === self::EVENT_CONFIG_UPDATED) { $this->onConfigUpdated(); return true; } elseif ($ret === self::EVENT_GRACEFUL_SHUTDOWN) { return $this->onShutdown(true); } elseif ($ret === self::EVENT_SHUTDOWN) { ...
php
public function handleStatus($ret) { if ($ret === self::EVENT_CONFIG_UPDATED) { $this->onConfigUpdated(); return true; } elseif ($ret === self::EVENT_GRACEFUL_SHUTDOWN) { return $this->onShutdown(true); } elseif ($ret === self::EVENT_SHUTDOWN) { ...
[ "public", "function", "handleStatus", "(", "$", "ret", ")", "{", "if", "(", "$", "ret", "===", "self", "::", "EVENT_CONFIG_UPDATED", ")", "{", "$", "this", "->", "onConfigUpdated", "(", ")", ";", "return", "true", ";", "}", "elseif", "(", "$", "ret", ...
Handle the worker status @param integer $ret Status code @return boolean Result
[ "Handle", "the", "worker", "status" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/AppInstance.php#L298-L309
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeclareOkFrame.php
QueueDeclareOkFrame.create
public static function create( $queue = null, $messageCount = null, $consumerCount = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $messageCount) { $frame->messageCount = $messageCount; } ...
php
public static function create( $queue = null, $messageCount = null, $consumerCount = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $messageCount) { $frame->messageCount = $messageCount; } ...
[ "public", "static", "function", "create", "(", "$", "queue", "=", "null", ",", "$", "messageCount", "=", "null", ",", "$", "consumerCount", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "queu...
long
[ "long" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeclareOkFrame.php#L22-L39
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.handleException
public function handleException($e) { if (!isset($this->route)) { return false; } return $this->route->handleException($e); }
php
public function handleException($e) { if (!isset($this->route)) { return false; } return $this->route->handleException($e); }
[ "public", "function", "handleException", "(", "$", "e", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "route", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "route", "->", "handleException", "(", "$", "e", ")...
Uncaught exception handler @param object $e @return boolean|null Handled?
[ "Uncaught", "exception", "handler" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L119-L125
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.onHandshake
public function onHandshake() { if (!isset($this->route)) { return; } $this->route->onWakeup(); try { $this->route->onHandshake(); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); } $this->route->onSleep(); ...
php
public function onHandshake() { if (!isset($this->route)) { return; } $this->route->onWakeup(); try { $this->route->onHandshake(); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); } $this->route->onSleep(); ...
[ "public", "function", "onHandshake", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "route", ")", ")", "{", "return", ";", "}", "$", "this", "->", "route", "->", "onWakeup", "(", ")", ";", "try", "{", "$", "this", "->", "route", ...
onHandshake @return void
[ "onHandshake" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L131-L143
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.c2s
public function c2s($redis) { if (!$redis) { return; } if ($this->finished) { return; } list(, $chan, $msg) = $redis->result; if ($msg === '') { return; } $this->onFrame($msg, \PHPDaemon\Servers\WebSocket\Pool::STRIN...
php
public function c2s($redis) { if (!$redis) { return; } if ($this->finished) { return; } list(, $chan, $msg) = $redis->result; if ($msg === '') { return; } $this->onFrame($msg, \PHPDaemon\Servers\WebSocket\Pool::STRIN...
[ "public", "function", "c2s", "(", "$", "redis", ")", "{", "if", "(", "!", "$", "redis", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "finished", ")", "{", "return", ";", "}", "list", "(", ",", "$", "chan", ",", "$", "msg", ")",...
c2s @param object $redis @return void
[ "c2s" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L150-L163
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.onFrame
public function onFrame($msg, $type) { $frames = json_decode($msg, true); if (!is_array($frames)) { return; } $this->route->onWakeup(); foreach ($frames as $frame) { try { $this->route->onFrame($frame, \PHPDaemon\Servers\WebSocket\Pool:...
php
public function onFrame($msg, $type) { $frames = json_decode($msg, true); if (!is_array($frames)) { return; } $this->route->onWakeup(); foreach ($frames as $frame) { try { $this->route->onFrame($frame, \PHPDaemon\Servers\WebSocket\Pool:...
[ "public", "function", "onFrame", "(", "$", "msg", ",", "$", "type", ")", "{", "$", "frames", "=", "json_decode", "(", "$", "msg", ",", "true", ")", ";", "if", "(", "!", "is_array", "(", "$", "frames", ")", ")", "{", "return", ";", "}", "$", "th...
onFrame @param string $msg [@todo description] @param integer $type [@todo description] @return void
[ "onFrame" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L171-L186
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.poll
public function poll($redis) { if (!$redis) { return; } list(, $chan, $msg) = $redis->result; $this->pollMode = json_decode($msg, true); Timer::setTimeout($this->finishTimer); $this->flush(); }
php
public function poll($redis) { if (!$redis) { return; } list(, $chan, $msg) = $redis->result; $this->pollMode = json_decode($msg, true); Timer::setTimeout($this->finishTimer); $this->flush(); }
[ "public", "function", "poll", "(", "$", "redis", ")", "{", "if", "(", "!", "$", "redis", ")", "{", "return", ";", "}", "list", "(", ",", "$", "chan", ",", "$", "msg", ")", "=", "$", "redis", "->", "result", ";", "$", "this", "->", "pollMode", ...
poll @param object $redis @return void
[ "poll" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L193-L203
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.flush
public function flush() { if ($this->pollMode === null) { // first polling request is not there yet return; } if ($this->flushing) { return; } $bsize = sizeof($this->buffer); $fbsize = sizeof($this->framesBuffer); if ($bsize === 0 && $f...
php
public function flush() { if ($this->pollMode === null) { // first polling request is not there yet return; } if ($this->flushing) { return; } $bsize = sizeof($this->buffer); $fbsize = sizeof($this->framesBuffer); if ($bsize === 0 && $f...
[ "public", "function", "flush", "(", ")", "{", "if", "(", "$", "this", "->", "pollMode", "===", "null", ")", "{", "// first polling request is not there yet", "return", ";", "}", "if", "(", "$", "this", "->", "flushing", ")", "{", "return", ";", "}", "$",...
Flushes buffered packets @return void
[ "Flushes", "buffered", "packets" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L266-L325
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.sendPacket
public function sendPacket($pct, $cb = null) { if (sizeof($this->framesBuffer)) { $this->buffer[] = 'a' . $this->toJson($this->framesBuffer); $this->framesBuffer = []; } $this->buffer[] = $pct; if ($cb !== null) { $this->onWrite->push($cb); ...
php
public function sendPacket($pct, $cb = null) { if (sizeof($this->framesBuffer)) { $this->buffer[] = 'a' . $this->toJson($this->framesBuffer); $this->framesBuffer = []; } $this->buffer[] = $pct; if ($cb !== null) { $this->onWrite->push($cb); ...
[ "public", "function", "sendPacket", "(", "$", "pct", ",", "$", "cb", "=", "null", ")", "{", "if", "(", "sizeof", "(", "$", "this", "->", "framesBuffer", ")", ")", "{", "$", "this", "->", "buffer", "[", "]", "=", "'a'", ".", "$", "this", "->", "...
sendPacket @param object $pct [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "sendPacket" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Session.php#L334-L345
kakserpom/phpdaemon
PHPDaemon/SockJS/Session.php
Session.sendFrame
public function sendFrame($data, $type = 0x00, $cb = null) { if ($this->finished) { return false; } $this->framesBuffer[] = $data; if ($cb !== null) { $this->onWrite->push($cb); } $this->flush(); return true; }
php
public function sendFrame($data, $type = 0x00, $cb = null) { if ($this->finished) { return false; } $this->framesBuffer[] = $data; if ($cb !== null) { $this->onWrite->push($cb); } $this->flush(); return true; }
[ "public", "function", "sendFrame", "(", "$", "data", ",", "$", "type", "=", "0x00", ",", "$", "cb", "=", "null", ")", "{", "if", "(", "$", "this", "->", "finished", ")", "{", "return", "false", ";", "}", "$", "this", "->", "framesBuffer", "[", "]...
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/Session.php#L355-L366
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWebSocket.php
ExampleWebSocket.onReady
public function onReady() { $appInstance = $this; // a reference to this application instance for ExampleWebSocketRoute // URI /exampleApp should be handled by ExampleWebSocketRoute \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute('exampleApp', function ($client) use ($appInstance)...
php
public function onReady() { $appInstance = $this; // a reference to this application instance for ExampleWebSocketRoute // URI /exampleApp should be handled by ExampleWebSocketRoute \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute('exampleApp', function ($client) use ($appInstance)...
[ "public", "function", "onReady", "(", ")", "{", "$", "appInstance", "=", "$", "this", ";", "// a reference to this application instance for ExampleWebSocketRoute", "// URI /exampleApp should be handled by ExampleWebSocketRoute", "\\", "PHPDaemon", "\\", "Servers", "\\", "WebSoc...
Called when the worker is ready to go. @return void
[ "Called", "when", "the", "worker", "is", "ready", "to", "go", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWebSocket.php#L18-L25
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWebSocket.php
ExampleWebSocketRoute.onFrame
public function onFrame($data, $type) { if ($data === 'ping') { $this->client->sendFrame('pong', 'STRING', function ($client) { // optional. called when the frame is transmitted to the client \PHPDaemon\Core\Daemon::log('ExampleWebSocket: \'pong\' received by ...
php
public function onFrame($data, $type) { if ($data === 'ping') { $this->client->sendFrame('pong', 'STRING', function ($client) { // optional. called when the frame is transmitted to the client \PHPDaemon\Core\Daemon::log('ExampleWebSocket: \'pong\' received by ...
[ "public", "function", "onFrame", "(", "$", "data", ",", "$", "type", ")", "{", "if", "(", "$", "data", "===", "'ping'", ")", "{", "$", "this", "->", "client", "->", "sendFrame", "(", "'pong'", ",", "'STRING'", ",", "function", "(", "$", "client", "...
Called when new frame received. @param string Frame's contents. @param integer Frame's type. @return void
[ "Called", "when", "new", "frame", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWebSocket.php#L48-L57
kakserpom/phpdaemon
PHPDaemon/WebSocket/Route.php
Route.onWakeup
public function onWakeup() { $this->running = true; Daemon::$context = $this; $_SESSION = &$this->attrs->session; $_GET = &$this->attrs->get; $_POST = []; $_COOKIE = &$this->attrs->cookie; Daemon::$process->setState(Daemon::WSTATE_BUSY); }
php
public function onWakeup() { $this->running = true; Daemon::$context = $this; $_SESSION = &$this->attrs->session; $_GET = &$this->attrs->get; $_POST = []; $_COOKIE = &$this->attrs->cookie; Daemon::$process->setState(Daemon::WSTATE_BUSY); }
[ "public", "function", "onWakeup", "(", ")", "{", "$", "this", "->", "running", "=", "true", ";", "Daemon", "::", "$", "context", "=", "$", "this", ";", "$", "_SESSION", "=", "&", "$", "this", "->", "attrs", "->", "session", ";", "$", "_GET", "=", ...
Called when the request wakes up @return void
[ "Called", "when", "the", "request", "wakes", "up" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/WebSocket/Route.php#L87-L96
kakserpom/phpdaemon
PHPDaemon/WebSocket/Route.php
Route.onSleep
public function onSleep() { Daemon::$context = null; $this->running = false; unset($_SESSION, $_GET, $_POST, $_COOKIE); Daemon::$process->setState(Daemon::WSTATE_IDLE); }
php
public function onSleep() { Daemon::$context = null; $this->running = false; unset($_SESSION, $_GET, $_POST, $_COOKIE); Daemon::$process->setState(Daemon::WSTATE_IDLE); }
[ "public", "function", "onSleep", "(", ")", "{", "Daemon", "::", "$", "context", "=", "null", ";", "$", "this", "->", "running", "=", "false", ";", "unset", "(", "$", "_SESSION", ",", "$", "_GET", ",", "$", "_POST", ",", "$", "_COOKIE", ")", ";", ...
Called when the request starts sleep @return void
[ "Called", "when", "the", "request", "starts", "sleep" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/WebSocket/Route.php#L102-L108
kakserpom/phpdaemon
PHPDaemon/WebSocket/Route.php
Route.getCookieStr
protected function getCookieStr($name) { return \PHPDaemon\HTTPRequest\Generic::getString($this->attrs->cookie[$name]); }
php
protected function getCookieStr($name) { return \PHPDaemon\HTTPRequest\Generic::getString($this->attrs->cookie[$name]); }
[ "protected", "function", "getCookieStr", "(", "$", "name", ")", "{", "return", "\\", "PHPDaemon", "\\", "HTTPRequest", "\\", "Generic", "::", "getString", "(", "$", "this", "->", "attrs", "->", "cookie", "[", "$", "name", "]", ")", ";", "}" ]
Get cookie by name @param string $name Name of cookie @return string Contents
[ "Get", "cookie", "by", "name" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/WebSocket/Route.php#L161-L164
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleGibson.php
ExampleGibsonRequest.init
public function init() { $job = $this->job = new \PHPDaemon\Core\ComplexJob(function ($job) { // called when job is done $this->wakeup(); // wake up the request immediately $job->keep(); // prevent from cleaning }); if (isset($_GET['fill'])) { for ($i = 0...
php
public function init() { $job = $this->job = new \PHPDaemon\Core\ComplexJob(function ($job) { // called when job is done $this->wakeup(); // wake up the request immediately $job->keep(); // prevent from cleaning }); if (isset($_GET['fill'])) { for ($i = 0...
[ "public", "function", "init", "(", ")", "{", "$", "job", "=", "$", "this", "->", "job", "=", "new", "\\", "PHPDaemon", "\\", "Core", "\\", "ComplexJob", "(", "function", "(", "$", "job", ")", "{", "// called when job is done", "$", "this", "->", "wakeu...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleGibson.php#L50-L74
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/MongoId.php
MongoId.import
public static function import($id) { if ($id instanceof static) { return $id; } elseif ($id instanceof \MongoId) { $id = (string)$id; } elseif (!is_string($id)) { if (is_array($id) && isset($id['$id'])) { return static::import($id['$id']); ...
php
public static function import($id) { if ($id instanceof static) { return $id; } elseif ($id instanceof \MongoId) { $id = (string)$id; } elseif (!is_string($id)) { if (is_array($id) && isset($id['$id'])) { return static::import($id['$id']); ...
[ "public", "static", "function", "import", "(", "$", "id", ")", "{", "if", "(", "$", "id", "instanceof", "static", ")", "{", "return", "$", "id", ";", "}", "elseif", "(", "$", "id", "instanceof", "\\", "MongoId", ")", "{", "$", "id", "=", "(", "st...
Import @param mixed $id ID @return mixed
[ "Import" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/MongoId.php#L33-L60
kakserpom/phpdaemon
PHPDaemon/Core/Pool.php
Pool.RPCall
public function RPCall($method, $args) { if (!is_callable($f = [$this->pool, 'RPCall'])) { return false; } return $f($method, $args); }
php
public function RPCall($method, $args) { if (!is_callable($f = [$this->pool, 'RPCall'])) { return false; } return $f($method, $args); }
[ "public", "function", "RPCall", "(", "$", "method", ",", "$", "args", ")", "{", "if", "(", "!", "is_callable", "(", "$", "f", "=", "[", "$", "this", "->", "pool", ",", "'RPCall'", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", ...
Function handles incoming Remote Procedure Calls You can override it @param string $method Method name. @param array $args Arguments. @return mixed Result
[ "Function", "handles", "incoming", "Remote", "Procedure", "Calls", "You", "can", "override", "it" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Pool.php#L25-L31
kakserpom/phpdaemon
PHPDaemon/Core/Pool.php
Pool.onConfigUpdated
public function onConfigUpdated() { if ($this->pool) { $this->pool->config = $this->config; $this->pool->onConfigUpdated(); } }
php
public function onConfigUpdated() { if ($this->pool) { $this->pool->config = $this->config; $this->pool->onConfigUpdated(); } }
[ "public", "function", "onConfigUpdated", "(", ")", "{", "if", "(", "$", "this", "->", "pool", ")", "{", "$", "this", "->", "pool", "->", "config", "=", "$", "this", "->", "config", ";", "$", "this", "->", "pool", "->", "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/Core/Pool.php#L48-L54
kakserpom/phpdaemon
PHPDaemon/Core/Pool.php
Pool.onShutdown
public function onShutdown($graceful = false) { if ($this->pool) { return $this->pool->onShutdown($graceful); } return true; }
php
public function onShutdown($graceful = false) { if ($this->pool) { return $this->pool->onShutdown($graceful); } return true; }
[ "public", "function", "onShutdown", "(", "$", "graceful", "=", "false", ")", "{", "if", "(", "$", "this", "->", "pool", ")", "{", "return", "$", "this", "->", "pool", "->", "onShutdown", "(", "$", "graceful", ")", ";", "}", "return", "true", ";", "...
Called when application instance is going to shutdown. @return boolean Ready to shutdown?
[ "Called", "when", "application", "instance", "is", "going", "to", "shutdown", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Pool.php#L60-L66
kakserpom/phpdaemon
PHPDaemon/Core/Pool.php
Pool.init
protected function init() { if ($this->isEnabled()) { list($class, $name) = explode(':', $this->name . ':'); $realclass = ClassFinder::find($class); $e = explode('\\', $realclass); if (($e[sizeof($e) - 1] !== 'Pool') && class_exists($realclass . '\\Pool')) { ...
php
protected function init() { if ($this->isEnabled()) { list($class, $name) = explode(':', $this->name . ':'); $realclass = ClassFinder::find($class); $e = explode('\\', $realclass); if (($e[sizeof($e) - 1] !== 'Pool') && class_exists($realclass . '\\Pool')) { ...
[ "protected", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "list", "(", "$", "class", ",", "$", "name", ")", "=", "explode", "(", "':'", ",", "$", "this", "->", "name", ".", "':'", ")", ";", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Pool.php#L83-L105
kakserpom/phpdaemon
PHPDaemon/Config/Entry/Size.php
Size.humanToPlain
public static function humanToPlain($value) { $l = substr($value, -1); if ($l === 'b' || $l === 'B') { return ((int)substr($value, 0, -1)); } if ($l === 'k') { return ((int)substr($value, 0, -1) * 1000); } if ($l === 'K') { retur...
php
public static function humanToPlain($value) { $l = substr($value, -1); if ($l === 'b' || $l === 'B') { return ((int)substr($value, 0, -1)); } if ($l === 'k') { return ((int)substr($value, 0, -1) * 1000); } if ($l === 'K') { retur...
[ "public", "static", "function", "humanToPlain", "(", "$", "value", ")", "{", "$", "l", "=", "substr", "(", "$", "value", ",", "-", "1", ")", ";", "if", "(", "$", "l", "===", "'b'", "||", "$", "l", "===", "'B'", ")", "{", "return", "(", "(", "...
Converts human-readable value to plain @param $value @return int
[ "Converts", "human", "-", "readable", "value", "to", "plain" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Entry/Size.php#L20-L53
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicConsumeFrame.php
BasicConsumeFrame.create
public static function create( $queue = null, $consumerTag = null, $noLocal = null, $noAck = null, $exclusive = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $consumerTag) { ...
php
public static function create( $queue = null, $consumerTag = null, $noLocal = null, $noAck = null, $exclusive = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $consumerTag) { ...
[ "public", "static", "function", "create", "(", "$", "queue", "=", "null", ",", "$", "consumerTag", "=", "null", ",", "$", "noLocal", "=", "null", ",", "$", "noAck", "=", "null", ",", "$", "exclusive", "=", "null", ",", "$", "nowait", "=", "null", "...
table
[ "table" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicConsumeFrame.php#L27-L56
kakserpom/phpdaemon
PHPDaemon/Servers/DebugConsole/Connection.php
Connection.onRead
public function onRead() { $seq = ["\xff\xf4\xff\xfd\x06", "\xff\xec", "\x03", "\x04"]; $finish = false; foreach ($seq as $s) { if ($this->search($s) !== false) { $finish = true; } } while (($line = $this->readline()) !== null) { ...
php
public function onRead() { $seq = ["\xff\xf4\xff\xfd\x06", "\xff\xec", "\x03", "\x04"]; $finish = false; foreach ($seq as $s) { if ($this->search($s) !== false) { $finish = true; } } while (($line = $this->readline()) !== null) { ...
[ "public", "function", "onRead", "(", ")", "{", "$", "seq", "=", "[", "\"\\xff\\xf4\\xff\\xfd\\x06\"", ",", "\"\\xff\\xec\"", ",", "\"\\x03\"", ",", "\"\\x04\"", "]", ";", "$", "finish", "=", "false", ";", "foreach", "(", "$", "seq", "as", "$", "s", ")", ...
Called when new data received. @return void
[ "Called", "when", "new", "data", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/DebugConsole/Connection.php#L44-L71
kakserpom/phpdaemon
PHPDaemon/Servers/DebugConsole/Connection.php
Connection.checkPassword
protected function checkPassword($pass = '') { if (!hash_equals($this->pool->config->passphrase->value, $pass)) { --$this->authTries; if (0 === $this->authTries) { $this->disconnect(); } else { $this->write('Wrong password. Please, try aga...
php
protected function checkPassword($pass = '') { if (!hash_equals($this->pool->config->passphrase->value, $pass)) { --$this->authTries; if (0 === $this->authTries) { $this->disconnect(); } else { $this->write('Wrong password. Please, try aga...
[ "protected", "function", "checkPassword", "(", "$", "pass", "=", "''", ")", "{", "if", "(", "!", "hash_equals", "(", "$", "this", "->", "pool", "->", "config", "->", "passphrase", "->", "value", ",", "$", "pass", ")", ")", "{", "--", "$", "this", "...
Let's check the password @param string $pass Password @return void
[ "Let", "s", "check", "the", "password" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/DebugConsole/Connection.php#L87-L101
kakserpom/phpdaemon
PHPDaemon/Servers/DebugConsole/Connection.php
Connection.processCommand
protected function processCommand($command = '', $argument = '') { switch ($command) { case 'help': $this->writeln(' Debug console for phpDaemon. Allowed commands: help eval exit '); break; case 'ping': $this->writeln('pong'); ...
php
protected function processCommand($command = '', $argument = '') { switch ($command) { case 'help': $this->writeln(' Debug console for phpDaemon. Allowed commands: help eval exit '); break; case 'ping': $this->writeln('pong'); ...
[ "protected", "function", "processCommand", "(", "$", "command", "=", "''", ",", "$", "argument", "=", "''", ")", "{", "switch", "(", "$", "command", ")", "{", "case", "'help'", ":", "$", "this", "->", "writeln", "(", "'\nDebug console for phpDaemon.\nAllowed...
Run the command @param string $command Command to execute @param string $argument Argument @return void
[ "Run", "the", "command" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/DebugConsole/Connection.php#L109-L134
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleAsyncProcessRequest.php
ExampleAsyncProcessRequest.init
public function init() { $this->header('Content-Type: text/plain'); $this->proc = new \PHPDaemon\Core\ShellCommand(); $this->proc->onReadData(function ($stream, $data) { echo $data; }); $this->proc->onEOF(function ($stream) { $this->wakeup(); ...
php
public function init() { $this->header('Content-Type: text/plain'); $this->proc = new \PHPDaemon\Core\ShellCommand(); $this->proc->onReadData(function ($stream, $data) { echo $data; }); $this->proc->onEOF(function ($stream) { $this->wakeup(); ...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "header", "(", "'Content-Type: text/plain'", ")", ";", "$", "this", "->", "proc", "=", "new", "\\", "PHPDaemon", "\\", "Core", "\\", "ShellCommand", "(", ")", ";", "$", "this", "->", "proc...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleAsyncProcessRequest.php#L15-L28
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleDNSClientRequest.php
ExampleDNSClientRequest.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('query', function ($name, $job) { // registering job named 'showvar...
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('query', function ($name, $job) { // registering job named 'showvar...
[ "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/ExampleDNSClientRequest.php#L15-L39
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleDNSClientRequest.php
ExampleDNSClientRequest.run
public function run() { try { $this->header('Content-Type: text/plain'); } catch (\Exception $e) { } var_dump($this->job->getResult('query')); var_dump($this->job->getResult('resolve')); }
php
public function run() { try { $this->header('Content-Type: text/plain'); } catch (\Exception $e) { } var_dump($this->job->getResult('query')); var_dump($this->job->getResult('resolve')); }
[ "public", "function", "run", "(", ")", "{", "try", "{", "$", "this", "->", "header", "(", "'Content-Type: text/plain'", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "}", "var_dump", "(", "$", "this", "->", "job", "->", "getResu...
Called when request iterated. @return integer Status.
[ "Called", "when", "request", "iterated", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleDNSClientRequest.php#L45-L53
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V0.php
V0.sendHandshakeReply
public function sendHandshakeReply($extraHeaders = '') { if (!isset($this->server['HTTP_SEC_WEBSOCKET_KEY1']) || !isset($this->server['HTTP_SEC_WEBSOCKET_KEY2'])) { return false; } $final_key = $this->_computeFinalKey( $this->server['HTTP_SEC_WEBSOCKET_KEY1'], ...
php
public function sendHandshakeReply($extraHeaders = '') { if (!isset($this->server['HTTP_SEC_WEBSOCKET_KEY1']) || !isset($this->server['HTTP_SEC_WEBSOCKET_KEY2'])) { return false; } $final_key = $this->_computeFinalKey( $this->server['HTTP_SEC_WEBSOCKET_KEY1'], ...
[ "public", "function", "sendHandshakeReply", "(", "$", "extraHeaders", "=", "''", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "server", "[", "'HTTP_SEC_WEBSOCKET_KEY1'", "]", ")", "||", "!", "isset", "(", "$", "this", "->", "server", "[", ...
Sends a handshake message reply @param string Received data (no use in this class) @return boolean OK?
[ "Sends", "a", "handshake", "message", "reply" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V0.php#L24-L58
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V0.php
V0._computeFinalKey
protected function _computeFinalKey($key1, $key2, $data) { if (mb_orig_strlen($data) < 8) { Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Invalid handshake data for client "' . $this->addr . '"'); return false; } return md5($this->_computeKey($key1)...
php
protected function _computeFinalKey($key1, $key2, $data) { if (mb_orig_strlen($data) < 8) { Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Invalid handshake data for client "' . $this->addr . '"'); return false; } return md5($this->_computeKey($key1)...
[ "protected", "function", "_computeFinalKey", "(", "$", "key1", ",", "$", "key2", ",", "$", "data", ")", "{", "if", "(", "mb_orig_strlen", "(", "$", "data", ")", "<", "8", ")", "{", "Daemon", "::", "$", "process", "->", "log", "(", "get_class", "(", ...
Computes final key for Sec-WebSocket. @param string Key1 @param string Key2 @param string Data @return string Result
[ "Computes", "final", "key", "for", "Sec", "-", "WebSocket", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V0.php#L67-L74
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V0.php
V0._computeKey
protected function _computeKey($key) { $spaces = 0; $digits = ''; for ($i = 0, $s = mb_orig_strlen($key); $i < $s; ++$i) { $c = mb_orig_substr($key, $i, 1); if ($c === "\x20") { ++$spaces; } elseif (ctype_digit($c)) { $dig...
php
protected function _computeKey($key) { $spaces = 0; $digits = ''; for ($i = 0, $s = mb_orig_strlen($key); $i < $s; ++$i) { $c = mb_orig_substr($key, $i, 1); if ($c === "\x20") { ++$spaces; } elseif (ctype_digit($c)) { $dig...
[ "protected", "function", "_computeKey", "(", "$", "key", ")", "{", "$", "spaces", "=", "0", ";", "$", "digits", "=", "''", ";", "for", "(", "$", "i", "=", "0", ",", "$", "s", "=", "mb_orig_strlen", "(", "$", "key", ")", ";", "$", "i", "<", "$...
Computes key for Sec-WebSocket. @param string Key @return string Result
[ "Computes", "key", "for", "Sec", "-", "WebSocket", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V0.php#L81-L103
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V0.php
V0.onRead
public function onRead() { if ($this->state === self::STATE_PREHANDSHAKE) { if ($this->getInputLength() < 8) { return; } $this->key = $this->readUnlimited(); $this->handshake(); } if ($this->state === self::STATE_HANDSHAKED) { ...
php
public function onRead() { if ($this->state === self::STATE_PREHANDSHAKE) { if ($this->getInputLength() < 8) { return; } $this->key = $this->readUnlimited(); $this->handshake(); } if ($this->state === self::STATE_HANDSHAKED) { ...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "$", "this", "->", "state", "===", "self", "::", "STATE_PREHANDSHAKE", ")", "{", "if", "(", "$", "this", "->", "getInputLength", "(", ")", "<", "8", ")", "{", "return", ";", "}", "$", "this"...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V0.php#L166-L228
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleRequest.php
ExampleRequest.run
public function run() { $this->sessionStart(); try { $this->header('Content-Type: text/html'); $this->setcookie('testcookie', '1'); } catch (\PHPDaemon\Request\RequestHeadersAlreadySent $e) { } $this->registerShutdownFunction(function () { ?> </html>...
php
public function run() { $this->sessionStart(); try { $this->header('Content-Type: text/html'); $this->setcookie('testcookie', '1'); } catch (\PHPDaemon\Request\RequestHeadersAlreadySent $e) { } $this->registerShutdownFunction(function () { ?> </html>...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "sessionStart", "(", ")", ";", "try", "{", "$", "this", "->", "header", "(", "'Content-Type: text/html'", ")", ";", "$", "this", "->", "setcookie", "(", "'testcookie'", ",", "'1'", ")", ";"...
Called when request iterated. @return integer Status.
[ "Called", "when", "request", "iterated", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleRequest.php#L12-L128
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V13.php
V13.sendHandshakeReply
public function sendHandshakeReply($extraHeaders = '') { if (!isset($this->server['HTTP_SEC_WEBSOCKET_KEY']) || !isset($this->server['HTTP_SEC_WEBSOCKET_VERSION'])) { return false; } if ($this->server['HTTP_SEC_WEBSOCKET_VERSION'] !== '13' && $this->server['HTTP_SEC_WEBSOCKET_VER...
php
public function sendHandshakeReply($extraHeaders = '') { if (!isset($this->server['HTTP_SEC_WEBSOCKET_KEY']) || !isset($this->server['HTTP_SEC_WEBSOCKET_VERSION'])) { return false; } if ($this->server['HTTP_SEC_WEBSOCKET_VERSION'] !== '13' && $this->server['HTTP_SEC_WEBSOCKET_VER...
[ "public", "function", "sendHandshakeReply", "(", "$", "extraHeaders", "=", "''", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "server", "[", "'HTTP_SEC_WEBSOCKET_KEY'", "]", ")", "||", "!", "isset", "(", "$", "this", "->", "server", "[", ...
Sends a handshake message reply @param string Received data (no use in this class) @return boolean OK?
[ "Sends", "a", "handshake", "message", "reply" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/V13.php#L39-L83
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Protocols/V13.php
V13.sendFrame
public function sendFrame($data, $type = null, $cb = null) { if (!$this->handshaked) { return false; } if ($this->finished && $type !== 'CONNCLOSE') { return false; } /*if (in_array($type, ['STRING', 'BINARY']) && ($this->outgoingCompression > 0) && ...
php
public function sendFrame($data, $type = null, $cb = null) { if (!$this->handshaked) { return false; } if ($this->finished && $type !== 'CONNCLOSE') { return false; } /*if (in_array($type, ['STRING', 'BINARY']) && ($this->outgoingCompression > 0) && ...
[ "public", "function", "sendFrame", "(", "$", "data", ",", "$", "type", "=", "null", ",", "$", "cb", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "handshaked", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "fi...
Sends a frame. @param string $data Frame's data. @param string $type Frame's type. ("STRING" OR "BINARY") @param callable $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/Servers/WebSocket/Protocols/V13.php#L94-L161