id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,700 | Innmind/neo4j-dbal | src/Query/Query.php | Query.return | public function return(string ...$variables): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\ReturnClause(...$variables)
);
return $query;
} | php | public function return(string ...$variables): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\ReturnClause(...$variables)
);
return $query;
} | [
"public",
"function",
"return",
"(",
"string",
"...",
"$",
"variables",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
"->",
"add",
"(",
"new",
"Clause",
"\\",
"ReturnCl... | Add a RETURN clause
@param string[] $variables
@return self | [
"Add",
"a",
"RETURN",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L554-L562 |
22,701 | Innmind/neo4j-dbal | src/Query/Query.php | Query.remove | public function remove(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\RemoveClause($cypher)
);
return $query;
} | php | public function remove(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\RemoveClause($cypher)
);
return $query;
} | [
"public",
"function",
"remove",
"(",
"string",
"$",
"cypher",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
"->",
"add",
"(",
"new",
"Clause",
"\\",
"RemoveClause",
"("... | Add a REMOVE clause
@param string $cypher
@return self | [
"Add",
"a",
"REMOVE",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L571-L579 |
22,702 | Innmind/neo4j-dbal | src/Query/Query.php | Query.orderBy | public function orderBy(
string $cypher,
string $direction = 'ASC'
): self {
$direction = \strtolower($direction);
$query = new self;
$query->clauses = $this->clauses->add(
Clause\OrderByClause::$direction($cypher)
);
return $query;
} | php | public function orderBy(
string $cypher,
string $direction = 'ASC'
): self {
$direction = \strtolower($direction);
$query = new self;
$query->clauses = $this->clauses->add(
Clause\OrderByClause::$direction($cypher)
);
return $query;
} | [
"public",
"function",
"orderBy",
"(",
"string",
"$",
"cypher",
",",
"string",
"$",
"direction",
"=",
"'ASC'",
")",
":",
"self",
"{",
"$",
"direction",
"=",
"\\",
"strtolower",
"(",
"$",
"direction",
")",
";",
"$",
"query",
"=",
"new",
"self",
";",
"$... | Add a ORDER BY clause
@param string $cypher
@param string $direction
@return self | [
"Add",
"a",
"ORDER",
"BY",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L589-L601 |
22,703 | Innmind/neo4j-dbal | src/Query/Query.php | Query.onMatch | public function onMatch(string $cypher): self
{
$clause = $this->clauses->last();
if (
!$clause instanceof Clause\MergeClause &&
!$clause instanceof Clause\OnCreateClause
) {
throw new NonMergeClause;
}
$query = new self;
$query->... | php | public function onMatch(string $cypher): self
{
$clause = $this->clauses->last();
if (
!$clause instanceof Clause\MergeClause &&
!$clause instanceof Clause\OnCreateClause
) {
throw new NonMergeClause;
}
$query = new self;
$query->... | [
"public",
"function",
"onMatch",
"(",
"string",
"$",
"cypher",
")",
":",
"self",
"{",
"$",
"clause",
"=",
"$",
"this",
"->",
"clauses",
"->",
"last",
"(",
")",
";",
"if",
"(",
"!",
"$",
"clause",
"instanceof",
"Clause",
"\\",
"MergeClause",
"&&",
"!"... | Add a ON MATCH clause
@param string $cypher
@throws NonMergeClause
@return self | [
"Add",
"a",
"ON",
"MATCH",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L612-L629 |
22,704 | Innmind/neo4j-dbal | src/Query/Query.php | Query.merge | public function merge(string $variable = null, array $labels = []): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\MergeClause(
Clause\Expression\Path::startWithNode($variable, $labels)
)
);
return $query;
} | php | public function merge(string $variable = null, array $labels = []): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\MergeClause(
Clause\Expression\Path::startWithNode($variable, $labels)
)
);
return $query;
} | [
"public",
"function",
"merge",
"(",
"string",
"$",
"variable",
"=",
"null",
",",
"array",
"$",
"labels",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
... | Add a MERGE clause
@param string $variable
@param array $labels
@return self | [
"Add",
"a",
"MERGE",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L667-L677 |
22,705 | Innmind/neo4j-dbal | src/Query/Query.php | Query.limit | public function limit(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\LimitClause($cypher)
);
return $query;
} | php | public function limit(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\LimitClause($cypher)
);
return $query;
} | [
"public",
"function",
"limit",
"(",
"string",
"$",
"cypher",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
"->",
"add",
"(",
"new",
"Clause",
"\\",
"LimitClause",
"(",
... | Add a LIMIT clause
@see http://neo4j.com/docs/stable/query-limit.html#limit-return-first-from-expression
@param string $cypher
@return self | [
"Add",
"a",
"LIMIT",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L687-L695 |
22,706 | Innmind/neo4j-dbal | src/Query/Query.php | Query.foreach | public function foreach(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\ForeachClause($cypher)
);
return $query;
} | php | public function foreach(string $cypher): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\ForeachClause($cypher)
);
return $query;
} | [
"public",
"function",
"foreach",
"(",
"string",
"$",
"cypher",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
"->",
"add",
"(",
"new",
"Clause",
"\\",
"ForeachClause",
"... | Add a FOREACH clause
@param string $cypher
@return self | [
"Add",
"a",
"FOREACH",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L704-L712 |
22,707 | Innmind/neo4j-dbal | src/Query/Query.php | Query.delete | public function delete(string $variable, bool $detach = false): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\DeleteClause($variable, $detach)
);
return $query;
} | php | public function delete(string $variable, bool $detach = false): self
{
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\DeleteClause($variable, $detach)
);
return $query;
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"variable",
",",
"bool",
"$",
"detach",
"=",
"false",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
"$",
"this",
"->",
"clauses",
"->",
"add",
"... | Add a DELETE clause
@param string $variable
@param bool $detach
@return self | [
"Add",
"a",
"DELETE",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L722-L730 |
22,708 | Innmind/neo4j-dbal | src/Query/Query.php | Query.create | public function create(
string $variable,
array $labels = [],
bool $unique = false
): self {
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\CreateClause(
Clause\Expression\Path::startWithNode($variable, $labels),
... | php | public function create(
string $variable,
array $labels = [],
bool $unique = false
): self {
$query = new self;
$query->clauses = $this->clauses->add(
new Clause\CreateClause(
Clause\Expression\Path::startWithNode($variable, $labels),
... | [
"public",
"function",
"create",
"(",
"string",
"$",
"variable",
",",
"array",
"$",
"labels",
"=",
"[",
"]",
",",
"bool",
"$",
"unique",
"=",
"false",
")",
":",
"self",
"{",
"$",
"query",
"=",
"new",
"self",
";",
"$",
"query",
"->",
"clauses",
"=",
... | Add a CREATE clause
@param string $variable
@param array $labels
@param bool $unique
@return self | [
"Add",
"a",
"CREATE",
"clause"
] | 12cb71e698cc0f4d55b7f2eb40f7b353c778a20b | https://github.com/Innmind/neo4j-dbal/blob/12cb71e698cc0f4d55b7f2eb40f7b353c778a20b/src/Query/Query.php#L741-L755 |
22,709 | nabab/bbn | src/bbn/file.php | file.get_size | public function get_size()
{
if ( $this->file && $this->size === 0 ){
$this->size = filesize($this->file);
}
return $this->size;
} | php | public function get_size()
{
if ( $this->file && $this->size === 0 ){
$this->size = filesize($this->file);
}
return $this->size;
} | [
"public",
"function",
"get_size",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"file",
"&&",
"$",
"this",
"->",
"size",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"size",
"=",
"filesize",
"(",
"$",
"this",
"->",
"file",
")",
";",
"}",
"return",
"... | Return the filesize in byte.
```php
$file = new bbn\file('C:/Test/file.txt');
bbn\x::dump($file->get_size());
// (int) 314
```
@return int | [
"Return",
"the",
"filesize",
"in",
"byte",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file.php#L126-L132 |
22,710 | nabab/bbn | src/bbn/file.php | file.get_extension | public function get_extension()
{
if ( $this->name ){
if ( !isset($this->ext) ){
if ( strpos($this->name, '.') !== false ){
$p = str::file_ext($this->name, 1);
$this->ext = $p[1];
$this->title = $p[0];
}
else{
$this->ext = '';
$this->... | php | public function get_extension()
{
if ( $this->name ){
if ( !isset($this->ext) ){
if ( strpos($this->name, '.') !== false ){
$p = str::file_ext($this->name, 1);
$this->ext = $p[1];
$this->title = $p[0];
}
else{
$this->ext = '';
$this->... | [
"public",
"function",
"get_extension",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"ext",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->",
"name",
",",
"'.'",
")",
... | Return the extension of the file.
```php
$file = new file('C:/Test/file.txt');
bbn\x::dump($file->get_extension());
//(string) 'txt'
```
@return string|false | [
"Return",
"the",
"extension",
"of",
"the",
"file",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file.php#L163-L180 |
22,711 | nabab/bbn | src/bbn/file.php | file.make | protected function make()
{
if ( !$this->file && strpos($this->path,'http://') === 0 ){
$d = getcwd();
chdir(__DIR__);
chdir('../tmp');
$f = tempnam('.','image');
try{
$c = file_get_contents($this->path.$this->name);
if ( file_put_contents($f, $c) ){
if ( su... | php | protected function make()
{
if ( !$this->file && strpos($this->path,'http://') === 0 ){
$d = getcwd();
chdir(__DIR__);
chdir('../tmp');
$f = tempnam('.','image');
try{
$c = file_get_contents($this->path.$this->name);
if ( file_put_contents($f, $c) ){
if ( su... | [
"protected",
"function",
"make",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"&&",
"strpos",
"(",
"$",
"this",
"->",
"path",
",",
"'http://'",
")",
"===",
"0",
")",
"{",
"$",
"d",
"=",
"getcwd",
"(",
")",
";",
"chdir",
"(",
"__DIR... | Creates a temporary file in tmp directory.
@todo of adjusting
@return file | [
"Creates",
"a",
"temporary",
"file",
"in",
"tmp",
"directory",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file.php#L188-L214 |
22,712 | nabab/bbn | src/bbn/file.php | file.download | public function download()
{
if ( $this->file ){
if ( !$this->size ){
$this->get_size();
}
if ( $this->size && ($handle = fopen($this->file, 'r')) ){
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$this->name.'"');
... | php | public function download()
{
if ( $this->file ){
if ( !$this->size ){
$this->get_size();
}
if ( $this->size && ($handle = fopen($this->file, 'r')) ){
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$this->name.'"');
... | [
"public",
"function",
"download",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"file",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"size",
")",
"{",
"$",
"this",
"->",
"get_size",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"size",
"&&... | Downloads the file. At the end of the script the user will be invited to choose the file's destination. If the file doesn't exist return an object with parameter file = null.
```php
$f = new \bbn\file('C:/Test/file.png');
$f->download();
```
@return file | [
"Downloads",
"the",
"file",
".",
"At",
"the",
"end",
"of",
"the",
"script",
"the",
"user",
"will",
"be",
"invited",
"to",
"choose",
"the",
"file",
"s",
"destination",
".",
"If",
"the",
"file",
"doesn",
"t",
"exist",
"return",
"an",
"object",
"with",
"p... | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file.php#L226-L245 |
22,713 | nabab/bbn | src/bbn/file.php | file.save | public function save($dest='./')
{
$new_name = false;
if ( substr($dest,-1) === '/' ){
if ( is_dir($dest) ){
$new_name = 0;
}
}
else if ( is_dir($dest) ){
$dest .= '/';
$new_name = 0;
}
else if ( is_dir(substr($dest,0,strrpos($dest,'/'))) ){
$new_name = 1;... | php | public function save($dest='./')
{
$new_name = false;
if ( substr($dest,-1) === '/' ){
if ( is_dir($dest) ){
$new_name = 0;
}
}
else if ( is_dir($dest) ){
$dest .= '/';
$new_name = 0;
}
else if ( is_dir(substr($dest,0,strrpos($dest,'/'))) ){
$new_name = 1;... | [
"public",
"function",
"save",
"(",
"$",
"dest",
"=",
"'./'",
")",
"{",
"$",
"new_name",
"=",
"false",
";",
"if",
"(",
"substr",
"(",
"$",
"dest",
",",
"-",
"1",
")",
"===",
"'/'",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"dest",
")",
")",
"{"... | That feature saves the file as a parameter, and accepts a string that contains the path where to save.
```php
$file->save('/home/user/desktop/');
```
@param string $dest
@return file | [
"That",
"feature",
"saves",
"the",
"file",
"as",
"a",
"parameter",
"and",
"accepts",
"a",
"string",
"that",
"contains",
"the",
"path",
"where",
"to",
"save",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file.php#L299-L328 |
22,714 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Inputstream/String.php | HTML5_Inputstream_String.unconsume | public function unconsume($howMany = 1) {
if (($this->char - $howMany) >= 0) {
$this->char = $this->char - $howMany;
}
} | php | public function unconsume($howMany = 1) {
if (($this->char - $howMany) >= 0) {
$this->char = $this->char - $howMany;
}
} | [
"public",
"function",
"unconsume",
"(",
"$",
"howMany",
"=",
"1",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"char",
"-",
"$",
"howMany",
")",
">=",
"0",
")",
"{",
"$",
"this",
"->",
"char",
"=",
"$",
"this",
"->",
"char",
"-",
"$",
"howMany"... | Unconsume characters.
@param int $howMany
The number of characters to unconsume. | [
"Unconsume",
"characters",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Inputstream/String.php#L380-L384 |
22,715 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Inputstream/String.php | HTML5_Inputstream_String.peek | public function peek() {
if (($this->char + 1) <= $this->EOF) {
return $this->data[$this->char + 1];
}
return false;
} | php | public function peek() {
if (($this->char + 1) <= $this->EOF) {
return $this->data[$this->char + 1];
}
return false;
} | [
"public",
"function",
"peek",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"char",
"+",
"1",
")",
"<=",
"$",
"this",
"->",
"EOF",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"this",
"->",
"char",
"+",
"1",
"]",
";",
"}",
"... | Look ahead without moving cursor. | [
"Look",
"ahead",
"without",
"moving",
"cursor",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Inputstream/String.php#L389-L395 |
22,716 | surebert/surebert-framework | src/sb/ICalendar/Event.php | Event.send | public function send()
{
$subject = 'EVENT';
if ($this->method == 'CANCEL') {
$subject = 'CANCELED ' . $subject;
if (empty($this->uid)) {
throw(new \Exception('Must set uid to cancel an event.'));
}
}
if (!empty($this->summary)) {... | php | public function send()
{
$subject = 'EVENT';
if ($this->method == 'CANCEL') {
$subject = 'CANCELED ' . $subject;
if (empty($this->uid)) {
throw(new \Exception('Must set uid to cancel an event.'));
}
}
if (!empty($this->summary)) {... | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"subject",
"=",
"'EVENT'",
";",
"if",
"(",
"$",
"this",
"->",
"method",
"==",
"'CANCEL'",
")",
"{",
"$",
"subject",
"=",
"'CANCELED '",
".",
"$",
"subject",
";",
"if",
"(",
"empty",
"(",
"$",
"this"... | Send via email the subject is the first 20 chars of the summary,
the message is the summary. The email is sent to the organizer's email,
The attendees all cc'd
@return boolean | [
"Send",
"via",
"email",
"the",
"subject",
"is",
"the",
"first",
"20",
"chars",
"of",
"the",
"summary",
"the",
"message",
"is",
"the",
"summary",
".",
"The",
"email",
"is",
"sent",
"to",
"the",
"organizer",
"s",
"email",
"The",
"attendees",
"all",
"cc",
... | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/ICalendar/Event.php#L174-L200 |
22,717 | eghojansu/moe | src/tools/web/PingBack.php | Pingback.enabled | protected function enabled($url) {
$web=Web::instance();
$req=$web->request($url);
$found=FALSE;
if ($req && $req['body']) {
// Look for pingback header
foreach ($req['headers'] as $header)
if (preg_match('/^X-Pingback:\h*(.+)/',$header,$href)) {
$found=$href[1];
break;
}
if (!$found ... | php | protected function enabled($url) {
$web=Web::instance();
$req=$web->request($url);
$found=FALSE;
if ($req && $req['body']) {
// Look for pingback header
foreach ($req['headers'] as $header)
if (preg_match('/^X-Pingback:\h*(.+)/',$header,$href)) {
$found=$href[1];
break;
}
if (!$found ... | [
"protected",
"function",
"enabled",
"(",
"$",
"url",
")",
"{",
"$",
"web",
"=",
"Web",
"::",
"instance",
"(",
")",
";",
"$",
"req",
"=",
"$",
"web",
"->",
"request",
"(",
"$",
"url",
")",
";",
"$",
"found",
"=",
"FALSE",
";",
"if",
"(",
"$",
... | Return TRUE if URL points to a pingback-enabled resource
@return bool
@param $url | [
"Return",
"TRUE",
"if",
"URL",
"points",
"to",
"a",
"pingback",
"-",
"enabled",
"resource"
] | f58ec75a3116d1a572782256e2b38bb9aab95e3c | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/web/PingBack.php#L22-L41 |
22,718 | eghojansu/moe | src/tools/web/PingBack.php | Pingback.inspect | function inspect($source) {
$fw=Base::instance();
$web=Web::instance();
$parts=parse_url($source);
if (empty($parts['scheme']) || empty($parts['host']) ||
$parts['host']==$fw->get('HOST')) {
$req=$web->request($source);
$doc=new DOMDocument('1.0',$fw->get('ENCODING'));
$doc->stricterrorchecking=FALS... | php | function inspect($source) {
$fw=Base::instance();
$web=Web::instance();
$parts=parse_url($source);
if (empty($parts['scheme']) || empty($parts['host']) ||
$parts['host']==$fw->get('HOST')) {
$req=$web->request($source);
$doc=new DOMDocument('1.0',$fw->get('ENCODING'));
$doc->stricterrorchecking=FALS... | [
"function",
"inspect",
"(",
"$",
"source",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"$",
"web",
"=",
"Web",
"::",
"instance",
"(",
")",
";",
"$",
"parts",
"=",
"parse_url",
"(",
"$",
"source",
")",
";",
"if",
"(",
"emp... | Load local page contents, parse HTML anchor tags, find permalinks,
and send XML-RPC calls to corresponding pingback servers
@return NULL
@param $source string | [
"Load",
"local",
"page",
"contents",
"parse",
"HTML",
"anchor",
"tags",
"find",
"permalinks",
"and",
"send",
"XML",
"-",
"RPC",
"calls",
"to",
"corresponding",
"pingback",
"servers"
] | f58ec75a3116d1a572782256e2b38bb9aab95e3c | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/web/PingBack.php#L49-L86 |
22,719 | eghojansu/moe | src/tools/web/PingBack.php | Pingback.listen | function listen($func,$path=NULL) {
$fw=Base::instance();
if (PHP_SAPI!='cli') {
header('X-Powered-By: '.$fw->get('PACKAGE'));
header('Content-Type: application/xml; '.
'charset='.$charset=$fw->get('ENCODING'));
}
if (!$path)
$path=$fw->get('BASE');
$web=Web::instance();
$args=xmlrpc_decode_req... | php | function listen($func,$path=NULL) {
$fw=Base::instance();
if (PHP_SAPI!='cli') {
header('X-Powered-By: '.$fw->get('PACKAGE'));
header('Content-Type: application/xml; '.
'charset='.$charset=$fw->get('ENCODING'));
}
if (!$path)
$path=$fw->get('BASE');
$web=Web::instance();
$args=xmlrpc_decode_req... | [
"function",
"listen",
"(",
"$",
"func",
",",
"$",
"path",
"=",
"NULL",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"PHP_SAPI",
"!=",
"'cli'",
")",
"{",
"header",
"(",
"'X-Powered-By: '",
".",
"$",
"fw",
"->",
"ge... | Receive ping, check if local page is pingback-enabled, verify
source contents, and return XML-RPC response
@return string
@param $func callback
@param $path string | [
"Receive",
"ping",
"check",
"if",
"local",
"page",
"is",
"pingback",
"-",
"enabled",
"verify",
"source",
"contents",
"and",
"return",
"XML",
"-",
"RPC",
"response"
] | f58ec75a3116d1a572782256e2b38bb9aab95e3c | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/web/PingBack.php#L95-L143 |
22,720 | ekuiter/feature-php | FeaturePhp/Generator/AspectGenerator.php | AspectGenerator.processFileSpecification | protected function processFileSpecification($artifact, $fileSpecification) {
$this->aspectKernel->addAspect(new fphp\Aspect\Aspect($artifact, $fileSpecification));
$this->tracingLinks[] = new fphp\Artifact\TracingLink(
"aspect", $artifact, $fileSpecification->getSourcePlace(), $fileSpecifica... | php | protected function processFileSpecification($artifact, $fileSpecification) {
$this->aspectKernel->addAspect(new fphp\Aspect\Aspect($artifact, $fileSpecification));
$this->tracingLinks[] = new fphp\Artifact\TracingLink(
"aspect", $artifact, $fileSpecification->getSourcePlace(), $fileSpecifica... | [
"protected",
"function",
"processFileSpecification",
"(",
"$",
"artifact",
",",
"$",
"fileSpecification",
")",
"{",
"$",
"this",
"->",
"aspectKernel",
"->",
"addAspect",
"(",
"new",
"fphp",
"\\",
"Aspect",
"\\",
"Aspect",
"(",
"$",
"artifact",
",",
"$",
"fil... | Adds an aspect from a file to the aspect kernel.
@param \FeaturePhp\Artifact\Artifact $artifact
@param \FeaturePhp\Specification\FileSpecification $fileSpecification | [
"Adds",
"an",
"aspect",
"from",
"a",
"file",
"to",
"the",
"aspect",
"kernel",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/AspectGenerator.php#L70-L75 |
22,721 | ekuiter/feature-php | FeaturePhp/Generator/AspectGenerator.php | AspectGenerator._generateFiles | protected function _generateFiles() {
if ($this->feature && !$this->isSelectedFeature($this->feature)) {
$this->logFile->log(null, "did not add aspect kernel because \"$this->feature\" is not selected");
return;
}
parent::_generateFiles();
$this->files = array_me... | php | protected function _generateFiles() {
if ($this->feature && !$this->isSelectedFeature($this->feature)) {
$this->logFile->log(null, "did not add aspect kernel because \"$this->feature\" is not selected");
return;
}
parent::_generateFiles();
$this->files = array_me... | [
"protected",
"function",
"_generateFiles",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"feature",
"&&",
"!",
"$",
"this",
"->",
"isSelectedFeature",
"(",
"$",
"this",
"->",
"feature",
")",
")",
"{",
"$",
"this",
"->",
"logFile",
"->",
"log",
"(",
"n... | Generates the aspect files and the aspect kernel. | [
"Generates",
"the",
"aspect",
"files",
"and",
"the",
"aspect",
"kernel",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/AspectGenerator.php#L80-L89 |
22,722 | zhouyl/mellivora | Mellivora/Database/Concerns/ManagesTransactions.php | ManagesTransactions.handleTransactionException | protected function handleTransactionException($e, $currentAttempt, $maxAttempts)
{
// On a deadlock, MySQL rolls back the entire transaction so we can't just
// retry the query. We have to throw this exception all the way out and
// let the developer handle it in another way. We will decreme... | php | protected function handleTransactionException($e, $currentAttempt, $maxAttempts)
{
// On a deadlock, MySQL rolls back the entire transaction so we can't just
// retry the query. We have to throw this exception all the way out and
// let the developer handle it in another way. We will decreme... | [
"protected",
"function",
"handleTransactionException",
"(",
"$",
"e",
",",
"$",
"currentAttempt",
",",
"$",
"maxAttempts",
")",
"{",
"// On a deadlock, MySQL rolls back the entire transaction so we can't just",
"// retry the query. We have to throw this exception all the way out and",
... | Handle an exception encountered when running a transacted statement.
@param \Exception $e
@param int $currentAttempt
@param int $maxAttempts
@throws \Exception
@return void | [
"Handle",
"an",
"exception",
"encountered",
"when",
"running",
"a",
"transacted",
"statement",
"."
] | 79f844c5c9c25ffbe18d142062e9bc3df00b36a1 | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Concerns/ManagesTransactions.php#L63-L86 |
22,723 | zhouyl/mellivora | Mellivora/Database/Concerns/ManagesTransactions.php | ManagesTransactions.createTransaction | protected function createTransaction()
{
if ($this->transactions === 0) {
try {
$this->getPdo()->beginTransaction();
} catch (Exception $e) {
$this->handleBeginTransactionException($e);
}
} elseif ($this->transactions >= 1 && $this-... | php | protected function createTransaction()
{
if ($this->transactions === 0) {
try {
$this->getPdo()->beginTransaction();
} catch (Exception $e) {
$this->handleBeginTransactionException($e);
}
} elseif ($this->transactions >= 1 && $this-... | [
"protected",
"function",
"createTransaction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transactions",
"===",
"0",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"getPdo",
"(",
")",
"->",
"beginTransaction",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",... | Create a transaction within the database.
@return void | [
"Create",
"a",
"transaction",
"within",
"the",
"database",
"."
] | 79f844c5c9c25ffbe18d142062e9bc3df00b36a1 | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Concerns/ManagesTransactions.php#L109-L120 |
22,724 | zhouyl/mellivora | Mellivora/Database/Concerns/ManagesTransactions.php | ManagesTransactions.performRollBack | protected function performRollBack($toLevel)
{
if ($toLevel === 0) {
$this->getPdo()->rollBack();
} elseif ($this->queryGrammar->supportsSavepoints()) {
$this->getPdo()->exec(
$this->queryGrammar->compileSavepointRollBack('trans' . ($toLevel + 1))
... | php | protected function performRollBack($toLevel)
{
if ($toLevel === 0) {
$this->getPdo()->rollBack();
} elseif ($this->queryGrammar->supportsSavepoints()) {
$this->getPdo()->exec(
$this->queryGrammar->compileSavepointRollBack('trans' . ($toLevel + 1))
... | [
"protected",
"function",
"performRollBack",
"(",
"$",
"toLevel",
")",
"{",
"if",
"(",
"$",
"toLevel",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"getPdo",
"(",
")",
"->",
"rollBack",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"queryGrammar",... | Perform a rollback within the database.
@param int $toLevel
@return void | [
"Perform",
"a",
"rollback",
"within",
"the",
"database",
"."
] | 79f844c5c9c25ffbe18d142062e9bc3df00b36a1 | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Concerns/ManagesTransactions.php#L207-L216 |
22,725 | wenbinye/PhalconX | src/Mvc/Model.php | Model.findPk | public static function findPk($pk)
{
if (empty($pk)) {
return false;
}
if (is_array($pk)) {
$conditions = '';
$sep = '';
foreach ($pk as $name => $value) {
$conditions .= $sep . "$name=:$name:";
$sep = ' AND ';
... | php | public static function findPk($pk)
{
if (empty($pk)) {
return false;
}
if (is_array($pk)) {
$conditions = '';
$sep = '';
foreach ($pk as $name => $value) {
$conditions .= $sep . "$name=:$name:";
$sep = ' AND ';
... | [
"public",
"static",
"function",
"findPk",
"(",
"$",
"pk",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"pk",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"pk",
")",
")",
"{",
"$",
"conditions",
"=",
"''",
";",
"$",
... | Finds model by primary key
@param string|array | [
"Finds",
"model",
"by",
"primary",
"key"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Mvc/Model.php#L16-L36 |
22,726 | wenbinye/PhalconX | src/Mvc/Model.php | Model.isChanged | public function isChanged()
{
$snapshot = $this->_snapshot;
if (!is_array($snapshot)) {
return true;
}
$metadata = $this->getModelsMetaData();
$attrs = $metadata->getNonPrimaryKeyAttributes($this);
$automatic = $metadata->getAutomaticUpdateAttributes($this... | php | public function isChanged()
{
$snapshot = $this->_snapshot;
if (!is_array($snapshot)) {
return true;
}
$metadata = $this->getModelsMetaData();
$attrs = $metadata->getNonPrimaryKeyAttributes($this);
$automatic = $metadata->getAutomaticUpdateAttributes($this... | [
"public",
"function",
"isChanged",
"(",
")",
"{",
"$",
"snapshot",
"=",
"$",
"this",
"->",
"_snapshot",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"snapshot",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"metadata",
"=",
"$",
"this",
"->",
"getM... | Checks whether the model changes
@return bool | [
"Checks",
"whether",
"the",
"model",
"changes"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Mvc/Model.php#L43-L88 |
22,727 | nabab/bbn | src/bbn/db.php | db._make_hash | private function _make_hash(): string
{
$args = \func_get_args();
if ( (\count($args) === 1) && \is_array($args[0]) ){
$args = $args[0];
}
$st = '';
foreach ( $args as $a ){
$st .= \is_array($a) ? serialize($a) : '--'.$a.'--';
}
return $this->hash_contour.md5($st).$this->hash_c... | php | private function _make_hash(): string
{
$args = \func_get_args();
if ( (\count($args) === 1) && \is_array($args[0]) ){
$args = $args[0];
}
$st = '';
foreach ( $args as $a ){
$st .= \is_array($a) ? serialize($a) : '--'.$a.'--';
}
return $this->hash_contour.md5($st).$this->hash_c... | [
"private",
"function",
"_make_hash",
"(",
")",
":",
"string",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"if",
"(",
"(",
"\\",
"count",
"(",
"$",
"args",
")",
"===",
"1",
")",
"&&",
"\\",
"is_array",
"(",
"$",
"args",
"[",
"0",
... | Makes a string that will be the id of the request.
@return string | [
"Makes",
"a",
"string",
"that",
"will",
"be",
"the",
"id",
"of",
"the",
"request",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L357-L368 |
22,728 | nabab/bbn | src/bbn/db.php | db._trigger | private function _trigger(array $cfg): array
{
if ( $this->triggers_disabled ){
$cfg['run'] = 1;
$cfg['trig'] = 1;
return $cfg;
}
if ( !isset($cfg['trig']) ){
$cfg['trig'] = 1;
}
if ( !isset($cfg['run']) ){
$cfg['run'] = 1;
}
if ( !empty($cfg['tables']) && !em... | php | private function _trigger(array $cfg): array
{
if ( $this->triggers_disabled ){
$cfg['run'] = 1;
$cfg['trig'] = 1;
return $cfg;
}
if ( !isset($cfg['trig']) ){
$cfg['trig'] = 1;
}
if ( !isset($cfg['run']) ){
$cfg['run'] = 1;
}
if ( !empty($cfg['tables']) && !em... | [
"private",
"function",
"_trigger",
"(",
"array",
"$",
"cfg",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"triggers_disabled",
")",
"{",
"$",
"cfg",
"[",
"'run'",
"]",
"=",
"1",
";",
"$",
"cfg",
"[",
"'trig'",
"]",
"=",
"1",
";",
"return... | Launches a function before or after
@param array $cfg
@return array | [
"Launches",
"a",
"function",
"before",
"or",
"after"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L376-L410 |
22,729 | nabab/bbn | src/bbn/db.php | db._add_primary | private function _add_primary(array &$cfg): void
{
// Inserting a row without primary when primary is needed and no auto-increment
if (
!empty($cfg['primary']) &&
empty($cfg['auto_increment']) &&
(($idx = array_search($cfg['primary'], $cfg['fields'], true)) > -1) &&
(count($cfg['values... | php | private function _add_primary(array &$cfg): void
{
// Inserting a row without primary when primary is needed and no auto-increment
if (
!empty($cfg['primary']) &&
empty($cfg['auto_increment']) &&
(($idx = array_search($cfg['primary'], $cfg['fields'], true)) > -1) &&
(count($cfg['values... | [
"private",
"function",
"_add_primary",
"(",
"array",
"&",
"$",
"cfg",
")",
":",
"void",
"{",
"// Inserting a row without primary when primary is needed and no auto-increment",
"if",
"(",
"!",
"empty",
"(",
"$",
"cfg",
"[",
"'primary'",
"]",
")",
"&&",
"empty",
"("... | Adds a random primary value when it is absent from the set and present in the fields
@param array $cfg | [
"Adds",
"a",
"random",
"primary",
"value",
"when",
"it",
"is",
"absent",
"from",
"the",
"set",
"and",
"present",
"in",
"the",
"fields"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L436-L467 |
22,730 | nabab/bbn | src/bbn/db.php | db.retrieve_query | public function retrieve_query(string $hash): ?array
{
if ( isset($this->queries[$hash]) ){
if ( \is_string($this->queries[$hash]) ){
$hash = $this->queries[$hash];
}
return $this->queries[$hash];
}
return null;
} | php | public function retrieve_query(string $hash): ?array
{
if ( isset($this->queries[$hash]) ){
if ( \is_string($this->queries[$hash]) ){
$hash = $this->queries[$hash];
}
return $this->queries[$hash];
}
return null;
} | [
"public",
"function",
"retrieve_query",
"(",
"string",
"$",
"hash",
")",
":",
"?",
"array",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"queries",
"[",
"$",
"hash",
"]",
")",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"this",
"->",
"q... | Retrieves a query array based on its hash.
@param string $hash
@return array|null | [
"Retrieves",
"a",
"query",
"array",
"based",
"on",
"its",
"hash",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L880-L889 |
22,731 | nabab/bbn | src/bbn/db.php | db.filter_filters | public function filter_filters(array $cfg, $field, $operator = null): ?array
{
if ( isset($cfg['filters']) ){
$f = function($cond, &$res = []) use (&$f, $field, $operator){
foreach ( $cond as $c ){
if ( isset($c['conditions']) ){
$f($c['conditions'], $res);
}
... | php | public function filter_filters(array $cfg, $field, $operator = null): ?array
{
if ( isset($cfg['filters']) ){
$f = function($cond, &$res = []) use (&$f, $field, $operator){
foreach ( $cond as $c ){
if ( isset($c['conditions']) ){
$f($c['conditions'], $res);
}
... | [
"public",
"function",
"filter_filters",
"(",
"array",
"$",
"cfg",
",",
"$",
"field",
",",
"$",
"operator",
"=",
"null",
")",
":",
"?",
"array",
"{",
"if",
"(",
"isset",
"(",
"$",
"cfg",
"[",
"'filters'",
"]",
")",
")",
"{",
"$",
"f",
"=",
"functi... | Retrieve an array of specific filters among the existing ones.
@param array $cfg
@param $field
@param null $operator
@return array|null | [
"Retrieve",
"an",
"array",
"of",
"specific",
"filters",
"among",
"the",
"existing",
"ones",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1016-L1033 |
22,732 | nabab/bbn | src/bbn/db.php | db.error | public function error($e): void
{
$this->has_error = true;
self::has_error();
$msg = [
self::$line,
self::get_log_line('ERROR DB!'),
self::$line
];
if ( \is_string($e) ){
$msg[] = self::get_log_line('USER MESSAGE');
$msg[] = $e;
}
else if ( method_exists($e, '... | php | public function error($e): void
{
$this->has_error = true;
self::has_error();
$msg = [
self::$line,
self::get_log_line('ERROR DB!'),
self::$line
];
if ( \is_string($e) ){
$msg[] = self::get_log_line('USER MESSAGE');
$msg[] = $e;
}
else if ( method_exists($e, '... | [
"public",
"function",
"error",
"(",
"$",
"e",
")",
":",
"void",
"{",
"$",
"this",
"->",
"has_error",
"=",
"true",
";",
"self",
"::",
"has_error",
"(",
")",
";",
"$",
"msg",
"=",
"[",
"self",
"::",
"$",
"line",
",",
"self",
"::",
"get_log_line",
"... | Set an error and acts appropriately based oon the error mode
@param $e
@return void | [
"Set",
"an",
"error",
"and",
"acts",
"appropriately",
"based",
"oon",
"the",
"error",
"mode"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1357-L1403 |
22,733 | nabab/bbn | src/bbn/db.php | db.check | public function check(): bool
{
if ( $this->current !== null ){
// if $on_error is set to E_CONTINUE returns true
if ( $this->on_error === self::E_CONTINUE ){
return true;
}
// If any connection has an error with mode E_STOP_ALL
if ( self::$has_error_all && ($this->on_error !... | php | public function check(): bool
{
if ( $this->current !== null ){
// if $on_error is set to E_CONTINUE returns true
if ( $this->on_error === self::E_CONTINUE ){
return true;
}
// If any connection has an error with mode E_STOP_ALL
if ( self::$has_error_all && ($this->on_error !... | [
"public",
"function",
"check",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"current",
"!==",
"null",
")",
"{",
"// if $on_error is set to E_CONTINUE returns true",
"if",
"(",
"$",
"this",
"->",
"on_error",
"===",
"self",
"::",
"E_CONTINUE",
")"... | Checks if the database is ready to process a query.
```php
bbn\x::dump($db->check());
// (bool)
```
@return bool | [
"Checks",
"if",
"the",
"database",
"is",
"ready",
"to",
"process",
"a",
"query",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1414-L1432 |
22,734 | nabab/bbn | src/bbn/db.php | db.clear_cache | public function clear_cache($item, $mode): self
{
$cache_name = $this->_cache_name($item, $mode);
if ( $this->cache_has($cache_name) ){
$this->cache_delete($cache_name);
}
return $this;
} | php | public function clear_cache($item, $mode): self
{
$cache_name = $this->_cache_name($item, $mode);
if ( $this->cache_has($cache_name) ){
$this->cache_delete($cache_name);
}
return $this;
} | [
"public",
"function",
"clear_cache",
"(",
"$",
"item",
",",
"$",
"mode",
")",
":",
"self",
"{",
"$",
"cache_name",
"=",
"$",
"this",
"->",
"_cache_name",
"(",
"$",
"item",
",",
"$",
"mode",
")",
";",
"if",
"(",
"$",
"this",
"->",
"cache_has",
"(",
... | Deletes a specific item from the cache.
```php
bbn\x::dump($db->clear_cache('db_example','tables'));
// (db)
```
@param string $item 'db_name' or 'table_name'
@param string $mode 'columns','tables' or'databases'
@return self | [
"Deletes",
"a",
"specific",
"item",
"from",
"the",
"cache",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1495-L1502 |
22,735 | nabab/bbn | src/bbn/db.php | db.stop_fancy_stuff | public function stop_fancy_stuff(): self
{
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [\PDOStatement::class]);
$this->fancy = false;
return $this;
} | php | public function stop_fancy_stuff(): self
{
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [\PDOStatement::class]);
$this->fancy = false;
return $this;
} | [
"public",
"function",
"stop_fancy_stuff",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"\\",
"PDO",
"::",
"ATTR_STATEMENT_CLASS",
",",
"[",
"\\",
"PDOStatement",
"::",
"class",
"]",
")",
";",
"$",
"this",
"->",
"fancy",
"=",
"false... | Stops fancy stuff.
```php
$db->stop_fancy_stuff();
// (void)
```
@return db | [
"Stops",
"fancy",
"stuff",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1530-L1535 |
22,736 | nabab/bbn | src/bbn/db.php | db.start_fancy_stuff | public function start_fancy_stuff(): self
{
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [db\query::class, [$this]]);
$this->fancy = 1;
return $this;
} | php | public function start_fancy_stuff(): self
{
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [db\query::class, [$this]]);
$this->fancy = 1;
return $this;
} | [
"public",
"function",
"start_fancy_stuff",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"\\",
"PDO",
"::",
"ATTR_STATEMENT_CLASS",
",",
"[",
"db",
"\\",
"query",
"::",
"class",
",",
"[",
"$",
"this",
"]",
"]",
")",
";",
"$",
"t... | Starts fancy stuff.
```php
$db->start_fancy_stuff();
// (void)
```
@return db | [
"Starts",
"fancy",
"stuff",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1546-L1551 |
22,737 | nabab/bbn | src/bbn/db.php | db.get_foreign_keys | public function get_foreign_keys(string $col, string $table, string $db = null): array
{
if ( !$db ){
$db = $this->current;
}
$res = [];
$model = $this->modelize();
foreach ( $model as $tn => $m ){
foreach ( $m['keys'] as $k => $t ){
if ( ($t['ref_table'] === $table) &&
... | php | public function get_foreign_keys(string $col, string $table, string $db = null): array
{
if ( !$db ){
$db = $this->current;
}
$res = [];
$model = $this->modelize();
foreach ( $model as $tn => $m ){
foreach ( $m['keys'] as $k => $t ){
if ( ($t['ref_table'] === $table) &&
... | [
"public",
"function",
"get_foreign_keys",
"(",
"string",
"$",
"col",
",",
"string",
"$",
"table",
",",
"string",
"$",
"db",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"db",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"current",
";... | Return an array with tables and fields related to the searched foreign key.
```php
bbn\x::dump($db->get_foreign_keys('id', 'table_users', 'db_example'));
// (Array)
```
@param string $col The column's name
@param string $table The table's name
@param string $db The database name if different from the current one
@ret... | [
"Return",
"an",
"array",
"with",
"tables",
"and",
"fields",
"related",
"to",
"the",
"searched",
"foreign",
"key",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1735-L1759 |
22,738 | nabab/bbn | src/bbn/db.php | db.has_id_increment | public function has_id_increment($table): bool
{
return ($model = $this->modelize($table)) &&
isset($model['keys']['PRIMARY']) &&
(\count($model['keys']['PRIMARY']['columns']) === 1) &&
($model['fields'][$model['keys']['PRIMARY']['columns'][0]]['extra'] === 'auto_increment');
} | php | public function has_id_increment($table): bool
{
return ($model = $this->modelize($table)) &&
isset($model['keys']['PRIMARY']) &&
(\count($model['keys']['PRIMARY']['columns']) === 1) &&
($model['fields'][$model['keys']['PRIMARY']['columns'][0]]['extra'] === 'auto_increment');
} | [
"public",
"function",
"has_id_increment",
"(",
"$",
"table",
")",
":",
"bool",
"{",
"return",
"(",
"$",
"model",
"=",
"$",
"this",
"->",
"modelize",
"(",
"$",
"table",
")",
")",
"&&",
"isset",
"(",
"$",
"model",
"[",
"'keys'",
"]",
"[",
"'PRIMARY'",
... | Return true if in the table there are fields with auto-increment.
Working only on mysql.
```php
\bbn\x::dump($db->has_id_increment('table_users'));
// (bool) 1
```
@param string $table The table's name
@return bool | [
"Return",
"true",
"if",
"in",
"the",
"table",
"there",
"are",
"fields",
"with",
"auto",
"-",
"increment",
".",
"Working",
"only",
"on",
"mysql",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1773-L1779 |
22,739 | nabab/bbn | src/bbn/db.php | db.modelize | public function modelize($table = null, bool $force = false): ?array
{
$r = [];
$tables = false;
if ( empty($table) || $table === '*' ){
$tables = $this->get_tables($this->current);
}
else if ( \is_string($table) ){
$tables = [$table];
}
else if ( \is_array($table) ){
$ta... | php | public function modelize($table = null, bool $force = false): ?array
{
$r = [];
$tables = false;
if ( empty($table) || $table === '*' ){
$tables = $this->get_tables($this->current);
}
else if ( \is_string($table) ){
$tables = [$table];
}
else if ( \is_array($table) ){
$ta... | [
"public",
"function",
"modelize",
"(",
"$",
"table",
"=",
"null",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"?",
"array",
"{",
"$",
"r",
"=",
"[",
"]",
";",
"$",
"tables",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"table",
")",
... | Return the table's structure as an indexed array.
```php
\bbn\x::dump($db->modelize("table_users"));
// (array) [keys] => Array ( [PRIMARY] => Array ( [columns] => Array ( [0] => userid [1] => userdataid ) [ref_db] => [ref_table] => [ref_column] => [unique] => 1 ) [table_users_userId_userdataId_info] => Array ( [c... | [
"Return",
"the",
"table",
"s",
"structure",
"as",
"an",
"indexed",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1793-L1817 |
22,740 | nabab/bbn | src/bbn/db.php | db.get_unique_primary | public function get_unique_primary($table): ?string
{
if ( ($keys = $this->get_keys($table)) &&
isset($keys['keys']['PRIMARY']) &&
(\count($keys['keys']['PRIMARY']['columns']) === 1) ){
return $keys['keys']['PRIMARY']['columns'][0];
}
return null;
} | php | public function get_unique_primary($table): ?string
{
if ( ($keys = $this->get_keys($table)) &&
isset($keys['keys']['PRIMARY']) &&
(\count($keys['keys']['PRIMARY']['columns']) === 1) ){
return $keys['keys']['PRIMARY']['columns'][0];
}
return null;
} | [
"public",
"function",
"get_unique_primary",
"(",
"$",
"table",
")",
":",
"?",
"string",
"{",
"if",
"(",
"(",
"$",
"keys",
"=",
"$",
"this",
"->",
"get_keys",
"(",
"$",
"table",
")",
")",
"&&",
"isset",
"(",
"$",
"keys",
"[",
"'keys'",
"]",
"[",
"... | Return the unique primary key of the given table.
```php
\bbn\x::dump($db->get_unique_primary('table_users'));
// (string) id
```
@param string $table The table's name
@return null|string | [
"Return",
"the",
"unique",
"primary",
"key",
"of",
"the",
"given",
"table",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L1980-L1988 |
22,741 | nabab/bbn | src/bbn/db.php | db.get_unique_keys | public function get_unique_keys($table): array
{
$fields = [[]];
if ( $ks = $this->get_keys($table) ){
foreach ( $ks['keys'] as $k ){
if ( $k['unique'] ){
$fields[] = $k['columns'];
}
}
}
return array_merge(...$fields);
} | php | public function get_unique_keys($table): array
{
$fields = [[]];
if ( $ks = $this->get_keys($table) ){
foreach ( $ks['keys'] as $k ){
if ( $k['unique'] ){
$fields[] = $k['columns'];
}
}
}
return array_merge(...$fields);
} | [
"public",
"function",
"get_unique_keys",
"(",
"$",
"table",
")",
":",
"array",
"{",
"$",
"fields",
"=",
"[",
"[",
"]",
"]",
";",
"if",
"(",
"$",
"ks",
"=",
"$",
"this",
"->",
"get_keys",
"(",
"$",
"table",
")",
")",
"{",
"foreach",
"(",
"$",
"k... | Return the unique keys of a table as a numeric array.
```php
\bbn\x::dump($db->get_unique_keys('table_users'));
// (array) ["userid", "userdataid"]
```
@param string $table The table's name
@return array | [
"Return",
"the",
"unique",
"keys",
"of",
"a",
"table",
"as",
"a",
"numeric",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2001-L2012 |
22,742 | nabab/bbn | src/bbn/db.php | db.escape_value | public function escape_value(string $value, $esc = "'"): string
{
return str_replace('%', '\\%', $esc === '"' ?
str::escape_dquotes($value) :
str::escape_squotes($value));
} | php | public function escape_value(string $value, $esc = "'"): string
{
return str_replace('%', '\\%', $esc === '"' ?
str::escape_dquotes($value) :
str::escape_squotes($value));
} | [
"public",
"function",
"escape_value",
"(",
"string",
"$",
"value",
",",
"$",
"esc",
"=",
"\"'\"",
")",
":",
"string",
"{",
"return",
"str_replace",
"(",
"'%'",
",",
"'\\\\%'",
",",
"$",
"esc",
"===",
"'\"'",
"?",
"str",
"::",
"escape_dquotes",
"(",
"$"... | Return a string with quotes and percent escaped.
```php
bbn\x::dump($db->escape_value("My father's job is interesting");
// (string) My father\'s job is interesting
```
@param string $value The string to escape.
@param string $esc
@return string | [
"Return",
"a",
"string",
"with",
"quotes",
"and",
"percent",
"escaped",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2035-L2040 |
22,743 | nabab/bbn | src/bbn/db.php | db.parse_query | public function parse_query(string $statement): ?array
{
if ( $this->parser === null ){
$this->parser = new \PHPSQLParser\PHPSQLParser();
}
try {
$r = $this->parser->parse($statement);
if ( !count($r) ){
return null;
}
if ( isset($r['BRACKET']) && (\count($r) === 1) )... | php | public function parse_query(string $statement): ?array
{
if ( $this->parser === null ){
$this->parser = new \PHPSQLParser\PHPSQLParser();
}
try {
$r = $this->parser->parse($statement);
if ( !count($r) ){
return null;
}
if ( isset($r['BRACKET']) && (\count($r) === 1) )... | [
"public",
"function",
"parse_query",
"(",
"string",
"$",
"statement",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"parser",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"parser",
"=",
"new",
"\\",
"PHPSQLParser",
"\\",
"PHPSQLParser",
"("... | Parses a SQL query and return an array.
@param string $statement
@return null|array | [
"Parses",
"a",
"SQL",
"query",
"and",
"return",
"an",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2080-L2099 |
22,744 | nabab/bbn | src/bbn/db.php | db.last_id | public function last_id()
{
if ( $this->last_insert_id ){
return str::is_buid($this->last_insert_id) ? bin2hex($this->last_insert_id) : $this->last_insert_id;
}
return false;
} | php | public function last_id()
{
if ( $this->last_insert_id ){
return str::is_buid($this->last_insert_id) ? bin2hex($this->last_insert_id) : $this->last_insert_id;
}
return false;
} | [
"public",
"function",
"last_id",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"last_insert_id",
")",
"{",
"return",
"str",
"::",
"is_buid",
"(",
"$",
"this",
"->",
"last_insert_id",
")",
"?",
"bin2hex",
"(",
"$",
"this",
"->",
"last_insert_id",
")",
":... | Return the last inserted ID.
```php
\bbn\x::dump($db->last_id());
// (int) 26
```
@return mixed | [
"Return",
"the",
"last",
"inserted",
"ID",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2126-L2132 |
22,745 | nabab/bbn | src/bbn/db.php | db.new_id | public function new_id($table, int $min = 1){
$tab = $this->modelize($table);
if ( \count($tab['keys']['PRIMARY']['columns']) !== 1 ){
die("Error! Unique numeric primary key doesn't exist");
}
if (
($id_field = $tab['keys']['PRIMARY']['columns'][0]) &&
($maxlength = $tab['fields'][$id_... | php | public function new_id($table, int $min = 1){
$tab = $this->modelize($table);
if ( \count($tab['keys']['PRIMARY']['columns']) !== 1 ){
die("Error! Unique numeric primary key doesn't exist");
}
if (
($id_field = $tab['keys']['PRIMARY']['columns'][0]) &&
($maxlength = $tab['fields'][$id_... | [
"public",
"function",
"new_id",
"(",
"$",
"table",
",",
"int",
"$",
"min",
"=",
"1",
")",
"{",
"$",
"tab",
"=",
"$",
"this",
"->",
"modelize",
"(",
"$",
"table",
")",
";",
"if",
"(",
"\\",
"count",
"(",
"$",
"tab",
"[",
"'keys'",
"]",
"[",
"'... | Generate a new casual id based on the max number of characters of id's column structure in the given table
```php
\bbn\x::dump($db->new_id('table_users', 18));
// (int) 69991701
```
@todo Either get rid of th efunction or include the UID types
@param null|string $table The table's name.
@param int $min
@return mixed | [
"Generate",
"a",
"new",
"casual",
"id",
"based",
"on",
"the",
"max",
"number",
"of",
"characters",
"of",
"id",
"s",
"column",
"structure",
"in",
"the",
"given",
"table"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2173-L2204 |
22,746 | nabab/bbn | src/bbn/db.php | db.random_value | public function random_value($col, $table){
$val = null;
if ( ($tab = $this->modelize($table)) && isset($tab['fields'][$col]) ){
foreach ( $tab['keys'] as $key => $cfg ){
if (
$cfg['unique'] &&
!empty($cfg['ref_column']) &&
(\count($cfg['columns']) === 1) &&
... | php | public function random_value($col, $table){
$val = null;
if ( ($tab = $this->modelize($table)) && isset($tab['fields'][$col]) ){
foreach ( $tab['keys'] as $key => $cfg ){
if (
$cfg['unique'] &&
!empty($cfg['ref_column']) &&
(\count($cfg['columns']) === 1) &&
... | [
"public",
"function",
"random_value",
"(",
"$",
"col",
",",
"$",
"table",
")",
"{",
"$",
"val",
"=",
"null",
";",
"if",
"(",
"(",
"$",
"tab",
"=",
"$",
"this",
"->",
"modelize",
"(",
"$",
"table",
")",
")",
"&&",
"isset",
"(",
"$",
"tab",
"[",
... | Returns a random value fitting the requested column's type
@todo This great function has to be done properly
@param $col
@param $table
@return mixed | [
"Returns",
"a",
"random",
"value",
"fitting",
"the",
"requested",
"column",
"s",
"type"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2214-L2277 |
22,747 | nabab/bbn | src/bbn/db.php | db.get_key_val | public function get_key_val(): ?array
{
if ( $r = $this->query(...\func_get_args()) ){
if ( $rows = $r->get_rows() ){
return x::index_by_first_val($rows);
}
return [];
}
return null;
} | php | public function get_key_val(): ?array
{
if ( $r = $this->query(...\func_get_args()) ){
if ( $rows = $r->get_rows() ){
return x::index_by_first_val($rows);
}
return [];
}
return null;
} | [
"public",
"function",
"get_key_val",
"(",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"r",
"=",
"$",
"this",
"->",
"query",
"(",
"...",
"\\",
"func_get_args",
"(",
")",
")",
")",
"{",
"if",
"(",
"$",
"rows",
"=",
"$",
"r",
"->",
"get_rows",
"(... | Return an array indexed on the first field of the request.
The value will be an array if the request has more than two fields.
```php
\bbn\x::dump($db->get_key_val("SELECT name,id_group FROM table_users"));
/*
(array)[
"John" => 1,
"Michael" => 1,
"Barbara" => 1
]
\bbn\x::dump($db->get_key_val("SELECT name, surname, ... | [
"Return",
"an",
"array",
"indexed",
"on",
"the",
"first",
"field",
"of",
"the",
"request",
".",
"The",
"value",
"will",
"be",
"an",
"array",
"if",
"the",
"request",
"has",
"more",
"than",
"two",
"fields",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2363-L2372 |
22,748 | nabab/bbn | src/bbn/db.php | db.select | public function select($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?\stdClass
{
$args = $this->_add_kind($this->_set_limit_1(\func_get_args()));
if ( $r = $this->_exec(...$args) ){
return $r->get_object();
}
return null;
} | php | public function select($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?\stdClass
{
$args = $this->_add_kind($this->_set_limit_1(\func_get_args()));
if ( $r = $this->_exec(...$args) ){
return $r->get_object();
}
return null;
} | [
"public",
"function",
"select",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"start",
"=",
"0",
")",
":",
"?",
"\\",
"stdClass",
"... | Returns the first row resulting from the query as an object.
```php
\bbn\x::dump($db->select('table_users', ['name', 'surname'], [['id','>','2']]));
/*
(object){
"name": "John",
"surname": "Smith",
}
```
@param string|array $table The table's name or a configuration array
@param string|array $fields The fields' name
... | [
"Returns",
"the",
"first",
"row",
"resulting",
"from",
"the",
"query",
"as",
"an",
"object",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2422-L2429 |
22,749 | nabab/bbn | src/bbn/db.php | db.select_all | public function select_all($table, $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
return $r->get_objects();
}
return null;
} | php | public function select_all($table, $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
return $r->get_objects();
}
return null;
} | [
"public",
"function",
"select_all",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"limit",
"=",
"0",
",",
"int",
"$",
"start",
"=",
... | Return table's rows resulting from the query as an array of objects.
```php
\bbn\x::dump($db->select_all("tab_users", ["id", "name", "surname"],[["id", ">", 1]], ["id" => "ASC"], 2));
/*
(array)[
Object stdClass: df {
"id" => 2,
"name" => "John",
"surname" => "Smith",
},
Object stdClass: df {
"id" => 3,
"name" => "Tho... | [
"Return",
"table",
"s",
"rows",
"resulting",
"from",
"the",
"query",
"as",
"an",
"array",
"of",
"objects",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2459-L2465 |
22,750 | nabab/bbn | src/bbn/db.php | db.iselect | public function iselect($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
return $r->get_irow();
}
return null;
} | php | public function iselect($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
return $r->get_irow();
}
return null;
} | [
"public",
"function",
"iselect",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"start",
"=",
"0",
")",
":",
"?",
"array",
"{",
"if"... | Return the first row resulting from the query as a numeric array.
```php
\bbn\x::dump($db->iselect("tab_users", ["id", "name", "surname"], [["id", ">", 1]], ["id" => "ASC"], 2));
/*
(array)[
4,
"Jack",
"Stewart"
]
```
@param string|array $table The table's name or a configuration array
@param string|array $fields The... | [
"Return",
"the",
"first",
"row",
"resulting",
"from",
"the",
"query",
"as",
"a",
"numeric",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2487-L2493 |
22,751 | nabab/bbn | src/bbn/db.php | db.iselect_all | public function iselect_all($table, $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
return $r->get_irows();
}
return null;
} | php | public function iselect_all($table, $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
return $r->get_irows();
}
return null;
} | [
"public",
"function",
"iselect_all",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"limit",
"=",
"0",
",",
"int",
"$",
"start",
"=",
... | Return the searched rows as an array of numeric arrays.
```php
\bbn\x::dump($db->iselect_all("tab_users", ["id", "name", "surname"], [["id", ">", 1]],["id" => "ASC"],2));
/*
(array)[
[
2,
"John",
"Smith",
],
[
3,
"Thomas",
"Jones",
]
]
```
@param string|array $table The table's name or a configuration array
@param st... | [
"Return",
"the",
"searched",
"rows",
"as",
"an",
"array",
"of",
"numeric",
"arrays",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2523-L2529 |
22,752 | nabab/bbn | src/bbn/db.php | db.rselect | public function rselect($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
return $r->get_row();
}
return null;
} | php | public function rselect($table, $fields = [], array $where = [], array $order = [], int $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
return $r->get_row();
}
return null;
} | [
"public",
"function",
"rselect",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"start",
"=",
"0",
")",
":",
"?",
"array",
"{",
"if"... | Return the first row resulting from the query as an indexed array.
```php
\bbn\x::dump($db->rselect("tab_users", ["id", "name", "surname"], ["id", ">", 1], ["id" => "ASC"], 2));
/*
(array) [
"id" => 4,
"name" => "John",
"surname" => "Smith"
]
```
@param string|array $table The table's name or a configuration array
@p... | [
"Return",
"the",
"first",
"row",
"resulting",
"from",
"the",
"query",
"as",
"an",
"indexed",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2551-L2557 |
22,753 | nabab/bbn | src/bbn/db.php | db.rselect_all | public function rselect_all($table, $fields = [], array $where = [], array $order = [], $limit = 0, $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
if ( \is_object($r) ){
return $r->get_rows();
}
$this->log('ERROR IN RSELECT_ALL', $r);
}
ret... | php | public function rselect_all($table, $fields = [], array $where = [], array $order = [], $limit = 0, $start = 0): ?array
{
if ( $r = $this->_exec(...$this->_add_kind(\func_get_args())) ){
if ( \is_object($r) ){
return $r->get_rows();
}
$this->log('ERROR IN RSELECT_ALL', $r);
}
ret... | [
"public",
"function",
"rselect_all",
"(",
"$",
"table",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"start",
"=",
"0",
")",
":... | Return table's rows as an array of indexed arrays.
```php
\bbn\x::dump($db->rselect_all("tab_users", ["id", "name", "surname"], [["id", ">", 1]], ["id" => "ASC"], 2));
/*
(array) [
[
"id" => 2,
"name" => "John",
"surname" => "Smith",
],
[
"id" => 3,
"name" => "Thomas",
"surname" => "Jones",
]
]
```
@param string|arra... | [
"Return",
"table",
"s",
"rows",
"as",
"an",
"array",
"of",
"indexed",
"arrays",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2587-L2596 |
22,754 | nabab/bbn | src/bbn/db.php | db.select_one | public function select_one($table, $field = null, array $where = [], array $order = [], int $start = 0)
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
if ( \is_object($r) ){
return ($a = $r->get_irow()) ? $a[0] : false;
}
$this->log('ERROR IN RSEL... | php | public function select_one($table, $field = null, array $where = [], array $order = [], int $start = 0)
{
if ( $r = $this->_exec(...$this->_add_kind($this->_set_limit_1(\func_get_args()))) ){
if ( \is_object($r) ){
return ($a = $r->get_irow()) ? $a[0] : false;
}
$this->log('ERROR IN RSEL... | [
"public",
"function",
"select_one",
"(",
"$",
"table",
",",
"$",
"field",
"=",
"null",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"start",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"r",
"=... | Return a single value
```php
\bbn\x::dump($db->select_one("tab_users", "name", [["id", ">", 1]], ["id" => "DESC"], 2));
(string) 'Michael'
```
@param string|array $table The table's name or a configuration array
@param string $field The field's name
@param array $where The "where" condition
@param array | boolean $o... | [
"Return",
"a",
"single",
"value"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2613-L2622 |
22,755 | nabab/bbn | src/bbn/db.php | db.select_all_by_keys | public function select_all_by_keys($table, array $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $rows = $this->rselect_all($table, $fields, $where, $order, $limit, $start) ){
return x::index_by_first_val($rows);
}
return $this->check() ? [] : null;... | php | public function select_all_by_keys($table, array $fields = [], array $where = [], array $order = [], int $limit = 0, int $start = 0): ?array
{
if ( $rows = $this->rselect_all($table, $fields, $where, $order, $limit, $start) ){
return x::index_by_first_val($rows);
}
return $this->check() ? [] : null;... | [
"public",
"function",
"select_all_by_keys",
"(",
"$",
"table",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
",",
"int",
"$",
"limit",
"=",
"0",
",",
"int",
"$",
... | Return an array indexed on the first field of the request.
The value will be an array if the request has more than two fields.
Return the same value as "get_key_val".
```php
\bbn\x::dump($db->select_all_by_keys("table_users", ["name","id","surname"], [["id", ">", "1"]], ["id" => "ASC"]);
/*
(array)[
"John" => [
"surna... | [
"Return",
"an",
"array",
"indexed",
"on",
"the",
"first",
"field",
"of",
"the",
"request",
".",
"The",
"value",
"will",
"be",
"an",
"array",
"if",
"the",
"request",
"has",
"more",
"than",
"two",
"fields",
".",
"Return",
"the",
"same",
"value",
"as",
"g... | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2681-L2687 |
22,756 | nabab/bbn | src/bbn/db.php | db.stat | public function stat(string $table, string $column, array $where = [], array $order = []): ?array{
if ( $this->check() ){
return $this->rselect_all([
'tables' => [$table],
'fields' => [
$column,
'num' => 'COUNT(*)'
],
'where' => $where,
'order' => $o... | php | public function stat(string $table, string $column, array $where = [], array $order = []): ?array{
if ( $this->check() ){
return $this->rselect_all([
'tables' => [$table],
'fields' => [
$column,
'num' => 'COUNT(*)'
],
'where' => $where,
'order' => $o... | [
"public",
"function",
"stat",
"(",
"string",
"$",
"table",
",",
"string",
"$",
"column",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"check",
"... | Return an array with the count of values corresponding to the where conditions.
```php
\bbn\x::dump($db->stat('table_user', 'name', ['name' => '%n']));
/* (array)
[
[
"num" => 1,
"name" => "alan",
], [
"num" => 1,
"name" => "karen",
],
]
```
@param string|array $table The table's name or a configuration array.
@param... | [
"Return",
"an",
"array",
"with",
"the",
"count",
"of",
"values",
"corresponding",
"to",
"the",
"where",
"conditions",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2712-L2726 |
22,757 | nabab/bbn | src/bbn/db.php | db.get_field_values | public function get_field_values($table, $field = null, array $where = [], array $order = []){
return $this->get_column_values($table, $field, $where, $order);
} | php | public function get_field_values($table, $field = null, array $where = [], array $order = []){
return $this->get_column_values($table, $field, $where, $order);
} | [
"public",
"function",
"get_field_values",
"(",
"$",
"table",
",",
"$",
"field",
"=",
"null",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"get_column_values",
"(",
"$",
... | Return the unique values of a column of a table as a numeric indexed array.
```php
\bbn\x::dump($db->get_field_values("table_users", "surname", [['id', '>', '2']], 1, 1));
// (array) ["Smiths", "White"]
```
@param string|array $table The table's name or a configuration array
@param string $field The field's name
@par... | [
"Return",
"the",
"unique",
"values",
"of",
"a",
"column",
"of",
"a",
"table",
"as",
"a",
"numeric",
"indexed",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2742-L2744 |
22,758 | nabab/bbn | src/bbn/db.php | db.count_field_values | public function count_field_values($table, string $field = null, array $where = [], array $order = []){
if ( \is_array($table) && \is_array($table['fields']) && count($table['fields']) ){
$args = $table;
$field = array_values($table['fields'])[0];
}
else{
$args = [
'tables' => [$t... | php | public function count_field_values($table, string $field = null, array $where = [], array $order = []){
if ( \is_array($table) && \is_array($table['fields']) && count($table['fields']) ){
$args = $table;
$field = array_values($table['fields'])[0];
}
else{
$args = [
'tables' => [$t... | [
"public",
"function",
"count_field_values",
"(",
"$",
"table",
",",
"string",
"$",
"field",
"=",
"null",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"array",
"$",
"order",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"table",... | Return a count of identical values in a field as array, reporting a structure type 'num' - 'val'.
```php
\bbn\x::dump($db->count_field_values('table_users','surname',[['name','=','John']]));
// (array) ["num" => 2, "val" => "John"]
```
@param string|array $table The table's name or a configuration array
@param null|s... | [
"Return",
"a",
"count",
"of",
"identical",
"values",
"in",
"a",
"field",
"as",
"array",
"reporting",
"a",
"structure",
"type",
"num",
"-",
"val",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2760-L2781 |
22,759 | nabab/bbn | src/bbn/db.php | db.get_values_count | public function get_values_count($table, string $field = null, array $where = [], $order): array
{
return $this->count_field_values($table, $field, $where, $order);
} | php | public function get_values_count($table, string $field = null, array $where = [], $order): array
{
return $this->count_field_values($table, $field, $where, $order);
} | [
"public",
"function",
"get_values_count",
"(",
"$",
"table",
",",
"string",
"$",
"field",
"=",
"null",
",",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"$",
"order",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"count_field_values",
"(",
"$",
... | Return a string with the sql query to count equal values in a field of the table.
```php
\bbn\x::dump($db->get_values_count('table_users','name',['surname','=','smith']));
/*
(string)
SELECT COUNT(*) AS num, `name` AS val FROM `db_example`.`table_users`
GROUP BY `name`
ORDER BY `name`
```
@param string|array $table T... | [
"Return",
"a",
"string",
"with",
"the",
"sql",
"query",
"to",
"count",
"equal",
"values",
"in",
"a",
"field",
"of",
"the",
"table",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L2839-L2842 |
22,760 | nabab/bbn | src/bbn/db.php | db.change | public function change(string $db): self
{
if ( $this->language->change($db) ){
$this->current = $db;
}
return $this;
} | php | public function change(string $db): self
{
if ( $this->language->change($db) ){
$this->current = $db;
}
return $this;
} | [
"public",
"function",
"change",
"(",
"string",
"$",
"db",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"language",
"->",
"change",
"(",
"$",
"db",
")",
")",
"{",
"$",
"this",
"->",
"current",
"=",
"$",
"db",
";",
"}",
"return",
"$",
"th... | Changes the database used to the given one.
```php
$db = new db();
x::dump($db->change('db_example'));
// (db)
```
@param string $db The database's name
@return self | [
"Changes",
"the",
"database",
"used",
"to",
"the",
"given",
"one",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3543-L3549 |
22,761 | nabab/bbn | src/bbn/db.php | db.table_full_name | public function table_full_name(string $table, bool $escaped = false): ?string
{
return $this->language->table_full_name($table, $escaped);
} | php | public function table_full_name(string $table, bool $escaped = false): ?string
{
return $this->language->table_full_name($table, $escaped);
} | [
"public",
"function",
"table_full_name",
"(",
"string",
"$",
"table",
",",
"bool",
"$",
"escaped",
"=",
"false",
")",
":",
"?",
"string",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"table_full_name",
"(",
"$",
"table",
",",
"$",
"escaped",
")",
... | Return table's full name.
```php
bbn\x::dump($db->table_full_name("table_users"));
// (String) db_example.table_users
bbn\x::dump($db->table_full_name("table_users", true));
// (String) `db_example`.`table_users`
```
@param string $table The table's name (escaped or not).
@param bool $escaped If set to true the retur... | [
"Return",
"table",
"s",
"full",
"name",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3581-L3584 |
22,762 | nabab/bbn | src/bbn/db.php | db.table_simple_name | public function table_simple_name(string $table, bool $escaped = false): ?string
{
return $this->language->table_simple_name($table, $escaped);
} | php | public function table_simple_name(string $table, bool $escaped = false): ?string
{
return $this->language->table_simple_name($table, $escaped);
} | [
"public",
"function",
"table_simple_name",
"(",
"string",
"$",
"table",
",",
"bool",
"$",
"escaped",
"=",
"false",
")",
":",
"?",
"string",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"table_simple_name",
"(",
"$",
"table",
",",
"$",
"escaped",
"... | Return table's simple name.
```php
\bbn\x::dump($db->table_simple_name("example_db.table_users"));
// (string) table_users
\bbn\x::dump($db->table_simple_name("example.table_users", true));
// (string) `table_users`
```
@param string $table The table's name (escaped or not)
@param bool $escaped If set to true the ret... | [
"Return",
"table",
"s",
"simple",
"name",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3628-L3631 |
22,763 | nabab/bbn | src/bbn/db.php | db.col_full_name | public function col_full_name(string $col, $table = '', $escaped = false): ?string
{
return $this->language->col_full_name($col, $table, $escaped);
} | php | public function col_full_name(string $col, $table = '', $escaped = false): ?string
{
return $this->language->col_full_name($col, $table, $escaped);
} | [
"public",
"function",
"col_full_name",
"(",
"string",
"$",
"col",
",",
"$",
"table",
"=",
"''",
",",
"$",
"escaped",
"=",
"false",
")",
":",
"?",
"string",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"col_full_name",
"(",
"$",
"col",
",",
"$"... | Return column's full name.
```php
\bbn\x::dump($db->col_full_name("name", "table_users"));
// (string) table_users.name
\bbn\x::dump($db->col_full_name("name", "table_users", true));
// (string) \`table_users\`.\`name\`
```
@param string $col The column's name (escaped or not)
@param string $table The table's name (... | [
"Return",
"column",
"s",
"full",
"name",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3648-L3651 |
22,764 | nabab/bbn | src/bbn/db.php | db.col_simple_name | public function col_simple_name(string $col, bool $escaped = false): ?string
{
return $this->language->col_simple_name($col, $escaped);
} | php | public function col_simple_name(string $col, bool $escaped = false): ?string
{
return $this->language->col_simple_name($col, $escaped);
} | [
"public",
"function",
"col_simple_name",
"(",
"string",
"$",
"col",
",",
"bool",
"$",
"escaped",
"=",
"false",
")",
":",
"?",
"string",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"col_simple_name",
"(",
"$",
"col",
",",
"$",
"escaped",
")",
";... | Return the column's simple name.
```php
\bbn\x::dump($db->col_simple_name("table_users.name"));
// (string) name
\bbn\x::dump($db->col_simple_name("table_users.name", true));
// (string) `name`
```
@param string $col The column's complete name (escaped or not).
@param bool $escaped If set to true the returned string ... | [
"Return",
"the",
"column",
"s",
"simple",
"name",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3667-L3670 |
22,765 | nabab/bbn | src/bbn/db.php | db.get_tables | public function get_tables(string $database=''): ?array
{
if ( empty($database) ){
$database = $this->current;
}
return $this->_get_cache($database, 'tables');
} | php | public function get_tables(string $database=''): ?array
{
if ( empty($database) ){
$database = $this->current;
}
return $this->_get_cache($database, 'tables');
} | [
"public",
"function",
"get_tables",
"(",
"string",
"$",
"database",
"=",
"''",
")",
":",
"?",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"database",
")",
")",
"{",
"$",
"database",
"=",
"$",
"this",
"->",
"current",
";",
"}",
"return",
"$",
"this"... | Return tables' names of a database as an array.
```php
\bbn\x::dump($db->get_tables('db_example'));
/*
(array) [
"clients",
"columns",
"cron",
"journal",
"dbs",
"examples",
"history",
"hosts",
"keys",
"mails",
"medias",
"notes",
"medias",
"versions"
]
```
@param string $database Database name
@return null|array | [
"Return",
"tables",
"names",
"of",
"a",
"database",
"as",
"an",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3753-L3759 |
22,766 | nabab/bbn | src/bbn/db.php | db.get_keys | public function get_keys(string $table): ?array
{
if ( $tmp = $this->_get_cache($table) ){
return [
'keys' => $tmp['keys'],
'cols' => $tmp['cols']
];
}
return null;
} | php | public function get_keys(string $table): ?array
{
if ( $tmp = $this->_get_cache($table) ){
return [
'keys' => $tmp['keys'],
'cols' => $tmp['cols']
];
}
return null;
} | [
"public",
"function",
"get_keys",
"(",
"string",
"$",
"table",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"tmp",
"=",
"$",
"this",
"->",
"_get_cache",
"(",
"$",
"table",
")",
")",
"{",
"return",
"[",
"'keys'",
"=>",
"$",
"tmp",
"[",
"'keys'",
"... | Return the table's keys as an array indexed with the fields names.
```php
\bbn\x::dump($db->get_keys("table_users"));
/*
(array)[
"keys" => [
"PRIMARY" => [
"columns" => [
"id",
],
"ref_db" => null,
"ref_table" => null,
"ref_column" => null,
"unique" => 1,
],
"number" => [
"columns" => [
"number",
],
"ref_db" => null,... | [
"Return",
"the",
"table",
"s",
"keys",
"as",
"an",
"array",
"indexed",
"with",
"the",
"fields",
"names",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3862-L3871 |
22,767 | nabab/bbn | src/bbn/db.php | db.get_insert | public function get_insert(array $cfg): string
{
$cfg['kind'] = 'INSERT';
return $this->language->get_insert($this->process_cfg($cfg));
} | php | public function get_insert(array $cfg): string
{
$cfg['kind'] = 'INSERT';
return $this->language->get_insert($this->process_cfg($cfg));
} | [
"public",
"function",
"get_insert",
"(",
"array",
"$",
"cfg",
")",
":",
"string",
"{",
"$",
"cfg",
"[",
"'kind'",
"]",
"=",
"'INSERT'",
";",
"return",
"$",
"this",
"->",
"language",
"->",
"get_insert",
"(",
"$",
"this",
"->",
"process_cfg",
"(",
"$",
... | Returns the SQL code for an INSERT statement.
```php
\bbn\x::dump($db->get_insert([
'tables' => ['table_users'],
'fields' => ['name','surname']
]));
/*
(string)
INSERT INTO `db_example`.`table_users` (
`name`, `surname`)
VALUES (?, ?)
```
@param array $cfg The configuration array
@return string | [
"Returns",
"the",
"SQL",
"code",
"for",
"an",
"INSERT",
"statement",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3922-L3926 |
22,768 | nabab/bbn | src/bbn/db.php | db.get_update | public function get_update(array $cfg): string
{
$cfg['kind'] = 'UPDATE';
return $this->language->get_update($this->process_cfg($cfg));
} | php | public function get_update(array $cfg): string
{
$cfg['kind'] = 'UPDATE';
return $this->language->get_update($this->process_cfg($cfg));
} | [
"public",
"function",
"get_update",
"(",
"array",
"$",
"cfg",
")",
":",
"string",
"{",
"$",
"cfg",
"[",
"'kind'",
"]",
"=",
"'UPDATE'",
";",
"return",
"$",
"this",
"->",
"language",
"->",
"get_update",
"(",
"$",
"this",
"->",
"process_cfg",
"(",
"$",
... | Returns the SQL code for an UPDATE statement.
```php
\bbn\x::dump($db->get_update([
'tables' => ['table_users'],
'fields' => ['name','surname']
]));
/*
(string)
UPDATE `db_example`.`table_users`
SET `table_users`.`name` = ?,
`table_users`.`surname` = ?
```
@param array $cfg The configuration array
@return string | [
"Returns",
"the",
"SQL",
"code",
"for",
"an",
"UPDATE",
"statement",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3946-L3950 |
22,769 | nabab/bbn | src/bbn/db.php | db.get_delete | public function get_delete(array $cfg): string
{
$cfg['kind'] = 'DELETE';
return $this->language->get_delete($this->process_cfg($cfg));
} | php | public function get_delete(array $cfg): string
{
$cfg['kind'] = 'DELETE';
return $this->language->get_delete($this->process_cfg($cfg));
} | [
"public",
"function",
"get_delete",
"(",
"array",
"$",
"cfg",
")",
":",
"string",
"{",
"$",
"cfg",
"[",
"'kind'",
"]",
"=",
"'DELETE'",
";",
"return",
"$",
"this",
"->",
"language",
"->",
"get_delete",
"(",
"$",
"this",
"->",
"process_cfg",
"(",
"$",
... | Returns the SQL code for a DELETE statement.
```php
\bbn\x::dump($db->get_delete('table_users',['id'=>1]));
// (string) DELETE FROM `db_example`.`table_users` * WHERE 1 AND `table_users`.`id` = ?
```
@param array $cfg The configuration array
@return string | [
"Returns",
"the",
"SQL",
"code",
"for",
"a",
"DELETE",
"statement",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L3963-L3967 |
22,770 | nabab/bbn | src/bbn/db.php | db.delete_index | public function delete_index(string $table, string $key): bool
{
return $this->language->delete_index($table, $key);
} | php | public function delete_index(string $table, string $key): bool
{
return $this->language->delete_index($table, $key);
} | [
"public",
"function",
"delete_index",
"(",
"string",
"$",
"table",
",",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"delete_index",
"(",
"$",
"table",
",",
"$",
"key",
")",
";",
"}"
] | Deletes index on a column of the table.
@todo far vedere a thomas perchè non funziona/return data
```php
\bbn\x::dump($db->delete_db_index('table_users','id_group'));
// (void)
```
@param string $table The table's name.
@param string $key The key's name.
@return bool | [
"Deletes",
"index",
"on",
"a",
"column",
"of",
"the",
"table",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db.php#L4109-L4112 |
22,771 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.setLimits | public function setLimits($offset, $limit, $max = 0, $cutoff = 0)
{
$this->sphinx->setLimits($offset, $limit, $max, $cutoff);
} | php | public function setLimits($offset, $limit, $max = 0, $cutoff = 0)
{
$this->sphinx->setLimits($offset, $limit, $max, $cutoff);
} | [
"public",
"function",
"setLimits",
"(",
"$",
"offset",
",",
"$",
"limit",
",",
"$",
"max",
"=",
"0",
",",
"$",
"cutoff",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"sphinx",
"->",
"setLimits",
"(",
"$",
"offset",
",",
"$",
"limit",
",",
"$",
"max",
... | Set limits on the range and number of results returned.
@param int $offset The number of results to seek past.
@param int $limit The number of results to return.
@param int $max The maximum number of matches to retrieve.
@param int $cutoff The cutoff to stop searching at. | [
"Set",
"limits",
"on",
"the",
"range",
"and",
"number",
"of",
"results",
"returned",
"."
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L89-L92 |
22,772 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.setFilter | public function setFilter($attribute, $values, $exclude = false)
{
$this->sphinx->setFilter($attribute, $values, $exclude);
} | php | public function setFilter($attribute, $values, $exclude = false)
{
$this->sphinx->setFilter($attribute, $values, $exclude);
} | [
"public",
"function",
"setFilter",
"(",
"$",
"attribute",
",",
"$",
"values",
",",
"$",
"exclude",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"sphinx",
"->",
"setFilter",
"(",
"$",
"attribute",
",",
"$",
"values",
",",
"$",
"exclude",
")",
";",
"}"
] | Set the desired search filter.
@param string $attribute The attribute to filter.
@param array $values The values to filter.
@param bool $exclude Is this an exclusion filter? | [
"Set",
"the",
"desired",
"search",
"filter",
"."
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L116-L119 |
22,773 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.search | public function search($query, array $indexes, array $options = array(), $escapeQuery = true)
{
if ($escapeQuery) {
$query = $this->sphinx->escapeString($query);
}
/**
* Build the list of indexes to be queried.
*/
$indexNames = '';
foreach ($ind... | php | public function search($query, array $indexes, array $options = array(), $escapeQuery = true)
{
if ($escapeQuery) {
$query = $this->sphinx->escapeString($query);
}
/**
* Build the list of indexes to be queried.
*/
$indexNames = '';
foreach ($ind... | [
"public",
"function",
"search",
"(",
"$",
"query",
",",
"array",
"$",
"indexes",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"escapeQuery",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"escapeQuery",
")",
"{",
"$",
"query",
"=",
"$",
... | Search for the specified query string.
@param string $query The query string that we are searching for.
@param array $indexes The indexes to perform the search on.
@param array $options The options for the query.
@param bool $escapeQuery Should the query string be escaped?
@return array|bool The res... | [
"Search",
"for",
"the",
"specified",
"query",
"string",
"."
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L140-L200 |
22,774 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.addQuery | public function addQuery($query, array $indexes)
{
$indexNames = '';
foreach ($indexes as &$label) {
if (isset($this->indexes[$label])) {
$indexNames .= $this->indexes[$label] . ' ';
}
}
if (!empty($indexNames)) {
$this->sphinx->ad... | php | public function addQuery($query, array $indexes)
{
$indexNames = '';
foreach ($indexes as &$label) {
if (isset($this->indexes[$label])) {
$indexNames .= $this->indexes[$label] . ' ';
}
}
if (!empty($indexNames)) {
$this->sphinx->ad... | [
"public",
"function",
"addQuery",
"(",
"$",
"query",
",",
"array",
"$",
"indexes",
")",
"{",
"$",
"indexNames",
"=",
"''",
";",
"foreach",
"(",
"$",
"indexes",
"as",
"&",
"$",
"label",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"indexes"... | Adds a query to a multi-query batch using current settings.
@param string $query The query string that we are searching for.
@param array $indexes The indexes to perform the search on. | [
"Adds",
"a",
"query",
"to",
"a",
"multi",
"-",
"query",
"batch",
"using",
"current",
"settings",
"."
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L208-L220 |
22,775 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.getSnippet | public function getSnippet($text, $index, $terms, $options = array())
{
$results = $this->getSnippets(array($text), $index, $terms, $options);
if ($results) {
return $results[0];
}
return false;
} | php | public function getSnippet($text, $index, $terms, $options = array())
{
$results = $this->getSnippets(array($text), $index, $terms, $options);
if ($results) {
return $results[0];
}
return false;
} | [
"public",
"function",
"getSnippet",
"(",
"$",
"text",
",",
"$",
"index",
",",
"$",
"terms",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"getSnippets",
"(",
"array",
"(",
"$",
"text",
")",
",",
"$... | Get snippet for text
@param string $text Text to process
@param string $index Search index
@param string $terms Words for highlight
@param array $options Generate snippet option
@return string|false | [
"Get",
"snippet",
"for",
"text"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L242-L251 |
22,776 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.getSnippets | public function getSnippets($text, $index, $terms, $options = array())
{
return $this->sphinx->BuildExcerpts($text, $index, $terms, $options);
} | php | public function getSnippets($text, $index, $terms, $options = array())
{
return $this->sphinx->BuildExcerpts($text, $index, $terms, $options);
} | [
"public",
"function",
"getSnippets",
"(",
"$",
"text",
",",
"$",
"index",
",",
"$",
"terms",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sphinx",
"->",
"BuildExcerpts",
"(",
"$",
"text",
",",
"$",
"index",
"... | Get snippets for array of text
@param array $text Array of text to process
@param string $index Search index
@param string $terms Words for highlight
@param array $options Generate snippet option
@return array|false | [
"Get",
"snippets",
"for",
"array",
"of",
"text"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L263-L266 |
22,777 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.resetAll | public function resetAll()
{
$this->sphinx->ResetFilters();
$this->sphinx->ResetGroupBy();
$this->sphinx->ResetOverrides();
$this->sphinx->SetSortMode(SPH_SORT_RELEVANCE);
$this->resetLimits();
} | php | public function resetAll()
{
$this->sphinx->ResetFilters();
$this->sphinx->ResetGroupBy();
$this->sphinx->ResetOverrides();
$this->sphinx->SetSortMode(SPH_SORT_RELEVANCE);
$this->resetLimits();
} | [
"public",
"function",
"resetAll",
"(",
")",
"{",
"$",
"this",
"->",
"sphinx",
"->",
"ResetFilters",
"(",
")",
";",
"$",
"this",
"->",
"sphinx",
"->",
"ResetGroupBy",
"(",
")",
";",
"$",
"this",
"->",
"sphinx",
"->",
"ResetOverrides",
"(",
")",
";",
"... | Reset filters, group by, overrides, limits | [
"Reset",
"filters",
"group",
"by",
"overrides",
"limits"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L271-L278 |
22,778 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.setFilterFloatRange | public function setFilterFloatRange($attribute, $min, $max, $exclude = false)
{
$this->sphinx->SetFilterFloatRange($attribute, $min, $max, $exclude);
} | php | public function setFilterFloatRange($attribute, $min, $max, $exclude = false)
{
$this->sphinx->SetFilterFloatRange($attribute, $min, $max, $exclude);
} | [
"public",
"function",
"setFilterFloatRange",
"(",
"$",
"attribute",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"exclude",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"sphinx",
"->",
"SetFilterFloatRange",
"(",
"$",
"attribute",
",",
"$",
"min",
",",
"$... | Set float range filter
@param string $attribute Attribute name
@param float $min Min range value
@param float $max Max range value
@param bool $exclude Is this an exclusion filter? | [
"Set",
"float",
"range",
"filter"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L311-L314 |
22,779 | verdet23/SphinxSearchBundle | Services/Search/SphinxSearch.php | SphinxSearch.setFilterRange | public function setFilterRange($attribute, $min, $max, $exclude = false)
{
$this->sphinx->SetFilterRange($attribute, $min, $max, $exclude);
} | php | public function setFilterRange($attribute, $min, $max, $exclude = false)
{
$this->sphinx->SetFilterRange($attribute, $min, $max, $exclude);
} | [
"public",
"function",
"setFilterRange",
"(",
"$",
"attribute",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"exclude",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"sphinx",
"->",
"SetFilterRange",
"(",
"$",
"attribute",
",",
"$",
"min",
",",
"$",
"max"... | Set range filter
@param string $attribute Attribute name
@param float $min Min range value
@param float $max Max range value
@param bool $exclude Is this an exclusion filter? | [
"Set",
"range",
"filter"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Search/SphinxSearch.php#L324-L327 |
22,780 | verdet23/SphinxSearchBundle | Services/Indexer/Indexer.php | Indexer.rotateAll | public function rotateAll()
{
$pb = $this->prepareProcessBuilder();
$pb->add('--all');
$indexer = $pb->getProcess();
$indexer->run();
if (strstr($indexer->getOutput(), 'FATAL:') || strstr($indexer->getOutput(), 'ERROR:')) {
throw new \RuntimeException(sprintf('E... | php | public function rotateAll()
{
$pb = $this->prepareProcessBuilder();
$pb->add('--all');
$indexer = $pb->getProcess();
$indexer->run();
if (strstr($indexer->getOutput(), 'FATAL:') || strstr($indexer->getOutput(), 'ERROR:')) {
throw new \RuntimeException(sprintf('E... | [
"public",
"function",
"rotateAll",
"(",
")",
"{",
"$",
"pb",
"=",
"$",
"this",
"->",
"prepareProcessBuilder",
"(",
")",
";",
"$",
"pb",
"->",
"add",
"(",
"'--all'",
")",
";",
"$",
"indexer",
"=",
"$",
"pb",
"->",
"getProcess",
"(",
")",
";",
"$",
... | Rebuild and rotate all indexes. | [
"Rebuild",
"and",
"rotate",
"all",
"indexes",
"."
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Indexer/Indexer.php#L51-L63 |
22,781 | verdet23/SphinxSearchBundle | Services/Indexer/Indexer.php | Indexer.prepareProcessBuilder | protected function prepareProcessBuilder()
{
$pb = new ProcessBuilder();
$pb->inheritEnvironmentVariables();
if ($this->sudo) {
$pb->add('sudo');
}
$pb->add($this->bin);
if ($this->config) {
$pb->add('--config')
->add($this->co... | php | protected function prepareProcessBuilder()
{
$pb = new ProcessBuilder();
$pb->inheritEnvironmentVariables();
if ($this->sudo) {
$pb->add('sudo');
}
$pb->add($this->bin);
if ($this->config) {
$pb->add('--config')
->add($this->co... | [
"protected",
"function",
"prepareProcessBuilder",
"(",
")",
"{",
"$",
"pb",
"=",
"new",
"ProcessBuilder",
"(",
")",
";",
"$",
"pb",
"->",
"inheritEnvironmentVariables",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"sudo",
")",
"{",
"$",
"pb",
"->",
"ad... | Prepare process builder
@return ProcessBuilder | [
"Prepare",
"process",
"builder"
] | 6452cc3a5fab83647b6c08574164249fb8f03b05 | https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Services/Indexer/Indexer.php#L129-L146 |
22,782 | kenphp/ken | src/Helpers/Url.php | Url.createAbsolute | public static function createAbsolute($url, array $params = array())
{
$url = self::addParams($url, $params);
$url = ltrim($url, '/');
$baseUrl = app()->request->getBaseUrl();
return $baseUrl.'/'.$url;
} | php | public static function createAbsolute($url, array $params = array())
{
$url = self::addParams($url, $params);
$url = ltrim($url, '/');
$baseUrl = app()->request->getBaseUrl();
return $baseUrl.'/'.$url;
} | [
"public",
"static",
"function",
"createAbsolute",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"self",
"::",
"addParams",
"(",
"$",
"url",
",",
"$",
"params",
")",
";",
"$",
"url",
"=",
"ltrim",
... | Creates absolute url.
@param string $url
@param array $params Assosiative array in format [key => value ] for GET parameters
@return string | [
"Creates",
"absolute",
"url",
"."
] | c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Helpers/Url.php#L33-L40 |
22,783 | kenphp/ken | src/Helpers/Url.php | Url.addParams | private static function addParams($url, array $params = array())
{
$cParams = count($params);
if ($cParams > 0) {
$url .= '?';
$idx = 1;
foreach ($params as $key => $value) {
$url .= $key.'='.$value;
if ($idx < $cParams) {
... | php | private static function addParams($url, array $params = array())
{
$cParams = count($params);
if ($cParams > 0) {
$url .= '?';
$idx = 1;
foreach ($params as $key => $value) {
$url .= $key.'='.$value;
if ($idx < $cParams) {
... | [
"private",
"static",
"function",
"addParams",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"cParams",
"=",
"count",
"(",
"$",
"params",
")",
";",
"if",
"(",
"$",
"cParams",
">",
"0",
")",
"{",
"$",
"url",
... | Appends GET parameters to url.
@param string $url
@param array $params Assosiative array in format [key => value ] for GET parameters
@return string | [
"Appends",
"GET",
"parameters",
"to",
"url",
"."
] | c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb | https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Helpers/Url.php#L50-L67 |
22,784 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php | ezcDbSchemaPersistentClassWriter.writeAttributes | private function writeAttributes( $file, $fields )
{
foreach ( $fields as $fieldName => $field )
{
fwrite( $file, " /**\n" );
fwrite( $file, " * $fieldName\n" );
fwrite( $file, " *\n" );
fwrite( $file, " * @var {$this->translateType($fie... | php | private function writeAttributes( $file, $fields )
{
foreach ( $fields as $fieldName => $field )
{
fwrite( $file, " /**\n" );
fwrite( $file, " * $fieldName\n" );
fwrite( $file, " *\n" );
fwrite( $file, " * @var {$this->translateType($fie... | [
"private",
"function",
"writeAttributes",
"(",
"$",
"file",
",",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"fwrite",
"(",
"$",
"file",
",",
"\" /**\\n\"",
")",
";",
"fwrite",
"(",
... | Writes the list of attributes.
@param resource $file
@param array $fields
@return void | [
"Writes",
"the",
"list",
"of",
"attributes",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php#L99-L110 |
22,785 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php | ezcDbSchemaPersistentClassWriter.writeClass | private function writeClass( $dir, $tableName, ezcDbSchemaTable $table )
{
$file = $this->openFile( $dir, $tableName );
fwrite( $file, "/**\n" );
fwrite( $file, " * Data class $tableName.\n" );
fwrite( $file, " * Class to be used with eZ Components PersistentObject.\n" );
fw... | php | private function writeClass( $dir, $tableName, ezcDbSchemaTable $table )
{
$file = $this->openFile( $dir, $tableName );
fwrite( $file, "/**\n" );
fwrite( $file, " * Data class $tableName.\n" );
fwrite( $file, " * Class to be used with eZ Components PersistentObject.\n" );
fw... | [
"private",
"function",
"writeClass",
"(",
"$",
"dir",
",",
"$",
"tableName",
",",
"ezcDbSchemaTable",
"$",
"table",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"openFile",
"(",
"$",
"dir",
",",
"$",
"tableName",
")",
";",
"fwrite",
"(",
"$",
"file... | Writes a PHP class.
This method writes a PHP class from a table definition.
@param string $dir The directory to write the defititions to.
@param string $tableName Name of the database table.
@param ezcDbSchemaTable $table The table definition. | [
"Writes",
"a",
"PHP",
"class",
".",
"This",
"method",
"writes",
"a",
"PHP",
"class",
"from",
"a",
"table",
"definition",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php#L168-L190 |
22,786 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php | ezcDbSchemaPersistentClassWriter.openFile | private function openFile( $dir, $name )
{
$filename = $dir . DIRECTORY_SEPARATOR . strtolower( $this->prefix ) . strtolower( $name ) . '.php';
// We do not want to overwrite files
if ( file_exists( $filename ) && ( $this->overwrite === false || is_writable( $filename ) === false ) )
... | php | private function openFile( $dir, $name )
{
$filename = $dir . DIRECTORY_SEPARATOR . strtolower( $this->prefix ) . strtolower( $name ) . '.php';
// We do not want to overwrite files
if ( file_exists( $filename ) && ( $this->overwrite === false || is_writable( $filename ) === false ) )
... | [
"private",
"function",
"openFile",
"(",
"$",
"dir",
",",
"$",
"name",
")",
"{",
"$",
"filename",
"=",
"$",
"dir",
".",
"DIRECTORY_SEPARATOR",
".",
"strtolower",
"(",
"$",
"this",
"->",
"prefix",
")",
".",
"strtolower",
"(",
"$",
"name",
")",
".",
"'.... | Open a file for writing a PersistentObject definition to.
This method opens a file for writing a PersistentObject definition to
and writes the basic PHP open tag to it.
@param string $dir The diretory to open the file in.
@param string $name The table name.
@return resource(file) The file resource used for writing.
... | [
"Open",
"a",
"file",
"for",
"writing",
"a",
"PersistentObject",
"definition",
"to",
".",
"This",
"method",
"opens",
"a",
"file",
"for",
"writing",
"a",
"PersistentObject",
"definition",
"to",
"and",
"writes",
"the",
"basic",
"PHP",
"open",
"tag",
"to",
"it",... | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/persistent/class_writer.php#L206-L223 |
22,787 | Laralum/Permissions | src/PermissionsChecker.php | PermissionsChecker.check | public static function check($permissions)
{
if (Schema::hasTable('laralum_permissions')) {
foreach ($permissions as $permission) {
if (!self::allCached()->contains('slug', $permission['slug'])) {
Cache::forget('laralum_permissions');
if (!... | php | public static function check($permissions)
{
if (Schema::hasTable('laralum_permissions')) {
foreach ($permissions as $permission) {
if (!self::allCached()->contains('slug', $permission['slug'])) {
Cache::forget('laralum_permissions');
if (!... | [
"public",
"static",
"function",
"check",
"(",
"$",
"permissions",
")",
"{",
"if",
"(",
"Schema",
"::",
"hasTable",
"(",
"'laralum_permissions'",
")",
")",
"{",
"foreach",
"(",
"$",
"permissions",
"as",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"self",... | Checks if the permisions exists and if they dont, they will be added.
@param array $permissions | [
"Checks",
"if",
"the",
"permisions",
"exists",
"and",
"if",
"they",
"dont",
"they",
"will",
"be",
"added",
"."
] | 79970ee7d1bff816ad4b9adee29067faead3f756 | https://github.com/Laralum/Permissions/blob/79970ee7d1bff816ad4b9adee29067faead3f756/src/PermissionsChecker.php#L41-L58 |
22,788 | ellipsephp/session-start | src/StartSessionMiddleware.php | StartSessionMiddleware.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Fail when session is disabled or has already started.
$this->failWhenDisabled();
$this->failWhenStarted();
// Try to retrieve the session id from the request cookies.
... | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Fail when session is disabled or has already started.
$this->failWhenDisabled();
$this->failWhenStarted();
// Try to retrieve the session id from the request cookies.
... | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"// Fail when session is disabled or has already started.",
"$",
"this",
"->",
"failWhenDisabled",
"(",
")",
... | Start the session, handle the request and add the session cookie to the
response.
@param \Psr\Http\Message\ServerRequestInterface $request
@param \Psr\Http\Server\RequestHandlerInterface $handler
@return \Psr\Http\Message\ResponseInterface
@throws \Ellipse\Session\Exceptions\SessionStartException | [
"Start",
"the",
"session",
"handle",
"the",
"request",
"and",
"add",
"the",
"session",
"cookie",
"to",
"the",
"response",
"."
] | 7272abfdc42bd8ffc1692c2a37114f6a187d4a24 | https://github.com/ellipsephp/session-start/blob/7272abfdc42bd8ffc1692c2a37114f6a187d4a24/src/StartSessionMiddleware.php#L66-L97 |
22,789 | ellipsephp/session-start | src/StartSessionMiddleware.php | StartSessionMiddleware.withSessionCookie | private function withSessionCookie(ResponseInterface $response, string $session_id): ResponseInterface
{
// Merge session cookie options.
$default = session_get_cookie_params();
$default = array_change_key_case($default, CASE_LOWER);
$options = array_change_key_case($this->options, ... | php | private function withSessionCookie(ResponseInterface $response, string $session_id): ResponseInterface
{
// Merge session cookie options.
$default = session_get_cookie_params();
$default = array_change_key_case($default, CASE_LOWER);
$options = array_change_key_case($this->options, ... | [
"private",
"function",
"withSessionCookie",
"(",
"ResponseInterface",
"$",
"response",
",",
"string",
"$",
"session_id",
")",
":",
"ResponseInterface",
"{",
"// Merge session cookie options.",
"$",
"default",
"=",
"session_get_cookie_params",
"(",
")",
";",
"$",
"defa... | Attach a session cookie with the given sesison id to the given response.
@param \Psr\Http\Message\ResponseInterface $response
@param string $session_id
@return \Psr\Http\Message\ResponseInterface | [
"Attach",
"a",
"session",
"cookie",
"with",
"the",
"given",
"sesison",
"id",
"to",
"the",
"given",
"response",
"."
] | 7272abfdc42bd8ffc1692c2a37114f6a187d4a24 | https://github.com/ellipsephp/session-start/blob/7272abfdc42bd8ffc1692c2a37114f6a187d4a24/src/StartSessionMiddleware.php#L151-L178 |
22,790 | netvlies/NetvliesFormBundle | Controller/FormAdminController.php | FormAdminController.createResponse | protected function createResponse(PHPExcel $excel, $fileName)
{
$writer = new PHPExcel_Writer_Excel2007($excel);
ob_start();
$writer->save('php://output');
$content = ob_get_clean();
$response = new Response();
$response->headers->set('Content-Type', 'application/vnd.... | php | protected function createResponse(PHPExcel $excel, $fileName)
{
$writer = new PHPExcel_Writer_Excel2007($excel);
ob_start();
$writer->save('php://output');
$content = ob_get_clean();
$response = new Response();
$response->headers->set('Content-Type', 'application/vnd.... | [
"protected",
"function",
"createResponse",
"(",
"PHPExcel",
"$",
"excel",
",",
"$",
"fileName",
")",
"{",
"$",
"writer",
"=",
"new",
"PHPExcel_Writer_Excel2007",
"(",
"$",
"excel",
")",
";",
"ob_start",
"(",
")",
";",
"$",
"writer",
"->",
"save",
"(",
"'... | Generates a response object for a PHPExcel object.
@param PHPExcel $excel
@param $fileName
@return Response | [
"Generates",
"a",
"response",
"object",
"for",
"a",
"PHPExcel",
"object",
"."
] | 93f9a3321d9925040111374e7c1014a6400a2d08 | https://github.com/netvlies/NetvliesFormBundle/blob/93f9a3321d9925040111374e7c1014a6400a2d08/Controller/FormAdminController.php#L73-L86 |
22,791 | ajant/SimpleArrayLibrary | src/Categories/Inspectors.php | Inspectors.haveSameKeys | public static function haveSameKeys(array $array1, array $array2)
{
return self::hasAllKeys($array1, array_keys($array2)) && self::hasAllKeys($array2, array_keys($array1)) ? true : false;
} | php | public static function haveSameKeys(array $array1, array $array2)
{
return self::hasAllKeys($array1, array_keys($array2)) && self::hasAllKeys($array2, array_keys($array1)) ? true : false;
} | [
"public",
"static",
"function",
"haveSameKeys",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
")",
"{",
"return",
"self",
"::",
"hasAllKeys",
"(",
"$",
"array1",
",",
"array_keys",
"(",
"$",
"array2",
")",
")",
"&&",
"self",
"::",
"hasAllKeys... | Checks if two arrays have all equal keys
@param array $array1
@param array $array2
@return boolean | [
"Checks",
"if",
"two",
"arrays",
"have",
"all",
"equal",
"keys"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Inspectors.php#L75-L78 |
22,792 | ajant/SimpleArrayLibrary | src/Categories/Inspectors.php | Inspectors.haveSameValues | public static function haveSameValues($array1, $array2)
{
return self::hasAllValues($array1, $array2) && self::hasAllValues($array2, $array1) ? true : false;
} | php | public static function haveSameValues($array1, $array2)
{
return self::hasAllValues($array1, $array2) && self::hasAllValues($array2, $array1) ? true : false;
} | [
"public",
"static",
"function",
"haveSameValues",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"return",
"self",
"::",
"hasAllValues",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"&&",
"self",
"::",
"hasAllValues",
"(",
"$",
"array2",
",",
"$",
"... | Check if two arrays have all equal values
@param array $array1
@param array $array2
@return bool | [
"Check",
"if",
"two",
"arrays",
"have",
"all",
"equal",
"values"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Inspectors.php#L88-L91 |
22,793 | inhere/php-librarys | src/Utils/Token.php | Token.gen | public static function gen($password)
{
return crypt($password, self::$algo . self::$cost . '$' . self::uniqueSalt());
} | php | public static function gen($password)
{
return crypt($password, self::$algo . self::$cost . '$' . self::uniqueSalt());
} | [
"public",
"static",
"function",
"gen",
"(",
"$",
"password",
")",
"{",
"return",
"crypt",
"(",
"$",
"password",
",",
"self",
"::",
"$",
"algo",
".",
"self",
"::",
"$",
"cost",
".",
"'$'",
".",
"self",
"::",
"uniqueSalt",
"(",
")",
")",
";",
"}"
] | this will be used to generate a hash
@param $password
@return string | [
"this",
"will",
"be",
"used",
"to",
"generate",
"a",
"hash"
] | e6ca598685469794f310e3ab0e2bc19519cd0ae6 | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Utils/Token.php#L56-L59 |
22,794 | ekuiter/feature-php | FeaturePhp/Collaboration/Composer.php | Composer.getComposerMap | public static function getComposerMap() {
$composerMap = array();
foreach (self::getComposers() as $composer)
$composerMap[call_user_func(array($composer, "getKind"))] = $composer;
return $composerMap;
} | php | public static function getComposerMap() {
$composerMap = array();
foreach (self::getComposers() as $composer)
$composerMap[call_user_func(array($composer, "getKind"))] = $composer;
return $composerMap;
} | [
"public",
"static",
"function",
"getComposerMap",
"(",
")",
"{",
"$",
"composerMap",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"getComposers",
"(",
")",
"as",
"$",
"composer",
")",
"$",
"composerMap",
"[",
"call_user_func",
"(",
"array",
... | Returns a map from all composer kinds to class names.
@return string[] | [
"Returns",
"a",
"map",
"from",
"all",
"composer",
"kinds",
"to",
"class",
"names",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Collaboration/Composer.php#L37-L42 |
22,795 | ekuiter/feature-php | FeaturePhp/Collaboration/Composer.php | Composer.fromKind | public static function fromKind($kind) {
$composerMap = self::getComposerMap();
if (!array_key_exists($kind, $composerMap))
throw new ComposerException("no composer found for \"$kind\"");
$class = $composerMap[$kind];
return new $class();
} | php | public static function fromKind($kind) {
$composerMap = self::getComposerMap();
if (!array_key_exists($kind, $composerMap))
throw new ComposerException("no composer found for \"$kind\"");
$class = $composerMap[$kind];
return new $class();
} | [
"public",
"static",
"function",
"fromKind",
"(",
"$",
"kind",
")",
"{",
"$",
"composerMap",
"=",
"self",
"::",
"getComposerMap",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"kind",
",",
"$",
"composerMap",
")",
")",
"throw",
"new",
"Co... | Creates a composer from a kind.
@param string $kind
@return Composer | [
"Creates",
"a",
"composer",
"from",
"a",
"kind",
"."
] | daf4a59098802fedcfd1f1a1d07847fcf2fea7bf | https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Collaboration/Composer.php#L49-L55 |
22,796 | jnaxo/country-codes | src/CountryStore.php | CountryStore.routes | public function routes()
{
Route::get('countries/{id}', function ($id) {
$request = request();
return CountryStore::country($id, $request);
})->name('country');
Route::get('countries', function () {
$request = request();
return CountryStore::c... | php | public function routes()
{
Route::get('countries/{id}', function ($id) {
$request = request();
return CountryStore::country($id, $request);
})->name('country');
Route::get('countries', function () {
$request = request();
return CountryStore::c... | [
"public",
"function",
"routes",
"(",
")",
"{",
"Route",
"::",
"get",
"(",
"'countries/{id}'",
",",
"function",
"(",
"$",
"id",
")",
"{",
"$",
"request",
"=",
"request",
"(",
")",
";",
"return",
"CountryStore",
"::",
"country",
"(",
"$",
"id",
",",
"$... | Set routes for country API
@return void | [
"Set",
"routes",
"for",
"country",
"API"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/CountryStore.php#L21-L42 |
22,797 | jnaxo/country-codes | src/CountryStore.php | CountryStore.country | public function country($country_id, Request $request = null)
{
$country = Country::with('zone')->find($country_id);
if ($request) {
$included = [];
$query = $country->getInlcudeResources($request->include);
if ($query) {
$collection = new Collect... | php | public function country($country_id, Request $request = null)
{
$country = Country::with('zone')->find($country_id);
if ($request) {
$included = [];
$query = $country->getInlcudeResources($request->include);
if ($query) {
$collection = new Collect... | [
"public",
"function",
"country",
"(",
"$",
"country_id",
",",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"country",
"=",
"Country",
"::",
"with",
"(",
"'zone'",
")",
"->",
"find",
"(",
"$",
"country_id",
")",
";",
"if",
"(",
"$",
"request... | Get Country item. Optional include administrative areas
@param int $country_id
@param Illuminate\Http\Request $request
@return mixed Jnaxo\CountryCodes\Country item | [
"Get",
"Country",
"item",
".",
"Optional",
"include",
"administrative",
"areas"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/CountryStore.php#L51-L74 |
22,798 | jnaxo/country-codes | src/CountryStore.php | CountryStore.countries | public function countries(Request $request = null)
{
$query = Country::with('zone');
if ($request) {
$resource = new Collection($query, 'country', $request);
return $this->respondWithCollection($resource);
}
return $query->get();
} | php | public function countries(Request $request = null)
{
$query = Country::with('zone');
if ($request) {
$resource = new Collection($query, 'country', $request);
return $this->respondWithCollection($resource);
}
return $query->get();
} | [
"public",
"function",
"countries",
"(",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"Country",
"::",
"with",
"(",
"'zone'",
")",
";",
"if",
"(",
"$",
"request",
")",
"{",
"$",
"resource",
"=",
"new",
"Collection",
"(",
"$",
... | Get Country list
@param Illuminate\Http\Request $request
@return mixed Jnaxo\CountryCodes\Country collection | [
"Get",
"Country",
"list"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/CountryStore.php#L82-L91 |
22,799 | jnaxo/country-codes | src/CountryStore.php | CountryStore.administrativeArea | public function administrativeArea($admin_area_id, Request $request = null)
{
$admin_area = AdministrativeArea::find($admin_area_id);
if ($request) {
$included = [];
if (
$request->has('include') &&
AdministrativeArea::isIncludable($request->include)
... | php | public function administrativeArea($admin_area_id, Request $request = null)
{
$admin_area = AdministrativeArea::find($admin_area_id);
if ($request) {
$included = [];
if (
$request->has('include') &&
AdministrativeArea::isIncludable($request->include)
... | [
"public",
"function",
"administrativeArea",
"(",
"$",
"admin_area_id",
",",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"admin_area",
"=",
"AdministrativeArea",
"::",
"find",
"(",
"$",
"admin_area_id",
")",
";",
"if",
"(",
"$",
"request",
")",
"... | Get Administrative area item, optional include cities
@param int $admin_area_id
@param Illuminate\Http\Request $request
@return mixed Jnaxo\CountryCodes\AdministrativeArea item | [
"Get",
"Administrative",
"area",
"item",
"optional",
"include",
"cities"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/CountryStore.php#L100-L123 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.