repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
andersao/l5-repository | src/Prettus/Repository/Eloquent/BaseRepository.php | BaseRepository.applyConditions | protected function applyConditions(array $where)
{
foreach ($where as $field => $value) {
if (is_array($value)) {
list($field, $condition, $val) = $value;
$this->model = $this->model->where($field, $condition, $val);
} else {
$this->mod... | php | protected function applyConditions(array $where)
{
foreach ($where as $field => $value) {
if (is_array($value)) {
list($field, $condition, $val) = $value;
$this->model = $this->model->where($field, $condition, $val);
} else {
$this->mod... | [
"protected",
"function",
"applyConditions",
"(",
"array",
"$",
"where",
")",
"{",
"foreach",
"(",
"$",
"where",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"list",
"(",
"$",
"field",
",... | Applies the given where conditions to the model.
@param array $where
@return void | [
"Applies",
"the",
"given",
"where",
"conditions",
"to",
"the",
"model",
"."
] | f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4 | https://github.com/andersao/l5-repository/blob/f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4/src/Prettus/Repository/Eloquent/BaseRepository.php#L956-L966 | train |
andersao/l5-repository | src/Prettus/Repository/Eloquent/BaseRepository.php | BaseRepository.parserResult | public function parserResult($result)
{
if ($this->presenter instanceof PresenterInterface) {
if ($result instanceof Collection || $result instanceof LengthAwarePaginator) {
$result->each(function ($model) {
if ($model instanceof Presentable) {
... | php | public function parserResult($result)
{
if ($this->presenter instanceof PresenterInterface) {
if ($result instanceof Collection || $result instanceof LengthAwarePaginator) {
$result->each(function ($model) {
if ($model instanceof Presentable) {
... | [
"public",
"function",
"parserResult",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"presenter",
"instanceof",
"PresenterInterface",
")",
"{",
"if",
"(",
"$",
"result",
"instanceof",
"Collection",
"||",
"$",
"result",
"instanceof",
"LengthAwarePa... | Wrapper result data
@param mixed $result
@return mixed | [
"Wrapper",
"result",
"data"
] | f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4 | https://github.com/andersao/l5-repository/blob/f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4/src/Prettus/Repository/Eloquent/BaseRepository.php#L989-L1010 | train |
andersao/l5-repository | src/Prettus/Repository/Generators/Generator.php | Generator.getName | public function getName()
{
$name = $this->name;
if (str_contains($this->name, '\\')) {
$name = str_replace('\\', '/', $this->name);
}
if (str_contains($this->name, '/')) {
$name = str_replace('/', '/', $this->name);
}
return Str::studly(str_r... | php | public function getName()
{
$name = $this->name;
if (str_contains($this->name, '\\')) {
$name = str_replace('\\', '/', $this->name);
}
if (str_contains($this->name, '/')) {
$name = str_replace('/', '/', $this->name);
}
return Str::studly(str_r... | [
"public",
"function",
"getName",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
";",
"if",
"(",
"str_contains",
"(",
"$",
"this",
"->",
"name",
",",
"'\\\\'",
")",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
... | Get name input.
@return string | [
"Get",
"name",
"input",
"."
] | f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4 | https://github.com/andersao/l5-repository/blob/f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4/src/Prettus/Repository/Generators/Generator.php#L135-L146 | train |
andersao/l5-repository | src/Prettus/Repository/Generators/Generator.php | Generator.getConfigGeneratorClassPath | public function getConfigGeneratorClassPath($class, $directoryPath = false)
{
switch ($class) {
case ('models' === $class):
$path = config('repository.generator.paths.models', 'Entities');
break;
case ('repositories' === $class):
$path ... | php | public function getConfigGeneratorClassPath($class, $directoryPath = false)
{
switch ($class) {
case ('models' === $class):
$path = config('repository.generator.paths.models', 'Entities');
break;
case ('repositories' === $class):
$path ... | [
"public",
"function",
"getConfigGeneratorClassPath",
"(",
"$",
"class",
",",
"$",
"directoryPath",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"class",
")",
"{",
"case",
"(",
"'models'",
"===",
"$",
"class",
")",
":",
"$",
"path",
"=",
"config",
"(",
"... | Get class-specific output paths.
@param $class
@return string | [
"Get",
"class",
"-",
"specific",
"output",
"paths",
"."
] | f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4 | https://github.com/andersao/l5-repository/blob/f2008d8ff8af50036d2d155c0b5dbb07cbcd0ee4/src/Prettus/Repository/Generators/Generator.php#L200-L242 | train |
spatie/laravel-backup | src/Tasks/Backup/BackupJob.php | BackupJob.dumpDatabases | protected function dumpDatabases(): array
{
return $this->dbDumpers->map(function (DbDumper $dbDumper, $key) {
consoleOutput()->info("Dumping database {$dbDumper->getDbName()}...");
$dbType = mb_strtolower(basename(str_replace('\\', '/', get_class($dbDumper))));
$dbName... | php | protected function dumpDatabases(): array
{
return $this->dbDumpers->map(function (DbDumper $dbDumper, $key) {
consoleOutput()->info("Dumping database {$dbDumper->getDbName()}...");
$dbType = mb_strtolower(basename(str_replace('\\', '/', get_class($dbDumper))));
$dbName... | [
"protected",
"function",
"dumpDatabases",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"dbDumpers",
"->",
"map",
"(",
"function",
"(",
"DbDumper",
"$",
"dbDumper",
",",
"$",
"key",
")",
"{",
"consoleOutput",
"(",
")",
"->",
"info",
"(",
"\... | Dumps the databases to the given directory.
Returns an array with paths to the dump files.
@return array | [
"Dumps",
"the",
"databases",
"to",
"the",
"given",
"directory",
".",
"Returns",
"an",
"array",
"with",
"paths",
"to",
"the",
"dump",
"files",
"."
] | d706e64c2500fda276d421551c140693156c0195 | https://github.com/spatie/laravel-backup/blob/d706e64c2500fda276d421551c140693156c0195/src/Tasks/Backup/BackupJob.php#L224-L254 | train |
spatie/laravel-backup | src/Tasks/Backup/FileSelection.php | FileSelection.excludeFilesFrom | public function excludeFilesFrom($excludeFilesAndDirectories): self
{
$this->excludeFilesAndDirectories = $this->excludeFilesAndDirectories->merge($this->sanitize($excludeFilesAndDirectories));
return $this;
} | php | public function excludeFilesFrom($excludeFilesAndDirectories): self
{
$this->excludeFilesAndDirectories = $this->excludeFilesAndDirectories->merge($this->sanitize($excludeFilesAndDirectories));
return $this;
} | [
"public",
"function",
"excludeFilesFrom",
"(",
"$",
"excludeFilesAndDirectories",
")",
":",
"self",
"{",
"$",
"this",
"->",
"excludeFilesAndDirectories",
"=",
"$",
"this",
"->",
"excludeFilesAndDirectories",
"->",
"merge",
"(",
"$",
"this",
"->",
"sanitize",
"(",
... | Do not included the given files and directories.
@param array|string $excludeFilesAndDirectories
@return \Spatie\Backup\Tasks\Backup\FileSelection | [
"Do",
"not",
"included",
"the",
"given",
"files",
"and",
"directories",
"."
] | d706e64c2500fda276d421551c140693156c0195 | https://github.com/spatie/laravel-backup/blob/d706e64c2500fda276d421551c140693156c0195/src/Tasks/Backup/FileSelection.php#L47-L52 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_bits | public function write_bits($bits)
{
$value = 0;
foreach ($bits as $n => $bit) {
$bit = $bit ? 1 : 0;
$value |= ($bit << $n);
}
$this->out .= chr($value);
return $this;
} | php | public function write_bits($bits)
{
$value = 0;
foreach ($bits as $n => $bit) {
$bit = $bit ? 1 : 0;
$value |= ($bit << $n);
}
$this->out .= chr($value);
return $this;
} | [
"public",
"function",
"write_bits",
"(",
"$",
"bits",
")",
"{",
"$",
"value",
"=",
"0",
";",
"foreach",
"(",
"$",
"bits",
"as",
"$",
"n",
"=>",
"$",
"bit",
")",
"{",
"$",
"bit",
"=",
"$",
"bit",
"?",
"1",
":",
"0",
";",
"$",
"value",
"|=",
... | Write multiple bits as an octet
@param bool[] $bits
@return $this | [
"Write",
"multiple",
"bits",
"as",
"an",
"octet"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L143-L155 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_octet | public function write_octet($n)
{
if ($n < 0 || $n > 255) {
throw new AMQPInvalidArgumentException('Octet out of range: ' . $n);
}
$this->out .= chr($n);
return $this;
} | php | public function write_octet($n)
{
if ($n < 0 || $n > 255) {
throw new AMQPInvalidArgumentException('Octet out of range: ' . $n);
}
$this->out .= chr($n);
return $this;
} | [
"public",
"function",
"write_octet",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"<",
"0",
"||",
"$",
"n",
">",
"255",
")",
"{",
"throw",
"new",
"AMQPInvalidArgumentException",
"(",
"'Octet out of range: '",
".",
"$",
"n",
")",
";",
"}",
"$",
"this... | Write an integer as an unsigned 8-bit value
@param int $n
@return $this
@throws \PhpAmqpLib\Exception\AMQPInvalidArgumentException | [
"Write",
"an",
"integer",
"as",
"an",
"unsigned",
"8",
"-",
"bit",
"value"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L164-L173 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_short | public function write_short($n)
{
if ($n < 0 || $n > 65535) {
throw new AMQPInvalidArgumentException('Short out of range: ' . $n);
}
$this->out .= pack('n', $n);
return $this;
} | php | public function write_short($n)
{
if ($n < 0 || $n > 65535) {
throw new AMQPInvalidArgumentException('Short out of range: ' . $n);
}
$this->out .= pack('n', $n);
return $this;
} | [
"public",
"function",
"write_short",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"<",
"0",
"||",
"$",
"n",
">",
"65535",
")",
"{",
"throw",
"new",
"AMQPInvalidArgumentException",
"(",
"'Short out of range: '",
".",
"$",
"n",
")",
";",
"}",
"$",
"th... | Write an integer as an unsigned 16-bit value
@param int $n
@return $this
@throws \PhpAmqpLib\Exception\AMQPInvalidArgumentException | [
"Write",
"an",
"integer",
"as",
"an",
"unsigned",
"16",
"-",
"bit",
"value"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L197-L206 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_long | public function write_long($n)
{
if (($n < 0) || ($n > 4294967295)) {
throw new AMQPInvalidArgumentException('Long out of range: ' . $n);
}
//Numeric strings >PHP_INT_MAX on 32bit are casted to PHP_INT_MAX, damn PHP
if (empty($this->is64bits) && is_string($n)) {
... | php | public function write_long($n)
{
if (($n < 0) || ($n > 4294967295)) {
throw new AMQPInvalidArgumentException('Long out of range: ' . $n);
}
//Numeric strings >PHP_INT_MAX on 32bit are casted to PHP_INT_MAX, damn PHP
if (empty($this->is64bits) && is_string($n)) {
... | [
"public",
"function",
"write_long",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"(",
"$",
"n",
"<",
"0",
")",
"||",
"(",
"$",
"n",
">",
"4294967295",
")",
")",
"{",
"throw",
"new",
"AMQPInvalidArgumentException",
"(",
"'Long out of range: '",
".",
"$",
"n",
... | Write an integer as an unsigned 32-bit value
@param int $n
@return $this | [
"Write",
"an",
"integer",
"as",
"an",
"unsigned",
"32",
"-",
"bit",
"value"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L229-L242 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_longlong | public function write_longlong($n)
{
if ($n < 0) {
throw new AMQPInvalidArgumentException('Longlong out of range: ' . $n);
}
// if PHP_INT_MAX is big enough for that
// direct $n<=PHP_INT_MAX check is unreliable on 64bit (values close to max) due to limited float precisi... | php | public function write_longlong($n)
{
if ($n < 0) {
throw new AMQPInvalidArgumentException('Longlong out of range: ' . $n);
}
// if PHP_INT_MAX is big enough for that
// direct $n<=PHP_INT_MAX check is unreliable on 64bit (values close to max) due to limited float precisi... | [
"public",
"function",
"write_longlong",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"<",
"0",
")",
"{",
"throw",
"new",
"AMQPInvalidArgumentException",
"(",
"'Longlong out of range: '",
".",
"$",
"n",
")",
";",
"}",
"// if PHP_INT_MAX is big enough for that",
... | Write an integer as an unsigned 64-bit value
@param int $n
@return $this | [
"Write",
"an",
"integer",
"as",
"an",
"unsigned",
"64",
"-",
"bit",
"value"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L266-L292 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPWriter.php | AMQPWriter.write_shortstr | public function write_shortstr($s)
{
$len = mb_strlen($s, 'ASCII');
if ($len > 255) {
throw new AMQPInvalidArgumentException('String too long');
}
$this->write_octet($len);
$this->out .= $s;
return $this;
} | php | public function write_shortstr($s)
{
$len = mb_strlen($s, 'ASCII');
if ($len > 255) {
throw new AMQPInvalidArgumentException('String too long');
}
$this->write_octet($len);
$this->out .= $s;
return $this;
} | [
"public",
"function",
"write_shortstr",
"(",
"$",
"s",
")",
"{",
"$",
"len",
"=",
"mb_strlen",
"(",
"$",
"s",
",",
"'ASCII'",
")",
";",
"if",
"(",
"$",
"len",
">",
"255",
")",
"{",
"throw",
"new",
"AMQPInvalidArgumentException",
"(",
"'String too long'",... | Write a string up to 255 bytes long after encoding.
Assume UTF-8 encoding
@param string $s
@return $this
@throws \PhpAmqpLib\Exception\AMQPInvalidArgumentException | [
"Write",
"a",
"string",
"up",
"to",
"255",
"bytes",
"long",
"after",
"encoding",
".",
"Assume",
"UTF",
"-",
"8",
"encoding"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPWriter.php#L344-L355 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AbstractChannel.php | AbstractChannel.prepare_method_frame | protected function prepare_method_frame($method_sig, $args = '', $pkt = null)
{
return $this->connection->prepare_channel_method_frame($this->channel_id, $method_sig, $args, $pkt);
} | php | protected function prepare_method_frame($method_sig, $args = '', $pkt = null)
{
return $this->connection->prepare_channel_method_frame($this->channel_id, $method_sig, $args, $pkt);
} | [
"protected",
"function",
"prepare_method_frame",
"(",
"$",
"method_sig",
",",
"$",
"args",
"=",
"''",
",",
"$",
"pkt",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"prepare_channel_method_frame",
"(",
"$",
"this",
"->",
"channel_id... | This is here for performance reasons to batch calls to fwrite from basic.publish
@param array $method_sig
@param \PhpAmqpLib\Wire\AMQPWriter|string $args
@param \PhpAmqpLib\Wire\AMQPWriter $pkt
@return \PhpAmqpLib\Wire\AMQPWriter | [
"This",
"is",
"here",
"for",
"performance",
"reasons",
"to",
"batch",
"calls",
"to",
"fwrite",
"from",
"basic",
".",
"publish"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AbstractChannel.php#L257-L260 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AbstractChannel.php | AbstractChannel.wait | public function wait($allowed_methods = null, $non_blocking = false, $timeout = 0)
{
$this->debug->debug_allowed_methods($allowed_methods);
$deferred = $this->process_deferred_methods($allowed_methods);
if ($deferred['dispatch'] === true) {
return $this->dispatch_deferred_method... | php | public function wait($allowed_methods = null, $non_blocking = false, $timeout = 0)
{
$this->debug->debug_allowed_methods($allowed_methods);
$deferred = $this->process_deferred_methods($allowed_methods);
if ($deferred['dispatch'] === true) {
return $this->dispatch_deferred_method... | [
"public",
"function",
"wait",
"(",
"$",
"allowed_methods",
"=",
"null",
",",
"$",
"non_blocking",
"=",
"false",
",",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"debug",
"->",
"debug_allowed_methods",
"(",
"$",
"allowed_methods",
")",
";",
"$"... | Wait for some expected AMQP methods and dispatch to them.
Unexpected methods are queued up for later calls to this PHP
method.
@param array $allowed_methods
@param bool $non_blocking
@param int|float|null $timeout
@throws \PhpAmqpLib\Exception\AMQPOutOfBoundsException
@throws \PhpAmqpLib\Exception\AMQPRuntimeException... | [
"Wait",
"for",
"some",
"expected",
"AMQP",
"methods",
"and",
"dispatch",
"to",
"them",
".",
"Unexpected",
"methods",
"are",
"queued",
"up",
"for",
"later",
"calls",
"to",
"this",
"PHP",
"method",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AbstractChannel.php#L334-L384 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/GenericContent.php | GenericContent.has | public function has($name)
{
return isset($this->properties[$name]) || isset($this->delivery_info[$name]);
} | php | public function has($name)
{
return isset($this->properties[$name]) || isset($this->delivery_info[$name]);
} | [
"public",
"function",
"has",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"properties",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"delivery_info",
"[",
"$",
"name",
"]",
")",
";",
"}"
] | Check whether a property exists in the 'properties' dictionary
or if present - in the 'delivery_info' dictionary.
@param string $name
@return bool | [
"Check",
"whether",
"a",
"property",
"exists",
"in",
"the",
"properties",
"dictionary",
"or",
"if",
"present",
"-",
"in",
"the",
"delivery_info",
"dictionary",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/GenericContent.php#L51-L54 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/GenericContent.php | GenericContent.get | public function get($name)
{
if (isset($this->properties[$name])) {
return $this->properties[$name];
}
if (isset($this->delivery_info[$name])) {
return $this->delivery_info[$name];
}
throw new \OutOfBoundsException(sprintf(
'No "%s" prope... | php | public function get($name)
{
if (isset($this->properties[$name])) {
return $this->properties[$name];
}
if (isset($this->delivery_info[$name])) {
return $this->delivery_info[$name];
}
throw new \OutOfBoundsException(sprintf(
'No "%s" prope... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"properties",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"properties",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"(",
"iss... | Look for additional properties in the 'properties' dictionary,
and if present - the 'delivery_info' dictionary.
@param string $name
@throws \OutOfBoundsException
@return mixed|AMQPChannel | [
"Look",
"for",
"additional",
"properties",
"in",
"the",
"properties",
"dictionary",
"and",
"if",
"present",
"-",
"the",
"delivery_info",
"dictionary",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/GenericContent.php#L64-L78 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/IO/AbstractIO.php | AbstractIO.write_heartbeat | protected function write_heartbeat()
{
$pkt = new AMQPWriter();
$pkt->write_octet(8);
$pkt->write_short(0);
$pkt->write_long(0);
$pkt->write_octet(0xCE);
$this->write($pkt->getvalue());
} | php | protected function write_heartbeat()
{
$pkt = new AMQPWriter();
$pkt->write_octet(8);
$pkt->write_short(0);
$pkt->write_long(0);
$pkt->write_octet(0xCE);
$this->write($pkt->getvalue());
} | [
"protected",
"function",
"write_heartbeat",
"(",
")",
"{",
"$",
"pkt",
"=",
"new",
"AMQPWriter",
"(",
")",
";",
"$",
"pkt",
"->",
"write_octet",
"(",
"8",
")",
";",
"$",
"pkt",
"->",
"write_short",
"(",
"0",
")",
";",
"$",
"pkt",
"->",
"write_long",
... | Sends a heartbeat message | [
"Sends",
"a",
"heartbeat",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/IO/AbstractIO.php#L173-L181 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/IO/AbstractIO.php | AbstractIO.cleanup_error_handler | protected function cleanup_error_handler()
{
restore_error_handler();
if ($this->last_error !== null) {
throw new \ErrorException(
$this->last_error['errstr'],
0,
$this->last_error['errno'],
$this->last_error['errfile'],
... | php | protected function cleanup_error_handler()
{
restore_error_handler();
if ($this->last_error !== null) {
throw new \ErrorException(
$this->last_error['errstr'],
0,
$this->last_error['errno'],
$this->last_error['errfile'],
... | [
"protected",
"function",
"cleanup_error_handler",
"(",
")",
"{",
"restore_error_handler",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"last_error",
"!==",
"null",
")",
"{",
"throw",
"new",
"\\",
"ErrorException",
"(",
"$",
"this",
"->",
"last_error",
"[",
... | throws an ErrorException if an error was handled
@throws \ErrorException | [
"throws",
"an",
"ErrorException",
"if",
"an",
"error",
"was",
"handled"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/IO/AbstractIO.php#L196-L209 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/IO/AbstractIO.php | AbstractIO.error_handler | public function error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
{
// throwing an exception in an error handler will halt execution
// set the last error and continue
$this->last_error = compact('errno', 'errstr', 'errfile', 'errline', 'errcontext');
} | php | public function error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
{
// throwing an exception in an error handler will halt execution
// set the last error and continue
$this->last_error = compact('errno', 'errstr', 'errfile', 'errline', 'errcontext');
} | [
"public",
"function",
"error_handler",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
",",
"$",
"errcontext",
"=",
"null",
")",
"{",
"// throwing an exception in an error handler will halt execution",
"// set the last error and contin... | Internal error handler to deal with stream and socket errors.
@param int $errno
@param string $errstr
@param string $errfile
@param int $errline
@param array $errcontext
@return void | [
"Internal",
"error",
"handler",
"to",
"deal",
"with",
"stream",
"and",
"socket",
"errors",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/IO/AbstractIO.php#L221-L226 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPReader.php | AMQPReader.reuse | public function reuse($str)
{
$this->str = $str;
$this->str_length = mb_strlen($this->str, 'ASCII');
$this->offset = 0;
$this->bitcount = $this->bits = 0;
} | php | public function reuse($str)
{
$this->str = $str;
$this->str_length = mb_strlen($this->str, 'ASCII');
$this->offset = 0;
$this->bitcount = $this->bits = 0;
} | [
"public",
"function",
"reuse",
"(",
"$",
"str",
")",
"{",
"$",
"this",
"->",
"str",
"=",
"$",
"str",
";",
"$",
"this",
"->",
"str_length",
"=",
"mb_strlen",
"(",
"$",
"this",
"->",
"str",
",",
"'ASCII'",
")",
";",
"$",
"this",
"->",
"offset",
"="... | Resets the object from the injected param
Used to not need to create a new AMQPReader instance every time.
when we can just pass a string and reset the object state.
NOTE: since we are working with strings we don't need to pass an AbstractIO
or a timeout.
@param string $str | [
"Resets",
"the",
"object",
"from",
"the",
"injected",
"param"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPReader.php#L81-L87 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPReader.php | AMQPReader.wait | protected function wait()
{
$timeout = $this->getTimeout();
if (null === $timeout) {
// timeout=null just poll state and return instantly
$sec = 0;
$usec = 0;
} elseif ($timeout > 0) {
list($sec, $usec) = MiscHelper::splitSecondsMicroseconds($t... | php | protected function wait()
{
$timeout = $this->getTimeout();
if (null === $timeout) {
// timeout=null just poll state and return instantly
$sec = 0;
$usec = 0;
} elseif ($timeout > 0) {
list($sec, $usec) = MiscHelper::splitSecondsMicroseconds($t... | [
"protected",
"function",
"wait",
"(",
")",
"{",
"$",
"timeout",
"=",
"$",
"this",
"->",
"getTimeout",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"timeout",
")",
"{",
"// timeout=null just poll state and return instantly",
"$",
"sec",
"=",
"0",
";",
"$",... | Waits until some data is retrieved from the socket.
AMQPTimeoutException can be raised if the timeout is set
@throws \PhpAmqpLib\Exception\AMQPIOWaitException on network errors
@throws \PhpAmqpLib\Exception\AMQPTimeoutException when timeout is set and no data received
@throws \PhpAmqpLib\Exception\AMQPNoDataException... | [
"Waits",
"until",
"some",
"data",
"is",
"retrieved",
"from",
"the",
"socket",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPReader.php#L119-L150 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPReader.php | AMQPReader.read_longlong | public function read_longlong()
{
$this->bitcount = $this->bits = 0;
list(, $hi, $lo) = unpack('N2', $this->rawread(8));
$msb = self::getLongMSB($hi);
if (empty($this->is64bits)) {
if ($msb) {
$hi = sprintf('%u', $hi);
}
if (self:... | php | public function read_longlong()
{
$this->bitcount = $this->bits = 0;
list(, $hi, $lo) = unpack('N2', $this->rawread(8));
$msb = self::getLongMSB($hi);
if (empty($this->is64bits)) {
if ($msb) {
$hi = sprintf('%u', $hi);
}
if (self:... | [
"public",
"function",
"read_longlong",
"(",
")",
"{",
"$",
"this",
"->",
"bitcount",
"=",
"$",
"this",
"->",
"bits",
"=",
"0",
";",
"list",
"(",
",",
"$",
"hi",
",",
"$",
"lo",
")",
"=",
"unpack",
"(",
"'N2'",
",",
"$",
"this",
"->",
"rawread",
... | Even on 64 bit systems PHP integers are singed.
Since we need an unsigned value here we return it
as a string.
@return string | [
"Even",
"on",
"64",
"bit",
"systems",
"PHP",
"integers",
"are",
"singed",
".",
"Since",
"we",
"need",
"an",
"unsigned",
"value",
"here",
"we",
"return",
"it",
"as",
"a",
"string",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPReader.php#L308-L325 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPReader.php | AMQPReader.read_array | public function read_array($returnObject = false)
{
$this->bitcount = $this->bits = 0;
// Determine array length and its end position
$arrayLength = $this->read_php_int();
$endOffset = $this->offset + $arrayLength;
$result = $returnObject ? new AMQPArray() : array();
... | php | public function read_array($returnObject = false)
{
$this->bitcount = $this->bits = 0;
// Determine array length and its end position
$arrayLength = $this->read_php_int();
$endOffset = $this->offset + $arrayLength;
$result = $returnObject ? new AMQPArray() : array();
... | [
"public",
"function",
"read_array",
"(",
"$",
"returnObject",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"bitcount",
"=",
"$",
"this",
"->",
"bits",
"=",
"0",
";",
"// Determine array length and its end position",
"$",
"arrayLength",
"=",
"$",
"this",
"->",
... | Reads the array in the next value.
@param bool $returnObject Whether to return AMQPArray instance instead of plain array
@return array|AMQPArray | [
"Reads",
"the",
"array",
"in",
"the",
"next",
"value",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPReader.php#L433-L451 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Wire/AMQPReader.php | AMQPReader.read_value | public function read_value($fieldType, $collectionsAsObjects = false)
{
$this->bitcount = $this->bits = 0;
switch ($fieldType) {
case AMQPAbstractCollection::T_INT_SHORTSHORT:
//according to AMQP091 spec, 'b' is not bit, it is short-short-int, also valid for rabbit/qpid
... | php | public function read_value($fieldType, $collectionsAsObjects = false)
{
$this->bitcount = $this->bits = 0;
switch ($fieldType) {
case AMQPAbstractCollection::T_INT_SHORTSHORT:
//according to AMQP091 spec, 'b' is not bit, it is short-short-int, also valid for rabbit/qpid
... | [
"public",
"function",
"read_value",
"(",
"$",
"fieldType",
",",
"$",
"collectionsAsObjects",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"bitcount",
"=",
"$",
"this",
"->",
"bits",
"=",
"0",
";",
"switch",
"(",
"$",
"fieldType",
")",
"{",
"case",
"AMQPA... | Reads the next value as the provided field type.
@param int $fieldType One of AMQPAbstractCollection::T_* constants
@param bool $collectionsAsObjects Description
@return mixed
@throws \PhpAmqpLib\Exception\AMQPDataReadException | [
"Reads",
"the",
"next",
"value",
"as",
"the",
"provided",
"field",
"type",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Wire/AMQPReader.php#L469-L537 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.connect | protected function connect()
{
try {
// Loop until we connect
while (!$this->isConnected()) {
// Assume we will connect, until we dont
$this->setIsConnected(true);
// Connect the socket
$this->io->connect();
... | php | protected function connect()
{
try {
// Loop until we connect
while (!$this->isConnected()) {
// Assume we will connect, until we dont
$this->setIsConnected(true);
// Connect the socket
$this->io->connect();
... | [
"protected",
"function",
"connect",
"(",
")",
"{",
"try",
"{",
"// Loop until we connect",
"while",
"(",
"!",
"$",
"this",
"->",
"isConnected",
"(",
")",
")",
"{",
"// Assume we will connect, until we dont",
"$",
"this",
"->",
"setIsConnected",
"(",
"true",
")",... | Connects to the AMQP server | [
"Connects",
"to",
"the",
"AMQP",
"server"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L207-L263 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.reconnect | public function reconnect()
{
// Try to close the AMQP connection
$this->safeClose();
// Reconnect the socket/stream then AMQP
$this->io->close();
$this->setIsConnected(false); // getIO can initiate the connection setting via LazyConnection, set it here to be sure
$th... | php | public function reconnect()
{
// Try to close the AMQP connection
$this->safeClose();
// Reconnect the socket/stream then AMQP
$this->io->close();
$this->setIsConnected(false); // getIO can initiate the connection setting via LazyConnection, set it here to be sure
$th... | [
"public",
"function",
"reconnect",
"(",
")",
"{",
"// Try to close the AMQP connection",
"$",
"this",
"->",
"safeClose",
"(",
")",
";",
"// Reconnect the socket/stream then AMQP",
"$",
"this",
"->",
"io",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"setIsCo... | Reconnects using the original connection settings.
This will not recreate any channels that were established previously | [
"Reconnects",
"using",
"the",
"original",
"connection",
"settings",
".",
"This",
"will",
"not",
"recreate",
"any",
"channels",
"that",
"were",
"established",
"previously"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L269-L277 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.safeClose | protected function safeClose()
{
try {
if (isset($this->input) && $this->input) {
$this->close();
}
} catch (\Exception $e) {
// Nothing here
}
} | php | protected function safeClose()
{
try {
if (isset($this->input) && $this->input) {
$this->close();
}
} catch (\Exception $e) {
// Nothing here
}
} | [
"protected",
"function",
"safeClose",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"input",
")",
"&&",
"$",
"this",
"->",
"input",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exc... | Attempts to close the connection safely | [
"Attempts",
"to",
"close",
"the",
"connection",
"safely"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L297-L306 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.wait_frame | protected function wait_frame($timeout = 0)
{
if (is_null($this->input))
{
$this->setIsConnected(false);
throw new AMQPConnectionClosedException('Broken pipe or closed connection');
}
$currentTimeout = $this->input->getTimeout();
$this->input->setTime... | php | protected function wait_frame($timeout = 0)
{
if (is_null($this->input))
{
$this->setIsConnected(false);
throw new AMQPConnectionClosedException('Broken pipe or closed connection');
}
$currentTimeout = $this->input->getTimeout();
$this->input->setTime... | [
"protected",
"function",
"wait_frame",
"(",
"$",
"timeout",
"=",
"0",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"input",
")",
")",
"{",
"$",
"this",
"->",
"setIsConnected",
"(",
"false",
")",
";",
"throw",
"new",
"AMQPConnectionClosedExcept... | Waits for a frame from the server
@param int|float|null $timeout
@return array
@throws \Exception
@throws \PhpAmqpLib\Exception\AMQPTimeoutException
@throws \PhpAmqpLib\Exception\AMQPRuntimeException | [
"Waits",
"for",
"a",
"frame",
"from",
"the",
"server"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L534-L588 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.wait_channel | protected function wait_channel($channel_id, $timeout = 0)
{
// Keeping the original timeout unchanged.
$_timeout = $timeout;
while (true) {
$now = time();
try {
list($frame_type, $frame_channel, $payload) = $this->wait_frame($_timeout);
} ... | php | protected function wait_channel($channel_id, $timeout = 0)
{
// Keeping the original timeout unchanged.
$_timeout = $timeout;
while (true) {
$now = time();
try {
list($frame_type, $frame_channel, $payload) = $this->wait_frame($_timeout);
} ... | [
"protected",
"function",
"wait_channel",
"(",
"$",
"channel_id",
",",
"$",
"timeout",
"=",
"0",
")",
"{",
"// Keeping the original timeout unchanged.",
"$",
"_timeout",
"=",
"$",
"timeout",
";",
"while",
"(",
"true",
")",
"{",
"$",
"now",
"=",
"time",
"(",
... | Waits for a frame from the server destined for a particular channel.
@param string $channel_id
@param int|float|null $timeout
@return array | [
"Waits",
"for",
"a",
"frame",
"from",
"the",
"server",
"destined",
"for",
"a",
"particular",
"channel",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L597-L651 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.close | public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0))
{
$result = null;
$this->io->disableHeartbeat();
if (empty($this->protocolWriter) || !$this->isConnected()) {
return $result;
}
try {
$this->closeChannels();
... | php | public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0))
{
$result = null;
$this->io->disableHeartbeat();
if (empty($this->protocolWriter) || !$this->isConnected()) {
return $result;
}
try {
$this->closeChannels();
... | [
"public",
"function",
"close",
"(",
"$",
"reply_code",
"=",
"0",
",",
"$",
"reply_text",
"=",
"''",
",",
"$",
"method_sig",
"=",
"array",
"(",
"0",
",",
"0",
")",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"this",
"->",
"io",
"->",
"disableH... | Requests a connection close
@param int $reply_code
@param string $reply_text
@param array $method_sig
@return mixed|null | [
"Requests",
"a",
"connection",
"close"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L681-L711 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.connection_open_ok | protected function connection_open_ok($args)
{
$this->known_hosts = $args->read_shortstr();
$this->debug->debug_msg('Open OK! known_hosts: ' . $this->known_hosts);
} | php | protected function connection_open_ok($args)
{
$this->known_hosts = $args->read_shortstr();
$this->debug->debug_msg('Open OK! known_hosts: ' . $this->known_hosts);
} | [
"protected",
"function",
"connection_open_ok",
"(",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"known_hosts",
"=",
"$",
"args",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"this",
"->",
"debug",
"->",
"debug_msg",
"(",
"'Open OK! known_hosts: '",
".",
"$",
"... | Signals that the connection is ready
@param AMQPReader $args | [
"Signals",
"that",
"the",
"connection",
"is",
"ready"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L780-L784 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.connection_redirect | protected function connection_redirect($args)
{
$host = $args->read_shortstr();
$this->known_hosts = $args->read_shortstr();
$this->debug->debug_msg(sprintf(
'Redirected to [%s], known_hosts [%s]',
$host,
$this->known_hosts
));
... | php | protected function connection_redirect($args)
{
$host = $args->read_shortstr();
$this->known_hosts = $args->read_shortstr();
$this->debug->debug_msg(sprintf(
'Redirected to [%s], known_hosts [%s]',
$host,
$this->known_hosts
));
... | [
"protected",
"function",
"connection_redirect",
"(",
"$",
"args",
")",
"{",
"$",
"host",
"=",
"$",
"args",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"this",
"->",
"known_hosts",
"=",
"$",
"args",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"this",
"->"... | Asks the client to use a different server
@param AMQPReader $args
@return string | [
"Asks",
"the",
"client",
"to",
"use",
"a",
"different",
"server"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L792-L803 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.x_secure_ok | protected function x_secure_ok($response)
{
$args = new AMQPWriter();
$args->write_longstr($response);
$this->send_method_frame(array(10, 21), $args);
} | php | protected function x_secure_ok($response)
{
$args = new AMQPWriter();
$args->write_longstr($response);
$this->send_method_frame(array(10, 21), $args);
} | [
"protected",
"function",
"x_secure_ok",
"(",
"$",
"response",
")",
"{",
"$",
"args",
"=",
"new",
"AMQPWriter",
"(",
")",
";",
"$",
"args",
"->",
"write_longstr",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"send_method_frame",
"(",
"array",
"(",
... | Security mechanism response
@param string $response | [
"Security",
"mechanism",
"response"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L820-L825 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.connection_start | protected function connection_start($args)
{
$this->version_major = $args->read_octet();
$this->version_minor = $args->read_octet();
$this->server_properties = $args->read_table();
$this->mechanisms = explode(' ', $args->read_longstr());
$this->locales = explode(' ', $args->r... | php | protected function connection_start($args)
{
$this->version_major = $args->read_octet();
$this->version_minor = $args->read_octet();
$this->server_properties = $args->read_table();
$this->mechanisms = explode(' ', $args->read_longstr());
$this->locales = explode(' ', $args->r... | [
"protected",
"function",
"connection_start",
"(",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"version_major",
"=",
"$",
"args",
"->",
"read_octet",
"(",
")",
";",
"$",
"this",
"->",
"version_minor",
"=",
"$",
"args",
"->",
"read_octet",
"(",
")",
";",
"... | Starts connection negotiation
@param AMQPReader $args | [
"Starts",
"connection",
"negotiation"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L832-L847 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.connection_tune | protected function connection_tune($args)
{
$v = $args->read_short();
if ($v) {
$this->channel_max = $v;
}
$v = $args->read_long();
if ($v) {
$this->frame_max = $v;
}
// use server proposed value if not set
if ($this->heartbea... | php | protected function connection_tune($args)
{
$v = $args->read_short();
if ($v) {
$this->channel_max = $v;
}
$v = $args->read_long();
if ($v) {
$this->frame_max = $v;
}
// use server proposed value if not set
if ($this->heartbea... | [
"protected",
"function",
"connection_tune",
"(",
"$",
"args",
")",
"{",
"$",
"v",
"=",
"$",
"args",
"->",
"read_short",
"(",
")",
";",
"if",
"(",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"channel_max",
"=",
"$",
"v",
";",
"}",
"$",
"v",
"=",
"$",... | Proposes connection tuning parameters
@param AMQPReader $args | [
"Proposes",
"connection",
"tuning",
"parameters"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L870-L888 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.x_tune_ok | protected function x_tune_ok($channel_max, $frame_max, $heartbeat)
{
$args = new AMQPWriter();
$args->write_short($channel_max);
$args->write_long($frame_max);
$args->write_short($heartbeat);
$this->send_method_frame(array(10, 31), $args);
$this->wait_tune_ok = false;... | php | protected function x_tune_ok($channel_max, $frame_max, $heartbeat)
{
$args = new AMQPWriter();
$args->write_short($channel_max);
$args->write_long($frame_max);
$args->write_short($heartbeat);
$this->send_method_frame(array(10, 31), $args);
$this->wait_tune_ok = false;... | [
"protected",
"function",
"x_tune_ok",
"(",
"$",
"channel_max",
",",
"$",
"frame_max",
",",
"$",
"heartbeat",
")",
"{",
"$",
"args",
"=",
"new",
"AMQPWriter",
"(",
")",
";",
"$",
"args",
"->",
"write_short",
"(",
"$",
"channel_max",
")",
";",
"$",
"args... | Negotiates connection tuning parameters
@param int $channel_max
@param int $frame_max
@param int $heartbeat | [
"Negotiates",
"connection",
"tuning",
"parameters"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L897-L905 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Connection/AbstractConnection.php | AbstractConnection.closeChannels | protected function closeChannels()
{
foreach ($this->channels as $key => $channel) {
// channels[0] is this connection object, so don't close it yet
if ($key === 0) {
continue;
}
try {
$channel->close();
} catch (\Ex... | php | protected function closeChannels()
{
foreach ($this->channels as $key => $channel) {
// channels[0] is this connection object, so don't close it yet
if ($key === 0) {
continue;
}
try {
$channel->close();
} catch (\Ex... | [
"protected",
"function",
"closeChannels",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"channels",
"as",
"$",
"key",
"=>",
"$",
"channel",
")",
"{",
"// channels[0] is this connection object, so don't close it yet",
"if",
"(",
"$",
"key",
"===",
"0",
")",
... | Closes all available channels | [
"Closes",
"all",
"available",
"channels"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Connection/AbstractConnection.php#L990-L1003 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.channel_alert | protected function channel_alert($reader)
{
$reply_code = $reader->read_short();
$reply_text = $reader->read_shortstr();
$details = $reader->read_table();
array_push($this->alerts, array($reply_code, $reply_text, $details));
} | php | protected function channel_alert($reader)
{
$reply_code = $reader->read_short();
$reply_text = $reader->read_shortstr();
$details = $reader->read_table();
array_push($this->alerts, array($reply_code, $reply_text, $details));
} | [
"protected",
"function",
"channel_alert",
"(",
"$",
"reader",
")",
"{",
"$",
"reply_code",
"=",
"$",
"reader",
"->",
"read_short",
"(",
")",
";",
"$",
"reply_text",
"=",
"$",
"reader",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"details",
"=",
"$",
"re... | Only for AMQP0.8.0
This method allows the server to send a non-fatal warning to
the client. This is used for methods that are normally
asynchronous and thus do not have confirmations, and for which
the server may detect errors that need to be reported. Fatal
errors are handled as channel or connection exceptions; non... | [
"Only",
"for",
"AMQP0",
".",
"8",
".",
"0",
"This",
"method",
"allows",
"the",
"server",
"to",
"send",
"a",
"non",
"-",
"fatal",
"warning",
"to",
"the",
"client",
".",
"This",
"is",
"used",
"for",
"methods",
"that",
"are",
"normally",
"asynchronous",
"... | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L150-L156 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.close | public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0))
{
$this->callbacks = array();
if ($this->is_open === false || $this->connection === null) {
$this->do_close();
return null; // already closed
}
list($class_id, $method_id, $ar... | php | public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0))
{
$this->callbacks = array();
if ($this->is_open === false || $this->connection === null) {
$this->do_close();
return null; // already closed
}
list($class_id, $method_id, $ar... | [
"public",
"function",
"close",
"(",
"$",
"reply_code",
"=",
"0",
",",
"$",
"reply_text",
"=",
"''",
",",
"$",
"method_sig",
"=",
"array",
"(",
"0",
",",
"0",
")",
")",
"{",
"$",
"this",
"->",
"callbacks",
"=",
"array",
"(",
")",
";",
"if",
"(",
... | Request a channel close
@param int $reply_code
@param string $reply_text
@param array $method_sig
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Request",
"a",
"channel",
"close"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L167-L193 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.access_request | public function access_request(
$realm,
$exclusive = false,
$passive = false,
$active = false,
$write = false,
$read = false
) {
list($class_id, $method_id, $args) = $this->protocolWriter->accessRequest(
$realm,
$exclusive,
... | php | public function access_request(
$realm,
$exclusive = false,
$passive = false,
$active = false,
$write = false,
$read = false
) {
list($class_id, $method_id, $args) = $this->protocolWriter->accessRequest(
$realm,
$exclusive,
... | [
"public",
"function",
"access_request",
"(",
"$",
"realm",
",",
"$",
"exclusive",
"=",
"false",
",",
"$",
"passive",
"=",
"false",
",",
"$",
"active",
"=",
"false",
",",
"$",
"write",
"=",
"false",
",",
"$",
"read",
"=",
"false",
")",
"{",
"list",
... | Requests an access ticket
@param string $realm
@param bool $exclusive
@param bool $passive
@param bool $active
@param bool $write
@param bool $read
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Requests",
"an",
"access",
"ticket"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L308-L330 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.exchange_delete | public function exchange_delete(
$exchange,
$if_unused = false,
$nowait = false,
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->exchangeDelete(
$ticket,
$exchange,
... | php | public function exchange_delete(
$exchange,
$if_unused = false,
$nowait = false,
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->exchangeDelete(
$ticket,
$exchange,
... | [
"public",
"function",
"exchange_delete",
"(",
"$",
"exchange",
",",
"$",
"if_unused",
"=",
"false",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticket",
"=",
"$",
"this",
"->",
"getTicket",
"(",
"$",
"ticket",
"... | Deletes an exchange
@param string $exchange
@param bool $if_unused
@param bool $nowait
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed|null | [
"Deletes",
"an",
"exchange"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L414-L437 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.exchange_bind | public function exchange_bind(
$destination,
$source,
$routing_key = '',
$nowait = false,
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->exchangeBind(
... | php | public function exchange_bind(
$destination,
$source,
$routing_key = '',
$nowait = false,
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->exchangeBind(
... | [
"public",
"function",
"exchange_bind",
"(",
"$",
"destination",
",",
"$",
"source",
",",
"$",
"routing_key",
"=",
"''",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
... | Binds dest exchange to source exchange
@param string $destination
@param string $source
@param string $routing_key
@param bool $nowait
@param array $arguments
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed|null | [
"Binds",
"dest",
"exchange",
"to",
"source",
"exchange"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L460-L488 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.queue_bind | public function queue_bind(
$queue,
$exchange,
$routing_key = '',
$nowait = false,
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueBind(
$ticket... | php | public function queue_bind(
$queue,
$exchange,
$routing_key = '',
$nowait = false,
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueBind(
$ticket... | [
"public",
"function",
"queue_bind",
"(",
"$",
"queue",
",",
"$",
"exchange",
",",
"$",
"routing_key",
"=",
"''",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticke... | Binds queue to an exchange
@param string $queue
@param string $exchange
@param string $routing_key
@param bool $nowait
@param array $arguments
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed|null | [
"Binds",
"queue",
"to",
"an",
"exchange"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L557-L585 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.queue_unbind | public function queue_unbind(
$queue,
$exchange,
$routing_key = '',
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueUnbind(
$ticket,
$queue,... | php | public function queue_unbind(
$queue,
$exchange,
$routing_key = '',
$arguments = array(),
$ticket = null
) {
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueUnbind(
$ticket,
$queue,... | [
"public",
"function",
"queue_unbind",
"(",
"$",
"queue",
",",
"$",
"exchange",
",",
"$",
"routing_key",
"=",
"''",
",",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticket",
"=",
"$",
"this",
"->",
"get... | Unbind queue from an exchange
@param string $queue
@param string $exchange
@param string $routing_key
@param array $arguments
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Unbind",
"queue",
"from",
"an",
"exchange"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L607-L629 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.queue_declare_ok | protected function queue_declare_ok($reader)
{
$queue = $reader->read_shortstr();
$message_count = $reader->read_long();
$consumer_count = $reader->read_long();
return array($queue, $message_count, $consumer_count);
} | php | protected function queue_declare_ok($reader)
{
$queue = $reader->read_shortstr();
$message_count = $reader->read_long();
$consumer_count = $reader->read_long();
return array($queue, $message_count, $consumer_count);
} | [
"protected",
"function",
"queue_declare_ok",
"(",
"$",
"reader",
")",
"{",
"$",
"queue",
"=",
"$",
"reader",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"message_count",
"=",
"$",
"reader",
"->",
"read_long",
"(",
")",
";",
"$",
"consumer_count",
"=",
"$"... | Confirms a queue definition
@param AMQPReader $reader
@return string[] | [
"Confirms",
"a",
"queue",
"definition"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L693-L700 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.queue_delete | public function queue_delete($queue = '', $if_unused = false, $if_empty = false, $nowait = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueDelete(
$ticket,
$queue,
$if_unused,
... | php | public function queue_delete($queue = '', $if_unused = false, $if_empty = false, $nowait = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queueDelete(
$ticket,
$queue,
$if_unused,
... | [
"public",
"function",
"queue_delete",
"(",
"$",
"queue",
"=",
"''",
",",
"$",
"if_unused",
"=",
"false",
",",
"$",
"if_empty",
"=",
"false",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticket",
"=",
"$",
"this... | Deletes a queue
@param string $queue
@param bool $if_unused
@param bool $if_empty
@param bool $nowait
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed|null | [
"Deletes",
"a",
"queue"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L713-L734 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.queue_purge | public function queue_purge($queue = '', $nowait = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queuePurge($ticket, $queue, $nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($now... | php | public function queue_purge($queue = '', $nowait = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->queuePurge($ticket, $queue, $nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($now... | [
"public",
"function",
"queue_purge",
"(",
"$",
"queue",
"=",
"''",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticket",
"=",
"$",
"this",
"->",
"getTicket",
"(",
"$",
"ticket",
")",
";",
"list",
"(",
"$",
"c... | Purges a queue
@param string $queue
@param bool $nowait
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed|null | [
"Purges",
"a",
"queue"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L756-L770 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_ack | public function basic_ack($delivery_tag, $multiple = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicAck($delivery_tag, $multiple);
$this->send_method_frame(array($class_id, $method_id), $args);
} | php | public function basic_ack($delivery_tag, $multiple = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicAck($delivery_tag, $multiple);
$this->send_method_frame(array($class_id, $method_id), $args);
} | [
"public",
"function",
"basic_ack",
"(",
"$",
"delivery_tag",
",",
"$",
"multiple",
"=",
"false",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"protocolWriter",
"->",
"basicAck",
"(",
"$",... | Acknowledges one or more messages
@param string $delivery_tag
@param bool $multiple | [
"Acknowledges",
"one",
"or",
"more",
"messages"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L789-L793 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_ack_from_server | protected function basic_ack_from_server(AMQPReader $reader)
{
$delivery_tag = $reader->read_longlong();
$multiple = (bool) $reader->read_bit();
if (!isset($this->published_messages[$delivery_tag])) {
throw new AMQPRuntimeException(sprintf(
'Server ack\'ed unknow... | php | protected function basic_ack_from_server(AMQPReader $reader)
{
$delivery_tag = $reader->read_longlong();
$multiple = (bool) $reader->read_bit();
if (!isset($this->published_messages[$delivery_tag])) {
throw new AMQPRuntimeException(sprintf(
'Server ack\'ed unknow... | [
"protected",
"function",
"basic_ack_from_server",
"(",
"AMQPReader",
"$",
"reader",
")",
"{",
"$",
"delivery_tag",
"=",
"$",
"reader",
"->",
"read_longlong",
"(",
")",
";",
"$",
"multiple",
"=",
"(",
"bool",
")",
"$",
"reader",
"->",
"read_bit",
"(",
")",
... | Called when the server sends a basic.ack
@param AMQPReader $reader
@throws AMQPRuntimeException | [
"Called",
"when",
"the",
"server",
"sends",
"a",
"basic",
".",
"ack"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L801-L814 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_nack_from_server | protected function basic_nack_from_server($reader)
{
$delivery_tag = $reader->read_longlong();
$multiple = (bool) $reader->read_bit();
if (!isset($this->published_messages[$delivery_tag])) {
throw new AMQPRuntimeException(sprintf(
'Server nack\'ed unknown deliver... | php | protected function basic_nack_from_server($reader)
{
$delivery_tag = $reader->read_longlong();
$multiple = (bool) $reader->read_bit();
if (!isset($this->published_messages[$delivery_tag])) {
throw new AMQPRuntimeException(sprintf(
'Server nack\'ed unknown deliver... | [
"protected",
"function",
"basic_nack_from_server",
"(",
"$",
"reader",
")",
"{",
"$",
"delivery_tag",
"=",
"$",
"reader",
"->",
"read_longlong",
"(",
")",
";",
"$",
"multiple",
"=",
"(",
"bool",
")",
"$",
"reader",
"->",
"read_bit",
"(",
")",
";",
"if",
... | Called when the server sends a basic.nack
@param AMQPReader $reader
@throws AMQPRuntimeException | [
"Called",
"when",
"the",
"server",
"sends",
"a",
"basic",
".",
"nack"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L822-L835 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_nack | public function basic_nack($delivery_tag, $multiple = false, $requeue = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicNack($delivery_tag, $multiple, $requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
} | php | public function basic_nack($delivery_tag, $multiple = false, $requeue = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicNack($delivery_tag, $multiple, $requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
} | [
"public",
"function",
"basic_nack",
"(",
"$",
"delivery_tag",
",",
"$",
"multiple",
"=",
"false",
",",
"$",
"requeue",
"=",
"false",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"protoc... | Rejects one or several received messages
@param string $delivery_tag
@param bool $multiple
@param bool $requeue | [
"Rejects",
"one",
"or",
"several",
"received",
"messages"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L893-L897 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_cancel | public function basic_cancel($consumer_tag, $nowait = false, $noreturn = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicCancel($consumer_tag, $nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($nowait || $noreturn) {
unset($th... | php | public function basic_cancel($consumer_tag, $nowait = false, $noreturn = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicCancel($consumer_tag, $nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($nowait || $noreturn) {
unset($th... | [
"public",
"function",
"basic_cancel",
"(",
"$",
"consumer_tag",
",",
"$",
"nowait",
"=",
"false",
",",
"$",
"noreturn",
"=",
"false",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"proto... | Ends a queue consumer
@param string $consumer_tag
@param bool $nowait
@param bool $noreturn
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Ends",
"a",
"queue",
"consumer"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L908-L921 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_consume | public function basic_consume(
$queue = '',
$consumer_tag = '',
$no_local = false,
$no_ack = false,
$exclusive = false,
$nowait = false,
$callback = null,
$ticket = null,
$arguments = array()
) {
$ticket = $this->getTicket($ticket);
... | php | public function basic_consume(
$queue = '',
$consumer_tag = '',
$no_local = false,
$no_ack = false,
$exclusive = false,
$nowait = false,
$callback = null,
$ticket = null,
$arguments = array()
) {
$ticket = $this->getTicket($ticket);
... | [
"public",
"function",
"basic_consume",
"(",
"$",
"queue",
"=",
"''",
",",
"$",
"consumer_tag",
"=",
"''",
",",
"$",
"no_local",
"=",
"false",
",",
"$",
"no_ack",
"=",
"false",
",",
"$",
"exclusive",
"=",
"false",
",",
"$",
"nowait",
"=",
"false",
","... | Starts a queue consumer
@param string $queue
@param string $consumer_tag
@param bool $no_local
@param bool $no_ack
@param bool $exclusive
@param bool $nowait
@param callable|null $callback
@param int|null $ticket
@param array $arguments
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation time... | [
"Starts",
"a",
"queue",
"consumer"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L969-L1003 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_deliver | protected function basic_deliver($reader, $message)
{
$consumer_tag = $reader->read_shortstr();
$delivery_tag = $reader->read_longlong();
$redelivered = $reader->read_bit();
$exchange = $reader->read_shortstr();
$routing_key = $reader->read_shortstr();
$message->deli... | php | protected function basic_deliver($reader, $message)
{
$consumer_tag = $reader->read_shortstr();
$delivery_tag = $reader->read_longlong();
$redelivered = $reader->read_bit();
$exchange = $reader->read_shortstr();
$routing_key = $reader->read_shortstr();
$message->deli... | [
"protected",
"function",
"basic_deliver",
"(",
"$",
"reader",
",",
"$",
"message",
")",
"{",
"$",
"consumer_tag",
"=",
"$",
"reader",
"->",
"read_shortstr",
"(",
")",
";",
"$",
"delivery_tag",
"=",
"$",
"reader",
"->",
"read_longlong",
"(",
")",
";",
"$"... | Notifies the client of a consumer message
@param AMQPReader $reader
@param AMQPMessage $message | [
"Notifies",
"the",
"client",
"of",
"a",
"consumer",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1022-L1042 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_get | public function basic_get($queue = '', $no_ack = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->basicGet($ticket, $queue, $no_ack);
$this->send_method_frame(array($class_id, $method_id), $args);
return $this... | php | public function basic_get($queue = '', $no_ack = false, $ticket = null)
{
$ticket = $this->getTicket($ticket);
list($class_id, $method_id, $args) = $this->protocolWriter->basicGet($ticket, $queue, $no_ack);
$this->send_method_frame(array($class_id, $method_id), $args);
return $this... | [
"public",
"function",
"basic_get",
"(",
"$",
"queue",
"=",
"''",
",",
"$",
"no_ack",
"=",
"false",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"ticket",
"=",
"$",
"this",
"->",
"getTicket",
"(",
"$",
"ticket",
")",
";",
"list",
"(",
"$",
"cla... | Direct access to a queue if no message was available in the queue, return null
@param string $queue
@param bool $no_ack
@param int|null $ticket
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Direct",
"access",
"to",
"a",
"queue",
"if",
"no",
"message",
"was",
"available",
"in",
"the",
"queue",
"return",
"null"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1053-L1064 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_get_ok | protected function basic_get_ok($reader, $message)
{
$delivery_tag = $reader->read_longlong();
$redelivered = $reader->read_bit();
$exchange = $reader->read_shortstr();
$routing_key = $reader->read_shortstr();
$message_count = $reader->read_long();
$message->delivery... | php | protected function basic_get_ok($reader, $message)
{
$delivery_tag = $reader->read_longlong();
$redelivered = $reader->read_bit();
$exchange = $reader->read_shortstr();
$routing_key = $reader->read_shortstr();
$message_count = $reader->read_long();
$message->delivery... | [
"protected",
"function",
"basic_get_ok",
"(",
"$",
"reader",
",",
"$",
"message",
")",
"{",
"$",
"delivery_tag",
"=",
"$",
"reader",
"->",
"read_longlong",
"(",
")",
";",
"$",
"redelivered",
"=",
"$",
"reader",
"->",
"read_bit",
"(",
")",
";",
"$",
"ex... | Provides client with a message
@param AMQPReader $reader
@param AMQPMessage $message
@return AMQPMessage | [
"Provides",
"client",
"with",
"a",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1082-L1099 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_publish | public function basic_publish(
$msg,
$exchange = '',
$routing_key = '',
$mandatory = false,
$immediate = false,
$ticket = null
) {
$pkt = new AMQPWriter();
$pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));
... | php | public function basic_publish(
$msg,
$exchange = '',
$routing_key = '',
$mandatory = false,
$immediate = false,
$ticket = null
) {
$pkt = new AMQPWriter();
$pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));
... | [
"public",
"function",
"basic_publish",
"(",
"$",
"msg",
",",
"$",
"exchange",
"=",
"''",
",",
"$",
"routing_key",
"=",
"''",
",",
"$",
"mandatory",
"=",
"false",
",",
"$",
"immediate",
"=",
"false",
",",
"$",
"ticket",
"=",
"null",
")",
"{",
"$",
"... | Publishes a message
@param AMQPMessage $msg
@param string $exchange
@param string $routing_key
@param bool $mandatory
@param bool $immediate
@param int|null $ticket | [
"Publishes",
"a",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1151-L1181 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_recover | public function basic_recover($requeue = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicRecover($requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
return $this->wait(array(
$this->waitHelper->get_wait('basic.recover_ok')
... | php | public function basic_recover($requeue = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicRecover($requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
return $this->wait(array(
$this->waitHelper->get_wait('basic.recover_ok')
... | [
"public",
"function",
"basic_recover",
"(",
"$",
"requeue",
"=",
"false",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"protocolWriter",
"->",
"basicRecover",
"(",
"$",
"requeue",
")",
";... | Redelivers unacknowledged messages
@param bool $requeue
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Redelivers",
"unacknowledged",
"messages"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1287-L1295 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_reject | public function basic_reject($delivery_tag, $requeue)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicReject($delivery_tag, $requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
} | php | public function basic_reject($delivery_tag, $requeue)
{
list($class_id, $method_id, $args) = $this->protocolWriter->basicReject($delivery_tag, $requeue);
$this->send_method_frame(array($class_id, $method_id), $args);
} | [
"public",
"function",
"basic_reject",
"(",
"$",
"delivery_tag",
",",
"$",
"requeue",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"protocolWriter",
"->",
"basicReject",
"(",
"$",
"delivery_... | Rejects an incoming message
@param string $delivery_tag
@param bool $requeue | [
"Rejects",
"an",
"incoming",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1311-L1315 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.basic_return | protected function basic_return($reader, $message)
{
$callback = $this->basic_return_callback;
if (!is_callable($callback)) {
$this->debug->debug_msg('Skipping unhandled basic_return message');
return null;
}
$reply_code = $reader->read_short();
$repl... | php | protected function basic_return($reader, $message)
{
$callback = $this->basic_return_callback;
if (!is_callable($callback)) {
$this->debug->debug_msg('Skipping unhandled basic_return message');
return null;
}
$reply_code = $reader->read_short();
$repl... | [
"protected",
"function",
"basic_return",
"(",
"$",
"reader",
",",
"$",
"message",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"basic_return_callback",
";",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"this",
"->",
"d... | Returns a failed message
@param AMQPReader $reader
@param AMQPMessage $message
@return null | [
"Returns",
"a",
"failed",
"message"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1324-L1344 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.tx_rollback | public function tx_rollback()
{
$this->send_method_frame(array(90, 30));
return $this->wait(array(
$this->waitHelper->get_wait('tx.rollback_ok')
), false, $this->channel_rpc_timeout);
} | php | public function tx_rollback()
{
$this->send_method_frame(array(90, 30));
return $this->wait(array(
$this->waitHelper->get_wait('tx.rollback_ok')
), false, $this->channel_rpc_timeout);
} | [
"public",
"function",
"tx_rollback",
"(",
")",
"{",
"$",
"this",
"->",
"send_method_frame",
"(",
"array",
"(",
"90",
",",
"30",
")",
")",
";",
"return",
"$",
"this",
"->",
"wait",
"(",
"array",
"(",
"$",
"this",
"->",
"waitHelper",
"->",
"get_wait",
... | Rollbacks the current transaction
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Rollbacks",
"the",
"current",
"transaction"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1373-L1380 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.confirm_select | public function confirm_select($nowait = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->confirmSelect($nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($nowait) {
return null;
}
$this->wait(array(
$th... | php | public function confirm_select($nowait = false)
{
list($class_id, $method_id, $args) = $this->protocolWriter->confirmSelect($nowait);
$this->send_method_frame(array($class_id, $method_id), $args);
if ($nowait) {
return null;
}
$this->wait(array(
$th... | [
"public",
"function",
"confirm_select",
"(",
"$",
"nowait",
"=",
"false",
")",
"{",
"list",
"(",
"$",
"class_id",
",",
"$",
"method_id",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"protocolWriter",
"->",
"confirmSelect",
"(",
"$",
"nowait",
")",
";... | Puts the channel into confirm mode
Beware that only non-transactional channels may be put into confirm mode and vice versa
@param bool $nowait
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return null | [
"Puts",
"the",
"channel",
"into",
"confirm",
"mode",
"Beware",
"that",
"only",
"non",
"-",
"transactional",
"channels",
"may",
"be",
"put",
"into",
"confirm",
"mode",
"and",
"vice",
"versa"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1399-L1413 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.wait_for_pending_acks | public function wait_for_pending_acks($timeout = 0)
{
$functions = array(
$this->waitHelper->get_wait('basic.ack'),
$this->waitHelper->get_wait('basic.nack'),
);
while (count($this->published_messages) !== 0) {
if ($timeout > 0) {
$this->w... | php | public function wait_for_pending_acks($timeout = 0)
{
$functions = array(
$this->waitHelper->get_wait('basic.ack'),
$this->waitHelper->get_wait('basic.nack'),
);
while (count($this->published_messages) !== 0) {
if ($timeout > 0) {
$this->w... | [
"public",
"function",
"wait_for_pending_acks",
"(",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"functions",
"=",
"array",
"(",
"$",
"this",
"->",
"waitHelper",
"->",
"get_wait",
"(",
"'basic.ack'",
")",
",",
"$",
"this",
"->",
"waitHelper",
"->",
"get_wait",... | Waits for pending acks and nacks from the server.
If there are no pending acks, the method returns immediately
@param int $timeout Waits until $timeout value is reached | [
"Waits",
"for",
"pending",
"acks",
"and",
"nacks",
"from",
"the",
"server",
".",
"If",
"there",
"are",
"no",
"pending",
"acks",
"the",
"method",
"returns",
"immediately"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1430-L1444 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.tx_select | public function tx_select()
{
$this->send_method_frame(array(90, 10));
return $this->wait(array(
$this->waitHelper->get_wait('tx.select_ok')
), false, $this->channel_rpc_timeout);
} | php | public function tx_select()
{
$this->send_method_frame(array(90, 10));
return $this->wait(array(
$this->waitHelper->get_wait('tx.select_ok')
), false, $this->channel_rpc_timeout);
} | [
"public",
"function",
"tx_select",
"(",
")",
"{",
"$",
"this",
"->",
"send_method_frame",
"(",
"array",
"(",
"90",
",",
"10",
")",
")",
";",
"return",
"$",
"this",
"->",
"wait",
"(",
"array",
"(",
"$",
"this",
"->",
"waitHelper",
"->",
"get_wait",
"(... | Selects standard transaction mode
@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
@return mixed | [
"Selects",
"standard",
"transaction",
"mode"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1474-L1481 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.set_return_listener | public function set_return_listener($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | php | public function set_return_listener($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | [
"public",
"function",
"set_return_listener",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Given callback \"%s\" should be callable. %s typ... | Sets callback for basic_return
@param callable $callback
@throws \InvalidArgumentException if $callback is not callable | [
"Sets",
"callback",
"for",
"basic_return"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1533-L1544 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.set_nack_handler | public function set_nack_handler($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | php | public function set_nack_handler($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | [
"public",
"function",
"set_nack_handler",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Given callback \"%s\" should be callable. %s type w... | Sets a handler which called for any message nack'ed by the server, with the AMQPMessage as first argument.
@param callable $callback
@throws \InvalidArgumentException | [
"Sets",
"a",
"handler",
"which",
"called",
"for",
"any",
"message",
"nack",
"ed",
"by",
"the",
"server",
"with",
"the",
"AMQPMessage",
"as",
"first",
"argument",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1552-L1563 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Channel/AMQPChannel.php | AMQPChannel.set_ack_handler | public function set_ack_handler($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | php | public function set_ack_handler($callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf(
'Given callback "%s" should be callable. %s type was given.',
$callback,
gettype($callback)
));
}
... | [
"public",
"function",
"set_ack_handler",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Given callback \"%s\" should be callable. %s type wa... | Sets a handler which called for any message ack'ed by the server, with the AMQPMessage as first argument.
@param callable $callback
@throws \InvalidArgumentException | [
"Sets",
"a",
"handler",
"which",
"called",
"for",
"any",
"message",
"ack",
"ed",
"by",
"the",
"server",
"with",
"the",
"AMQPMessage",
"as",
"first",
"argument",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Channel/AMQPChannel.php#L1571-L1582 | train |
php-amqplib/php-amqplib | demo/amqp_consumer_signals.php | Consumer.start | public function start()
{
if ($this->restart) {
echo 'Restarting consumer.' . PHP_EOL;
$this->restart = false;
} else {
echo 'Starting consumer.' . PHP_EOL;
}
$exchange = 'router';
$queue = 'msgs';
$this->channel = $this->conne... | php | public function start()
{
if ($this->restart) {
echo 'Restarting consumer.' . PHP_EOL;
$this->restart = false;
} else {
echo 'Starting consumer.' . PHP_EOL;
}
$exchange = 'router';
$queue = 'msgs';
$this->channel = $this->conne... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"restart",
")",
"{",
"echo",
"'Restarting consumer.'",
".",
"PHP_EOL",
";",
"$",
"this",
"->",
"restart",
"=",
"false",
";",
"}",
"else",
"{",
"echo",
"'Starting consumer.'",
"."... | Start a consumer on an existing connection
@return void | [
"Start",
"a",
"consumer",
"on",
"an",
"existing",
"connection"
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/demo/amqp_consumer_signals.php#L127-L160 | train |
php-amqplib/php-amqplib | PhpAmqpLib/Helper/MiscHelper.php | MiscHelper.hexdump | public static function hexdump($data, $htmloutput = true, $uppercase = false, $return = false)
{
// Init
$hexi = '';
$ascii = '';
$dump = $htmloutput ? '<pre>' : '';
$offset = 0;
$len = mb_strlen($data, 'ASCII');
// Upper or lower case hexidecimal
$he... | php | public static function hexdump($data, $htmloutput = true, $uppercase = false, $return = false)
{
// Init
$hexi = '';
$ascii = '';
$dump = $htmloutput ? '<pre>' : '';
$offset = 0;
$len = mb_strlen($data, 'ASCII');
// Upper or lower case hexidecimal
$he... | [
"public",
"static",
"function",
"hexdump",
"(",
"$",
"data",
",",
"$",
"htmloutput",
"=",
"true",
",",
"$",
"uppercase",
"=",
"false",
",",
"$",
"return",
"=",
"false",
")",
"{",
"// Init",
"$",
"hexi",
"=",
"''",
";",
"$",
"ascii",
"=",
"''",
";",... | View any string as a hexdump.
This is most commonly used to view binary data from streams
or sockets while debugging, but can be used to view any string
with non-viewable characters.
@version 1.3.2
@author Aidan Lister <aidan@php.net>
@author Peter Waller <iridum@php.net>
@link http://aidanlister... | [
"View",
"any",
"string",
"as",
"a",
"hexdump",
"."
] | 614bb57a3b600cd3c005fdcb8aa55a89ca0069f3 | https://github.com/php-amqplib/php-amqplib/blob/614bb57a3b600cd3c005fdcb8aa55a89ca0069f3/PhpAmqpLib/Helper/MiscHelper.php#L60-L120 | train |
flarum/core | src/Forum/Content/Discussion.php | Discussion.getApiDocument | protected function getApiDocument(User $actor, array $params)
{
$response = $this->api->send('Flarum\Api\Controller\ShowDiscussionController', $actor, $params);
$statusCode = $response->getStatusCode();
if ($statusCode === 404) {
throw new RouteNotFoundException;
}
... | php | protected function getApiDocument(User $actor, array $params)
{
$response = $this->api->send('Flarum\Api\Controller\ShowDiscussionController', $actor, $params);
$statusCode = $response->getStatusCode();
if ($statusCode === 404) {
throw new RouteNotFoundException;
}
... | [
"protected",
"function",
"getApiDocument",
"(",
"User",
"$",
"actor",
",",
"array",
"$",
"params",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"send",
"(",
"'Flarum\\Api\\Controller\\ShowDiscussionController'",
",",
"$",
"actor",
",",
"$",
... | Get the result of an API request to show a discussion.
@param User $actor
@param array $params
@return object
@throws RouteNotFoundException | [
"Get",
"the",
"result",
"of",
"an",
"API",
"request",
"to",
"show",
"a",
"discussion",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Forum/Content/Discussion.php#L108-L118 | train |
flarum/core | src/Foundation/Application.php | Application.url | public function url($path = null)
{
$config = $this->make('flarum.config');
$url = array_get($config, 'url', array_get($_SERVER, 'REQUEST_URI'));
if (is_array($url)) {
if (isset($url[$path])) {
return $url[$path];
}
$url = $url['base'];
... | php | public function url($path = null)
{
$config = $this->make('flarum.config');
$url = array_get($config, 'url', array_get($_SERVER, 'REQUEST_URI'));
if (is_array($url)) {
if (isset($url[$path])) {
return $url[$path];
}
$url = $url['base'];
... | [
"public",
"function",
"url",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"make",
"(",
"'flarum.config'",
")",
";",
"$",
"url",
"=",
"array_get",
"(",
"$",
"config",
",",
"'url'",
",",
"array_get",
"(",
"$",
"_SER... | Get the URL to the Flarum installation.
@param string $path
@return string | [
"Get",
"the",
"URL",
"to",
"the",
"Flarum",
"installation",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Foundation/Application.php#L142-L160 | train |
flarum/core | src/Notification/NotificationServiceProvider.php | NotificationServiceProvider.registerNotificationTypes | public function registerNotificationTypes()
{
$blueprints = [
DiscussionRenamedBlueprint::class => ['alert']
];
$this->app->make('events')->fire(
new ConfigureNotificationTypes($blueprints)
);
foreach ($blueprints as $blueprint => $enabled) {
... | php | public function registerNotificationTypes()
{
$blueprints = [
DiscussionRenamedBlueprint::class => ['alert']
];
$this->app->make('events')->fire(
new ConfigureNotificationTypes($blueprints)
);
foreach ($blueprints as $blueprint => $enabled) {
... | [
"public",
"function",
"registerNotificationTypes",
"(",
")",
"{",
"$",
"blueprints",
"=",
"[",
"DiscussionRenamedBlueprint",
"::",
"class",
"=>",
"[",
"'alert'",
"]",
"]",
";",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'events'",
")",
"->",
"fire",
"("... | Register notification types. | [
"Register",
"notification",
"types",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Notification/NotificationServiceProvider.php#L33-L63 | train |
flarum/core | src/Frontend/Compiler/RevisionCompiler.php | RevisionCompiler.getFilenameForRevision | protected function getFilenameForRevision(string $revision): string
{
$ext = pathinfo($this->filename, PATHINFO_EXTENSION);
return substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
} | php | protected function getFilenameForRevision(string $revision): string
{
$ext = pathinfo($this->filename, PATHINFO_EXTENSION);
return substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
} | [
"protected",
"function",
"getFilenameForRevision",
"(",
"string",
"$",
"revision",
")",
":",
"string",
"{",
"$",
"ext",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"filename",
",",
"PATHINFO_EXTENSION",
")",
";",
"return",
"substr_replace",
"(",
"$",
"this",
"-... | Get the filename for the given revision.
@param string $revision
@return string | [
"Get",
"the",
"filename",
"for",
"the",
"given",
"revision",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Frontend/Compiler/RevisionCompiler.php#L190-L195 | train |
flarum/core | src/Notification/NotificationRepository.php | NotificationRepository.findByUser | public function findByUser(User $user, $limit = null, $offset = 0)
{
$primaries = Notification::select(
app('flarum.db')->raw('MAX(id) AS id'),
app('flarum.db')->raw('SUM(read_at IS NULL) AS unread_count')
)
->where('user_id', $user->id)
->whereIn('typ... | php | public function findByUser(User $user, $limit = null, $offset = 0)
{
$primaries = Notification::select(
app('flarum.db')->raw('MAX(id) AS id'),
app('flarum.db')->raw('SUM(read_at IS NULL) AS unread_count')
)
->where('user_id', $user->id)
->whereIn('typ... | [
"public",
"function",
"findByUser",
"(",
"User",
"$",
"user",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"primaries",
"=",
"Notification",
"::",
"select",
"(",
"app",
"(",
"'flarum.db'",
")",
"->",
"raw",
"(",
"'MAX(... | Find a user's notifications.
@param User $user
@param int|null $limit
@param int $offset
@return \Illuminate\Database\Eloquent\Collection | [
"Find",
"a",
"user",
"s",
"notifications",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Notification/NotificationRepository.php#L27-L47 | train |
flarum/core | src/Notification/NotificationRepository.php | NotificationRepository.markAllAsRead | public function markAllAsRead(User $user)
{
Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]);
} | php | public function markAllAsRead(User $user)
{
Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]);
} | [
"public",
"function",
"markAllAsRead",
"(",
"User",
"$",
"user",
")",
"{",
"Notification",
"::",
"where",
"(",
"'user_id'",
",",
"$",
"user",
"->",
"id",
")",
"->",
"update",
"(",
"[",
"'read_at'",
"=>",
"Carbon",
"::",
"now",
"(",
")",
"]",
")",
";"... | Mark all of a user's notifications as read.
@param User $user
@return void | [
"Mark",
"all",
"of",
"a",
"user",
"s",
"notifications",
"as",
"read",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Notification/NotificationRepository.php#L56-L59 | train |
flarum/core | src/Http/AccessToken.php | AccessToken.generate | public static function generate($userId, $lifetime = 3600)
{
$token = new static;
$token->token = str_random(40);
$token->user_id = $userId;
$token->created_at = Carbon::now();
$token->last_activity_at = Carbon::now();
$token->lifetime_seconds = $lifetime;
r... | php | public static function generate($userId, $lifetime = 3600)
{
$token = new static;
$token->token = str_random(40);
$token->user_id = $userId;
$token->created_at = Carbon::now();
$token->last_activity_at = Carbon::now();
$token->lifetime_seconds = $lifetime;
r... | [
"public",
"static",
"function",
"generate",
"(",
"$",
"userId",
",",
"$",
"lifetime",
"=",
"3600",
")",
"{",
"$",
"token",
"=",
"new",
"static",
";",
"$",
"token",
"->",
"token",
"=",
"str_random",
"(",
"40",
")",
";",
"$",
"token",
"->",
"user_id",
... | Generate an access token for the specified user.
@param int $userId
@param int $lifetime
@return static | [
"Generate",
"an",
"access",
"token",
"for",
"the",
"specified",
"user",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Http/AccessToken.php#L46-L57 | train |
flarum/core | src/Http/RouteCollectionUrlGenerator.php | RouteCollectionUrlGenerator.route | public function route($name, $parameters = [])
{
$path = $this->routes->getPath($name, $parameters);
$path = ltrim($path, '/');
return $this->baseUrl.'/'.$path;
} | php | public function route($name, $parameters = [])
{
$path = $this->routes->getPath($name, $parameters);
$path = ltrim($path, '/');
return $this->baseUrl.'/'.$path;
} | [
"public",
"function",
"route",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"routes",
"->",
"getPath",
"(",
"$",
"name",
",",
"$",
"parameters",
")",
";",
"$",
"path",
"=",
"ltrim",
"(",
... | Generate a URL to a named route.
@param string $name
@param array $parameters
@return string | [
"Generate",
"a",
"URL",
"to",
"a",
"named",
"route",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Http/RouteCollectionUrlGenerator.php#L43-L49 | train |
flarum/core | src/Foundation/AbstractValidator.php | AbstractValidator.assertValid | public function assertValid(array $attributes)
{
$validator = $this->makeValidator($attributes);
if ($validator->fails()) {
throw new ValidationException($validator);
}
} | php | public function assertValid(array $attributes)
{
$validator = $this->makeValidator($attributes);
if ($validator->fails()) {
throw new ValidationException($validator);
}
} | [
"public",
"function",
"assertValid",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"makeValidator",
"(",
"$",
"attributes",
")",
";",
"if",
"(",
"$",
"validator",
"->",
"fails",
"(",
")",
")",
"{",
"throw",
"new",... | Throw an exception if a model is not valid.
@param array $attributes | [
"Throw",
"an",
"exception",
"if",
"a",
"model",
"is",
"not",
"valid",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Foundation/AbstractValidator.php#L59-L66 | train |
flarum/core | src/Foundation/AbstractValidator.php | AbstractValidator.makeValidator | protected function makeValidator(array $attributes)
{
$rules = array_only($this->getRules(), array_keys($attributes));
$validator = $this->validator->make($attributes, $rules, $this->getMessages());
$this->events->dispatch(
new Validating($this, $validator)
);
... | php | protected function makeValidator(array $attributes)
{
$rules = array_only($this->getRules(), array_keys($attributes));
$validator = $this->validator->make($attributes, $rules, $this->getMessages());
$this->events->dispatch(
new Validating($this, $validator)
);
... | [
"protected",
"function",
"makeValidator",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"rules",
"=",
"array_only",
"(",
"$",
"this",
"->",
"getRules",
"(",
")",
",",
"array_keys",
"(",
"$",
"attributes",
")",
")",
";",
"$",
"validator",
"=",
"$",
"t... | Make a new validator instance for this model.
@param array $attributes
@return \Illuminate\Validation\Validator | [
"Make",
"a",
"new",
"validator",
"instance",
"for",
"this",
"model",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Foundation/AbstractValidator.php#L90-L101 | train |
flarum/core | src/Forum/Content/Index.php | Index.getApiDocument | private function getApiDocument(User $actor, array $params)
{
return json_decode($this->api->send(ListDiscussionsController::class, $actor, $params)->getBody());
} | php | private function getApiDocument(User $actor, array $params)
{
return json_decode($this->api->send(ListDiscussionsController::class, $actor, $params)->getBody());
} | [
"private",
"function",
"getApiDocument",
"(",
"User",
"$",
"actor",
",",
"array",
"$",
"params",
")",
"{",
"return",
"json_decode",
"(",
"$",
"this",
"->",
"api",
"->",
"send",
"(",
"ListDiscussionsController",
"::",
"class",
",",
"$",
"actor",
",",
"$",
... | Get the result of an API request to list discussions.
@param User $actor
@param array $params
@return object | [
"Get",
"the",
"result",
"of",
"an",
"API",
"request",
"to",
"list",
"discussions",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Forum/Content/Index.php#L89-L92 | train |
flarum/core | src/Api/ApiServiceProvider.php | ApiServiceProvider.registerNotificationSerializers | protected function registerNotificationSerializers()
{
$blueprints = [];
$serializers = [
'discussionRenamed' => BasicDiscussionSerializer::class
];
$this->app->make('events')->fire(
new ConfigureNotificationTypes($blueprints, $serializers)
);
... | php | protected function registerNotificationSerializers()
{
$blueprints = [];
$serializers = [
'discussionRenamed' => BasicDiscussionSerializer::class
];
$this->app->make('events')->fire(
new ConfigureNotificationTypes($blueprints, $serializers)
);
... | [
"protected",
"function",
"registerNotificationSerializers",
"(",
")",
"{",
"$",
"blueprints",
"=",
"[",
"]",
";",
"$",
"serializers",
"=",
"[",
"'discussionRenamed'",
"=>",
"BasicDiscussionSerializer",
"::",
"class",
"]",
";",
"$",
"this",
"->",
"app",
"->",
"... | Register notification serializers. | [
"Register",
"notification",
"serializers",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Api/ApiServiceProvider.php#L108-L122 | train |
flarum/core | src/Api/ApiServiceProvider.php | ApiServiceProvider.populateRoutes | protected function populateRoutes(RouteCollection $routes)
{
$factory = $this->app->make(RouteHandlerFactory::class);
$callback = include __DIR__.'/routes.php';
$callback($routes, $factory);
$this->app->make('events')->fire(
new ConfigureApiRoutes($routes, $factory)
... | php | protected function populateRoutes(RouteCollection $routes)
{
$factory = $this->app->make(RouteHandlerFactory::class);
$callback = include __DIR__.'/routes.php';
$callback($routes, $factory);
$this->app->make('events')->fire(
new ConfigureApiRoutes($routes, $factory)
... | [
"protected",
"function",
"populateRoutes",
"(",
"RouteCollection",
"$",
"routes",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"RouteHandlerFactory",
"::",
"class",
")",
";",
"$",
"callback",
"=",
"include",
"__DIR__",
".",
"... | Populate the API routes.
@param RouteCollection $routes | [
"Populate",
"the",
"API",
"routes",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Api/ApiServiceProvider.php#L129-L139 | train |
flarum/core | src/User/User.php | User.rename | public function rename($username)
{
if ($username !== $this->username) {
$oldUsername = $this->username;
$this->username = $username;
$this->raise(new Renamed($this, $oldUsername));
}
return $this;
} | php | public function rename($username)
{
if ($username !== $this->username) {
$oldUsername = $this->username;
$this->username = $username;
$this->raise(new Renamed($this, $oldUsername));
}
return $this;
} | [
"public",
"function",
"rename",
"(",
"$",
"username",
")",
"{",
"if",
"(",
"$",
"username",
"!==",
"$",
"this",
"->",
"username",
")",
"{",
"$",
"oldUsername",
"=",
"$",
"this",
"->",
"username",
";",
"$",
"this",
"->",
"username",
"=",
"$",
"usernam... | Rename the user.
@param string $username
@return $this | [
"Rename",
"the",
"user",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L179-L189 | train |
flarum/core | src/User/User.php | User.changeEmail | public function changeEmail($email)
{
if ($email !== $this->email) {
$this->email = $email;
$this->raise(new EmailChanged($this));
}
return $this;
} | php | public function changeEmail($email)
{
if ($email !== $this->email) {
$this->email = $email;
$this->raise(new EmailChanged($this));
}
return $this;
} | [
"public",
"function",
"changeEmail",
"(",
"$",
"email",
")",
"{",
"if",
"(",
"$",
"email",
"!==",
"$",
"this",
"->",
"email",
")",
"{",
"$",
"this",
"->",
"email",
"=",
"$",
"email",
";",
"$",
"this",
"->",
"raise",
"(",
"new",
"EmailChanged",
"(",... | Change the user's email.
@param string $email
@return $this | [
"Change",
"the",
"user",
"s",
"email",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L197-L206 | train |
flarum/core | src/User/User.php | User.requestEmailChange | public function requestEmailChange($email)
{
if ($email !== $this->email) {
$this->raise(new EmailChangeRequested($this, $email));
}
return $this;
} | php | public function requestEmailChange($email)
{
if ($email !== $this->email) {
$this->raise(new EmailChangeRequested($this, $email));
}
return $this;
} | [
"public",
"function",
"requestEmailChange",
"(",
"$",
"email",
")",
"{",
"if",
"(",
"$",
"email",
"!==",
"$",
"this",
"->",
"email",
")",
"{",
"$",
"this",
"->",
"raise",
"(",
"new",
"EmailChangeRequested",
"(",
"$",
"this",
",",
"$",
"email",
")",
"... | Request that the user's email be changed.
@param string $email
@return $this | [
"Request",
"that",
"the",
"user",
"s",
"email",
"be",
"changed",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L214-L221 | train |
flarum/core | src/User/User.php | User.changeAvatarPath | public function changeAvatarPath($path)
{
$this->avatar_url = $path;
$this->raise(new AvatarChanged($this));
return $this;
} | php | public function changeAvatarPath($path)
{
$this->avatar_url = $path;
$this->raise(new AvatarChanged($this));
return $this;
} | [
"public",
"function",
"changeAvatarPath",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"avatar_url",
"=",
"$",
"path",
";",
"$",
"this",
"->",
"raise",
"(",
"new",
"AvatarChanged",
"(",
"$",
"this",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Change the path of the user avatar.
@param string $path
@return $this | [
"Change",
"the",
"path",
"of",
"the",
"user",
"avatar",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L278-L285 | train |
flarum/core | src/User/User.php | User.getAvatarUrlAttribute | public function getAvatarUrlAttribute(string $value = null)
{
if ($value && strpos($value, '://') === false) {
return app(UrlGenerator::class)->to('forum')->path('assets/avatars/'.$value);
}
return $value;
} | php | public function getAvatarUrlAttribute(string $value = null)
{
if ($value && strpos($value, '://') === false) {
return app(UrlGenerator::class)->to('forum')->path('assets/avatars/'.$value);
}
return $value;
} | [
"public",
"function",
"getAvatarUrlAttribute",
"(",
"string",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"&&",
"strpos",
"(",
"$",
"value",
",",
"'://'",
")",
"===",
"false",
")",
"{",
"return",
"app",
"(",
"UrlGenerator",
"::",
"cla... | Get the URL of the user's avatar.
@todo Allow different storage locations to be used
@param string|null $value
@return string | [
"Get",
"the",
"URL",
"of",
"the",
"user",
"s",
"avatar",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L294-L301 | train |
flarum/core | src/User/User.php | User.checkPassword | public function checkPassword($password)
{
$valid = static::$dispatcher->until(new CheckingPassword($this, $password));
if ($valid !== null) {
return $valid;
}
return static::$hasher->check($password, $this->password);
} | php | public function checkPassword($password)
{
$valid = static::$dispatcher->until(new CheckingPassword($this, $password));
if ($valid !== null) {
return $valid;
}
return static::$hasher->check($password, $this->password);
} | [
"public",
"function",
"checkPassword",
"(",
"$",
"password",
")",
"{",
"$",
"valid",
"=",
"static",
"::",
"$",
"dispatcher",
"->",
"until",
"(",
"new",
"CheckingPassword",
"(",
"$",
"this",
",",
"$",
"password",
")",
")",
";",
"if",
"(",
"$",
"valid",
... | Check if a given password matches the user's password.
@param string $password
@return bool | [
"Check",
"if",
"a",
"given",
"password",
"matches",
"the",
"user",
"s",
"password",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L319-L328 | train |
flarum/core | src/User/User.php | User.activate | public function activate()
{
if ($this->is_email_confirmed !== true) {
$this->is_email_confirmed = true;
$this->raise(new Activated($this));
}
return $this;
} | php | public function activate()
{
if ($this->is_email_confirmed !== true) {
$this->is_email_confirmed = true;
$this->raise(new Activated($this));
}
return $this;
} | [
"public",
"function",
"activate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_email_confirmed",
"!==",
"true",
")",
"{",
"$",
"this",
"->",
"is_email_confirmed",
"=",
"true",
";",
"$",
"this",
"->",
"raise",
"(",
"new",
"Activated",
"(",
"$",
"thi... | Activate the user's account.
@return $this | [
"Activate",
"the",
"user",
"s",
"account",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L335-L344 | train |
flarum/core | src/User/User.php | User.hasPermission | public function hasPermission($permission)
{
if ($this->isAdmin()) {
return true;
}
if (is_null($this->permissions)) {
$this->permissions = $this->getPermissions();
}
return in_array($permission, $this->permissions);
} | php | public function hasPermission($permission)
{
if ($this->isAdmin()) {
return true;
}
if (is_null($this->permissions)) {
$this->permissions = $this->getPermissions();
}
return in_array($permission, $this->permissions);
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAdmin",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"permissions",
")",
")",
"{",
"$",
"this... | Check whether the user has a certain permission based on their groups.
@param string $permission
@return bool | [
"Check",
"whether",
"the",
"user",
"has",
"a",
"certain",
"permission",
"based",
"on",
"their",
"groups",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L352-L363 | train |
flarum/core | src/User/User.php | User.hasPermissionLike | public function hasPermissionLike($match)
{
if ($this->isAdmin()) {
return true;
}
if (is_null($this->permissions)) {
$this->permissions = $this->getPermissions();
}
foreach ($this->permissions as $permission) {
if (substr($permission, -s... | php | public function hasPermissionLike($match)
{
if ($this->isAdmin()) {
return true;
}
if (is_null($this->permissions)) {
$this->permissions = $this->getPermissions();
}
foreach ($this->permissions as $permission) {
if (substr($permission, -s... | [
"public",
"function",
"hasPermissionLike",
"(",
"$",
"match",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAdmin",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"permissions",
")",
")",
"{",
"$",
"this"... | Check whether the user has a permission that is like the given string,
based on their groups.
@param string $match
@return bool | [
"Check",
"whether",
"the",
"user",
"has",
"a",
"permission",
"that",
"is",
"like",
"the",
"given",
"string",
"based",
"on",
"their",
"groups",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L372-L389 | train |
flarum/core | src/User/User.php | User.getUnreadNotifications | protected function getUnreadNotifications()
{
static $cached = null;
if (is_null($cached)) {
$cached = $this->notifications()
->whereIn('type', $this->getAlertableNotificationTypes())
->whereNull('read_at')
->where('is_deleted', false)
... | php | protected function getUnreadNotifications()
{
static $cached = null;
if (is_null($cached)) {
$cached = $this->notifications()
->whereIn('type', $this->getAlertableNotificationTypes())
->whereNull('read_at')
->where('is_deleted', false)
... | [
"protected",
"function",
"getUnreadNotifications",
"(",
")",
"{",
"static",
"$",
"cached",
"=",
"null",
";",
"if",
"(",
"is_null",
"(",
"$",
"cached",
")",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"notifications",
"(",
")",
"->",
"whereIn",
"("... | Get all notifications that have not been read yet.
@return \Illuminate\Database\Eloquent\Collection | [
"Get",
"all",
"notifications",
"that",
"have",
"not",
"been",
"read",
"yet",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L419-L433 | train |
flarum/core | src/User/User.php | User.getNewNotificationCount | public function getNewNotificationCount()
{
return $this->getUnreadNotifications()->filter(function ($notification) {
return $notification->created_at > $this->read_notifications_at ?: 0;
})->count();
} | php | public function getNewNotificationCount()
{
return $this->getUnreadNotifications()->filter(function ($notification) {
return $notification->created_at > $this->read_notifications_at ?: 0;
})->count();
} | [
"public",
"function",
"getNewNotificationCount",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getUnreadNotifications",
"(",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"notification",
")",
"{",
"return",
"$",
"notification",
"->",
"created_at",
">",
"$",
... | Get the number of new, unseen notifications for the user.
@return int | [
"Get",
"the",
"number",
"of",
"new",
"unseen",
"notifications",
"for",
"the",
"user",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L440-L445 | train |
flarum/core | src/User/User.php | User.getPreferencesAttribute | public function getPreferencesAttribute($value)
{
$defaults = array_map(function ($value) {
return $value['default'];
}, static::$preferences);
$user = array_only((array) json_decode($value, true), array_keys(static::$preferences));
return array_merge($defaults, $user);... | php | public function getPreferencesAttribute($value)
{
$defaults = array_map(function ($value) {
return $value['default'];
}, static::$preferences);
$user = array_only((array) json_decode($value, true), array_keys(static::$preferences));
return array_merge($defaults, $user);... | [
"public",
"function",
"getPreferencesAttribute",
"(",
"$",
"value",
")",
"{",
"$",
"defaults",
"=",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"$",
"value",
"[",
"'default'",
"]",
";",
"}",
",",
"static",
"::",
"$",
"preferences... | Get the values of all registered preferences for this user, by
transforming their stored preferences and merging them with the defaults.
@param string $value
@return array | [
"Get",
"the",
"values",
"of",
"all",
"registered",
"preferences",
"for",
"this",
"user",
"by",
"transforming",
"their",
"stored",
"preferences",
"and",
"merging",
"them",
"with",
"the",
"defaults",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L454-L463 | train |
flarum/core | src/User/User.php | User.setPreference | public function setPreference($key, $value)
{
if (isset(static::$preferences[$key])) {
$preferences = $this->preferences;
if (! is_null($transformer = static::$preferences[$key]['transformer'])) {
$preferences[$key] = call_user_func($transformer, $value);
... | php | public function setPreference($key, $value)
{
if (isset(static::$preferences[$key])) {
$preferences = $this->preferences;
if (! is_null($transformer = static::$preferences[$key]['transformer'])) {
$preferences[$key] = call_user_func($transformer, $value);
... | [
"public",
"function",
"setPreference",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"preferences",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"preferences",
"=",
"$",
"this",
"->",
"preferences",
";",
"... | Set the value of a preference for this user.
@param string $key
@param mixed $value
@return $this | [
"Set",
"the",
"value",
"of",
"a",
"preference",
"for",
"this",
"user",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L518-L533 | train |
flarum/core | src/User/User.php | User.permissions | public function permissions()
{
$groupIds = [Group::GUEST_ID];
// If a user's account hasn't been activated, they are essentially no
// more than a guest. If they are activated, we can give them the
// standard 'member' group, as well as any other groups they've been
// assi... | php | public function permissions()
{
$groupIds = [Group::GUEST_ID];
// If a user's account hasn't been activated, they are essentially no
// more than a guest. If they are activated, we can give them the
// standard 'member' group, as well as any other groups they've been
// assi... | [
"public",
"function",
"permissions",
"(",
")",
"{",
"$",
"groupIds",
"=",
"[",
"Group",
"::",
"GUEST_ID",
"]",
";",
"// If a user's account hasn't been activated, they are essentially no",
"// more than a guest. If they are activated, we can give them the",
"// standard 'member' gr... | Define the relationship with the permissions of all of the groups that
the user is in.
@return \Illuminate\Database\Eloquent\Builder | [
"Define",
"the",
"relationship",
"with",
"the",
"permissions",
"of",
"all",
"of",
"the",
"groups",
"that",
"the",
"user",
"is",
"in",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/User.php#L633-L648 | train |
flarum/core | src/Http/CookieFactory.php | CookieFactory.make | public function make($name, $value = null, $maxAge = null)
{
$cookie = SetCookie::create($this->getName($name), $value);
// Make sure we send both the MaxAge and Expires parameters (the former
// is not supported by all browser versions)
if ($maxAge) {
$cookie = $cookie
... | php | public function make($name, $value = null, $maxAge = null)
{
$cookie = SetCookie::create($this->getName($name), $value);
// Make sure we send both the MaxAge and Expires parameters (the former
// is not supported by all browser versions)
if ($maxAge) {
$cookie = $cookie
... | [
"public",
"function",
"make",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"maxAge",
"=",
"null",
")",
"{",
"$",
"cookie",
"=",
"SetCookie",
"::",
"create",
"(",
"$",
"this",
"->",
"getName",
"(",
"$",
"name",
")",
",",
"$",
"value... | Make a new cookie instance.
This method returns a cookie instance for use with the Set-Cookie HTTP header.
It will be pre-configured according to Flarum's base URL and protocol.
@param string $name
@param string $value
@param int $maxAge
@return \Dflydev\FigCookies\SetCookie | [
"Make",
"a",
"new",
"cookie",
"instance",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Http/CookieFactory.php#L73-L93 | train |
flarum/core | src/User/UserRepository.php | UserRepository.getIdForUsername | public function getIdForUsername($username, User $actor = null)
{
$query = User::where('username', 'like', $username);
return $this->scopeVisibleTo($query, $actor)->value('id');
} | php | public function getIdForUsername($username, User $actor = null)
{
$query = User::where('username', 'like', $username);
return $this->scopeVisibleTo($query, $actor)->value('id');
} | [
"public",
"function",
"getIdForUsername",
"(",
"$",
"username",
",",
"User",
"$",
"actor",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"User",
"::",
"where",
"(",
"'username'",
",",
"'like'",
",",
"$",
"username",
")",
";",
"return",
"$",
"this",
"->",
... | Get the ID of a user with the given username.
@param string $username
@param User|null $actor
@return int|null | [
"Get",
"the",
"ID",
"of",
"a",
"user",
"with",
"the",
"given",
"username",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/UserRepository.php#L76-L81 | train |
flarum/core | src/User/UserRepository.php | UserRepository.getIdsForUsername | public function getIdsForUsername($string, User $actor = null)
{
$string = $this->escapeLikeString($string);
$query = User::where('username', 'like', '%'.$string.'%')
->orderByRaw('username = ? desc', [$string])
->orderByRaw('username like ? desc', [$string.'%']);
r... | php | public function getIdsForUsername($string, User $actor = null)
{
$string = $this->escapeLikeString($string);
$query = User::where('username', 'like', '%'.$string.'%')
->orderByRaw('username = ? desc', [$string])
->orderByRaw('username like ? desc', [$string.'%']);
r... | [
"public",
"function",
"getIdsForUsername",
"(",
"$",
"string",
",",
"User",
"$",
"actor",
"=",
"null",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"escapeLikeString",
"(",
"$",
"string",
")",
";",
"$",
"query",
"=",
"User",
"::",
"where",
"(",
"... | Find users by matching a string of words against their username,
optionally making sure they are visible to a certain user.
@param string $string
@param User|null $actor
@return array | [
"Find",
"users",
"by",
"matching",
"a",
"string",
"of",
"words",
"against",
"their",
"username",
"optionally",
"making",
"sure",
"they",
"are",
"visible",
"to",
"a",
"certain",
"user",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/User/UserRepository.php#L91-L100 | train |
flarum/core | src/Group/Group.php | Group.rename | public function rename($nameSingular, $namePlural)
{
$this->name_singular = $nameSingular;
$this->name_plural = $namePlural;
$this->raise(new Renamed($this));
return $this;
} | php | public function rename($nameSingular, $namePlural)
{
$this->name_singular = $nameSingular;
$this->name_plural = $namePlural;
$this->raise(new Renamed($this));
return $this;
} | [
"public",
"function",
"rename",
"(",
"$",
"nameSingular",
",",
"$",
"namePlural",
")",
"{",
"$",
"this",
"->",
"name_singular",
"=",
"$",
"nameSingular",
";",
"$",
"this",
"->",
"name_plural",
"=",
"$",
"namePlural",
";",
"$",
"this",
"->",
"raise",
"(",... | Rename the group.
@param string $nameSingular
@param string $namePlural
@return $this | [
"Rename",
"the",
"group",
"."
] | 99a6066f96899c15145eff80bb3ad3e97ff24c29 | https://github.com/flarum/core/blob/99a6066f96899c15145eff80bb3ad3e97ff24c29/src/Group/Group.php#L100-L108 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.