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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,100 | phootwork/lang | src/Text.php | Text.insert | public function insert($substring, $index) {
if ($index <= 0) {
return $this->prepend($substring);
}
if ($index > $this->length()) {
return $this->append($substring);
}
$start = mb_substr($this->string, 0, $index, $this->encoding);
$end = mb_substr($this->string, $index, $this->length(), $this->enco... | php | public function insert($substring, $index) {
if ($index <= 0) {
return $this->prepend($substring);
}
if ($index > $this->length()) {
return $this->append($substring);
}
$start = mb_substr($this->string, 0, $index, $this->encoding);
$end = mb_substr($this->string, $index, $this->length(), $this->enco... | [
"public",
"function",
"insert",
"(",
"$",
"substring",
",",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
"<=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"prepend",
"(",
"$",
"substring",
")",
";",
"}",
"if",
"(",
"$",
"index",
">",
"$",
"... | Inserts a substring at the given index
<code>
$str = new Text('Hello World!');<br>
$str->insert('to this ', 5); // Hello to this World!
</code>
@param string|Text $substring
@param int $index
@return Text | [
"Inserts",
"a",
"substring",
"at",
"the",
"given",
"index"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L115-L127 |
21,101 | phootwork/lang | src/Text.php | Text.compare | public function compare($compare, callable $callback = null) {
if ($callback === null) {
$callback = 'strcmp';
}
return $callback($this->string, (string) $compare);
} | php | public function compare($compare, callable $callback = null) {
if ($callback === null) {
$callback = 'strcmp';
}
return $callback($this->string, (string) $compare);
} | [
"public",
"function",
"compare",
"(",
"$",
"compare",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"===",
"null",
")",
"{",
"$",
"callback",
"=",
"'strcmp'",
";",
"}",
"return",
"$",
"callback",
"(",
"$",
"this... | Compares this string to another
@param string $compare string to compare to
@param callable $callback
@return int | [
"Compares",
"this",
"string",
"to",
"another"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L164-L169 |
21,102 | phootwork/lang | src/Text.php | Text.slice | public function slice($offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
if ($length === 0) {
return new Text('', $this->encoding);
}
return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
} | php | public function slice($offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
if ($length === 0) {
return new Text('', $this->encoding);
}
return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
} | [
"public",
"function",
"slice",
"(",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"prepareLength",
"(",
"$",
"o... | Slices a piece of the string from a given offset with a specified length.
If no length is given, the String is sliced to its maximum length.
@see #substring
@param int $offset
@param int $length
@return Text | [
"Slices",
"a",
"piece",
"of",
"the",
"string",
"from",
"a",
"given",
"offset",
"with",
"a",
"specified",
"length",
".",
"If",
"no",
"length",
"is",
"given",
"the",
"String",
"is",
"sliced",
"to",
"its",
"maximum",
"length",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L206-L215 |
21,103 | phootwork/lang | src/Text.php | Text.substring | public function substring($start, $end = null) {
$length = $this->length();
if ($end < 0) {
$end = $length + $end;
}
$end = $end !== null ? min($end, $length) : $length;
$start = min($start, $end);
$end = max($start, $end);
$end = $end - $start;
return new Text(mb_substr($this->string, $start, $end,... | php | public function substring($start, $end = null) {
$length = $this->length();
if ($end < 0) {
$end = $length + $end;
}
$end = $end !== null ? min($end, $length) : $length;
$start = min($start, $end);
$end = max($start, $end);
$end = $end - $start;
return new Text(mb_substr($this->string, $start, $end,... | [
"public",
"function",
"substring",
"(",
"$",
"start",
",",
"$",
"end",
"=",
"null",
")",
"{",
"$",
"length",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"if",
"(",
"$",
"end",
"<",
"0",
")",
"{",
"$",
"end",
"=",
"$",
"length",
"+",
"$",... | Slices a piece of the string from a given start to an end.
If no length is given, the String is sliced to its maximum length.
@see #slice
@param int $start
@param int $end
@return Text | [
"Slices",
"a",
"piece",
"of",
"the",
"string",
"from",
"a",
"given",
"start",
"to",
"an",
"end",
".",
"If",
"no",
"length",
"is",
"given",
"the",
"String",
"is",
"sliced",
"to",
"its",
"maximum",
"length",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L226-L237 |
21,104 | phootwork/lang | src/Text.php | Text.countSubstring | public function countSubstring($substring, $caseSensitive = true) {
$this->verifyNotEmpty($substring, '$substring');
if ($caseSensitive) {
return mb_substr_count($this->string, $substring, $this->encoding);
}
$str = mb_strtoupper($this->string, $this->encoding);
$substring = mb_strtoupper($substring, $this... | php | public function countSubstring($substring, $caseSensitive = true) {
$this->verifyNotEmpty($substring, '$substring');
if ($caseSensitive) {
return mb_substr_count($this->string, $substring, $this->encoding);
}
$str = mb_strtoupper($this->string, $this->encoding);
$substring = mb_strtoupper($substring, $this... | [
"public",
"function",
"countSubstring",
"(",
"$",
"substring",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"verifyNotEmpty",
"(",
"$",
"substring",
",",
"'$substring'",
")",
";",
"if",
"(",
"$",
"caseSensitive",
")",
"{",
"return",... | Count the number of substring occurrences.
@param string|Text $substring The substring to count the occurrencies
@param boolean $caseSensitive Force case-sensitivity
@return int | [
"Count",
"the",
"number",
"of",
"substring",
"occurrences",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L246-L254 |
21,105 | phootwork/lang | src/Text.php | Text.supplant | public function supplant(array $map) {
return new Text(str_replace(array_keys($map), array_values($map), $this->string), $this->encoding);
} | php | public function supplant(array $map) {
return new Text(str_replace(array_keys($map), array_values($map), $this->string), $this->encoding);
} | [
"public",
"function",
"supplant",
"(",
"array",
"$",
"map",
")",
"{",
"return",
"new",
"Text",
"(",
"str_replace",
"(",
"array_keys",
"(",
"$",
"map",
")",
",",
"array_values",
"(",
"$",
"map",
")",
",",
"$",
"this",
"->",
"string",
")",
",",
"$",
... | Replaces all occurences of given replacement map. Keys will be replaced with its values.
@param array $map the replacements. Keys will be replaced with its value.
@return Text | [
"Replaces",
"all",
"occurences",
"of",
"given",
"replacement",
"map",
".",
"Keys",
"will",
"be",
"replaced",
"with",
"its",
"values",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L297-L299 |
21,106 | phootwork/lang | src/Text.php | Text.splice | public function splice($replacement, $offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
$start = $this->substring(0, $offset);
$end = $this->substring($offset + $length);
return new Text($start . $replacement . $end);
} | php | public function splice($replacement, $offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
$start = $this->substring(0, $offset);
$end = $this->substring($offset + $length);
return new Text($start . $replacement . $end);
} | [
"public",
"function",
"splice",
"(",
"$",
"replacement",
",",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"pr... | Replace text within a portion of a string.
@param string|Text $replacement
@param int $offset
@param int|null $length
@return Text
@throws \InvalidArgumentException If $offset is greater then the string length or $length is too small. | [
"Replace",
"text",
"within",
"a",
"portion",
"of",
"a",
"string",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L310-L318 |
21,107 | phootwork/lang | src/Text.php | Text.chars | public function chars() {
$chars = new ArrayObject();
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
$chars->push($this->at($i));
}
return $chars;
} | php | public function chars() {
$chars = new ArrayObject();
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
$chars->push($this->at($i));
}
return $chars;
} | [
"public",
"function",
"chars",
"(",
")",
"{",
"$",
"chars",
"=",
"new",
"ArrayObject",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"l",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"$",
"i",
"<",
"$",
"l",
";",
"$",
"i",
... | Returns an ArrayObject consisting of the characters in the string.
@return ArrayObject An ArrayObject of all chars | [
"Returns",
"an",
"ArrayObject",
"consisting",
"of",
"the",
"characters",
"in",
"the",
"string",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L349-L355 |
21,108 | phootwork/lang | src/Text.php | Text.indexOf | public function indexOf($string, $offset = 0) {
$offset = $this->prepareOffset($offset);
if ($string == '') {
return $offset;
}
return mb_strpos($this->string, (string) $string, $offset, $this->encoding);
} | php | public function indexOf($string, $offset = 0) {
$offset = $this->prepareOffset($offset);
if ($string == '') {
return $offset;
}
return mb_strpos($this->string, (string) $string, $offset, $this->encoding);
} | [
"public",
"function",
"indexOf",
"(",
"$",
"string",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"if",
"(",
"$",
"string",
"==",
"''",
")",
"{",
"return",
"$",
"off... | Returns the index of a given string, starting at the optional zero-related offset
@param string $string
@param int $offset zero-related offset
@return int|boolean int for the index or false if the given string doesn't occur | [
"Returns",
"the",
"index",
"of",
"a",
"given",
"string",
"starting",
"at",
"the",
"optional",
"zero",
"-",
"related",
"offset"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L364-L372 |
21,109 | phootwork/lang | src/Text.php | Text.lastIndexOf | public function lastIndexOf($string, $offset = null) {
if (null === $offset) {
$offset = $this->length();
} else {
$offset = $this->prepareOffset($offset);
}
if ($string === '') {
return $offset;
}
/* Converts $offset to a negative offset as strrpos has a different
* behavior for positive offs... | php | public function lastIndexOf($string, $offset = null) {
if (null === $offset) {
$offset = $this->length();
} else {
$offset = $this->prepareOffset($offset);
}
if ($string === '') {
return $offset;
}
/* Converts $offset to a negative offset as strrpos has a different
* behavior for positive offs... | [
"public",
"function",
"lastIndexOf",
"(",
"$",
"string",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"offset",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"}",
"else",
"{",
"$",
"offset"... | Returns the last index of a given string, starting at the optional offset
@param string $string
@param int $offset
@return int|boolean int for the index or false if the given string doesn't occur | [
"Returns",
"the",
"last",
"index",
"of",
"a",
"given",
"string",
"starting",
"at",
"the",
"optional",
"offset"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L381-L395 |
21,110 | phootwork/lang | src/Text.php | Text.startsWith | public function startsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_substr($this->string, 0, $substringLength, $this->encoding);
return (string) $substring === $startOfStr;
} | php | public function startsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_substr($this->string, 0, $substringLength, $this->encoding);
return (string) $substring === $startOfStr;
} | [
"public",
"function",
"startsWith",
"(",
"$",
"substring",
")",
"{",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"startOfStr",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"string",
","... | Checks whether the string starts with the given string. Case sensitive!
@see Text::startsWithIgnoreCase()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"starts",
"with",
"the",
"given",
"string",
".",
"Case",
"sensitive!"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L404-L409 |
21,111 | phootwork/lang | src/Text.php | Text.startsWithIgnoreCase | public function startsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_strtolower(mb_substr($this->string, 0, $substringLength, $this->encoding));
return (string) $substring === $startOfStr;
} | php | public function startsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_strtolower(mb_substr($this->string, 0, $substringLength, $this->encoding));
return (string) $substring === $startOfStr;
} | [
"public",
"function",
"startsWithIgnoreCase",
"(",
"$",
"substring",
")",
"{",
"$",
"substring",
"=",
"mb_strtolower",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
... | Checks whether the string starts with the given string. Ignores case.
@see Text::startsWith()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"starts",
"with",
"the",
"given",
"string",
".",
"Ignores",
"case",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L418-L424 |
21,112 | phootwork/lang | src/Text.php | Text.endsWith | public function endsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding);
return (string) $substring === $endOfStr;
} | php | public function endsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding);
return (string) $substring === $endOfStr;
} | [
"public",
"function",
"endsWith",
"(",
"$",
"substring",
")",
"{",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"endOfStr",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"string",
",",
... | Checks whether the string ends with the given string. Case sensitive!
@see Text::endsWithIgnoreCase()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"ends",
"with",
"the",
"given",
"string",
".",
"Case",
"sensitive!"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L433-L438 |
21,113 | phootwork/lang | src/Text.php | Text.endsWithIgnoreCase | public function endsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_strtolower(mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding));
return (string) $subst... | php | public function endsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_strtolower(mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding));
return (string) $subst... | [
"public",
"function",
"endsWithIgnoreCase",
"(",
"$",
"substring",
")",
"{",
"$",
"substring",
"=",
"mb_strtolower",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
... | Checks whether the string ends with the given string. Ingores case.
@see Text::endsWith()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"ends",
"with",
"the",
"given",
"string",
".",
"Ingores",
"case",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L447-L453 |
21,114 | phootwork/lang | src/Text.php | Text.pad | public function pad($length, $padding = ' ') {
$len = $length - $this->length();
return $this->applyPadding(floor($len / 2), ceil($len / 2), $padding);
} | php | public function pad($length, $padding = ' ') {
$len = $length - $this->length();
return $this->applyPadding(floor($len / 2), ceil($len / 2), $padding);
} | [
"public",
"function",
"pad",
"(",
"$",
"length",
",",
"$",
"padding",
"=",
"' '",
")",
"{",
"$",
"len",
"=",
"$",
"length",
"-",
"$",
"this",
"->",
"length",
"(",
")",
";",
"return",
"$",
"this",
"->",
"applyPadding",
"(",
"floor",
"(",
"$",
"len... | Adds padding to the start and end
@param int $length
@param string $padding
@return Text | [
"Adds",
"padding",
"to",
"the",
"start",
"and",
"end"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L530-L533 |
21,115 | phootwork/lang | src/Text.php | Text.wrapWords | public function wrapWords($width = 75, $break = "\n", $cut = false) {
return new Text(wordwrap($this->string, $width, $break, $cut), $this->encoding);
} | php | public function wrapWords($width = 75, $break = "\n", $cut = false) {
return new Text(wordwrap($this->string, $width, $break, $cut), $this->encoding);
} | [
"public",
"function",
"wrapWords",
"(",
"$",
"width",
"=",
"75",
",",
"$",
"break",
"=",
"\"\\n\"",
",",
"$",
"cut",
"=",
"false",
")",
"{",
"return",
"new",
"Text",
"(",
"wordwrap",
"(",
"$",
"this",
"->",
"string",
",",
"$",
"width",
",",
"$",
... | Returns a copy of the string wrapped at a given number of characters
@param int $width The number of characters at which the string will be wrapped.
@param string $break The line is broken using the optional break parameter.
@param bool $cut
If the cut is set to TRUE, the string is always wrapped at or before the spec... | [
"Returns",
"a",
"copy",
"of",
"the",
"string",
"wrapped",
"at",
"a",
"given",
"number",
"of",
"characters"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L616-L618 |
21,116 | phootwork/lang | src/Text.php | Text.truncate | public function truncate($length, $substring = '') {
if ($this->length() <= $length) {
return new Text($this->string, $this->encoding);
}
$substrLen = mb_strlen($substring, $this->encoding);
if ($this->length() + $substrLen > $length) {
$length -= $substrLen;
}
return $this->substring(0, $length)->... | php | public function truncate($length, $substring = '') {
if ($this->length() <= $length) {
return new Text($this->string, $this->encoding);
}
$substrLen = mb_strlen($substring, $this->encoding);
if ($this->length() + $substrLen > $length) {
$length -= $substrLen;
}
return $this->substring(0, $length)->... | [
"public",
"function",
"truncate",
"(",
"$",
"length",
",",
"$",
"substring",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"length",
"(",
")",
"<=",
"$",
"length",
")",
"{",
"return",
"new",
"Text",
"(",
"$",
"this",
"->",
"string",
",",
"$"... | Truncates the string with a substring and ensures it doesn't exceed the given length
@param int $length
@param string $substring
@return Text | [
"Truncates",
"the",
"string",
"with",
"a",
"substring",
"and",
"ensures",
"it",
"doesn",
"t",
"exceed",
"the",
"given",
"length"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L648-L660 |
21,117 | phootwork/lang | src/Text.php | Text.split | public function split($delimiter, $limit = PHP_INT_MAX) {
return new ArrayObject(explode($delimiter, $this->string, $limit));
} | php | public function split($delimiter, $limit = PHP_INT_MAX) {
return new ArrayObject(explode($delimiter, $this->string, $limit));
} | [
"public",
"function",
"split",
"(",
"$",
"delimiter",
",",
"$",
"limit",
"=",
"PHP_INT_MAX",
")",
"{",
"return",
"new",
"ArrayObject",
"(",
"explode",
"(",
"$",
"delimiter",
",",
"$",
"this",
"->",
"string",
",",
"$",
"limit",
")",
")",
";",
"}"
] | Splits the string by string
@param string $delimiter The boundary string.
@param integer $limit
If limit is set and positive, the returned array will contain a maximum of
limit elements with the last element containing the rest of string.
If the limit parameter is negative, all components except the last
-limit are r... | [
"Splits",
"the",
"string",
"by",
"string"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L692-L694 |
21,118 | phootwork/lang | src/Text.php | Text.join | public static function join(array $pieces, $glue = '', $encoding = null) {
return new Text(implode($pieces, $glue), $encoding);
} | php | public static function join(array $pieces, $glue = '', $encoding = null) {
return new Text(implode($pieces, $glue), $encoding);
} | [
"public",
"static",
"function",
"join",
"(",
"array",
"$",
"pieces",
",",
"$",
"glue",
"=",
"''",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"return",
"new",
"Text",
"(",
"implode",
"(",
"$",
"pieces",
",",
"$",
"glue",
")",
",",
"$",
"encoding",... | Join array elements with a string
@param array $pieces The array of strings to join.
@param string $glue Defaults to an empty string.
@param string $encoding the desired encoding
@return Text
Returns a string containing a string representation of all the array elements in the
same order, with the glue string between e... | [
"Join",
"array",
"elements",
"with",
"a",
"string"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L706-L708 |
21,119 | phootwork/lang | src/Text.php | Text.chunk | public function chunk($splitLength = 1) {
$this->verifyPositive($splitLength, 'The chunk length');
return new ArrayObject(str_split($this->string, $splitLength));
} | php | public function chunk($splitLength = 1) {
$this->verifyPositive($splitLength, 'The chunk length');
return new ArrayObject(str_split($this->string, $splitLength));
} | [
"public",
"function",
"chunk",
"(",
"$",
"splitLength",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"verifyPositive",
"(",
"$",
"splitLength",
",",
"'The chunk length'",
")",
";",
"return",
"new",
"ArrayObject",
"(",
"str_split",
"(",
"$",
"this",
"->",
"string... | Convert the string to an array
@param int $splitLength Maximum length of the chunk.
@return ArrayObject
If the optional splitLength parameter is specified, the returned array will be
broken down into chunks with each being splitLength in length, otherwise each chunk
will be one character in length.
If the split_lengt... | [
"Convert",
"the",
"string",
"to",
"an",
"array"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L723-L727 |
21,120 | phootwork/lang | src/Text.php | Text.toLowerCaseFirst | public function toLowerCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtolower($first, $this->encoding) . $rest, $this->encoding);
} | php | public function toLowerCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtolower($first, $this->encoding) . $rest, $this->encoding);
} | [
"public",
"function",
"toLowerCaseFirst",
"(",
")",
"{",
"$",
"first",
"=",
"$",
"this",
"->",
"substring",
"(",
"0",
",",
"1",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"substring",
"(",
"1",
")",
";",
"return",
"new",
"Text",
"(",
"mb_strtol... | Transforms the string to first character lowercased
@return Text | [
"Transforms",
"the",
"string",
"to",
"first",
"character",
"lowercased"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L750-L755 |
21,121 | phootwork/lang | src/Text.php | Text.toUpperCaseFirst | public function toUpperCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtoupper($first, $this->encoding) . $rest, $this->encoding);
} | php | public function toUpperCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtoupper($first, $this->encoding) . $rest, $this->encoding);
} | [
"public",
"function",
"toUpperCaseFirst",
"(",
")",
"{",
"$",
"first",
"=",
"$",
"this",
"->",
"substring",
"(",
"0",
",",
"1",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"substring",
"(",
"1",
")",
";",
"return",
"new",
"Text",
"(",
"mb_strtou... | Transforms the string to first character uppercased
@return Text | [
"Transforms",
"the",
"string",
"to",
"first",
"character",
"uppercased"
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L771-L776 |
21,122 | phootwork/lang | src/Text.php | Text.toCapitalCaseWords | public function toCapitalCaseWords() {
$encoding = $this->encoding;
return $this->split(' ')->map(function ($str) use ($encoding) {
return Text::create($str, $encoding)->toCapitalCase();
})->join(' ');
} | php | public function toCapitalCaseWords() {
$encoding = $this->encoding;
return $this->split(' ')->map(function ($str) use ($encoding) {
return Text::create($str, $encoding)->toCapitalCase();
})->join(' ');
} | [
"public",
"function",
"toCapitalCaseWords",
"(",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"encoding",
";",
"return",
"$",
"this",
"->",
"split",
"(",
"' '",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"str",
")",
"use",
"(",
"$",
"encoding... | Transforms the string with the words capitalized.
@return Text | [
"Transforms",
"the",
"string",
"with",
"the",
"words",
"capitalized",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L792-L797 |
21,123 | phootwork/lang | src/Text.php | Text.toStudlyCase | public function toStudlyCase() {
$input = $this->trim('-_');
if ($input->isEmpty()) {
return $input;
}
$encoding = $this->encoding;
return Text::create(preg_replace_callback('/([A-Z-_][a-z0-9]+)/', function ($matches) use ($encoding) {
return Text::create($matches[0], $encoding)->replace(['-', '_'], '')... | php | public function toStudlyCase() {
$input = $this->trim('-_');
if ($input->isEmpty()) {
return $input;
}
$encoding = $this->encoding;
return Text::create(preg_replace_callback('/([A-Z-_][a-z0-9]+)/', function ($matches) use ($encoding) {
return Text::create($matches[0], $encoding)->replace(['-', '_'], '')... | [
"public",
"function",
"toStudlyCase",
"(",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"trim",
"(",
"'-_'",
")",
";",
"if",
"(",
"$",
"input",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"input",
";",
"}",
"$",
"encoding",
"=",
"$",
... | Converts this string into StudlyCase. Numbers are considered as part of its previous piece.
<code>
$var = new Text('my_own_variable');<br>
$var->toStudlyCase(); // MyOwnVariable
$var = new Text('my_test3_variable');<br>
$var->toStudlyCase(); // MyTest3Variable
</code>
@return Text | [
"Converts",
"this",
"string",
"into",
"StudlyCase",
".",
"Numbers",
"are",
"considered",
"as",
"part",
"of",
"its",
"previous",
"piece",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L846-L855 |
21,124 | phootwork/lang | src/Text.php | Text.toKebabCase | public function toKebabCase() {
if ($this->contains('_')) {
return $this->replace('_', '-');
}
return new Text(mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1-$2', $this->string)), $this->encoding);
} | php | public function toKebabCase() {
if ($this->contains('_')) {
return $this->replace('_', '-');
}
return new Text(mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1-$2', $this->string)), $this->encoding);
} | [
"public",
"function",
"toKebabCase",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contains",
"(",
"'_'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"replace",
"(",
"'_'",
",",
"'-'",
")",
";",
"}",
"return",
"new",
"Text",
"(",
"mb_strtolower",
"... | Convert this string into kebab-case. Numbers are considered as part of its previous piece.
<code>
$var = new Text('myOwnVariable');<br>
$var->toKebapCase(); // my-own-variable
$var = new Text('myTest3Variable');<br>
$var->toKebapCase(); // my-test3-variable
</code>
@return Text | [
"Convert",
"this",
"string",
"into",
"kebab",
"-",
"case",
".",
"Numbers",
"are",
"considered",
"as",
"part",
"of",
"its",
"previous",
"piece",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L870-L876 |
21,125 | phootwork/lang | src/Text.php | Text.toPlural | public function toPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getPluralForm($this->string), $this->encoding);
} | php | public function toPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getPluralForm($this->string), $this->encoding);
} | [
"public",
"function",
"toPlural",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"new",
"Text",
"(",
"$",
"pluralizer",
"->",
"getPlural... | Get the plural form of the Text object.
@return Text | [
"Get",
"the",
"plural",
"form",
"of",
"the",
"Text",
"object",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L883-L887 |
21,126 | phootwork/lang | src/Text.php | Text.toSingular | public function toSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getSingularForm($this->string), $this->encoding);
} | php | public function toSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getSingularForm($this->string), $this->encoding);
} | [
"public",
"function",
"toSingular",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"new",
"Text",
"(",
"$",
"pluralizer",
"->",
"getSing... | Get the singular form of the Text object.
@return Text | [
"Get",
"the",
"singular",
"form",
"of",
"the",
"Text",
"object",
"."
] | 2e5dc084d9102bf6b4c60f3ec2acc2ef49861588 | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L894-L898 |
21,127 | rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.isUsed | public static function isUsed($password, $user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
$passwords = static::find()->createdBy($user)->all();
foreach ($passwords as $p) {
/* @var $p static */
if ($p... | php | public static function isUsed($password, $user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
$passwords = static::find()->createdBy($user)->all();
foreach ($passwords as $p) {
/* @var $p static */
if ($p... | [
"public",
"static",
"function",
"isUsed",
"(",
"$",
"password",
",",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";"... | Check whether the password has been used.
@param string $password Password or Password Hash.
@param User $user
@return false|static The first validated password model, or false if not validated. | [
"Check",
"whether",
"the",
"password",
"has",
"been",
"used",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L62-L75 |
21,128 | rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.add | public static function add($password, $user = null)
{
if (static::isUsed($password, $user) && !$user->allowUsedPassword) {
throw new InvalidParamException('Password existed.');
}
if (static::judgePasswordHash($password)) {
$passwordHistory = $user->create(static::clas... | php | public static function add($password, $user = null)
{
if (static::isUsed($password, $user) && !$user->allowUsedPassword) {
throw new InvalidParamException('Password existed.');
}
if (static::judgePasswordHash($password)) {
$passwordHistory = $user->create(static::clas... | [
"public",
"static",
"function",
"add",
"(",
"$",
"password",
",",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"static",
"::",
"isUsed",
"(",
"$",
"password",
",",
"$",
"user",
")",
"&&",
"!",
"$",
"user",
"->",
"allowUsedPassword",
")",
"{",
"th... | Add password to history.
@param string $password Password or Password Hash.
@param User $user
@return boolean
@throws InvalidParamException throw if password existed. | [
"Add",
"password",
"to",
"history",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L99-L112 |
21,129 | rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.first | public static function first($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt()->one();
} | php | public static function first($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt()->one();
} | [
"public",
"static",
"function",
"first",
"(",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";",
"}",
"return",
"stati... | Get first password hash.
@param User $user
@return static
@throws InvalidParamException throw if user invalid. | [
"Get",
"first",
"password",
"hash",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L146-L152 |
21,130 | rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.last | public static function last($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt(SORT_DESC)->one();
} | php | public static function last($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt(SORT_DESC)->one();
} | [
"public",
"static",
"function",
"last",
"(",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";",
"}",
"return",
"static... | Get last password hash.
@param User $user
@return static
@throws InvalidParamException throw if user invalid. | [
"Get",
"last",
"password",
"hash",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L161-L167 |
21,131 | jaxon-php/jaxon-jquery | src/Dom/Action.php | Action.getScript | public function getScript()
{
$this->useSingleQuotes();
foreach($this->aArguments as $xArgument)
{
if($xArgument instanceof Element)
{
$this->addParameter(Jaxon::JS_VALUE, $xArgument->getScript());
}
else if($xArgument instanceo... | php | public function getScript()
{
$this->useSingleQuotes();
foreach($this->aArguments as $xArgument)
{
if($xArgument instanceof Element)
{
$this->addParameter(Jaxon::JS_VALUE, $xArgument->getScript());
}
else if($xArgument instanceo... | [
"public",
"function",
"getScript",
"(",
")",
"{",
"$",
"this",
"->",
"useSingleQuotes",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"aArguments",
"as",
"$",
"xArgument",
")",
"{",
"if",
"(",
"$",
"xArgument",
"instanceof",
"Element",
")",
"{",
"$... | Return a string representation of the call to this jQuery function
@return string | [
"Return",
"a",
"string",
"representation",
"of",
"the",
"call",
"to",
"this",
"jQuery",
"function"
] | 90766a8ea8a4124a3f110e96b316370f71762380 | https://github.com/jaxon-php/jaxon-jquery/blob/90766a8ea8a4124a3f110e96b316370f71762380/src/Dom/Action.php#L41-L76 |
21,132 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php | ezcMailRfc822Parser.parseBody | public function parseBody( $origLine )
{
$line = rtrim( $origLine, "\r\n" );
if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
{
$this->parserState = self::PARSE_STATE_BODY;
// clean up headers for the part
// the rest of the headers s... | php | public function parseBody( $origLine )
{
$line = rtrim( $origLine, "\r\n" );
if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
{
$this->parserState = self::PARSE_STATE_BODY;
// clean up headers for the part
// the rest of the headers s... | [
"public",
"function",
"parseBody",
"(",
"$",
"origLine",
")",
"{",
"$",
"line",
"=",
"rtrim",
"(",
"$",
"origLine",
",",
"\"\\r\\n\"",
")",
";",
"if",
"(",
"$",
"this",
"->",
"parserState",
"==",
"self",
"::",
"PARSE_STATE_HEADERS",
"&&",
"$",
"line",
... | Parses the body of an rfc 2822 message.
@throws ezcBaseFileNotFoundException
if a neccessary temporary file could not be openened.
@param string $origLine | [
"Parses",
"the",
"body",
"of",
"an",
"rfc",
"2822",
"message",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php#L71-L104 |
21,133 | spiderling-php/spiderling | src/CrawlerSession.php | CrawlerSession.saveHtml | public function saveHtml($filename, $base = null)
{
$this->ensureWritableDirectory(dirname($filename));
$html = new Html($this->getHtml());
if (null !== $base) {
$html->resolveLinks(\GuzzleHttp\Psr7\uri_for($base));
}
file_put_contents($filename, $html->get());... | php | public function saveHtml($filename, $base = null)
{
$this->ensureWritableDirectory(dirname($filename));
$html = new Html($this->getHtml());
if (null !== $base) {
$html->resolveLinks(\GuzzleHttp\Psr7\uri_for($base));
}
file_put_contents($filename, $html->get());... | [
"public",
"function",
"saveHtml",
"(",
"$",
"filename",
",",
"$",
"base",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensureWritableDirectory",
"(",
"dirname",
"(",
"$",
"filename",
")",
")",
";",
"$",
"html",
"=",
"new",
"Html",
"(",
"$",
"this",
"->... | Save the HTML of the session into a file
Optionally resolve all the links with a base uri
@param string $filename
@throws InvalidArgumentException if directory doesnt exist or is not writable
@param UriInterface|string $base | [
"Save",
"the",
"HTML",
"of",
"the",
"session",
"into",
"a",
"file",
"Optionally",
"resolve",
"all",
"the",
"links",
"with",
"a",
"base",
"uri"
] | 030d70fb71c89256e3b256dda7fa4c47751d9c53 | https://github.com/spiderling-php/spiderling/blob/030d70fb71c89256e3b256dda7fa4c47751d9c53/src/CrawlerSession.php#L85-L98 |
21,134 | fccn/oai-pmh-core | src/libs/phprop.php | Phprop.parse | public static function parse($filename, $del=".")
{
if (is_null(self::$_instance)) {
self::$_instance = new self($filename, $del);
}
return self::$_instance->getObj();
//return self::$_instance;
} | php | public static function parse($filename, $del=".")
{
if (is_null(self::$_instance)) {
self::$_instance = new self($filename, $del);
}
return self::$_instance->getObj();
//return self::$_instance;
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"filename",
",",
"$",
"del",
"=",
"\".\"",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_instance",
")",
")",
"{",
"self",
"::",
"$",
"_instance",
"=",
"new",
"self",
"(",
"$",
"filenam... | Singleton pattern constructor
@param string ini filename
@param string delimiter, it is '.' by default but can be changed
@return object : object containing ini data | [
"Singleton",
"pattern",
"constructor"
] | a9c6852482c7bd7c48911a2165120325ecc27ea2 | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/phprop.php#L91-L98 |
21,135 | fccn/oai-pmh-core | src/libs/phprop.php | Phprop._parseIni | private function _parseIni($iniFile)
{
$aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
$tmpArray = array();
foreach ($aParsedIni as $key=>$value) {
if (strpos($key, ':') !== false) {
$sections = explode(':', $key);
if (count($section... | php | private function _parseIni($iniFile)
{
$aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
$tmpArray = array();
foreach ($aParsedIni as $key=>$value) {
if (strpos($key, ':') !== false) {
$sections = explode(':', $key);
if (count($section... | [
"private",
"function",
"_parseIni",
"(",
"$",
"iniFile",
")",
"{",
"$",
"aParsedIni",
"=",
"parse_ini_file",
"(",
"$",
"iniFile",
",",
"true",
",",
"INI_SCANNER_RAW",
")",
";",
"$",
"tmpArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aParsedIn... | Parses ini file and extract its keys and prepare it for object creation | [
"Parses",
"ini",
"file",
"and",
"extract",
"its",
"keys",
"and",
"prepare",
"it",
"for",
"object",
"creation"
] | a9c6852482c7bd7c48911a2165120325ecc27ea2 | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/phprop.php#L103-L165 |
21,136 | hametuha/wpametu | src/WPametu/File/Image.php | Image.trim | public function trim( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ){
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) )
return $editor;
$editor->set_quality( $jpeg_quality );
$resized = $editor->resize( $max_... | php | public function trim( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ){
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) )
return $editor;
$editor->set_quality( $jpeg_quality );
$resized = $editor->resize( $max_... | [
"public",
"function",
"trim",
"(",
"$",
"file",
",",
"$",
"max_w",
",",
"$",
"max_h",
",",
"$",
"crop",
"=",
"false",
",",
"$",
"suffix",
"=",
"null",
",",
"$",
"dest_path",
"=",
"null",
",",
"$",
"jpeg_quality",
"=",
"90",
")",
"{",
"$",
"editor... | Clone of image resize
@see image_resize
@param string $file Image file path.
@param int $max_w Maximum width to resize to.
@param int $max_h Maximum height to resize to.
@param bool $crop Optional. Whether to crop image or resize.
@param string $suffix Optional. File suffix.
@param string $dest_path Optional. New imag... | [
"Clone",
"of",
"image",
"resize"
] | 0939373800815a8396291143d2a57967340da5aa | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Image.php#L39-L56 |
21,137 | hametuha/wpametu | src/WPametu/File/Image.php | Image.fit | public function fit($src, $dest, $width, $height){
// Calculate
$size = getimagesize($src);
$ratio = max($width / $size[0], $height / $size[1]);
$old_width = $size[0];
$old_height = $size[1];
$new_width = intval($old_width * $ratio);
$new_height = intval($old_heig... | php | public function fit($src, $dest, $width, $height){
// Calculate
$size = getimagesize($src);
$ratio = max($width / $size[0], $height / $size[1]);
$old_width = $size[0];
$old_height = $size[1];
$new_width = intval($old_width * $ratio);
$new_height = intval($old_heig... | [
"public",
"function",
"fit",
"(",
"$",
"src",
",",
"$",
"dest",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"// Calculate",
"$",
"size",
"=",
"getimagesize",
"(",
"$",
"src",
")",
";",
"$",
"ratio",
"=",
"max",
"(",
"$",
"width",
"/",
"$",
... | Fit small image to specified bound
@param string $src
@param string $dest
@param int $width
@param int $height
@return bool | [
"Fit",
"small",
"image",
"to",
"specified",
"bound"
] | 0939373800815a8396291143d2a57967340da5aa | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Image.php#L67-L99 |
21,138 | blast-project/BaseEntitiesBundle | src/Controller/SearchController.php | SearchController.retrieveFormFieldDescription | private function retrieveFormFieldDescription(AdminInterface $admin, $field)
{
$admin->getFormFieldDescriptions();
$fieldDescription = $admin->getFormFieldDescription($field);
if (!$fieldDescription) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field... | php | private function retrieveFormFieldDescription(AdminInterface $admin, $field)
{
$admin->getFormFieldDescriptions();
$fieldDescription = $admin->getFormFieldDescription($field);
if (!$fieldDescription) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field... | [
"private",
"function",
"retrieveFormFieldDescription",
"(",
"AdminInterface",
"$",
"admin",
",",
"$",
"field",
")",
"{",
"$",
"admin",
"->",
"getFormFieldDescriptions",
"(",
")",
";",
"$",
"fieldDescription",
"=",
"$",
"admin",
"->",
"getFormFieldDescription",
"("... | Retrieve the form field description given by field name.
Copied from Sonata\AdminBundle\Controller\HelperController.
@param AdminInterface $admin
@param string $field
@return FormInterface
@throws \RuntimeException | [
"Retrieve",
"the",
"form",
"field",
"description",
"given",
"by",
"field",
"name",
".",
"Copied",
"from",
"Sonata",
"\\",
"AdminBundle",
"\\",
"Controller",
"\\",
"HelperController",
"."
] | abd06891fc38922225ab7e4fcb437a286ba2c0c4 | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Controller/SearchController.php#L143-L158 |
21,139 | webdevvie/pheanstalk-task-queue-bundle | Command/Example/AddExampleTaskCommand.php | AddExampleTaskCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$totalTasks = $input->getOption('total-tasks');
for ($counter = 0; $counter < $totalTasks; $counter++) {
$task = new ExampleTaskDescription();
$task-... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$totalTasks = $input->getOption('total-tasks');
for ($counter = 0; $counter < $totalTasks; $counter++) {
$task = new ExampleTaskDescription();
$task-... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"initialiseWorker",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"totalTasks",
"=",
"$",
"input",
"->",
... | Adds an example task to the task queue using the ExampleTask.php
@param InputInterface $input
@param OutputInterface $output
@return void
@throws \InvalidArgumentException | [
"Adds",
"an",
"example",
"task",
"to",
"the",
"task",
"queue",
"using",
"the",
"ExampleTask",
".",
"php"
] | db5e63a8f844e345dc2e69ce8e94b32d851020eb | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Command/Example/AddExampleTaskCommand.php#L43-L53 |
21,140 | Visithor/visithor | src/Visithor/Reader/YamlConfigurationReader.php | YamlConfigurationReader.read | public function read($path)
{
$config = $this
->readByFilename(
$path,
Visithor::CONFIG_FILE_NAME_DISTR
);
if (false === $config) {
$config = $this
->readByFilename(
$path,
Vi... | php | public function read($path)
{
$config = $this
->readByFilename(
$path,
Visithor::CONFIG_FILE_NAME_DISTR
);
if (false === $config) {
$config = $this
->readByFilename(
$path,
Vi... | [
"public",
"function",
"read",
"(",
"$",
"path",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"readByFilename",
"(",
"$",
"path",
",",
"Visithor",
"::",
"CONFIG_FILE_NAME_DISTR",
")",
";",
"if",
"(",
"false",
"===",
"$",
"config",
")",
"{",
"$",
"... | Read all the configuration given a path
@param string $path Path
@return array|false Configuration loaded or false if file not exists | [
"Read",
"all",
"the",
"configuration",
"given",
"a",
"path"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Reader/YamlConfigurationReader.php#L32-L49 |
21,141 | Visithor/visithor | src/Visithor/Reader/YamlConfigurationReader.php | YamlConfigurationReader.readByFilename | public function readByFilename($path, $filename)
{
$config = false;
$configFilePath = rtrim($path, '/') . '/' . $filename;
if (is_file($configFilePath)) {
$yamlParser = new YamlParser();
$config = $yamlParser->parse(file_get_contents($configFilePath));
}
... | php | public function readByFilename($path, $filename)
{
$config = false;
$configFilePath = rtrim($path, '/') . '/' . $filename;
if (is_file($configFilePath)) {
$yamlParser = new YamlParser();
$config = $yamlParser->parse(file_get_contents($configFilePath));
}
... | [
"public",
"function",
"readByFilename",
"(",
"$",
"path",
",",
"$",
"filename",
")",
"{",
"$",
"config",
"=",
"false",
";",
"$",
"configFilePath",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/'",
")",
".",
"'/'",
".",
"$",
"filename",
";",
"if",
"(",
"i... | Read all the configuration given a path and a filename
@param string $path Path
@param string $filename File name
@return array Configuration | [
"Read",
"all",
"the",
"configuration",
"given",
"a",
"path",
"and",
"a",
"filename"
] | 201ba2cfc536a0875983c79226947aa20b9f4dca | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Reader/YamlConfigurationReader.php#L60-L71 |
21,142 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.addClass | public function addClass($class, $extends = null, $implements = [])
{
$classId = $this->registerClass($class);
if ($extends) {
$parentClassId = $this->registerClass($extends);
$this->extends[$classId] = [$parentClassId];
}
if (!empty($implements)) {
... | php | public function addClass($class, $extends = null, $implements = [])
{
$classId = $this->registerClass($class);
if ($extends) {
$parentClassId = $this->registerClass($extends);
$this->extends[$classId] = [$parentClassId];
}
if (!empty($implements)) {
... | [
"public",
"function",
"addClass",
"(",
"$",
"class",
",",
"$",
"extends",
"=",
"null",
",",
"$",
"implements",
"=",
"[",
"]",
")",
"{",
"$",
"classId",
"=",
"$",
"this",
"->",
"registerClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"extends",... | add class to hierarchy tree
@param string $class
@param string $extends parent class
@param array $implements interfaces that implements
@return self | [
"add",
"class",
"to",
"hierarchy",
"tree"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L74-L88 |
21,143 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.addInterface | public function addInterface($interface, $extends = [])
{
$interfaceId = $this->registerInterface($interface);
if (!empty($extends)) {
$interfaceIds = [];
foreach ($extends as $name) {
$interfaceIds[] = $this->registerInterface($name);
}
... | php | public function addInterface($interface, $extends = [])
{
$interfaceId = $this->registerInterface($interface);
if (!empty($extends)) {
$interfaceIds = [];
foreach ($extends as $name) {
$interfaceIds[] = $this->registerInterface($name);
}
... | [
"public",
"function",
"addInterface",
"(",
"$",
"interface",
",",
"$",
"extends",
"=",
"[",
"]",
")",
"{",
"$",
"interfaceId",
"=",
"$",
"this",
"->",
"registerInterface",
"(",
"$",
"interface",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"extends",
... | add interface to hierarchy tree
@param string $interface
@param array $extends
@return self | [
"add",
"interface",
"to",
"hierarchy",
"tree"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L97-L107 |
21,144 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getParent | public function getParent($class)
{
$classId = $this->getClassId($class);
if (!isset($classId)) {
return false;
}
$parentClassId = $this->extends[$classId];
return isset($parentClassId) ? $this->classes[$parentClassId[0]] : null;
} | php | public function getParent($class)
{
$classId = $this->getClassId($class);
if (!isset($classId)) {
return false;
}
$parentClassId = $this->extends[$classId];
return isset($parentClassId) ? $this->classes[$parentClassId[0]] : null;
} | [
"public",
"function",
"getParent",
"(",
"$",
"class",
")",
"{",
"$",
"classId",
"=",
"$",
"this",
"->",
"getClassId",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"classId",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"par... | gets parent class
@param string $class
@retutn string|null|false | [
"gets",
"parent",
"class"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L115-L123 |
21,145 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getAncestors | public function getAncestors($class)
{
$ancestors = [];
while (true) {
$parent = $this->getParent($class);
if ($parent) {
$ancestors[] = $parent;
$class = $parent;
} else {
break;
}
}
retu... | php | public function getAncestors($class)
{
$ancestors = [];
while (true) {
$parent = $this->getParent($class);
if ($parent) {
$ancestors[] = $parent;
$class = $parent;
} else {
break;
}
}
retu... | [
"public",
"function",
"getAncestors",
"(",
"$",
"class",
")",
"{",
"$",
"ancestors",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"parent",
")... | gets all parent classes
@param string $class
@return array | [
"gets",
"all",
"parent",
"classes"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L131-L144 |
21,146 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getImplements | public function getImplements($class)
{
$interfaces = [];
$classId = $this->getClassId($class);
if (isset($classId)) {
if (isset($this->implements[$classId])) {
foreach ($this->implements[$classId] as $interfaceId) {
$interfaces[$this->interfac... | php | public function getImplements($class)
{
$interfaces = [];
$classId = $this->getClassId($class);
if (isset($classId)) {
if (isset($this->implements[$classId])) {
foreach ($this->implements[$classId] as $interfaceId) {
$interfaces[$this->interfac... | [
"public",
"function",
"getImplements",
"(",
"$",
"class",
")",
"{",
"$",
"interfaces",
"=",
"[",
"]",
";",
"$",
"classId",
"=",
"$",
"this",
"->",
"getClassId",
"(",
"$",
"class",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"classId",
")",
")",
"{",
... | gets implemented interfaces
@param string $class
@return array|false | [
"gets",
"implemented",
"interfaces"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L152-L169 |
21,147 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.isA | public function isA($class, $test_class)
{
$test_class = $this->normalize($test_class);
if ($this->classExists($test_class)) {
return in_array($test_class, $this->getAncestors($class));
} elseif ($this->interfaceExists($test_class)) {
return in_array($test_class, $thi... | php | public function isA($class, $test_class)
{
$test_class = $this->normalize($test_class);
if ($this->classExists($test_class)) {
return in_array($test_class, $this->getAncestors($class));
} elseif ($this->interfaceExists($test_class)) {
return in_array($test_class, $thi... | [
"public",
"function",
"isA",
"(",
"$",
"class",
",",
"$",
"test_class",
")",
"{",
"$",
"test_class",
"=",
"$",
"this",
"->",
"normalize",
"(",
"$",
"test_class",
")",
";",
"if",
"(",
"$",
"this",
"->",
"classExists",
"(",
"$",
"test_class",
")",
")",... | checks the class is subclass or implements the test class
@param string $class
@param string $test_class class or interface name
@return boolean | [
"checks",
"the",
"class",
"is",
"subclass",
"or",
"implements",
"the",
"test",
"class"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L202-L212 |
21,148 | wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getSubClasses | public function getSubClasses($class)
{
$class = $this->normalize($class);
if ($this->classExists($class)) {
return $this->getSubclassOfClass($class);
} elseif ($this->interfaceExists($class)) {
return $this->getSubclassOfInterface($class);
} else {
... | php | public function getSubClasses($class)
{
$class = $this->normalize($class);
if ($this->classExists($class)) {
return $this->getSubclassOfClass($class);
} elseif ($this->interfaceExists($class)) {
return $this->getSubclassOfInterface($class);
} else {
... | [
"public",
"function",
"getSubClasses",
"(",
"$",
"class",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"normalize",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"this",
"->",
"classExists",
"(",
"$",
"class",
")",
")",
"{",
"return",
"$",
"this"... | gets all subclass of the class or interface
@param string $class
@return array | [
"gets",
"all",
"subclass",
"of",
"the",
"class",
"or",
"interface"
] | 0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1 | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L220-L230 |
21,149 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.paginate | public function paginate()
{
$this->count = $this->query->get()->count();
$this->limit = $this->limit ?: $this->count;
$this->query->skip($this->offset)->take($this->limit);
} | php | public function paginate()
{
$this->count = $this->query->get()->count();
$this->limit = $this->limit ?: $this->count;
$this->query->skip($this->offset)->take($this->limit);
} | [
"public",
"function",
"paginate",
"(",
")",
"{",
"$",
"this",
"->",
"count",
"=",
"$",
"this",
"->",
"query",
"->",
"get",
"(",
")",
"->",
"count",
"(",
")",
";",
"$",
"this",
"->",
"limit",
"=",
"$",
"this",
"->",
"limit",
"?",
":",
"$",
"this... | Will modify a query builder to get paginated data and will
return an array with the meta data.
@param Illuminate\Database\Query\Builder $query
@return array | [
"Will",
"modify",
"a",
"query",
"builder",
"to",
"get",
"paginated",
"data",
"and",
"will",
"return",
"an",
"array",
"with",
"the",
"meta",
"data",
"."
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L68-L73 |
21,150 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.getNextPageParams | public function getNextPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$next_url = $this->offset_key
. $this->offset
. $this->limit_key
. $limit;
if ($this->count <= ($this->offset + $limit)) {
return false;
}
... | php | public function getNextPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$next_url = $this->offset_key
. $this->offset
. $this->limit_key
. $limit;
if ($this->count <= ($this->offset + $limit)) {
return false;
}
... | [
"public",
"function",
"getNextPageParams",
"(",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"limit",
"<=",
"0",
"?",
"$",
"this",
"->",
"count",
":",
"$",
"this",
"->",
"limit",
";",
"$",
"next_url",
"=",
"$",
"this",
"->",
"offset_key",
".",
"... | Generate the next page url parameters as string.
@param int $count
@param int $currentOffset
@param int $limit
@return string | [
"Generate",
"the",
"next",
"page",
"url",
"parameters",
"as",
"string",
"."
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L84-L104 |
21,151 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.getPrevPageParams | public function getPrevPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$prev_url = $this->offset_key
. $this->offset
. $this->limit_key
. $limit;
if ($this->count >= $limit) {
$prev_url = $this->offset_key
... | php | public function getPrevPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$prev_url = $this->offset_key
. $this->offset
. $this->limit_key
. $limit;
if ($this->count >= $limit) {
$prev_url = $this->offset_key
... | [
"public",
"function",
"getPrevPageParams",
"(",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"limit",
"<=",
"0",
"?",
"$",
"this",
"->",
"count",
":",
"$",
"this",
"->",
"limit",
";",
"$",
"prev_url",
"=",
"$",
"this",
"->",
"offset_key",
".",
"... | Generate the prev page url parameters as string.
@param int $count
@param int $currentOffset
@param int $limit
@return string | [
"Generate",
"the",
"prev",
"page",
"url",
"parameters",
"as",
"string",
"."
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L115-L136 |
21,152 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.getLastPageParams | public function getLastPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$last_page = intdiv(intval($this->count), intval($limit));
$last_url = $this->offset_key
. ($last_page * $limit)
. $this->limit_key
. $limit;
return $l... | php | public function getLastPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$last_page = intdiv(intval($this->count), intval($limit));
$last_url = $this->offset_key
. ($last_page * $limit)
. $this->limit_key
. $limit;
return $l... | [
"public",
"function",
"getLastPageParams",
"(",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"limit",
"<=",
"0",
"?",
"$",
"this",
"->",
"count",
":",
"$",
"this",
"->",
"limit",
";",
"$",
"last_page",
"=",
"intdiv",
"(",
"intval",
"(",
"$",
"th... | Generate the last page url parameters as string.
@param int $count
@param int $currentOffset
@param int $limit
@return string | [
"Generate",
"the",
"last",
"page",
"url",
"parameters",
"as",
"string",
"."
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L147-L157 |
21,153 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.getFirstPageParams | public function getFirstPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$first_url = $this->offset_key . '0' . $this->limit_key . $limit;
return $first_url;
} | php | public function getFirstPageParams()
{
$limit = $this->limit <= 0 ? $this->count : $this->limit;
$first_url = $this->offset_key . '0' . $this->limit_key . $limit;
return $first_url;
} | [
"public",
"function",
"getFirstPageParams",
"(",
")",
"{",
"$",
"limit",
"=",
"$",
"this",
"->",
"limit",
"<=",
"0",
"?",
"$",
"this",
"->",
"count",
":",
"$",
"this",
"->",
"limit",
";",
"$",
"first_url",
"=",
"$",
"this",
"->",
"offset_key",
".",
... | Generate the first page url parameters as string.
@param int $count
@param int $currentOffset
@param int $limit
@return string | [
"Generate",
"the",
"first",
"page",
"url",
"parameters",
"as",
"string",
"."
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L168-L174 |
21,154 | jnaxo/country-codes | src/Store/api/Paginator.php | Paginator.getPaginationMetaData | public function getPaginationMetaData()
{
$pagination = [
'count' => $this->count,
'offset' => $this->offset,
'limit' => $this->limit,
'next_page_params' => $this->getNextPageParams(),
];
return $pagination;
} | php | public function getPaginationMetaData()
{
$pagination = [
'count' => $this->count,
'offset' => $this->offset,
'limit' => $this->limit,
'next_page_params' => $this->getNextPageParams(),
];
return $pagination;
} | [
"public",
"function",
"getPaginationMetaData",
"(",
")",
"{",
"$",
"pagination",
"=",
"[",
"'count'",
"=>",
"$",
"this",
"->",
"count",
",",
"'offset'",
"=>",
"$",
"this",
"->",
"offset",
",",
"'limit'",
"=>",
"$",
"this",
"->",
"limit",
",",
"'next_page... | Get a json encoded array with pagination metadata | [
"Get",
"a",
"json",
"encoded",
"array",
"with",
"pagination",
"metadata"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Paginator.php#L180-L190 |
21,155 | Danzabar/config-builder | src/Data/ParamBag.php | ParamBag.recursiveReplace | public function recursiveReplace($search, $replace)
{
$json = json_encode($this->params);
$json = str_replace($search, $replace, $json);
$this->params = json_decode($json, TRUE);
} | php | public function recursiveReplace($search, $replace)
{
$json = json_encode($this->params);
$json = str_replace($search, $replace, $json);
$this->params = json_decode($json, TRUE);
} | [
"public",
"function",
"recursiveReplace",
"(",
"$",
"search",
",",
"$",
"replace",
")",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"$",
"this",
"->",
"params",
")",
";",
"$",
"json",
"=",
"str_replace",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"... | Search and replace function for multi level arrays
@param String $search
@param String $replace
@return void
@author Dan Cox | [
"Search",
"and",
"replace",
"function",
"for",
"multi",
"level",
"arrays"
] | 3b237be578172c32498bbcdfb360e69a6243739d | https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/ParamBag.php#L145-L152 |
21,156 | Danzabar/config-builder | src/Data/ParamBag.php | ParamBag.rollback | public function rollback()
{
if($this->hasBackup)
{
$this->params = $this->backup;
} else
{
throw new Exceptions\NoValidBackup($this->params);
}
} | php | public function rollback()
{
if($this->hasBackup)
{
$this->params = $this->backup;
} else
{
throw new Exceptions\NoValidBackup($this->params);
}
} | [
"public",
"function",
"rollback",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasBackup",
")",
"{",
"$",
"this",
"->",
"params",
"=",
"$",
"this",
"->",
"backup",
";",
"}",
"else",
"{",
"throw",
"new",
"Exceptions",
"\\",
"NoValidBackup",
"(",
"$",... | Uses the backup array to revert the params array
@return void
@author Dan Cox
@throws Exceptions\NoValidBackup | [
"Uses",
"the",
"backup",
"array",
"to",
"revert",
"the",
"params",
"array"
] | 3b237be578172c32498bbcdfb360e69a6243739d | https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/ParamBag.php#L187-L197 |
21,157 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.activateSubscription | public function activateSubscription( $hashString )
{
// 1. fetch the subscription object
$subscription = ezcomSubscription::fetchByHashString( $hashString );
if ( is_null( $subscription ) )
{
$this->tpl->setVariable( 'error_message', ezpI18n::tr( 'ezcomments/comment/acti... | php | public function activateSubscription( $hashString )
{
// 1. fetch the subscription object
$subscription = ezcomSubscription::fetchByHashString( $hashString );
if ( is_null( $subscription ) )
{
$this->tpl->setVariable( 'error_message', ezpI18n::tr( 'ezcomments/comment/acti... | [
"public",
"function",
"activateSubscription",
"(",
"$",
"hashString",
")",
"{",
"// 1. fetch the subscription object",
"$",
"subscription",
"=",
"ezcomSubscription",
"::",
"fetchByHashString",
"(",
"$",
"hashString",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"subscr... | Activate subscription
If there is error,set 'error_message' to the template,
If activation succeeds, set 'subscriber' to the template
@param string: $hashString
@return void | [
"Activate",
"subscription",
"If",
"there",
"is",
"error",
"set",
"error_message",
"to",
"the",
"template",
"If",
"activation",
"succeeds",
"set",
"subscriber",
"to",
"the",
"template"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L35-L64 |
21,158 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.addSubscription | public function addSubscription( $email, $user, $contentID, $languageID, $subscriptionType, $currentTime, $activate = true )
{
//1. insert into subscriber
$ezcommentsINI = eZINI::instance( 'ezcomments.ini' );
$subscriber = ezcomSubscriber::fetchByEmail( $email );
//if there is no dat... | php | public function addSubscription( $email, $user, $contentID, $languageID, $subscriptionType, $currentTime, $activate = true )
{
//1. insert into subscriber
$ezcommentsINI = eZINI::instance( 'ezcomments.ini' );
$subscriber = ezcomSubscriber::fetchByEmail( $email );
//if there is no dat... | [
"public",
"function",
"addSubscription",
"(",
"$",
"email",
",",
"$",
"user",
",",
"$",
"contentID",
",",
"$",
"languageID",
",",
"$",
"subscriptionType",
",",
"$",
"currentTime",
",",
"$",
"activate",
"=",
"true",
")",
"{",
"//1. insert into subscriber",
"$... | Add an subscription. If the subscriber is disabled, throw an exception
If there is no subscriber, add one.
If there is no subscription for the content, add one
@param $email: user's email
@return void | [
"Add",
"an",
"subscription",
".",
"If",
"the",
"subscriber",
"is",
"disabled",
"throw",
"an",
"exception",
"If",
"there",
"is",
"no",
"subscriber",
"add",
"one",
".",
"If",
"there",
"is",
"no",
"subscription",
"for",
"the",
"content",
"add",
"one"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L73-L140 |
21,159 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.sendActivationEmail | public static function sendActivationEmail( $contentObject, $subscriber, $subscription )
{
$transport = eZNotificationTransport::instance( 'ezmail' );
$email = $subscriber->attribute( 'email' );
$tpl = eZTemplate::factory();
$tpl->setVariable( 'contentobject', $contentObject );
... | php | public static function sendActivationEmail( $contentObject, $subscriber, $subscription )
{
$transport = eZNotificationTransport::instance( 'ezmail' );
$email = $subscriber->attribute( 'email' );
$tpl = eZTemplate::factory();
$tpl->setVariable( 'contentobject', $contentObject );
... | [
"public",
"static",
"function",
"sendActivationEmail",
"(",
"$",
"contentObject",
",",
"$",
"subscriber",
",",
"$",
"subscription",
")",
"{",
"$",
"transport",
"=",
"eZNotificationTransport",
"::",
"instance",
"(",
"'ezmail'",
")",
";",
"$",
"email",
"=",
"$",... | send activation email to the user
@param ezcomContentObject $contentObject
@param ezcomSubscriber $subscriber
@param ezcomSubscription $subscription
@return true if mail sending succeeds
false if mail sending fails | [
"send",
"activation",
"email",
"to",
"the",
"user"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L150-L169 |
21,160 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.cleanupExpiredSubscription | public static function cleanupExpiredSubscription( $time )
{
//1. find the subscription which is disabled and whose time is too long
$startTime = time() - $time;
$db = eZDB::instance();
$selectSql = "SELECT id FROM ezcomment_subscription WHERE subscription_time < $startTime AND enabl... | php | public static function cleanupExpiredSubscription( $time )
{
//1. find the subscription which is disabled and whose time is too long
$startTime = time() - $time;
$db = eZDB::instance();
$selectSql = "SELECT id FROM ezcomment_subscription WHERE subscription_time < $startTime AND enabl... | [
"public",
"static",
"function",
"cleanupExpiredSubscription",
"(",
"$",
"time",
")",
"{",
"//1. find the subscription which is disabled and whose time is too long",
"$",
"startTime",
"=",
"time",
"(",
")",
"-",
"$",
"time",
";",
"$",
"db",
"=",
"eZDB",
"::",
"instan... | clean up the subscription if the subscription has not been activate for very long
@return array id of subscription cleaned up
null if nothing cleaned up | [
"clean",
"up",
"the",
"subscription",
"if",
"the",
"subscription",
"has",
"not",
"been",
"activate",
"for",
"very",
"long"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L176-L194 |
21,161 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.deleteSubscription | public function deleteSubscription( $email, $contentObjectID, $languageID )
{
$subscriber = ezcomSubscriber::fetchByEmail( $email );
$cond = array();
$cond['subscriber_id'] = $subscriber->attribute( 'id' );
$cond['content_id'] = $contentObjectID;
$cond['language_id'] = $langu... | php | public function deleteSubscription( $email, $contentObjectID, $languageID )
{
$subscriber = ezcomSubscriber::fetchByEmail( $email );
$cond = array();
$cond['subscriber_id'] = $subscriber->attribute( 'id' );
$cond['content_id'] = $contentObjectID;
$cond['language_id'] = $langu... | [
"public",
"function",
"deleteSubscription",
"(",
"$",
"email",
",",
"$",
"contentObjectID",
",",
"$",
"languageID",
")",
"{",
"$",
"subscriber",
"=",
"ezcomSubscriber",
"::",
"fetchByEmail",
"(",
"$",
"email",
")",
";",
"$",
"cond",
"=",
"array",
"(",
")",... | delete the subscription given the subscriber's email
@param $email
@param $contentObjectID
@param $languageID
@return unknown_type | [
"delete",
"the",
"subscription",
"given",
"the",
"subscriber",
"s",
"email"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L203-L213 |
21,162 | ezsystems/ezcomments-ls-extension | classes/ezcomsubscriptionmanager.php | ezcomSubscriptionManager.instance | public static function instance( $tpl = null, $module = null, $params = null, $className = null )
{
$object = null;
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'ManagerClasses', 'SubscriptionManagerClass' );
... | php | public static function instance( $tpl = null, $module = null, $params = null, $className = null )
{
$object = null;
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'ManagerClasses', 'SubscriptionManagerClass' );
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"tpl",
"=",
"null",
",",
"$",
"module",
"=",
"null",
",",
"$",
"params",
"=",
"null",
",",
"$",
"className",
"=",
"null",
")",
"{",
"$",
"object",
"=",
"null",
";",
"if",
"(",
"is_null",
"(",
... | method for creating object
@return ezcomSubscriptionManager | [
"method",
"for",
"creating",
"object"
] | 2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5 | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomsubscriptionmanager.php#L219-L240 |
21,163 | raideer/twitch-api | src/Resources/Games.php | Games.getTopGames | public function getTopGames($params = [])
{
$defaults = [
'limit' => 10,
'offset' => 0,
];
return $this->wrapper->request('GET', 'games/top', ['query' => $this->resolveOptions($params, $defaults)]);
} | php | public function getTopGames($params = [])
{
$defaults = [
'limit' => 10,
'offset' => 0,
];
return $this->wrapper->request('GET', 'games/top', ['query' => $this->resolveOptions($params, $defaults)]);
} | [
"public",
"function",
"getTopGames",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'limit'",
"=>",
"10",
",",
"'offset'",
"=>",
"0",
",",
"]",
";",
"return",
"$",
"this",
"->",
"wrapper",
"->",
"request",
"(",
"'GET'",
",... | Returns a list of games objects sorted by number of current viewers on Twitch, most popular first.
Learn more:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/games.md#get-gamestop
@param array $params Optional parameters
@return array | [
"Returns",
"a",
"list",
"of",
"games",
"objects",
"sorted",
"by",
"number",
"of",
"current",
"viewers",
"on",
"Twitch",
"most",
"popular",
"first",
"."
] | 27ebf1dcb0315206300d507600b6a82ebe33d57e | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Resources/Games.php#L31-L39 |
21,164 | derhasi/buddy | src/Config.php | Config.load | public function load($workingDir)
{
$locator = new FileLocator($this->getPotentialDirectories($workingDir));
$loader = new YamlLoader($locator);
// Config validation.
$processor = new Processor();
$schema = new BuddySchema();
$files = $locator->locate(static::FILENAME, NULL, FALSE);
fore... | php | public function load($workingDir)
{
$locator = new FileLocator($this->getPotentialDirectories($workingDir));
$loader = new YamlLoader($locator);
// Config validation.
$processor = new Processor();
$schema = new BuddySchema();
$files = $locator->locate(static::FILENAME, NULL, FALSE);
fore... | [
"public",
"function",
"load",
"(",
"$",
"workingDir",
")",
"{",
"$",
"locator",
"=",
"new",
"FileLocator",
"(",
"$",
"this",
"->",
"getPotentialDirectories",
"(",
"$",
"workingDir",
")",
")",
";",
"$",
"loader",
"=",
"new",
"YamlLoader",
"(",
"$",
"locat... | Loads the configuration file data. | [
"Loads",
"the",
"configuration",
"file",
"data",
"."
] | a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165 | https://github.com/derhasi/buddy/blob/a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165/src/Config.php#L29-L62 |
21,165 | derhasi/buddy | src/Config.php | Config.getCommand | public function getCommand($command)
{
return new CommandShortcut($command, $this->commands[$command]['options'], $this->commands[$command]['file']);
} | php | public function getCommand($command)
{
return new CommandShortcut($command, $this->commands[$command]['options'], $this->commands[$command]['file']);
} | [
"public",
"function",
"getCommand",
"(",
"$",
"command",
")",
"{",
"return",
"new",
"CommandShortcut",
"(",
"$",
"command",
",",
"$",
"this",
"->",
"commands",
"[",
"$",
"command",
"]",
"[",
"'options'",
"]",
",",
"$",
"this",
"->",
"commands",
"[",
"$... | Provides the command specification.
@param string $command
@return \derhasi\buddy\CommandShortcut
Command shortcut | [
"Provides",
"the",
"command",
"specification",
"."
] | a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165 | https://github.com/derhasi/buddy/blob/a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165/src/Config.php#L86-L89 |
21,166 | derhasi/buddy | src/Config.php | Config.getPotentialDirectories | protected function getPotentialDirectories($workingDir)
{
$paths = array();
$path = '';
foreach (explode('/', $workingDir) as $part) {
$path .= $part . '/';
$paths[] = rtrim($path, '/');
}
return $paths;
} | php | protected function getPotentialDirectories($workingDir)
{
$paths = array();
$path = '';
foreach (explode('/', $workingDir) as $part) {
$path .= $part . '/';
$paths[] = rtrim($path, '/');
}
return $paths;
} | [
"protected",
"function",
"getPotentialDirectories",
"(",
"$",
"workingDir",
")",
"{",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"$",
"path",
"=",
"''",
";",
"foreach",
"(",
"explode",
"(",
"'/'",
",",
"$",
"workingDir",
")",
"as",
"$",
"part",
")",
... | Helper to provide potential directories to look for .buddy.yml files.
@return array
List of directory paths. | [
"Helper",
"to",
"provide",
"potential",
"directories",
"to",
"look",
"for",
".",
"buddy",
".",
"yml",
"files",
"."
] | a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165 | https://github.com/derhasi/buddy/blob/a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165/src/Config.php#L97-L106 |
21,167 | nabab/bbn | src/bbn/db/languages/mysql.php | mysql.get_group_by | public function get_group_by(array $cfg): string
{
$res = '';
$group_to_put = [];
if ( !empty($cfg['group_by']) ){
foreach ( $cfg['group_by'] as $g ){
if ( isset($cfg['available_fields'][$g]) ){
$group_to_put[] = $this->escape($g);
//$group_to_put[] = $this->col_full_name... | php | public function get_group_by(array $cfg): string
{
$res = '';
$group_to_put = [];
if ( !empty($cfg['group_by']) ){
foreach ( $cfg['group_by'] as $g ){
if ( isset($cfg['available_fields'][$g]) ){
$group_to_put[] = $this->escape($g);
//$group_to_put[] = $this->col_full_name... | [
"public",
"function",
"get_group_by",
"(",
"array",
"$",
"cfg",
")",
":",
"string",
"{",
"$",
"res",
"=",
"''",
";",
"$",
"group_to_put",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cfg",
"[",
"'group_by'",
"]",
")",
")",
"{",
"foreac... | Returns a string with the GROUP BY part of the query if there is, empty otherwise
@param array $cfg
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"GROUP",
"BY",
"part",
"of",
"the",
"query",
"if",
"there",
"is",
"empty",
"otherwise"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/languages/mysql.php#L948-L967 |
21,168 | nabab/bbn | src/bbn/db/languages/mysql.php | mysql.get_having | public function get_having(array $cfg): string
{
$res = '';
if ( !empty($cfg['group_by']) && !empty($cfg['having']) && ($cond = $this->get_conditions($cfg['having'], $cfg, true)) ){
$res .= 'HAVING '.$cond.PHP_EOL;
}
return $res;
} | php | public function get_having(array $cfg): string
{
$res = '';
if ( !empty($cfg['group_by']) && !empty($cfg['having']) && ($cond = $this->get_conditions($cfg['having'], $cfg, true)) ){
$res .= 'HAVING '.$cond.PHP_EOL;
}
return $res;
} | [
"public",
"function",
"get_having",
"(",
"array",
"$",
"cfg",
")",
":",
"string",
"{",
"$",
"res",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cfg",
"[",
"'group_by'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"cfg",
"[",
"'having'",
"]",
... | Returns a string with the HAVING part of the query if there is, empty otherwise
@param array $cfg
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"HAVING",
"part",
"of",
"the",
"query",
"if",
"there",
"is",
"empty",
"otherwise"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/languages/mysql.php#L975-L982 |
21,169 | nabab/bbn | src/bbn/db/languages/mysql.php | mysql.create_index | public function create_index(string $table, $column, bool $unique = false, $length = null): bool
{
$column = (array)$column;
if ( $length ){
$length = (array)$length;
}
$name = bbn\str::encode_filename($table);
if ( $table = $this->table_full_name($table, true) ){
foreach ( $column as $i =... | php | public function create_index(string $table, $column, bool $unique = false, $length = null): bool
{
$column = (array)$column;
if ( $length ){
$length = (array)$length;
}
$name = bbn\str::encode_filename($table);
if ( $table = $this->table_full_name($table, true) ){
foreach ( $column as $i =... | [
"public",
"function",
"create_index",
"(",
"string",
"$",
"table",
",",
"$",
"column",
",",
"bool",
"$",
"unique",
"=",
"false",
",",
"$",
"length",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"column",
"=",
"(",
"array",
")",
"$",
"column",
";",
"if"... | Creates an index
@param null|string $table
@param string|array $column
@param bool $unique
@param null $length
@return bool | [
"Creates",
"an",
"index"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/languages/mysql.php#L1124-L1147 |
21,170 | nabab/bbn | src/bbn/db/languages/mysql.php | mysql.delete_user | public function delete_user(string $user): bool
{
if ( bbn\str::check_name($user) ){
$this->db->raw_query("
REVOKE ALL PRIVILEGES ON *.*
FROM $user");
return (bool)$this->db->query("DROP USER $user");
}
return false;
} | php | public function delete_user(string $user): bool
{
if ( bbn\str::check_name($user) ){
$this->db->raw_query("
REVOKE ALL PRIVILEGES ON *.*
FROM $user");
return (bool)$this->db->query("DROP USER $user");
}
return false;
} | [
"public",
"function",
"delete_user",
"(",
"string",
"$",
"user",
")",
":",
"bool",
"{",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"check_name",
"(",
"$",
"user",
")",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"raw_query",
"(",
"\"\n\t\t\tREVOKE ALL PRIVILEGES ... | Deletes a database user
@param string $user
@return bool | [
"Deletes",
"a",
"database",
"user"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/db/languages/mysql.php#L1206-L1215 |
21,171 | Laralum/Users | src/Controllers/UserController.php | UserController.manageRoles | public function manageRoles(User $user)
{
$this->authorize('roles', $user);
$roles = Role::all();
return view('laralum_users::roles', ['user' => $user, 'roles' => $roles]);
} | php | public function manageRoles(User $user)
{
$this->authorize('roles', $user);
$roles = Role::all();
return view('laralum_users::roles', ['user' => $user, 'roles' => $roles]);
} | [
"public",
"function",
"manageRoles",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"authorize",
"(",
"'roles'",
",",
"$",
"user",
")",
";",
"$",
"roles",
"=",
"Role",
"::",
"all",
"(",
")",
";",
"return",
"view",
"(",
"'laralum_users::roles'",... | Manage roles from users.
@param \Laralum\Users\Models\User $user
@return \Illuminate\Http\Response | [
"Manage",
"roles",
"from",
"users",
"."
] | 788851d4cdf4bff548936faf1b12cf4697d13428 | https://github.com/Laralum/Users/blob/788851d4cdf4bff548936faf1b12cf4697d13428/src/Controllers/UserController.php#L137-L144 |
21,172 | GrupaZero/api | src/Gzero/Api/Transformer/UserTransformer.php | UserTransformer.transform | public function transform($user)
{
$user = $this->entityToArray(User::class, $user);
return [
'id' => (int) $user['id'],
'email' => $user['email'],
'nick' => $user['nick'],
'firstName' => $user['first_name'],
'lastName' => ... | php | public function transform($user)
{
$user = $this->entityToArray(User::class, $user);
return [
'id' => (int) $user['id'],
'email' => $user['email'],
'nick' => $user['nick'],
'firstName' => $user['first_name'],
'lastName' => ... | [
"public",
"function",
"transform",
"(",
"$",
"user",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"entityToArray",
"(",
"User",
"::",
"class",
",",
"$",
"user",
")",
";",
"return",
"[",
"'id'",
"=>",
"(",
"int",
")",
"$",
"user",
"[",
"'id'",
"... | Transforms user entity
@param User|array $user User entity
@return array | [
"Transforms",
"user",
"entity"
] | fc544bb6057274e9d5e7b617346c3f854ea5effd | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/UserTransformer.php#L35-L46 |
21,173 | SporkCode/Spork | src/Mvc/Listener/XmlHttpRequestStrategy.php | XmlHttpRequestStrategy.handleXmlHttpRequest | public function handleXmlHttpRequest(MvcEvent $event)
{
$request = $event->getRequest();
if ($request->isXMLHttpRequest()) {
$dispatchResult = $event->getResult();
if ($dispatchResult instanceof ViewModel) {
$dispatchResult->setTerminal(true);
}
}
} | php | public function handleXmlHttpRequest(MvcEvent $event)
{
$request = $event->getRequest();
if ($request->isXMLHttpRequest()) {
$dispatchResult = $event->getResult();
if ($dispatchResult instanceof ViewModel) {
$dispatchResult->setTerminal(true);
}
}
} | [
"public",
"function",
"handleXmlHttpRequest",
"(",
"MvcEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"isXMLHttpRequest",
"(",
")",
")",
"{",
"$",
"dispatchResult",
"... | If request is an XML HTTP Request disable layouts
@param MvcEvent $event | [
"If",
"request",
"is",
"an",
"XML",
"HTTP",
"Request",
"disable",
"layouts"
] | 7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/XmlHttpRequestStrategy.php#L41-L50 |
21,174 | ajgarlag/AjglSessionConcurrency | src/Http/Session/ConcurrentSessionControlAuthenticationStrategy.php | ConcurrentSessionControlAuthenticationStrategy.allowedSessionsExceeded | protected function allowedSessionsExceeded($orderedSessions, $allowableSessions, SessionRegistry $registry)
{
if ($this->errorIfMaximumExceeded) {
throw new MaxSessionsExceededException(sprintf('Maximum number of sessions (%s) exceeded', $allowableSessions));
}
// Expire oldest ... | php | protected function allowedSessionsExceeded($orderedSessions, $allowableSessions, SessionRegistry $registry)
{
if ($this->errorIfMaximumExceeded) {
throw new MaxSessionsExceededException(sprintf('Maximum number of sessions (%s) exceeded', $allowableSessions));
}
// Expire oldest ... | [
"protected",
"function",
"allowedSessionsExceeded",
"(",
"$",
"orderedSessions",
",",
"$",
"allowableSessions",
",",
"SessionRegistry",
"$",
"registry",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"errorIfMaximumExceeded",
")",
"{",
"throw",
"new",
"MaxSessionsExceededE... | Allows subclasses to customize behavior when too many sessions are detected.
@param Registry\SessionInformation[] $orderedSessions Array of SessionInformation ordered from newest to oldest
@param int $allowableSessions
@param SessionRegistry $registry | [
"Allows",
"subclasses",
"to",
"customize",
"behavior",
"when",
"too",
"many",
"sessions",
"are",
"detected",
"."
] | daa3b1ff3ad4951947f7192e12b2496555e135fb | https://github.com/ajgarlag/AjglSessionConcurrency/blob/daa3b1ff3ad4951947f7192e12b2496555e135fb/src/Http/Session/ConcurrentSessionControlAuthenticationStrategy.php#L104-L115 |
21,175 | ClementIV/yii-rest-rbac2.0 | controllers/MenuController.php | MenuController.actionGetMenus | public function actionGetMenus()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
return Menu::getMenuSource();
}catch(Exception $e){
throw new Exception($e);
... | php | public function actionGetMenus()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
return Menu::getMenuSource();
}catch(Exception $e){
throw new Exception($e);
... | [
"public",
"function",
"actionGetMenus",
"(",
")",
"{",
"$",
"request",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
";",
"if",
"(",
"$",
"request",
"->",
"getIsOptions",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"ResponseOptions",
"(",
... | list all menus
@return json list | [
"list",
"all",
"menus"
] | 435ffceca8d51b4d369182db3a06c20f336e9ac4 | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/controllers/MenuController.php#L71-L82 |
21,176 | ClementIV/yii-rest-rbac2.0 | controllers/MenuController.php | MenuController.actionGetSavedRoutes | public function actionGetSavedRoutes()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
return Menu::getSavedRoutes();
}catch(Exception $e){
throw new Exception... | php | public function actionGetSavedRoutes()
{
$request = \Yii::$app->request;
if ($request->getIsOptions()) {
return $this->ResponseOptions($this->verbs()['index']);
}
try{
return Menu::getSavedRoutes();
}catch(Exception $e){
throw new Exception... | [
"public",
"function",
"actionGetSavedRoutes",
"(",
")",
"{",
"$",
"request",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
";",
"if",
"(",
"$",
"request",
"->",
"getIsOptions",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"ResponseOptions",
... | list all menus route
@return json list | [
"list",
"all",
"menus",
"route"
] | 435ffceca8d51b4d369182db3a06c20f336e9ac4 | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/controllers/MenuController.php#L88-L99 |
21,177 | novaway/open-graph | src/OpenGraphGenerator.php | OpenGraphGenerator.generate | public function generate($obj)
{
if (!is_object($obj)) {
throw new \InvalidArgumentException('OpenGraphGenerator::generate only accept object argument.');
}
$openGraph = new OpenGraph();
$classType = get_class($obj);
$metadata = $this->factory->getMetadataForCl... | php | public function generate($obj)
{
if (!is_object($obj)) {
throw new \InvalidArgumentException('OpenGraphGenerator::generate only accept object argument.');
}
$openGraph = new OpenGraph();
$classType = get_class($obj);
$metadata = $this->factory->getMetadataForCl... | [
"public",
"function",
"generate",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"obj",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'OpenGraphGenerator::generate only accept object argument.'",
")",
";",
"}",
"$",
... | Generate OpenGraph through metadata
@param object $obj
@return OpenGraphInterface | [
"Generate",
"OpenGraph",
"through",
"metadata"
] | 19817bee4b91cf26ca3fe44883ad58b32328e464 | https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/OpenGraphGenerator.php#L29-L58 |
21,178 | OKTOTV/OktolabMediaBundle | Model/EpisodeAssetDataJob.php | EpisodeAssetDataJob.getStreamInformationsOfEpisode | private function getStreamInformationsOfEpisode($episode)
{
$uri = $this->getContainer()->get('bprs.asset_helper')->getAbsoluteUrl($episode->getVideo());
if (!$uri) { // can't create uri of episode video
$this->logbook->error('oktolab_media.episode_assetdatajob_nourl', [], $this->args['u... | php | private function getStreamInformationsOfEpisode($episode)
{
$uri = $this->getContainer()->get('bprs.asset_helper')->getAbsoluteUrl($episode->getVideo());
if (!$uri) { // can't create uri of episode video
$this->logbook->error('oktolab_media.episode_assetdatajob_nourl', [], $this->args['u... | [
"private",
"function",
"getStreamInformationsOfEpisode",
"(",
"$",
"episode",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'bprs.asset_helper'",
")",
"->",
"getAbsoluteUrl",
"(",
"$",
"episode",
"->",
"getVideo",
... | extracts streaminformations of an episode from its video.
returns false if informations can't be extracted
returns array of video and audio info. | [
"extracts",
"streaminformations",
"of",
"an",
"episode",
"from",
"its",
"video",
".",
"returns",
"false",
"if",
"informations",
"can",
"t",
"be",
"extracted",
"returns",
"array",
"of",
"video",
"and",
"audio",
"info",
"."
] | f9c1eac4f6b19d2ab25288b301dd0d9350478bb3 | https://github.com/OKTOTV/OktolabMediaBundle/blob/f9c1eac4f6b19d2ab25288b301dd0d9350478bb3/Model/EpisodeAssetDataJob.php#L77-L103 |
21,179 | oroinc/OroLayoutComponent | Layouts.php | Layouts.createLayoutFactoryBuilder | public static function createLayoutFactoryBuilder()
{
$builder = new LayoutFactoryBuilder(
new ExpressionProcessor(
new ExpressionLanguage(),
new ExpressionEncoderRegistry(
[
'json' => new JsonExpressionEncoder(new Expre... | php | public static function createLayoutFactoryBuilder()
{
$builder = new LayoutFactoryBuilder(
new ExpressionProcessor(
new ExpressionLanguage(),
new ExpressionEncoderRegistry(
[
'json' => new JsonExpressionEncoder(new Expre... | [
"public",
"static",
"function",
"createLayoutFactoryBuilder",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"LayoutFactoryBuilder",
"(",
"new",
"ExpressionProcessor",
"(",
"new",
"ExpressionLanguage",
"(",
")",
",",
"new",
"ExpressionEncoderRegistry",
"(",
"[",
"'json'... | Creates a layout factory builder with the default configuration.
@return LayoutFactoryBuilderInterface | [
"Creates",
"a",
"layout",
"factory",
"builder",
"with",
"the",
"default",
"configuration",
"."
] | 682a96672393d81c63728e47c4a4c3618c515be0 | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Layouts.php#L110-L126 |
21,180 | phpnfe/tools | src/Strings.php | Strings.clearXml | public static function clearXml($xml = '', $remEnc = false)
{
//$xml = self::clearMsg($xml);
$aFind = [
'xmlns:default="http://www.w3.org/2000/09/xmldsig#"',
' standalone="no"',
'default:',
':default',
"\n",
"\r",
"\... | php | public static function clearXml($xml = '', $remEnc = false)
{
//$xml = self::clearMsg($xml);
$aFind = [
'xmlns:default="http://www.w3.org/2000/09/xmldsig#"',
' standalone="no"',
'default:',
':default',
"\n",
"\r",
"\... | [
"public",
"static",
"function",
"clearXml",
"(",
"$",
"xml",
"=",
"''",
",",
"$",
"remEnc",
"=",
"false",
")",
"{",
"//$xml = self::clearMsg($xml);",
"$",
"aFind",
"=",
"[",
"'xmlns:default=\"http://www.w3.org/2000/09/xmldsig#\"'",
",",
"' standalone=\"no\"'",
",",
... | clearXml
Remove \r \n \s \t.
@param string $xml
@param bool $remEnc remover encoding do xml
@return string | [
"clearXml",
"Remove",
"\\",
"r",
"\\",
"n",
"\\",
"s",
"\\",
"t",
"."
] | 303ca311989e0b345071f61b71d2b3bf7ee80454 | https://github.com/phpnfe/tools/blob/303ca311989e0b345071f61b71d2b3bf7ee80454/src/Strings.php#L38-L60 |
21,181 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Parser/UTF8Utils.php | HTML5_Parser_UTF8Utils.countChars | public static function countChars($string) {
// Get the length for the string we need.
if (function_exists('iconv_strlen')) {
return iconv_strlen($string, 'utf-8');
} elseif (function_exists('mb_strlen')) {
return mb_strlen($string, 'utf-8');
} elseif (function_ex... | php | public static function countChars($string) {
// Get the length for the string we need.
if (function_exists('iconv_strlen')) {
return iconv_strlen($string, 'utf-8');
} elseif (function_exists('mb_strlen')) {
return mb_strlen($string, 'utf-8');
} elseif (function_ex... | [
"public",
"static",
"function",
"countChars",
"(",
"$",
"string",
")",
"{",
"// Get the length for the string we need.",
"if",
"(",
"function_exists",
"(",
"'iconv_strlen'",
")",
")",
"{",
"return",
"iconv_strlen",
"(",
"$",
"string",
",",
"'utf-8'",
")",
";",
"... | Count the number of characters in a string.
UTF-8 aware. This will try (in order) iconv,
MB, libxml, and finally a custom counter.
@todo Move this to a general utility class. | [
"Count",
"the",
"number",
"of",
"characters",
"in",
"a",
"string",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Parser/UTF8Utils.php#L133-L148 |
21,182 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Parser/UTF8Utils.php | HTML5_Parser_UTF8Utils.convertToUTF8 | public static function convertToUTF8($data, $encoding = 'UTF-8') {
/*
* From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted to Unicode characters for the tokeniser, as described by the rules for that encoding, except that the leading U+FEFF BYTE ORDER MARK character,... | php | public static function convertToUTF8($data, $encoding = 'UTF-8') {
/*
* From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted to Unicode characters for the tokeniser, as described by the rules for that encoding, except that the leading U+FEFF BYTE ORDER MARK character,... | [
"public",
"static",
"function",
"convertToUTF8",
"(",
"$",
"data",
",",
"$",
"encoding",
"=",
"'UTF-8'",
")",
"{",
"/*\n * From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted to Unicode characters for the tokeniser, as described by the rules fo... | Convert data from the given encoding to UTF-8.
This has not yet been tested with charactersets other than UTF-8.
It should work with ISO-8859-1/-13 and standard Latin Win charsets.
@param string $data
The data to convert.
@param string $encoding
A valid encoding. Examples: http://www.php.net/manual/en/mbstring.suppor... | [
"Convert",
"data",
"from",
"the",
"given",
"encoding",
"to",
"UTF",
"-",
"8",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Parser/UTF8Utils.php#L161-L204 |
21,183 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Parser/UTF8Utils.php | HTML5_Parser_UTF8Utils.checkForIllegalCodepoints | public static function checkForIllegalCodepoints($data) {
if (!function_exists('preg_match_all')) {
throw HTML5_Exception('The PCRE library is not loaded or is not available.');
}
// Vestigal error handling.
$errors = array();
/*
* All U+0000 null character... | php | public static function checkForIllegalCodepoints($data) {
if (!function_exists('preg_match_all')) {
throw HTML5_Exception('The PCRE library is not loaded or is not available.');
}
// Vestigal error handling.
$errors = array();
/*
* All U+0000 null character... | [
"public",
"static",
"function",
"checkForIllegalCodepoints",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'preg_match_all'",
")",
")",
"{",
"throw",
"HTML5_Exception",
"(",
"'The PCRE library is not loaded or is not available.'",
")",
";",
"}",... | Checks for Unicode code points that are not valid in a document.
@param string $data
A string to analyze.
@return array An array of (string) error messages produced by the scanning. | [
"Checks",
"for",
"Unicode",
"code",
"points",
"that",
"are",
"not",
"valid",
"in",
"a",
"document",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Parser/UTF8Utils.php#L213-L251 |
21,184 | wplibs/rules | src/Rule.php | Rule.apply | public function apply( $context ) {
if ( ! $context instanceof RContext ) {
$context = new Context( $context );
}
return $this->evaluate( $context );
} | php | public function apply( $context ) {
if ( ! $context instanceof RContext ) {
$context = new Context( $context );
}
return $this->evaluate( $context );
} | [
"public",
"function",
"apply",
"(",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"RContext",
")",
"{",
"$",
"context",
"=",
"new",
"Context",
"(",
"$",
"context",
")",
";",
"}",
"return",
"$",
"this",
"->",
"evaluate",
"(",... | Evaluate the Rule with the given Context.
@param \Ruler\Context|array $context Context with which to evaluate this Rule.
@return boolean | [
"Evaluate",
"the",
"Rule",
"with",
"the",
"given",
"Context",
"."
] | 29b4495e2ae87349fd64fcd844f3ba96cc268e3d | https://github.com/wplibs/rules/blob/29b4495e2ae87349fd64fcd844f3ba96cc268e3d/src/Rule.php#L31-L37 |
21,185 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php | ezcMailTools.generateMessageId | public static function generateMessageId( $hostname )
{
if ( strpos( $hostname, '@' ) !== false )
{
$hostname = strstr( $hostname, '@' );
}
else
{
$hostname = '@' . $hostname;
}
return date( 'YmdGHjs' ) . '.' . getmypid() . '.' . self::... | php | public static function generateMessageId( $hostname )
{
if ( strpos( $hostname, '@' ) !== false )
{
$hostname = strstr( $hostname, '@' );
}
else
{
$hostname = '@' . $hostname;
}
return date( 'YmdGHjs' ) . '.' . getmypid() . '.' . self::... | [
"public",
"static",
"function",
"generateMessageId",
"(",
"$",
"hostname",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"hostname",
",",
"'@'",
")",
"!==",
"false",
")",
"{",
"$",
"hostname",
"=",
"strstr",
"(",
"$",
"hostname",
",",
"'@'",
")",
";",
"}"... | Returns an unique message ID to be used for a mail message.
The hostname $hostname will be added to the unique ID as required by RFC822.
If an e-mail address is provided instead, the hostname is extracted and used.
The formula to generate the message ID is: [time_and_date].[process_id].[counter]
@param string $hostn... | [
"Returns",
"an",
"unique",
"message",
"ID",
"to",
"be",
"used",
"for",
"a",
"mail",
"message",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php#L502-L513 |
21,186 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php | ezcMailTools.mimeDecode | public static function mimeDecode( $text, $charset = 'utf-8' )
{
$origtext = $text;
$text = @iconv_mime_decode( $text, 0, $charset );
if ( $text !== false )
{
return $text;
}
// something went wrong while decoding, let's see if we can fix it
// Tr... | php | public static function mimeDecode( $text, $charset = 'utf-8' )
{
$origtext = $text;
$text = @iconv_mime_decode( $text, 0, $charset );
if ( $text !== false )
{
return $text;
}
// something went wrong while decoding, let's see if we can fix it
// Tr... | [
"public",
"static",
"function",
"mimeDecode",
"(",
"$",
"text",
",",
"$",
"charset",
"=",
"'utf-8'",
")",
"{",
"$",
"origtext",
"=",
"$",
"text",
";",
"$",
"text",
"=",
"@",
"iconv_mime_decode",
"(",
"$",
"text",
",",
"0",
",",
"$",
"charset",
")",
... | Decodes mime encoded fields and tries to recover from errors.
Decodes the $text encoded as a MIME string to the $charset. In case the
strict conversion fails this method tries to workaround the issues by
trying to "fix" the original $text before trying to convert it.
@param string $text
@param string $charset
@return... | [
"Decodes",
"mime",
"encoded",
"fields",
"and",
"tries",
"to",
"recover",
"from",
"errors",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php#L568-L604 |
21,187 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php | ezcMailTools.replyToMail | static public function replyToMail( ezcMail $mail, ezcMailAddress $from,
$type = self::REPLY_SENDER, $subjectPrefix = "Re: ",
$mailClass = "ezcMail" )
{
$reply = new $mailClass();
$reply->from = $from;
// To = R... | php | static public function replyToMail( ezcMail $mail, ezcMailAddress $from,
$type = self::REPLY_SENDER, $subjectPrefix = "Re: ",
$mailClass = "ezcMail" )
{
$reply = new $mailClass();
$reply->from = $from;
// To = R... | [
"static",
"public",
"function",
"replyToMail",
"(",
"ezcMail",
"$",
"mail",
",",
"ezcMailAddress",
"$",
"from",
",",
"$",
"type",
"=",
"self",
"::",
"REPLY_SENDER",
",",
"$",
"subjectPrefix",
"=",
"\"Re: \"",
",",
"$",
"mailClass",
"=",
"\"ezcMail\"",
")",
... | Returns a new mail object that is a reply to the current object.
The new mail will have the correct to, cc, bcc and reference headers set.
It will not have any body set.
By default the reply will only be sent to the sender of the original mail.
If $type is set to REPLY_ALL, all the original recipients will be include... | [
"Returns",
"a",
"new",
"mail",
"object",
"that",
"is",
"a",
"reply",
"to",
"the",
"current",
"object",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php#L626-L689 |
21,188 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php | ezcMailTools.guessContentType | static public function guessContentType( $fileName, &$contentType, &$mimeType )
{
$extension = strtolower( pathinfo( $fileName, PATHINFO_EXTENSION ) );
switch ( $extension )
{
case 'gif':
$contentType = 'image';
$mimeType = 'gif';
b... | php | static public function guessContentType( $fileName, &$contentType, &$mimeType )
{
$extension = strtolower( pathinfo( $fileName, PATHINFO_EXTENSION ) );
switch ( $extension )
{
case 'gif':
$contentType = 'image';
$mimeType = 'gif';
b... | [
"static",
"public",
"function",
"guessContentType",
"(",
"$",
"fileName",
",",
"&",
"$",
"contentType",
",",
"&",
"$",
"mimeType",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"fileName",
",",
"PATHINFO_EXTENSION",
")",
")",
";... | Guesses the content and mime type by using the file extension.
The content and mime types are returned through the $contentType
and $mimeType arguments.
For the moment only for image files.
@param string $fileName
@param string $contentType
@param string $mimeType | [
"Guesses",
"the",
"content",
"and",
"mime",
"type",
"by",
"using",
"the",
"file",
"extension",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/tools.php#L702-L739 |
21,189 | robrogers3/laraldap-auth | src/LdapUserProvider.php | LdapUserProvider.authenticate | public function authenticate(Authenticatable $user, array $credentials)
{
$handler = ldap_connect($this->host);
if (! $handler) {
throw new RuntimeException("Connection fail! Check your server address: '{$this->host}'.");
}
try {
ldap_set_option($handler, L... | php | public function authenticate(Authenticatable $user, array $credentials)
{
$handler = ldap_connect($this->host);
if (! $handler) {
throw new RuntimeException("Connection fail! Check your server address: '{$this->host}'.");
}
try {
ldap_set_option($handler, L... | [
"public",
"function",
"authenticate",
"(",
"Authenticatable",
"$",
"user",
",",
"array",
"$",
"credentials",
")",
"{",
"$",
"handler",
"=",
"ldap_connect",
"(",
"$",
"this",
"->",
"host",
")",
";",
"if",
"(",
"!",
"$",
"handler",
")",
"{",
"throw",
"ne... | Check user's credentials against LDAP server.
@param Authenticatable $user
@param array $credentials
@return bool | [
"Check",
"user",
"s",
"credentials",
"against",
"LDAP",
"server",
"."
] | f1b8d001f8b230389c7fbc5fdd59e39663d8ad36 | https://github.com/robrogers3/laraldap-auth/blob/f1b8d001f8b230389c7fbc5fdd59e39663d8ad36/src/LdapUserProvider.php#L183-L219 |
21,190 | willhoffmann/domuserp-php | src/Resources/Companies/Companies.php | Companies.getList | public function getList(array $query = [])
{
$list = $this->execute(self::HTTP_GET, self::DOMUSERP_API_PEDIDOVENDA . '/empresas');
return $list;
} | php | public function getList(array $query = [])
{
$list = $this->execute(self::HTTP_GET, self::DOMUSERP_API_PEDIDOVENDA . '/empresas');
return $list;
} | [
"public",
"function",
"getList",
"(",
"array",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"$",
"list",
"=",
"$",
"this",
"->",
"execute",
"(",
"self",
"::",
"HTTP_GET",
",",
"self",
"::",
"DOMUSERP_API_PEDIDOVENDA",
".",
"'/empresas'",
")",
";",
"return",
... | List of companies
@param array $query
@return array|string
@throws \GuzzleHttp\Exception\GuzzleException | [
"List",
"of",
"companies"
] | 44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6 | https://github.com/willhoffmann/domuserp-php/blob/44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6/src/Resources/Companies/Companies.php#L18-L23 |
21,191 | wilgucki/php-csv | src/Writer.php | Writer.flush | public function flush()
{
rewind($this->handle);
$out = stream_get_contents($this->handle);
fseek($this->handle, 0, SEEK_END);
return $out;
} | php | public function flush()
{
rewind($this->handle);
$out = stream_get_contents($this->handle);
fseek($this->handle, 0, SEEK_END);
return $out;
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"rewind",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"$",
"out",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"handle",
")",
";",
"fseek",
"(",
"$",
"this",
"->",
"handle",
",",
"0",
",",
"SEEK_... | Output all written data as string.
@return string | [
"Output",
"all",
"written",
"data",
"as",
"string",
"."
] | a6759ecc2ee42348f989dce0688f6c9dd02b1b96 | https://github.com/wilgucki/php-csv/blob/a6759ecc2ee42348f989dce0688f6c9dd02b1b96/src/Writer.php#L60-L66 |
21,192 | wilgucki/php-csv | src/Writer.php | Writer.write | private function write(array $row)
{
if ($this->encodingFrom !== null && $this->encodingTo !== null) {
foreach ($row as $k => $v) {
$row[$k] = iconv($this->encodingFrom, $this->encodingTo, $v);
}
}
return fputcsv($this->handle, $row, $this->delimiter,... | php | private function write(array $row)
{
if ($this->encodingFrom !== null && $this->encodingTo !== null) {
foreach ($row as $k => $v) {
$row[$k] = iconv($this->encodingFrom, $this->encodingTo, $v);
}
}
return fputcsv($this->handle, $row, $this->delimiter,... | [
"private",
"function",
"write",
"(",
"array",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"encodingFrom",
"!==",
"null",
"&&",
"$",
"this",
"->",
"encodingTo",
"!==",
"null",
")",
"{",
"foreach",
"(",
"$",
"row",
"as",
"$",
"k",
"=>",
"$",
... | Wrapper for fputcsv function
@param array $row
@return bool|int | [
"Wrapper",
"for",
"fputcsv",
"function"
] | a6759ecc2ee42348f989dce0688f6c9dd02b1b96 | https://github.com/wilgucki/php-csv/blob/a6759ecc2ee42348f989dce0688f6c9dd02b1b96/src/Writer.php#L74-L83 |
21,193 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/utilities.php | ezcDbUtilities.createTemporaryTable | public function createTemporaryTable( $tableName, $tableDefinition )
{
$tableName = str_replace( '%', '', $tableName );
$tableName = $this->getPrefixedTableNames($tableName);
$this->db->exec( "CREATE TEMPORARY TABLE $tableName ($tableDefinition)" );
return $tableName;
} | php | public function createTemporaryTable( $tableName, $tableDefinition )
{
$tableName = str_replace( '%', '', $tableName );
$tableName = $this->getPrefixedTableNames($tableName);
$this->db->exec( "CREATE TEMPORARY TABLE $tableName ($tableDefinition)" );
return $tableName;
} | [
"public",
"function",
"createTemporaryTable",
"(",
"$",
"tableName",
",",
"$",
"tableDefinition",
")",
"{",
"$",
"tableName",
"=",
"str_replace",
"(",
"'%'",
",",
"''",
",",
"$",
"tableName",
")",
";",
"$",
"tableName",
"=",
"$",
"this",
"->",
"getPrefixed... | Create temporary table.
Developers should use this method rather than creating temporary
tables by hand, executing the appropriate SQL queries.
If the specified table name contains percent character (%)
then it might be substituted with a unique number by some handlers.
For example, Oracle handler does this to guaran... | [
"Create",
"temporary",
"table",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/utilities.php#L69-L75 |
21,194 | Eresus/EresusCMS | src/core/framework/core/3rdparty/dwoo/Dwoo/Adapters/ZendFramework/PluginProxy.php | Dwoo_Adapters_ZendFramework_PluginProxy.handles | public function handles($name) {
try {
$this->view->getHelper($name);
} catch (Zend_Loader_PluginLoader_Exception $e) {
return false;
}
return true;
} | php | public function handles($name) {
try {
$this->view->getHelper($name);
} catch (Zend_Loader_PluginLoader_Exception $e) {
return false;
}
return true;
} | [
"public",
"function",
"handles",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"view",
"->",
"getHelper",
"(",
"$",
"name",
")",
";",
"}",
"catch",
"(",
"Zend_Loader_PluginLoader_Exception",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",... | Called from Dwoo_Compiler to check if the requested plugin is available
@param string $name
@return bool | [
"Called",
"from",
"Dwoo_Compiler",
"to",
"check",
"if",
"the",
"requested",
"plugin",
"is",
"available"
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/dwoo/Dwoo/Adapters/ZendFramework/PluginProxy.php#L43-L51 |
21,195 | antaresproject/notifications | src/Decorator/SidebarItemDecorator.php | SidebarItemDecorator.decorate | public function decorate(Collection $items, $type = 'notification')
{
$view = config('antares/notifications::templates.' . $type);
if (is_null($view)) {
throw new RuntimeException('Unable to resolve notification partial view.');
}
$return = [];
foreach ($items as ... | php | public function decorate(Collection $items, $type = 'notification')
{
$view = config('antares/notifications::templates.' . $type);
if (is_null($view)) {
throw new RuntimeException('Unable to resolve notification partial view.');
}
$return = [];
foreach ($items as ... | [
"public",
"function",
"decorate",
"(",
"Collection",
"$",
"items",
",",
"$",
"type",
"=",
"'notification'",
")",
"{",
"$",
"view",
"=",
"config",
"(",
"'antares/notifications::templates.'",
".",
"$",
"type",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"view"... | Decorates notifications of alerts
@param Collection $items
@param String $type
@return array
@throws RuntimeException | [
"Decorates",
"notifications",
"of",
"alerts"
] | 60de743477b7e9cbb51de66da5fd9461adc9dd8a | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Decorator/SidebarItemDecorator.php#L39-L50 |
21,196 | antaresproject/notifications | src/Decorator/SidebarItemDecorator.php | SidebarItemDecorator.item | public function item(Model $item, $view)
{
$content = $this->getVariablesAdapter()->get($item->content[0]->content, (array) $item->variables);
return view($view, [
'id' => $item->id,
'author' => $item->author,
'title' => $item->content[0]->title,... | php | public function item(Model $item, $view)
{
$content = $this->getVariablesAdapter()->get($item->content[0]->content, (array) $item->variables);
return view($view, [
'id' => $item->id,
'author' => $item->author,
'title' => $item->content[0]->title,... | [
"public",
"function",
"item",
"(",
"Model",
"$",
"item",
",",
"$",
"view",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getVariablesAdapter",
"(",
")",
"->",
"get",
"(",
"$",
"item",
"->",
"content",
"[",
"0",
"]",
"->",
"content",
",",
"(",
... | Decorates single item
@param Model $item
@param String $view
@return String | [
"Decorates",
"single",
"item"
] | 60de743477b7e9cbb51de66da5fd9461adc9dd8a | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Decorator/SidebarItemDecorator.php#L59-L71 |
21,197 | WellCommerce/AppBundle | Controller/Front/CurrencyController.php | CurrencyController.switchAction | public function switchAction(Request $request, string $currency) : RedirectResponse
{
$result = $this->get('currency.repository')->findOneBy(['code' => $currency]);
if (null !== $result) {
$request->getSession()->set('_currency', $currency);
}
return new RedirectResponse... | php | public function switchAction(Request $request, string $currency) : RedirectResponse
{
$result = $this->get('currency.repository')->findOneBy(['code' => $currency]);
if (null !== $result) {
$request->getSession()->set('_currency', $currency);
}
return new RedirectResponse... | [
"public",
"function",
"switchAction",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"currency",
")",
":",
"RedirectResponse",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"get",
"(",
"'currency.repository'",
")",
"->",
"findOneBy",
"(",
"[",
"'code'",
... | Sets new session currency
@param Request $request
@param string $currency
@return RedirectResponse | [
"Sets",
"new",
"session",
"currency"
] | 2add687d1c898dd0b24afd611d896e3811a0eac3 | https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Controller/Front/CurrencyController.php#L34-L42 |
21,198 | nabab/bbn | src/bbn/api/cloudmin.php | cloudmin.sanitize | private function sanitize($st){
$st = trim((string)$st);
if ( strpos($st, ';') !== false ){
return '';
}
if ( strpos($st, '<') !== false ){
return '';
}
if ( strpos($st, '"') !== false ){
return '';
}
if ( strpos($st, "'") !== false ){
return '';
}
return ... | php | private function sanitize($st){
$st = trim((string)$st);
if ( strpos($st, ';') !== false ){
return '';
}
if ( strpos($st, '<') !== false ){
return '';
}
if ( strpos($st, '"') !== false ){
return '';
}
if ( strpos($st, "'") !== false ){
return '';
}
return ... | [
"private",
"function",
"sanitize",
"(",
"$",
"st",
")",
"{",
"$",
"st",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"st",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"st",
",",
"';'",
")",
"!==",
"false",
")",
"{",
"return",
"''",
";",
"}",
"if",... | This function is used to sanitize the strings which are given as parameters
@param string $st
@return string The the header url part to be executed | [
"This",
"function",
"is",
"used",
"to",
"sanitize",
"the",
"strings",
"which",
"are",
"given",
"as",
"parameters"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/api/cloudmin.php#L222-L237 |
21,199 | nabab/bbn | src/bbn/api/cloudmin.php | cloudmin.process_parameters | private function process_parameters($param){
foreach ($param as $key => $val){
//$val is an array
if (\is_array($val)){
$param[$key] = $this->process_parameters($val);
}
else {
$param[$key] = $this->sanitize($val);
}
}
//Return the processed parameters
retur... | php | private function process_parameters($param){
foreach ($param as $key => $val){
//$val is an array
if (\is_array($val)){
$param[$key] = $this->process_parameters($val);
}
else {
$param[$key] = $this->sanitize($val);
}
}
//Return the processed parameters
retur... | [
"private",
"function",
"process_parameters",
"(",
"$",
"param",
")",
"{",
"foreach",
"(",
"$",
"param",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"//$val is an array",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"val",
")",
")",
"{",
"$",
"param",
"["... | Sanitize each parameter
@param array $param the raw parameters
@return array the processed parameters | [
"Sanitize",
"each",
"parameter"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/api/cloudmin.php#L291-L303 |
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.