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/Thread/Master.php | Master.stopWorkers | protected function stopWorkers($n = 1)
{
Daemon::log('--' . $n . '-- ' . Debug::backtrace() . '-----');
$n = (int)$n;
$i = 0;
foreach ($this->workers->threads as &$w) {
if ($i >= $n) {
break;
}
if ($w->shutdown) {
... | php | protected function stopWorkers($n = 1)
{
Daemon::log('--' . $n . '-- ' . Debug::backtrace() . '-----');
$n = (int)$n;
$i = 0;
foreach ($this->workers->threads as &$w) {
if ($i >= $n) {
break;
}
if ($w->shutdown) {
... | [
"protected",
"function",
"stopWorkers",
"(",
"$",
"n",
"=",
"1",
")",
"{",
"Daemon",
"::",
"log",
"(",
"'--'",
".",
"$",
"n",
".",
"'-- '",
".",
"Debug",
"::",
"backtrace",
"(",
")",
".",
"'-----'",
")",
";",
"$",
"n",
"=",
"(",
"int",
")",
"$"... | Stop the workers
@param $n - integer - number of workers to stop
@return boolean - success | [
"Stop",
"the",
"workers"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L299-L325 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.shutdown | protected function shutdown($signo = false)
{
$this->shutdown = true;
$this->waitAll(true);
Daemon::$shm_wstate->delete();
file_put_contents(Daemon::$config->pidfile->value, '');
posix_kill(getmypid(), SIGKILL);
exit(0);
} | php | protected function shutdown($signo = false)
{
$this->shutdown = true;
$this->waitAll(true);
Daemon::$shm_wstate->delete();
file_put_contents(Daemon::$config->pidfile->value, '');
posix_kill(getmypid(), SIGKILL);
exit(0);
} | [
"protected",
"function",
"shutdown",
"(",
"$",
"signo",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"shutdown",
"=",
"true",
";",
"$",
"this",
"->",
"waitAll",
"(",
"true",
")",
";",
"Daemon",
"::",
"$",
"shm_wstate",
"->",
"delete",
"(",
")",
";",
... | Called when master is going to shutdown
@param integer System singal's number
@return void | [
"Called",
"when",
"master",
"is",
"going",
"to",
"shutdown"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L332-L340 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigint | protected function sigint()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGINT.');
}
$this->signalToChildren(SIGINT);
$this->shutdown(SIGINT);
} | php | protected function sigint()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGINT.');
}
$this->signalToChildren(SIGINT);
$this->shutdown(SIGINT);
} | [
"protected",
"function",
"sigint",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGINT.'",
")",
";",
"}",
"$",
"this",
"->",
"signalToChildren",
"(",
"SIGI... | Handler for the SIGINT (shutdown) signal in master process. Shutdown.
@return void | [
"Handler",
"for",
"the",
"SIGINT",
"(",
"shutdown",
")",
"signal",
"in",
"master",
"process",
".",
"Shutdown",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L359-L367 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigterm | protected function sigterm()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGTERM.');
}
$this->signalToChildren(SIGTERM);
$this->shutdown(SIGTERM);
} | php | protected function sigterm()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGTERM.');
}
$this->signalToChildren(SIGTERM);
$this->shutdown(SIGTERM);
} | [
"protected",
"function",
"sigterm",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGTERM.'",
")",
";",
"}",
"$",
"this",
"->",
"signalToChildren",
"(",
"SI... | Handler for the SIGTERM (shutdown) signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGTERM",
"(",
"shutdown",
")",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L383-L391 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigquit | protected function sigquit()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGQUIT.');
}
$this->signalToChildren(SIGQUIT);
$this->shutdown(SIGQUIT);
} | php | protected function sigquit()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGQUIT.');
}
$this->signalToChildren(SIGQUIT);
$this->shutdown(SIGQUIT);
} | [
"protected",
"function",
"sigquit",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGQUIT.'",
")",
";",
"}",
"$",
"this",
"->",
"signalToChildren",
"(",
"SI... | Handler for the SIGQUIT signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGQUIT",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L397-L405 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigtstp | protected function sigtstp()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGTSTP (graceful stop all workers).');
}
$this->signalToChildren(SIGTSTP);
$this->shutdown(SIGTSTP);
} | php | protected function sigtstp()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGTSTP (graceful stop all workers).');
}
$this->signalToChildren(SIGTSTP);
$this->shutdown(SIGTSTP);
} | [
"protected",
"function",
"sigtstp",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGTSTP (graceful stop all workers).'",
")",
";",
"}",
"$",
"this",
"->",
"sig... | Handler for the SIGTSTP (graceful stop all workers) signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGTSTP",
"(",
"graceful",
"stop",
"all",
"workers",
")",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L411-L419 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sighup | protected function sighup()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGHUP (reload config).');
}
if (isset(Daemon::$config->configfile)) {
Daemon::loadConfig(Daemon::$config->configfile->value);
}
$this->signalToChildren(SIGHUP... | php | protected function sighup()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGHUP (reload config).');
}
if (isset(Daemon::$config->configfile)) {
Daemon::loadConfig(Daemon::$config->configfile->value);
}
$this->signalToChildren(SIGHUP... | [
"protected",
"function",
"sighup",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGHUP (reload config).'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"Daemon",
... | Handler for the SIGHUP (reload config) signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGHUP",
"(",
"reload",
"config",
")",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L425-L436 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigusr1 | protected function sigusr1()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGUSR1 (re-open log-file).');
}
Daemon::openLogs();
$this->signalToChildren(SIGUSR1);
} | php | protected function sigusr1()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGUSR1 (re-open log-file).');
}
Daemon::openLogs();
$this->signalToChildren(SIGUSR1);
} | [
"protected",
"function",
"sigusr1",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGUSR1 (re-open log-file).'",
")",
";",
"}",
"Daemon",
"::",
"openLogs",
"(",... | Handler for the SIGUSR1 (re-open log-file) signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGUSR1",
"(",
"re",
"-",
"open",
"log",
"-",
"file",
")",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L442-L450 |
kakserpom/phpdaemon | PHPDaemon/Thread/Master.php | Master.sigusr2 | protected function sigusr2()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGUSR2 (graceful restart all workers).');
}
$this->signalToChildren(SIGUSR2);
} | php | protected function sigusr2()
{
if (Daemon::$config->logsignals->value) {
$this->log('Caught SIGUSR2 (graceful restart all workers).');
}
$this->signalToChildren(SIGUSR2);
} | [
"protected",
"function",
"sigusr2",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"config",
"->",
"logsignals",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"'Caught SIGUSR2 (graceful restart all workers).'",
")",
";",
"}",
"$",
"this",
"->",
"... | Handler for the SIGUSR2 (graceful restart all workers) signal in master process
@return void | [
"Handler",
"for",
"the",
"SIGUSR2",
"(",
"graceful",
"restart",
"all",
"workers",
")",
"signal",
"in",
"master",
"process"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Thread/Master.php#L456-L462 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicCancelOkFrame.php | BasicCancelOkFrame.create | public static function create(
$consumerTag = null
)
{
$frame = new self();
if (null !== $consumerTag) {
$frame->consumerTag = $consumerTag;
}
return $frame;
} | php | public static function create(
$consumerTag = null
)
{
$frame = new self();
if (null !== $consumerTag) {
$frame->consumerTag = $consumerTag;
}
return $frame;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"consumerTag",
"=",
"null",
")",
"{",
"$",
"frame",
"=",
"new",
"self",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"consumerTag",
")",
"{",
"$",
"frame",
"->",
"consumerTag",
"=",
"$",
"consumerT... | shortstr | [
"shortstr"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Basic/BasicCancelOkFrame.php#L20-L31 |
kakserpom/phpdaemon | PHPDaemon/Servers/WebSocket/Protocols/VE.php | VE.sendHandshakeReply | public function sendHandshakeReply($extraHeaders = '')
{
if (!isset($this->server['HTTP_SEC_WEBSOCKET_ORIGIN'])) {
$this->server['HTTP_SEC_WEBSOCKET_ORIGIN'] = '';
}
$this->write(
"HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
. "Upgrade: WebSocket\r\n"... | php | public function sendHandshakeReply($extraHeaders = '')
{
if (!isset($this->server['HTTP_SEC_WEBSOCKET_ORIGIN'])) {
$this->server['HTTP_SEC_WEBSOCKET_ORIGIN'] = '';
}
$this->write(
"HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
. "Upgrade: WebSocket\r\n"... | [
"public",
"function",
"sendHandshakeReply",
"(",
"$",
"extraHeaders",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"server",
"[",
"'HTTP_SEC_WEBSOCKET_ORIGIN'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"server",
"[",
"'HTTP_SEC_WEBSO... | Sends a handshake message reply
@param string Received data (no use in this class)
@return boolean OK? | [
"Sends",
"a",
"handshake",
"message",
"reply"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/VE.php#L22-L43 |
kakserpom/phpdaemon | PHPDaemon/Servers/WebSocket/Protocols/VE.php | VE.sendFrame | public function sendFrame($data, $type = null, $cb = null)
{
if (!$this->handshaked) {
return false;
}
if ($this->finished && $type !== 'CONNCLOSE') {
return false;
}
if ($type === 'CONNCLOSE') {
if ($cb !== null) {
$cb($t... | php | public function sendFrame($data, $type = null, $cb = null)
{
if (!$this->handshaked) {
return false;
}
if ($this->finished && $type !== 'CONNCLOSE') {
return false;
}
if ($type === 'CONNCLOSE') {
if ($cb !== null) {
$cb($t... | [
"public",
"function",
"sendFrame",
"(",
"$",
"data",
",",
"$",
"type",
"=",
"null",
",",
"$",
"cb",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"handshaked",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"fi... | Sends a frame.
@param string $data Frame's data.
@param string $type Frame's type. ("STRING" OR "BINARY")
@param callable $cb Optional. Callback called when the frame is received by client.
@callback $cb ( )
@return boolean Success. | [
"Sends",
"a",
"frame",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/VE.php#L53-L101 |
kakserpom/phpdaemon | PHPDaemon/Servers/WebSocket/Protocols/VE.php | VE.onRead | public function onRead()
{
while (($buflen = $this->getInputLength()) >= 2) {
$hdr = $this->look(10);
$frametype = ord(mb_orig_substr($hdr, 0, 1));
if (($frametype & 0x80) === 0x80) {
$len = 0;
$i = 0;
do {
... | php | public function onRead()
{
while (($buflen = $this->getInputLength()) >= 2) {
$hdr = $this->look(10);
$frametype = ord(mb_orig_substr($hdr, 0, 1));
if (($frametype & 0x80) === 0x80) {
$len = 0;
$i = 0;
do {
... | [
"public",
"function",
"onRead",
"(",
")",
"{",
"while",
"(",
"(",
"$",
"buflen",
"=",
"$",
"this",
"->",
"getInputLength",
"(",
")",
")",
">=",
"2",
")",
"{",
"$",
"hdr",
"=",
"$",
"this",
"->",
"look",
"(",
"10",
")",
";",
"$",
"frametype",
"=... | Called when new data received
@return void | [
"Called",
"when",
"new",
"data",
"received"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/WebSocket/Protocols/VE.php#L107-L158 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.onConfigUpdated | public function onConfigUpdated()
{
if (Daemon::$process instanceof Thread\Worker) {
if ($this->config === null) {
$this->disable();
} else {
$this->enable();
}
}
if ($defaults = $this->getConfigDefaults()) {
$th... | php | public function onConfigUpdated()
{
if (Daemon::$process instanceof Thread\Worker) {
if ($this->config === null) {
$this->disable();
} else {
$this->enable();
}
}
if ($defaults = $this->getConfigDefaults()) {
$th... | [
"public",
"function",
"onConfigUpdated",
"(",
")",
"{",
"if",
"(",
"Daemon",
"::",
"$",
"process",
"instanceof",
"Thread",
"\\",
"Worker",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"disable",
"(",
"... | 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/Network/Pool.php#L119-L132 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.applyConfig | protected function applyConfig()
{
foreach ($this->config as $k => $v) {
if (is_object($v) && $v instanceof Config\Entry\Generic) {
$v = $v->getValue();
}
$k = strtolower($k);
if ($k === 'connectionclass') {
$this->connectionCla... | php | protected function applyConfig()
{
foreach ($this->config as $k => $v) {
if (is_object($v) && $v instanceof Config\Entry\Generic) {
$v = $v->getValue();
}
$k = strtolower($k);
if ($k === 'connectionclass') {
$this->connectionCla... | [
"protected",
"function",
"applyConfig",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"v",
")",
"&&",
"$",
"v",
"instanceof",
"Config",
"\\",
"Entry",
"\\",
... | Applies config
@return void | [
"Applies",
"config"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L138-L155 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.getInstance | public static function getInstance($arg = '', $spawn = true)
{
if ($arg === 'default') {
$arg = '';
}
$class = static::class;
if (is_string($arg)) {
$key = $class . ':' . $arg;
if (isset(self::$instances[$key])) {
return self::$inst... | php | public static function getInstance($arg = '', $spawn = true)
{
if ($arg === 'default') {
$arg = '';
}
$class = static::class;
if (is_string($arg)) {
$key = $class . ':' . $arg;
if (isset(self::$instances[$key])) {
return self::$inst... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"arg",
"=",
"''",
",",
"$",
"spawn",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"arg",
"===",
"'default'",
")",
"{",
"$",
"arg",
"=",
"''",
";",
"}",
"$",
"class",
"=",
"static",
"::",
"class",... | Returns instance object
@param string $arg name / array config / ConfigSection
@param boolean $spawn Spawn? Default is true
@return this | [
"Returns",
"instance",
"object"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L172-L196 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.finish | public function finish($graceful = false)
{
$this->disable();
if (!$this->finished) {
$this->finished = true;
$this->onFinish();
}
$result = true;
foreach ($this as $conn) {
if ($graceful) {
if (!$conn->gracefulShutdown()... | php | public function finish($graceful = false)
{
$this->disable();
if (!$this->finished) {
$this->finished = true;
$this->onFinish();
}
$result = true;
foreach ($this as $conn) {
if ($graceful) {
if (!$conn->gracefulShutdown()... | [
"public",
"function",
"finish",
"(",
"$",
"graceful",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"disable",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"finished",
")",
"{",
"$",
"this",
"->",
"finished",
"=",
"true",
";",
"$",
"this",
"->"... | Finishes ConnectionPool
@return boolean Success | [
"Finishes",
"ConnectionPool"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L272-L294 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.attach | public function attach($conn, $inf = null)
{
parent::attach($conn, $inf);
if ($this->maxConcurrency && !$this->overload) {
if ($this->count() >= $this->maxConcurrency) {
$this->overload = true;
$this->disable();
return;
}
... | php | public function attach($conn, $inf = null)
{
parent::attach($conn, $inf);
if ($this->maxConcurrency && !$this->overload) {
if ($this->count() >= $this->maxConcurrency) {
$this->overload = true;
$this->disable();
return;
}
... | [
"public",
"function",
"attach",
"(",
"$",
"conn",
",",
"$",
"inf",
"=",
"null",
")",
"{",
"parent",
"::",
"attach",
"(",
"$",
"conn",
",",
"$",
"inf",
")",
";",
"if",
"(",
"$",
"this",
"->",
"maxConcurrency",
"&&",
"!",
"$",
"this",
"->",
"overlo... | Attach Connection
@param object $conn Connection
@param mixed $inf Info
@return void | [
"Attach",
"Connection"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L302-L312 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.detach | public function detach($conn)
{
parent::detach($conn);
if ($this->overload) {
if (!$this->maxConcurrency || ($this->count() < $this->maxConcurrency)) {
$this->overload = false;
$this->enable();
}
}
} | php | public function detach($conn)
{
parent::detach($conn);
if ($this->overload) {
if (!$this->maxConcurrency || ($this->count() < $this->maxConcurrency)) {
$this->overload = false;
$this->enable();
}
}
} | [
"public",
"function",
"detach",
"(",
"$",
"conn",
")",
"{",
"parent",
"::",
"detach",
"(",
"$",
"conn",
")",
";",
"if",
"(",
"$",
"this",
"->",
"overload",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"maxConcurrency",
"||",
"(",
"$",
"this",
"->... | Detach Connection
@param object $conn Connection
@return void | [
"Detach",
"Connection"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L319-L328 |
kakserpom/phpdaemon | PHPDaemon/Network/Pool.php | Pool.connect | public function connect($url, $cb, $class = null)
{
if ($class === null) {
$class = $this->connectionClass;
}
$conn = new $class(null, $this);
$conn->connect($url, $cb);
return $conn;
} | php | public function connect($url, $cb, $class = null)
{
if ($class === null) {
$class = $this->connectionClass;
}
$conn = new $class(null, $this);
$conn->connect($url, $cb);
return $conn;
} | [
"public",
"function",
"connect",
"(",
"$",
"url",
",",
"$",
"cb",
",",
"$",
"class",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"class",
"===",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"connectionClass",
";",
"}",
"$",
"conn",
"=",
"... | Establish a connection with remote peer
@param string $url URL
@param callback $cb Callback
@param string $class Optional. Connection class name
@return integer Connection's ID. Boolean false when failed | [
"Establish",
"a",
"connection",
"with",
"remote",
"peer"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Network/Pool.php#L337-L345 |
kakserpom/phpdaemon | PHPDaemon/Core/DeferredEvent.php | DeferredEvent.setResult | public function setResult($result = null)
{
$this->result = $result;
$this->state = self::STATE_DONE;
if ($this->listeners) {
$this->listeners->executeAll($this->result);
}
} | php | public function setResult($result = null)
{
$this->result = $result;
$this->state = self::STATE_DONE;
if ($this->listeners) {
$this->listeners->executeAll($this->result);
}
} | [
"public",
"function",
"setResult",
"(",
"$",
"result",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"result",
"=",
"$",
"result",
";",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE_DONE",
";",
"if",
"(",
"$",
"this",
"->",
"listeners",
")",
"{... | Set result
@param mixed $result Result
@return void | [
"Set",
"result"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/DeferredEvent.php#L84-L91 |
kakserpom/phpdaemon | PHPDaemon/Core/DeferredEvent.php | DeferredEvent.cleanup | public function cleanup()
{
$this->listeners = null;
$this->producer = null;
$this->args = [];
$this->parent = null;
} | php | public function cleanup()
{
$this->listeners = null;
$this->producer = null;
$this->args = [];
$this->parent = null;
} | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"$",
"this",
"->",
"listeners",
"=",
"null",
";",
"$",
"this",
"->",
"producer",
"=",
"null",
";",
"$",
"this",
"->",
"args",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"parent",
"=",
"null",
";",
"}"
] | Clean up
@return void | [
"Clean",
"up"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/DeferredEvent.php#L97-L103 |
kakserpom/phpdaemon | PHPDaemon/Core/DeferredEvent.php | DeferredEvent.reset | public function reset()
{
$this->state = self::STATE_WAITING;
$this->result = null;
$this->args = [];
return $this;
} | php | public function reset()
{
$this->state = self::STATE_WAITING;
$this->result = null;
$this->args = [];
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE_WAITING",
";",
"$",
"this",
"->",
"result",
"=",
"null",
";",
"$",
"this",
"->",
"args",
"=",
"[",
"]",
";",
"return",
"$",
"this",
";",
"}"
] | Reset
@return this | [
"Reset"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/DeferredEvent.php#L109-L115 |
kakserpom/phpdaemon | PHPDaemon/Core/DeferredEvent.php | DeferredEvent.addListener | public function addListener($cb)
{
if ($this->state === self::STATE_DONE) {
if ($cb !== null) {
$cb($this);
}
return;
}
if ($cb !== null) {
$this->listeners->push($cb);
}
if ($this->state === self::STATE_WAITING)... | php | public function addListener($cb)
{
if ($this->state === self::STATE_DONE) {
if ($cb !== null) {
$cb($this);
}
return;
}
if ($cb !== null) {
$this->listeners->push($cb);
}
if ($this->state === self::STATE_WAITING)... | [
"public",
"function",
"addListener",
"(",
"$",
"cb",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"state",
"===",
"self",
"::",
"STATE_DONE",
")",
"{",
"if",
"(",
"$",
"cb",
"!==",
"null",
")",
"{",
"$",
"cb",
"(",
"$",
"this",
")",
";",
"}",
"retur... | Add listener
@param callable $cb Callback
@param mixed ...$args Arguments
@return void | [
"Add",
"listener"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Core/DeferredEvent.php#L133-L155 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.dispatch | public function dispatch(IncomingFrame $incomingFrame)
{
switch (true) {
case $incomingFrame instanceof Basic\BasicDeliverFrame:
case $incomingFrame instanceof Basic\BasicGetOkFrame:
$message = new Message();
$message->setRoutingKey($incomingFrame->rou... | php | public function dispatch(IncomingFrame $incomingFrame)
{
switch (true) {
case $incomingFrame instanceof Basic\BasicDeliverFrame:
case $incomingFrame instanceof Basic\BasicGetOkFrame:
$message = new Message();
$message->setRoutingKey($incomingFrame->rou... | [
"public",
"function",
"dispatch",
"(",
"IncomingFrame",
"$",
"incomingFrame",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"incomingFrame",
"instanceof",
"Basic",
"\\",
"BasicDeliverFrame",
":",
"case",
"$",
"incomingFrame",
"instanceof",
"Basic",
"\\... | Dispatch incoming frame
@param IncomingFrame $incomingFrame
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Dispatch",
"incoming",
"frame"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L196-L316 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.close | public function close()
{
$outputFrame = ProtocolChannel\ChannelCloseFrame::create(
0,//@todo replyCode
'Channel closed by client'
);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputFrame);
} | php | public function close()
{
$outputFrame = ProtocolChannel\ChannelCloseFrame::create(
0,//@todo replyCode
'Channel closed by client'
);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputFrame);
} | [
"public",
"function",
"close",
"(",
")",
"{",
"$",
"outputFrame",
"=",
"ProtocolChannel",
"\\",
"ChannelCloseFrame",
"::",
"create",
"(",
"0",
",",
"//@todo replyCode",
"'Channel closed by client'",
")",
";",
"$",
"outputFrame",
"->",
"frameChannelId",
"=",
"$",
... | Close the channel.
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Close",
"the",
"channel",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L324-L332 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.declareQueue | public function declareQueue($name, array $options = [], callable $callback = null)
{
$passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
$durable = array_key_exists('durable', $options) ? (bool)$options['durable'] : null;
$exclusive = array_key_exists('exclu... | php | public function declareQueue($name, array $options = [], callable $callback = null)
{
$passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
$durable = array_key_exists('durable', $options) ? (bool)$options['durable'] : null;
$exclusive = array_key_exists('exclu... | [
"public",
"function",
"declareQueue",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"passive",
"=",
"array_key_exists",
"(",
"'passive'",
",",
"$",
"options",
")",
"?",
"(",... | DeclareQueue
@param string $name a quque name
@param array $options a queue options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"DeclareQueue"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L355-L379 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.deleteQueue | public function deleteQueue($name, array $options = [], callable $callback = null)
{
$ifUnused = array_key_exists('ifUnused', $options) ? (bool)$options['ifUnused'] : null;
$ifEmpty = array_key_exists('ifEmpty', $options) ? (bool)$options['ifEmpty'] : null;
$noWait = array_key_exists('noWait... | php | public function deleteQueue($name, array $options = [], callable $callback = null)
{
$ifUnused = array_key_exists('ifUnused', $options) ? (bool)$options['ifUnused'] : null;
$ifEmpty = array_key_exists('ifEmpty', $options) ? (bool)$options['ifEmpty'] : null;
$noWait = array_key_exists('noWait... | [
"public",
"function",
"deleteQueue",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"ifUnused",
"=",
"array_key_exists",
"(",
"'ifUnused'",
",",
"$",
"options",
")",
"?",
"("... | Delete Queue
@param string $name a queue name
@param array $options a options array
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Delete",
"Queue"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L390-L403 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.purgeQueue | public function purgeQueue($name, array $options = [], callable $callback = null)
{
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$outputFrame = Queue\QueuePurgeFrame::create($name, $noWait);
$outputFrame->frameChannelId = $this->id;
$this->connec... | php | public function purgeQueue($name, array $options = [], callable $callback = null)
{
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$outputFrame = Queue\QueuePurgeFrame::create($name, $noWait);
$outputFrame->frameChannelId = $this->id;
$this->connec... | [
"public",
"function",
"purgeQueue",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"noWait",
"=",
"array_key_exists",
"(",
"'noWait'",
",",
"$",
"options",
")",
"?",
"(",
"... | Purge queue messages
@param string $name a queue name
@param array $options a options array
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Purge",
"queue",
"messages"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L414-L425 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.bindQueue | public function bindQueue($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$arguments = array_key_exists('arguments', $options) ? $options['arguments'] : null;
$outputFrame ... | php | public function bindQueue($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$arguments = array_key_exists('arguments', $options) ? $options['arguments'] : null;
$outputFrame ... | [
"public",
"function",
"bindQueue",
"(",
"$",
"name",
",",
"$",
"exchangeName",
",",
"$",
"routingKey",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"noWait",
"=",
"array_key_exists",
"(",
"'... | Bind queue to exchange
@param string $name a queue name
@param string $exchangeName a exchange name
@param string $routingKey a routing key
@param array $options additional options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolExc... | [
"Bind",
"queue",
"to",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L438-L456 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.unbindQueue | public function unbindQueue($name, $exchangeName, $routingKey, callable $callback = null)
{
$outputFrame = Queue\QueueUnbindFrame::create(
$name,
$exchangeName,
$routingKey
);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($ou... | php | public function unbindQueue($name, $exchangeName, $routingKey, callable $callback = null)
{
$outputFrame = Queue\QueueUnbindFrame::create(
$name,
$exchangeName,
$routingKey
);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($ou... | [
"public",
"function",
"unbindQueue",
"(",
"$",
"name",
",",
"$",
"exchangeName",
",",
"$",
"routingKey",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"outputFrame",
"=",
"Queue",
"\\",
"QueueUnbindFrame",
"::",
"create",
"(",
"$",
"name",
... | Unbind queue from exchange
@param string $name a queue name
@param string $exchangeName a exchange name
@param string $routingKey a routing key
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Unbind",
"queue",
"from",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L468-L481 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.declareExchange | public function declareExchange($name, array $options = [], callable $callback = null)
{
$type = array_key_exists('type', $options) ? $options['type'] : null;
$passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
$durable = array_key_exists('durable', $options)... | php | public function declareExchange($name, array $options = [], callable $callback = null)
{
$type = array_key_exists('type', $options) ? $options['type'] : null;
$passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
$durable = array_key_exists('durable', $options)... | [
"public",
"function",
"declareExchange",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"array_key_exists",
"(",
"'type'",
",",
"$",
"options",
")",
"?",
"$",
... | Declare exchange
@param string $name a name of exchange
@param array $options exchange options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Declare",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L492-L518 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.deleteExchange | public function deleteExchange($name, array $options = [], callable $callback = null)
{
$ifUnused = array_key_exists('ifUnused', $options) ? (bool)$options['ifUnused'] : null;
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$outputFrame = Exchange\ExchangeD... | php | public function deleteExchange($name, array $options = [], callable $callback = null)
{
$ifUnused = array_key_exists('ifUnused', $options) ? (bool)$options['ifUnused'] : null;
$noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
$outputFrame = Exchange\ExchangeD... | [
"public",
"function",
"deleteExchange",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"ifUnused",
"=",
"array_key_exists",
"(",
"'ifUnused'",
",",
"$",
"options",
")",
"?",
... | Delete Exchange
@param string $name a exchange name
@param array $options a exchange options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Delete",
"Exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L529-L541 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.bindExchange | public function bindExchange($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
if (!$this->connection->getFeatures()->exchangeToExchangeBindings) {
throw new AMQPChannelException('Broker does not support exchange to exchange bindings');
}
if ($... | php | public function bindExchange($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
if (!$this->connection->getFeatures()->exchangeToExchangeBindings) {
throw new AMQPChannelException('Broker does not support exchange to exchange bindings');
}
if ($... | [
"public",
"function",
"bindExchange",
"(",
"$",
"name",
",",
"$",
"exchangeName",
",",
"$",
"routingKey",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connec... | Bind exchange
@param string $name a source exchange name
@param string $exchangeName a destination exchange name
@param string $routingKey a routing key
@param array $options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException... | [
"Bind",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L555-L580 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.unbindExchange | public function unbindExchange($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
if (!$this->connection->getFeatures()->exchangeToExchangeBindings) {
throw new AMQPChannelException('Broker does not support exchange to exchange bindings');
}
if ... | php | public function unbindExchange($name, $exchangeName, $routingKey, array $options = [], callable $callback = null)
{
if (!$this->connection->getFeatures()->exchangeToExchangeBindings) {
throw new AMQPChannelException('Broker does not support exchange to exchange bindings');
}
if ... | [
"public",
"function",
"unbindExchange",
"(",
"$",
"name",
",",
"$",
"exchangeName",
",",
"$",
"routingKey",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"conn... | Unbind exchange
@param string $name a source exchange name
@param string $exchangeName a destination exchange name
@param string $routingKey a routing key
@param array $options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Exception\AMQPChannelException
@throws... | [
"Unbind",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L594-L619 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.publish | public function publish($content, $exchangeName, $routingKey, array $options = [])
{
/**
* Нам нужно собрать докучи три фрейма
* 1. BasicPublishFrame сообщает брокеру , что будет чтото передавать.
* 2. BasicHeaderFrame сообщает брокеру заголовки отправляемого сообщения
* ... | php | public function publish($content, $exchangeName, $routingKey, array $options = [])
{
/**
* Нам нужно собрать докучи три фрейма
* 1. BasicPublishFrame сообщает брокеру , что будет чтото передавать.
* 2. BasicHeaderFrame сообщает брокеру заголовки отправляемого сообщения
* ... | [
"public",
"function",
"publish",
"(",
"$",
"content",
",",
"$",
"exchangeName",
",",
"$",
"routingKey",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"/**\n * Нам нужно собрать докучи три фрейма\n * 1. BasicPublishFrame сообщает брокеру , что будет ... | Publish message to exchange
@param string $content The message content
@param string $exchangeName exchange name
@param string $routingKey routing key
@param array $options
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Publish",
"message",
"to",
"exchange"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L631-L695 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.consume | public function consume($queueName, array $options = [], callable $callback)
{
$consumerTag = array_key_exists('consumerTag', $options) ? $options['consumerTag'] : null;
$noLocal = array_key_exists('noLocal', $options) ? (bool)$options['noLocal'] : null;
$noAck = array_key_exists('noAck', $o... | php | public function consume($queueName, array $options = [], callable $callback)
{
$consumerTag = array_key_exists('consumerTag', $options) ? $options['consumerTag'] : null;
$noLocal = array_key_exists('noLocal', $options) ? (bool)$options['noLocal'] : null;
$noAck = array_key_exists('noAck', $o... | [
"public",
"function",
"consume",
"(",
"$",
"queueName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
")",
"{",
"$",
"consumerTag",
"=",
"array_key_exists",
"(",
"'consumerTag'",
",",
"$",
"options",
")",
"?",
"$",
"optio... | Bind a consumer to consume on message receive
@param string $queueName a queue name
@param array $options
@param callable $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Bind",
"a",
"consumer",
"to",
"consume",
"on",
"message",
"receive"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L720-L746 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.cancel | public function cancel($consumerTag, array $options = [])
{
$noWait = array_key_exists('noWait', $options) ? $options['noWait'] : null;
$outputFrame = Basic\BasicCancelFrame::create($consumerTag, $noWait);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputF... | php | public function cancel($consumerTag, array $options = [])
{
$noWait = array_key_exists('noWait', $options) ? $options['noWait'] : null;
$outputFrame = Basic\BasicCancelFrame::create($consumerTag, $noWait);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputF... | [
"public",
"function",
"cancel",
"(",
"$",
"consumerTag",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"noWait",
"=",
"array_key_exists",
"(",
"'noWait'",
",",
"$",
"options",
")",
"?",
"$",
"options",
"[",
"'noWait'",
"]",
":",
"null",
... | Unbind consumer
@param string $consumerTag
@param array $options
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Unbind",
"consumer"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L756-L763 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.get | public function get($queueName, array $options = [], callable $callback = null)
{
$noAck = array_key_exists('noAck', $options) ? $options['noAck'] : null;
$outputFrame = Basic\BasicGetFrame::create(
$queueName,
$noAck
);
$outputFrame->frameChannelId = $this->... | php | public function get($queueName, array $options = [], callable $callback = null)
{
$noAck = array_key_exists('noAck', $options) ? $options['noAck'] : null;
$outputFrame = Basic\BasicGetFrame::create(
$queueName,
$noAck
);
$outputFrame->frameChannelId = $this->... | [
"public",
"function",
"get",
"(",
"$",
"queueName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"noAck",
"=",
"array_key_exists",
"(",
"'noAck'",
",",
"$",
"options",
")",
"?",
"$",
"opti... | get message from queue
@param string $queueName a queue name
@param array $options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"get",
"message",
"from",
"queue"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L774-L788 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.ack | public function ack($deliveryTag, array $options = [])
{
$multiple = array_key_exists('multiple', $options) ? (int)$options['multiple'] : null;
$outputFrame = Basic\BasicAckFrame::create($deliveryTag, $multiple);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($... | php | public function ack($deliveryTag, array $options = [])
{
$multiple = array_key_exists('multiple', $options) ? (int)$options['multiple'] : null;
$outputFrame = Basic\BasicAckFrame::create($deliveryTag, $multiple);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($... | [
"public",
"function",
"ack",
"(",
"$",
"deliveryTag",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"multiple",
"=",
"array_key_exists",
"(",
"'multiple'",
",",
"$",
"options",
")",
"?",
"(",
"int",
")",
"$",
"options",
"[",
"'multiple'",... | Ack message by delivery tag
@param int $deliveryTag
@param array $options
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Ack",
"message",
"by",
"delivery",
"tag"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L798-L805 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.nack | public function nack($deliveryTag, array $options = [])
{
$multiple = array_key_exists('multiple', $options) ? (int)$options['multiple'] : null;
$requeue = array_key_exists('requeue', $options) ? (bool)$options['requeue'] : null;
$outputFrame = Basic\BasicNackFrame::create($deliveryTag, $mu... | php | public function nack($deliveryTag, array $options = [])
{
$multiple = array_key_exists('multiple', $options) ? (int)$options['multiple'] : null;
$requeue = array_key_exists('requeue', $options) ? (bool)$options['requeue'] : null;
$outputFrame = Basic\BasicNackFrame::create($deliveryTag, $mu... | [
"public",
"function",
"nack",
"(",
"$",
"deliveryTag",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"multiple",
"=",
"array_key_exists",
"(",
"'multiple'",
",",
"$",
"options",
")",
"?",
"(",
"int",
")",
"$",
"options",
"[",
"'multiple'"... | Nack message
@param $deliveryTag
@param array $options
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Nack",
"message"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L815-L823 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.reject | public function reject($deliveryTag, array $options = [])
{
$requeue = array_key_exists('requeue', $options) ? $options['requeue'] : null;
$outputFrame = Basic\BasicRejectFrame::create($deliveryTag, $requeue);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($out... | php | public function reject($deliveryTag, array $options = [])
{
$requeue = array_key_exists('requeue', $options) ? $options['requeue'] : null;
$outputFrame = Basic\BasicRejectFrame::create($deliveryTag, $requeue);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($out... | [
"public",
"function",
"reject",
"(",
"$",
"deliveryTag",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"requeue",
"=",
"array_key_exists",
"(",
"'requeue'",
",",
"$",
"options",
")",
"?",
"$",
"options",
"[",
"'requeue'",
"]",
":",
"null"... | Reject a message
@param $deliveryTag
@param array $options
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Reject",
"a",
"message"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L833-L840 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Channel.php | Channel.recover | public function recover($requeue = true)
{
$outputFrame = Basic\BasicRecoverFrame::create($requeue);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputFrame);
} | php | public function recover($requeue = true)
{
$outputFrame = Basic\BasicRecoverFrame::create($requeue);
$outputFrame->frameChannelId = $this->id;
$this->connection->command($outputFrame);
} | [
"public",
"function",
"recover",
"(",
"$",
"requeue",
"=",
"true",
")",
"{",
"$",
"outputFrame",
"=",
"Basic",
"\\",
"BasicRecoverFrame",
"::",
"create",
"(",
"$",
"requeue",
")",
";",
"$",
"outputFrame",
"->",
"frameChannelId",
"=",
"$",
"this",
"->",
"... | Redeliver unacknowledged messages.
@param bool $requeue
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Redeliver",
"unacknowledged",
"messages",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Channel.php#L849-L854 |
kakserpom/phpdaemon | PHPDaemon/Servers/HTTP/Pool.php | Pool.onConfigUpdated | public function onConfigUpdated()
{
parent::onConfigUpdated();
if (($order = ini_get('request_order')) || ($order = ini_get('variables_order'))) {
$this->variablesOrder = $order;
} else {
$this->variablesOrder = null;
}
} | php | public function onConfigUpdated()
{
parent::onConfigUpdated();
if (($order = ini_get('request_order')) || ($order = ini_get('variables_order'))) {
$this->variablesOrder = $order;
} else {
$this->variablesOrder = null;
}
} | [
"public",
"function",
"onConfigUpdated",
"(",
")",
"{",
"parent",
"::",
"onConfigUpdated",
"(",
")",
";",
"if",
"(",
"(",
"$",
"order",
"=",
"ini_get",
"(",
"'request_order'",
")",
")",
"||",
"(",
"$",
"order",
"=",
"ini_get",
"(",
"'variables_order'",
"... | Called when worker is going to update configuration.
@return void | [
"Called",
"when",
"worker",
"is",
"going",
"to",
"update",
"configuration",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Servers/HTTP/Pool.php#L28-L37 |
kakserpom/phpdaemon | PHPDaemon/Servers/HTTP/Pool.php | Pool.onReady | public function onReady()
{
parent::onReady();
$this->WS = \PHPDaemon\Servers\WebSocket\Pool::getInstance($this->config->wssname->value, false);
} | php | public function onReady()
{
parent::onReady();
$this->WS = \PHPDaemon\Servers\WebSocket\Pool::getInstance($this->config->wssname->value, false);
} | [
"public",
"function",
"onReady",
"(",
")",
"{",
"parent",
"::",
"onReady",
"(",
")",
";",
"$",
"this",
"->",
"WS",
"=",
"\\",
"PHPDaemon",
"\\",
"Servers",
"\\",
"WebSocket",
"\\",
"Pool",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"config",
"->",
... | 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/Servers/HTTP/Pool.php#L43-L47 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueUnbindFrame.php | QueueUnbindFrame.create | public static function create(
$queue = null, $exchange = null, $routingKey = null, $arguments = null
)
{
$frame = new self();
if (null !== $queue) {
$frame->queue = $queue;
}
if (null !== $exchange) {
$frame->exchange = $exchange;
}
... | php | public static function create(
$queue = null, $exchange = null, $routingKey = null, $arguments = null
)
{
$frame = new self();
if (null !== $queue) {
$frame->queue = $queue;
}
if (null !== $exchange) {
$frame->exchange = $exchange;
}
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"queue",
"=",
"null",
",",
"$",
"exchange",
"=",
"null",
",",
"$",
"routingKey",
"=",
"null",
",",
"$",
"arguments",
"=",
"null",
")",
"{",
"$",
"frame",
"=",
"new",
"self",
"(",
")",
";",
"if",
... | table | [
"table"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Protocol/Queue/QueueUnbindFrame.php#L24-L44 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Message.php | Message.ack | public function ack()
{
$this->checkChannel();
$outputFrame = BasicAckFrame::create($this->tag);
$outputFrame->frameChannelId = $this->channel->getId();
$this->channel->getConnection()->command($outputFrame);
} | php | public function ack()
{
$this->checkChannel();
$outputFrame = BasicAckFrame::create($this->tag);
$outputFrame->frameChannelId = $this->channel->getId();
$this->channel->getConnection()->command($outputFrame);
} | [
"public",
"function",
"ack",
"(",
")",
"{",
"$",
"this",
"->",
"checkChannel",
"(",
")",
";",
"$",
"outputFrame",
"=",
"BasicAckFrame",
"::",
"create",
"(",
"$",
"this",
"->",
"tag",
")",
";",
"$",
"outputFrame",
"->",
"frameChannelId",
"=",
"$",
"this... | Acknowledge the message.
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException
@throws \PHPDaemon\Clients\AMQP\Driver\Exception\AMQPMessageException | [
"Acknowledge",
"the",
"message",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Message.php#L137-L145 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Message.php | Message.nack | public function nack($multiple = null, $requeue = null)
{
$this->checkChannel();
$outputFrame = BasicNackFrame::create($this->tag, $multiple, $requeue);
$outputFrame->frameChannelId = $this->channel->getId();
$this->channel->getConnection()->command($outputFrame);
} | php | public function nack($multiple = null, $requeue = null)
{
$this->checkChannel();
$outputFrame = BasicNackFrame::create($this->tag, $multiple, $requeue);
$outputFrame->frameChannelId = $this->channel->getId();
$this->channel->getConnection()->command($outputFrame);
} | [
"public",
"function",
"nack",
"(",
"$",
"multiple",
"=",
"null",
",",
"$",
"requeue",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkChannel",
"(",
")",
";",
"$",
"outputFrame",
"=",
"BasicNackFrame",
"::",
"create",
"(",
"$",
"this",
"->",
"tag",
"... | Not Acknowledge the message.
@param null $multiple
@param null $requeue
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException | [
"Not",
"Acknowledge",
"the",
"message",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Message.php#L155-L162 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Message.php | Message.reject | public function reject($requeue = true)
{
$this->checkChannel();
$outputFrame = BasicRejectFrame::create($this->tag, $requeue);
$outputFrame->frameChannelId = $this->channel->getId();
if (null !== $requeue) {
$outputFrame->requeue = $requeue;
}
$this->cha... | php | public function reject($requeue = true)
{
$this->checkChannel();
$outputFrame = BasicRejectFrame::create($this->tag, $requeue);
$outputFrame->frameChannelId = $this->channel->getId();
if (null !== $requeue) {
$outputFrame->requeue = $requeue;
}
$this->cha... | [
"public",
"function",
"reject",
"(",
"$",
"requeue",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"checkChannel",
"(",
")",
";",
"$",
"outputFrame",
"=",
"BasicRejectFrame",
"::",
"create",
"(",
"$",
"this",
"->",
"tag",
",",
"$",
"requeue",
")",
";",
"... | Reject the message and requeue it.
@see ConsumerOptionsInterface::$noAck to consume messages without requiring
excplicit acknowledgement by the consumer.
@param bool $requeue
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException
@throws \PHPDaemon\Clients\AM... | [
"Reject",
"the",
"message",
"and",
"requeue",
"it",
"."
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Message.php#L175-L185 |
kakserpom/phpdaemon | PHPDaemon/Clients/AMQP/Message.php | Message.checkChannel | private function checkChannel()
{
if (!$this->channel->isConnected()) {
throw new AMQPMessageException('Channel is closed');
}
if (null === $this->channel->getId()) {
throw new AMQPMessageException('AMQPChannel id not found');
}
return true;
} | php | private function checkChannel()
{
if (!$this->channel->isConnected()) {
throw new AMQPMessageException('Channel is closed');
}
if (null === $this->channel->getId()) {
throw new AMQPMessageException('AMQPChannel id not found');
}
return true;
} | [
"private",
"function",
"checkChannel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"channel",
"->",
"isConnected",
"(",
")",
")",
"{",
"throw",
"new",
"AMQPMessageException",
"(",
"'Channel is closed'",
")",
";",
"}",
"if",
"(",
"null",
"===",
"$",... | Проеряет, что канал еще жив
@throws AMQPMessageException | [
"Проеряет",
"что",
"канал",
"еще",
"жив"
] | train | https://github.com/kakserpom/phpdaemon/blob/cfbe02e60e162853747ea9484c12f15341e56833/PHPDaemon/Clients/AMQP/Message.php#L372-L383 |
squareboat/sneaker | src/SneakerServiceProvider.php | SneakerServiceProvider.boot | public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'sneaker');
$this->publishes([
__DIR__ . '/../resources/views/email' => resource_path('views/vendor/sneaker/email')
], 'views');
$this->publishes([
__DIR__.'/../config/sneaker.php... | php | public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'sneaker');
$this->publishes([
__DIR__ . '/../resources/views/email' => resource_path('views/vendor/sneaker/email')
], 'views');
$this->publishes([
__DIR__.'/../config/sneaker.php... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"__DIR__",
".",
"'/../resources/views'",
",",
"'sneaker'",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/../resources/views/email'",
"=>",
"resource_... | Bootstrap the application services.
@return void | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/SneakerServiceProvider.php#L21-L38 |
squareboat/sneaker | src/SneakerServiceProvider.php | SneakerServiceProvider.register | public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/sneaker.php', 'sneaker'
);
$this->app->singleton('sneaker', function () {
return $this->app->make(Sneaker::class);
});
} | php | public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/sneaker.php', 'sneaker'
);
$this->app->singleton('sneaker', function () {
return $this->app->make(Sneaker::class);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/sneaker.php'",
",",
"'sneaker'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'sneaker'",
",",
"function",
"(",
")",
"{... | Register the application services.
@return void | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/SneakerServiceProvider.php#L45-L54 |
squareboat/sneaker | src/Commands/Sneak.php | Sneak.handle | public function handle()
{
$this->overrideConfig();
try {
app('sneaker')->captureException(new DummyException, true);
$this->info('Sneaker is working fine ✅');
} catch (Exception $e) {
(new ConsoleApplication)->renderException($e, $this->output);
... | php | public function handle()
{
$this->overrideConfig();
try {
app('sneaker')->captureException(new DummyException, true);
$this->info('Sneaker is working fine ✅');
} catch (Exception $e) {
(new ConsoleApplication)->renderException($e, $this->output);
... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"overrideConfig",
"(",
")",
";",
"try",
"{",
"app",
"(",
"'sneaker'",
")",
"->",
"captureException",
"(",
"new",
"DummyException",
",",
"true",
")",
";",
"$",
"this",
"->",
"info",
"(",
... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/Commands/Sneak.php#L52-L63 |
squareboat/sneaker | src/ExceptionHandler.php | ExceptionHandler.convertExceptionToHtml | public function convertExceptionToHtml($exception)
{
$flat = $this->getFlattenedException($exception);
$handler = new SymfonyExceptionHandler();
return $this->decorate($handler->getContent($flat), $handler->getStylesheet($flat), $flat);
} | php | public function convertExceptionToHtml($exception)
{
$flat = $this->getFlattenedException($exception);
$handler = new SymfonyExceptionHandler();
return $this->decorate($handler->getContent($flat), $handler->getStylesheet($flat), $flat);
} | [
"public",
"function",
"convertExceptionToHtml",
"(",
"$",
"exception",
")",
"{",
"$",
"flat",
"=",
"$",
"this",
"->",
"getFlattenedException",
"(",
"$",
"exception",
")",
";",
"$",
"handler",
"=",
"new",
"SymfonyExceptionHandler",
"(",
")",
";",
"return",
"$... | Create a html for the given exception.
@param \Exception $exception
@return string | [
"Create",
"a",
"html",
"for",
"the",
"given",
"exception",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/ExceptionHandler.php#L46-L53 |
squareboat/sneaker | src/ExceptionHandler.php | ExceptionHandler.decorate | private function decorate($content, $css, $exception)
{
$content = $this->removeTitle($content);
return $this->view->make('sneaker::email.body', compact('content', 'css', 'exception'))->render();
} | php | private function decorate($content, $css, $exception)
{
$content = $this->removeTitle($content);
return $this->view->make('sneaker::email.body', compact('content', 'css', 'exception'))->render();
} | [
"private",
"function",
"decorate",
"(",
"$",
"content",
",",
"$",
"css",
",",
"$",
"exception",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"removeTitle",
"(",
"$",
"content",
")",
";",
"return",
"$",
"this",
"->",
"view",
"->",
"make",
"(",
... | Get the html response content.
@param string $content
@param string $css
@return string | [
"Get",
"the",
"html",
"response",
"content",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/ExceptionHandler.php#L77-L82 |
squareboat/sneaker | src/ExceptionHandler.php | ExceptionHandler.removeTitle | private function removeTitle($content)
{
$titles = [
'Whoops, looks like something went wrong.',
'Sorry, the page you are looking for could not be found.',
];
foreach ($titles as $title) {
$content = str_replace("<h1>{$title}</h1>", '', $content);
... | php | private function removeTitle($content)
{
$titles = [
'Whoops, looks like something went wrong.',
'Sorry, the page you are looking for could not be found.',
];
foreach ($titles as $title) {
$content = str_replace("<h1>{$title}</h1>", '', $content);
... | [
"private",
"function",
"removeTitle",
"(",
"$",
"content",
")",
"{",
"$",
"titles",
"=",
"[",
"'Whoops, looks like something went wrong.'",
",",
"'Sorry, the page you are looking for could not be found.'",
",",
"]",
";",
"foreach",
"(",
"$",
"titles",
"as",
"$",
"titl... | Removes title from content as it is same for all exceptions and has no real value.
@param string $content
@return string | [
"Removes",
"title",
"from",
"content",
"as",
"it",
"is",
"same",
"for",
"all",
"exceptions",
"and",
"has",
"no",
"real",
"value",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/ExceptionHandler.php#L90-L102 |
squareboat/sneaker | src/Sneaker.php | Sneaker.captureException | public function captureException(Exception $exception, $sneaking = false)
{
try {
if ($this->isSilent()) {
return;
}
if ($this->isExceptionFromBot()) {
return;
}
if ($this->shouldCapture($exception)) {
... | php | public function captureException(Exception $exception, $sneaking = false)
{
try {
if ($this->isSilent()) {
return;
}
if ($this->isExceptionFromBot()) {
return;
}
if ($this->shouldCapture($exception)) {
... | [
"public",
"function",
"captureException",
"(",
"Exception",
"$",
"exception",
",",
"$",
"sneaking",
"=",
"false",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilent",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
... | Checks an exception which should be tracked and captures it if applicable.
@param \Exception $exception
@return void | [
"Checks",
"an",
"exception",
"which",
"should",
"be",
"tracked",
"and",
"captures",
"it",
"if",
"applicable",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/Sneaker.php#L69-L95 |
squareboat/sneaker | src/Sneaker.php | Sneaker.capture | private function capture($exception)
{
$recipients = $this->config->get('sneaker.to');
$subject = $this->handler->convertExceptionToString($exception);
$body = $this->handler->convertExceptionToHtml($exception);
$this->mailer->to($recipients)->send(new ExceptionMailer($subject, $b... | php | private function capture($exception)
{
$recipients = $this->config->get('sneaker.to');
$subject = $this->handler->convertExceptionToString($exception);
$body = $this->handler->convertExceptionToHtml($exception);
$this->mailer->to($recipients)->send(new ExceptionMailer($subject, $b... | [
"private",
"function",
"capture",
"(",
"$",
"exception",
")",
"{",
"$",
"recipients",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'sneaker.to'",
")",
";",
"$",
"subject",
"=",
"$",
"this",
"->",
"handler",
"->",
"convertExceptionToString",
"(",
... | Capture an exception.
@param \Exception $exception
@return void | [
"Capture",
"an",
"exception",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/Sneaker.php#L103-L112 |
squareboat/sneaker | src/Sneaker.php | Sneaker.shouldCapture | private function shouldCapture(Exception $exception)
{
$capture = $this->config->get('sneaker.capture');
if (! is_array($capture)) {
return false;
}
if (in_array('*', $capture)) {
return true;
}
foreach ($capture as $type) {
if (... | php | private function shouldCapture(Exception $exception)
{
$capture = $this->config->get('sneaker.capture');
if (! is_array($capture)) {
return false;
}
if (in_array('*', $capture)) {
return true;
}
foreach ($capture as $type) {
if (... | [
"private",
"function",
"shouldCapture",
"(",
"Exception",
"$",
"exception",
")",
"{",
"$",
"capture",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'sneaker.capture'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"capture",
")",
")",
"{",
"re... | Determine if the exception is in the "capture" list.
@param Exception $exception
@return boolean | [
"Determine",
"if",
"the",
"exception",
"is",
"in",
"the",
"capture",
"list",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/Sneaker.php#L130-L149 |
squareboat/sneaker | src/Sneaker.php | Sneaker.isExceptionFromBot | private function isExceptionFromBot()
{
$ignored_bots = $this->config->get('sneaker.ignored_bots');
$agent = array_key_exists('HTTP_USER_AGENT', $_SERVER)
? strtolower($_SERVER['HTTP_USER_AGENT'])
: null;
if (is_null($agent)) {
return fal... | php | private function isExceptionFromBot()
{
$ignored_bots = $this->config->get('sneaker.ignored_bots');
$agent = array_key_exists('HTTP_USER_AGENT', $_SERVER)
? strtolower($_SERVER['HTTP_USER_AGENT'])
: null;
if (is_null($agent)) {
return fal... | [
"private",
"function",
"isExceptionFromBot",
"(",
")",
"{",
"$",
"ignored_bots",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'sneaker.ignored_bots'",
")",
";",
"$",
"agent",
"=",
"array_key_exists",
"(",
"'HTTP_USER_AGENT'",
",",
"$",
"_SERVER",
")",
... | Determine if the exception is from the bot.
@return boolean | [
"Determine",
"if",
"the",
"exception",
"is",
"from",
"the",
"bot",
"."
] | train | https://github.com/squareboat/sneaker/blob/618a8c5dfc7852a83b523b65c5485e21acfdf03d/src/Sneaker.php#L156-L175 |
TheNetworg/oauth2-azure | src/Provider/AzureResourceOwner.php | AzureResourceOwner.claim | public function claim($name)
{
return isset($this->data[$name]) ? $this->data[$name] : null;
} | php | public function claim($name)
{
return isset($this->data[$name]) ? $this->data[$name] : null;
} | [
"public",
"function",
"claim",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
] | Returns a field from the parsed JWT data.
@param string $name
@return mixed|null | [
"Returns",
"a",
"field",
"from",
"the",
"parsed",
"JWT",
"data",
"."
] | train | https://github.com/TheNetworg/oauth2-azure/blob/1bd78900f8048c9493b6f27a2e4409ee62a5718a/src/Provider/AzureResourceOwner.php#L83-L86 |
TheNetworg/oauth2-azure | src/Provider/Azure.php | Azure.validateAccessToken | public function validateAccessToken($accessToken)
{
$keys = $this->getJwtVerificationKeys();
$tokenClaims = (array)JWT::decode($accessToken, $keys, ['RS256']);
if ($this->getClientId() != $tokenClaims['aud'] && $this->getClientId() != $tokenClaims['appid']) {
throw new \R... | php | public function validateAccessToken($accessToken)
{
$keys = $this->getJwtVerificationKeys();
$tokenClaims = (array)JWT::decode($accessToken, $keys, ['RS256']);
if ($this->getClientId() != $tokenClaims['aud'] && $this->getClientId() != $tokenClaims['appid']) {
throw new \R... | [
"public",
"function",
"validateAccessToken",
"(",
"$",
"accessToken",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"getJwtVerificationKeys",
"(",
")",
";",
"$",
"tokenClaims",
"=",
"(",
"array",
")",
"JWT",
"::",
"decode",
"(",
"$",
"accessToken",
",",
... | Validate the access token you received in your application.
@param $accessToken string The access token you received in the authorization header.
@return array | [
"Validate",
"the",
"access",
"token",
"you",
"received",
"in",
"your",
"application",
"."
] | train | https://github.com/TheNetworg/oauth2-azure/blob/1bd78900f8048c9493b6f27a2e4409ee62a5718a/src/Provider/Azure.php#L202-L230 |
TheNetworg/oauth2-azure | src/Provider/Azure.php | Azure.getJwtVerificationKeys | public function getJwtVerificationKeys()
{
$factory = $this->getRequestFactory();
$request = $factory->getRequestWithOptions('get', 'https://login.windows.net/common/discovery/keys', []);
$response = $this->getParsedResponse($request);
$keys = [];
foreach ($response['keys']... | php | public function getJwtVerificationKeys()
{
$factory = $this->getRequestFactory();
$request = $factory->getRequestWithOptions('get', 'https://login.windows.net/common/discovery/keys', []);
$response = $this->getParsedResponse($request);
$keys = [];
foreach ($response['keys']... | [
"public",
"function",
"getJwtVerificationKeys",
"(",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"getRequestFactory",
"(",
")",
";",
"$",
"request",
"=",
"$",
"factory",
"->",
"getRequestWithOptions",
"(",
"'get'",
",",
"'https://login.windows.net/common/dis... | Get JWT verification keys from Azure Active Directory.
@return array | [
"Get",
"JWT",
"verification",
"keys",
"from",
"Azure",
"Active",
"Directory",
"."
] | train | https://github.com/TheNetworg/oauth2-azure/blob/1bd78900f8048c9493b6f27a2e4409ee62a5718a/src/Provider/Azure.php#L237-L279 |
TheNetworg/oauth2-azure | src/Provider/Azure.php | Azure.getTenantDetails | public function getTenantDetails($tenant)
{
$factory = $this->getRequestFactory();
$request = $factory->getRequestWithOptions(
'get',
'https://login.windows.net/' . $tenant . '/.well-known/openid-configuration',
[]
);
$response = $this->getParsedR... | php | public function getTenantDetails($tenant)
{
$factory = $this->getRequestFactory();
$request = $factory->getRequestWithOptions(
'get',
'https://login.windows.net/' . $tenant . '/.well-known/openid-configuration',
[]
);
$response = $this->getParsedR... | [
"public",
"function",
"getTenantDetails",
"(",
"$",
"tenant",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"getRequestFactory",
"(",
")",
";",
"$",
"request",
"=",
"$",
"factory",
"->",
"getRequestWithOptions",
"(",
"'get'",
",",
"'https://login.windows.n... | Get the specified tenant's details.
@param string $tenant
@return array | [
"Get",
"the",
"specified",
"tenant",
"s",
"details",
"."
] | train | https://github.com/TheNetworg/oauth2-azure/blob/1bd78900f8048c9493b6f27a2e4409ee62a5718a/src/Provider/Azure.php#L288-L300 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.inheritFromParent | protected function inheritFromParent(BaseQuery $parent)
{
parent::inheritFromParent($parent);
if ($parent instanceof Select) {
$parent->copyTo($this);
}
} | php | protected function inheritFromParent(BaseQuery $parent)
{
parent::inheritFromParent($parent);
if ($parent instanceof Select) {
$parent->copyTo($this);
}
} | [
"protected",
"function",
"inheritFromParent",
"(",
"BaseQuery",
"$",
"parent",
")",
"{",
"parent",
"::",
"inheritFromParent",
"(",
"$",
"parent",
")",
";",
"if",
"(",
"$",
"parent",
"instanceof",
"Select",
")",
"{",
"$",
"parent",
"->",
"copyTo",
"(",
"$",... | Inherit property values from parent query
@param BaseQuery $parent
@return void | [
"Inherit",
"property",
"values",
"from",
"parent",
"query"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L73-L80 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.copyTo | public function copyTo(Select $query)
{
$query->fields = $this->fields;
$query->distinct = $this->distinct;
$query->orders = $this->orders;
$query->groups = $this->groups;
$query->joins = $this->joins;
$query->groupResults = $this->groupResults;
$query->forwar... | php | public function copyTo(Select $query)
{
$query->fields = $this->fields;
$query->distinct = $this->distinct;
$query->orders = $this->orders;
$query->groups = $this->groups;
$query->joins = $this->joins;
$query->groupResults = $this->groupResults;
$query->forwar... | [
"public",
"function",
"copyTo",
"(",
"Select",
"$",
"query",
")",
"{",
"$",
"query",
"->",
"fields",
"=",
"$",
"this",
"->",
"fields",
";",
"$",
"query",
"->",
"distinct",
"=",
"$",
"this",
"->",
"distinct",
";",
"$",
"query",
"->",
"orders",
"=",
... | Copy current queries select attributes to the given one
@param Select $query | [
"Copy",
"current",
"queries",
"select",
"attributes",
"to",
"the",
"given",
"one"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L87-L96 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.fields | public function fields($fields)
{
// we always have to reset the fields
$this->fields = array();
// when a string is given
if (is_string($fields))
{
$fields = $this->stringArgumentToArray($fields);
}
// it also could be an object
elseif (... | php | public function fields($fields)
{
// we always have to reset the fields
$this->fields = array();
// when a string is given
if (is_string($fields))
{
$fields = $this->stringArgumentToArray($fields);
}
// it also could be an object
elseif (... | [
"public",
"function",
"fields",
"(",
"$",
"fields",
")",
"{",
"// we always have to reset the fields",
"$",
"this",
"->",
"fields",
"=",
"array",
"(",
")",
";",
"// when a string is given",
"if",
"(",
"is_string",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fie... | Set the selected fields fields
->fields('title')
->fields(['id', 'name'])
->fields('id, name, created_at as created')
@param array $values
@return self The current query builder. | [
"Set",
"the",
"selected",
"fields",
"fields"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L121-L153 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldCount | public function addFieldCount($field, $alias = null)
{
$this->addField(new Func('count', $field), $alias); return $this;
} | php | public function addFieldCount($field, $alias = null)
{
$this->addField(new Func('count', $field), $alias); return $this;
} | [
"public",
"function",
"addFieldCount",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'count'",
",",
"$",
"field",
")",
",",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
... | Shortcut to add a count function
->addFieldCount('id')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"count",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L178-L181 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldMax | public function addFieldMax($field, $alias = null)
{
$this->addField(new Func('max', $field), $alias); return $this;
} | php | public function addFieldMax($field, $alias = null)
{
$this->addField(new Func('max', $field), $alias); return $this;
} | [
"public",
"function",
"addFieldMax",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'max'",
",",
"$",
"field",
")",
",",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
"}... | Shortcut to add a max function
->addFieldMax('views')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"max",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L192-L195 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldMin | public function addFieldMin($field, $alias = null)
{
$this->addField(new Func('min', $field), $alias); return $this;
} | php | public function addFieldMin($field, $alias = null)
{
$this->addField(new Func('min', $field), $alias); return $this;
} | [
"public",
"function",
"addFieldMin",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'min'",
",",
"$",
"field",
")",
",",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
"}... | Shortcut to add a min function
->addFieldMin('views')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"min",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L206-L209 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldSum | public function addFieldSum($field, $alias = null)
{
$this->addField(new Func('sum', $field), $alias); return $this;
} | php | public function addFieldSum($field, $alias = null)
{
$this->addField(new Func('sum', $field), $alias); return $this;
} | [
"public",
"function",
"addFieldSum",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'sum'",
",",
"$",
"field",
")",
",",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
"}... | Shortcut to add a sum function
->addFieldSum('views')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"sum",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L220-L223 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldAvg | public function addFieldAvg($field, $alias = null)
{
$this->addField(new Func('avg', $field), $alias); return $this;
} | php | public function addFieldAvg($field, $alias = null)
{
$this->addField(new Func('avg', $field), $alias); return $this;
} | [
"public",
"function",
"addFieldAvg",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'avg'",
",",
"$",
"field",
")",
",",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
"}... | Shortcut to add a avg function
->addFieldAvg('views')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"avg",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L234-L237 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.addFieldRound | public function addFieldRound($field, $decimals = 0, $alias = null)
{
$this->addField(new Func('round', $field, new Expression((int)$decimals)), $alias); return $this;
} | php | public function addFieldRound($field, $decimals = 0, $alias = null)
{
$this->addField(new Func('round', $field, new Expression((int)$decimals)), $alias); return $this;
} | [
"public",
"function",
"addFieldRound",
"(",
"$",
"field",
",",
"$",
"decimals",
"=",
"0",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"new",
"Func",
"(",
"'round'",
",",
"$",
"field",
",",
"new",
"Expression",
"(",
... | Shortcut to add a price function
->addFieldRound('price')
@param string $field
@param string $alias
@return self The current query builder. | [
"Shortcut",
"to",
"add",
"a",
"price",
"function"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L248-L251 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.orderBy | public function orderBy($columns, $direction = 'asc')
{
if (is_string($columns))
{
$columns = $this->stringArgumentToArray($columns);
}
elseif ($columns instanceof Expression)
{
$this->orders[] = array($columns, $direction); return $this;
}
... | php | public function orderBy($columns, $direction = 'asc')
{
if (is_string($columns))
{
$columns = $this->stringArgumentToArray($columns);
}
elseif ($columns instanceof Expression)
{
$this->orders[] = array($columns, $direction); return $this;
}
... | [
"public",
"function",
"orderBy",
"(",
"$",
"columns",
",",
"$",
"direction",
"=",
"'asc'",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"stringArgumentToArray",
"(",
"$",
"columns",
")",
... | Add an order by statement to the current query
->orderBy('created_at')
->orderBy('modified_at', 'desc')
// multiple order statements
->orderBy(['firstname', 'lastname'], 'desc')
// muliple order statements with diffrent directions
->orderBy(['firstname' => 'asc', 'lastname' => 'desc'])
@param array|string ... | [
"Add",
"an",
"order",
"by",
"statement",
"to",
"the",
"current",
"query"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L269-L296 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.groupBy | public function groupBy($groupKeys)
{
if (is_string($groupKeys))
{
$groupKeys = $this->stringArgumentToArray($groupKeys);
}
foreach ($groupKeys as $groupKey)
{
$this->groups[] = $groupKey;
}
return $this;
} | php | public function groupBy($groupKeys)
{
if (is_string($groupKeys))
{
$groupKeys = $this->stringArgumentToArray($groupKeys);
}
foreach ($groupKeys as $groupKey)
{
$this->groups[] = $groupKey;
}
return $this;
} | [
"public",
"function",
"groupBy",
"(",
"$",
"groupKeys",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"groupKeys",
")",
")",
"{",
"$",
"groupKeys",
"=",
"$",
"this",
"->",
"stringArgumentToArray",
"(",
"$",
"groupKeys",
")",
";",
"}",
"foreach",
"(",
"$"... | Add a group by statement to the current query
->groupBy('category')
->gorupBy(['category', 'price'])
@param array|string $keys
@return self The current query builder. | [
"Add",
"a",
"group",
"by",
"statement",
"to",
"the",
"current",
"query"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L307-L320 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.join | public function join($table, $localKey, $operator = null, $referenceKey = null, $type = 'left')
{
// validate the join type
if (!in_array($type, array('inner', 'left', 'right', 'outer')))
{
throw new Exception('Invalid join type "'.$type.'" given. Available type: inner, left, rig... | php | public function join($table, $localKey, $operator = null, $referenceKey = null, $type = 'left')
{
// validate the join type
if (!in_array($type, array('inner', 'left', 'right', 'outer')))
{
throw new Exception('Invalid join type "'.$type.'" given. Available type: inner, left, rig... | [
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"referenceKey",
"=",
"null",
",",
"$",
"type",
"=",
"'left'",
")",
"{",
"// validate the join type",
"if",
"(",
"!",
"in_array",
"(",
"$... | Add a join statement to the current query
->join('avatars', 'users.id', '=', 'avatars.user_id')
@param array|string $table The table to join. (can contain an alias definition.)
@param string $localKey
@param string $operator The operator (=, !=, <, > etc.)
@param str... | [
"Add",
"a",
"join",
"statement",
"to",
"the",
"current",
"query"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L335-L358 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.leftJoin | public function leftJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'left');
} | php | public function leftJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'left');
} | [
"public",
"function",
"leftJoin",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"referenceKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"... | Left join same as join with special type
@param array|string $table The table to join. (can contain an alias definition.)
@param string $localKey
@param string $operator The operator (=, !=, <, > etc.)
@param string $referenceKey
@return self The c... | [
"Left",
"join",
"same",
"as",
"join",
"with",
"special",
"type"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L370-L373 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.rightJoin | public function rightJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'right');
} | php | public function rightJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'right');
} | [
"public",
"function",
"rightJoin",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"referenceKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
... | Alias of the `join` method with join type right.
@param array|string $table The table to join. (can contain an alias definition.)
@param string $localKey
@param string $operator The operator (=, !=, <, > etc.)
@param string $referenceKey
@return se... | [
"Alias",
"of",
"the",
"join",
"method",
"with",
"join",
"type",
"right",
"."
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L385-L388 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.innerJoin | public function innerJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'inner');
} | php | public function innerJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'inner');
} | [
"public",
"function",
"innerJoin",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"referenceKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
... | Alias of the `join` method with join type inner.
@param array|string $table The table to join. (can contain an alias definition.)
@param string $localKey
@param string $operator The operator (=, !=, <, > etc.)
@param string $referenceKey
@return se... | [
"Alias",
"of",
"the",
"join",
"method",
"with",
"join",
"type",
"inner",
"."
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L400-L403 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.outerJoin | public function outerJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'outer');
} | php | public function outerJoin($table, $localKey, $operator = null, $referenceKey = null)
{
return $this->join($table, $localKey, $operator, $referenceKey, 'outer');
} | [
"public",
"function",
"outerJoin",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"referenceKey",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"localKey",
",",
"$",
... | Alias of the `join` method with join type outer.
@param array|string $table The table to join. (can contain an alias definition.)
@param string $localKey
@param string $operator The operator (=, !=, <, > etc.)
@param string $referenceKey
@return se... | [
"Alias",
"of",
"the",
"join",
"method",
"with",
"join",
"type",
"outer",
"."
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L415-L418 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.forwardKey | public function forwardKey($key = true)
{
if ($key === false) {
$this->forwardKey = false;
} elseif ($key === true) {
$this->forwardKey = \ClanCats::$config->get('database.default_primary_key', 'id');
} else {
$this->forwardKey = $key;
}
r... | php | public function forwardKey($key = true)
{
if ($key === false) {
$this->forwardKey = false;
} elseif ($key === true) {
$this->forwardKey = \ClanCats::$config->get('database.default_primary_key', 'id');
} else {
$this->forwardKey = $key;
}
r... | [
"public",
"function",
"forwardKey",
"(",
"$",
"key",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"forwardKey",
"=",
"false",
";",
"}",
"elseif",
"(",
"$",
"key",
"===",
"true",
")",
"{",
"$",
"this",... | Forward a result value as array key
@param string|bool $key
@return self The current query builder. | [
"Forward",
"a",
"result",
"value",
"as",
"array",
"key"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L426-L437 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.groupResults | public function groupResults($key)
{
if ($key === false) {
$this->groupResults = false;
} else {
$this->groupResults = $key;
}
return $this;
} | php | public function groupResults($key)
{
if ($key === false) {
$this->groupResults = false;
} else {
$this->groupResults = $key;
}
return $this;
} | [
"public",
"function",
"groupResults",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"groupResults",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"groupResults",
"=",
"$",
"key",
";",
"}",
... | Group results by a column
example:
array( 'name' => 'John', 'age' => 18, ),
array( 'name' => 'Jeff', 'age' => 32, ),
array( 'name' => 'Jenny', 'age' => 18, ),
To:
'18' => array(
array( 'name' => 'John', 'age' => 18 ),
array( 'name' => 'Jenny', 'age' => 18 ),
),
'32' => array(
array( 'name' => 'Jeff', 'age' => 32 ),
),... | [
"Group",
"results",
"by",
"a",
"column"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L458-L467 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.get | public function get()
{
// run the callbacks to retirve the results
$results = $this->executeResultFetcher();
// we always exprect an array here!
if (!is_array($results) || empty($results))
{
$results = array();
}
// In case we should forward a ... | php | public function get()
{
// run the callbacks to retirve the results
$results = $this->executeResultFetcher();
// we always exprect an array here!
if (!is_array($results) || empty($results))
{
$results = array();
}
// In case we should forward a ... | [
"public",
"function",
"get",
"(",
")",
"{",
"// run the callbacks to retirve the results",
"$",
"results",
"=",
"$",
"this",
"->",
"executeResultFetcher",
"(",
")",
";",
"// we always exprect an array here!",
"if",
"(",
"!",
"is_array",
"(",
"$",
"results",
")",
"... | Executes the `executeResultFetcher` callback and handles the results.
@return mixed The fetched result. | [
"Executes",
"the",
"executeResultFetcher",
"callback",
"and",
"handles",
"the",
"results",
"."
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L474-L532 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.column | public function column($column)
{
$result = $this->fields($column)->one();
// only return something if something is found
if (is_array($result))
{
return reset($result);
}
} | php | public function column($column)
{
$result = $this->fields($column)->one();
// only return something if something is found
if (is_array($result))
{
return reset($result);
}
} | [
"public",
"function",
"column",
"(",
"$",
"column",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"fields",
"(",
"$",
"column",
")",
"->",
"one",
"(",
")",
";",
"// only return something if something is found",
"if",
"(",
"is_array",
"(",
"$",
"result",... | Just get a single value from the result
@param string $column The name of the column.
@return mixed The columns value | [
"Just",
"get",
"a",
"single",
"value",
"from",
"the",
"result"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L601-L610 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.count | public function count($field = null)
{
// when no field is given we use *
if (is_null($field))
{
$field = new Expression('*');
}
// return the column
return (int) $this->column(new Func('count', $field));
} | php | public function count($field = null)
{
// when no field is given we use *
if (is_null($field))
{
$field = new Expression('*');
}
// return the column
return (int) $this->column(new Func('count', $field));
} | [
"public",
"function",
"count",
"(",
"$",
"field",
"=",
"null",
")",
"{",
"// when no field is given we use *",
"if",
"(",
"is_null",
"(",
"$",
"field",
")",
")",
"{",
"$",
"field",
"=",
"new",
"Expression",
"(",
"'*'",
")",
";",
"}",
"// return the column"... | Just return the number of results
@param string $field
@return int | [
"Just",
"return",
"the",
"number",
"of",
"results"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L618-L628 |
ClanCats/Hydrahon | src/Query/Sql/Select.php | Select.exists | public function exists()
{
$existsQuery = new Exists($this);
// set the current select for the exists query
$existsQuery->setSelect($this);
// run the callbacks to retirve the results
$result = $existsQuery->executeResultFetcher();
if (isset($result[0]['exists']))
... | php | public function exists()
{
$existsQuery = new Exists($this);
// set the current select for the exists query
$existsQuery->setSelect($this);
// run the callbacks to retirve the results
$result = $existsQuery->executeResultFetcher();
if (isset($result[0]['exists']))
... | [
"public",
"function",
"exists",
"(",
")",
"{",
"$",
"existsQuery",
"=",
"new",
"Exists",
"(",
"$",
"this",
")",
";",
"// set the current select for the exists query",
"$",
"existsQuery",
"->",
"setSelect",
"(",
"$",
"this",
")",
";",
"// run the callbacks to retir... | Do any results of this query exist?
@return bool | [
"Do",
"any",
"results",
"of",
"this",
"query",
"exist?"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/Select.php#L679-L695 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translate | public function translate(BaseQuery $query)
{
// retrive the query attributes
$this->attributes = $query->attributes();
// handle SQL SELECT queries
if ($query instanceof Select)
{
$queryString = $this->translateSelect();
}
// handle SQL INSERT qu... | php | public function translate(BaseQuery $query)
{
// retrive the query attributes
$this->attributes = $query->attributes();
// handle SQL SELECT queries
if ($query instanceof Select)
{
$queryString = $this->translateSelect();
}
// handle SQL INSERT qu... | [
"public",
"function",
"translate",
"(",
"BaseQuery",
"$",
"query",
")",
"{",
"// retrive the query attributes",
"$",
"this",
"->",
"attributes",
"=",
"$",
"query",
"->",
"attributes",
"(",
")",
";",
"// handle SQL SELECT queries",
"if",
"(",
"$",
"query",
"insta... | Translate the given query object and return the results as
argument array
@param ClanCats\Hydrahon\BaseQuery $query
@return array | [
"Translate",
"the",
"given",
"query",
"object",
"and",
"return",
"the",
"results",
"as",
"argument",
"array"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L56-L110 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.escape | protected function escape($string)
{
if (is_object($string))
{
if ($this->isExpression($string))
{
return $string->value();
}
elseif ($this->isFunction($string))
{
return $this->escapeFunction($string);
... | php | protected function escape($string)
{
if (is_object($string))
{
if ($this->isExpression($string))
{
return $string->value();
}
elseif ($this->isFunction($string))
{
return $this->escapeFunction($string);
... | [
"protected",
"function",
"escape",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"string",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isExpression",
"(",
"$",
"string",
")",
")",
"{",
"return",
"$",
"string",
"->",
"value",
"("... | Escape / wrap an string for sql
@param string|object $string | [
"Escape",
"/",
"wrap",
"an",
"string",
"for",
"sql"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L200-L240 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.escapeFunction | protected function escapeFunction($function)
{
$buffer = $function->name() . '(';
$arguments = $function->arguments();
foreach($arguments as &$argument)
{
$argument = $this->escape($argument);
}
return $buffer . implode(', ', $arguments) . ')';
} | php | protected function escapeFunction($function)
{
$buffer = $function->name() . '(';
$arguments = $function->arguments();
foreach($arguments as &$argument)
{
$argument = $this->escape($argument);
}
return $buffer . implode(', ', $arguments) . ')';
} | [
"protected",
"function",
"escapeFunction",
"(",
"$",
"function",
")",
"{",
"$",
"buffer",
"=",
"$",
"function",
"->",
"name",
"(",
")",
".",
"'('",
";",
"$",
"arguments",
"=",
"$",
"function",
"->",
"arguments",
"(",
")",
";",
"foreach",
"(",
"$",
"a... | Escapes an sql function object
@param Func $function
@return string | [
"Escapes",
"an",
"sql",
"function",
"object"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L248-L260 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.escapeTable | protected function escapeTable($allowAlias = true)
{
$table = $this->attr('table');
$database = $this->attr('database');
$buffer = '';
if (!is_null($database))
{
$buffer .= $this->escape($database) . '.';
}
// when the table is an array we have a... | php | protected function escapeTable($allowAlias = true)
{
$table = $this->attr('table');
$database = $this->attr('database');
$buffer = '';
if (!is_null($database))
{
$buffer .= $this->escape($database) . '.';
}
// when the table is an array we have a... | [
"protected",
"function",
"escapeTable",
"(",
"$",
"allowAlias",
"=",
"true",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"attr",
"(",
"'table'",
")",
";",
"$",
"database",
"=",
"$",
"this",
"->",
"attr",
"(",
"'database'",
")",
";",
"$",
"buffer"... | get and escape the table name
@return string | [
"get",
"and",
"escape",
"the",
"table",
"name"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L294-L338 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateInsert | protected function translateInsert($key)
{
$build = ($this->attr('ignore') ? $key . ' ignore' : $key);
$build .= ' into ' . $this->escapeTable(false) . ' ';
if (!$valueCollection = $this->attr('values'))
{
throw new Exception('Cannot build insert query without values.')... | php | protected function translateInsert($key)
{
$build = ($this->attr('ignore') ? $key . ' ignore' : $key);
$build .= ' into ' . $this->escapeTable(false) . ' ';
if (!$valueCollection = $this->attr('values'))
{
throw new Exception('Cannot build insert query without values.')... | [
"protected",
"function",
"translateInsert",
"(",
"$",
"key",
")",
"{",
"$",
"build",
"=",
"(",
"$",
"this",
"->",
"attr",
"(",
"'ignore'",
")",
"?",
"$",
"key",
".",
"' ignore'",
":",
"$",
"key",
")",
";",
"$",
"build",
".=",
"' into '",
".",
"$",
... | Translate the current query to an SQL insert statement
@return string | [
"Translate",
"the",
"current",
"query",
"to",
"an",
"SQL",
"insert",
"statement"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L365-L389 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateUpdate | protected function translateUpdate()
{
$build = 'update ' . $this->escapeTable() . ' set ';
// add the array values.
foreach ($this->attr('values') as $key => $value) {
$build .= $this->escape($key) . ' = ' . $this->param($value) . ', ';
}
// cut away the last c... | php | protected function translateUpdate()
{
$build = 'update ' . $this->escapeTable() . ' set ';
// add the array values.
foreach ($this->attr('values') as $key => $value) {
$build .= $this->escape($key) . ' = ' . $this->param($value) . ', ';
}
// cut away the last c... | [
"protected",
"function",
"translateUpdate",
"(",
")",
"{",
"$",
"build",
"=",
"'update '",
".",
"$",
"this",
"->",
"escapeTable",
"(",
")",
".",
"' set '",
";",
"// add the array values.",
"foreach",
"(",
"$",
"this",
"->",
"attr",
"(",
"'values'",
")",
"a... | Translate the current query to an SQL update statement
@return string | [
"Translate",
"the",
"current",
"query",
"to",
"an",
"SQL",
"update",
"statement"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L396-L421 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateDelete | protected function translateDelete()
{
$build = 'delete from ' . $this->escapeTable(false);
// build the where statements
if ($wheres = $this->attr('wheres'))
{
$build .= $this->translateWhere($wheres);
}
// build offset and limit
if ($this->... | php | protected function translateDelete()
{
$build = 'delete from ' . $this->escapeTable(false);
// build the where statements
if ($wheres = $this->attr('wheres'))
{
$build .= $this->translateWhere($wheres);
}
// build offset and limit
if ($this->... | [
"protected",
"function",
"translateDelete",
"(",
")",
"{",
"$",
"build",
"=",
"'delete from '",
".",
"$",
"this",
"->",
"escapeTable",
"(",
"false",
")",
";",
"// build the where statements",
"if",
"(",
"$",
"wheres",
"=",
"$",
"this",
"->",
"attr",
"(",
"... | Translate the current query to an SQL delete statement
@return string | [
"Translate",
"the",
"current",
"query",
"to",
"an",
"SQL",
"delete",
"statement"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L428-L445 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateSelect | protected function translateSelect()
{
// normal or distinct selection?
$build = ($this->attr('distinct') ? 'select distinct' : 'select') . ' ';
// build the selected fields
$fields = $this->attr('fields');
if (!empty($fields))
{
foreach ($fields as $k... | php | protected function translateSelect()
{
// normal or distinct selection?
$build = ($this->attr('distinct') ? 'select distinct' : 'select') . ' ';
// build the selected fields
$fields = $this->attr('fields');
if (!empty($fields))
{
foreach ($fields as $k... | [
"protected",
"function",
"translateSelect",
"(",
")",
"{",
"// normal or distinct selection?",
"$",
"build",
"=",
"(",
"$",
"this",
"->",
"attr",
"(",
"'distinct'",
")",
"?",
"'select distinct'",
":",
"'select'",
")",
".",
"' '",
";",
"// build the selected fields... | Translate the current query to an SQL select statement
@return string | [
"Translate",
"the",
"current",
"query",
"to",
"an",
"SQL",
"select",
"statement"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L452-L519 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateWhere | protected function translateWhere($wheres)
{
$build = '';
foreach ($wheres as $where)
{
// to make nested wheres possible you can pass an closure
// wich will create a new query where you can add your nested wheres
if (!isset($where[2]) && isset( $where[... | php | protected function translateWhere($wheres)
{
$build = '';
foreach ($wheres as $where)
{
// to make nested wheres possible you can pass an closure
// wich will create a new query where you can add your nested wheres
if (!isset($where[2]) && isset( $where[... | [
"protected",
"function",
"translateWhere",
"(",
"$",
"wheres",
")",
"{",
"$",
"build",
"=",
"''",
";",
"foreach",
"(",
"$",
"wheres",
"as",
"$",
"where",
")",
"{",
"// to make nested wheres possible you can pass an closure",
"// wich will create a new query where you ca... | Translate the where statements into sql
@param array $wheres
@return string | [
"Translate",
"the",
"where",
"statements",
"into",
"sql"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L527-L562 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateJoins | protected function translateJoins()
{
$build = '';
foreach ($this->attr('joins') as $join)
{
// get the type and table
$type = $join[0]; $table = $join[1];
// table
if (is_array($table))
{
reset($table);
... | php | protected function translateJoins()
{
$build = '';
foreach ($this->attr('joins') as $join)
{
// get the type and table
$type = $join[0]; $table = $join[1];
// table
if (is_array($table))
{
reset($table);
... | [
"protected",
"function",
"translateJoins",
"(",
")",
"{",
"$",
"build",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"attr",
"(",
"'joins'",
")",
"as",
"$",
"join",
")",
"{",
"// get the type and table",
"$",
"type",
"=",
"$",
"join",
"[",
"0",
... | Build the sql join statements
@return string | [
"Build",
"the",
"sql",
"join",
"statements"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L569-L640 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateOrderBy | protected function translateOrderBy()
{
$build = " order by ";
foreach ($this->attr('orders') as $column => $direction)
{
// in case a raw value is given we had to
// put the column / raw value an direction inside another
// array because we cannot make... | php | protected function translateOrderBy()
{
$build = " order by ";
foreach ($this->attr('orders') as $column => $direction)
{
// in case a raw value is given we had to
// put the column / raw value an direction inside another
// array because we cannot make... | [
"protected",
"function",
"translateOrderBy",
"(",
")",
"{",
"$",
"build",
"=",
"\" order by \"",
";",
"foreach",
"(",
"$",
"this",
"->",
"attr",
"(",
"'orders'",
")",
"as",
"$",
"column",
"=>",
"$",
"direction",
")",
"{",
"// in case a raw value is given we ha... | Build the order by statement
@return string | [
"Build",
"the",
"order",
"by",
"statement"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L647-L668 |
ClanCats/Hydrahon | src/Translator/Mysql.php | Mysql.translateExists | protected function translateExists()
{
$translator = new static;
// translate the subselect
list($subQuery, $subQueryParameters) = $translator->translate($this->attr('select'));
// merge the parameters
foreach($subQueryParameters as $parameter)
{
$this->... | php | protected function translateExists()
{
$translator = new static;
// translate the subselect
list($subQuery, $subQueryParameters) = $translator->translate($this->attr('select'));
// merge the parameters
foreach($subQueryParameters as $parameter)
{
$this->... | [
"protected",
"function",
"translateExists",
"(",
")",
"{",
"$",
"translator",
"=",
"new",
"static",
";",
"// translate the subselect",
"list",
"(",
"$",
"subQuery",
",",
"$",
"subQueryParameters",
")",
"=",
"$",
"translator",
"->",
"translate",
"(",
"$",
"this... | Translate the exists querry
@return string | [
"Translate",
"the",
"exists",
"querry"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Translator/Mysql.php#L727-L741 |
ClanCats/Hydrahon | src/Query/Sql/SelectJoin.php | SelectJoin.on | public function on($localKey, $operator, $referenceKey, $type = 'and')
{
$this->ons[] = array($type, $localKey, $operator, $referenceKey); return $this;
} | php | public function on($localKey, $operator, $referenceKey, $type = 'and')
{
$this->ons[] = array($type, $localKey, $operator, $referenceKey); return $this;
} | [
"public",
"function",
"on",
"(",
"$",
"localKey",
",",
"$",
"operator",
",",
"$",
"referenceKey",
",",
"$",
"type",
"=",
"'and'",
")",
"{",
"$",
"this",
"->",
"ons",
"[",
"]",
"=",
"array",
"(",
"$",
"type",
",",
"$",
"localKey",
",",
"$",
"opera... | Add an on condition to the join object
@param string $localKey
@param string $operator
@param string $referenceKey
@return self | [
"Add",
"an",
"on",
"condition",
"to",
"the",
"join",
"object"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/SelectJoin.php#L39-L42 |
ClanCats/Hydrahon | src/Query/Sql/SelectJoin.php | SelectJoin.orOn | public function orOn($localKey, $operator, $referenceKey)
{
$this->on($localKey, $operator, $referenceKey, 'or'); return $this;
} | php | public function orOn($localKey, $operator, $referenceKey)
{
$this->on($localKey, $operator, $referenceKey, 'or'); return $this;
} | [
"public",
"function",
"orOn",
"(",
"$",
"localKey",
",",
"$",
"operator",
",",
"$",
"referenceKey",
")",
"{",
"$",
"this",
"->",
"on",
"(",
"$",
"localKey",
",",
"$",
"operator",
",",
"$",
"referenceKey",
",",
"'or'",
")",
";",
"return",
"$",
"this",... | Add an or on condition to the join object
@param string $localKey
@param string $operator
@param string $referenceKey
@return self | [
"Add",
"an",
"or",
"on",
"condition",
"to",
"the",
"join",
"object"
] | train | https://github.com/ClanCats/Hydrahon/blob/e2790279bfdb1faa9155504267db1f57d4dabe00/src/Query/Sql/SelectJoin.php#L53-L56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.