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/Mongo/Pool.php
Pool.insert
public function insert($col, $doc = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (!isset($doc['_id'])) { $doc['_id'] = new \MongoId; } if ($this->safeMode) { static::saf...
php
public function insert($col, $doc = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (!isset($doc['_id'])) { $doc['_id'] = new \MongoId; } if ($this->safeMode) { static::saf...
[ "public", "function", "insert", "(", "$", "col", ",", "$", "doc", "=", "[", "]", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'.'", ")", "===", "false", ")", "{"...
Inserts an object @param string $col Collection's name @param array $doc Document @param callable $cb Optional. Callback @param array $params Optional. Parameters @callback $cb ( ) @return MongoId
[ "Inserts", "an", "object" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1274-L1308
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.killCursors
public function killCursors($cursors, $conn) { if (!$cursors) { $cursors = []; } $this->request( self::OP_KILL_CURSORS, "\x00\x00\x00\x00" . pack('V', sizeof($cursors)) . implode('', $cursors), false, $conn ); }
php
public function killCursors($cursors, $conn) { if (!$cursors) { $cursors = []; } $this->request( self::OP_KILL_CURSORS, "\x00\x00\x00\x00" . pack('V', sizeof($cursors)) . implode('', $cursors), false, $conn ); }
[ "public", "function", "killCursors", "(", "$", "cursors", ",", "$", "conn", ")", "{", "if", "(", "!", "$", "cursors", ")", "{", "$", "cursors", "=", "[", "]", ";", "}", "$", "this", "->", "request", "(", "self", "::", "OP_KILL_CURSORS", ",", "\"\\x...
Sends a request to kill certain cursors on the server side @param array $cursors Array of cursors @param Connection $conn Connection @return void
[ "Sends", "a", "request", "to", "kill", "certain", "cursors", "on", "the", "server", "side" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1316-L1328
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.insertMulti
public function insertMulti($col, $docs = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } $ids = []; $bson = ''; foreach ($docs as &$doc) { if (!isset($doc['_id'])) { $do...
php
public function insertMulti($col, $docs = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } $ids = []; $bson = ''; foreach ($docs as &$doc) { if (!isset($doc['_id'])) { $do...
[ "public", "function", "insertMulti", "(", "$", "col", ",", "$", "docs", "=", "[", "]", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'.'", ")", "===", "false", ")",...
Inserts several documents @param string $col Collection's name @param array $docs Array of docs @param callable $cb Optional. Callback @param array $params Optional. Parameters @callback $cb ( ) @return array IDs
[ "Inserts", "several", "documents" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1339-L1377
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.remove
public function remove($col, $cond = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (is_string($cond)) { $cond = new \MongoCode($cond); } if ($this->safeMode && is_array($cond)) { ...
php
public function remove($col, $cond = [], $cb = null, $params = []) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } if (is_string($cond)) { $cond = new \MongoCode($cond); } if ($this->safeMode && is_array($cond)) { ...
[ "public", "function", "remove", "(", "$", "col", ",", "$", "cond", "=", "[", "]", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "[", "]", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'.'", ")", "===", "false", ")", "{...
Remove objects from collection @param string $col Collection's name @param array $cond Conditions @param callable $cb Optional. Callback called when response received @param array $params Optional. Parameters @callback $cb ( ) @return void
[ "Remove", "objects", "from", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1388-L1423
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.getMore
public function getMore($col, $id, $number, $conn) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } $this->request( self::OP_GETMORE, "\x00\x00\x00\x00" . $col . "\x00" . pack('V', $number) . $id, false, ...
php
public function getMore($col, $id, $number, $conn) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } $this->request( self::OP_GETMORE, "\x00\x00\x00\x00" . $col . "\x00" . pack('V', $number) . $id, false, ...
[ "public", "function", "getMore", "(", "$", "col", ",", "$", "id", ",", "$", "number", ",", "$", "conn", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'.'", ")", "===", "false", ")", "{", "$", "col", "=", "$", "this", "->", "dbna...
Asks for more objects @param string $col Collection's name @param string $id Cursor's ID @param integer $number Number of objects @param Connection $conn Connection @return void
[ "Asks", "for", "more", "objects" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1433-L1452
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Pool.php
Pool.getCollection
public function getCollection($col) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } else { $collName = explode('.', $col, 2); } if (isset($this->collections[$col])) { return $this->collections[$col]; } ...
php
public function getCollection($col) { if (mb_orig_strpos($col, '.') === false) { $col = $this->dbname . '.' . $col; } else { $collName = explode('.', $col, 2); } if (isset($this->collections[$col])) { return $this->collections[$col]; } ...
[ "public", "function", "getCollection", "(", "$", "col", ")", "{", "if", "(", "mb_orig_strpos", "(", "$", "col", ",", "'.'", ")", "===", "false", ")", "{", "$", "col", "=", "$", "this", "->", "dbname", ".", "'.'", ".", "$", "col", ";", "}", "else"...
Returns an object of collection @param string $col Collection's name @return Collection
[ "Returns", "an", "object", "of", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Pool.php#L1459-L1472
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Pool.php
Pool.parseUrl
public static function parseUrl($mixed) { $url = static::buildUrl($mixed); if (false === $url) { return false; } $u = parse_url($url); $uri = ''; if (!isset($u['path']) && isset($u['query'])) { $u['path'] = '/'; } if (isset($u['...
php
public static function parseUrl($mixed) { $url = static::buildUrl($mixed); if (false === $url) { return false; } $u = parse_url($url); $uri = ''; if (!isset($u['path']) && isset($u['query'])) { $u['path'] = '/'; } if (isset($u['...
[ "public", "static", "function", "parseUrl", "(", "$", "mixed", ")", "{", "$", "url", "=", "static", "::", "buildUrl", "(", "$", "mixed", ")", ";", "if", "(", "false", "===", "$", "url", ")", "{", "return", "false", ";", "}", "$", "u", "=", "parse...
Parse URL @param string $mixed Look Pool::buildUrl() @call ( string $str ) @call ( array $mixed ) @return array|bool
[ "Parse", "URL" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Pool.php#L55-L73
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Pool.php
Pool.buildUrl
public static function buildUrl($mixed) { if (is_string($mixed)) { return $mixed; } if (!is_array($mixed)) { return false; } $url = ''; $buf = []; $queryDelimiter = '?'; $mixed[] = ''; foreach ($mixed as $k => $v) { ...
php
public static function buildUrl($mixed) { if (is_string($mixed)) { return $mixed; } if (!is_array($mixed)) { return false; } $url = ''; $buf = []; $queryDelimiter = '?'; $mixed[] = ''; foreach ($mixed as $k => $v) { ...
[ "public", "static", "function", "buildUrl", "(", "$", "mixed", ")", "{", "if", "(", "is_string", "(", "$", "mixed", ")", ")", "{", "return", "$", "mixed", ";", "}", "if", "(", "!", "is_array", "(", "$", "mixed", ")", ")", "{", "return", "false", ...
Builds URL from array @param string $mixed @call ( string $str ) @call ( array $mixed ) @return string|false
[ "Builds", "URL", "from", "array" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Pool.php#L82-L109
kakserpom/phpdaemon
PHPDaemon/Clients/HTTP/Pool.php
Pool.get
public function get($url, $params) { if (is_callable($params)) { $params = ['resultcb' => $params]; } if (!isset($params['uri']) || !isset($params['host'])) { list($params['scheme'], $params['host'], $params['uri'], $params['port']) = static::parseUrl($url); }...
php
public function get($url, $params) { if (is_callable($params)) { $params = ['resultcb' => $params]; } if (!isset($params['uri']) || !isset($params['host'])) { list($params['scheme'], $params['host'], $params['uri'], $params['port']) = static::parseUrl($url); }...
[ "public", "function", "get", "(", "$", "url", ",", "$", "params", ")", "{", "if", "(", "is_callable", "(", "$", "params", ")", ")", "{", "$", "params", "=", "[", "'resultcb'", "=>", "$", "params", "]", ";", "}", "if", "(", "!", "isset", "(", "$...
Perform a GET request @param string $url @param array $params @param callable $resultcb @call ( url $url, array $params ) @call ( url $url, callable $resultcb ) @callback $resultcb ( Connection $conn, boolean $success )
[ "Perform", "a", "GET", "request" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/HTTP/Pool.php#L120-L144
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Cursor.php
Cursor.current
public function current() { return isset($this->items[$this->pos]) ? $this->items[$this->pos] : null; }
php
public function current() { return isset($this->items[$this->pos]) ? $this->items[$this->pos] : null; }
[ "public", "function", "current", "(", ")", "{", "return", "isset", "(", "$", "this", "->", "items", "[", "$", "this", "->", "pos", "]", ")", "?", "$", "this", "->", "items", "[", "$", "this", "->", "pos", "]", ":", "null", ";", "}" ]
Current @return mixed
[ "Current" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Cursor.php#L116-L119
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Cursor.php
Cursor.valid
public function valid() { $key = isset($this->items[$this->pos]) ? $this->items[$this->pos] : null; return ($key !== null && $key !== false); }
php
public function valid() { $key = isset($this->items[$this->pos]) ? $this->items[$this->pos] : null; return ($key !== null && $key !== false); }
[ "public", "function", "valid", "(", ")", "{", "$", "key", "=", "isset", "(", "$", "this", "->", "items", "[", "$", "this", "->", "pos", "]", ")", "?", "$", "this", "->", "items", "[", "$", "this", "->", "pos", "]", ":", "null", ";", "return", ...
Valid @return boolean
[ "Valid" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Cursor.php#L169-L173
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Cursor.php
Cursor.getMore
public function getMore($number = 0) { if ($this->finished || $this->destroyed) { return; } if (mb_orig_substr($this->id, 0, 1) === 'c') { $this->conn->pool->getMore($this->col, mb_orig_substr($this->id, 1), $number, $this->conn); } }
php
public function getMore($number = 0) { if ($this->finished || $this->destroyed) { return; } if (mb_orig_substr($this->id, 0, 1) === 'c') { $this->conn->pool->getMore($this->col, mb_orig_substr($this->id, 1), $number, $this->conn); } }
[ "public", "function", "getMore", "(", "$", "number", "=", "0", ")", "{", "if", "(", "$", "this", "->", "finished", "||", "$", "this", "->", "destroyed", ")", "{", "return", ";", "}", "if", "(", "mb_orig_substr", "(", "$", "this", "->", "id", ",", ...
Asks for more objects @param integer $number Number of objects @return void
[ "Asks", "for", "more", "objects" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Cursor.php#L210-L218
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Cursor.php
Cursor.destroy
public function destroy($notify = false) { if ($this->destroyed) { return false; } $this->destroyed = true; if ($notify) { if ($this->callback) { $func = $this->callback; $func($this); } } unset($this...
php
public function destroy($notify = false) { if ($this->destroyed) { return false; } $this->destroyed = true; if ($notify) { if ($this->callback) { $func = $this->callback; $func($this); } } unset($this...
[ "public", "function", "destroy", "(", "$", "notify", "=", "false", ")", "{", "if", "(", "$", "this", "->", "destroyed", ")", "{", "return", "false", ";", "}", "$", "this", "->", "destroyed", "=", "true", ";", "if", "(", "$", "notify", ")", "{", "...
Destroys the cursors @param boolean $notify @return boolean Success
[ "Destroys", "the", "cursors" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Cursor.php#L244-L258
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeclareFrame.php
QueueDeclareFrame.create
public static function create( $queue = null, $passive = null, $durable = null, $exclusive = null, $autoDelete = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $passive) { ...
php
public static function create( $queue = null, $passive = null, $durable = null, $exclusive = null, $autoDelete = null, $nowait = null, $arguments = null ) { $frame = new self(); if (null !== $queue) { $frame->queue = $queue; } if (null !== $passive) { ...
[ "public", "static", "function", "create", "(", "$", "queue", "=", "null", ",", "$", "passive", "=", "null", ",", "$", "durable", "=", "null", ",", "$", "exclusive", "=", "null", ",", "$", "autoDelete", "=", "null", ",", "$", "nowait", "=", "null", ...
table
[ "table" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueDeclareFrame.php#L27-L56
kakserpom/phpdaemon
PHPDaemon/Examples/ExamplePubSub.php
ExamplePubSub.onReady
public function onReady() { $appInstance = $this; // a reference to this application instance for ExampleWebSocketRoute \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute('ExamplePubSub', function ($client) use ($appInstance) { return new ExamplePubSubWebSocketRou...
php
public function onReady() { $appInstance = $this; // a reference to this application instance for ExampleWebSocketRoute \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute('ExamplePubSub', function ($client) use ($appInstance) { return new ExamplePubSubWebSocketRou...
[ "public", "function", "onReady", "(", ")", "{", "$", "appInstance", "=", "$", "this", ";", "// a reference to this application instance for ExampleWebSocketRoute", "\\", "PHPDaemon", "\\", "Servers", "\\", "WebSocket", "\\", "Pool", "::", "getInstance", "(", ")", "-...
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/ExamplePubSub.php#L13-L47
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicNackFrame.php
BasicNackFrame.create
public static function create( $deliveryTag = null, $multiple = null, $requeue = null ) { $frame = new self(); if (null !== $deliveryTag) { $frame->deliveryTag = $deliveryTag; } if (null !== $multiple) { $frame->multiple = $multiple; } ...
php
public static function create( $deliveryTag = null, $multiple = null, $requeue = null ) { $frame = new self(); if (null !== $deliveryTag) { $frame->deliveryTag = $deliveryTag; } if (null !== $multiple) { $frame->multiple = $multiple; } ...
[ "public", "static", "function", "create", "(", "$", "deliveryTag", "=", "null", ",", "$", "multiple", "=", "null", ",", "$", "requeue", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "delivery...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicNackFrame.php#L23-L40
kakserpom/phpdaemon
PHPDaemon/Traits/DeferredEventHandlers.php
DeferredEventHandlers.cleanupDeferredEventHandlers
public function cleanupDeferredEventHandlers() { foreach ($this as $key => $property) { if ($property instanceof DeferredEvent) { $property->cleanup(); $this->{$key} = null; } } }
php
public function cleanupDeferredEventHandlers() { foreach ($this as $key => $property) { if ($property instanceof DeferredEvent) { $property->cleanup(); $this->{$key} = null; } } }
[ "public", "function", "cleanupDeferredEventHandlers", "(", ")", "{", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "property", ")", "{", "if", "(", "$", "property", "instanceof", "DeferredEvent", ")", "{", "$", "property", "->", "cleanup", "(",...
Cleans up events @return void
[ "Cleans", "up", "events" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/DeferredEventHandlers.php#L53-L61
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicCancelFrame.php
BasicCancelFrame.create
public static function create( $consumerTag = null, $nowait = null ) { $frame = new self(); if (null !== $consumerTag) { $frame->consumerTag = $consumerTag; } if (null !== $nowait) { $frame->nowait = $nowait; } return $frame; ...
php
public static function create( $consumerTag = null, $nowait = null ) { $frame = new self(); if (null !== $consumerTag) { $frame->consumerTag = $consumerTag; } if (null !== $nowait) { $frame->nowait = $nowait; } return $frame; ...
[ "public", "static", "function", "create", "(", "$", "consumerTag", "=", "null", ",", "$", "nowait", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "consumerTag", ")", "{", "$", "frame", "->", ...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicCancelFrame.php#L21-L35
kakserpom/phpdaemon
PHPDaemon/Clients/Gearman/Connection.php
Connection.onRead
public function onRead() { if (($head = $this->lookExact(static::HEADER_LENGTH)) === false) { return; } list($magic, $typeInt, $size) = unpack(static::HEADER_READ_FORMAT, $head); if ($this->getInputLength() < static::HEADER_LENGTH + $size) { return; ...
php
public function onRead() { if (($head = $this->lookExact(static::HEADER_LENGTH)) === false) { return; } list($magic, $typeInt, $size) = unpack(static::HEADER_READ_FORMAT, $head); if ($this->getInputLength() < static::HEADER_LENGTH + $size) { return; ...
[ "public", "function", "onRead", "(", ")", "{", "if", "(", "(", "$", "head", "=", "$", "this", "->", "lookExact", "(", "static", "::", "HEADER_LENGTH", ")", ")", "===", "false", ")", "{", "return", ";", "}", "list", "(", "$", "magic", ",", "$", "t...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Gearman/Connection.php#L124-L152
kakserpom/phpdaemon
PHPDaemon/Clients/Gearman/Connection.php
Connection.onReady
public function onReady() { if (static::$requestCommandListFlipped === null) { static::$requestCommandListFlipped = array_flip(static::$requestCommandList); } if (static::$responseCommandListFlipped === null) { static::$responseCommandListFlipped = array_flip(static::...
php
public function onReady() { if (static::$requestCommandListFlipped === null) { static::$requestCommandListFlipped = array_flip(static::$requestCommandList); } if (static::$responseCommandListFlipped === null) { static::$responseCommandListFlipped = array_flip(static::...
[ "public", "function", "onReady", "(", ")", "{", "if", "(", "static", "::", "$", "requestCommandListFlipped", "===", "null", ")", "{", "static", "::", "$", "requestCommandListFlipped", "=", "array_flip", "(", "static", "::", "$", "requestCommandList", ")", ";",...
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/Gearman/Connection.php#L158-L167
kakserpom/phpdaemon
PHPDaemon/Clients/Gearman/Connection.php
Connection.sendCommand
public function sendCommand($commandName, $payload, $cb = null) { $pct = implode( static::ARGS_DELIMITER, array_map(function ($item) { return !is_scalar($item) ? serialize($item) : $item; }, (array)$payload) ); $this->onResponse->push($cb)...
php
public function sendCommand($commandName, $payload, $cb = null) { $pct = implode( static::ARGS_DELIMITER, array_map(function ($item) { return !is_scalar($item) ? serialize($item) : $item; }, (array)$payload) ); $this->onResponse->push($cb)...
[ "public", "function", "sendCommand", "(", "$", "commandName", ",", "$", "payload", ",", "$", "cb", "=", "null", ")", "{", "$", "pct", "=", "implode", "(", "static", "::", "ARGS_DELIMITER", ",", "array_map", "(", "function", "(", "$", "item", ")", "{", ...
Send a command @param $commandName @param $payload @param callable $cb = null
[ "Send", "a", "command" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Gearman/Connection.php#L188-L207
kakserpom/phpdaemon
PHPDaemon/Clients/Gearman/Connection.php
Connection.submitJob
public function submitJob($params, $cb = null) { $closure = function () use (&$params, $cb) { $this->sendCommand( 'SUBMIT_JOB' . (isset($params['pri']) ? '_ ' . strtoupper($params['pri']) : '') . (isset($params['bg']) && $params['bg'] ? '_BG' : '')...
php
public function submitJob($params, $cb = null) { $closure = function () use (&$params, $cb) { $this->sendCommand( 'SUBMIT_JOB' . (isset($params['pri']) ? '_ ' . strtoupper($params['pri']) : '') . (isset($params['bg']) && $params['bg'] ? '_BG' : '')...
[ "public", "function", "submitJob", "(", "$", "params", ",", "$", "cb", "=", "null", ")", "{", "$", "closure", "=", "function", "(", ")", "use", "(", "&", "$", "params", ",", "$", "cb", ")", "{", "$", "this", "->", "sendCommand", "(", "'SUBMIT_JOB'"...
Function run task and wait result in callback @param $params @param callable $cb = null @param boolean $unique
[ "Function", "run", "task", "and", "wait", "result", "in", "callback" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Gearman/Connection.php#L216-L239
kakserpom/phpdaemon
PHPDaemon/Utils/MIME.php
MIME.get
public static function get($path) { $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); if (!isset(self::$fileTypes[$ext])) { return false; } return self::$fileTypes[$ext]; }
php
public static function get($path) { $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); if (!isset(self::$fileTypes[$ext])) { return false; } return self::$fileTypes[$ext]; }
[ "public", "static", "function", "get", "(", "$", "path", ")", "{", "$", "ext", "=", "strtolower", "(", "pathinfo", "(", "$", "path", ",", "PATHINFO_EXTENSION", ")", ")", ";", "if", "(", "!", "isset", "(", "self", "::", "$", "fileTypes", "[", "$", "...
Returns MIME type of the given file @param string $path Path @return string MIME type
[ "Returns", "MIME", "type", "of", "the", "given", "file" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/MIME.php#L77-L84
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicPublishFrame.php
BasicPublishFrame.create
public static function create( $exchange = null, $routingKey = null, $mandatory = null, $immediate = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (null !== $routingKey) { $frame->routingKey = $routingK...
php
public static function create( $exchange = null, $routingKey = null, $mandatory = null, $immediate = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (null !== $routingKey) { $frame->routingKey = $routingK...
[ "public", "static", "function", "create", "(", "$", "exchange", "=", "null", ",", "$", "routingKey", "=", "null", ",", "$", "mandatory", "=", "null", ",", "$", "immediate", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicPublishFrame.php#L25-L45
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Pool.php
Pool.setRouteOptions
public function setRouteOptions($path, $opts) { $routeName = ltrim($path, '/'); if (!isset($this->routes[$routeName])) { Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is not found.'); return false; } $this->routeOptions[$routeName] = $opts; retur...
php
public function setRouteOptions($path, $opts) { $routeName = ltrim($path, '/'); if (!isset($this->routes[$routeName])) { Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is not found.'); return false; } $this->routeOptions[$routeName] = $opts; retur...
[ "public", "function", "setRouteOptions", "(", "$", "path", ",", "$", "opts", ")", "{", "$", "routeName", "=", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "routes", "[", "$", "routeName", "]", ...
Sets an array of options associated to the route @param string $path Route name. @param array $opts Options @return boolean Success.
[ "Sets", "an", "array", "of", "options", "associated", "to", "the", "route" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Pool.php#L58-L67
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Pool.php
Pool.getRouteOptions
public function getRouteOptions($path) { $routeName = ltrim($path, '/'); if (!isset($this->routeOptions[$routeName])) { return []; } return $this->routeOptions[$routeName]; }
php
public function getRouteOptions($path) { $routeName = ltrim($path, '/'); if (!isset($this->routeOptions[$routeName])) { return []; } return $this->routeOptions[$routeName]; }
[ "public", "function", "getRouteOptions", "(", "$", "path", ")", "{", "$", "routeName", "=", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "routeOptions", "[", "$", "routeName", "]", ")", ")", "{",...
Return options by route @param string $path Route name @return array Options
[ "Return", "options", "by", "route" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Pool.php#L75-L82
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Pool.php
Pool.addRoute
public function addRoute($path, $cb) { $routeName = ltrim($path, '/'); if (isset($this->routes[$routeName])) { Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is already defined.'); return false; } $this->routes[$routeName] = $cb; return true; ...
php
public function addRoute($path, $cb) { $routeName = ltrim($path, '/'); if (isset($this->routes[$routeName])) { Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is already defined.'); return false; } $this->routes[$routeName] = $cb; return true; ...
[ "public", "function", "addRoute", "(", "$", "path", ",", "$", "cb", ")", "{", "$", "routeName", "=", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "routes", "[", "$", "routeName", "]", ")", ")", "{...
Adds a route if it doesn't exist already. @param string $path Route name. @param callable $cb Route's callback. @callback $cb ( ) @return boolean Success.
[ "Adds", "a", "route", "if", "it", "doesn", "t", "exist", "already", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Pool.php#L91-L100
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Pool.php
Pool.setRoute
public function setRoute($path, $cb) { $routeName = ltrim($path, '/'); $this->routes[$routeName] = $cb; return true; }
php
public function setRoute($path, $cb) { $routeName = ltrim($path, '/'); $this->routes[$routeName] = $cb; return true; }
[ "public", "function", "setRoute", "(", "$", "path", ",", "$", "cb", ")", "{", "$", "routeName", "=", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "$", "this", "->", "routes", "[", "$", "routeName", "]", "=", "$", "cb", ";", "return", "true", ...
Force add/replace a route. @param string $path Path @param callable $cb Callback @callback $cb ( ) @return boolean Success
[ "Force", "add", "/", "replace", "a", "route", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Pool.php#L157-L162
kakserpom/phpdaemon
PHPDaemon/Servers/WebSocket/Pool.php
Pool.removeRoute
public function removeRoute($path) { $routeName = ltrim($path, '/'); if (!isset($this->routes[$routeName])) { return false; } unset($this->routes[$routeName]); return true; }
php
public function removeRoute($path) { $routeName = ltrim($path, '/'); if (!isset($this->routes[$routeName])) { return false; } unset($this->routes[$routeName]); return true; }
[ "public", "function", "removeRoute", "(", "$", "path", ")", "{", "$", "routeName", "=", "ltrim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "routes", "[", "$", "routeName", "]", ")", ")", "{", "return...
Removes a route. @param string $path Route name @return boolean Success
[ "Removes", "a", "route", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Pool.php#L169-L177
kakserpom/phpdaemon
PHPDaemon/Clients/WebSocket/Example.php
Example.init
public function init() { if ($this->isEnabled()) { $this->wsclient = Pool::getInstance($this->config->wsclientname->value); } }
php
public function init() { if ($this->isEnabled()) { $this->wsclient = Pool::getInstance($this->config->wsclientname->value); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "$", "this", "->", "wsclient", "=", "Pool", "::", "getInstance", "(", "$", "this", "->", "config", "->", "wsclientname", "->", "value", ")", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/WebSocket/Example.php#L23-L28
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.find
public function find($cb, $p = []) { $p['col'] = $this->name; $this->pool->find($p, $cb); }
php
public function find($cb, $p = []) { $p['col'] = $this->name; $this->pool->find($p, $cb); }
[ "public", "function", "find", "(", "$", "cb", ",", "$", "p", "=", "[", "]", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "find", "(", "$", "p", ",", "$", "cb", ")", ";", "}" ...
Finds objects in collection @param callable $cb Callback called when response received @param array $p Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @callback $cb ( ) @return void
[ "Finds", "objects", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L43-L47
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.findAll
public function findAll($cb, $p = []) { $p['col'] = $this->name; $this->pool->findAll($p, $cb); }
php
public function findAll($cb, $p = []) { $p['col'] = $this->name; $this->pool->findAll($p, $cb); }
[ "public", "function", "findAll", "(", "$", "cb", ",", "$", "p", "=", "[", "]", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "findAll", "(", "$", "p", ",", "$", "cb", ")", ";", ...
Finds objects in collection and fires callback when got all objects @param callable $cb Callback called when response received @param array $p Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @callback $cb ( ) @return void
[ "Finds", "objects", "in", "collection", "and", "fires", "callback", "when", "got", "all", "objects" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L56-L60
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.findOne
public function findOne($cb, $p = []) { $p['col'] = $this->name; $this->pool->findOne($p, $cb); }
php
public function findOne($cb, $p = []) { $p['col'] = $this->name; $this->pool->findOne($p, $cb); }
[ "public", "function", "findOne", "(", "$", "cb", ",", "$", "p", "=", "[", "]", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "findOne", "(", "$", "p", ",", "$", "cb", ")", ";", ...
Finds one object in collection @param callable $cb Callback called when response received @param array $p Hash of properties (offset, opts, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) @callback $cb ( ) @return void
[ "Finds", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L69-L73
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.count
public function count($cb, $p = []) { $p['col'] = $this->name; $this->pool->findCount($p, $cb); }
php
public function count($cb, $p = []) { $p['col'] = $this->name; $this->pool->findCount($p, $cb); }
[ "public", "function", "count", "(", "$", "cb", ",", "$", "p", "=", "[", "]", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "findCount", "(", "$", "p", ",", "$", "cb", ")", ";", ...
Counts objects in collection @param callable $cb Callback called when response received @param array $p Hash of properties (offset, limit, opts, where, col) @callback $cb ( ) @return void
[ "Counts", "objects", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L82-L86
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.ensureIndex
public function ensureIndex($keys, $options = [], $cb = null) { $this->pool->ensureIndex($this->name, $keys, $options, $cb); }
php
public function ensureIndex($keys, $options = [], $cb = null) { $this->pool->ensureIndex($this->name, $keys, $options, $cb); }
[ "public", "function", "ensureIndex", "(", "$", "keys", ",", "$", "options", "=", "[", "]", ",", "$", "cb", "=", "null", ")", "{", "$", "this", "->", "pool", "->", "ensureIndex", "(", "$", "this", "->", "name", ",", "$", "keys", ",", "$", "options...
Ensure index @param array $keys Keys @param array $options Optional. Options @param callable $cb Optional. Callback called when response received @callback $cb ( ) @return void
[ "Ensure", "index" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L96-L99
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.group
public function group($cb, $p = []) { $p['col'] = $this->name; $this->pool->group($p, $cb); }
php
public function group($cb, $p = []) { $p['col'] = $this->name; $this->pool->group($p, $cb); }
[ "public", "function", "group", "(", "$", "cb", ",", "$", "p", "=", "[", "]", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "group", "(", "$", "p", ",", "$", "cb", ")", ";", "}...
Groupping function @param callable $cb Callback called when response received @param array $p Hash of properties (offset, limit, opts, key, col, reduce, initial) @callback $cb ( ) @return void
[ "Groupping", "function" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L108-L112
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.insert
public function insert($doc, $cb = null, $params = null) { return $this->pool->insert($this->name, $doc, $cb, $params); }
php
public function insert($doc, $cb = null, $params = null) { return $this->pool->insert($this->name, $doc, $cb, $params); }
[ "public", "function", "insert", "(", "$", "doc", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "return", "$", "this", "->", "pool", "->", "insert", "(", "$", "this", "->", "name", ",", "$", "doc", ",", "$", "cb", ",", ...
Inserts an object @param array $doc Data @param callable $cb Optional. Callback called when response received @param array $params Optional. Params @callback $cb ( ) @return MongoId
[ "Inserts", "an", "object" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L122-L125
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.insertMulti
public function insertMulti($docs, $cb = null, $params = null) { return $this->pool->insertMulti($this->name, $docs, $cb, $params); }
php
public function insertMulti($docs, $cb = null, $params = null) { return $this->pool->insertMulti($this->name, $docs, $cb, $params); }
[ "public", "function", "insertMulti", "(", "$", "docs", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "return", "$", "this", "->", "pool", "->", "insertMulti", "(", "$", "this", "->", "name", ",", "$", "docs", ",", "$", "...
Inserts several documents @param array $docs Array of docs @param callable $cb Optional. Callback called when response received. @param array $params Optional. Params @callback $cb ( ) @return array IDs
[ "Inserts", "several", "documents" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L148-L151
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.update
public function update($cond, $data, $flags = 0, $cb = null, $params = null) { $this->pool->update($this->name, $cond, $data, $flags, $cb, $params); }
php
public function update($cond, $data, $flags = 0, $cb = null, $params = null) { $this->pool->update($this->name, $cond, $data, $flags, $cb, $params); }
[ "public", "function", "update", "(", "$", "cond", ",", "$", "data", ",", "$", "flags", "=", "0", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "pool", "->", "update", "(", "$", "this", "->", "name", ...
Updates one object in collection @param array $cond Conditions @param array $data Data @param integer $flags Optional. Flags @param callable $cb Optional. Callback called when response received @param array $params Optional. Params @callback $cb ( ) @return void
[ "Updates", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L163-L166
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.updateOne
public function updateOne($cond, $data, $cb = null, $params = null) { $this->pool->updateOne($this->name, $cond, $data, $cb, $params); }
php
public function updateOne($cond, $data, $cb = null, $params = null) { $this->pool->updateOne($this->name, $cond, $data, $cb, $params); }
[ "public", "function", "updateOne", "(", "$", "cond", ",", "$", "data", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "pool", "->", "updateOne", "(", "$", "this", "->", "name", ",", "$", "cond", ",", ...
Updates one object in collection @param array $cond Conditions @param array $data Data @param callable $cb Optional. Callback called when response received @param array $params Optional. Params @callback $cb ( ) @return void
[ "Updates", "one", "object", "in", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L178-L181
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.upsert
public function upsert($cond, $data, $multi = false, $cb = null, $params = null) { $this->pool->upsert($this->name, $cond, $data, $multi, $cb, $params); }
php
public function upsert($cond, $data, $multi = false, $cb = null, $params = null) { $this->pool->upsert($this->name, $cond, $data, $multi, $cb, $params); }
[ "public", "function", "upsert", "(", "$", "cond", ",", "$", "data", ",", "$", "multi", "=", "false", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "pool", "->", "upsert", "(", "$", "this", "->", "nam...
Upserts an object (updates if exists, insert if not exists) @param array $cond Conditions @param array $data Data @param boolean $multi Optional. Multi-flag @param callable $cb Optional. Callback called when response received @param array $params Optional. Params @callback $cb ( ) @return void
[ "Upserts", "an", "object", "(", "updates", "if", "exists", "insert", "if", "not", "exists", ")" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L207-L210
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.remove
public function remove($cond = [], $cb = null, $params = null) { $this->pool->remove($this->name, $cond, $cb); }
php
public function remove($cond = [], $cb = null, $params = null) { $this->pool->remove($this->name, $cond, $cb); }
[ "public", "function", "remove", "(", "$", "cond", "=", "[", "]", ",", "$", "cb", "=", "null", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "pool", "->", "remove", "(", "$", "this", "->", "name", ",", "$", "cond", ",", "$", "c...
Removes objects from collection @param array $cond Conditions @param callable $cb Optional. Callback called when response received @param array $params Optional. Params @callback $cb ( ) @return void
[ "Removes", "objects", "from", "collection" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L248-L251
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.aggregate
public function aggregate($p, $cb) { $p['col'] = $this->name; $this->pool->aggregate($p, $cb); }
php
public function aggregate($p, $cb) { $p['col'] = $this->name; $this->pool->aggregate($p, $cb); }
[ "public", "function", "aggregate", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "aggregate", "(", "$", "p", ",", "$", "cb", ")", ";", "}" ]
Aggregate @param array $p Params @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Aggregate" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L273-L277
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.autoincrement
public function autoincrement($cb, $plain = false) { $e = explode('.', $this->name); $col = (isset($e[1]) ? $e[0] . '.' : '') . 'autoincrement'; $this->pool->{$col}->findAndModify([ 'query' => ['_id' => isset($e[1]) ? $e[1] : $e[0]], 'update' => ['$inc' => ['seq' => 1...
php
public function autoincrement($cb, $plain = false) { $e = explode('.', $this->name); $col = (isset($e[1]) ? $e[0] . '.' : '') . 'autoincrement'; $this->pool->{$col}->findAndModify([ 'query' => ['_id' => isset($e[1]) ? $e[1] : $e[0]], 'update' => ['$inc' => ['seq' => 1...
[ "public", "function", "autoincrement", "(", "$", "cb", ",", "$", "plain", "=", "false", ")", "{", "$", "e", "=", "explode", "(", "'.'", ",", "$", "this", "->", "name", ")", ";", "$", "col", "=", "(", "isset", "(", "$", "e", "[", "1", "]", ")"...
Generation autoincrement @param callable $cb Called when response received @param boolean $plain Plain? @callback $cb ( ) @return void
[ "Generation", "autoincrement" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L286-L298
kakserpom/phpdaemon
PHPDaemon/Clients/Mongo/Collection.php
Collection.findAndModify
public function findAndModify($p, $cb) { $p['col'] = $this->name; $this->pool->findAndModify($p, $cb); }
php
public function findAndModify($p, $cb) { $p['col'] = $this->name; $this->pool->findAndModify($p, $cb); }
[ "public", "function", "findAndModify", "(", "$", "p", ",", "$", "cb", ")", "{", "$", "p", "[", "'col'", "]", "=", "$", "this", "->", "name", ";", "$", "this", "->", "pool", "->", "findAndModify", "(", "$", "p", ",", "$", "cb", ")", ";", "}" ]
Generation autoincrement @param array $p Params @param callable $cb Callback called when response received @callback $cb ( ) @return void
[ "Generation", "autoincrement" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Mongo/Collection.php#L307-L311
kakserpom/phpdaemon
PHPDaemon/Structures/PriorityQueueCallbacks.php
PriorityQueueCallbacks.executeOne
public function executeOne(...$args) { if ($this->isEmpty()) { return false; } $cb = $this->extract(); if ($cb) { $cb(...$args); } return true; }
php
public function executeOne(...$args) { if ($this->isEmpty()) { return false; } $cb = $this->extract(); if ($cb) { $cb(...$args); } return true; }
[ "public", "function", "executeOne", "(", "...", "$", "args", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "$", "cb", "=", "$", "this", "->", "extract", "(", ")", ";", "if", "(", "$", "cb", ...
Executes one callback from the top of queue with arbitrary arguments @param mixed ...$args Arguments @return boolean
[ "Executes", "one", "callback", "from", "the", "top", "of", "queue", "with", "arbitrary", "arguments" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Structures/PriorityQueueCallbacks.php#L66-L76
kakserpom/phpdaemon
PHPDaemon/Structures/PriorityQueueCallbacks.php
PriorityQueueCallbacks.executeAll
public function executeAll(...$args) { if ($this->isEmpty()) { return 0; } $n = 0; do { $cb = $this->extract(); if ($cb) { $cb(...$args); ++$n; } } while (!$this->isEmpty()); return $n; ...
php
public function executeAll(...$args) { if ($this->isEmpty()) { return 0; } $n = 0; do { $cb = $this->extract(); if ($cb) { $cb(...$args); ++$n; } } while (!$this->isEmpty()); return $n; ...
[ "public", "function", "executeAll", "(", "...", "$", "args", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "0", ";", "}", "$", "n", "=", "0", ";", "do", "{", "$", "cb", "=", "$", "this", "->", "extract", "("...
Executes all callbacks from the top of queue to bottom with arbitrary arguments @param mixed ...$args Arguments @return integer
[ "Executes", "all", "callbacks", "from", "the", "top", "of", "queue", "to", "bottom", "with", "arbitrary", "arguments" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Structures/PriorityQueueCallbacks.php#L83-L97
kakserpom/phpdaemon
PHPDaemon/Clients/WebSocket/Connection.php
Connection.onReady
public function onReady() { $this->setWatermark(2, $this->pool->maxAllowedPacket); Crypt::randomString(16, null, function ($string) { $this->key = base64_encode($string); $this->write('GET /' . $this->path . " HTTP/1.1\r\nHost: " . $this->host . ($this->port != 80 ? ':' . $th...
php
public function onReady() { $this->setWatermark(2, $this->pool->maxAllowedPacket); Crypt::randomString(16, null, function ($string) { $this->key = base64_encode($string); $this->write('GET /' . $this->path . " HTTP/1.1\r\nHost: " . $this->host . ($this->port != 80 ? ':' . $th...
[ "public", "function", "onReady", "(", ")", "{", "$", "this", "->", "setWatermark", "(", "2", ",", "$", "this", "->", "pool", "->", "maxAllowedPacket", ")", ";", "Crypt", "::", "randomString", "(", "16", ",", "null", ",", "function", "(", "$", "string",...
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/WebSocket/Connection.php#L73-L80
kakserpom/phpdaemon
PHPDaemon/Clients/WebSocket/Connection.php
Connection.onRead
public function onRead() { start: if ($this->state === static::STATE_HEADER) { $l = $this->getInputLength(); if ($l < 2) { return; } $hdr = $this->look(2); $fb = Binary::getbitmap(ord($hdr)); $fin = (bool)$fb{0};...
php
public function onRead() { start: if ($this->state === static::STATE_HEADER) { $l = $this->getInputLength(); if ($l < 2) { return; } $hdr = $this->look(2); $fb = Binary::getbitmap(ord($hdr)); $fin = (bool)$fb{0};...
[ "public", "function", "onRead", "(", ")", "{", "start", ":", "if", "(", "$", "this", "->", "state", "===", "static", "::", "STATE_HEADER", ")", "{", "$", "l", "=", "$", "this", "->", "getInputLength", "(", ")", ";", "if", "(", "$", "l", "<", "2",...
Called when new data received @return void
[ "Called", "when", "new", "data", "received" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/WebSocket/Connection.php#L86-L177
kakserpom/phpdaemon
PHPDaemon/Clients/WebSocket/Connection.php
Connection.sendFrame
public function sendFrame($payload, $type = Pool::TYPE_TEXT, $isMasked = true) { $payloadLength = mb_orig_strlen($payload); if ($payloadLength > $this->pool->maxAllowedPacket) { Daemon::$process->log('max-allowed-packet (' . $this->pool->config->maxallowedpacket->getHumanValue() . ') exc...
php
public function sendFrame($payload, $type = Pool::TYPE_TEXT, $isMasked = true) { $payloadLength = mb_orig_strlen($payload); if ($payloadLength > $this->pool->maxAllowedPacket) { Daemon::$process->log('max-allowed-packet (' . $this->pool->config->maxallowedpacket->getHumanValue() . ') exc...
[ "public", "function", "sendFrame", "(", "$", "payload", ",", "$", "type", "=", "Pool", "::", "TYPE_TEXT", ",", "$", "isMasked", "=", "true", ")", "{", "$", "payloadLength", "=", "mb_orig_strlen", "(", "$", "payload", ")", ";", "if", "(", "$", "payloadL...
Send frame to WebSocket server @param string $payload @param string $type @param boolean $isMasked
[ "Send", "frame", "to", "WebSocket", "server" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/WebSocket/Connection.php#L185-L239
kakserpom/phpdaemon
PHPDaemon/Clients/XMPP/XMPPRoster.php
XMPPRoster._addContact
public function _addContact($jid, $subscription, $name = '', $groups = []) { $contact = ['jid' => $jid, 'subscription' => $subscription, 'name' => $name, 'groups' => $groups]; if ($this->isContact($jid)) { $this->roster_array[$jid]['contact'] = $contact; } else { $thi...
php
public function _addContact($jid, $subscription, $name = '', $groups = []) { $contact = ['jid' => $jid, 'subscription' => $subscription, 'name' => $name, 'groups' => $groups]; if ($this->isContact($jid)) { $this->roster_array[$jid]['contact'] = $contact; } else { $thi...
[ "public", "function", "_addContact", "(", "$", "jid", ",", "$", "subscription", ",", "$", "name", "=", "''", ",", "$", "groups", "=", "[", "]", ")", "{", "$", "contact", "=", "[", "'jid'", "=>", "$", "jid", ",", "'subscription'", "=>", "$", "subscr...
Add given contact to roster @param string $jid @param string $subscription @param string $name @param array $groups
[ "Add", "given", "contact", "to", "roster" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/XMPP/XMPPRoster.php#L116-L124
kakserpom/phpdaemon
PHPDaemon/SockJS/Methods/Iframe.php
Iframe.init
public function init() { parent::init(); if (isset($this->attrs->version)) { $this->version = $this->attrs->version; } $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0'); $this->header('Expires: ' . date('r', strtotime('+1 year')))...
php
public function init() { parent::init(); if (isset($this->attrs->version)) { $this->version = $this->attrs->version; } $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0'); $this->header('Expires: ' . date('r', strtotime('+1 year')))...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "attrs", "->", "version", ")", ")", "{", "$", "this", "->", "version", "=", "$", "this", "->", "attrs", "->", "version...
Constructor @return void
[ "Constructor" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/Methods/Iframe.php#L19-L56
kakserpom/phpdaemon
PHPDaemon/Core/Bootstrap.php
Bootstrap.init
public static function init($configFile = null) { if (!version_compare(PHP_VERSION, '5.6.0', '>=')) { Daemon::log('PHP >= 5.6.0 required.'); return; } //run without composer if (!function_exists('setTimeout')) { require 'PHPDaemon/Utils/func.php';...
php
public static function init($configFile = null) { if (!version_compare(PHP_VERSION, '5.6.0', '>=')) { Daemon::log('PHP >= 5.6.0 required.'); return; } //run without composer if (!function_exists('setTimeout')) { require 'PHPDaemon/Utils/func.php';...
[ "public", "static", "function", "init", "(", "$", "configFile", "=", "null", ")", "{", "if", "(", "!", "version_compare", "(", "PHP_VERSION", ",", "'5.6.0'", ",", "'>='", ")", ")", "{", "Daemon", "::", "log", "(", "'PHP >= 5.6.0 required.'", ")", ";", "r...
Actions on early startup. @param string Optional. Config file path. @return void
[ "Actions", "on", "early", "startup", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Bootstrap.php#L101-L434
kakserpom/phpdaemon
PHPDaemon/Core/Bootstrap.php
Bootstrap.printHelp
protected static function printHelp() { $term = new Terminal(); echo 'phpDaemon ' . Daemon::$version . ". http://phpdaemon.net\n"; self::printUsage(); echo "\nAlso you can use some optional parameters to override the same configuration variables:\n"; foreach (self::$param...
php
protected static function printHelp() { $term = new Terminal(); echo 'phpDaemon ' . Daemon::$version . ". http://phpdaemon.net\n"; self::printUsage(); echo "\nAlso you can use some optional parameters to override the same configuration variables:\n"; foreach (self::$param...
[ "protected", "static", "function", "printHelp", "(", ")", "{", "$", "term", "=", "new", "Terminal", "(", ")", ";", "echo", "'phpDaemon '", ".", "Daemon", "::", "$", "version", ".", "\". http://phpdaemon.net\\n\"", ";", "self", "::", "printUsage", "(", ")", ...
Print help @return void
[ "Print", "help" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Bootstrap.php#L449-L474
kakserpom/phpdaemon
PHPDaemon/Core/Bootstrap.php
Bootstrap.start
public static function start() { if (Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid)) { Daemon::log('[START] phpDaemon with pid-file \'' . Daemon::$config->pidfile->value . '\' is running already (PID ' . Bootstrap::$pid . ')'); exit(6); } Daemon::i...
php
public static function start() { if (Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid)) { Daemon::log('[START] phpDaemon with pid-file \'' . Daemon::$config->pidfile->value . '\' is running already (PID ' . Bootstrap::$pid . ')'); exit(6); } Daemon::i...
[ "public", "static", "function", "start", "(", ")", "{", "if", "(", "Bootstrap", "::", "$", "pid", "&&", "Thread", "\\", "Generic", "::", "ifExistsByPid", "(", "Bootstrap", "::", "$", "pid", ")", ")", "{", "Daemon", "::", "log", "(", "'[START] phpDaemon w...
Start master. @return void
[ "Start", "master", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Bootstrap.php#L480-L490
kakserpom/phpdaemon
PHPDaemon/Core/Bootstrap.php
Bootstrap.stop
public static function stop($mode = 1) { $ok = Bootstrap::$pid && posix_kill( Bootstrap::$pid, $mode === 3 ? SIGINT : (($mode === 4) ? SIGTSTP : SIGTERM) ); if (!$ok) { echo '[WARN]. It seems that phpDaemon is not running' . (Bootstrap::$pid ?...
php
public static function stop($mode = 1) { $ok = Bootstrap::$pid && posix_kill( Bootstrap::$pid, $mode === 3 ? SIGINT : (($mode === 4) ? SIGTSTP : SIGTERM) ); if (!$ok) { echo '[WARN]. It seems that phpDaemon is not running' . (Bootstrap::$pid ?...
[ "public", "static", "function", "stop", "(", "$", "mode", "=", "1", ")", "{", "$", "ok", "=", "Bootstrap", "::", "$", "pid", "&&", "posix_kill", "(", "Bootstrap", "::", "$", "pid", ",", "$", "mode", "===", "3", "?", "SIGINT", ":", "(", "(", "$", ...
Stop script. @param int $mode @return void
[ "Stop", "script", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Bootstrap.php#L508-L527
kakserpom/phpdaemon
PHPDaemon/Core/Bootstrap.php
Bootstrap.getArgs
public static function getArgs($args) { $out = []; $last_arg = null; for ($i = 1, $il = sizeof($args); $i < $il; ++$i) { if (preg_match('~^--(.+)~', $args[$i], $match)) { $parts = explode('=', $match[1]); $key = preg_replace('~[^a-z0-9]+~', '', $p...
php
public static function getArgs($args) { $out = []; $last_arg = null; for ($i = 1, $il = sizeof($args); $i < $il; ++$i) { if (preg_match('~^--(.+)~', $args[$i], $match)) { $parts = explode('=', $match[1]); $key = preg_replace('~[^a-z0-9]+~', '', $p...
[ "public", "static", "function", "getArgs", "(", "$", "args", ")", "{", "$", "out", "=", "[", "]", ";", "$", "last_arg", "=", "null", ";", "for", "(", "$", "i", "=", "1", ",", "$", "il", "=", "sizeof", "(", "$", "args", ")", ";", "$", "i", "...
Parses command-line arguments. @param array $args $_SERVER ['argv'] @return array Arguments
[ "Parses", "command", "-", "line", "arguments", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Bootstrap.php#L534-L565
kakserpom/phpdaemon
PHPDaemon/SockJS/WebSocketRouteProxy.php
WebSocketRouteProxy.onFrame
public function onFrame($data, $type) { foreach (explode("\n", $data) as $pct) { if ($pct === '') { continue; } $pct = json_decode($pct, true); if (isset($pct[0])) { foreach ($pct as $i) { $this->onPacket(rtr...
php
public function onFrame($data, $type) { foreach (explode("\n", $data) as $pct) { if ($pct === '') { continue; } $pct = json_decode($pct, true); if (isset($pct[0])) { foreach ($pct as $i) { $this->onPacket(rtr...
[ "public", "function", "onFrame", "(", "$", "data", ",", "$", "type", ")", "{", "foreach", "(", "explode", "(", "\"\\n\"", ",", "$", "data", ")", "as", "$", "pct", ")", "{", "if", "(", "$", "pct", "===", "''", ")", "{", "continue", ";", "}", "$"...
Called when new frame received. @param string $data Frame's contents. @param integer $type Frame's type. @return void
[ "Called", "when", "new", "frame", "received", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/WebSocketRouteProxy.php#L60-L75
kakserpom/phpdaemon
PHPDaemon/SockJS/WebSocketRouteProxy.php
WebSocketRouteProxy.onBeforeHandshake
public function onBeforeHandshake($cb) { if (!method_exists($this->realRoute, 'onBeforeHandshake')) { return false; } $this->realRoute->onBeforeHandshake($cb); }
php
public function onBeforeHandshake($cb) { if (!method_exists($this->realRoute, 'onBeforeHandshake')) { return false; } $this->realRoute->onBeforeHandshake($cb); }
[ "public", "function", "onBeforeHandshake", "(", "$", "cb", ")", "{", "if", "(", "!", "method_exists", "(", "$", "this", "->", "realRoute", ",", "'onBeforeHandshake'", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "realRoute", "->", "onBe...
realRoute onBeforeHandshake @param callable $cb @return void|false
[ "realRoute", "onBeforeHandshake" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/SockJS/WebSocketRouteProxy.php#L93-L99
kakserpom/phpdaemon
PHPDaemon/Clients/Memcache/Pool.php
Pool.get
public function get($key, $onResponse) { $this->requestByKey($key, 'get ' . $this->config->prefix->value . $key . "\r\n", $onResponse); }
php
public function get($key, $onResponse) { $this->requestByKey($key, 'get ' . $this->config->prefix->value . $key . "\r\n", $onResponse); }
[ "public", "function", "get", "(", "$", "key", ",", "$", "onResponse", ")", "{", "$", "this", "->", "requestByKey", "(", "$", "key", ",", "'get '", ".", "$", "this", "->", "config", "->", "prefix", "->", "value", ".", "$", "key", ".", "\"\\r\\n\"", ...
Gets the key @param string $key Key @param callable $onResponse Callback called when response received @callback $onResponse ( ) @return void
[ "Gets", "the", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Memcache/Pool.php#L19-L22
kakserpom/phpdaemon
PHPDaemon/Clients/Memcache/Pool.php
Pool.set
public function set($key, $value, $exp = 0, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse->pus...
php
public function set($key, $value, $exp = 0, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse->pus...
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ",", "$", "exp", "=", "0", ",", "$", "onResponse", "=", "null", ")", "{", "$", "this", "->", "getConnectionByKey", "(", "$", "key", ",", "function", "(", "$", "conn", ")", "use", "(...
Sets the key @param string $key Key @param string $value Value @param integer $exp Lifetime in seconds (0 - immortal) @param callable $onResponse Callback called when the request complete @callback $onResponse ( ) @return void
[ "Sets", "the", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Memcache/Pool.php#L33-L49
kakserpom/phpdaemon
PHPDaemon/Clients/Memcache/Pool.php
Pool.delete
public function delete($key, $onResponse = null, $time = 0) { $this->getConnectionByKey($key, function ($conn) use ($key, $time, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse->push($onRespon...
php
public function delete($key, $onResponse = null, $time = 0) { $this->getConnectionByKey($key, function ($conn) use ($key, $time, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse->push($onRespon...
[ "public", "function", "delete", "(", "$", "key", ",", "$", "onResponse", "=", "null", ",", "$", "time", "=", "0", ")", "{", "$", "this", "->", "getConnectionByKey", "(", "$", "key", ",", "function", "(", "$", "conn", ")", "use", "(", "$", "key", ...
Deletes the key @param string $key Key @param callable $onResponse Callback called when the request complete @param integer $time Time to block this key @callback $onResponse ( ) @return void
[ "Deletes", "the", "key" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Memcache/Pool.php#L83-L95
kakserpom/phpdaemon
PHPDaemon/Clients/Memcache/Pool.php
Pool.prepend
public function prepend($key, $value, $exp = 0, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse-...
php
public function prepend($key, $value, $exp = 0, $onResponse = null) { $this->getConnectionByKey($key, function ($conn) use ($key, $value, $exp, $onResponse) { if (!$conn->connected) { return; } if ($onResponse !== null) { $conn->onResponse-...
[ "public", "function", "prepend", "(", "$", "key", ",", "$", "value", ",", "$", "exp", "=", "0", ",", "$", "onResponse", "=", "null", ")", "{", "$", "this", "->", "getConnectionByKey", "(", "$", "key", ",", "function", "(", "$", "conn", ")", "use", ...
Prepends a string to the key's value @param string $key Key @param string $value Value @param integer $exp Lifetime in seconds (0 - immortal) @param callable $onResponse Callback called when the request complete @callback $onResponse ( ) @return void
[ "Prepends", "a", "string", "to", "the", "key", "s", "value" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/Memcache/Pool.php#L154-L167
kakserpom/phpdaemon
PHPDaemon/Utils/DateTime.php
DateTime.diffAsText
public static function diffAsText($datetime1, $datetime2, $absolute = false) { if (!($datetime1 instanceof \DateTimeInterface)) { $datetime1 = new static($datetime1); } if (!($datetime2 instanceof \DateTimeInterface)) { $datetime2 = new static($datetime2); } ...
php
public static function diffAsText($datetime1, $datetime2, $absolute = false) { if (!($datetime1 instanceof \DateTimeInterface)) { $datetime1 = new static($datetime1); } if (!($datetime2 instanceof \DateTimeInterface)) { $datetime2 = new static($datetime2); } ...
[ "public", "static", "function", "diffAsText", "(", "$", "datetime1", ",", "$", "datetime2", ",", "$", "absolute", "=", "false", ")", "{", "if", "(", "!", "(", "$", "datetime1", "instanceof", "\\", "DateTimeInterface", ")", ")", "{", "$", "datetime1", "="...
Calculates a difference between two dates @see http://www.php.net/manual/en/datetime.diff.php @param integer|string|\DateTimeInterface $datetime1 @param integer|string|\DateTimeInterface $datetime2 @param boolean $absolute @return string Something like this: 1 year. 2 mon. 6 day. 4 hours. 21 min. 10 sec.
[ "Calculates", "a", "difference", "between", "two", "dates" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/DateTime.php#L34-L53
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Exchange/ExchangeDeleteFrame.php
ExchangeDeleteFrame.create
public static function create( $exchange = null, $ifUnused = null, $nowait = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (null !== $ifUnused) { $frame->ifUnused = $ifUnused; } if (null...
php
public static function create( $exchange = null, $ifUnused = null, $nowait = null ) { $frame = new self(); if (null !== $exchange) { $frame->exchange = $exchange; } if (null !== $ifUnused) { $frame->ifUnused = $ifUnused; } if (null...
[ "public", "static", "function", "create", "(", "$", "exchange", "=", "null", ",", "$", "ifUnused", "=", "null", ",", "$", "nowait", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "exchange", ...
bit
[ "bit" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Exchange/ExchangeDeleteFrame.php#L23-L40
kakserpom/phpdaemon
PHPDaemon/IPCManager/IPCManager.php
IPCManager.init
public function init() { $this->socketurl = sprintf($this->config->mastersocket->value, crc32(Daemon::$config->pidfile->value . "\x00" . Daemon::$config->user->value . "\x00" . Daemon::$config->group->value)); if (Daemon::$process instanceof Thread\IPC) { $this->pool = Master...
php
public function init() { $this->socketurl = sprintf($this->config->mastersocket->value, crc32(Daemon::$config->pidfile->value . "\x00" . Daemon::$config->user->value . "\x00" . Daemon::$config->group->value)); if (Daemon::$process instanceof Thread\IPC) { $this->pool = Master...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "socketurl", "=", "sprintf", "(", "$", "this", "->", "config", "->", "mastersocket", "->", "value", ",", "crc32", "(", "Daemon", "::", "$", "config", "->", "pidfile", "->", "value", ".", ...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/IPCManager/IPCManager.php#L35-L44
kakserpom/phpdaemon
PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionSecureFrame.php
ConnectionSecureFrame.create
public static function create( $challenge = null ) { $frame = new self(); if (null !== $challenge) { $frame->challenge = $challenge; } return $frame; }
php
public static function create( $challenge = null ) { $frame = new self(); if (null !== $challenge) { $frame->challenge = $challenge; } return $frame; }
[ "public", "static", "function", "create", "(", "$", "challenge", "=", "null", ")", "{", "$", "frame", "=", "new", "self", "(", ")", ";", "if", "(", "null", "!==", "$", "challenge", ")", "{", "$", "frame", "->", "challenge", "=", "$", "challenge", "...
longstr
[ "longstr" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Connection/ConnectionSecureFrame.php#L20-L31
kakserpom/phpdaemon
PHPDaemon/BoundSocket/TCP.php
TCP.bindSocket
public function bindSocket() { if ($this->erroneous) { return false; } $port = $this->getPort(); if (!is_int($port)) { Daemon::log(get_class($this) . ' (' . get_class($this->pool) . '): no port defined for \'' . $this->uri['uri'] . '\''); return; ...
php
public function bindSocket() { if ($this->erroneous) { return false; } $port = $this->getPort(); if (!is_int($port)) { Daemon::log(get_class($this) . ' (' . get_class($this->pool) . '): no port defined for \'' . $this->uri['uri'] . '\''); return; ...
[ "public", "function", "bindSocket", "(", ")", "{", "if", "(", "$", "this", "->", "erroneous", ")", "{", "return", "false", ";", "}", "$", "port", "=", "$", "this", "->", "getPort", "(", ")", ";", "if", "(", "!", "is_int", "(", "$", "port", ")", ...
Bind the socket @return null|boolean Success.
[ "Bind", "the", "socket" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/TCP.php#L47-L98
kakserpom/phpdaemon
PHPDaemon/BoundSocket/TCP.php
TCP.onBound
protected function onBound() { if ($this->ev) { $this->ev->getSocketName($this->locHost, $this->locPort); } else { Daemon::log('Unable to bind TCP-socket ' . $this->host . ':' . $this->getPort()); } }
php
protected function onBound() { if ($this->ev) { $this->ev->getSocketName($this->locHost, $this->locPort); } else { Daemon::log('Unable to bind TCP-socket ' . $this->host . ':' . $this->getPort()); } }
[ "protected", "function", "onBound", "(", ")", "{", "if", "(", "$", "this", "->", "ev", ")", "{", "$", "this", "->", "ev", "->", "getSocketName", "(", "$", "this", "->", "locHost", ",", "$", "this", "->", "locPort", ")", ";", "}", "else", "{", "Da...
Called when socket is bound @return boolean|null Success
[ "Called", "when", "socket", "is", "bound" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/BoundSocket/TCP.php#L104-L111
kakserpom/phpdaemon
PHPDaemon/Thread/IPC.php
IPC.run
protected function run() { if (Daemon::$process instanceof Master) { Daemon::$process->unregisterSignals(); } EventLoop::init(); Daemon::$process = $this; if (Daemon::$logpointerAsync) { Daemon::$logpointerAsync->fd = null; Daemon::$logpoin...
php
protected function run() { if (Daemon::$process instanceof Master) { Daemon::$process->unregisterSignals(); } EventLoop::init(); Daemon::$process = $this; if (Daemon::$logpointerAsync) { Daemon::$logpointerAsync->fd = null; Daemon::$logpoin...
[ "protected", "function", "run", "(", ")", "{", "if", "(", "Daemon", "::", "$", "process", "instanceof", "Master", ")", "{", "Daemon", "::", "$", "process", "->", "unregisterSignals", "(", ")", ";", "}", "EventLoop", "::", "init", "(", ")", ";", "Daemon...
Runtime of Worker process. @return void
[ "Runtime", "of", "Worker", "process", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/IPC.php#L76-L107
kakserpom/phpdaemon
PHPDaemon/Thread/IPC.php
IPC.update
protected function update() { FileSystem::updateConfig(); foreach (Daemon::$appInstances as $app) { foreach ($app as $appInstance) { $appInstance->handleStatus(AppInstance::EVENT_CONFIG_UPDATED); } } }
php
protected function update() { FileSystem::updateConfig(); foreach (Daemon::$appInstances as $app) { foreach ($app as $appInstance) { $appInstance->handleStatus(AppInstance::EVENT_CONFIG_UPDATED); } } }
[ "protected", "function", "update", "(", ")", "{", "FileSystem", "::", "updateConfig", "(", ")", ";", "foreach", "(", "Daemon", "::", "$", "appInstances", "as", "$", "app", ")", "{", "foreach", "(", "$", "app", "as", "$", "appInstance", ")", "{", "$", ...
Reloads additional config-files on-the-fly. @return void
[ "Reloads", "additional", "config", "-", "files", "on", "-", "the", "-", "fly", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/IPC.php#L187-L195
kakserpom/phpdaemon
PHPDaemon/Thread/IPC.php
IPC.shutdown
public function shutdown($hard = false) { $error = error_get_last(); if ($error) { if ($error['type'] === E_ERROR) { $this->log('crashed by error \'' . $error['message'] . '\' at ' . $error['file'] . ':' . $error['line']); } } if (Daemon::$con...
php
public function shutdown($hard = false) { $error = error_get_last(); if ($error) { if ($error['type'] === E_ERROR) { $this->log('crashed by error \'' . $error['message'] . '\' at ' . $error['file'] . ':' . $error['line']); } } if (Daemon::$con...
[ "public", "function", "shutdown", "(", "$", "hard", "=", "false", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "if", "(", "$", "error", ")", "{", "if", "(", "$", "error", "[", "'type'", "]", "===", "E_ERROR", ")", "{", "$", "this...
Shutdown thread @param boolean - Hard? If hard, we shouldn't wait for graceful shutdown of the running applications. @return boolean|null - Ready?
[ "Shutdown", "thread" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/IPC.php#L202-L235
kakserpom/phpdaemon
PHPDaemon/Thread/IPC.php
IPC.sigint
protected function sigint() { if (Daemon::$config->logsignals->value) { $this->log('caught SIGINT.'); } $this->shutdown(true); }
php
protected function sigint() { if (Daemon::$config->logsignals->value) { $this->log('caught SIGINT.'); } $this->shutdown(true); }
[ "protected", "function", "sigint", "(", ")", "{", "if", "(", "Daemon", "::", "$", "config", "->", "logsignals", "->", "value", ")", "{", "$", "this", "->", "log", "(", "'caught SIGINT.'", ")", ";", "}", "$", "this", "->", "shutdown", "(", "true", ")"...
Handler of the SIGINT (hard shutdown) signal in worker process. @return void
[ "Handler", "of", "the", "SIGINT", "(", "hard", "shutdown", ")", "signal", "in", "worker", "process", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/IPC.php#L241-L248
kakserpom/phpdaemon
PHPDaemon/Thread/IPC.php
IPC.sigunknown
public function sigunknown($signo) { if (isset(Generic::$signals[$signo])) { $sig = Generic::$signals[$signo]; } else { $sig = 'UNKNOWN'; } $this->log('caught signal #' . $signo . ' (' . $sig . ').'); }
php
public function sigunknown($signo) { if (isset(Generic::$signals[$signo])) { $sig = Generic::$signals[$signo]; } else { $sig = 'UNKNOWN'; } $this->log('caught signal #' . $signo . ' (' . $sig . ').'); }
[ "public", "function", "sigunknown", "(", "$", "signo", ")", "{", "if", "(", "isset", "(", "Generic", "::", "$", "signals", "[", "$", "signo", "]", ")", ")", "{", "$", "sig", "=", "Generic", "::", "$", "signals", "[", "$", "signo", "]", ";", "}", ...
Handler of non-known signals. @return void
[ "Handler", "of", "non", "-", "known", "signals", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/IPC.php#L351-L360
kakserpom/phpdaemon
PHPDaemon/Config/Section.php
Section.toArray
public function toArray() { $arr = []; foreach ($this as $k => $entry) { if (!$entry instanceof Generic) { continue; } $arr[$k] = $entry->value; } return $arr; }
php
public function toArray() { $arr = []; foreach ($this as $k => $entry) { if (!$entry instanceof Generic) { continue; } $arr[$k] = $entry->value; } return $arr; }
[ "public", "function", "toArray", "(", ")", "{", "$", "arr", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "k", "=>", "$", "entry", ")", "{", "if", "(", "!", "$", "entry", "instanceof", "Generic", ")", "{", "continue", ";", "}", "$...
toArray handler @return hash
[ "toArray", "handler" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Section.php#L64-L74
kakserpom/phpdaemon
PHPDaemon/Config/Section.php
Section.imposeDefault
public function imposeDefault($settings = []) { foreach ($settings as $name => $value) { $name = strtolower(str_replace('-', '', $name)); if (!isset($this->{$name})) { if (is_scalar($value)) { $this->{$name} = new Generic($value); }...
php
public function imposeDefault($settings = []) { foreach ($settings as $name => $value) { $name = strtolower(str_replace('-', '', $name)); if (!isset($this->{$name})) { if (is_scalar($value)) { $this->{$name} = new Generic($value); }...
[ "public", "function", "imposeDefault", "(", "$", "settings", "=", "[", "]", ")", "{", "foreach", "(", "$", "settings", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "name", "=", "strtolower", "(", "str_replace", "(", "'-'", ",", "''", ",", ...
Impose default config @param array {"setting": "value"} @return void
[ "Impose", "default", "config" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Config/Section.php#L137-L161
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.timeout
public function timeout($timeout = null) { if ($timeout !== null) { $this->lastTimeout = $timeout; } $this->ev->add($this->lastTimeout / 1e6); }
php
public function timeout($timeout = null) { if ($timeout !== null) { $this->lastTimeout = $timeout; } $this->ev->add($this->lastTimeout / 1e6); }
[ "public", "function", "timeout", "(", "$", "timeout", "=", "null", ")", "{", "if", "(", "$", "timeout", "!==", "null", ")", "{", "$", "this", "->", "lastTimeout", "=", "$", "timeout", ";", "}", "$", "this", "->", "ev", "->", "add", "(", "$", "thi...
Sets timeout @param integer $timeout Timeout @return void
[ "Sets", "timeout" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L95-L101
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.add
public static function add($cb, $timeout = null, $id = null, $priority = null) { $obj = new self($cb, $timeout, $id, $priority); return $obj->id; }
php
public static function add($cb, $timeout = null, $id = null, $priority = null) { $obj = new self($cb, $timeout, $id, $priority); return $obj->id; }
[ "public", "static", "function", "add", "(", "$", "cb", ",", "$", "timeout", "=", "null", ",", "$", "id", "=", "null", ",", "$", "priority", "=", "null", ")", "{", "$", "obj", "=", "new", "self", "(", "$", "cb", ",", "$", "timeout", ",", "$", ...
Adds timer @param callable $cb Callback @param integer $timeout Timeout @param integer|string $id Timer ID @param integer $priority Priority @return integer|string Timer ID
[ "Adds", "timer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L111-L115
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.setTimeout
public static function setTimeout($id, $timeout = null) { if (isset(self::$list[$id])) { self::$list[$id]->timeout($timeout); return true; } return false; }
php
public static function setTimeout($id, $timeout = null) { if (isset(self::$list[$id])) { self::$list[$id]->timeout($timeout); return true; } return false; }
[ "public", "static", "function", "setTimeout", "(", "$", "id", ",", "$", "timeout", "=", "null", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "list", "[", "$", "id", "]", ")", ")", "{", "self", "::", "$", "list", "[", "$", "id", "]", ...
Sets timeout @param integer|string $id Timer ID @param integer $timeout Timeout @return boolean
[ "Sets", "timeout" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L123-L130
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.remove
public static function remove($id) { if (isset(self::$list[$id])) { self::$list[$id]->free(); } }
php
public static function remove($id) { if (isset(self::$list[$id])) { self::$list[$id]->free(); } }
[ "public", "static", "function", "remove", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "list", "[", "$", "id", "]", ")", ")", "{", "self", "::", "$", "list", "[", "$", "id", "]", "->", "free", "(", ")", ";", "}", "}...
Removes timer by ID @param integer|string $id Timer ID @return void
[ "Removes", "timer", "by", "ID" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L137-L142
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.free
public function free() { unset(self::$list[$this->id]); if ($this->ev !== null) { $this->ev->free(); $this->ev = null; } }
php
public function free() { unset(self::$list[$this->id]); if ($this->ev !== null) { $this->ev->free(); $this->ev = null; } }
[ "public", "function", "free", "(", ")", "{", "unset", "(", "self", "::", "$", "list", "[", "$", "this", "->", "id", "]", ")", ";", "if", "(", "$", "this", "->", "ev", "!==", "null", ")", "{", "$", "this", "->", "ev", "->", "free", "(", ")", ...
Frees the timer @return void
[ "Frees", "the", "timer" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L148-L155
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.cancelTimeout
public static function cancelTimeout($id) { if (isset(self::$list[$id])) { self::$list[$id]->cancel(); } }
php
public static function cancelTimeout($id) { if (isset(self::$list[$id])) { self::$list[$id]->cancel(); } }
[ "public", "static", "function", "cancelTimeout", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "list", "[", "$", "id", "]", ")", ")", "{", "self", "::", "$", "list", "[", "$", "id", "]", "->", "cancel", "(", ")", ";", ...
Cancels timer by ID @param integer|string $id Timer ID @return void
[ "Cancels", "timer", "by", "ID" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L162-L167
kakserpom/phpdaemon
PHPDaemon/Core/Timer.php
Timer.eventCall
public function eventCall() { try { //Daemon::log('cb - '.Debug::zdump($this->cb)); $func = $this->cb; $func($this); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); } }
php
public function eventCall() { try { //Daemon::log('cb - '.Debug::zdump($this->cb)); $func = $this->cb; $func($this); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); } }
[ "public", "function", "eventCall", "(", ")", "{", "try", "{", "//Daemon::log('cb - '.Debug::zdump($this->cb));", "$", "func", "=", "$", "this", "->", "cb", ";", "$", "func", "(", "$", "this", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")",...
Called when timer is triggered @return void
[ "Called", "when", "timer", "is", "triggered" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/Timer.php#L182-L191
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.onSessionStartEvent
public function onSessionStartEvent() { return function ($sessionStartEvent) { /** @var \PHPDaemon\Core\DeferredEvent $sessionStartEvent */ $name = ini_get('session.name'); $sid = $this->getCookieStr($name); if ($sid === '') { $this->sessionSta...
php
public function onSessionStartEvent() { return function ($sessionStartEvent) { /** @var \PHPDaemon\Core\DeferredEvent $sessionStartEvent */ $name = ini_get('session.name'); $sid = $this->getCookieStr($name); if ($sid === '') { $this->sessionSta...
[ "public", "function", "onSessionStartEvent", "(", ")", "{", "return", "function", "(", "$", "sessionStartEvent", ")", "{", "/** @var \\PHPDaemon\\Core\\DeferredEvent $sessionStartEvent */", "$", "name", "=", "ini_get", "(", "'session.name'", ")", ";", "$", "sid", "=",...
Deferred event 'onSessionStart' @return callable
[ "Deferred", "event", "onSessionStart" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L58-L80
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.onSessionReadEvent
public function onSessionReadEvent() { return function ($sessionEvent) { /** @var \PHPDaemon\Core\DeferredEvent $sessionEvent */ $name = ini_get('session.name'); $sid = $this->getCookieStr($name); if ($sid === '') { $sessionEvent->setResult(fal...
php
public function onSessionReadEvent() { return function ($sessionEvent) { /** @var \PHPDaemon\Core\DeferredEvent $sessionEvent */ $name = ini_get('session.name'); $sid = $this->getCookieStr($name); if ($sid === '') { $sessionEvent->setResult(fal...
[ "public", "function", "onSessionReadEvent", "(", ")", "{", "return", "function", "(", "$", "sessionEvent", ")", "{", "/** @var \\PHPDaemon\\Core\\DeferredEvent $sessionEvent */", "$", "name", "=", "ini_get", "(", "'session.name'", ")", ";", "$", "sid", "=", "$", "...
Deferred event 'onSessionRead' @return callable
[ "Deferred", "event", "onSessionRead" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L86-L105
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionRead
public function sessionRead($sid, $cb = null) { FileSystem::open(FileSystem::genRndTempnamPrefix(session_save_path(), $this->sessionPrefix) . basename($sid), 'r+!', function ($fp) use ($cb) { if (!$fp) { $cb(false); return; ...
php
public function sessionRead($sid, $cb = null) { FileSystem::open(FileSystem::genRndTempnamPrefix(session_save_path(), $this->sessionPrefix) . basename($sid), 'r+!', function ($fp) use ($cb) { if (!$fp) { $cb(false); return; ...
[ "public", "function", "sessionRead", "(", "$", "sid", ",", "$", "cb", "=", "null", ")", "{", "FileSystem", "::", "open", "(", "FileSystem", "::", "genRndTempnamPrefix", "(", "session_save_path", "(", ")", ",", "$", "this", "->", "sessionPrefix", ")", ".", ...
Reads session data @param string $sid Session ID @param callable $cb Callback @return void
[ "Reads", "session", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L113-L126
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionCommit
public function sessionCommit($cb = null) { if (!$this->sessionFp || $this->sessionFlushing) { if ($cb) { $cb(false); } return; } $this->sessionFlushing = true; $data = $this->sessionEncode(); $l = mb_orig_strlen($data); ...
php
public function sessionCommit($cb = null) { if (!$this->sessionFp || $this->sessionFlushing) { if ($cb) { $cb(false); } return; } $this->sessionFlushing = true; $data = $this->sessionEncode(); $l = mb_orig_strlen($data); ...
[ "public", "function", "sessionCommit", "(", "$", "cb", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "sessionFp", "||", "$", "this", "->", "sessionFlushing", ")", "{", "if", "(", "$", "cb", ")", "{", "$", "cb", "(", "false", ")", ";",...
Commmit session data @param callable $cb Callback @return void
[ "Commmit", "session", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L133-L153
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionStart
protected function sessionStart($force_start = true) { if ($this->sessionStarted) { return; } $this->sessionStarted = true; if (!$this instanceof \PHPDaemon\HTTPRequest\Generic) { Daemon::log('Called ' . get_class($this) . '(trait \PHPDaemon\Traits\Sessions)->...
php
protected function sessionStart($force_start = true) { if ($this->sessionStarted) { return; } $this->sessionStarted = true; if (!$this instanceof \PHPDaemon\HTTPRequest\Generic) { Daemon::log('Called ' . get_class($this) . '(trait \PHPDaemon\Traits\Sessions)->...
[ "protected", "function", "sessionStart", "(", "$", "force_start", "=", "true", ")", "{", "if", "(", "$", "this", "->", "sessionStarted", ")", "{", "return", ";", "}", "$", "this", "->", "sessionStarted", "=", "true", ";", "if", "(", "!", "$", "this", ...
Session start @param boolean $force_start @return void
[ "Session", "start" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L160-L178
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionStartNew
protected function sessionStartNew($cb = null) { FileSystem::tempnam(session_save_path(), $this->sessionPrefix, function ($fp) use ($cb) { if (!$fp) { $cb(false); return; } $this->sessionFp = $fp; $this->sessionId = substr(base...
php
protected function sessionStartNew($cb = null) { FileSystem::tempnam(session_save_path(), $this->sessionPrefix, function ($fp) use ($cb) { if (!$fp) { $cb(false); return; } $this->sessionFp = $fp; $this->sessionId = substr(base...
[ "protected", "function", "sessionStartNew", "(", "$", "cb", "=", "null", ")", "{", "FileSystem", "::", "tempnam", "(", "session_save_path", "(", ")", ",", "$", "this", "->", "sessionPrefix", ",", "function", "(", "$", "fp", ")", "use", "(", "$", "cb", ...
Start new session @param callable $cb Callback @return void
[ "Start", "new", "session" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L185-L207
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionEncode
protected function sessionEncode() { $type = ini_get('session.serialize_handler'); if ($type === 'php') { return $this->serializePHP($this->getSessionState()); } if ($type === 'php_binary') { return igbinary_serialize($this->getSessionState()); } ...
php
protected function sessionEncode() { $type = ini_get('session.serialize_handler'); if ($type === 'php') { return $this->serializePHP($this->getSessionState()); } if ($type === 'php_binary') { return igbinary_serialize($this->getSessionState()); } ...
[ "protected", "function", "sessionEncode", "(", ")", "{", "$", "type", "=", "ini_get", "(", "'session.serialize_handler'", ")", ";", "if", "(", "$", "type", "===", "'php'", ")", "{", "return", "$", "this", "->", "serializePHP", "(", "$", "this", "->", "ge...
Encodes session data @return string|false
[ "Encodes", "session", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L213-L223
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.sessionDecode
protected function sessionDecode($str) { $type = ini_get('session.serialize_handler'); if ($type === 'php') { $this->setSessionState($this->unserializePHP($str)); return true; } if ($type === 'php_binary') { $this->setSessionState(igbinary_unserial...
php
protected function sessionDecode($str) { $type = ini_get('session.serialize_handler'); if ($type === 'php') { $this->setSessionState($this->unserializePHP($str)); return true; } if ($type === 'php_binary') { $this->setSessionState(igbinary_unserial...
[ "protected", "function", "sessionDecode", "(", "$", "str", ")", "{", "$", "type", "=", "ini_get", "(", "'session.serialize_handler'", ")", ";", "if", "(", "$", "type", "===", "'php'", ")", "{", "$", "this", "->", "setSessionState", "(", "$", "this", "->"...
Decodes session data @param string $str Data @return boolean
[ "Decodes", "session", "data" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L249-L261
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.serializePHP
public function serializePHP($array) { $raw = ''; $line = 0; $keys = array_keys($array); foreach ($keys as $key) { $value = $array[$key]; $line++; $raw .= $key . '|'; if (is_array($value) && isset($value['huge_recursion_blocker_we_hope...
php
public function serializePHP($array) { $raw = ''; $line = 0; $keys = array_keys($array); foreach ($keys as $key) { $value = $array[$key]; $line++; $raw .= $key . '|'; if (is_array($value) && isset($value['huge_recursion_blocker_we_hope...
[ "public", "function", "serializePHP", "(", "$", "array", ")", "{", "$", "raw", "=", "''", ";", "$", "line", "=", "0", ";", "$", "keys", "=", "array_keys", "(", "$", "array", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "$"...
session_encode() - clone, which not require session_start() @see http://www.php.net/manual/en/function.session-encode.php @param array $array @return string
[ "session_encode", "()", "-", "clone", "which", "not", "require", "session_start", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L269-L288
kakserpom/phpdaemon
PHPDaemon/Traits/Sessions.php
Sessions.unserializePHP
protected function unserializePHP($session_data) { $return_data = array(); $offset = 0; while ($offset < mb_orig_strlen($session_data)) { if (!strstr(substr($session_data, $offset), "|")) { return $return_data; //throw new \Exception("invalid sess...
php
protected function unserializePHP($session_data) { $return_data = array(); $offset = 0; while ($offset < mb_orig_strlen($session_data)) { if (!strstr(substr($session_data, $offset), "|")) { return $return_data; //throw new \Exception("invalid sess...
[ "protected", "function", "unserializePHP", "(", "$", "session_data", ")", "{", "$", "return_data", "=", "array", "(", ")", ";", "$", "offset", "=", "0", ";", "while", "(", "$", "offset", "<", "mb_orig_strlen", "(", "$", "session_data", ")", ")", "{", "...
session_decode() - clone, which not require session_start() @see http://www.php.net/manual/en/function.session-decode.php#108037 @param string $session_data @return array
[ "session_decode", "()", "-", "clone", "which", "not", "require", "session_start", "()" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Traits/Sessions.php#L296-L316
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWithMemcache.php
ExampleWithMemcacheRequest.init
public function init() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } $req = $this; $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done $req->wakeup(); // wake up the request immediately }); ...
php
public function init() { try { $this->header('Content-Type: text/html'); } catch (\Exception $e) { } $req = $this; $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done $req->wakeup(); // wake up the request immediately }); ...
[ "public", "function", "init", "(", ")", "{", "try", "{", "$", "this", "->", "header", "(", "'Content-Type: text/html'", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "}", "$", "req", "=", "$", "this", ";", "$", "job", "=", "...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWithMemcache.php#L35-L63
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleWithMemcache.php
ExampleWithMemcacheRequest.run
public function run() { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Example with Memcache</title> </h...
php
public function run() { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Example with Memcache</title> </h...
[ "public", "function", "run", "(", ")", "{", "?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf...
Called when request iterated. @return integer Status.
[ "Called", "when", "request", "iterated", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleWithMemcache.php#L69-L93
kakserpom/phpdaemon
PHPDaemon/Utils/ShmEntity.php
ShmEntity.open
public function open($segno = 0, $create = false) { if (isset($this->segments[$segno])) { return $this->segments[$segno]; } $key = $this->key + $segno; if (!$create) { $shm = @shmop_open($key, 'w', 0, 0); } else { $shm = @shmop_open($key, '...
php
public function open($segno = 0, $create = false) { if (isset($this->segments[$segno])) { return $this->segments[$segno]; } $key = $this->key + $segno; if (!$create) { $shm = @shmop_open($key, 'w', 0, 0); } else { $shm = @shmop_open($key, '...
[ "public", "function", "open", "(", "$", "segno", "=", "0", ",", "$", "create", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "segments", "[", "$", "segno", "]", ")", ")", "{", "return", "$", "this", "->", "segments", "[", ...
Opens segment of shared memory @param integer $segno Segment number @param boolean $create Create @return integer Segment number
[ "Opens", "segment", "of", "shared", "memory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/ShmEntity.php#L74-L97
kakserpom/phpdaemon
PHPDaemon/Utils/ShmEntity.php
ShmEntity.write
public function write($data, $offset) { $segno = floor($offset / $this->segsize); if (!isset($this->segments[$segno])) { if (!$this->open($segno, true)) { return false; } } $sOffset = $offset % $this->segsize; $d = $this->segsize - ($sO...
php
public function write($data, $offset) { $segno = floor($offset / $this->segsize); if (!isset($this->segments[$segno])) { if (!$this->open($segno, true)) { return false; } } $sOffset = $offset % $this->segsize; $d = $this->segsize - ($sO...
[ "public", "function", "write", "(", "$", "data", ",", "$", "offset", ")", "{", "$", "segno", "=", "floor", "(", "$", "offset", "/", "$", "this", "->", "segsize", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "segments", "[", "$", "...
Write to shared memory @param string $data Data @param integer $offset Offset @return boolean Success
[ "Write", "to", "shared", "memory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/ShmEntity.php#L125-L142
kakserpom/phpdaemon
PHPDaemon/Utils/ShmEntity.php
ShmEntity.read
public function read($offset, $length = 1) { $ret = ''; $segno = floor($offset / $this->segsize); $sOffset = $offset % $this->segsize; while (true) { if (!isset($this->segments[$segno])) { if (!$this->open($segno)) { goto ret; ...
php
public function read($offset, $length = 1) { $ret = ''; $segno = floor($offset / $this->segsize); $sOffset = $offset % $this->segsize; while (true) { if (!isset($this->segments[$segno])) { if (!$this->open($segno)) { goto ret; ...
[ "public", "function", "read", "(", "$", "offset", ",", "$", "length", "=", "1", ")", "{", "$", "ret", "=", "''", ";", "$", "segno", "=", "floor", "(", "$", "offset", "/", "$", "this", "->", "segsize", ")", ";", "$", "sOffset", "=", "$", "offset...
Read from shared memory @param integer $offset Offset @param integer $length Length @return string Data
[ "Read", "from", "shared", "memory" ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Utils/ShmEntity.php#L150-L175
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleJabberbot.php
ExampleJabberbot.init
public function init() { if ($this->isEnabled()) { $this->xmppclient = \PHPDaemon\Clients\XMPP\Pool::getInstance(); } }
php
public function init() { if ($this->isEnabled()) { $this->xmppclient = \PHPDaemon\Clients\XMPP\Pool::getInstance(); } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "$", "this", "->", "xmppclient", "=", "\\", "PHPDaemon", "\\", "Clients", "\\", "XMPP", "\\", "Pool", "::", "getInstance", "(", ")", ";", "}...
Constructor. @return void
[ "Constructor", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleJabberbot.php#L20-L25
kakserpom/phpdaemon
PHPDaemon/Examples/ExampleJabberbot.php
ExampleJabberbot.onConfigUpdated
public function onConfigUpdated() { if ($this->xmppclient) { $this->xmppclient->config = $this->config; $this->xmppclient->onConfigUpdated(); } }
php
public function onConfigUpdated() { if ($this->xmppclient) { $this->xmppclient->config = $this->config; $this->xmppclient->onConfigUpdated(); } }
[ "public", "function", "onConfigUpdated", "(", ")", "{", "if", "(", "$", "this", "->", "xmppclient", ")", "{", "$", "this", "->", "xmppclient", "->", "config", "=", "$", "this", "->", "config", ";", "$", "this", "->", "xmppclient", "->", "onConfigUpdated"...
Called when worker is going to update configuration. @return void
[ "Called", "when", "worker", "is", "going", "to", "update", "configuration", "." ]
train
https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Examples/ExampleJabberbot.php#L64-L70