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 |
---|---|---|---|---|---|---|---|---|---|---|---|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeTeamRestrictions
|
public function removeTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
php
|
public function removeTeamRestrictions($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
}
|
[
"public",
"function",
"removeTeamRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/teams'",
",",
"$",
"params",
")",
";",
"}"
] |
Remove team restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-team-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of team slugs with push access
@return array The updated branch team restrictions information
|
[
"Remove",
"team",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L370-L373
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.showUserRestrictions
|
public function showUserRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users');
}
|
php
|
public function showUserRestrictions($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users');
}
|
[
"public",
"function",
"showUserRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/users'",
")",
";",
"}"
] |
List user restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#list-user-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@return array The branch user restrictions information
|
[
"List",
"user",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L386-L389
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.replaceUserRestrictions
|
public function replaceUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
php
|
public function replaceUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
[
"public",
"function",
"replaceUserRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/users'",
",",
"$",
"params",
")",
";",
"}"
] |
Replace user restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#replace-user-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of user logins with push access
@return array The new branch user restrictions information
|
[
"Replace",
"user",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L403-L406
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.addUserRestrictions
|
public function addUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
php
|
public function addUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
[
"public",
"function",
"addUserRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/users'",
",",
"$",
"params",
")",
";",
"}"
] |
Add user restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#add-user-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of user logins with push access
@return array The branch user restrictions information
|
[
"Add",
"user",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L420-L423
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Protection.php
|
Protection.removeUserRestrictions
|
public function removeUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
php
|
public function removeUserRestrictions($username, $repository, $branch, array $params = [])
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
}
|
[
"public",
"function",
"removeUserRestrictions",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"branch",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/branches/'",
".",
"rawurlencode",
"(",
"$",
"branch",
")",
".",
"'/protection/restrictions/users'",
",",
"$",
"params",
")",
";",
"}"
] |
Remove user restrictions of protected branch.
@link https://developer.github.com/v3/repos/branches/#remove-user-restrictions-of-protected-branch
@param string $username The user who owns the repository
@param string $repository The name of the repo
@param string $branch The name of the branch
@param array $params The list of user logins with push access
@return array The updated branch user restrictions information
|
[
"Remove",
"user",
"restrictions",
"of",
"protected",
"branch",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Protection.php#L437-L440
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/CurrentUser/Emails.php
|
Emails.add
|
public function add($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->post('/user/emails', $emails);
}
|
php
|
public function add($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->post('/user/emails', $emails);
}
|
[
"public",
"function",
"add",
"(",
"$",
"emails",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"emails",
")",
")",
"{",
"$",
"emails",
"=",
"[",
"$",
"emails",
"]",
";",
"}",
"elseif",
"(",
"0",
"===",
"count",
"(",
"$",
"emails",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The user emails parameter should be a single email or an array of emails'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/user/emails'",
",",
"$",
"emails",
")",
";",
"}"
] |
Adds one or more email for the authenticated user.
@link http://developer.github.com/v3/users/emails/
@param string|array $emails
@throws \Github\Exception\InvalidArgumentException
@return array
|
[
"Adds",
"one",
"or",
"more",
"email",
"for",
"the",
"authenticated",
"user",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/CurrentUser/Emails.php#L50-L59
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/CurrentUser/Emails.php
|
Emails.remove
|
public function remove($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->delete('/user/emails', $emails);
}
|
php
|
public function remove($emails)
{
if (is_string($emails)) {
$emails = [$emails];
} elseif (0 === count($emails)) {
throw new InvalidArgumentException('The user emails parameter should be a single email or an array of emails');
}
return $this->delete('/user/emails', $emails);
}
|
[
"public",
"function",
"remove",
"(",
"$",
"emails",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"emails",
")",
")",
"{",
"$",
"emails",
"=",
"[",
"$",
"emails",
"]",
";",
"}",
"elseif",
"(",
"0",
"===",
"count",
"(",
"$",
"emails",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The user emails parameter should be a single email or an array of emails'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/user/emails'",
",",
"$",
"emails",
")",
";",
"}"
] |
Removes one or more email for the authenticated user.
@link http://developer.github.com/v3/users/emails/
@param string|array $emails
@throws \Github\Exception\InvalidArgumentException
@return array
|
[
"Removes",
"one",
"or",
"more",
"email",
"for",
"the",
"authenticated",
"user",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/CurrentUser/Emails.php#L72-L81
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Repository/Releases.php
|
Releases.tag
|
public function tag($username, $repository, $tag)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/tags/'.rawurlencode($tag));
}
|
php
|
public function tag($username, $repository, $tag)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/tags/'.rawurlencode($tag));
}
|
[
"public",
"function",
"tag",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"tag",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/releases/tags/'",
".",
"rawurlencode",
"(",
"$",
"tag",
")",
")",
";",
"}"
] |
List releases for a tag.
@param string $username
@param string $repository
@param string $tag
@return array
|
[
"List",
"releases",
"for",
"a",
"tag",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Repository/Releases.php#L38-L41
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.all
|
public function all($username, $repository, $issue = null)
{
if ($issue === null) {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels';
} else {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels';
}
return $this->get($path);
}
|
php
|
public function all($username, $repository, $issue = null)
{
if ($issue === null) {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels';
} else {
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels';
}
return $this->get($path);
}
|
[
"public",
"function",
"all",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"issue",
"===",
"null",
")",
"{",
"$",
"path",
"=",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/labels'",
";",
"}",
"else",
"{",
"$",
"path",
"=",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/labels'",
";",
"}",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"path",
")",
";",
"}"
] |
Get all labels for a repository or the labels for a specific issue.
@link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
@param string $username
@param string $repository
@param int|null $issue
@return array
|
[
"Get",
"all",
"labels",
"for",
"a",
"repository",
"or",
"the",
"labels",
"for",
"a",
"specific",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L27-L36
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.show
|
public function show($username, $repository, $label)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
|
php
|
public function show($username, $repository, $label)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
|
[
"public",
"function",
"show",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"label",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/labels/'",
".",
"rawurlencode",
"(",
"$",
"label",
")",
")",
";",
"}"
] |
Get a single label.
@link https://developer.github.com/v3/issues/labels/#get-a-single-label
@param string $username
@param string $repository
@param string $label
@return array
|
[
"Get",
"a",
"single",
"label",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L49-L52
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.deleteLabel
|
public function deleteLabel($username, $repository, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
|
php
|
public function deleteLabel($username, $repository, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
}
|
[
"public",
"function",
"deleteLabel",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"label",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/labels/'",
".",
"rawurlencode",
"(",
"$",
"label",
")",
")",
";",
"}"
] |
Delete a label for a repository.
@link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
@param string $username
@param string $repository
@param string $label
@return array
|
[
"Delete",
"a",
"label",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L90-L93
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.update
|
public function update($username, $repository, $label, $newName, $color)
{
$params = [
'name' => $newName,
'color' => $color,
];
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params);
}
|
php
|
public function update($username, $repository, $label, $newName, $color)
{
$params = [
'name' => $newName,
'color' => $color,
];
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params);
}
|
[
"public",
"function",
"update",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"label",
",",
"$",
"newName",
",",
"$",
"color",
")",
"{",
"$",
"params",
"=",
"[",
"'name'",
"=>",
"$",
"newName",
",",
"'color'",
"=>",
"$",
"color",
",",
"]",
";",
"return",
"$",
"this",
"->",
"patch",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/labels/'",
".",
"rawurlencode",
"(",
"$",
"label",
")",
",",
"$",
"params",
")",
";",
"}"
] |
Edit a label for a repository.
@link https://developer.github.com/v3/issues/labels/#update-a-label
@param string $username
@param string $repository
@param string $label
@param string $newName
@param string $color
@return array
|
[
"Edit",
"a",
"label",
"for",
"a",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L108-L116
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.add
|
public function add($username, $repository, $issue, $labels)
{
if (is_string($labels)) {
$labels = [$labels];
} elseif (0 === count($labels)) {
throw new InvalidArgumentException('The labels parameter should be a single label or an array of labels');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels);
}
|
php
|
public function add($username, $repository, $issue, $labels)
{
if (is_string($labels)) {
$labels = [$labels];
} elseif (0 === count($labels)) {
throw new InvalidArgumentException('The labels parameter should be a single label or an array of labels');
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels);
}
|
[
"public",
"function",
"add",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
",",
"$",
"labels",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"labels",
")",
")",
"{",
"$",
"labels",
"=",
"[",
"$",
"labels",
"]",
";",
"}",
"elseif",
"(",
"0",
"===",
"count",
"(",
"$",
"labels",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The labels parameter should be a single label or an array of labels'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"post",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/labels'",
",",
"$",
"labels",
")",
";",
"}"
] |
Add a label to an issue.
@link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
@param string $username
@param string $repository
@param int $issue
@param string|array $labels
@return array
@thorws \Github\Exception\InvalidArgumentException
|
[
"Add",
"a",
"label",
"to",
"an",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L132-L141
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.replace
|
public function replace($username, $repository, $issue, array $params)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params);
}
|
php
|
public function replace($username, $repository, $issue, array $params)
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params);
}
|
[
"public",
"function",
"replace",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
",",
"array",
"$",
"params",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/labels'",
",",
"$",
"params",
")",
";",
"}"
] |
Replace labels for an issue.
@link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
@param string $username
@param string $repository
@param int $issue
@param array $params
@return array
|
[
"Replace",
"labels",
"for",
"an",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L155-L158
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.remove
|
public function remove($username, $repository, $issue, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label));
}
|
php
|
public function remove($username, $repository, $issue, $label)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label));
}
|
[
"public",
"function",
"remove",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
",",
"$",
"label",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/labels/'",
".",
"rawurlencode",
"(",
"$",
"label",
")",
")",
";",
"}"
] |
Remove a label for an issue.
@link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
@param string $username
@param string $repository
@param string $issue
@param string $label
@return array|string
|
[
"Remove",
"a",
"label",
"for",
"an",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L172-L175
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Issue/Labels.php
|
Labels.clear
|
public function clear($username, $repository, $issue)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels');
}
|
php
|
public function clear($username, $repository, $issue)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels');
}
|
[
"public",
"function",
"clear",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"$",
"issue",
")",
"{",
"return",
"$",
"this",
"->",
"delete",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/issues/'",
".",
"rawurlencode",
"(",
"$",
"issue",
")",
".",
"'/labels'",
")",
";",
"}"
] |
Remove all labels from an issue.
@link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
@param string $username
@param string $repository
@param string $issue
@return array|string
|
[
"Remove",
"all",
"labels",
"from",
"an",
"issue",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Issue/Labels.php#L188-L191
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/CurrentUser/Notifications.php
|
Notifications.allInRepository
|
public function allInRepository($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
|
php
|
public function allInRepository($username, $repository, array $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
|
[
"public",
"function",
"allInRepository",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/notifications'",
",",
"$",
"params",
")",
";",
"}"
] |
List all notifications for the authenticated user in selected repository.
@link http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
@param string $username the user who owns the repo
@param string $repository the name of the repo
@param array $params
@return array
|
[
"List",
"all",
"notifications",
"for",
"the",
"authenticated",
"user",
"in",
"selected",
"repository",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/CurrentUser/Notifications.php#L39-L42
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/CurrentUser/Notifications.php
|
Notifications.markAsReadInRepository
|
public function markAsReadInRepository($username, $repository, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
|
php
|
public function markAsReadInRepository($username, $repository, array $params = [])
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
}
|
[
"public",
"function",
"markAsReadInRepository",
"(",
"$",
"username",
",",
"$",
"repository",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"'/repos/'",
".",
"rawurlencode",
"(",
"$",
"username",
")",
".",
"'/'",
".",
"rawurlencode",
"(",
"$",
"repository",
")",
".",
"'/notifications'",
",",
"$",
"params",
")",
";",
"}"
] |
Mark all notifications for a repository as read.
@link http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
@param string $username the user who owns the repo
@param string $repository the name of the repo
@param array $params
@return array
|
[
"Mark",
"all",
"notifications",
"for",
"a",
"repository",
"as",
"read",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/CurrentUser/Notifications.php#L69-L72
|
train
|
KnpLabs/php-github-api
|
lib/Github/Api/Authorizations.php
|
Authorizations.create
|
public function create(array $params, $OTPCode = null)
{
$headers = null === $OTPCode ? [] : ['X-GitHub-OTP' => $OTPCode];
return $this->post('/authorizations', $params, $headers);
}
|
php
|
public function create(array $params, $OTPCode = null)
{
$headers = null === $OTPCode ? [] : ['X-GitHub-OTP' => $OTPCode];
return $this->post('/authorizations', $params, $headers);
}
|
[
"public",
"function",
"create",
"(",
"array",
"$",
"params",
",",
"$",
"OTPCode",
"=",
"null",
")",
"{",
"$",
"headers",
"=",
"null",
"===",
"$",
"OTPCode",
"?",
"[",
"]",
":",
"[",
"'X-GitHub-OTP'",
"=>",
"$",
"OTPCode",
"]",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"'/authorizations'",
",",
"$",
"params",
",",
"$",
"headers",
")",
";",
"}"
] |
Create an authorization.
@param array $params
@param null $OTPCode
@return array
|
[
"Create",
"an",
"authorization",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/Api/Authorizations.php#L44-L49
|
train
|
KnpLabs/php-github-api
|
lib/Github/HttpClient/Builder.php
|
Builder.clearHeaders
|
public function clearHeaders()
{
$this->headers = [];
$this->removePlugin(Plugin\HeaderAppendPlugin::class);
$this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));
}
|
php
|
public function clearHeaders()
{
$this->headers = [];
$this->removePlugin(Plugin\HeaderAppendPlugin::class);
$this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));
}
|
[
"public",
"function",
"clearHeaders",
"(",
")",
"{",
"$",
"this",
"->",
"headers",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"removePlugin",
"(",
"Plugin",
"\\",
"HeaderAppendPlugin",
"::",
"class",
")",
";",
"$",
"this",
"->",
"addPlugin",
"(",
"new",
"Plugin",
"\\",
"HeaderAppendPlugin",
"(",
"$",
"this",
"->",
"headers",
")",
")",
";",
"}"
] |
Clears used headers.
|
[
"Clears",
"used",
"headers",
"."
] |
275ce096aaadf274905e085f103e9c1ea476de82
|
https://github.com/KnpLabs/php-github-api/blob/275ce096aaadf274905e085f103e9c1ea476de82/lib/Github/HttpClient/Builder.php#L141-L147
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Components/Event/EventDispatcher.php
|
EventDispatcher.add
|
public function add($type, $listener)
{
if (!array_key_exists($type, $this->_eventListeners)) {
$this->_eventListeners [$type] = [];
}
array_push($this->_eventListeners[$type], $listener);
}
|
php
|
public function add($type, $listener)
{
if (!array_key_exists($type, $this->_eventListeners)) {
$this->_eventListeners [$type] = [];
}
array_push($this->_eventListeners[$type], $listener);
}
|
[
"public",
"function",
"add",
"(",
"$",
"type",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"_eventListeners",
")",
")",
"{",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
"=",
"[",
"]",
";",
"}",
"array_push",
"(",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
",",
"$",
"listener",
")",
";",
"}"
] |
Registers an event listener at a certain object.
@param string $type
@param callable $listener
|
[
"Registers",
"an",
"event",
"listener",
"at",
"a",
"certain",
"object",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/Event/EventDispatcher.php#L45-L51
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Components/Event/EventDispatcher.php
|
EventDispatcher.remove
|
public function remove($type, $listener)
{
if (array_key_exists($type, $this->_eventListeners)) {
$index = array_search($listener, $this->_eventListeners [$type]);
if ($index !== null) {
unset ($this->_eventListeners [$type] [$index]);
}
$numListeners = count($this->_eventListeners [$type]);
if ($numListeners == 0) {
unset ($this->_eventListeners [$type]);
}
}
}
|
php
|
public function remove($type, $listener)
{
if (array_key_exists($type, $this->_eventListeners)) {
$index = array_search($listener, $this->_eventListeners [$type]);
if ($index !== null) {
unset ($this->_eventListeners [$type] [$index]);
}
$numListeners = count($this->_eventListeners [$type]);
if ($numListeners == 0) {
unset ($this->_eventListeners [$type]);
}
}
}
|
[
"public",
"function",
"remove",
"(",
"$",
"type",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"_eventListeners",
")",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"listener",
",",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
"[",
"$",
"index",
"]",
")",
";",
"}",
"$",
"numListeners",
"=",
"count",
"(",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
")",
";",
"if",
"(",
"$",
"numListeners",
"==",
"0",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_eventListeners",
"[",
"$",
"type",
"]",
")",
";",
"}",
"}",
"}"
] |
Removes an event listener from the object.
@param string $type
@param callable $listener
|
[
"Removes",
"an",
"event",
"listener",
"from",
"the",
"object",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/Event/EventDispatcher.php#L59-L71
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Components/Event/EventDispatcher.php
|
EventDispatcher.dispatchEvent
|
protected function dispatchEvent($event)
{
if (!array_key_exists($event->type, $this->_eventListeners)) {
return; // no need to do anything
}
$this->invokeEvent($event);
}
|
php
|
protected function dispatchEvent($event)
{
if (!array_key_exists($event->type, $this->_eventListeners)) {
return; // no need to do anything
}
$this->invokeEvent($event);
}
|
[
"protected",
"function",
"dispatchEvent",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"event",
"->",
"type",
",",
"$",
"this",
"->",
"_eventListeners",
")",
")",
"{",
"return",
";",
"// no need to do anything",
"}",
"$",
"this",
"->",
"invokeEvent",
"(",
"$",
"event",
")",
";",
"}"
] |
Dispatches an event to all objects that have registered listeners for its type.
If an event with enabled 'bubble' property is dispatched to a display object, it will
travel up along the line of parents, until it either hits the root object or someone
stops its propagation manually.
@param Event $event
|
[
"Dispatches",
"an",
"event",
"to",
"all",
"objects",
"that",
"have",
"registered",
"listeners",
"for",
"its",
"type",
".",
"If",
"an",
"event",
"with",
"enabled",
"bubble",
"property",
"is",
"dispatched",
"to",
"a",
"display",
"object",
"it",
"will",
"travel",
"up",
"along",
"the",
"line",
"of",
"parents",
"until",
"it",
"either",
"hits",
"the",
"root",
"object",
"or",
"someone",
"stops",
"its",
"propagation",
"manually",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/Event/EventDispatcher.php#L96-L102
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Components/Event/EventDispatcher.php
|
EventDispatcher.dispatch
|
public function dispatch($type, $data = null, $onlyMyWorker = false, $fromDispatch = false)
{
if (!$onlyMyWorker) {
if ($fromDispatch) {//来自集群的请求
get_instance()->sendToAllAsynWorks(SwooleMarco::DISPATCHER_NAME, [$type, $data], EventDispatcher::class . "::workerDispatchEventWith");
return;
}
if (get_instance()->isCluster()) {
ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_dispatchEvent($type, $data);
}
get_instance()->sendToAllAsynWorks(SwooleMarco::DISPATCHER_NAME, [$type, $data], EventDispatcher::class . "::workerDispatchEventWith");
} else {//仅仅发布自己的进程
self::workerDispatchEventWith([$type, $data]);
}
}
|
php
|
public function dispatch($type, $data = null, $onlyMyWorker = false, $fromDispatch = false)
{
if (!$onlyMyWorker) {
if ($fromDispatch) {//来自集群的请求
get_instance()->sendToAllAsynWorks(SwooleMarco::DISPATCHER_NAME, [$type, $data], EventDispatcher::class . "::workerDispatchEventWith");
return;
}
if (get_instance()->isCluster()) {
ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_dispatchEvent($type, $data);
}
get_instance()->sendToAllAsynWorks(SwooleMarco::DISPATCHER_NAME, [$type, $data], EventDispatcher::class . "::workerDispatchEventWith");
} else {//仅仅发布自己的进程
self::workerDispatchEventWith([$type, $data]);
}
}
|
[
"public",
"function",
"dispatch",
"(",
"$",
"type",
",",
"$",
"data",
"=",
"null",
",",
"$",
"onlyMyWorker",
"=",
"false",
",",
"$",
"fromDispatch",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"onlyMyWorker",
")",
"{",
"if",
"(",
"$",
"fromDispatch",
")",
"{",
"//来自集群的请求",
"get_instance",
"(",
")",
"->",
"sendToAllAsynWorks",
"(",
"SwooleMarco",
"::",
"DISPATCHER_NAME",
",",
"[",
"$",
"type",
",",
"$",
"data",
"]",
",",
"EventDispatcher",
"::",
"class",
".",
"\"::workerDispatchEventWith\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"get_instance",
"(",
")",
"->",
"isCluster",
"(",
")",
")",
"{",
"ProcessManager",
"::",
"getInstance",
"(",
")",
"->",
"getRpcCall",
"(",
"ClusterProcess",
"::",
"class",
",",
"true",
")",
"->",
"my_dispatchEvent",
"(",
"$",
"type",
",",
"$",
"data",
")",
";",
"}",
"get_instance",
"(",
")",
"->",
"sendToAllAsynWorks",
"(",
"SwooleMarco",
"::",
"DISPATCHER_NAME",
",",
"[",
"$",
"type",
",",
"$",
"data",
"]",
",",
"EventDispatcher",
"::",
"class",
".",
"\"::workerDispatchEventWith\"",
")",
";",
"}",
"else",
"{",
"//仅仅发布自己的进程",
"self",
"::",
"workerDispatchEventWith",
"(",
"[",
"$",
"type",
",",
"$",
"data",
"]",
")",
";",
"}",
"}"
] |
Dispatches an event with the given parameters to all objects that have registered
listeners for the given type.
The method uses an internal pool of event objects to
avoid allocations.
@param string $type
@param null $data
@param bool $onlyMyWorker
@param bool $fromDispatch
@throws \Exception
|
[
"Dispatches",
"an",
"event",
"with",
"the",
"given",
"parameters",
"to",
"all",
"objects",
"that",
"have",
"registered",
"listeners",
"for",
"the",
"given",
"type",
".",
"The",
"method",
"uses",
"an",
"internal",
"pool",
"of",
"event",
"objects",
"to",
"avoid",
"allocations",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/Event/EventDispatcher.php#L137-L151
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/CMDStore.php
|
CMDStore.getWaits
|
public function getWaits($message_type)
{
return $this->isEmpty($this->command_awaits[$message_type]) ?
false : $this->command_awaits[$message_type];
}
|
php
|
public function getWaits($message_type)
{
return $this->isEmpty($this->command_awaits[$message_type]) ?
false : $this->command_awaits[$message_type];
}
|
[
"public",
"function",
"getWaits",
"(",
"$",
"message_type",
")",
"{",
"return",
"$",
"this",
"->",
"isEmpty",
"(",
"$",
"this",
"->",
"command_awaits",
"[",
"$",
"message_type",
"]",
")",
"?",
"false",
":",
"$",
"this",
"->",
"command_awaits",
"[",
"$",
"message_type",
"]",
";",
"}"
] |
Get all by message_type
@param int $message_type
@return array
|
[
"Get",
"all",
"by",
"message_type"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/CMDStore.php#L86-L90
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Base.php
|
Base.build
|
final public function build(&$length=0)
{
if ($this->protocol_type == self::FIXED_ONLY) {
$payload = $this->payload();
} else if ($this->protocol_type == self::WITH_VARIABLE) {
$payload = $this->payload();
} else if ($this->protocol_type == self::WITH_PAYLOAD) {
$payload = $this->payload();
} else {
throw new Exception('Invalid protocol type');
}
$length = strlen($payload);
$this->header->setPayloadLength($length);
$length = $this->header->getFullLength();
Debug::Log(Debug::DEBUG, 'Message Build: total length='.$length);
return $this->header->build() . $payload;
}
|
php
|
final public function build(&$length=0)
{
if ($this->protocol_type == self::FIXED_ONLY) {
$payload = $this->payload();
} else if ($this->protocol_type == self::WITH_VARIABLE) {
$payload = $this->payload();
} else if ($this->protocol_type == self::WITH_PAYLOAD) {
$payload = $this->payload();
} else {
throw new Exception('Invalid protocol type');
}
$length = strlen($payload);
$this->header->setPayloadLength($length);
$length = $this->header->getFullLength();
Debug::Log(Debug::DEBUG, 'Message Build: total length='.$length);
return $this->header->build() . $payload;
}
|
[
"final",
"public",
"function",
"build",
"(",
"&",
"$",
"length",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"protocol_type",
"==",
"self",
"::",
"FIXED_ONLY",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"payload",
"(",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"protocol_type",
"==",
"self",
"::",
"WITH_VARIABLE",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"payload",
"(",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"protocol_type",
"==",
"self",
"::",
"WITH_PAYLOAD",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"payload",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid protocol type'",
")",
";",
"}",
"$",
"length",
"=",
"strlen",
"(",
"$",
"payload",
")",
";",
"$",
"this",
"->",
"header",
"->",
"setPayloadLength",
"(",
"$",
"length",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"header",
"->",
"getFullLength",
"(",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'Message Build: total length='",
".",
"$",
"length",
")",
";",
"return",
"$",
"this",
"->",
"header",
"->",
"build",
"(",
")",
".",
"$",
"payload",
";",
"}"
] |
Build packet data
@param int & $length
@return string
@throws Exception
|
[
"Build",
"packet",
"data"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Base.php#L141-L160
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Base.php
|
Base.processReadFixedHeaderWithMsgID
|
final protected function processReadFixedHeaderWithMsgID($message)
{
$packet_length = 4;
$name = Message::$name[$this->message_type];
if (!isset($message[$packet_length - 1])) {
# error
Debug::Log(Debug::DEBUG, "Message {$name}: error on reading");
return false;
}
$packet = unpack('Ccmd/Clength/nmsgid', $message);
$packet['cmd'] = Utility::UnpackCommand($packet['cmd']);
if ($packet['cmd']['message_type'] != $this->getMessageType()) {
Debug::Log(Debug::DEBUG, "Message {$name}: type mismatch");
return false;
} else {
Debug::Log(Debug::DEBUG, "Message {$name}: success");
return $packet;
}
}
|
php
|
final protected function processReadFixedHeaderWithMsgID($message)
{
$packet_length = 4;
$name = Message::$name[$this->message_type];
if (!isset($message[$packet_length - 1])) {
# error
Debug::Log(Debug::DEBUG, "Message {$name}: error on reading");
return false;
}
$packet = unpack('Ccmd/Clength/nmsgid', $message);
$packet['cmd'] = Utility::UnpackCommand($packet['cmd']);
if ($packet['cmd']['message_type'] != $this->getMessageType()) {
Debug::Log(Debug::DEBUG, "Message {$name}: type mismatch");
return false;
} else {
Debug::Log(Debug::DEBUG, "Message {$name}: success");
return $packet;
}
}
|
[
"final",
"protected",
"function",
"processReadFixedHeaderWithMsgID",
"(",
"$",
"message",
")",
"{",
"$",
"packet_length",
"=",
"4",
";",
"$",
"name",
"=",
"Message",
"::",
"$",
"name",
"[",
"$",
"this",
"->",
"message_type",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"message",
"[",
"$",
"packet_length",
"-",
"1",
"]",
")",
")",
"{",
"# error",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"\"Message {$name}: error on reading\"",
")",
";",
"return",
"false",
";",
"}",
"$",
"packet",
"=",
"unpack",
"(",
"'Ccmd/Clength/nmsgid'",
",",
"$",
"message",
")",
";",
"$",
"packet",
"[",
"'cmd'",
"]",
"=",
"Utility",
"::",
"UnpackCommand",
"(",
"$",
"packet",
"[",
"'cmd'",
"]",
")",
";",
"if",
"(",
"$",
"packet",
"[",
"'cmd'",
"]",
"[",
"'message_type'",
"]",
"!=",
"$",
"this",
"->",
"getMessageType",
"(",
")",
")",
"{",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"\"Message {$name}: type mismatch\"",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"\"Message {$name}: success\"",
")",
";",
"return",
"$",
"packet",
";",
"}",
"}"
] |
Process packet with Fixed Header + Message Identifier only
@param string $message
@return array|bool
|
[
"Process",
"packet",
"with",
"Fixed",
"Header",
"+",
"Message",
"Identifier",
"only"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Base.php#L181-L203
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/MQTT.php
|
MQTT.setVersion
|
public function setVersion($version)
{
if ($version == self::VERSION_3 || $version == self::VERSION_3_1_1) {
$this->version = $version;
} else {
throw new Exception('Invalid version');
}
}
|
php
|
public function setVersion($version)
{
if ($version == self::VERSION_3 || $version == self::VERSION_3_1_1) {
$this->version = $version;
} else {
throw new Exception('Invalid version');
}
}
|
[
"public",
"function",
"setVersion",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"$",
"version",
"==",
"self",
"::",
"VERSION_3",
"||",
"$",
"version",
"==",
"self",
"::",
"VERSION_3_1_1",
")",
"{",
"$",
"this",
"->",
"version",
"=",
"$",
"version",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"'Invalid version'",
")",
";",
"}",
"}"
] |
Set Protocol Version
@param string $version
@throws Exception
|
[
"Set",
"Protocol",
"Version"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/MQTT.php#L156-L163
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/MQTT.php
|
MQTT.setWill
|
public function setWill($topic, $message, $qos = 0, $retain = 0)
{
$this->connect_will = new Will($topic, $message, $qos, $retain);
}
|
php
|
public function setWill($topic, $message, $qos = 0, $retain = 0)
{
$this->connect_will = new Will($topic, $message, $qos, $retain);
}
|
[
"public",
"function",
"setWill",
"(",
"$",
"topic",
",",
"$",
"message",
",",
"$",
"qos",
"=",
"0",
",",
"$",
"retain",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"connect_will",
"=",
"new",
"Will",
"(",
"$",
"topic",
",",
"$",
"message",
",",
"$",
"qos",
",",
"$",
"retain",
")",
";",
"}"
] |
Set Will Message
@param string $topic
@param string $message
@param int $qos 0,1,2
@param int $retain bool
|
[
"Set",
"Will",
"Message"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/MQTT.php#L215-L218
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/MQTT.php
|
MQTT.do_unsubscribe
|
protected function do_unsubscribe()
{
/**
* Packet Identifier Generator
*
* @var PacketIdentifier $pi
*/
static $pi = null;
if (!$pi) {
$pi = $this->PIG();
}
$msgid = $pi->next();
# send SUBSCRIBE
/**
* @var Message\UNSUBSCRIBE $unsubscribeobj
*/
$unsubscribeobj = $this->getMessageObject(Message::UNSUBSCRIBE);
$unsubscribeobj->setMsgID($msgid);
$unsubscribe_topics = array();
# no need to check if topic is subscribed before unsubscribing
foreach ($this->topics_to_unsubscribe as $tn => $topic_filter) {
$unsubscribeobj->addTopic($topic_filter);
unset($this->topics_to_unsubscribe[$tn]);
$unsubscribe_topics[] = $topic_filter;
}
$unsubscribe_bytes_written = $this->message_write($unsubscribeobj);
Debug::Log(Debug::DEBUG, 'unsubscribe(): bytes written=' . $unsubscribe_bytes_written);
return array($msgid, $unsubscribe_topics);
}
|
php
|
protected function do_unsubscribe()
{
/**
* Packet Identifier Generator
*
* @var PacketIdentifier $pi
*/
static $pi = null;
if (!$pi) {
$pi = $this->PIG();
}
$msgid = $pi->next();
# send SUBSCRIBE
/**
* @var Message\UNSUBSCRIBE $unsubscribeobj
*/
$unsubscribeobj = $this->getMessageObject(Message::UNSUBSCRIBE);
$unsubscribeobj->setMsgID($msgid);
$unsubscribe_topics = array();
# no need to check if topic is subscribed before unsubscribing
foreach ($this->topics_to_unsubscribe as $tn => $topic_filter) {
$unsubscribeobj->addTopic($topic_filter);
unset($this->topics_to_unsubscribe[$tn]);
$unsubscribe_topics[] = $topic_filter;
}
$unsubscribe_bytes_written = $this->message_write($unsubscribeobj);
Debug::Log(Debug::DEBUG, 'unsubscribe(): bytes written=' . $unsubscribe_bytes_written);
return array($msgid, $unsubscribe_topics);
}
|
[
"protected",
"function",
"do_unsubscribe",
"(",
")",
"{",
"/**\n * Packet Identifier Generator\n *\n * @var PacketIdentifier $pi\n */",
"static",
"$",
"pi",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"pi",
")",
"{",
"$",
"pi",
"=",
"$",
"this",
"->",
"PIG",
"(",
")",
";",
"}",
"$",
"msgid",
"=",
"$",
"pi",
"->",
"next",
"(",
")",
";",
"# send SUBSCRIBE",
"/**\n * @var Message\\UNSUBSCRIBE $unsubscribeobj\n */",
"$",
"unsubscribeobj",
"=",
"$",
"this",
"->",
"getMessageObject",
"(",
"Message",
"::",
"UNSUBSCRIBE",
")",
";",
"$",
"unsubscribeobj",
"->",
"setMsgID",
"(",
"$",
"msgid",
")",
";",
"$",
"unsubscribe_topics",
"=",
"array",
"(",
")",
";",
"# no need to check if topic is subscribed before unsubscribing",
"foreach",
"(",
"$",
"this",
"->",
"topics_to_unsubscribe",
"as",
"$",
"tn",
"=>",
"$",
"topic_filter",
")",
"{",
"$",
"unsubscribeobj",
"->",
"addTopic",
"(",
"$",
"topic_filter",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"topics_to_unsubscribe",
"[",
"$",
"tn",
"]",
")",
";",
"$",
"unsubscribe_topics",
"[",
"]",
"=",
"$",
"topic_filter",
";",
"}",
"$",
"unsubscribe_bytes_written",
"=",
"$",
"this",
"->",
"message_write",
"(",
"$",
"unsubscribeobj",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'unsubscribe(): bytes written='",
".",
"$",
"unsubscribe_bytes_written",
")",
";",
"return",
"array",
"(",
"$",
"msgid",
",",
"$",
"unsubscribe_topics",
")",
";",
"}"
] |
DO Unsubscribe topics
@return int
@throws Exception
|
[
"DO",
"Unsubscribe",
"topics"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/MQTT.php#L808-L842
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/MQTT.php
|
MQTT.simpleCommand
|
protected function simpleCommand($type, $msgid = 0)
{
$msgobj = $this->getMessageObject($type);
if ($msgid) {
$msgobj->setMsgID($msgid);
}
return $this->message_write($msgobj);
}
|
php
|
protected function simpleCommand($type, $msgid = 0)
{
$msgobj = $this->getMessageObject($type);
if ($msgid) {
$msgobj->setMsgID($msgid);
}
return $this->message_write($msgobj);
}
|
[
"protected",
"function",
"simpleCommand",
"(",
"$",
"type",
",",
"$",
"msgid",
"=",
"0",
")",
"{",
"$",
"msgobj",
"=",
"$",
"this",
"->",
"getMessageObject",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"msgid",
")",
"{",
"$",
"msgobj",
"->",
"setMsgID",
"(",
"$",
"msgid",
")",
";",
"}",
"return",
"$",
"this",
"->",
"message_write",
"(",
"$",
"msgobj",
")",
";",
"}"
] |
Send Simple Commands
@param int $type
@param int $msgid
@return int bytes written
|
[
"Send",
"Simple",
"Commands"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/MQTT.php#L904-L913
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Header/Base.php
|
Base.decode
|
final public function decode(& $packet_data, $remaining_length, & $payload_pos)
{
$cmd = Utility::ParseCommand(ord($packet_data[0]));
$message_type = $cmd['message_type'];
if ($this->message->getMessageType() != $message_type) {
throw new Exception('Unexpected Control Packet Type');
}
$flags = $cmd['flags'];
$this->setFlags($flags);
$pos = 1;
$rl_len = strlen(($this->remaining_length_bytes = Utility::EncodeLength($remaining_length)));
$pos += $rl_len;
$this->remaining_length = $remaining_length;
$this->decodeVariableHeader($packet_data, $pos);
$payload_pos = $pos;
}
|
php
|
final public function decode(& $packet_data, $remaining_length, & $payload_pos)
{
$cmd = Utility::ParseCommand(ord($packet_data[0]));
$message_type = $cmd['message_type'];
if ($this->message->getMessageType() != $message_type) {
throw new Exception('Unexpected Control Packet Type');
}
$flags = $cmd['flags'];
$this->setFlags($flags);
$pos = 1;
$rl_len = strlen(($this->remaining_length_bytes = Utility::EncodeLength($remaining_length)));
$pos += $rl_len;
$this->remaining_length = $remaining_length;
$this->decodeVariableHeader($packet_data, $pos);
$payload_pos = $pos;
}
|
[
"final",
"public",
"function",
"decode",
"(",
"&",
"$",
"packet_data",
",",
"$",
"remaining_length",
",",
"&",
"$",
"payload_pos",
")",
"{",
"$",
"cmd",
"=",
"Utility",
"::",
"ParseCommand",
"(",
"ord",
"(",
"$",
"packet_data",
"[",
"0",
"]",
")",
")",
";",
"$",
"message_type",
"=",
"$",
"cmd",
"[",
"'message_type'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"message",
"->",
"getMessageType",
"(",
")",
"!=",
"$",
"message_type",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Unexpected Control Packet Type'",
")",
";",
"}",
"$",
"flags",
"=",
"$",
"cmd",
"[",
"'flags'",
"]",
";",
"$",
"this",
"->",
"setFlags",
"(",
"$",
"flags",
")",
";",
"$",
"pos",
"=",
"1",
";",
"$",
"rl_len",
"=",
"strlen",
"(",
"(",
"$",
"this",
"->",
"remaining_length_bytes",
"=",
"Utility",
"::",
"EncodeLength",
"(",
"$",
"remaining_length",
")",
")",
")",
";",
"$",
"pos",
"+=",
"$",
"rl_len",
";",
"$",
"this",
"->",
"remaining_length",
"=",
"$",
"remaining_length",
";",
"$",
"this",
"->",
"decodeVariableHeader",
"(",
"$",
"packet_data",
",",
"$",
"pos",
")",
";",
"$",
"payload_pos",
"=",
"$",
"pos",
";",
"}"
] |
Decode Packet Header and returns payload position.
@param string & $packet_data
@param int $remaining_length
@param int & $payload_pos
@throws \Server\Asyn\MQTT\Exception
|
[
"Decode",
"Packet",
"Header",
"and",
"returns",
"payload",
"position",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Header/Base.php#L77-L95
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Header/Base.php
|
Base.setRemainingLength
|
public function setRemainingLength($length)
{
$this->remaining_length = $length;
$this->remaining_length_bytes = Utility::EncodeLength($this->remaining_length);
}
|
php
|
public function setRemainingLength($length)
{
$this->remaining_length = $length;
$this->remaining_length_bytes = Utility::EncodeLength($this->remaining_length);
}
|
[
"public",
"function",
"setRemainingLength",
"(",
"$",
"length",
")",
"{",
"$",
"this",
"->",
"remaining_length",
"=",
"$",
"length",
";",
"$",
"this",
"->",
"remaining_length_bytes",
"=",
"Utility",
"::",
"EncodeLength",
"(",
"$",
"this",
"->",
"remaining_length",
")",
";",
"}"
] |
Set Remaining Length
@param int $length
|
[
"Set",
"Remaining",
"Length"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Header/Base.php#L140-L144
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Header/Base.php
|
Base.getFullLength
|
public function getFullLength()
{
$cmd_length = 1;
$rl_length = strlen($this->remaining_length_bytes);
return $cmd_length + $rl_length + $this->remaining_length;
}
|
php
|
public function getFullLength()
{
$cmd_length = 1;
$rl_length = strlen($this->remaining_length_bytes);
return $cmd_length + $rl_length + $this->remaining_length;
}
|
[
"public",
"function",
"getFullLength",
"(",
")",
"{",
"$",
"cmd_length",
"=",
"1",
";",
"$",
"rl_length",
"=",
"strlen",
"(",
"$",
"this",
"->",
"remaining_length_bytes",
")",
";",
"return",
"$",
"cmd_length",
"+",
"$",
"rl_length",
"+",
"$",
"this",
"->",
"remaining_length",
";",
"}"
] |
Get Full Header Length
@return int
|
[
"Get",
"Full",
"Header",
"Length"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Header/Base.php#L172-L179
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Components/GrayLog/UdpTransport.php
|
UdpTransport.sendMessageInChunks
|
protected function sendMessageInChunks($rawMessage)
{
// split to chunks
$chunks = str_split($rawMessage, $this->chunkSize);
$numChunks = count($chunks);
if ($numChunks > self::CHUNK_MAX_COUNT) {
throw new \Exception(
sprintf(
"Message is too big. Chunk count exceeds %d",
self::CHUNK_MAX_COUNT
)
);
}
// generate a random 8byte-message-id
$messageId = substr(md5(uniqid("", true), true), 0, 8);
// send chunks with a correct chunk-header
// @link http://graylog2.org/gelf#specs
foreach ($chunks as $idx => $chunk) {
$data = self::CHUNK_GELF_ID // GELF chunk magic bytes
. $messageId // unique message id
. pack('CC', $idx, $numChunks) // sequence information
. $chunk // chunk-data
;
$this->write($data);
}
return $numChunks;
}
|
php
|
protected function sendMessageInChunks($rawMessage)
{
// split to chunks
$chunks = str_split($rawMessage, $this->chunkSize);
$numChunks = count($chunks);
if ($numChunks > self::CHUNK_MAX_COUNT) {
throw new \Exception(
sprintf(
"Message is too big. Chunk count exceeds %d",
self::CHUNK_MAX_COUNT
)
);
}
// generate a random 8byte-message-id
$messageId = substr(md5(uniqid("", true), true), 0, 8);
// send chunks with a correct chunk-header
// @link http://graylog2.org/gelf#specs
foreach ($chunks as $idx => $chunk) {
$data = self::CHUNK_GELF_ID // GELF chunk magic bytes
. $messageId // unique message id
. pack('CC', $idx, $numChunks) // sequence information
. $chunk // chunk-data
;
$this->write($data);
}
return $numChunks;
}
|
[
"protected",
"function",
"sendMessageInChunks",
"(",
"$",
"rawMessage",
")",
"{",
"// split to chunks",
"$",
"chunks",
"=",
"str_split",
"(",
"$",
"rawMessage",
",",
"$",
"this",
"->",
"chunkSize",
")",
";",
"$",
"numChunks",
"=",
"count",
"(",
"$",
"chunks",
")",
";",
"if",
"(",
"$",
"numChunks",
">",
"self",
"::",
"CHUNK_MAX_COUNT",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"\"Message is too big. Chunk count exceeds %d\"",
",",
"self",
"::",
"CHUNK_MAX_COUNT",
")",
")",
";",
"}",
"// generate a random 8byte-message-id",
"$",
"messageId",
"=",
"substr",
"(",
"md5",
"(",
"uniqid",
"(",
"\"\"",
",",
"true",
")",
",",
"true",
")",
",",
"0",
",",
"8",
")",
";",
"// send chunks with a correct chunk-header",
"// @link http://graylog2.org/gelf#specs",
"foreach",
"(",
"$",
"chunks",
"as",
"$",
"idx",
"=>",
"$",
"chunk",
")",
"{",
"$",
"data",
"=",
"self",
"::",
"CHUNK_GELF_ID",
"// GELF chunk magic bytes",
".",
"$",
"messageId",
"// unique message id",
".",
"pack",
"(",
"'CC'",
",",
"$",
"idx",
",",
"$",
"numChunks",
")",
"// sequence information",
".",
"$",
"chunk",
"// chunk-data",
";",
"$",
"this",
"->",
"write",
"(",
"$",
"data",
")",
";",
"}",
"return",
"$",
"numChunks",
";",
"}"
] |
Sends given string in multiple chunks
@param string $rawMessage
@return int
@throws \Exception
|
[
"Sends",
"given",
"string",
"in",
"multiple",
"chunks"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Components/GrayLog/UdpTransport.php#L92-L123
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Header/PUBLISH.php
|
PUBLISH.buildVariableHeader
|
protected function buildVariableHeader()
{
$header = '';
$topic = $this->message->getTopic();
# Topic
$header .= Utility::PackStringWithLength($topic);
Debug::Log(Debug::DEBUG, 'Message PUBLISH: topic='.$topic);
Debug::Log(Debug::DEBUG, 'Message PUBLISH: QoS='.$this->getQos());
Debug::Log(Debug::DEBUG, 'Message PUBLISH: DUP='.$this->getDup());
Debug::Log(Debug::DEBUG, 'Message PUBLISH: RETAIN='.$this->getRetain());
# Message ID if QoS > 0
if ($this->getQos()) {
if (!$this->msgid) {
throw new Exception('MsgID MUST be set if QoS is not 0.');
}
$header .= $this->packPacketIdentifer();
}
return $header;
}
|
php
|
protected function buildVariableHeader()
{
$header = '';
$topic = $this->message->getTopic();
# Topic
$header .= Utility::PackStringWithLength($topic);
Debug::Log(Debug::DEBUG, 'Message PUBLISH: topic='.$topic);
Debug::Log(Debug::DEBUG, 'Message PUBLISH: QoS='.$this->getQos());
Debug::Log(Debug::DEBUG, 'Message PUBLISH: DUP='.$this->getDup());
Debug::Log(Debug::DEBUG, 'Message PUBLISH: RETAIN='.$this->getRetain());
# Message ID if QoS > 0
if ($this->getQos()) {
if (!$this->msgid) {
throw new Exception('MsgID MUST be set if QoS is not 0.');
}
$header .= $this->packPacketIdentifer();
}
return $header;
}
|
[
"protected",
"function",
"buildVariableHeader",
"(",
")",
"{",
"$",
"header",
"=",
"''",
";",
"$",
"topic",
"=",
"$",
"this",
"->",
"message",
"->",
"getTopic",
"(",
")",
";",
"# Topic",
"$",
"header",
".=",
"Utility",
"::",
"PackStringWithLength",
"(",
"$",
"topic",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'Message PUBLISH: topic='",
".",
"$",
"topic",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'Message PUBLISH: QoS='",
".",
"$",
"this",
"->",
"getQos",
"(",
")",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'Message PUBLISH: DUP='",
".",
"$",
"this",
"->",
"getDup",
"(",
")",
")",
";",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'Message PUBLISH: RETAIN='",
".",
"$",
"this",
"->",
"getRetain",
"(",
")",
")",
";",
"# Message ID if QoS > 0",
"if",
"(",
"$",
"this",
"->",
"getQos",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"msgid",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'MsgID MUST be set if QoS is not 0.'",
")",
";",
"}",
"$",
"header",
".=",
"$",
"this",
"->",
"packPacketIdentifer",
"(",
")",
";",
"}",
"return",
"$",
"header",
";",
"}"
] |
PUBLISH Variable Header
Topic Name, Packet Identifier
@return string
@throws Exception
|
[
"PUBLISH",
"Variable",
"Header"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Header/PUBLISH.php#L156-L179
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Message/Header/PUBLISH.php
|
PUBLISH.decodeVariableHeader
|
protected function decodeVariableHeader(& $packet_data, & $pos)
{
$topic = Utility::UnpackStringWithLength($packet_data, $pos);
$this->message->setTopic($topic);
if ($this->getQos() > 0) {
# Decode Packet Identifier if QoS > 0
$this->decodePacketIdentifier($packet_data, $pos);
}
return true;
}
|
php
|
protected function decodeVariableHeader(& $packet_data, & $pos)
{
$topic = Utility::UnpackStringWithLength($packet_data, $pos);
$this->message->setTopic($topic);
if ($this->getQos() > 0) {
# Decode Packet Identifier if QoS > 0
$this->decodePacketIdentifier($packet_data, $pos);
}
return true;
}
|
[
"protected",
"function",
"decodeVariableHeader",
"(",
"&",
"$",
"packet_data",
",",
"&",
"$",
"pos",
")",
"{",
"$",
"topic",
"=",
"Utility",
"::",
"UnpackStringWithLength",
"(",
"$",
"packet_data",
",",
"$",
"pos",
")",
";",
"$",
"this",
"->",
"message",
"->",
"setTopic",
"(",
"$",
"topic",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getQos",
"(",
")",
">",
"0",
")",
"{",
"# Decode Packet Identifier if QoS > 0",
"$",
"this",
"->",
"decodePacketIdentifier",
"(",
"$",
"packet_data",
",",
"$",
"pos",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Decode Variable Header
Topic, Packet Identifier
@param string & $packet_data
@param int & $pos
@return bool
|
[
"Decode",
"Variable",
"Header",
"Topic",
"Packet",
"Identifier"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Message/Header/PUBLISH.php#L189-L200
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.ASCII2Visible
|
static public function ASCII2Visible($char, $replace='.')
{
$c = ord($char);
if ($c >= 0x20 && $c <= 0x7F) {
return $char;
} else {
return $replace;
}
}
|
php
|
static public function ASCII2Visible($char, $replace='.')
{
$c = ord($char);
if ($c >= 0x20 && $c <= 0x7F) {
return $char;
} else {
return $replace;
}
}
|
[
"static",
"public",
"function",
"ASCII2Visible",
"(",
"$",
"char",
",",
"$",
"replace",
"=",
"'.'",
")",
"{",
"$",
"c",
"=",
"ord",
"(",
"$",
"char",
")",
";",
"if",
"(",
"$",
"c",
">=",
"0x20",
"&&",
"$",
"c",
"<=",
"0x7F",
")",
"{",
"return",
"$",
"char",
";",
"}",
"else",
"{",
"return",
"$",
"replace",
";",
"}",
"}"
] |
Convert ASCII Invisible Character to Visible
@param string $char
@param string $replace Default Control Character to '.'
@return string
|
[
"Convert",
"ASCII",
"Invisible",
"Character",
"to",
"Visible"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L21-L29
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.PrintHex
|
static public function PrintHex($chars, $return=false, $width=0, $with_ascii=false)
{
$output = '';
$hex_str = '';
$ascii_str = '';
$width = (int) $width;
if (!$width) {
for ($i=0; isset($chars[$i]); $i++) {
$hex_str .= sprintf('%02x ', ord($chars[$i]));
$ascii_str .= sprintf('%s ', self::ASCII2Visible($chars[$i], '.'));
}
$output .= "HEX DUMP:\t" . $hex_str . "\n";
if ($with_ascii) {
$output .= "ASCII CHR: \t" . $ascii_str . "\n";
}
} else {
for ($i=0; isset($chars[$i]); $i++) {
$hex_str .= sprintf('%02x ', ord($chars[$i]));
$ascii_str .= sprintf('%s', self::ASCII2Visible($chars[$i], '.'));
}
$ph = $pa = 0;
$wh = 3;
$wa = 1;
$lwh = $wh * $width;
$lwa = $wa * $width;
do {
$output .= "DUMP\t";
$output .= str_pad(substr($hex_str, $ph, $lwh), $lwh, ' ');
$output .= "\t";
$output .= str_pad(substr($ascii_str, $pa, $lwa), $lwa, ' ');
$output .= "\n";
$ph += $lwh;
$pa += $lwa;
if (!isset($hex_str[$ph]) || !isset($ascii_str[$pa])) {
break;
}
} while (true);
}
if ($return) {
return $output;
} else {
echo $output;
return true;
}
}
|
php
|
static public function PrintHex($chars, $return=false, $width=0, $with_ascii=false)
{
$output = '';
$hex_str = '';
$ascii_str = '';
$width = (int) $width;
if (!$width) {
for ($i=0; isset($chars[$i]); $i++) {
$hex_str .= sprintf('%02x ', ord($chars[$i]));
$ascii_str .= sprintf('%s ', self::ASCII2Visible($chars[$i], '.'));
}
$output .= "HEX DUMP:\t" . $hex_str . "\n";
if ($with_ascii) {
$output .= "ASCII CHR: \t" . $ascii_str . "\n";
}
} else {
for ($i=0; isset($chars[$i]); $i++) {
$hex_str .= sprintf('%02x ', ord($chars[$i]));
$ascii_str .= sprintf('%s', self::ASCII2Visible($chars[$i], '.'));
}
$ph = $pa = 0;
$wh = 3;
$wa = 1;
$lwh = $wh * $width;
$lwa = $wa * $width;
do {
$output .= "DUMP\t";
$output .= str_pad(substr($hex_str, $ph, $lwh), $lwh, ' ');
$output .= "\t";
$output .= str_pad(substr($ascii_str, $pa, $lwa), $lwa, ' ');
$output .= "\n";
$ph += $lwh;
$pa += $lwa;
if (!isset($hex_str[$ph]) || !isset($ascii_str[$pa])) {
break;
}
} while (true);
}
if ($return) {
return $output;
} else {
echo $output;
return true;
}
}
|
[
"static",
"public",
"function",
"PrintHex",
"(",
"$",
"chars",
",",
"$",
"return",
"=",
"false",
",",
"$",
"width",
"=",
"0",
",",
"$",
"with_ascii",
"=",
"false",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"hex_str",
"=",
"''",
";",
"$",
"ascii_str",
"=",
"''",
";",
"$",
"width",
"=",
"(",
"int",
")",
"$",
"width",
";",
"if",
"(",
"!",
"$",
"width",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"hex_str",
".=",
"sprintf",
"(",
"'%02x '",
",",
"ord",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
")",
")",
";",
"$",
"ascii_str",
".=",
"sprintf",
"(",
"'%s '",
",",
"self",
"::",
"ASCII2Visible",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
",",
"'.'",
")",
")",
";",
"}",
"$",
"output",
".=",
"\"HEX DUMP:\\t\"",
".",
"$",
"hex_str",
".",
"\"\\n\"",
";",
"if",
"(",
"$",
"with_ascii",
")",
"{",
"$",
"output",
".=",
"\"ASCII CHR: \\t\"",
".",
"$",
"ascii_str",
".",
"\"\\n\"",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"hex_str",
".=",
"sprintf",
"(",
"'%02x '",
",",
"ord",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
")",
")",
";",
"$",
"ascii_str",
".=",
"sprintf",
"(",
"'%s'",
",",
"self",
"::",
"ASCII2Visible",
"(",
"$",
"chars",
"[",
"$",
"i",
"]",
",",
"'.'",
")",
")",
";",
"}",
"$",
"ph",
"=",
"$",
"pa",
"=",
"0",
";",
"$",
"wh",
"=",
"3",
";",
"$",
"wa",
"=",
"1",
";",
"$",
"lwh",
"=",
"$",
"wh",
"*",
"$",
"width",
";",
"$",
"lwa",
"=",
"$",
"wa",
"*",
"$",
"width",
";",
"do",
"{",
"$",
"output",
".=",
"\"DUMP\\t\"",
";",
"$",
"output",
".=",
"str_pad",
"(",
"substr",
"(",
"$",
"hex_str",
",",
"$",
"ph",
",",
"$",
"lwh",
")",
",",
"$",
"lwh",
",",
"' '",
")",
";",
"$",
"output",
".=",
"\"\\t\"",
";",
"$",
"output",
".=",
"str_pad",
"(",
"substr",
"(",
"$",
"ascii_str",
",",
"$",
"pa",
",",
"$",
"lwa",
")",
",",
"$",
"lwa",
",",
"' '",
")",
";",
"$",
"output",
".=",
"\"\\n\"",
";",
"$",
"ph",
"+=",
"$",
"lwh",
";",
"$",
"pa",
"+=",
"$",
"lwa",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"hex_str",
"[",
"$",
"ph",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"ascii_str",
"[",
"$",
"pa",
"]",
")",
")",
"{",
"break",
";",
"}",
"}",
"while",
"(",
"true",
")",
";",
"}",
"if",
"(",
"$",
"return",
")",
"{",
"return",
"$",
"output",
";",
"}",
"else",
"{",
"echo",
"$",
"output",
";",
"return",
"true",
";",
"}",
"}"
] |
Print string in Hex
@param string $chars
@param bool $return
@param int $width
@param bool $with_ascii
@return void|string
|
[
"Print",
"string",
"in",
"Hex"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L40-L93
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.PackStringWithLength
|
static public function PackStringWithLength($str)
{
$len = strlen($str);
# UTF-8
if (!self::ValidateUTF8($str)) {
throw new Exception('Bad UTF-8 String');
}
return pack('n', $len) . $str;
}
|
php
|
static public function PackStringWithLength($str)
{
$len = strlen($str);
# UTF-8
if (!self::ValidateUTF8($str)) {
throw new Exception('Bad UTF-8 String');
}
return pack('n', $len) . $str;
}
|
[
"static",
"public",
"function",
"PackStringWithLength",
"(",
"$",
"str",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"str",
")",
";",
"# UTF-8",
"if",
"(",
"!",
"self",
"::",
"ValidateUTF8",
"(",
"$",
"str",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Bad UTF-8 String'",
")",
";",
"}",
"return",
"pack",
"(",
"'n'",
",",
"$",
"len",
")",
".",
"$",
"str",
";",
"}"
] |
Pack string with a 16-bit big endian length ahead.
@param string $str input string
@return string returned string
@throws Exception
|
[
"Pack",
"string",
"with",
"a",
"16",
"-",
"bit",
"big",
"endian",
"length",
"ahead",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L102-L110
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.ExtractUShort
|
static public function ExtractUShort($str, &$pos)
{
$bytes = substr($str, $pos, 2);
$ushort = Utility::Word2UShort($bytes);
$pos += 2;
return $ushort;
}
|
php
|
static public function ExtractUShort($str, &$pos)
{
$bytes = substr($str, $pos, 2);
$ushort = Utility::Word2UShort($bytes);
$pos += 2;
return $ushort;
}
|
[
"static",
"public",
"function",
"ExtractUShort",
"(",
"$",
"str",
",",
"&",
"$",
"pos",
")",
"{",
"$",
"bytes",
"=",
"substr",
"(",
"$",
"str",
",",
"$",
"pos",
",",
"2",
")",
";",
"$",
"ushort",
"=",
"Utility",
"::",
"Word2UShort",
"(",
"$",
"bytes",
")",
";",
"$",
"pos",
"+=",
"2",
";",
"return",
"$",
"ushort",
";",
"}"
] |
Extract Unsigned Short from Buffer
@param string $str
@param int & $pos
@return int
|
[
"Extract",
"Unsigned",
"Short",
"from",
"Buffer"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L136-L143
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.EncodeLength
|
static public function EncodeLength($length)
{
self::CheckMessageLength($length);
$string = "";
do{
$digit = $length % 0x80;
$length = $length >> 7;
// if there are more digits to encode, set the top bit of this digit
if ( $length > 0 ) $digit = ($digit | 0x80);
$string .= chr($digit);
} while ( $length > 0 );
return $string;
}
|
php
|
static public function EncodeLength($length)
{
self::CheckMessageLength($length);
$string = "";
do{
$digit = $length % 0x80;
$length = $length >> 7;
// if there are more digits to encode, set the top bit of this digit
if ( $length > 0 ) $digit = ($digit | 0x80);
$string .= chr($digit);
} while ( $length > 0 );
return $string;
}
|
[
"static",
"public",
"function",
"EncodeLength",
"(",
"$",
"length",
")",
"{",
"self",
"::",
"CheckMessageLength",
"(",
"$",
"length",
")",
";",
"$",
"string",
"=",
"\"\"",
";",
"do",
"{",
"$",
"digit",
"=",
"$",
"length",
"%",
"0x80",
";",
"$",
"length",
"=",
"$",
"length",
">>",
"7",
";",
"// if there are more digits to encode, set the top bit of this digit",
"if",
"(",
"$",
"length",
">",
"0",
")",
"$",
"digit",
"=",
"(",
"$",
"digit",
"|",
"0x80",
")",
";",
"$",
"string",
".=",
"chr",
"(",
"$",
"digit",
")",
";",
"}",
"while",
"(",
"$",
"length",
">",
"0",
")",
";",
"return",
"$",
"string",
";",
"}"
] |
Encode Remaining Length
@param int $length
@return string
|
[
"Encode",
"Remaining",
"Length"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L164-L178
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.DecodeLength
|
static public function DecodeLength($msg, &$pos)
{
$multiplier = 1;
$value = 0 ;
do{
$digit = ord($msg[$pos]);
$value += ($digit & 0x7F) * $multiplier;
$multiplier *= 0x80;
$pos++;
} while (($digit & 0x80) != 0);
return $value;
}
|
php
|
static public function DecodeLength($msg, &$pos)
{
$multiplier = 1;
$value = 0 ;
do{
$digit = ord($msg[$pos]);
$value += ($digit & 0x7F) * $multiplier;
$multiplier *= 0x80;
$pos++;
} while (($digit & 0x80) != 0);
return $value;
}
|
[
"static",
"public",
"function",
"DecodeLength",
"(",
"$",
"msg",
",",
"&",
"$",
"pos",
")",
"{",
"$",
"multiplier",
"=",
"1",
";",
"$",
"value",
"=",
"0",
";",
"do",
"{",
"$",
"digit",
"=",
"ord",
"(",
"$",
"msg",
"[",
"$",
"pos",
"]",
")",
";",
"$",
"value",
"+=",
"(",
"$",
"digit",
"&",
"0x7F",
")",
"*",
"$",
"multiplier",
";",
"$",
"multiplier",
"*=",
"0x80",
";",
"$",
"pos",
"++",
";",
"}",
"while",
"(",
"(",
"$",
"digit",
"&",
"0x80",
")",
"!=",
"0",
")",
";",
"return",
"$",
"value",
";",
"}"
] |
Decode Remaining Length
@param string $msg
@param int & $pos
@return int
|
[
"Decode",
"Remaining",
"Length"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L187-L199
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.CheckTopicFilter
|
static public function CheckTopicFilter($topic_filter)
{
if (!isset($topic_filter[0]) || isset($topic_filter[65535])) {
throw new Exception('Topic filter must be at 1~65535 bytes long');
}
self::ValidateUTF8($topic_filter);
if (false !== strpos($topic_filter, chr(0))) {
throw new Exception('Null character is not allowed in topic');
}
$length = strlen($topic_filter);
/*
The multi-level wildcard character MUST be specified either on its own or following a topic level separator.
In either case it MUST be the last character specified in the Topic Filter [MQTT-4.7.1-2].
*/
if (($p = strpos($topic_filter, '#')) !== false) {
if ($p != $length - 1) {
throw new Exception('"#" MUST be the last char in topic filter');
} else if ($length > 1 && $topic_filter[$length - 2] != '/') {
throw new Exception('"#" MUST occupy an entire level of the filter');
}
}
$levels = explode('/', $topic_filter);
foreach ($levels as $l) {
if ($l == '') {
continue;
} else if (strpos($l, '+') !== false && isset($l[1])) {
/*
The single-level wildcard can be used at any level in the Topic Filter, including first and last levels.
Where it is used it MUST occupy an entire level of the filter [MQTT-4.7.1-3].
*/
throw new Exception('"+" MUST occupy an entire level of the filter');
}
}
if ($topic_filter[0] == '#') {
Debug::Log(Debug::DEBUG, 'If you want to subscribe topic begin with $, please subscribe both "#" and "$SOMETOPIC/#"');
}
}
|
php
|
static public function CheckTopicFilter($topic_filter)
{
if (!isset($topic_filter[0]) || isset($topic_filter[65535])) {
throw new Exception('Topic filter must be at 1~65535 bytes long');
}
self::ValidateUTF8($topic_filter);
if (false !== strpos($topic_filter, chr(0))) {
throw new Exception('Null character is not allowed in topic');
}
$length = strlen($topic_filter);
/*
The multi-level wildcard character MUST be specified either on its own or following a topic level separator.
In either case it MUST be the last character specified in the Topic Filter [MQTT-4.7.1-2].
*/
if (($p = strpos($topic_filter, '#')) !== false) {
if ($p != $length - 1) {
throw new Exception('"#" MUST be the last char in topic filter');
} else if ($length > 1 && $topic_filter[$length - 2] != '/') {
throw new Exception('"#" MUST occupy an entire level of the filter');
}
}
$levels = explode('/', $topic_filter);
foreach ($levels as $l) {
if ($l == '') {
continue;
} else if (strpos($l, '+') !== false && isset($l[1])) {
/*
The single-level wildcard can be used at any level in the Topic Filter, including first and last levels.
Where it is used it MUST occupy an entire level of the filter [MQTT-4.7.1-3].
*/
throw new Exception('"+" MUST occupy an entire level of the filter');
}
}
if ($topic_filter[0] == '#') {
Debug::Log(Debug::DEBUG, 'If you want to subscribe topic begin with $, please subscribe both "#" and "$SOMETOPIC/#"');
}
}
|
[
"static",
"public",
"function",
"CheckTopicFilter",
"(",
"$",
"topic_filter",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"topic_filter",
"[",
"0",
"]",
")",
"||",
"isset",
"(",
"$",
"topic_filter",
"[",
"65535",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Topic filter must be at 1~65535 bytes long'",
")",
";",
"}",
"self",
"::",
"ValidateUTF8",
"(",
"$",
"topic_filter",
")",
";",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"topic_filter",
",",
"chr",
"(",
"0",
")",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Null character is not allowed in topic'",
")",
";",
"}",
"$",
"length",
"=",
"strlen",
"(",
"$",
"topic_filter",
")",
";",
"/*\n The multi-level wildcard character MUST be specified either on its own or following a topic level separator.\n In either case it MUST be the last character specified in the Topic Filter [MQTT-4.7.1-2].\n */",
"if",
"(",
"(",
"$",
"p",
"=",
"strpos",
"(",
"$",
"topic_filter",
",",
"'#'",
")",
")",
"!==",
"false",
")",
"{",
"if",
"(",
"$",
"p",
"!=",
"$",
"length",
"-",
"1",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'\"#\" MUST be the last char in topic filter'",
")",
";",
"}",
"else",
"if",
"(",
"$",
"length",
">",
"1",
"&&",
"$",
"topic_filter",
"[",
"$",
"length",
"-",
"2",
"]",
"!=",
"'/'",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'\"#\" MUST occupy an entire level of the filter'",
")",
";",
"}",
"}",
"$",
"levels",
"=",
"explode",
"(",
"'/'",
",",
"$",
"topic_filter",
")",
";",
"foreach",
"(",
"$",
"levels",
"as",
"$",
"l",
")",
"{",
"if",
"(",
"$",
"l",
"==",
"''",
")",
"{",
"continue",
";",
"}",
"else",
"if",
"(",
"strpos",
"(",
"$",
"l",
",",
"'+'",
")",
"!==",
"false",
"&&",
"isset",
"(",
"$",
"l",
"[",
"1",
"]",
")",
")",
"{",
"/*\n The single-level wildcard can be used at any level in the Topic Filter, including first and last levels.\n Where it is used it MUST occupy an entire level of the filter [MQTT-4.7.1-3].\n */",
"throw",
"new",
"Exception",
"(",
"'\"+\" MUST occupy an entire level of the filter'",
")",
";",
"}",
"}",
"if",
"(",
"$",
"topic_filter",
"[",
"0",
"]",
"==",
"'#'",
")",
"{",
"Debug",
"::",
"Log",
"(",
"Debug",
"::",
"DEBUG",
",",
"'If you want to subscribe topic begin with $, please subscribe both \"#\" and \"$SOMETOPIC/#\"'",
")",
";",
"}",
"}"
] |
Check Topic Filter
Based on 4.7 Topic Names and Topic Filters
@param string $topic_filter
@throws Exception
|
[
"Check",
"Topic",
"Filter"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L287-L328
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/MQTT/Utility.php
|
Utility.ValidateUTF8
|
static public function ValidateUTF8($string)
{
$pop_10s = 0;
$unicode_char = 0;
for ($i=0; isset($string[$i]); $i++) {
$c = ord($string[$i]);
if ($pop_10s) {
# Check if following chars in multibytes are not 10xxxxxx
if (($c & 0xC0) != 0x80) {
throw new Exception\BadUTF8('Following characters must be 10xxxxxx');
} else {
$unicode_char <<= 6;
$unicode_char |= $c & 0x3F;
--$pop_10s;
}
} else if (($c & 0x7F) == $c) {
# single ASCII char
$unicode_char = 0;
/*
I tried mosquitto, it accepts \0 when publishing Message, no connection is closed.
No exception will be thrown here.
MQTT-1.5.3-2
A UTF-8 encoded string MUST NOT include an encoding of the null character U+0000.
If a receiver (Server or Client) receives a Control Packet containing U+0000 it MUST
close the Network Connection.
*/
continue;
} else if (($c & 0xFE) == 0xFC) {
# leading 1111110x
$pop_10s = 5;
$unicode_char = 0;
$unicode_char |= $c & 0x01;
} else if (($c & 0xFC) == 0xF8) {
# leading 111110xx
$pop_10s = 4;
$unicode_char = 0;
$unicode_char |= $c & 0x03;
} else if (($c & 0xF8) == 0xF0) {
# leading 11110xxx
$pop_10s = 3;
$unicode_char = 0;
$unicode_char |= $c & 0x07;
} else if (($c & 0xF0) == 0xE0) {
# leading 1110xxxx
$pop_10s = 2;
$unicode_char = 0;
$unicode_char |= $c & 0x0F;
} else if (($c & 0xE0) == 0xC0) {
# leading 110xxxxx
$pop_10s = 1;
$unicode_char = 0;
$unicode_char |= $c & 0x1F;
} else {
throw new Exception\BadUTF8('Bad leading characters');
}
if ($unicode_char >= 0xD800 && $unicode_char <= 0xDFFF) {
/*
MQTT-1.5.3.1
The character data in a UTF-8 encoded string MUST be well-formed UTF-8 as defined
by the Unicode specification [Unicode] and restated in RFC 3629 [RFC3629]. In
particular this data MUST NOT include encodings of code points between U+D800 and
U+DFFF. If a Server or Client receives a Control Packet containing ill-formed UTF-8
it MUST close the Network Connection [MQTT-1.5.3-1].
*/
throw new Exception\BadUTF8('U+D800 ~ U+DFFF CAN NOT be used in UTF-8');
}
}
if ($pop_10s) {
throw new Exception\BadUTF8('Missing UTF-8 following characters');
}
return true;
}
|
php
|
static public function ValidateUTF8($string)
{
$pop_10s = 0;
$unicode_char = 0;
for ($i=0; isset($string[$i]); $i++) {
$c = ord($string[$i]);
if ($pop_10s) {
# Check if following chars in multibytes are not 10xxxxxx
if (($c & 0xC0) != 0x80) {
throw new Exception\BadUTF8('Following characters must be 10xxxxxx');
} else {
$unicode_char <<= 6;
$unicode_char |= $c & 0x3F;
--$pop_10s;
}
} else if (($c & 0x7F) == $c) {
# single ASCII char
$unicode_char = 0;
/*
I tried mosquitto, it accepts \0 when publishing Message, no connection is closed.
No exception will be thrown here.
MQTT-1.5.3-2
A UTF-8 encoded string MUST NOT include an encoding of the null character U+0000.
If a receiver (Server or Client) receives a Control Packet containing U+0000 it MUST
close the Network Connection.
*/
continue;
} else if (($c & 0xFE) == 0xFC) {
# leading 1111110x
$pop_10s = 5;
$unicode_char = 0;
$unicode_char |= $c & 0x01;
} else if (($c & 0xFC) == 0xF8) {
# leading 111110xx
$pop_10s = 4;
$unicode_char = 0;
$unicode_char |= $c & 0x03;
} else if (($c & 0xF8) == 0xF0) {
# leading 11110xxx
$pop_10s = 3;
$unicode_char = 0;
$unicode_char |= $c & 0x07;
} else if (($c & 0xF0) == 0xE0) {
# leading 1110xxxx
$pop_10s = 2;
$unicode_char = 0;
$unicode_char |= $c & 0x0F;
} else if (($c & 0xE0) == 0xC0) {
# leading 110xxxxx
$pop_10s = 1;
$unicode_char = 0;
$unicode_char |= $c & 0x1F;
} else {
throw new Exception\BadUTF8('Bad leading characters');
}
if ($unicode_char >= 0xD800 && $unicode_char <= 0xDFFF) {
/*
MQTT-1.5.3.1
The character data in a UTF-8 encoded string MUST be well-formed UTF-8 as defined
by the Unicode specification [Unicode] and restated in RFC 3629 [RFC3629]. In
particular this data MUST NOT include encodings of code points between U+D800 and
U+DFFF. If a Server or Client receives a Control Packet containing ill-formed UTF-8
it MUST close the Network Connection [MQTT-1.5.3-1].
*/
throw new Exception\BadUTF8('U+D800 ~ U+DFFF CAN NOT be used in UTF-8');
}
}
if ($pop_10s) {
throw new Exception\BadUTF8('Missing UTF-8 following characters');
}
return true;
}
|
[
"static",
"public",
"function",
"ValidateUTF8",
"(",
"$",
"string",
")",
"{",
"$",
"pop_10s",
"=",
"0",
";",
"$",
"unicode_char",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
"string",
"[",
"$",
"i",
"]",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"c",
"=",
"ord",
"(",
"$",
"string",
"[",
"$",
"i",
"]",
")",
";",
"if",
"(",
"$",
"pop_10s",
")",
"{",
"# Check if following chars in multibytes are not 10xxxxxx",
"if",
"(",
"(",
"$",
"c",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"BadUTF8",
"(",
"'Following characters must be 10xxxxxx'",
")",
";",
"}",
"else",
"{",
"$",
"unicode_char",
"<<=",
"6",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x3F",
";",
"--",
"$",
"pop_10s",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0x7F",
")",
"==",
"$",
"c",
")",
"{",
"# single ASCII char",
"$",
"unicode_char",
"=",
"0",
";",
"/*\n I tried mosquitto, it accepts \\0 when publishing Message, no connection is closed.\n No exception will be thrown here.\n\n MQTT-1.5.3-2\n A UTF-8 encoded string MUST NOT include an encoding of the null character U+0000.\n If a receiver (Server or Client) receives a Control Packet containing U+0000 it MUST\n close the Network Connection.\n\n */",
"continue",
";",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0xFE",
")",
"==",
"0xFC",
")",
"{",
"# leading 1111110x",
"$",
"pop_10s",
"=",
"5",
";",
"$",
"unicode_char",
"=",
"0",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x01",
";",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0xFC",
")",
"==",
"0xF8",
")",
"{",
"# leading 111110xx",
"$",
"pop_10s",
"=",
"4",
";",
"$",
"unicode_char",
"=",
"0",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x03",
";",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0xF8",
")",
"==",
"0xF0",
")",
"{",
"# leading 11110xxx",
"$",
"pop_10s",
"=",
"3",
";",
"$",
"unicode_char",
"=",
"0",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x07",
";",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0xF0",
")",
"==",
"0xE0",
")",
"{",
"# leading 1110xxxx",
"$",
"pop_10s",
"=",
"2",
";",
"$",
"unicode_char",
"=",
"0",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x0F",
";",
"}",
"else",
"if",
"(",
"(",
"$",
"c",
"&",
"0xE0",
")",
"==",
"0xC0",
")",
"{",
"# leading 110xxxxx",
"$",
"pop_10s",
"=",
"1",
";",
"$",
"unicode_char",
"=",
"0",
";",
"$",
"unicode_char",
"|=",
"$",
"c",
"&",
"0x1F",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"\\",
"BadUTF8",
"(",
"'Bad leading characters'",
")",
";",
"}",
"if",
"(",
"$",
"unicode_char",
">=",
"0xD800",
"&&",
"$",
"unicode_char",
"<=",
"0xDFFF",
")",
"{",
"/*\n MQTT-1.5.3.1\n The character data in a UTF-8 encoded string MUST be well-formed UTF-8 as defined\n by the Unicode specification [Unicode] and restated in RFC 3629 [RFC3629]. In\n particular this data MUST NOT include encodings of code points between U+D800 and\n U+DFFF. If a Server or Client receives a Control Packet containing ill-formed UTF-8\n it MUST close the Network Connection [MQTT-1.5.3-1].\n\n */",
"throw",
"new",
"Exception",
"\\",
"BadUTF8",
"(",
"'U+D800 ~ U+DFFF CAN NOT be used in UTF-8'",
")",
";",
"}",
"}",
"if",
"(",
"$",
"pop_10s",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"BadUTF8",
"(",
"'Missing UTF-8 following characters'",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Check if string is UTF-8
@param string $string
@return bool
@throws Exception\BadUTF8
|
[
"Check",
"if",
"string",
"is",
"UTF",
"-",
"8"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/MQTT/Utility.php#L410-L495
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.innerJoin
|
public function innerJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::INNER_JOIN, $alias);
}
|
php
|
public function innerJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::INNER_JOIN, $alias);
}
|
[
"public",
"function",
"innerJoin",
"(",
"$",
"table",
",",
"$",
"criteria",
"=",
"null",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"criteria",
",",
"self",
"::",
"INNER_JOIN",
",",
"$",
"alias",
")",
";",
"}"
] |
Add an INNER JOIN table with optional ON criteria.
@param string $table table name
@param string|array $criteria optional ON criteria
@param string $alias optional alias
@return Miner
|
[
"Add",
"an",
"INNER",
"JOIN",
"table",
"with",
"optional",
"ON",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L437-L440
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.join
|
public function join($table, $criteria = null, $type = self::INNER_JOIN, $alias = null)
{
if (!$this->isJoinUnique($table, $alias)) {
return $this;
}
if (is_string($criteria)) {
$criteria = array($criteria);
}
$this->join[] = array('table' => $table,
'criteria' => $criteria,
'type' => $type,
'alias' => $alias);
return $this;
}
|
php
|
public function join($table, $criteria = null, $type = self::INNER_JOIN, $alias = null)
{
if (!$this->isJoinUnique($table, $alias)) {
return $this;
}
if (is_string($criteria)) {
$criteria = array($criteria);
}
$this->join[] = array('table' => $table,
'criteria' => $criteria,
'type' => $type,
'alias' => $alias);
return $this;
}
|
[
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"criteria",
"=",
"null",
",",
"$",
"type",
"=",
"self",
"::",
"INNER_JOIN",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isJoinUnique",
"(",
"$",
"table",
",",
"$",
"alias",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"criteria",
")",
")",
"{",
"$",
"criteria",
"=",
"array",
"(",
"$",
"criteria",
")",
";",
"}",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"array",
"(",
"'table'",
"=>",
"$",
"table",
",",
"'criteria'",
"=>",
"$",
"criteria",
",",
"'type'",
"=>",
"$",
"type",
",",
"'alias'",
"=>",
"$",
"alias",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Add a JOIN table with optional ON criteria.
@param string $table table name
@param string|array $criteria optional ON criteria
@param string $type optional type of join, default INNER JOIN
@param string $alias optional alias
@return Miner
|
[
"Add",
"a",
"JOIN",
"table",
"with",
"optional",
"ON",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L451-L467
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.leftJoin
|
public function leftJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::LEFT_JOIN, $alias);
}
|
php
|
public function leftJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::LEFT_JOIN, $alias);
}
|
[
"public",
"function",
"leftJoin",
"(",
"$",
"table",
",",
"$",
"criteria",
"=",
"null",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"criteria",
",",
"self",
"::",
"LEFT_JOIN",
",",
"$",
"alias",
")",
";",
"}"
] |
Add a LEFT JOIN table with optional ON criteria.
@param string $table table name
@param string|array $criteria optional ON criteria
@param string $alias optional alias
@return Miner
|
[
"Add",
"a",
"LEFT",
"JOIN",
"table",
"with",
"optional",
"ON",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L495-L498
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.rightJoin
|
public function rightJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::RIGHT_JOIN, $alias);
}
|
php
|
public function rightJoin($table, $criteria = null, $alias = null)
{
return $this->join($table, $criteria, self::RIGHT_JOIN, $alias);
}
|
[
"public",
"function",
"rightJoin",
"(",
"$",
"table",
",",
"$",
"criteria",
"=",
"null",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"table",
",",
"$",
"criteria",
",",
"self",
"::",
"RIGHT_JOIN",
",",
"$",
"alias",
")",
";",
"}"
] |
Add a RIGHT JOIN table with optional ON criteria.
@param string $table table name
@param string|array $criteria optional ON criteria
@param string $alias optional alias
@return Miner
|
[
"Add",
"a",
"RIGHT",
"JOIN",
"table",
"with",
"optional",
"ON",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L508-L511
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.orWhere
|
public function orWhere($column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->orCriteria($this->where, $column, $value, $operator, $quote);
}
|
php
|
public function orWhere($column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->orCriteria($this->where, $column, $value, $operator, $quote);
}
|
[
"public",
"function",
"orWhere",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"self",
"::",
"EQUALS",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"orCriteria",
"(",
"$",
"this",
"->",
"where",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
",",
"$",
"quote",
")",
";",
"}"
] |
Add an OR WHERE condition.
@param string $column colum name
@param mixed $value value
@param string $operator optional comparison operator, default =
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"an",
"OR",
"WHERE",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L559-L562
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.orCriteria
|
private function orCriteria(array &$criteria, $column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->criteria($criteria, $column, $value, $operator, self::LOGICAL_OR, $quote);
}
|
php
|
private function orCriteria(array &$criteria, $column, $value, $operator = self::EQUALS, $quote = null)
{
return $this->criteria($criteria, $column, $value, $operator, self::LOGICAL_OR, $quote);
}
|
[
"private",
"function",
"orCriteria",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"self",
"::",
"EQUALS",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteria",
"(",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
",",
"self",
"::",
"LOGICAL_OR",
",",
"$",
"quote",
")",
";",
"}"
] |
Add an OR condition to the specified WHERE or HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $column column name
@param mixed $value value
@param string $operator optional comparison operator, default =
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"an",
"OR",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L574-L577
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.criteriaIn
|
private function criteriaIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, $values, self::IN, $connector, $quote);
}
|
php
|
private function criteriaIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, $values, self::IN, $connector, $quote);
}
|
[
"private",
"function",
"criteriaIn",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"array",
"$",
"values",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteria",
"(",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"values",
",",
"self",
"::",
"IN",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add an IN condition to the specified WHERE or HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $column column name
@param array $values values
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"an",
"IN",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L603-L607
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.whereNotIn
|
public function whereNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotIn($this->where, $column, $values, $connector, $quote);
}
|
php
|
public function whereNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotIn($this->where, $column, $values, $connector, $quote);
}
|
[
"public",
"function",
"whereNotIn",
"(",
"$",
"column",
",",
"array",
"$",
"values",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaNotIn",
"(",
"$",
"this",
"->",
"where",
",",
"$",
"column",
",",
"$",
"values",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT IN WHERE condition.
@param string $column column name
@param array $values values
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"IN",
"WHERE",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L618-L621
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.criteriaNotIn
|
private function criteriaNotIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, $values, self::NOT_IN, $connector, $quote);
}
|
php
|
private function criteriaNotIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, $values, self::NOT_IN, $connector, $quote);
}
|
[
"private",
"function",
"criteriaNotIn",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"array",
"$",
"values",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteria",
"(",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"values",
",",
"self",
"::",
"NOT_IN",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT IN condition to the specified WHERE or HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $column column name
@param array $values values
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"IN",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L633-L637
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.whereBetween
|
public function whereBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaBetween($this->where, $column, $min, $max, $connector, $quote);
}
|
php
|
public function whereBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaBetween($this->where, $column, $min, $max, $connector, $quote);
}
|
[
"public",
"function",
"whereBetween",
"(",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaBetween",
"(",
"$",
"this",
"->",
"where",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a BETWEEN WHERE condition.
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"BETWEEN",
"WHERE",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L649-L652
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.criteriaBetween
|
private function criteriaBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, array($min, $max), self::BETWEEN, $connector, $quote);
}
|
php
|
private function criteriaBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, array($min, $max), self::BETWEEN, $connector, $quote);
}
|
[
"private",
"function",
"criteriaBetween",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteria",
"(",
"$",
"criteria",
",",
"$",
"column",
",",
"array",
"(",
"$",
"min",
",",
"$",
"max",
")",
",",
"self",
"::",
"BETWEEN",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a BETWEEN condition to the specified WHERE or HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"BETWEEN",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L665-L669
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.whereNotBetween
|
public function whereNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotBetween($this->where, $column, $min, $max, $connector, $quote);
}
|
php
|
public function whereNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotBetween($this->where, $column, $min, $max, $connector, $quote);
}
|
[
"public",
"function",
"whereNotBetween",
"(",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaNotBetween",
"(",
"$",
"this",
"->",
"where",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT BETWEEN WHERE condition.
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"BETWEEN",
"WHERE",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L681-L684
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.criteriaNotBetween
|
private function criteriaNotBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, array($min, $max), self::NOT_BETWEEN, $connector, $quote);
}
|
php
|
private function criteriaNotBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND,
$quote = null)
{
return $this->criteria($criteria, $column, array($min, $max), self::NOT_BETWEEN, $connector, $quote);
}
|
[
"private",
"function",
"criteriaNotBetween",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteria",
"(",
"$",
"criteria",
",",
"$",
"column",
",",
"array",
"(",
"$",
"min",
",",
"$",
"max",
")",
",",
"self",
"::",
"NOT_BETWEEN",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT BETWEEN condition to the specified WHERE or HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"BETWEEN",
"condition",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L697-L701
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.havingNotIn
|
public function havingNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotIn($this->having, $column, $values, $connector, $quote);
}
|
php
|
public function havingNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotIn($this->having, $column, $values, $connector, $quote);
}
|
[
"public",
"function",
"havingNotIn",
"(",
"$",
"column",
",",
"array",
"$",
"values",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaNotIn",
"(",
"$",
"this",
"->",
"having",
",",
"$",
"column",
",",
"$",
"values",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT IN HAVING condition.
@param string $column column name
@param array $values values
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"IN",
"HAVING",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L754-L757
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.havingBetween
|
public function havingBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaBetween($this->having, $column, $min, $max, $connector, $quote);
}
|
php
|
public function havingBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaBetween($this->having, $column, $min, $max, $connector, $quote);
}
|
[
"public",
"function",
"havingBetween",
"(",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaBetween",
"(",
"$",
"this",
"->",
"having",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a BETWEEN HAVING condition.
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"BETWEEN",
"HAVING",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L769-L772
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.havingNotBetween
|
public function havingNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotBetween($this->having, $column, $min, $max, $connector, $quote);
}
|
php
|
public function havingNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
{
return $this->criteriaNotBetween($this->having, $column, $min, $max, $connector, $quote);
}
|
[
"public",
"function",
"havingNotBetween",
"(",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
",",
"$",
"quote",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"criteriaNotBetween",
"(",
"$",
"this",
"->",
"having",
",",
"$",
"column",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"connector",
",",
"$",
"quote",
")",
";",
"}"
] |
Add a NOT BETWEEN HAVING condition.
@param string $column column name
@param mixed $min minimum value
@param mixed $max maximum value
@param string $connector optional logical connector, default AND
@param bool|null $quote optional auto-escape value, default to global
@return Miner
|
[
"Add",
"a",
"NOT",
"BETWEEN",
"HAVING",
"condition",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L784-L787
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getStatement
|
public function getStatement($usePlaceholders = true)
{
$statement = "";
if ($this->isSelect()) {
$statement = $this->getSelectStatement($usePlaceholders);
} elseif ($this->isInsert()) {
$statement = $this->getInsertStatement($usePlaceholders);
} elseif ($this->isReplace()) {
$statement = $this->getReplaceStatement($usePlaceholders);
} elseif ($this->isUpdate()) {
$statement = $this->getUpdateStatement($usePlaceholders);
} elseif ($this->isDelete()) {
$statement = $this->getDeleteStatement($usePlaceholders);
}
return $statement;
}
|
php
|
public function getStatement($usePlaceholders = true)
{
$statement = "";
if ($this->isSelect()) {
$statement = $this->getSelectStatement($usePlaceholders);
} elseif ($this->isInsert()) {
$statement = $this->getInsertStatement($usePlaceholders);
} elseif ($this->isReplace()) {
$statement = $this->getReplaceStatement($usePlaceholders);
} elseif ($this->isUpdate()) {
$statement = $this->getUpdateStatement($usePlaceholders);
} elseif ($this->isDelete()) {
$statement = $this->getDeleteStatement($usePlaceholders);
}
return $statement;
}
|
[
"public",
"function",
"getStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"$",
"this",
"->",
"isSelect",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getSelectStatement",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isInsert",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getInsertStatement",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isReplace",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getReplaceStatement",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isUpdate",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getUpdateStatement",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isDelete",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getDeleteStatement",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full SQL statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full SQL statement
|
[
"Get",
"the",
"full",
"SQL",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L877-L892
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getSelectStatement
|
private function getSelectStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isSelect()) {
return $statement;
}
$statement .= $this->getSelectString();
if ($this->from) {
$statement .= " " . $this->getFromString();
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
if ($this->groupBy) {
$statement .= " " . $this->getGroupByString();
}
if ($this->having) {
$statement .= " " . $this->getHavingString($usePlaceholders);
}
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
return $statement;
}
|
php
|
private function getSelectStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isSelect()) {
return $statement;
}
$statement .= $this->getSelectString();
if ($this->from) {
$statement .= " " . $this->getFromString();
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
if ($this->groupBy) {
$statement .= " " . $this->getGroupByString();
}
if ($this->having) {
$statement .= " " . $this->getHavingString($usePlaceholders);
}
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
return $statement;
}
|
[
"private",
"function",
"getSelectStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isSelect",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getSelectString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"from",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getFromString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"where",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getWhereString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"groupBy",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getGroupByString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"having",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getHavingString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"orderBy",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getOrderByString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"limit",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getLimitString",
"(",
")",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full SELECT statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full SELECT statement
|
[
"Get",
"the",
"full",
"SELECT",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L910-L945
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getSelectString
|
public function getSelectString($includeText = true)
{
$statement = "";
if (!$this->select) {
return $statement;
}
$statement .= $this->getOptionsString(true);
foreach ($this->select as $column => $alias) {
$statement .= $column;
if ($alias) {
$statement .= " AS " . $alias;
}
$statement .= ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "SELECT " . $statement;
}
return $statement;
}
|
php
|
public function getSelectString($includeText = true)
{
$statement = "";
if (!$this->select) {
return $statement;
}
$statement .= $this->getOptionsString(true);
foreach ($this->select as $column => $alias) {
$statement .= $column;
if ($alias) {
$statement .= " AS " . $alias;
}
$statement .= ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "SELECT " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getSelectString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"select",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"select",
"as",
"$",
"column",
"=>",
"$",
"alias",
")",
"{",
"$",
"statement",
".=",
"$",
"column",
";",
"if",
"(",
"$",
"alias",
")",
"{",
"$",
"statement",
".=",
"\" AS \"",
".",
"$",
"alias",
";",
"}",
"$",
"statement",
".=",
"\", \"",
";",
"}",
"$",
"statement",
"=",
"substr",
"(",
"$",
"statement",
",",
"0",
",",
"-",
"2",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"SELECT \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the SELECT portion of the statement as a string.
@param bool $includeText optional include 'SELECT' text, default true
@return string SELECT portion of the statement
|
[
"Get",
"the",
"SELECT",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L953-L980
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getOptionsString
|
public function getOptionsString($includeTrailingSpace = false)
{
$statement = "";
if (!$this->option) {
return $statement;
}
$statement .= implode(' ', $this->option);
if ($includeTrailingSpace) {
$statement .= " ";
}
return $statement;
}
|
php
|
public function getOptionsString($includeTrailingSpace = false)
{
$statement = "";
if (!$this->option) {
return $statement;
}
$statement .= implode(' ', $this->option);
if ($includeTrailingSpace) {
$statement .= " ";
}
return $statement;
}
|
[
"public",
"function",
"getOptionsString",
"(",
"$",
"includeTrailingSpace",
"=",
"false",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"option",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"implode",
"(",
"' '",
",",
"$",
"this",
"->",
"option",
")",
";",
"if",
"(",
"$",
"includeTrailingSpace",
")",
"{",
"$",
"statement",
".=",
"\" \"",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the execution options portion of the statement as a string.
@param bool $includeTrailingSpace optional include space after options
@return string execution options portion of the statement
|
[
"Get",
"the",
"execution",
"options",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L988-L1003
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getFromString
|
public function getFromString($includeText = true)
{
$statement = "";
if (!$this->from) {
return $statement;
}
$statement .= $this->getFrom();
if ($this->getFromAlias()) {
$statement .= " AS " . $this->getFromAlias();
}
// Add any JOINs.
$statement .= " " . $this->getJoinString();
$statement = rtrim($statement);
if ($includeText && $statement) {
$statement = "FROM " . $statement;
}
return $statement;
}
|
php
|
public function getFromString($includeText = true)
{
$statement = "";
if (!$this->from) {
return $statement;
}
$statement .= $this->getFrom();
if ($this->getFromAlias()) {
$statement .= " AS " . $this->getFromAlias();
}
// Add any JOINs.
$statement .= " " . $this->getJoinString();
$statement = rtrim($statement);
if ($includeText && $statement) {
$statement = "FROM " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getFromString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"from",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getFrom",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getFromAlias",
"(",
")",
")",
"{",
"$",
"statement",
".=",
"\" AS \"",
".",
"$",
"this",
"->",
"getFromAlias",
"(",
")",
";",
"}",
"// Add any JOINs.",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getJoinString",
"(",
")",
";",
"$",
"statement",
"=",
"rtrim",
"(",
"$",
"statement",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"FROM \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the FROM portion of the statement, including all JOINs, as a string.
@param bool $includeText optional include 'FROM' text, default true
@return string FROM portion of the statement
|
[
"Get",
"the",
"FROM",
"portion",
"of",
"the",
"statement",
"including",
"all",
"JOINs",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1011-L1035
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getJoinCriteriaUsingPreviousTable
|
private function getJoinCriteriaUsingPreviousTable($joinIndex, $table, $column)
{
$joinCriteria = "";
$previousJoinIndex = $joinIndex - 1;
// If the previous table is from a JOIN, use that. Otherwise, use the
// FROM table.
if (array_key_exists($previousJoinIndex, $this->join)) {
$previousTable = $this->join[$previousJoinIndex]['alias'] ?? $this->join[$previousJoinIndex]['table'];
} elseif ($this->isSelect()) {
$previousTable = $this->getFromAlias() ?? $this->getFrom();
} elseif ($this->isUpdate()) {
$previousTable = $this->getUpdate();
} else {
$previousTable = false;
}
// In the off chance there is no previous table.
if ($previousTable) {
$joinCriteria .= $previousTable . ".";
}
$joinCriteria .= $column . " " . self::EQUALS . " " . $table . "." . $column;
return $joinCriteria;
}
|
php
|
private function getJoinCriteriaUsingPreviousTable($joinIndex, $table, $column)
{
$joinCriteria = "";
$previousJoinIndex = $joinIndex - 1;
// If the previous table is from a JOIN, use that. Otherwise, use the
// FROM table.
if (array_key_exists($previousJoinIndex, $this->join)) {
$previousTable = $this->join[$previousJoinIndex]['alias'] ?? $this->join[$previousJoinIndex]['table'];
} elseif ($this->isSelect()) {
$previousTable = $this->getFromAlias() ?? $this->getFrom();
} elseif ($this->isUpdate()) {
$previousTable = $this->getUpdate();
} else {
$previousTable = false;
}
// In the off chance there is no previous table.
if ($previousTable) {
$joinCriteria .= $previousTable . ".";
}
$joinCriteria .= $column . " " . self::EQUALS . " " . $table . "." . $column;
return $joinCriteria;
}
|
[
"private",
"function",
"getJoinCriteriaUsingPreviousTable",
"(",
"$",
"joinIndex",
",",
"$",
"table",
",",
"$",
"column",
")",
"{",
"$",
"joinCriteria",
"=",
"\"\"",
";",
"$",
"previousJoinIndex",
"=",
"$",
"joinIndex",
"-",
"1",
";",
"// If the previous table is from a JOIN, use that. Otherwise, use the",
"// FROM table.",
"if",
"(",
"array_key_exists",
"(",
"$",
"previousJoinIndex",
",",
"$",
"this",
"->",
"join",
")",
")",
"{",
"$",
"previousTable",
"=",
"$",
"this",
"->",
"join",
"[",
"$",
"previousJoinIndex",
"]",
"[",
"'alias'",
"]",
"??",
"$",
"this",
"->",
"join",
"[",
"$",
"previousJoinIndex",
"]",
"[",
"'table'",
"]",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isSelect",
"(",
")",
")",
"{",
"$",
"previousTable",
"=",
"$",
"this",
"->",
"getFromAlias",
"(",
")",
"??",
"$",
"this",
"->",
"getFrom",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"isUpdate",
"(",
")",
")",
"{",
"$",
"previousTable",
"=",
"$",
"this",
"->",
"getUpdate",
"(",
")",
";",
"}",
"else",
"{",
"$",
"previousTable",
"=",
"false",
";",
"}",
"// In the off chance there is no previous table.",
"if",
"(",
"$",
"previousTable",
")",
"{",
"$",
"joinCriteria",
".=",
"$",
"previousTable",
".",
"\".\"",
";",
"}",
"$",
"joinCriteria",
".=",
"$",
"column",
".",
"\" \"",
".",
"self",
"::",
"EQUALS",
".",
"\" \"",
".",
"$",
"table",
".",
"\".\"",
".",
"$",
"column",
";",
"return",
"$",
"joinCriteria",
";",
"}"
] |
Get an ON criteria string joining the specified table and column to the
same column of the previous JOIN or FROM table.
@param int $joinIndex index of current join
@param string $table current table name
@param string $column current column name
@return string ON join criteria
|
[
"Get",
"an",
"ON",
"criteria",
"string",
"joining",
"the",
"specified",
"table",
"and",
"column",
"to",
"the",
"same",
"column",
"of",
"the",
"previous",
"JOIN",
"or",
"FROM",
"table",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1109-L1133
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getWhereString
|
public function getWhereString($usePlaceholders = true, $includeText = true)
{
$statement = $this->getCriteriaString($this->where, $usePlaceholders, $this->wherePlaceholderValues);
if ($includeText && $statement) {
$statement = "WHERE " . $statement;
}
return $statement;
}
|
php
|
public function getWhereString($usePlaceholders = true, $includeText = true)
{
$statement = $this->getCriteriaString($this->where, $usePlaceholders, $this->wherePlaceholderValues);
if ($includeText && $statement) {
$statement = "WHERE " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getWhereString",
"(",
"$",
"usePlaceholders",
"=",
"true",
",",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getCriteriaString",
"(",
"$",
"this",
"->",
"where",
",",
"$",
"usePlaceholders",
",",
"$",
"this",
"->",
"wherePlaceholderValues",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"WHERE \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the WHERE portion of the statement as a string.
@param bool $usePlaceholders optional use ? placeholders, default true
@param bool $includeText optional include 'WHERE' text, default true
@return string WHERE portion of the statement
|
[
"Get",
"the",
"WHERE",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1162-L1171
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.autoQuote
|
public function autoQuote($value, $override = null)
{
return $this->getAutoQuote($override) ? $this->quote($value) : $value;
}
|
php
|
public function autoQuote($value, $override = null)
{
return $this->getAutoQuote($override) ? $this->quote($value) : $value;
}
|
[
"public",
"function",
"autoQuote",
"(",
"$",
"value",
",",
"$",
"override",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAutoQuote",
"(",
"$",
"override",
")",
"?",
"$",
"this",
"->",
"quote",
"(",
"$",
"value",
")",
":",
"$",
"value",
";",
"}"
] |
Safely escape a value if auto-quoting is enabled, or do nothing if
disabled.
The $override parameter is for convenience in checking if a specific
value should be quoted differently than the rest. 'null' defers to the
global setting.
@param mixed $value value to escape (or not)
@param bool|null $override value-specific override for convenience
@return mixed|false value (escaped or original) or false if failed
|
[
"Safely",
"escape",
"a",
"value",
"if",
"auto",
"-",
"quoting",
"is",
"enabled",
"or",
"do",
"nothing",
"if",
"disabled",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1315-L1318
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getGroupByString
|
public function getGroupByString($includeText = true)
{
$statement = "";
foreach ($this->groupBy as $groupBy) {
$statement .= $groupBy['column'];
if ($groupBy['order']) {
$statement .= " " . $groupBy['order'];
}
$statement .= ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "GROUP BY " . $statement;
}
return $statement;
}
|
php
|
public function getGroupByString($includeText = true)
{
$statement = "";
foreach ($this->groupBy as $groupBy) {
$statement .= $groupBy['column'];
if ($groupBy['order']) {
$statement .= " " . $groupBy['order'];
}
$statement .= ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "GROUP BY " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getGroupByString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"groupBy",
"as",
"$",
"groupBy",
")",
"{",
"$",
"statement",
".=",
"$",
"groupBy",
"[",
"'column'",
"]",
";",
"if",
"(",
"$",
"groupBy",
"[",
"'order'",
"]",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"groupBy",
"[",
"'order'",
"]",
";",
"}",
"$",
"statement",
".=",
"\", \"",
";",
"}",
"$",
"statement",
"=",
"substr",
"(",
"$",
"statement",
",",
"0",
",",
"-",
"2",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"GROUP BY \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the GROUP BY portion of the statement as a string.
@param bool $includeText optional include 'GROUP BY' text, default true
@return string GROUP BY portion of the statement
|
[
"Get",
"the",
"GROUP",
"BY",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1375-L1396
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getHavingString
|
public function getHavingString($usePlaceholders = true, $includeText = true)
{
$statement = $this->getCriteriaString($this->having, $usePlaceholders, $this->havingPlaceholderValues);
if ($includeText && $statement) {
$statement = "HAVING " . $statement;
}
return $statement;
}
|
php
|
public function getHavingString($usePlaceholders = true, $includeText = true)
{
$statement = $this->getCriteriaString($this->having, $usePlaceholders, $this->havingPlaceholderValues);
if ($includeText && $statement) {
$statement = "HAVING " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getHavingString",
"(",
"$",
"usePlaceholders",
"=",
"true",
",",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getCriteriaString",
"(",
"$",
"this",
"->",
"having",
",",
"$",
"usePlaceholders",
",",
"$",
"this",
"->",
"havingPlaceholderValues",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"HAVING \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the HAVING portion of the statement as a string.
@param bool $usePlaceholders optional use ? placeholders, default true
@param bool $includeText optional include 'HAVING' text, default true
@return string HAVING portion of the statement
|
[
"Get",
"the",
"HAVING",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1405-L1414
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getOrderByString
|
public function getOrderByString($includeText = true)
{
$statement = "";
foreach ($this->orderBy as $orderBy) {
$statement .= $orderBy['column'] . " " . $orderBy['order'] . ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "ORDER BY " . $statement;
}
return $statement;
}
|
php
|
public function getOrderByString($includeText = true)
{
$statement = "";
foreach ($this->orderBy as $orderBy) {
$statement .= $orderBy['column'] . " " . $orderBy['order'] . ", ";
}
$statement = substr($statement, 0, -2);
if ($includeText && $statement) {
$statement = "ORDER BY " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getOrderByString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"orderBy",
"as",
"$",
"orderBy",
")",
"{",
"$",
"statement",
".=",
"$",
"orderBy",
"[",
"'column'",
"]",
".",
"\" \"",
".",
"$",
"orderBy",
"[",
"'order'",
"]",
".",
"\", \"",
";",
"}",
"$",
"statement",
"=",
"substr",
"(",
"$",
"statement",
",",
"0",
",",
"-",
"2",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"ORDER BY \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the ORDER BY portion of the statement as a string.
@param bool $includeText optional include 'ORDER BY' text, default true
@return string ORDER BY portion of the statement
|
[
"Get",
"the",
"ORDER",
"BY",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1422-L1437
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getLimitString
|
public function getLimitString($includeText = true)
{
$statement = "";
if (!$this->limit) {
return $statement;
}
$statement .= $this->limit['limit'];
if ($this->limit['offset'] !== 0) {
$statement .= " OFFSET " . $this->limit['offset'];
}
if ($includeText && $statement) {
$statement = "LIMIT " . $statement;
}
return $statement;
}
|
php
|
public function getLimitString($includeText = true)
{
$statement = "";
if (!$this->limit) {
return $statement;
}
$statement .= $this->limit['limit'];
if ($this->limit['offset'] !== 0) {
$statement .= " OFFSET " . $this->limit['offset'];
}
if ($includeText && $statement) {
$statement = "LIMIT " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getLimitString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"limit",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"limit",
"[",
"'limit'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"limit",
"[",
"'offset'",
"]",
"!==",
"0",
")",
"{",
"$",
"statement",
".=",
"\" OFFSET \"",
".",
"$",
"this",
"->",
"limit",
"[",
"'offset'",
"]",
";",
"}",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"LIMIT \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the LIMIT portion of the statement as a string.
@param bool $includeText optional include 'LIMIT' text, default true
@return string LIMIT portion of the statement
|
[
"Get",
"the",
"LIMIT",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1445-L1464
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getInsertStatement
|
private function getInsertStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isInsert()) {
return $statement;
}
$statement .= $this->getInsertString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
return $statement;
}
|
php
|
private function getInsertStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isInsert()) {
return $statement;
}
$statement .= $this->getInsertString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
return $statement;
}
|
[
"private",
"function",
"getInsertStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isInsert",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getInsertString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getIntoString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"set",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getSetString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full INSERT statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full INSERT statement
|
[
"Get",
"the",
"full",
"INSERT",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1482-L1500
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getInsertString
|
public function getInsertString($includeText = true)
{
$statement = "";
if (!$this->insert) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getInsert();
if ($includeText && $statement) {
$statement = "INSERT " . $statement;
}
return $statement;
}
|
php
|
public function getInsertString($includeText = true)
{
$statement = "";
if (!$this->insert) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getInsert();
if ($includeText && $statement) {
$statement = "INSERT " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getInsertString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"insert",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
".",
"'INTO '",
";",
"}",
"else",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getInsert",
"(",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"INSERT \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the INSERT portion of the statement as a string.
@param bool $includeText optional include 'INSERT' text, default true
@return string INSERT portion of the statement
|
[
"Get",
"the",
"INSERT",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1508-L1529
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getReplaceStatement
|
private function getReplaceStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isReplace()) {
return $statement;
}
$statement .= $this->getReplaceString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
return $statement;
}
|
php
|
private function getReplaceStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isReplace()) {
return $statement;
}
$statement .= $this->getReplaceString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
return $statement;
}
|
[
"private",
"function",
"getReplaceStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isReplace",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getReplaceString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getIntoString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"set",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getSetString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full REPLACE statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full REPLACE statement
|
[
"Get",
"the",
"full",
"REPLACE",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1654-L1673
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getReplaceString
|
public function getReplaceString($includeText = true)
{
$statement = "";
if (!$this->replace) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getReplace();
if ($includeText && $statement) {
$statement = "REPLACE " . $statement;
}
return $statement;
}
|
php
|
public function getReplaceString($includeText = true)
{
$statement = "";
if (!$this->replace) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getReplace();
if ($includeText && $statement) {
$statement = "REPLACE " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getReplaceString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"replace",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
".",
"'INTO '",
";",
"}",
"else",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getReplace",
"(",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"REPLACE \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the REPLACE portion of the statement as a string.
@param bool $includeText optional include 'REPLACE' text, default true
@return string REPLACE portion of the statement
|
[
"Get",
"the",
"REPLACE",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1681-L1702
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getUpdateStatement
|
private function getUpdateStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isUpdate()) {
return $statement;
}
$statement .= $this->getUpdateString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
// ORDER BY and LIMIT are only applicable when updating a single table.
if (!$this->join) {
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
}
return $statement;
}
|
php
|
private function getUpdateStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isUpdate()) {
return $statement;
}
$statement .= $this->getUpdateString();
if ($this->isInto) {
$statement .= " " . $this->getIntoString($usePlaceholders);
} else {
if ($this->set) {
$statement .= " " . $this->getSetString($usePlaceholders);
}
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
// ORDER BY and LIMIT are only applicable when updating a single table.
if (!$this->join) {
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
}
return $statement;
}
|
[
"private",
"function",
"getUpdateStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isUpdate",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getUpdateString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getIntoString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"set",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getSetString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"where",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getWhereString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"// ORDER BY and LIMIT are only applicable when updating a single table.",
"if",
"(",
"!",
"$",
"this",
"->",
"join",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"orderBy",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getOrderByString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"limit",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getLimitString",
"(",
")",
";",
"}",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full UPDATE statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full UPDATE statement
|
[
"Get",
"the",
"full",
"UPDATE",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1720-L1754
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getUpdateString
|
public function getUpdateString($includeText = true)
{
$statement = "";
if (!$this->update) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getUpdate();
// Add any JOINs.
$statement .= " " . $this->getJoinString();
$statement = rtrim($statement);
if ($includeText && $statement) {
$statement = "UPDATE " . $statement;
}
return $statement;
}
|
php
|
public function getUpdateString($includeText = true)
{
$statement = "";
if (!$this->update) {
return $statement;
}
if ($this->isInto) {
$statement .= $this->getOptionsString(true) . 'INTO ';
} else {
$statement .= $this->getOptionsString(true);
}
$statement .= $this->getUpdate();
// Add any JOINs.
$statement .= " " . $this->getJoinString();
$statement = rtrim($statement);
if ($includeText && $statement) {
$statement = "UPDATE " . $statement;
}
return $statement;
}
|
[
"public",
"function",
"getUpdateString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"update",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isInto",
")",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
".",
"'INTO '",
";",
"}",
"else",
"{",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getUpdate",
"(",
")",
";",
"// Add any JOINs.",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getJoinString",
"(",
")",
";",
"$",
"statement",
"=",
"rtrim",
"(",
"$",
"statement",
")",
";",
"if",
"(",
"$",
"includeText",
"&&",
"$",
"statement",
")",
"{",
"$",
"statement",
"=",
"\"UPDATE \"",
".",
"$",
"statement",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the UPDATE portion of the statement as a string.
@param bool $includeText optional include 'UPDATE' text, default true
@return string UPDATE portion of the statement
|
[
"Get",
"the",
"UPDATE",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1762-L1787
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getDeleteStatement
|
private function getDeleteStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isDelete()) {
return $statement;
}
$statement .= $this->getDeleteString();
if ($this->from) {
$statement .= " " . $this->getFromString();
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
// ORDER BY and LIMIT are only applicable when deleting from a single
// table.
if ($this->isDeleteTableFrom()) {
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
}
return $statement;
}
|
php
|
private function getDeleteStatement($usePlaceholders = true)
{
$statement = "";
if (!$this->isDelete()) {
return $statement;
}
$statement .= $this->getDeleteString();
if ($this->from) {
$statement .= " " . $this->getFromString();
}
if ($this->where) {
$statement .= " " . $this->getWhereString($usePlaceholders);
}
// ORDER BY and LIMIT are only applicable when deleting from a single
// table.
if ($this->isDeleteTableFrom()) {
if ($this->orderBy) {
$statement .= " " . $this->getOrderByString();
}
if ($this->limit) {
$statement .= " " . $this->getLimitString();
}
}
return $statement;
}
|
[
"private",
"function",
"getDeleteStatement",
"(",
"$",
"usePlaceholders",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isDelete",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getDeleteString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"from",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getFromString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"where",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getWhereString",
"(",
"$",
"usePlaceholders",
")",
";",
"}",
"// ORDER BY and LIMIT are only applicable when deleting from a single",
"// table.",
"if",
"(",
"$",
"this",
"->",
"isDeleteTableFrom",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"orderBy",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getOrderByString",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"limit",
")",
"{",
"$",
"statement",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getLimitString",
"(",
")",
";",
"}",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the full DELETE statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full DELETE statement
|
[
"Get",
"the",
"full",
"DELETE",
"statement",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1805-L1836
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.getDeleteString
|
public function getDeleteString($includeText = true)
{
$statement = "";
if (!$this->delete && !$this->isDeleteTableFrom()) {
return $statement;
}
$statement .= $this->getOptionsString(true);
if (is_array($this->delete)) {
$statement .= implode(', ', $this->delete);
}
if ($includeText && ($statement || $this->isDeleteTableFrom())) {
$statement = "DELETE " . $statement;
// Trim in case the table is specified in FROM.
$statement = trim($statement);
}
return $statement;
}
|
php
|
public function getDeleteString($includeText = true)
{
$statement = "";
if (!$this->delete && !$this->isDeleteTableFrom()) {
return $statement;
}
$statement .= $this->getOptionsString(true);
if (is_array($this->delete)) {
$statement .= implode(', ', $this->delete);
}
if ($includeText && ($statement || $this->isDeleteTableFrom())) {
$statement = "DELETE " . $statement;
// Trim in case the table is specified in FROM.
$statement = trim($statement);
}
return $statement;
}
|
[
"public",
"function",
"getDeleteString",
"(",
"$",
"includeText",
"=",
"true",
")",
"{",
"$",
"statement",
"=",
"\"\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"delete",
"&&",
"!",
"$",
"this",
"->",
"isDeleteTableFrom",
"(",
")",
")",
"{",
"return",
"$",
"statement",
";",
"}",
"$",
"statement",
".=",
"$",
"this",
"->",
"getOptionsString",
"(",
"true",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"delete",
")",
")",
"{",
"$",
"statement",
".=",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"delete",
")",
";",
"}",
"if",
"(",
"$",
"includeText",
"&&",
"(",
"$",
"statement",
"||",
"$",
"this",
"->",
"isDeleteTableFrom",
"(",
")",
")",
")",
"{",
"$",
"statement",
"=",
"\"DELETE \"",
".",
"$",
"statement",
";",
"// Trim in case the table is specified in FROM.",
"$",
"statement",
"=",
"trim",
"(",
"$",
"statement",
")",
";",
"}",
"return",
"$",
"statement",
";",
"}"
] |
Get the DELETE portion of the statement as a string.
@param bool $includeText optional include 'DELETE' text, default true
@return string DELETE portion of the statement
|
[
"Get",
"the",
"DELETE",
"portion",
"of",
"the",
"statement",
"as",
"a",
"string",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1844-L1866
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeSelectInto
|
public function mergeSelectInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
foreach ($this->select as $column => $alias) {
$Miner->select($column, $alias);
}
return $Miner;
}
|
php
|
public function mergeSelectInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
foreach ($this->select as $column => $alias) {
$Miner->select($column, $alias);
}
return $Miner;
}
|
[
"public",
"function",
"mergeSelectInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"$",
"this",
"->",
"mergeOptionsInto",
"(",
"$",
"Miner",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"select",
"as",
"$",
"column",
"=>",
"$",
"alias",
")",
"{",
"$",
"Miner",
"->",
"select",
"(",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's SELECT into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"SELECT",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1950-L1959
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeOptionsInto
|
public function mergeOptionsInto(Miner $Miner)
{
foreach ($this->option as $option) {
$Miner->option($option);
}
return $Miner;
}
|
php
|
public function mergeOptionsInto(Miner $Miner)
{
foreach ($this->option as $option) {
$Miner->option($option);
}
return $Miner;
}
|
[
"public",
"function",
"mergeOptionsInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"option",
"as",
"$",
"option",
")",
"{",
"$",
"Miner",
"->",
"option",
"(",
"$",
"option",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's execution options into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"execution",
"options",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1967-L1974
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeFromInto
|
public function mergeFromInto(Miner $Miner)
{
if ($this->from) {
$Miner->from($this->getFrom(), $this->getFromAlias());
}
return $Miner;
}
|
php
|
public function mergeFromInto(Miner $Miner)
{
if ($this->from) {
$Miner->from($this->getFrom(), $this->getFromAlias());
}
return $Miner;
}
|
[
"public",
"function",
"mergeFromInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"from",
")",
"{",
"$",
"Miner",
"->",
"from",
"(",
"$",
"this",
"->",
"getFrom",
"(",
")",
",",
"$",
"this",
"->",
"getFromAlias",
"(",
")",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's FROM into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"FROM",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L1996-L2003
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.from
|
public function from($table, $alias = null)
{
$this->from['table'] = $table;
$this->from['alias'] = $alias;
return $this;
}
|
php
|
public function from($table, $alias = null)
{
$this->from['table'] = $table;
$this->from['alias'] = $alias;
return $this;
}
|
[
"public",
"function",
"from",
"(",
"$",
"table",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"from",
"[",
"'table'",
"]",
"=",
"$",
"table",
";",
"$",
"this",
"->",
"from",
"[",
"'alias'",
"]",
"=",
"$",
"alias",
";",
"return",
"$",
"this",
";",
"}"
] |
Set the FROM table with optional alias.
@param string $table table name
@param string $alias optional alias
@return Miner
|
[
"Set",
"the",
"FROM",
"table",
"with",
"optional",
"alias",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2012-L2018
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeJoinInto
|
public function mergeJoinInto(Miner $Miner)
{
foreach ($this->join as $join) {
$Miner->join($join['table'], $join['criteria'], $join['type'], $join['alias']);
}
return $Miner;
}
|
php
|
public function mergeJoinInto(Miner $Miner)
{
foreach ($this->join as $join) {
$Miner->join($join['table'], $join['criteria'], $join['type'], $join['alias']);
}
return $Miner;
}
|
[
"public",
"function",
"mergeJoinInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"join",
"as",
"$",
"join",
")",
"{",
"$",
"Miner",
"->",
"join",
"(",
"$",
"join",
"[",
"'table'",
"]",
",",
"$",
"join",
"[",
"'criteria'",
"]",
",",
"$",
"join",
"[",
"'type'",
"]",
",",
"$",
"join",
"[",
"'alias'",
"]",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's JOINs into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"JOINs",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2026-L2033
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeWhereInto
|
public function mergeWhereInto(Miner $Miner)
{
foreach ($this->where as $where) {
// Handle open/close brackets differently than other criteria.
if (array_key_exists('bracket', $where)) {
if (strcmp($where['bracket'], self::BRACKET_OPEN) == 0) {
$Miner->openWhere($where['connector']);
} else {
$Miner->closeWhere();
}
} else {
$Miner->where($where['column'], $where['value'], $where['operator'], $where['connector'], $where['quote']);
}
}
return $Miner;
}
|
php
|
public function mergeWhereInto(Miner $Miner)
{
foreach ($this->where as $where) {
// Handle open/close brackets differently than other criteria.
if (array_key_exists('bracket', $where)) {
if (strcmp($where['bracket'], self::BRACKET_OPEN) == 0) {
$Miner->openWhere($where['connector']);
} else {
$Miner->closeWhere();
}
} else {
$Miner->where($where['column'], $where['value'], $where['operator'], $where['connector'], $where['quote']);
}
}
return $Miner;
}
|
[
"public",
"function",
"mergeWhereInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"where",
"as",
"$",
"where",
")",
"{",
"// Handle open/close brackets differently than other criteria.",
"if",
"(",
"array_key_exists",
"(",
"'bracket'",
",",
"$",
"where",
")",
")",
"{",
"if",
"(",
"strcmp",
"(",
"$",
"where",
"[",
"'bracket'",
"]",
",",
"self",
"::",
"BRACKET_OPEN",
")",
"==",
"0",
")",
"{",
"$",
"Miner",
"->",
"openWhere",
"(",
"$",
"where",
"[",
"'connector'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"Miner",
"->",
"closeWhere",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"Miner",
"->",
"where",
"(",
"$",
"where",
"[",
"'column'",
"]",
",",
"$",
"where",
"[",
"'value'",
"]",
",",
"$",
"where",
"[",
"'operator'",
"]",
",",
"$",
"where",
"[",
"'connector'",
"]",
",",
"$",
"where",
"[",
"'quote'",
"]",
")",
";",
"}",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's WHERE into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"WHERE",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2041-L2057
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.openCriteria
|
private function openCriteria(array &$criteria, $connector = self::LOGICAL_AND)
{
$criteria[] = array('bracket' => self::BRACKET_OPEN,
'connector' => $connector);
return $this;
}
|
php
|
private function openCriteria(array &$criteria, $connector = self::LOGICAL_AND)
{
$criteria[] = array('bracket' => self::BRACKET_OPEN,
'connector' => $connector);
return $this;
}
|
[
"private",
"function",
"openCriteria",
"(",
"array",
"&",
"$",
"criteria",
",",
"$",
"connector",
"=",
"self",
"::",
"LOGICAL_AND",
")",
"{",
"$",
"criteria",
"[",
"]",
"=",
"array",
"(",
"'bracket'",
"=>",
"self",
"::",
"BRACKET_OPEN",
",",
"'connector'",
"=>",
"$",
"connector",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Add an open bracket for nesting conditions to the specified WHERE or
HAVING criteria.
@param array $criteria WHERE or HAVING criteria
@param string $connector optional logical connector, default AND
@return Miner
|
[
"Add",
"an",
"open",
"bracket",
"for",
"nesting",
"conditions",
"to",
"the",
"specified",
"WHERE",
"or",
"HAVING",
"criteria",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2078-L2084
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeGroupByInto
|
public function mergeGroupByInto(Miner $Miner)
{
foreach ($this->groupBy as $groupBy) {
$Miner->groupBy($groupBy['column'], $groupBy['order']);
}
return $Miner;
}
|
php
|
public function mergeGroupByInto(Miner $Miner)
{
foreach ($this->groupBy as $groupBy) {
$Miner->groupBy($groupBy['column'], $groupBy['order']);
}
return $Miner;
}
|
[
"public",
"function",
"mergeGroupByInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"groupBy",
"as",
"$",
"groupBy",
")",
"{",
"$",
"Miner",
"->",
"groupBy",
"(",
"$",
"groupBy",
"[",
"'column'",
"]",
",",
"$",
"groupBy",
"[",
"'order'",
"]",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's GROUP BY into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"GROUP",
"BY",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2132-L2139
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeHavingInto
|
public function mergeHavingInto(Miner $Miner)
{
foreach ($this->having as $having) {
// Handle open/close brackets differently than other criteria.
if (array_key_exists('bracket', $having)) {
if (strcmp($having['bracket'], self::BRACKET_OPEN) == 0) {
$Miner->openHaving($having['connector']);
} else {
$Miner->closeHaving();
}
} else {
$Miner->having($having['column'], $having['value'], $having['operator'],
$having['connector'], $having['quote']);
}
}
return $Miner;
}
|
php
|
public function mergeHavingInto(Miner $Miner)
{
foreach ($this->having as $having) {
// Handle open/close brackets differently than other criteria.
if (array_key_exists('bracket', $having)) {
if (strcmp($having['bracket'], self::BRACKET_OPEN) == 0) {
$Miner->openHaving($having['connector']);
} else {
$Miner->closeHaving();
}
} else {
$Miner->having($having['column'], $having['value'], $having['operator'],
$having['connector'], $having['quote']);
}
}
return $Miner;
}
|
[
"public",
"function",
"mergeHavingInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"having",
"as",
"$",
"having",
")",
"{",
"// Handle open/close brackets differently than other criteria.",
"if",
"(",
"array_key_exists",
"(",
"'bracket'",
",",
"$",
"having",
")",
")",
"{",
"if",
"(",
"strcmp",
"(",
"$",
"having",
"[",
"'bracket'",
"]",
",",
"self",
"::",
"BRACKET_OPEN",
")",
"==",
"0",
")",
"{",
"$",
"Miner",
"->",
"openHaving",
"(",
"$",
"having",
"[",
"'connector'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"Miner",
"->",
"closeHaving",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"Miner",
"->",
"having",
"(",
"$",
"having",
"[",
"'column'",
"]",
",",
"$",
"having",
"[",
"'value'",
"]",
",",
"$",
"having",
"[",
"'operator'",
"]",
",",
"$",
"having",
"[",
"'connector'",
"]",
",",
"$",
"having",
"[",
"'quote'",
"]",
")",
";",
"}",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's HAVING into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"HAVING",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2162-L2179
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeOrderByInto
|
public function mergeOrderByInto(Miner $Miner)
{
foreach ($this->orderBy as $orderBy) {
$Miner->orderBy($orderBy['column'], $orderBy['order']);
}
return $Miner;
}
|
php
|
public function mergeOrderByInto(Miner $Miner)
{
foreach ($this->orderBy as $orderBy) {
$Miner->orderBy($orderBy['column'], $orderBy['order']);
}
return $Miner;
}
|
[
"public",
"function",
"mergeOrderByInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"orderBy",
"as",
"$",
"orderBy",
")",
"{",
"$",
"Miner",
"->",
"orderBy",
"(",
"$",
"orderBy",
"[",
"'column'",
"]",
",",
"$",
"orderBy",
"[",
"'order'",
"]",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's ORDER BY into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"ORDER",
"BY",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2223-L2230
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.orderBy
|
public function orderBy($column, $order = self::ORDER_BY_ASC)
{
$this->orderBy[] = array('column' => $column,
'order' => $order);
return $this;
}
|
php
|
public function orderBy($column, $order = self::ORDER_BY_ASC)
{
$this->orderBy[] = array('column' => $column,
'order' => $order);
return $this;
}
|
[
"public",
"function",
"orderBy",
"(",
"$",
"column",
",",
"$",
"order",
"=",
"self",
"::",
"ORDER_BY_ASC",
")",
"{",
"$",
"this",
"->",
"orderBy",
"[",
"]",
"=",
"array",
"(",
"'column'",
"=>",
"$",
"column",
",",
"'order'",
"=>",
"$",
"order",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Add a column to ORDER BY.
@param string $column column name
@param string $order optional order direction, default ASC
@return Miner
|
[
"Add",
"a",
"column",
"to",
"ORDER",
"BY",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2239-L2245
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeLimitInto
|
public function mergeLimitInto(Miner $Miner)
{
if ($this->limit) {
$Miner->limit($this->getLimit(), $this->getLimitOffset());
}
return $Miner;
}
|
php
|
public function mergeLimitInto(Miner $Miner)
{
if ($this->limit) {
$Miner->limit($this->getLimit(), $this->getLimitOffset());
}
return $Miner;
}
|
[
"public",
"function",
"mergeLimitInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"limit",
")",
"{",
"$",
"Miner",
"->",
"limit",
"(",
"$",
"this",
"->",
"getLimit",
"(",
")",
",",
"$",
"this",
"->",
"getLimitOffset",
"(",
")",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's LIMIT into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"LIMIT",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2253-L2260
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeIntoColumns
|
public function mergeIntoColumns(Miner $Miner)
{
if ($this->intoColums) {
$Miner->intoColumns($this->intoColums);
}
return $Miner;
}
|
php
|
public function mergeIntoColumns(Miner $Miner)
{
if ($this->intoColums) {
$Miner->intoColumns($this->intoColums);
}
return $Miner;
}
|
[
"public",
"function",
"mergeIntoColumns",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"intoColums",
")",
"{",
"$",
"Miner",
"->",
"intoColumns",
"(",
"$",
"this",
"->",
"intoColums",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's INTOCOLUMS into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"INTOCOLUMS",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2303-L2310
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeIntoValues
|
public function mergeIntoValues(Miner $Miner)
{
if ($this->intoValues) {
$Miner->intoValues($this->intoValues);
}
return $Miner;
}
|
php
|
public function mergeIntoValues(Miner $Miner)
{
if ($this->intoValues) {
$Miner->intoValues($this->intoValues);
}
return $Miner;
}
|
[
"public",
"function",
"mergeIntoValues",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"intoValues",
")",
"{",
"$",
"Miner",
"->",
"intoValues",
"(",
"$",
"this",
"->",
"intoValues",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's INTOVALUES into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"INTOVALUES",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2318-L2325
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeSetInto
|
public function mergeSetInto(Miner $Miner)
{
foreach ($this->set as $set) {
$Miner->set($set['column'], $set['value'], $set['quote']);
}
return $Miner;
}
|
php
|
public function mergeSetInto(Miner $Miner)
{
foreach ($this->set as $set) {
$Miner->set($set['column'], $set['value'], $set['quote']);
}
return $Miner;
}
|
[
"public",
"function",
"mergeSetInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"set",
"as",
"$",
"set",
")",
"{",
"$",
"Miner",
"->",
"set",
"(",
"$",
"set",
"[",
"'column'",
"]",
",",
"$",
"set",
"[",
"'value'",
"]",
",",
"$",
"set",
"[",
"'quote'",
"]",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's SET into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"SET",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2354-L2361
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeUpdateInto
|
public function mergeUpdateInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
if ($this->update) {
$Miner->update($this->getUpdate());
}
return $Miner;
}
|
php
|
public function mergeUpdateInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
if ($this->update) {
$Miner->update($this->getUpdate());
}
return $Miner;
}
|
[
"public",
"function",
"mergeUpdateInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"$",
"this",
"->",
"mergeOptionsInto",
"(",
"$",
"Miner",
")",
";",
"if",
"(",
"$",
"this",
"->",
"update",
")",
"{",
"$",
"Miner",
"->",
"update",
"(",
"$",
"this",
"->",
"getUpdate",
"(",
")",
")",
";",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's UPDATE into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"UPDATE",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2390-L2399
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.mergeDeleteInto
|
public function mergeDeleteInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
if ($this->isDeleteTableFrom()) {
$Miner->delete();
} else {
foreach ($this->delete as $delete) {
$Miner->delete($delete);
}
}
return $Miner;
}
|
php
|
public function mergeDeleteInto(Miner $Miner)
{
$this->mergeOptionsInto($Miner);
if ($this->isDeleteTableFrom()) {
$Miner->delete();
} else {
foreach ($this->delete as $delete) {
$Miner->delete($delete);
}
}
return $Miner;
}
|
[
"public",
"function",
"mergeDeleteInto",
"(",
"Miner",
"$",
"Miner",
")",
"{",
"$",
"this",
"->",
"mergeOptionsInto",
"(",
"$",
"Miner",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isDeleteTableFrom",
"(",
")",
")",
"{",
"$",
"Miner",
"->",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"this",
"->",
"delete",
"as",
"$",
"delete",
")",
"{",
"$",
"Miner",
"->",
"delete",
"(",
"$",
"delete",
")",
";",
"}",
"}",
"return",
"$",
"Miner",
";",
"}"
] |
Merge this Miner's DELETE into the given Miner.
@param Miner $Miner to merge into
@return Miner
|
[
"Merge",
"this",
"Miner",
"s",
"DELETE",
"into",
"the",
"given",
"Miner",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2407-L2420
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/Mysql/Miner.php
|
Miner.delete
|
public function delete($table = false)
{
if ($table === false) {
$this->delete = true;
} else {
// Reset the array in case the class variable was previously set to a
// boolean value.
if (!is_array($this->delete)) {
$this->delete = array();
}
$this->delete[] = $table;
}
return $this;
}
|
php
|
public function delete($table = false)
{
if ($table === false) {
$this->delete = true;
} else {
// Reset the array in case the class variable was previously set to a
// boolean value.
if (!is_array($this->delete)) {
$this->delete = array();
}
$this->delete[] = $table;
}
return $this;
}
|
[
"public",
"function",
"delete",
"(",
"$",
"table",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"table",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"delete",
"=",
"true",
";",
"}",
"else",
"{",
"// Reset the array in case the class variable was previously set to a",
"// boolean value.",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"delete",
")",
")",
"{",
"$",
"this",
"->",
"delete",
"=",
"array",
"(",
")",
";",
"}",
"$",
"this",
"->",
"delete",
"[",
"]",
"=",
"$",
"table",
";",
"}",
"return",
"$",
"this",
";",
"}"
] |
Add a table to DELETE from, or false if deleting from the FROM table.
@param string|false $table optional table name, default false
@return Miner
|
[
"Add",
"a",
"table",
"to",
"DELETE",
"from",
"or",
"false",
"if",
"deleting",
"from",
"the",
"FROM",
"table",
"."
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/Mysql/Miner.php#L2428-L2443
|
train
|
SwooleDistributed/SwooleDistributed
|
src/Server/Asyn/AMQP/SwooleIO.php
|
SwooleIO.connect
|
public function connect()
{
$sock = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP);
if (!$sock->connect($this->host, $this->port, $this->connection_timeout))
{
throw new AMQPRuntimeException(
sprintf(
'Error Connecting to server(%s): %s ',
$sock->errCode,
swoole_strerror($sock->errCode)
),
$sock->errCode
);
}
$this->sock = $sock;
}
|
php
|
public function connect()
{
$sock = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP);
if (!$sock->connect($this->host, $this->port, $this->connection_timeout))
{
throw new AMQPRuntimeException(
sprintf(
'Error Connecting to server(%s): %s ',
$sock->errCode,
swoole_strerror($sock->errCode)
),
$sock->errCode
);
}
$this->sock = $sock;
}
|
[
"public",
"function",
"connect",
"(",
")",
"{",
"$",
"sock",
"=",
"new",
"Swoole",
"\\",
"Coroutine",
"\\",
"Client",
"(",
"SWOOLE_SOCK_TCP",
")",
";",
"if",
"(",
"!",
"$",
"sock",
"->",
"connect",
"(",
"$",
"this",
"->",
"host",
",",
"$",
"this",
"->",
"port",
",",
"$",
"this",
"->",
"connection_timeout",
")",
")",
"{",
"throw",
"new",
"AMQPRuntimeException",
"(",
"sprintf",
"(",
"'Error Connecting to server(%s): %s '",
",",
"$",
"sock",
"->",
"errCode",
",",
"swoole_strerror",
"(",
"$",
"sock",
"->",
"errCode",
")",
")",
",",
"$",
"sock",
"->",
"errCode",
")",
";",
"}",
"$",
"this",
"->",
"sock",
"=",
"$",
"sock",
";",
"}"
] |
Sets up the stream connection
@throws \PhpAmqpLib\Exception\AMQPRuntimeException
@throws \Exception
|
[
"Sets",
"up",
"the",
"stream",
"connection"
] |
bca3c1fde5a3160747b7e2234bb3851a19bc2e94
|
https://github.com/SwooleDistributed/SwooleDistributed/blob/bca3c1fde5a3160747b7e2234bb3851a19bc2e94/src/Server/Asyn/AMQP/SwooleIO.php#L115-L130
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.