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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,800 | rhoone/yii2-rhoone | controllers/ExtensionController.php | ExtensionController.actionRemove | public function actionRemove($class, $force = false)
{
try {
Yii::$app->rhoone->ext->deregister($class, $force);
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "The extension `" . $class . "` is removed.\n";
return 0;
} | php | public function actionRemove($class, $force = false)
{
try {
Yii::$app->rhoone->ext->deregister($class, $force);
} catch (\Exception $ex) {
throw new Exception($ex->getMessage());
}
echo "The extension `" . $class . "` is removed.\n";
return 0;
} | [
"public",
"function",
"actionRemove",
"(",
"$",
"class",
",",
"$",
"force",
"=",
"false",
")",
"{",
"try",
"{",
"Yii",
"::",
"$",
"app",
"->",
"rhoone",
"->",
"ext",
"->",
"deregister",
"(",
"$",
"class",
",",
"$",
"force",
")",
";",
"}",
"catch",
... | Remove an extension
@param string $class
@param boolean $force
@return int
@throws Exception | [
"Remove",
"an",
"extension"
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/controllers/ExtensionController.php#L153-L162 |
33,801 | brainworxx/kreXX | src/Analyse/Comment/Functions.php | Functions.getComment | public function getComment(\Reflector $reflectionFunction, \ReflectionClass $reflectionClass = null)
{
// Do some static caching. The comment will not change during a run.
static $cache = array();
/** @var \ReflectionFunction $reflectionFunction */
$cachingKey = $reflectionFunction->... | php | public function getComment(\Reflector $reflectionFunction, \ReflectionClass $reflectionClass = null)
{
// Do some static caching. The comment will not change during a run.
static $cache = array();
/** @var \ReflectionFunction $reflectionFunction */
$cachingKey = $reflectionFunction->... | [
"public",
"function",
"getComment",
"(",
"\\",
"Reflector",
"$",
"reflectionFunction",
",",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
"=",
"null",
")",
"{",
"// Do some static caching. The comment will not change during a run.",
"static",
"$",
"cache",
"=",
"array"... | Get the prettified comment from a function.
@param \Reflector $reflectionFunction
The reflection of the function with the comment.
@param \ReflectionClass|null $reflectionClass
Nothing, null. We do not have a hosting class.
@return string
The prettified comment. | [
"Get",
"the",
"prettified",
"comment",
"from",
"a",
"function",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Comment/Functions.php#L55-L71 |
33,802 | honey-comb/core | src/Http/Controllers/HCLanguageController.php | HCLanguageController.index | public function index(): JsonResponse
{
$config = $this->makeView('language-view', trans('HCCore::languages.title.list'))
->addFormSource('add-new', 'language')
->addDataTable($this->getDataTable())
->setPermissions(['search'])
->toArray();
return $th... | php | public function index(): JsonResponse
{
$config = $this->makeView('language-view', trans('HCCore::languages.title.list'))
->addFormSource('add-new', 'language')
->addDataTable($this->getDataTable())
->setPermissions(['search'])
->toArray();
return $th... | [
"public",
"function",
"index",
"(",
")",
":",
"JsonResponse",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"makeView",
"(",
"'language-view'",
",",
"trans",
"(",
"'HCCore::languages.title.list'",
")",
")",
"->",
"addFormSource",
"(",
"'add-new'",
",",
"'languag... | Admin panel page config
@return JsonResponse | [
"Admin",
"panel",
"page",
"config"
] | 5c12aba31cae092e9681f0ae3e3664ed3fcec956 | https://github.com/honey-comb/core/blob/5c12aba31cae092e9681f0ae3e3664ed3fcec956/src/Http/Controllers/HCLanguageController.php#L84-L93 |
33,803 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/Getter.php | Getter.callMe | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
// Get all public methods.
$methodList = $ref->getMethods(\ReflectionMethod::IS_PUBLIC);
... | php | public function callMe()
{
$output = $this->dispatchStartEvent();
/** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
$ref = $this->parameters[static::PARAM_REF];
// Get all public methods.
$methodList = $ref->getMethods(\ReflectionMethod::IS_PUBLIC);
... | [
"public",
"function",
"callMe",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"dispatchStartEvent",
"(",
")",
";",
"/** @var \\Brainworxx\\Krexx\\Service\\Reflection\\ReflectionClass $ref */",
"$",
"ref",
"=",
"$",
"this",
"->",
"parameters",
"[",
"static",
... | Dump the possible result of all getter methods
@return string
The generated markup. | [
"Dump",
"the",
"possible",
"result",
"of",
"all",
"getter",
"methods"
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Getter.php#L85-L136 |
33,804 | brainworxx/kreXX | src/Analyse/Callback/Analyse/Objects/Getter.php | Getter.populateGetterLists | protected function populateGetterLists(array $methodList, $isInScope, ReflectionClass $ref)
{
/** @var \ReflectionMethod $method */
foreach ($methodList as $method) {
// Check, if the method is really available, inside the analysis
// context. A inherited private method can n... | php | protected function populateGetterLists(array $methodList, $isInScope, ReflectionClass $ref)
{
/** @var \ReflectionMethod $method */
foreach ($methodList as $method) {
// Check, if the method is really available, inside the analysis
// context. A inherited private method can n... | [
"protected",
"function",
"populateGetterLists",
"(",
"array",
"$",
"methodList",
",",
"$",
"isInScope",
",",
"ReflectionClass",
"$",
"ref",
")",
"{",
"/** @var \\ReflectionMethod $method */",
"foreach",
"(",
"$",
"methodList",
"as",
"$",
"method",
")",
"{",
"// Ch... | Filter and then populate the method list. We only dump those that have no
parameters and start with has, is or get.
@param array $methodList
@param $isInScope
@param \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref | [
"Filter",
"and",
"then",
"populate",
"the",
"method",
"list",
".",
"We",
"only",
"dump",
"those",
"that",
"have",
"no",
"parameters",
"and",
"start",
"with",
"has",
"is",
"or",
"get",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Analyse/Callback/Analyse/Objects/Getter.php#L146-L183 |
33,805 | silverorange/swat | Swat/SwatTableViewGroup.php | SwatTableViewGroup.displayFooter | public function displayFooter($row, $next_row)
{
if ($this->group_by === null) {
throw new SwatException("Attribute 'group_by' must be set.");
}
$group_by = $this->group_by;
if (
$next_row === null ||
!$this->isEqual($row->$group_by, $next_row->$... | php | public function displayFooter($row, $next_row)
{
if ($this->group_by === null) {
throw new SwatException("Attribute 'group_by' must be set.");
}
$group_by = $this->group_by;
if (
$next_row === null ||
!$this->isEqual($row->$group_by, $next_row->$... | [
"public",
"function",
"displayFooter",
"(",
"$",
"row",
",",
"$",
"next_row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"group_by",
"===",
"null",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"\"Attribute 'group_by' must be set.\"",
")",
";",
"}",
"$",
"g... | Displays the grouping footer of this table-view group
The grouping footer is displayed when the group_by field is different
between the given rows.
@param mixed $row a data object containing the data for the first row in
in the table store for this group.
@param mixed $row a data object containing the data for the cu... | [
"Displays",
"the",
"grouping",
"footer",
"of",
"this",
"table",
"-",
"view",
"group"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewGroup.php#L71-L85 |
33,806 | silverorange/swat | Swat/SwatTableViewGroup.php | SwatTableViewGroup.displayGroupHeader | protected function displayGroupHeader($row)
{
$tr_tag = new SwatHtmlTag('tr');
$tr_tag->class = 'swat-table-view-group';
$tr_tag->open();
$td_tag = new SwatHtmlTag('td', $this->getTdAttributes());
$td_tag->colspan = $this->view->getXhtmlColspan();
$td_tag->open();
... | php | protected function displayGroupHeader($row)
{
$tr_tag = new SwatHtmlTag('tr');
$tr_tag->class = 'swat-table-view-group';
$tr_tag->open();
$td_tag = new SwatHtmlTag('td', $this->getTdAttributes());
$td_tag->colspan = $this->view->getXhtmlColspan();
$td_tag->open();
... | [
"protected",
"function",
"displayGroupHeader",
"(",
"$",
"row",
")",
"{",
"$",
"tr_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'tr'",
")",
";",
"$",
"tr_tag",
"->",
"class",
"=",
"'swat-table-view-group'",
";",
"$",
"tr_tag",
"->",
"open",
"(",
")",
";",
"$",... | Displays the group header for this grouping column
The grouping header is displayed at the beginning of a group.
@param mixed $row a data object containing the data for the first row in
in the table store for this group. | [
"Displays",
"the",
"group",
"header",
"for",
"this",
"grouping",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewGroup.php#L98-L111 |
33,807 | silverorange/swat | Swat/SwatTableViewGroup.php | SwatTableViewGroup.isEqual | protected function isEqual($group_value, $row_value)
{
if (
$group_value instanceof SwatDate &&
$row_value instanceof SwatDate
) {
return SwatDate::compare($group_value, $row_value) === 0;
}
return $group_value === $row_value;
} | php | protected function isEqual($group_value, $row_value)
{
if (
$group_value instanceof SwatDate &&
$row_value instanceof SwatDate
) {
return SwatDate::compare($group_value, $row_value) === 0;
}
return $group_value === $row_value;
} | [
"protected",
"function",
"isEqual",
"(",
"$",
"group_value",
",",
"$",
"row_value",
")",
"{",
"if",
"(",
"$",
"group_value",
"instanceof",
"SwatDate",
"&&",
"$",
"row_value",
"instanceof",
"SwatDate",
")",
"{",
"return",
"SwatDate",
"::",
"compare",
"(",
"$"... | Compares the value of the current row to the value of the current
group to see if the value has changed
@param mixed $group_value the current group value.
@param mixed $row_value the current row value.
@return boolean true if the row value is different from the current
group value. Otherwise, false. | [
"Compares",
"the",
"value",
"of",
"the",
"current",
"row",
"to",
"the",
"value",
"of",
"the",
"current",
"group",
"to",
"see",
"if",
"the",
"value",
"has",
"changed"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewGroup.php#L175-L185 |
33,808 | silverorange/swat | Swat/SwatTableViewGroup.php | SwatTableViewGroup.resetSubGroups | protected function resetSubGroups()
{
$reset = false;
foreach ($this->parent->getGroups() as $group) {
if ($reset) {
$group->reset();
}
if ($group === $this) {
$reset = true;
}
}
} | php | protected function resetSubGroups()
{
$reset = false;
foreach ($this->parent->getGroups() as $group) {
if ($reset) {
$group->reset();
}
if ($group === $this) {
$reset = true;
}
}
} | [
"protected",
"function",
"resetSubGroups",
"(",
")",
"{",
"$",
"reset",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"parent",
"->",
"getGroups",
"(",
")",
"as",
"$",
"group",
")",
"{",
"if",
"(",
"$",
"reset",
")",
"{",
"$",
"group",
"->"... | Resets grouping columns below this one
This is used when outside headers change before inside headers. In this
case, the inside headers are reset so they display again in the new
outside header. | [
"Resets",
"grouping",
"columns",
"below",
"this",
"one"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewGroup.php#L197-L209 |
33,809 | silverorange/swat | Swat/SwatCheckboxTree.php | SwatCheckboxTree.displayNode | private function displayNode(
SwatDataTreeNode $node,
$nodes = 0,
$parent_index = ''
) {
// build a unique id of the indexes of the tree
if ($parent_index === '' || $parent_index === null) {
// index of the first node is just the node index
$index = $n... | php | private function displayNode(
SwatDataTreeNode $node,
$nodes = 0,
$parent_index = ''
) {
// build a unique id of the indexes of the tree
if ($parent_index === '' || $parent_index === null) {
// index of the first node is just the node index
$index = $n... | [
"private",
"function",
"displayNode",
"(",
"SwatDataTreeNode",
"$",
"node",
",",
"$",
"nodes",
"=",
"0",
",",
"$",
"parent_index",
"=",
"''",
")",
"{",
"// build a unique id of the indexes of the tree",
"if",
"(",
"$",
"parent_index",
"===",
"''",
"||",
"$",
"... | Displays a node in a tree as a checkbox input
@param SwatDataTreeNode $node the node to display.
@param integer $nodes the current number of nodes.
@param string $parent_index the path of the parent node.
@return integer the number of checkable nodes in the tree. | [
"Displays",
"a",
"node",
"in",
"a",
"tree",
"as",
"a",
"checkbox",
"input"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatCheckboxTree.php#L155-L217 |
33,810 | silverorange/swat | Swat/SwatString.php | SwatString.minimizeEntities | public static function minimizeEntities($text)
{
// decode any entities that might already exist
$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
// encode all ampersands (&), less than (<), greater than (>),
// and double quote (") characters as their XML entities
$t... | php | public static function minimizeEntities($text)
{
// decode any entities that might already exist
$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
// encode all ampersands (&), less than (<), greater than (>),
// and double quote (") characters as their XML entities
$t... | [
"public",
"static",
"function",
"minimizeEntities",
"(",
"$",
"text",
")",
"{",
"// decode any entities that might already exist",
"$",
"text",
"=",
"html_entity_decode",
"(",
"$",
"text",
",",
"ENT_COMPAT",
",",
"'UTF-8'",
")",
";",
"// encode all ampersands (&), less ... | Converts a UTF-8 text string to have the minimal number of entities
necessary to output it as valid UTF-8 XHTML without ever double-escaping.
The text is converted as follows:
- any exisiting entities are decoded to their UTF-8 characaters
- the minimal number of characters necessary are then escaped as entities:
- a... | [
"Converts",
"a",
"UTF",
"-",
"8",
"text",
"string",
"to",
"have",
"the",
"minimal",
"number",
"of",
"entities",
"necessary",
"to",
"output",
"it",
"as",
"valid",
"UTF",
"-",
"8",
"XHTML",
"without",
"ever",
"double",
"-",
"escaping",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L408-L418 |
33,811 | silverorange/swat | Swat/SwatString.php | SwatString.condenseToName | public static function condenseToName($string, $max_length = 15)
{
if (!is_string($string)) {
$string = strval($string);
}
if ($string == '') {
return $string;
}
// remove tags and make lowercase
$string = strip_tags(mb_strtolower($string));
... | php | public static function condenseToName($string, $max_length = 15)
{
if (!is_string($string)) {
$string = strval($string);
}
if ($string == '') {
return $string;
}
// remove tags and make lowercase
$string = strip_tags(mb_strtolower($string));
... | [
"public",
"static",
"function",
"condenseToName",
"(",
"$",
"string",
",",
"$",
"max_length",
"=",
"15",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"$",
"string",
"=",
"strval",
"(",
"$",
"string",
")",
";",
"}",
"if"... | Condenses a string to a name
The generated name can be used for things like database identifiers and
site URI fragments.
Example:
<code>
$string = 'The quick brown fox jumped over the lazy dogs.';
// displays 'thequickbrown'
echo SwatString::condenseToName($string);
</code>
@param string $string the string to conden... | [
"Condenses",
"a",
"string",
"to",
"a",
"name"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L595-L685 |
33,812 | silverorange/swat | Swat/SwatString.php | SwatString.removePunctuation | public static function removePunctuation($string)
{
$string = self::removeTrailingPunctuation($string);
$string = self::removeLeadingPunctuation($string);
return $string;
} | php | public static function removePunctuation($string)
{
$string = self::removeTrailingPunctuation($string);
$string = self::removeLeadingPunctuation($string);
return $string;
} | [
"public",
"static",
"function",
"removePunctuation",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"self",
"::",
"removeTrailingPunctuation",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"self",
"::",
"removeLeadingPunctuation",
"(",
"$",
"string",
... | Removes both leading and trailing punctuation from a string
@param string $string the string to format remove punctuation from.
@return string the string with leading and trailing punctuation removed. | [
"Removes",
"both",
"leading",
"and",
"trailing",
"punctuation",
"from",
"a",
"string"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L936-L941 |
33,813 | silverorange/swat | Swat/SwatString.php | SwatString.moneyFormat | public static function moneyFormat(
$value,
$locale = null,
$display_currency = false,
$decimal_places = null
) {
if (!function_exists('money_format')) {
throw new SwatException(
'moneyFormat() method is not available ' .
'on th... | php | public static function moneyFormat(
$value,
$locale = null,
$display_currency = false,
$decimal_places = null
) {
if (!function_exists('money_format')) {
throw new SwatException(
'moneyFormat() method is not available ' .
'on th... | [
"public",
"static",
"function",
"moneyFormat",
"(",
"$",
"value",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"display_currency",
"=",
"false",
",",
"$",
"decimal_places",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'money_format'",
")",... | Formats a numeric value as currency
Note: This method does not work in some operating systems and in such
cases, this method will throw an exception.
Note: This method is deprecated. Use {@link SwatI18NLocale::formatCurrency()}
instead. The newer method is more flexible and works across more
platforms.
@param float ... | [
"Formats",
"a",
"numeric",
"value",
"as",
"currency"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L979-L1041 |
33,814 | silverorange/swat | Swat/SwatString.php | SwatString.getInternationalCurrencySymbol | public static function getInternationalCurrencySymbol($locale = null)
{
if ($locale !== null) {
$old_locale = setlocale(LC_MONETARY, 0);
if (setlocale(LC_MONETARY, $locale) === false) {
throw new SwatException(
sprintf(
'Loc... | php | public static function getInternationalCurrencySymbol($locale = null)
{
if ($locale !== null) {
$old_locale = setlocale(LC_MONETARY, 0);
if (setlocale(LC_MONETARY, $locale) === false) {
throw new SwatException(
sprintf(
'Loc... | [
"public",
"static",
"function",
"getInternationalCurrencySymbol",
"(",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"locale",
"!==",
"null",
")",
"{",
"$",
"old_locale",
"=",
"setlocale",
"(",
"LC_MONETARY",
",",
"0",
")",
";",
"if",
"(",
"setlo... | Gets the international currency symbol of a locale
@param string $locale optional. Locale to get the international currency
symbol for. If no locale is specified, the
current locale is used.
@return string the international currency symbol for the specified
locale. The symbol is UTF-8 encoded and does not include
the... | [
"Gets",
"the",
"international",
"currency",
"symbol",
"of",
"a",
"locale"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1059-L1102 |
33,815 | silverorange/swat | Swat/SwatString.php | SwatString.numberFormat | public static function numberFormat(
$value,
$decimals = null,
$locale = null,
$show_thousands_separator = true
) {
// look up decimal precision if none is provided
if ($decimals === null) {
$decimals = self::getDecimalPrecision($value);
}
... | php | public static function numberFormat(
$value,
$decimals = null,
$locale = null,
$show_thousands_separator = true
) {
// look up decimal precision if none is provided
if ($decimals === null) {
$decimals = self::getDecimalPrecision($value);
}
... | [
"public",
"static",
"function",
"numberFormat",
"(",
"$",
"value",
",",
"$",
"decimals",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"show_thousands_separator",
"=",
"true",
")",
"{",
"// look up decimal precision if none is provided",
"if",
"(",
"$"... | Formats a number using locale-based separators
@param float $value the numeric value to format.
@param integer $decimals number of decimal places to display. By
default, the full number of decimal places of
the value will be displayed.
@param string $locale an optional locale to use to format the value. If
no locale i... | [
"Formats",
"a",
"number",
"using",
"locale",
"-",
"based",
"separators"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1126-L1186 |
33,816 | silverorange/swat | Swat/SwatString.php | SwatString.byteFormat | public static function byteFormat(
$value,
$magnitude = -1,
$iec_units = false,
$significant_digits = 3
) {
if ($iec_units) {
$units = array(
60 => 'EiB',
50 => 'PiB',
40 => 'TiB',
30 => 'GiB',
... | php | public static function byteFormat(
$value,
$magnitude = -1,
$iec_units = false,
$significant_digits = 3
) {
if ($iec_units) {
$units = array(
60 => 'EiB',
50 => 'PiB',
40 => 'TiB',
30 => 'GiB',
... | [
"public",
"static",
"function",
"byteFormat",
"(",
"$",
"value",
",",
"$",
"magnitude",
"=",
"-",
"1",
",",
"$",
"iec_units",
"=",
"false",
",",
"$",
"significant_digits",
"=",
"3",
")",
"{",
"if",
"(",
"$",
"iec_units",
")",
"{",
"$",
"units",
"=",
... | Format bytes in human readible units
By default, bytes are formatted using canonical, ambiguous, base-10
prefixed units. Bytes may optionally be formatted using unambiguous IEC
standard binary prefixes. See the National Institute of Standards and
Technology's page on binary unit prefixes at
{@link http://physics.nist.... | [
"Format",
"bytes",
"in",
"human",
"readible",
"units"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1240-L1319 |
33,817 | silverorange/swat | Swat/SwatString.php | SwatString.pad | public static function pad(
$input,
$pad_length,
$pad_string = ' ',
$pad_type = STR_PAD_RIGHT
) {
$output = '';
$length = $pad_length - mb_strlen($input);
if ($pad_string === null || mb_strlen($pad_string) === 0) {
$pad_string = ' ';
}
... | php | public static function pad(
$input,
$pad_length,
$pad_string = ' ',
$pad_type = STR_PAD_RIGHT
) {
$output = '';
$length = $pad_length - mb_strlen($input);
if ($pad_string === null || mb_strlen($pad_string) === 0) {
$pad_string = ' ';
}
... | [
"public",
"static",
"function",
"pad",
"(",
"$",
"input",
",",
"$",
"pad_length",
",",
"$",
"pad_string",
"=",
"' '",
",",
"$",
"pad_type",
"=",
"STR_PAD_RIGHT",
")",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"length",
"=",
"$",
"pad_length",
"-",
"mb... | Pads a string in a UTF-8 safe way.
@param string $input the string to pad.
@param int $pad_length length in characters to pad to.
@param string $pad_string string to use for padding.
@param int $pad_type type of padding to use: <code>STR_PAD_LEFT</code>,
<code>STR_PAD_RIGHT</code>, or
<code>STR_PAD_BOTH</code>.
@retu... | [
"Pads",
"a",
"string",
"in",
"a",
"UTF",
"-",
"8",
"safe",
"way",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1336-L1385 |
33,818 | silverorange/swat | Swat/SwatString.php | SwatString.toInteger | public static function toInteger($string)
{
$lc = localeconv();
$string = self::parseNegativeNotation($string);
// change all locale formatting to numeric formatting
$remove_parts = array(
$lc['positive_sign'] => '',
$lc['thousands_sep'] => ''
);
... | php | public static function toInteger($string)
{
$lc = localeconv();
$string = self::parseNegativeNotation($string);
// change all locale formatting to numeric formatting
$remove_parts = array(
$lc['positive_sign'] => '',
$lc['thousands_sep'] => ''
);
... | [
"public",
"static",
"function",
"toInteger",
"(",
"$",
"string",
")",
"{",
"$",
"lc",
"=",
"localeconv",
"(",
")",
";",
"$",
"string",
"=",
"self",
"::",
"parseNegativeNotation",
"(",
"$",
"string",
")",
";",
"// change all locale formatting to numeric formattin... | Convert a locale-formatted number and return it as an integer.
If the string can not be converted to an integer, the method returns
null. If the number has values after the decimal point, the value is
rounded according to the rounding rules for PHP's
{@link http://php.net/manual/en/function.intval.php intval} function... | [
"Convert",
"a",
"locale",
"-",
"formatted",
"number",
"and",
"return",
"it",
"as",
"an",
"integer",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1409-L1451 |
33,819 | silverorange/swat | Swat/SwatString.php | SwatString.toFloat | public static function toFloat($string)
{
$lc = localeconv();
$string = self::parseNegativeNotation($string);
// change all locale formatting to numeric formatting
$remove_parts = array(
$lc['decimal_point'] => '.',
$lc['positive_sign'] => '',
$l... | php | public static function toFloat($string)
{
$lc = localeconv();
$string = self::parseNegativeNotation($string);
// change all locale formatting to numeric formatting
$remove_parts = array(
$lc['decimal_point'] => '.',
$lc['positive_sign'] => '',
$l... | [
"public",
"static",
"function",
"toFloat",
"(",
"$",
"string",
")",
"{",
"$",
"lc",
"=",
"localeconv",
"(",
")",
";",
"$",
"string",
"=",
"self",
"::",
"parseNegativeNotation",
"(",
"$",
"string",
")",
";",
"// change all locale formatting to numeric formatting"... | Convert a locale-formatted number and return it as an float.
If the string is not an float, the method returns null.
@param string $string the string to convert.
@return float The converted value. | [
"Convert",
"a",
"locale",
"-",
"formatted",
"number",
"and",
"return",
"it",
"as",
"an",
"float",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1465-L1490 |
33,820 | silverorange/swat | Swat/SwatString.php | SwatString.toList | public static function toList(
$iterator,
$conjunction = 'and',
$delimiter = ', ',
$display_final_delimiter = true
) {
if (is_array($iterator)) {
$iterator = new ArrayIterator($iterator);
}
if (!($iterator instanceof Iterator)) {
throw... | php | public static function toList(
$iterator,
$conjunction = 'and',
$delimiter = ', ',
$display_final_delimiter = true
) {
if (is_array($iterator)) {
$iterator = new ArrayIterator($iterator);
}
if (!($iterator instanceof Iterator)) {
throw... | [
"public",
"static",
"function",
"toList",
"(",
"$",
"iterator",
",",
"$",
"conjunction",
"=",
"'and'",
",",
"$",
"delimiter",
"=",
"', '",
",",
"$",
"display_final_delimiter",
"=",
"true",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"iterator",
")",
")",
... | Convert an iterable object or array into a human-readable, delimited
list.
@param array|Iterator $iterator the object to convert to a list.
@param string $conjunction the list's conjunction. Usually 'and' or
'or'.
@param string $delimiter the list delimiter. If list items should
additionally be padded with a space, th... | [
"Convert",
"an",
"iterable",
"object",
"or",
"array",
"into",
"a",
"human",
"-",
"readable",
"delimited",
"list",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1516-L1559 |
33,821 | silverorange/swat | Swat/SwatString.php | SwatString.getTimePeriodParts | public static function getTimePeriodParts($seconds, $interval_parts = null)
{
$interval = SwatDate::getIntervalFromSeconds($seconds);
if ($interval_parts === null) {
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_MONTHS |
SwatDate::DI... | php | public static function getTimePeriodParts($seconds, $interval_parts = null)
{
$interval = SwatDate::getIntervalFromSeconds($seconds);
if ($interval_parts === null) {
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_MONTHS |
SwatDate::DI... | [
"public",
"static",
"function",
"getTimePeriodParts",
"(",
"$",
"seconds",
",",
"$",
"interval_parts",
"=",
"null",
")",
"{",
"$",
"interval",
"=",
"SwatDate",
"::",
"getIntervalFromSeconds",
"(",
"$",
"seconds",
")",
";",
"if",
"(",
"$",
"interval_parts",
"... | Gets the parts representing a time period matching a desired interval
format.
This method splits an interval in seconds into component parts. Given an
example value of 161740805, the following key=>value array is returned.
<code>
<?php
array(
'years' => 5,
'months' => 3,
'days' => 2,
'seconds' => 5,
);
?>
</code... | [
"Gets",
"the",
"parts",
"representing",
"a",
"time",
"period",
"matching",
"a",
"desired",
"interval",
"format",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1590-L1679 |
33,822 | silverorange/swat | Swat/SwatString.php | SwatString.getHumanReadableTimePeriodParts | public static function getHumanReadableTimePeriodParts(
$seconds,
$interval_parts = null
) {
// Depend on getTimePeriodParts() to return the correct parts requested
$parts = static::getTimePeriodParts($seconds, $interval_parts);
// Add human readable formatting to each retur... | php | public static function getHumanReadableTimePeriodParts(
$seconds,
$interval_parts = null
) {
// Depend on getTimePeriodParts() to return the correct parts requested
$parts = static::getTimePeriodParts($seconds, $interval_parts);
// Add human readable formatting to each retur... | [
"public",
"static",
"function",
"getHumanReadableTimePeriodParts",
"(",
"$",
"seconds",
",",
"$",
"interval_parts",
"=",
"null",
")",
"{",
"// Depend on getTimePeriodParts() to return the correct parts requested",
"$",
"parts",
"=",
"static",
"::",
"getTimePeriodParts",
"("... | Gets the parts to construct a human-readable string representing a time
period.
This method formats seconds as a time period. Given an example value
of 161740805, the following key=>value array is returned.
<code>
<?php
array(
'years' => '5 years',
'months' => '3 months',
'days' => '2 days',
'seconds' => '5 seco... | [
"Gets",
"the",
"parts",
"to",
"construct",
"a",
"human",
"-",
"readable",
"string",
"representing",
"a",
"time",
"period",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1710-L1775 |
33,823 | silverorange/swat | Swat/SwatString.php | SwatString.toHumanReadableTimePeriod | public static function toHumanReadableTimePeriod(
$seconds,
$largest_part = false
) {
$parts = self::getHumanReadableTimePeriodParts($seconds);
return self::toHumanReadableTimePeriodString($parts, $largest_part);
} | php | public static function toHumanReadableTimePeriod(
$seconds,
$largest_part = false
) {
$parts = self::getHumanReadableTimePeriodParts($seconds);
return self::toHumanReadableTimePeriodString($parts, $largest_part);
} | [
"public",
"static",
"function",
"toHumanReadableTimePeriod",
"(",
"$",
"seconds",
",",
"$",
"largest_part",
"=",
"false",
")",
"{",
"$",
"parts",
"=",
"self",
"::",
"getHumanReadableTimePeriodParts",
"(",
"$",
"seconds",
")",
";",
"return",
"self",
"::",
"toHu... | Gets a human-readable string representing a time period
This method formats seconds as a time period. Given an example value
of 161740805, the formatted value "5 years, 3 months, 2 days and 5
seconds" is returned.
As this method applies on seconds, no time zone considerations are
made. Years are assumed to be 365 day... | [
"Gets",
"a",
"human",
"-",
"readable",
"string",
"representing",
"a",
"time",
"period"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1797-L1803 |
33,824 | silverorange/swat | Swat/SwatString.php | SwatString.toHumanReadableTimePeriodWithWeeks | public static function toHumanReadableTimePeriodWithWeeks(
$seconds,
$largest_part = false
) {
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_WEEKS |
SwatDate::DI_DAYS |
SwatDate::DI_HOURS |
SwatDate::DI_MINUTES |
S... | php | public static function toHumanReadableTimePeriodWithWeeks(
$seconds,
$largest_part = false
) {
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_WEEKS |
SwatDate::DI_DAYS |
SwatDate::DI_HOURS |
SwatDate::DI_MINUTES |
S... | [
"public",
"static",
"function",
"toHumanReadableTimePeriodWithWeeks",
"(",
"$",
"seconds",
",",
"$",
"largest_part",
"=",
"false",
")",
"{",
"$",
"interval_parts",
"=",
"SwatDate",
"::",
"DI_YEARS",
"|",
"SwatDate",
"::",
"DI_WEEKS",
"|",
"SwatDate",
"::",
"DI_D... | Gets a human-readable string representing a time period that includes
weeks.
This method formats seconds as a time period. Given an example value
of 161740805, the formatted value "5 years, 12 weeks, 2 days and 5
seconds" is returned. Months are not returned as combining months and
weeks in the same string can be conf... | [
"Gets",
"a",
"human",
"-",
"readable",
"string",
"representing",
"a",
"time",
"period",
"that",
"includes",
"weeks",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1827-L1845 |
33,825 | silverorange/swat | Swat/SwatString.php | SwatString.toHumanReadableTimePeriodWithWeeksAndDays | public static function toHumanReadableTimePeriodWithWeeksAndDays($seconds)
{
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_WEEKS |
SwatDate::DI_DAYS |
SwatDate::DI_HOURS |
SwatDate::DI_MINUTES |
SwatDate::DI_SECONDS;
$par... | php | public static function toHumanReadableTimePeriodWithWeeksAndDays($seconds)
{
$interval_parts =
SwatDate::DI_YEARS |
SwatDate::DI_WEEKS |
SwatDate::DI_DAYS |
SwatDate::DI_HOURS |
SwatDate::DI_MINUTES |
SwatDate::DI_SECONDS;
$par... | [
"public",
"static",
"function",
"toHumanReadableTimePeriodWithWeeksAndDays",
"(",
"$",
"seconds",
")",
"{",
"$",
"interval_parts",
"=",
"SwatDate",
"::",
"DI_YEARS",
"|",
"SwatDate",
"::",
"DI_WEEKS",
"|",
"SwatDate",
"::",
"DI_DAYS",
"|",
"SwatDate",
"::",
"DI_HO... | Gets a human-readable string representing a time period that includes
weeks and days as one time period part, and always returns the largest
part only.
This method formats seconds as a time period. Given an example value
of 7435400, the formatted value "12 weeks, 2 days" is returned.
As this method applies on seconds... | [
"Gets",
"a",
"human",
"-",
"readable",
"string",
"representing",
"a",
"time",
"period",
"that",
"includes",
"weeks",
"and",
"days",
"as",
"one",
"time",
"period",
"part",
"and",
"always",
"returns",
"the",
"largest",
"part",
"only",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1865-L1891 |
33,826 | silverorange/swat | Swat/SwatString.php | SwatString.hash | public static function hash($string)
{
$hash = md5($string, true);
$hash = base64_encode($hash);
// remove padding characters
$hash = str_replace('=', '', $hash);
// use modified Base64 for URL varient
$hash = str_replace('+', '*', $hash);
$hash = str_replac... | php | public static function hash($string)
{
$hash = md5($string, true);
$hash = base64_encode($hash);
// remove padding characters
$hash = str_replace('=', '', $hash);
// use modified Base64 for URL varient
$hash = str_replace('+', '*', $hash);
$hash = str_replac... | [
"public",
"static",
"function",
"hash",
"(",
"$",
"string",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"$",
"string",
",",
"true",
")",
";",
"$",
"hash",
"=",
"base64_encode",
"(",
"$",
"hash",
")",
";",
"// remove padding characters",
"$",
"hash",
"=",
... | Gets a unique hash of a string
The hashing is as unique as md5 but the hash string is shorter than md5.
This method is useful if hash strings will be visible to end-users and
shorter hash strings are desired.
@param string $string the string to get the unique hash for.
@return string the unique hash of the given str... | [
"Gets",
"a",
"unique",
"hash",
"of",
"a",
"string"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1908-L1921 |
33,827 | silverorange/swat | Swat/SwatString.php | SwatString.getSalt | public static function getSalt($length)
{
$salt = '';
for ($i = 0; $i < $length; $i++) {
$salt .= chr(mt_rand(1, 127));
}
return $salt;
} | php | public static function getSalt($length)
{
$salt = '';
for ($i = 0; $i < $length; $i++) {
$salt .= chr(mt_rand(1, 127));
}
return $salt;
} | [
"public",
"static",
"function",
"getSalt",
"(",
"$",
"length",
")",
"{",
"$",
"salt",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"length",
";",
"$",
"i",
"++",
")",
"{",
"$",
"salt",
".=",
"chr",
"(",
"mt_rand",
... | Gets a salt value of the specified length
Useful for securing passwords or other one-way encrypted fields that
may be succeptable to a dictionary attack.
This method generates a random ASCII string of the specified length. All
ASCII characters except the null character (0x00) may be included in
the returned string.
... | [
"Gets",
"a",
"salt",
"value",
"of",
"the",
"specified",
"length"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L1940-L1948 |
33,828 | silverorange/swat | Swat/SwatString.php | SwatString.signedSerialize | public static function signedSerialize($data, $salt)
{
$serialized_data = serialize($data);
$signature_data = self::hash($serialized_data . (string) $salt);
return $signature_data . '|' . $serialized_data;
} | php | public static function signedSerialize($data, $salt)
{
$serialized_data = serialize($data);
$signature_data = self::hash($serialized_data . (string) $salt);
return $signature_data . '|' . $serialized_data;
} | [
"public",
"static",
"function",
"signedSerialize",
"(",
"$",
"data",
",",
"$",
"salt",
")",
"{",
"$",
"serialized_data",
"=",
"serialize",
"(",
"$",
"data",
")",
";",
"$",
"signature_data",
"=",
"self",
"::",
"hash",
"(",
"$",
"serialized_data",
".",
"("... | Serializes and signs a value using a salt
By signing serialized data, it is possible to detect tampering of
serialized data. This is useful if serialized data is accepted from
user editable <code>$_GET</code>, <code>$_POST</code> or
<code>$_COOKIE data</code>.
@param mixed $data the data to serialize.
@param string $... | [
"Serializes",
"and",
"signs",
"a",
"value",
"using",
"a",
"salt"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2052-L2058 |
33,829 | silverorange/swat | Swat/SwatString.php | SwatString.signedUnserialize | public static function signedUnserialize($data, $salt)
{
$data_exp = explode('|', (string) $data, 2);
if (count($data_exp) != 2) {
throw new SwatInvalidSerializedDataException(
"Invalid signed serialized data '{$data}'.",
0,
$data
... | php | public static function signedUnserialize($data, $salt)
{
$data_exp = explode('|', (string) $data, 2);
if (count($data_exp) != 2) {
throw new SwatInvalidSerializedDataException(
"Invalid signed serialized data '{$data}'.",
0,
$data
... | [
"public",
"static",
"function",
"signedUnserialize",
"(",
"$",
"data",
",",
"$",
"salt",
")",
"{",
"$",
"data_exp",
"=",
"explode",
"(",
"'|'",
",",
"(",
"string",
")",
"$",
"data",
",",
"2",
")",
";",
"if",
"(",
"count",
"(",
"$",
"data_exp",
")",... | Unserializes a signed serialized value
@param string $data the signed serialized data.
@param string $salt the signature salt. This must be the same salt value
used to serialize the value.
@return mixed the unserialized value.
@throws SwatInvalidSerializedDataException if the signed serialized data
has been tampered... | [
"Unserializes",
"a",
"signed",
"serialized",
"value"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2077-L2101 |
33,830 | silverorange/swat | Swat/SwatString.php | SwatString.quoteJavaScriptString | public static function quoteJavaScriptString($string)
{
$search = array(
'\\', // backslash quote
'&', // ampersand
'<', // less than
'>', // greater than
'=', // equal
'"', // double quote
"'", // single quote
"... | php | public static function quoteJavaScriptString($string)
{
$search = array(
'\\', // backslash quote
'&', // ampersand
'<', // less than
'>', // greater than
'=', // equal
'"', // double quote
"'", // single quote
"... | [
"public",
"static",
"function",
"quoteJavaScriptString",
"(",
"$",
"string",
")",
"{",
"$",
"search",
"=",
"array",
"(",
"'\\\\'",
",",
"// backslash quote",
"'&'",
",",
"// ampersand",
"'<'",
",",
"// less than",
"'>'",
",",
"// greater than",
"'='",
",",
"//... | Safely quotes a PHP string into a JavaScript string
Strings are always quoted using single quotes. The characters documented
at {@link http://code.google.com/p/doctype/wiki/ArticleXSSInJavaScript}
are escaped to prevent XSS attacks.
@param string $string the PHP string to quote as a JavaScript string.
@return string... | [
"Safely",
"quotes",
"a",
"PHP",
"string",
"into",
"a",
"JavaScript",
"string"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2119-L2162 |
33,831 | silverorange/swat | Swat/SwatString.php | SwatString.escapeBinary | public static function escapeBinary($string)
{
$escaped = '';
for ($i = 0; $i < mb_strlen($string, '8bit'); $i++) {
$char = mb_substr($string, $i, 1, '8bit');
$ord = ord($char);
if ($ord === 9) {
$escaped .= '\t';
} elseif ($ord === 10... | php | public static function escapeBinary($string)
{
$escaped = '';
for ($i = 0; $i < mb_strlen($string, '8bit'); $i++) {
$char = mb_substr($string, $i, 1, '8bit');
$ord = ord($char);
if ($ord === 9) {
$escaped .= '\t';
} elseif ($ord === 10... | [
"public",
"static",
"function",
"escapeBinary",
"(",
"$",
"string",
")",
"{",
"$",
"escaped",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"mb_strlen",
"(",
"$",
"string",
",",
"'8bit'",
")",
";",
"$",
"i",
"++",
")",
"{"... | Escapes a binary string making it safe to display using ASCII encoding
Newlines, tabs and returns are encoded as \n, \t and \r. Other
bytes are hexadecimal encoded (e.g. \xA6). Escaping the binary string
makes it valid UTF-8 as well as valid ASCII.
@param string $string the string to escape.
@return string the escap... | [
"Escapes",
"a",
"binary",
"string",
"making",
"it",
"safe",
"to",
"display",
"using",
"ASCII",
"encoding"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2226-L2251 |
33,832 | silverorange/swat | Swat/SwatString.php | SwatString.toHumanReadableTimePeriodString | protected static function toHumanReadableTimePeriodString(
array $parts,
$largest_part = false
) {
if ($largest_part && count($parts) > 0) {
$parts = array(reset($parts));
}
return self::toList($parts);
} | php | protected static function toHumanReadableTimePeriodString(
array $parts,
$largest_part = false
) {
if ($largest_part && count($parts) > 0) {
$parts = array(reset($parts));
}
return self::toList($parts);
} | [
"protected",
"static",
"function",
"toHumanReadableTimePeriodString",
"(",
"array",
"$",
"parts",
",",
"$",
"largest_part",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"largest_part",
"&&",
"count",
"(",
"$",
"parts",
")",
">",
"0",
")",
"{",
"$",
"parts",
"... | Gets a human-readable string representing a time period from an array of
human readable date parts.
This method formats seconds as a time period. Given an example value
of 161740805, the formatted value "5 years, 3 months, 2 days and 5
seconds" is returned.
As this method applies on seconds, no time zone consideratio... | [
"Gets",
"a",
"human",
"-",
"readable",
"string",
"representing",
"a",
"time",
"period",
"from",
"an",
"array",
"of",
"human",
"readable",
"date",
"parts",
"."
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2275-L2284 |
33,833 | silverorange/swat | Swat/SwatString.php | SwatString.stripEntities | private static function stripEntities(&$string, &$matches)
{
$reg_exp = '/&#?[a-z0-9]*?;/su';
preg_match_all($reg_exp, $string, $matches, PREG_OFFSET_CAPTURE);
$string = preg_replace($reg_exp, '*', $string);
} | php | private static function stripEntities(&$string, &$matches)
{
$reg_exp = '/&#?[a-z0-9]*?;/su';
preg_match_all($reg_exp, $string, $matches, PREG_OFFSET_CAPTURE);
$string = preg_replace($reg_exp, '*', $string);
} | [
"private",
"static",
"function",
"stripEntities",
"(",
"&",
"$",
"string",
",",
"&",
"$",
"matches",
")",
"{",
"$",
"reg_exp",
"=",
"'/&#?[a-z0-9]*?;/su'",
";",
"preg_match_all",
"(",
"$",
"reg_exp",
",",
"$",
"string",
",",
"$",
"matches",
",",
"PREG_OFFS... | Strips entities from a string remembering their positions
Stripped entities are replaces with a single special character. All
parameters are passed by reference and nothing is returned by this
function.
@param string $string the string to strip entites from.
@param array $matches the array to store matches in. | [
"Strips",
"entities",
"from",
"a",
"string",
"remembering",
"their",
"positions"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2299-L2306 |
33,834 | silverorange/swat | Swat/SwatString.php | SwatString.insertEntities | private static function insertEntities(
&$string,
&$matches,
$hole_start = -1,
$hole_end = -1,
$hole_length = 0
) {
for ($i = 0; $i < count($matches[0]); $i++) {
$entity = $matches[0][$i][0];
$position = $matches[0][$i][1];
// offs... | php | private static function insertEntities(
&$string,
&$matches,
$hole_start = -1,
$hole_end = -1,
$hole_length = 0
) {
for ($i = 0; $i < count($matches[0]); $i++) {
$entity = $matches[0][$i][0];
$position = $matches[0][$i][1];
// offs... | [
"private",
"static",
"function",
"insertEntities",
"(",
"&",
"$",
"string",
",",
"&",
"$",
"matches",
",",
"$",
"hole_start",
"=",
"-",
"1",
",",
"$",
"hole_end",
"=",
"-",
"1",
",",
"$",
"hole_length",
"=",
"0",
")",
"{",
"for",
"(",
"$",
"i",
"... | Re-inserts stripped entities into a string in the correct positions
The first two parameters are passed by reference and nothing is returned
by this function.
@param string $string the string to re-insert entites into.
@param array $matches the array of stored matches.
@param integer $hole_start ignore inserting enti... | [
"Re",
"-",
"inserts",
"stripped",
"entities",
"into",
"a",
"string",
"in",
"the",
"correct",
"positions"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatString.php#L2325-L2368 |
33,835 | silverorange/swat | Swat/SwatTile.php | SwatTile.display | public function display($data)
{
if (!$this->visible) {
return;
}
$this->setupRenderers($data);
$this->displayRenderers($data);
} | php | public function display($data)
{
if (!$this->visible) {
return;
}
$this->setupRenderers($data);
$this->displayRenderers($data);
} | [
"public",
"function",
"display",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"setupRenderers",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"displayRenderers",
"(",
"$... | Displays this tile using a data object
@param mixed $data a data object used to display the cell renderers in
this tile. | [
"Displays",
"this",
"tile",
"using",
"a",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTile.php#L42-L50 |
33,836 | silverorange/swat | Swat/SwatTile.php | SwatTile.getMessages | public function getMessages()
{
$messages = $this->messages;
foreach ($this->renderers as $renderer) {
$messages = array_merge($messages, $renderer->getMessages());
}
return $messages;
} | php | public function getMessages()
{
$messages = $this->messages;
foreach ($this->renderers as $renderer) {
$messages = array_merge($messages, $renderer->getMessages());
}
return $messages;
} | [
"public",
"function",
"getMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"messages",
";",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"messages",
"=",
"array_merge",
"(",
"$",
"messages",
",... | Gathers all messages from this tile
@return array an array of {@link SwatMessage} objects. | [
"Gathers",
"all",
"messages",
"from",
"this",
"tile"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTile.php#L90-L99 |
33,837 | silverorange/swat | Swat/SwatTile.php | SwatTile.hasMessage | public function hasMessage()
{
$has_message = false;
foreach ($this->renderers as $renderer) {
if ($renderer->hasMessage()) {
$has_message = true;
break;
}
}
return $has_message;
} | php | public function hasMessage()
{
$has_message = false;
foreach ($this->renderers as $renderer) {
if ($renderer->hasMessage()) {
$has_message = true;
break;
}
}
return $has_message;
} | [
"public",
"function",
"hasMessage",
"(",
")",
"{",
"$",
"has_message",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"if",
"(",
"$",
"renderer",
"->",
"hasMessage",
"(",
")",
")",
"{",
"$",
"has_m... | Gets whether or not this tile has any messages
@return boolean true if this tile has one or more messages and
false if it does not. | [
"Gets",
"whether",
"or",
"not",
"this",
"tile",
"has",
"any",
"messages"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTile.php#L125-L137 |
33,838 | silverorange/swat | Swat/SwatTile.php | SwatTile.displayRenderers | protected function displayRenderers($data)
{
$div_tag = new SwatHtmlTag('div');
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$this->displayRenderersInternal($data);
$div_tag->close();
} | php | protected function displayRenderers($data)
{
$div_tag = new SwatHtmlTag('div');
$div_tag->class = $this->getCSSClassString();
$div_tag->open();
$this->displayRenderersInternal($data);
$div_tag->close();
} | [
"protected",
"function",
"displayRenderers",
"(",
"$",
"data",
")",
"{",
"$",
"div_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'div'",
")",
";",
"$",
"div_tag",
"->",
"class",
"=",
"$",
"this",
"->",
"getCSSClassString",
"(",
")",
";",
"$",
"div_tag",
"->",
... | Renders cell renderers
@param mixed $data the data object being used to render the cell
renderers of this field. | [
"Renders",
"cell",
"renderers"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTile.php#L174-L181 |
33,839 | brainworxx/kreXX | src/Service/Flow/Emergency.php | Emergency.checkEmergencyBreak | public function checkEmergencyBreak()
{
if ($this->disabled === true) {
// Tell them, everything is OK!
return false;
}
if (static::$allIsOk === false) {
// This has failed before!
// No need to check again!
return true;
}
... | php | public function checkEmergencyBreak()
{
if ($this->disabled === true) {
// Tell them, everything is OK!
return false;
}
if (static::$allIsOk === false) {
// This has failed before!
// No need to check again!
return true;
}
... | [
"public",
"function",
"checkEmergencyBreak",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"disabled",
"===",
"true",
")",
"{",
"// Tell them, everything is OK!",
"return",
"false",
";",
"}",
"if",
"(",
"static",
"::",
"$",
"allIsOk",
"===",
"false",
")",
"... | Checks if there is enough memory and time left on the Server.
@return bool
Boolean to show if we have enough left.
FALSE = all is OK.
TRUE = we have a problem. | [
"Checks",
"if",
"there",
"is",
"enough",
"memory",
"and",
"time",
"left",
"on",
"the",
"Server",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Emergency.php#L174-L188 |
33,840 | brainworxx/kreXX | src/Service/Flow/Emergency.php | Emergency.checkRuntime | protected function checkRuntime()
{
// Check Runtime.
if ($this->timer < time()) {
// This is taking longer than expected.
$this->pool->messages->addMessage('emergencyTimer');
Krexx::editSettings();
Krexx::disable();
static::$allIsOk = fals... | php | protected function checkRuntime()
{
// Check Runtime.
if ($this->timer < time()) {
// This is taking longer than expected.
$this->pool->messages->addMessage('emergencyTimer');
Krexx::editSettings();
Krexx::disable();
static::$allIsOk = fals... | [
"protected",
"function",
"checkRuntime",
"(",
")",
"{",
"// Check Runtime.",
"if",
"(",
"$",
"this",
"->",
"timer",
"<",
"time",
"(",
")",
")",
"{",
"// This is taking longer than expected.",
"$",
"this",
"->",
"pool",
"->",
"messages",
"->",
"addMessage",
"("... | Checks if there is enough time left for the analysis.
@return bool
Boolean to show if we have enough left.
FALSE = all is OK.
TRUE = we have a problem. | [
"Checks",
"if",
"there",
"is",
"enough",
"time",
"left",
"for",
"the",
"analysis",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Emergency.php#L198-L211 |
33,841 | brainworxx/kreXX | src/Service/Flow/Emergency.php | Emergency.checkMemory | protected function checkMemory()
{
// We will only check, if we were able to determine a memory limit
// in the first place.
if ($this->serverMemoryLimit > 2) {
$left = $this->serverMemoryLimit - memory_get_usage();
// Is more left than is configured?
if (... | php | protected function checkMemory()
{
// We will only check, if we were able to determine a memory limit
// in the first place.
if ($this->serverMemoryLimit > 2) {
$left = $this->serverMemoryLimit - memory_get_usage();
// Is more left than is configured?
if (... | [
"protected",
"function",
"checkMemory",
"(",
")",
"{",
"// We will only check, if we were able to determine a memory limit",
"// in the first place.",
"if",
"(",
"$",
"this",
"->",
"serverMemoryLimit",
">",
"2",
")",
"{",
"$",
"left",
"=",
"$",
"this",
"->",
"serverMe... | Check if we have enough memory left.
@return bool
Boolean to show if we have enough left.
FALSE = all is OK.
TRUE = we have a problem. | [
"Check",
"if",
"we",
"have",
"enough",
"memory",
"left",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Emergency.php#L221-L239 |
33,842 | brainworxx/kreXX | src/Service/Flow/Emergency.php | Emergency.resetTimer | public function resetTimer()
{
if (empty($this->timer) === true) {
$this->timer = time() + $this->maxRuntime;
}
} | php | public function resetTimer()
{
if (empty($this->timer) === true) {
$this->timer = time() + $this->maxRuntime;
}
} | [
"public",
"function",
"resetTimer",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"timer",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"timer",
"=",
"time",
"(",
")",
"+",
"$",
"this",
"->",
"maxRuntime",
";",
"}",
"}"
] | Resets the timer.
When a certain time has passed, kreXX will use an emergency break to
prevent too large output (or no output at all (WSOD)). | [
"Resets",
"the",
"timer",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Emergency.php#L284-L289 |
33,843 | brainworxx/kreXX | src/Service/Flow/Emergency.php | Emergency.checkMaxCall | public function checkMaxCall()
{
if ($this->krexxCount >= $this->maxCall) {
// Called too often, we might get into trouble here!
return true;
}
// Give feedback if this is our last call.
if ($this->krexxCount === ($this->maxCall - 1)) {
$this->poo... | php | public function checkMaxCall()
{
if ($this->krexxCount >= $this->maxCall) {
// Called too often, we might get into trouble here!
return true;
}
// Give feedback if this is our last call.
if ($this->krexxCount === ($this->maxCall - 1)) {
$this->poo... | [
"public",
"function",
"checkMaxCall",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"krexxCount",
">=",
"$",
"this",
"->",
"maxCall",
")",
"{",
"// Called too often, we might get into trouble here!",
"return",
"true",
";",
"}",
"// Give feedback if this is our last cal... | Finds out, if krexx was called too often, to prevent large output.
@return bool
Whether kreXX was called too often or not. | [
"Finds",
"out",
"if",
"krexx",
"was",
"called",
"too",
"often",
"to",
"prevent",
"large",
"output",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Flow/Emergency.php#L297-L313 |
33,844 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.each | public function each(callable $callback)
{
if ($this->isCollection()) {
foreach ($this->data as $val) {
$callback($this->box($val));
}
} else {
$callback($this->box($this->data));
}
return $this;
} | php | public function each(callable $callback)
{
if ($this->isCollection()) {
foreach ($this->data as $val) {
$callback($this->box($val));
}
} else {
$callback($this->box($this->data));
}
return $this;
} | [
"public",
"function",
"each",
"(",
"callable",
"$",
"callback",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCollection",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"val",
")",
"{",
"$",
"callback",
"(",
"$",
"this",
... | Fire callback for each member of the array.
@param callable $callback
@return $this | [
"Fire",
"callback",
"for",
"each",
"member",
"of",
"the",
"array",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L63-L74 |
33,845 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.pluckArray | public function pluckArray($key): array
{
if ($this->isCollection()) {
return array_map(function ($val) {
return $this->box($val);
}, CollectionUtility::pluck($this->data, $key));
}
// Non-collection
return CollectionUtility::pluck([$this->dat... | php | public function pluckArray($key): array
{
if ($this->isCollection()) {
return array_map(function ($val) {
return $this->box($val);
}, CollectionUtility::pluck($this->data, $key));
}
// Non-collection
return CollectionUtility::pluck([$this->dat... | [
"public",
"function",
"pluckArray",
"(",
"$",
"key",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"isCollection",
"(",
")",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"val",
")",
"{",
"return",
"$",
"this",
"->",
"box",
"(... | Pluck a value by key from each result and return an array.
@param $key
@return array | [
"Pluck",
"a",
"value",
"by",
"key",
"from",
"each",
"result",
"and",
"return",
"an",
"array",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L122-L132 |
33,846 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.filter | public function filter($filter): ArrayObjectInterface
{
return \is_callable($filter, true) ? $this->filterCallback($filter) : $this->filterConditions($filter);
} | php | public function filter($filter): ArrayObjectInterface
{
return \is_callable($filter, true) ? $this->filterCallback($filter) : $this->filterConditions($filter);
} | [
"public",
"function",
"filter",
"(",
"$",
"filter",
")",
":",
"ArrayObjectInterface",
"{",
"return",
"\\",
"is_callable",
"(",
"$",
"filter",
",",
"true",
")",
"?",
"$",
"this",
"->",
"filterCallback",
"(",
"$",
"filter",
")",
":",
"$",
"this",
"->",
"... | Return a new collection by filtering data within the current collection.
@param mixed $filter
@return ArrayObjectInterface | [
"Return",
"a",
"new",
"collection",
"by",
"filtering",
"data",
"within",
"the",
"current",
"collection",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L141-L144 |
33,847 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.filterCallback | public function filterCallback(callable $fn): ArrayObjectInterface
{
return new static(
array_values(
array_filter(
$this->isCollection() ? $this->data : [$this->data],
function($item) use ($fn) {
return $fn($this->b... | php | public function filterCallback(callable $fn): ArrayObjectInterface
{
return new static(
array_values(
array_filter(
$this->isCollection() ? $this->data : [$this->data],
function($item) use ($fn) {
return $fn($this->b... | [
"public",
"function",
"filterCallback",
"(",
"callable",
"$",
"fn",
")",
":",
"ArrayObjectInterface",
"{",
"return",
"new",
"static",
"(",
"array_values",
"(",
"array_filter",
"(",
"$",
"this",
"->",
"isCollection",
"(",
")",
"?",
"$",
"this",
"->",
"data",
... | Return a new collection by filtering the data via a callback.
@param callable|\Closure $fn
@return ArrayObjectInterface | [
"Return",
"a",
"new",
"collection",
"by",
"filtering",
"the",
"data",
"via",
"a",
"callback",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L153-L165 |
33,848 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.filterConditions | public function filterConditions(
array $conditions,
string $matchType = CollectionUtility::MATCH_TYPE_LOOSE,
$preserveKeys = false
): ArrayObjectInterface {
return new static(CollectionUtility::filterWhere($this->isCollection() ? $this->data : [$this->data],
$conditions,... | php | public function filterConditions(
array $conditions,
string $matchType = CollectionUtility::MATCH_TYPE_LOOSE,
$preserveKeys = false
): ArrayObjectInterface {
return new static(CollectionUtility::filterWhere($this->isCollection() ? $this->data : [$this->data],
$conditions,... | [
"public",
"function",
"filterConditions",
"(",
"array",
"$",
"conditions",
",",
"string",
"$",
"matchType",
"=",
"CollectionUtility",
"::",
"MATCH_TYPE_LOOSE",
",",
"$",
"preserveKeys",
"=",
"false",
")",
":",
"ArrayObjectInterface",
"{",
"return",
"new",
"static"... | Return a new collection by filtering the data against a list of conditions.
@param array $conditions
@param string $matchType
@param bool $preserveKeys
@return ArrayObjectInterface | [
"Return",
"a",
"new",
"collection",
"by",
"filtering",
"the",
"data",
"against",
"a",
"list",
"of",
"conditions",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L176-L183 |
33,849 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.first | public function first()
{
if (!$this->isCollection()) {
return $this;
}
return isset($this->data[0]) ? $this->box($this->data[0]) : null;
} | php | public function first()
{
if (!$this->isCollection()) {
return $this;
}
return isset($this->data[0]) ? $this->box($this->data[0]) : null;
} | [
"public",
"function",
"first",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCollection",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"0",
"]",
")",
"?",
"$",
"this",
"->",... | Returns the first element in the collection.
@return mixed | [
"Returns",
"the",
"first",
"element",
"in",
"the",
"collection",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L190-L197 |
33,850 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.last | public function last()
{
if (!$this->isCollection()) {
return $this;
}
return isset($this->data[0]) ? $this->box(ArrayUtility::last($this->data)) : null;
} | php | public function last()
{
if (!$this->isCollection()) {
return $this;
}
return isset($this->data[0]) ? $this->box(ArrayUtility::last($this->data)) : null;
} | [
"public",
"function",
"last",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCollection",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"0",
"]",
")",
"?",
"$",
"this",
"->",
... | Returns the last element in the collection.
@return ArrayObjectInterface|null | [
"Returns",
"the",
"last",
"element",
"in",
"the",
"collection",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L204-L211 |
33,851 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.getNormalizedKey | protected function getNormalizedKey($key): string
{
// Keys within collections must be offset based
if (!\is_int($key) && $this->isCollection() && !preg_match('/^\d+\./', $key)) {
$key = "0.$key";
}
return $key;
} | php | protected function getNormalizedKey($key): string
{
// Keys within collections must be offset based
if (!\is_int($key) && $this->isCollection() && !preg_match('/^\d+\./', $key)) {
$key = "0.$key";
}
return $key;
} | [
"protected",
"function",
"getNormalizedKey",
"(",
"$",
"key",
")",
":",
"string",
"{",
"// Keys within collections must be offset based",
"if",
"(",
"!",
"\\",
"is_int",
"(",
"$",
"key",
")",
"&&",
"$",
"this",
"->",
"isCollection",
"(",
")",
"&&",
"!",
"pre... | Forces key to be prefixed with an offset.
@param $key
@return string | [
"Forces",
"key",
"to",
"be",
"prefixed",
"with",
"an",
"offset",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L236-L244 |
33,852 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.has | public function has($key): bool
{
return ArrayUtility::dotRead($this->data, $this->getNormalizedKey($key)) !== null;
} | php | public function has($key): bool
{
return ArrayUtility::dotRead($this->data, $this->getNormalizedKey($key)) !== null;
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
":",
"bool",
"{",
"return",
"ArrayUtility",
"::",
"dotRead",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"getNormalizedKey",
"(",
"$",
"key",
")",
")",
"!==",
"null",
";",
"}"
] | Determine if the node contains a property.
@param string $key
@return bool | [
"Determine",
"if",
"the",
"node",
"contains",
"a",
"property",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L321-L324 |
33,853 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.shift | public function shift()
{
$this->forceCollection();
if (!$this->hasItems()) {
throw new InvalidOffsetException('Cannot shift this array, no more items');
}
return $this->box(array_shift($this->data));
} | php | public function shift()
{
$this->forceCollection();
if (!$this->hasItems()) {
throw new InvalidOffsetException('Cannot shift this array, no more items');
}
return $this->box(array_shift($this->data));
} | [
"public",
"function",
"shift",
"(",
")",
"{",
"$",
"this",
"->",
"forceCollection",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasItems",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidOffsetException",
"(",
"'Cannot shift this array, no more items'",
"... | Pull the first item off the collection.
If the underlying data is not a collection, it will be converted to one.
@throws \Rexlabs\ArrayObject\Exceptions\InvalidOffsetException
@return mixed | [
"Pull",
"the",
"first",
"item",
"off",
"the",
"collection",
".",
"If",
"the",
"underlying",
"data",
"is",
"not",
"a",
"collection",
"it",
"will",
"be",
"converted",
"to",
"one",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L346-L354 |
33,854 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.forceCollection | protected function forceCollection()
{
if (!$this->isCollection()) {
$this->isCollection = true;
$this->data = [$this->data];
}
} | php | protected function forceCollection()
{
if (!$this->isCollection()) {
$this->isCollection = true;
$this->data = [$this->data];
}
} | [
"protected",
"function",
"forceCollection",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCollection",
"(",
")",
")",
"{",
"$",
"this",
"->",
"isCollection",
"=",
"true",
";",
"$",
"this",
"->",
"data",
"=",
"[",
"$",
"this",
"->",
"data",
"... | Forces the underlying data-structure to become a collection. | [
"Forces",
"the",
"underlying",
"data",
"-",
"structure",
"to",
"become",
"a",
"collection",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L359-L365 |
33,855 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.unshift | public function unshift(...$values)
{
$this->forceCollection();
$values = array_map([$this, 'unbox'], $values);
array_unshift($this->data, ...$values);
return $this;
} | php | public function unshift(...$values)
{
$this->forceCollection();
$values = array_map([$this, 'unbox'], $values);
array_unshift($this->data, ...$values);
return $this;
} | [
"public",
"function",
"unshift",
"(",
"...",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"forceCollection",
"(",
")",
";",
"$",
"values",
"=",
"array_map",
"(",
"[",
"$",
"this",
",",
"'unbox'",
"]",
",",
"$",
"values",
")",
";",
"array_unshift",
"("... | Add one or more items at the start of the collection.
If the underlying data is not a collection, it will be converted to one.
@param array $values
@throws \Rexlabs\ArrayObject\Exceptions\InvalidOffsetException
@return mixed | [
"Add",
"one",
"or",
"more",
"items",
"at",
"the",
"start",
"of",
"the",
"collection",
".",
"If",
"the",
"underlying",
"data",
"is",
"not",
"a",
"collection",
"it",
"will",
"be",
"converted",
"to",
"one",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L397-L404 |
33,856 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.push | public function push(...$values)
{
$this->forceCollection();
$values = array_map([$this, 'unbox'], $values);
array_push($this->data, ...$values);
return $this;
} | php | public function push(...$values)
{
$this->forceCollection();
$values = array_map([$this, 'unbox'], $values);
array_push($this->data, ...$values);
return $this;
} | [
"public",
"function",
"push",
"(",
"...",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"forceCollection",
"(",
")",
";",
"$",
"values",
"=",
"array_map",
"(",
"[",
"$",
"this",
",",
"'unbox'",
"]",
",",
"$",
"values",
")",
";",
"array_push",
"(",
"$... | Add one or more items to the end of the collection.
If the underlying data is not a collection, it will be converted to one.
@param array $values
@return mixed | [
"Add",
"one",
"or",
"more",
"items",
"to",
"the",
"end",
"of",
"the",
"collection",
".",
"If",
"the",
"underlying",
"data",
"is",
"not",
"a",
"collection",
"it",
"will",
"be",
"converted",
"to",
"one",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L414-L421 |
33,857 | rexlabsio/array-object-php | src/ArrayObject.php | ArrayObject.pop | public function pop()
{
$this->forceCollection();
if (!$this->hasItems()) {
throw new InvalidOffsetException('Cannot shift this array, no more items');
}
return $this->box(array_pop($this->data));
} | php | public function pop()
{
$this->forceCollection();
if (!$this->hasItems()) {
throw new InvalidOffsetException('Cannot shift this array, no more items');
}
return $this->box(array_pop($this->data));
} | [
"public",
"function",
"pop",
"(",
")",
"{",
"$",
"this",
"->",
"forceCollection",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasItems",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidOffsetException",
"(",
"'Cannot shift this array, no more items'",
")"... | Pull the last item off the end of the collection.
If the underlying data is not a collection, it will be converted to one.
@throws \Rexlabs\ArrayObject\Exceptions\InvalidOffsetException
@return mixed | [
"Pull",
"the",
"last",
"item",
"off",
"the",
"end",
"of",
"the",
"collection",
".",
"If",
"the",
"underlying",
"data",
"is",
"not",
"a",
"collection",
"it",
"will",
"be",
"converted",
"to",
"one",
"."
] | 5633cbd556ed6e495cd77aca6ed644262a7d5165 | https://github.com/rexlabsio/array-object-php/blob/5633cbd556ed6e495cd77aca6ed644262a7d5165/src/ArrayObject.php#L431-L439 |
33,858 | brainworxx/kreXX | src/Service/Config/Config.php | Config.getDevHandler | public function getDevHandler()
{
static $handle = false;
if ($handle === false) {
$handle = $this->cookieConfig->getConfigFromCookies('deep', static::SETTING_DEV_HANDLE);
}
return $handle;
} | php | public function getDevHandler()
{
static $handle = false;
if ($handle === false) {
$handle = $this->cookieConfig->getConfigFromCookies('deep', static::SETTING_DEV_HANDLE);
}
return $handle;
} | [
"public",
"function",
"getDevHandler",
"(",
")",
"{",
"static",
"$",
"handle",
"=",
"false",
";",
"if",
"(",
"$",
"handle",
"===",
"false",
")",
"{",
"$",
"handle",
"=",
"$",
"this",
"->",
"cookieConfig",
"->",
"getConfigFromCookies",
"(",
"'deep'",
",",... | Returns the developer handle from the cookies.
@return string
The Developer handle. | [
"Returns",
"the",
"developer",
"handle",
"from",
"the",
"cookies",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Config.php#L180-L189 |
33,859 | brainworxx/kreXX | src/Service/Config/Config.php | Config.loadConfigValue | public function loadConfigValue($name)
{
$feConfig = $this->iniConfig->getFeConfig($name);
$section = $this->feConfigFallback[$name][static::SECTION];
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Service\\Config\\Model')
->setSection($sec... | php | public function loadConfigValue($name)
{
$feConfig = $this->iniConfig->getFeConfig($name);
$section = $this->feConfigFallback[$name][static::SECTION];
/** @var Model $model */
$model = $this->pool->createClass('Brainworxx\\Krexx\\Service\\Config\\Model')
->setSection($sec... | [
"public",
"function",
"loadConfigValue",
"(",
"$",
"name",
")",
"{",
"$",
"feConfig",
"=",
"$",
"this",
"->",
"iniConfig",
"->",
"getFeConfig",
"(",
"$",
"name",
")",
";",
"$",
"section",
"=",
"$",
"this",
"->",
"feConfigFallback",
"[",
"$",
"name",
"]... | Load values of the kreXX's configuration.
@param string $name
The name of the config value.
@return $this
Return this, for chaining. | [
"Load",
"values",
"of",
"the",
"kreXX",
"s",
"configuration",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Config.php#L214-L253 |
33,860 | brainworxx/kreXX | src/Service/Config/Config.php | Config.isRequestAjaxOrCli | protected function isRequestAjaxOrCli()
{
$server = $this->pool->getServer();
if (isset($server['HTTP_X_REQUESTED_WITH']) === true &&
strtolower($server['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' &&
$this->getSetting(static::SETTING_DETECT_AJAX) === true
) {
... | php | protected function isRequestAjaxOrCli()
{
$server = $this->pool->getServer();
if (isset($server['HTTP_X_REQUESTED_WITH']) === true &&
strtolower($server['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' &&
$this->getSetting(static::SETTING_DETECT_AJAX) === true
) {
... | [
"protected",
"function",
"isRequestAjaxOrCli",
"(",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"pool",
"->",
"getServer",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"server",
"[",
"'HTTP_X_REQUESTED_WITH'",
"]",
")",
"===",
"true",
"&&",
"strtolo... | Check if the current request is an AJAX request.
@return bool
TRUE when this is AJAX, FALSE if not | [
"Check",
"if",
"the",
"current",
"request",
"is",
"an",
"AJAX",
"request",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Config.php#L261-L284 |
33,861 | brainworxx/kreXX | src/Service/Config/Config.php | Config.isAllowedIp | protected function isAllowedIp($whitelist)
{
$server = $this->pool->getServer();
if (empty($server[static::REMOTE_ADDRESS]) === true) {
$remote = '';
} else {
$remote = $server[static::REMOTE_ADDRESS];
}
$whitelist = explode(',', $whitelist);
... | php | protected function isAllowedIp($whitelist)
{
$server = $this->pool->getServer();
if (empty($server[static::REMOTE_ADDRESS]) === true) {
$remote = '';
} else {
$remote = $server[static::REMOTE_ADDRESS];
}
$whitelist = explode(',', $whitelist);
... | [
"protected",
"function",
"isAllowedIp",
"(",
"$",
"whitelist",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"pool",
"->",
"getServer",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"server",
"[",
"static",
"::",
"REMOTE_ADDRESS",
"]",
")",
"===",
... | Checks if the current client ip is allowed.
@author Chin Leung
@see https://stackoverflow.com/questions/35559119/php-ip-address-whitelist-with-wildcards
@param string $whitelist
The ip whitelist.
@return bool
Whether the current client ip is allowed or not. | [
"Checks",
"if",
"the",
"current",
"client",
"ip",
"is",
"allowed",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Config.php#L331-L358 |
33,862 | brainworxx/kreXX | src/Service/Config/Config.php | Config.isAllowedDebugCall | public function isAllowedDebugCall($data)
{
// Check if the class itself is blacklisted.
foreach ($this->classBlacklist as $classname) {
if (is_a($data, $classname) === true) {
// No debug methods for you.
return false;
}
}
// ... | php | public function isAllowedDebugCall($data)
{
// Check if the class itself is blacklisted.
foreach ($this->classBlacklist as $classname) {
if (is_a($data, $classname) === true) {
// No debug methods for you.
return false;
}
}
// ... | [
"public",
"function",
"isAllowedDebugCall",
"(",
"$",
"data",
")",
"{",
"// Check if the class itself is blacklisted.",
"foreach",
"(",
"$",
"this",
"->",
"classBlacklist",
"as",
"$",
"classname",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"data",
",",
"$",
"class... | Determines if the specific class is blacklisted for debug methods.
@param object $data
The class we are analysing.
@return bool
Whether the function is allowed to be called. | [
"Determines",
"if",
"the",
"specific",
"class",
"is",
"blacklisted",
"for",
"debug",
"methods",
"."
] | a03beaa4507ffb391412b9ac61593d263d3f8bca | https://github.com/brainworxx/kreXX/blob/a03beaa4507ffb391412b9ac61593d263d3f8bca/src/Service/Config/Config.php#L369-L381 |
33,863 | silverorange/swat | Swat/SwatDetailsStore.php | SwatDetailsStore.__isset | public function __isset($name)
{
$is_set = isset($this->data[$name]);
if (!$is_set && $this->base_object !== null) {
$is_set = isset($this->base_object->$name);
}
return $is_set;
} | php | public function __isset($name)
{
$is_set = isset($this->data[$name]);
if (!$is_set && $this->base_object !== null) {
$is_set = isset($this->base_object->$name);
}
return $is_set;
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"$",
"is_set",
"=",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
")",
";",
"if",
"(",
"!",
"$",
"is_set",
"&&",
"$",
"this",
"->",
"base_object",
"!==",
"null",
")",
... | Gets whether or not a property is set for this details store
First, the manually set properties are checked. Then the properties of
the base object are checked if there is a base object.
@param string $name the name of the property to check.
@return boolean true if the property is set for this details store and
fals... | [
"Gets",
"whether",
"or",
"not",
"a",
"property",
"is",
"set",
"for",
"this",
"details",
"store"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatDetailsStore.php#L137-L146 |
33,864 | silverorange/swat | Swat/Swat.php | Swat.ngettext | public static function ngettext($singular_message, $plural_message, $number)
{
return dngettext(
self::GETTEXT_DOMAIN,
$singular_message,
$plural_message,
$number
);
} | php | public static function ngettext($singular_message, $plural_message, $number)
{
return dngettext(
self::GETTEXT_DOMAIN,
$singular_message,
$plural_message,
$number
);
} | [
"public",
"static",
"function",
"ngettext",
"(",
"$",
"singular_message",
",",
"$",
"plural_message",
",",
"$",
"number",
")",
"{",
"return",
"dngettext",
"(",
"self",
"::",
"GETTEXT_DOMAIN",
",",
"$",
"singular_message",
",",
"$",
"plural_message",
",",
"$",
... | Translates a plural phrase
This method should be used when a phrase depends on a number. For
example, use ngettext when translating a dynamic phrase like:
- "There is 1 new item" for 1 item and
- "There are 2 new items" for 2 or more items.
This method relies on the php gettext extension and uses dngettext()
interna... | [
"Translates",
"a",
"plural",
"phrase"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/Swat.php#L89-L97 |
33,865 | silverorange/swat | Swat/Swat.php | Swat.displayMethods | public static function displayMethods($object)
{
echo sprintf(self::_('Methods for class %s:'), get_class($object));
echo '<ul>';
foreach (get_class_methods(get_class($object)) as $method_name) {
echo '<li>', $method_name, '</li>';
}
echo '</ul>';
} | php | public static function displayMethods($object)
{
echo sprintf(self::_('Methods for class %s:'), get_class($object));
echo '<ul>';
foreach (get_class_methods(get_class($object)) as $method_name) {
echo '<li>', $method_name, '</li>';
}
echo '</ul>';
} | [
"public",
"static",
"function",
"displayMethods",
"(",
"$",
"object",
")",
"{",
"echo",
"sprintf",
"(",
"self",
"::",
"_",
"(",
"'Methods for class %s:'",
")",
",",
"get_class",
"(",
"$",
"object",
")",
")",
";",
"echo",
"'<ul>'",
";",
"foreach",
"(",
"g... | Displays the methods of an object
This is useful for debugging.
@param mixed $object the object whose methods are to be displayed. | [
"Displays",
"the",
"methods",
"of",
"an",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/Swat.php#L123-L133 |
33,866 | silverorange/swat | Swat/Swat.php | Swat.displayProperties | public static function displayProperties($object)
{
$class = get_class($object);
echo sprintf(self::_('Properties for class %s:'), $class);
echo '<ul>';
foreach (get_class_vars($class) as $property_name => $value) {
$instance_value = $object->$property_name;
... | php | public static function displayProperties($object)
{
$class = get_class($object);
echo sprintf(self::_('Properties for class %s:'), $class);
echo '<ul>';
foreach (get_class_vars($class) as $property_name => $value) {
$instance_value = $object->$property_name;
... | [
"public",
"static",
"function",
"displayProperties",
"(",
"$",
"object",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"object",
")",
";",
"echo",
"sprintf",
"(",
"self",
"::",
"_",
"(",
"'Properties for class %s:'",
")",
",",
"$",
"class",
")",
";... | Displays the properties of an object
This is useful for debugging.
@param mixed $object the object whose properties are to be displayed. | [
"Displays",
"the",
"properties",
"of",
"an",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/Swat.php#L145-L158 |
33,867 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.query | public static function query(
$db,
$sql,
$wrapper = 'SwatDBDefaultRecordsetWrapper',
$types = null
) {
$mdb2_types = $types === null ? true : $types;
$rs = self::executeQuery($db, 'query', array(
$sql,
$mdb2_types,
true,
... | php | public static function query(
$db,
$sql,
$wrapper = 'SwatDBDefaultRecordsetWrapper',
$types = null
) {
$mdb2_types = $types === null ? true : $types;
$rs = self::executeQuery($db, 'query', array(
$sql,
$mdb2_types,
true,
... | [
"public",
"static",
"function",
"query",
"(",
"$",
"db",
",",
"$",
"sql",
",",
"$",
"wrapper",
"=",
"'SwatDBDefaultRecordsetWrapper'",
",",
"$",
"types",
"=",
"null",
")",
"{",
"$",
"mdb2_types",
"=",
"$",
"types",
"===",
"null",
"?",
"true",
":",
"$",... | Performs an SQL query
@param MDB2_Driver_Common $db the database connection.
@param string $sql the SQL to execute.
@param string|SwatDBRecordsetWrapper $wrapper optional. The object or
name of class with which
to wrap the result set. If
not specified,
{@link SwatDBDefaultRec... | [
"Performs",
"an",
"SQL",
"query"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L87-L112 |
33,868 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.updateColumn | public static function updateColumn(
$db,
$table,
$field,
$value,
$id_field,
$ids,
$where = null
) {
$ids = self::initArray($ids);
if (count($ids) === 0) {
return;
}
$field = new SwatDBField($field, 'integer');
... | php | public static function updateColumn(
$db,
$table,
$field,
$value,
$id_field,
$ids,
$where = null
) {
$ids = self::initArray($ids);
if (count($ids) === 0) {
return;
}
$field = new SwatDBField($field, 'integer');
... | [
"public",
"static",
"function",
"updateColumn",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"field",
",",
"$",
"value",
",",
"$",
"id_field",
",",
"$",
"ids",
",",
"$",
"where",
"=",
"null",
")",
"{",
"$",
"ids",
"=",
"self",
"::",
"initArray",
... | Update a column
Convenience method to update a single database field for one or more
rows. One convenient use of this method is for processing {@link
SwatAction}s
that change a single database field.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to query.
@param stri... | [
"Update",
"a",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L172-L211 |
33,869 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.queryColumn | public static function queryColumn(
$db,
$table,
$field,
$id_field = null,
$id = 0
) {
$field = new SwatDBField($field, 'integer');
if ($id_field == null) {
$sql = 'select %s from %s';
$sql = sprintf($sql, $field->name, $table);
... | php | public static function queryColumn(
$db,
$table,
$field,
$id_field = null,
$id = 0
) {
$field = new SwatDBField($field, 'integer');
if ($id_field == null) {
$sql = 'select %s from %s';
$sql = sprintf($sql, $field->name, $table);
... | [
"public",
"static",
"function",
"queryColumn",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"field",
",",
"$",
"id_field",
"=",
"null",
",",
"$",
"id",
"=",
"0",
")",
"{",
"$",
"field",
"=",
"new",
"SwatDBField",
"(",
"$",
"field",
",",
"'integer'"... | Query a column
Convenience method to query for values in a single database column.
One convenient use of this method is for loading values from a binding
table.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to query.
@param string $field The name of the database fiel... | [
"Query",
"a",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L245-L275 |
33,870 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.queryOne | public static function queryOne($db, $sql, $type = null)
{
$mdb2_type = $type === null ? true : $type;
return self::executeQuery($db, 'queryOne', array($sql, $mdb2_type));
} | php | public static function queryOne($db, $sql, $type = null)
{
$mdb2_type = $type === null ? true : $type;
return self::executeQuery($db, 'queryOne', array($sql, $mdb2_type));
} | [
"public",
"static",
"function",
"queryOne",
"(",
"$",
"db",
",",
"$",
"sql",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"mdb2_type",
"=",
"$",
"type",
"===",
"null",
"?",
"true",
":",
"$",
"type",
";",
"return",
"self",
"::",
"executeQuery",
"("... | Query a single value
Convenience method to query a single value in a single database column.
@param MDB2_Driver_Common $db The database connection.
@param string $sql The SQL to execute.
@param string $type Optional MDB2 datatype for the result.
@return mixed The value queried for a single result. Null when there ar... | [
"Query",
"a",
"single",
"value"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L294-L298 |
33,871 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.queryRow | public static function queryRow($db, $sql, $types = null)
{
$mdb2_types = $types === null ? true : $types;
$row = self::executeQuery($db, 'queryRow', array(
$sql,
$mdb2_types,
MDB2_FETCHMODE_OBJECT
));
return $row;
} | php | public static function queryRow($db, $sql, $types = null)
{
$mdb2_types = $types === null ? true : $types;
$row = self::executeQuery($db, 'queryRow', array(
$sql,
$mdb2_types,
MDB2_FETCHMODE_OBJECT
));
return $row;
} | [
"public",
"static",
"function",
"queryRow",
"(",
"$",
"db",
",",
"$",
"sql",
",",
"$",
"types",
"=",
"null",
")",
"{",
"$",
"mdb2_types",
"=",
"$",
"types",
"===",
"null",
"?",
"true",
":",
"$",
"types",
";",
"$",
"row",
"=",
"self",
"::",
"execu... | Query a single row
Convenience method to query for a single row from a database table.
@param MDB2_Driver_Common $db The database connection.
@param string $sql The SQL to execute.
@param array $types Optional array of MDB2 datatypes for the result.
@return Object A row object, or null.
@throws SwatDBException | [
"Query",
"a",
"single",
"row"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L316-L327 |
33,872 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.queryOneFromTable | public static function queryOneFromTable(
$db,
$table,
$field,
$id_field = null,
$id = 0
) {
$field = new SwatDBField($field, 'integer');
if ($id_field == null) {
$sql = 'select %s from %s';
$sql = sprintf($sql, $field->name, $table);
... | php | public static function queryOneFromTable(
$db,
$table,
$field,
$id_field = null,
$id = 0
) {
$field = new SwatDBField($field, 'integer');
if ($id_field == null) {
$sql = 'select %s from %s';
$sql = sprintf($sql, $field->name, $table);
... | [
"public",
"static",
"function",
"queryOneFromTable",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"field",
",",
"$",
"id_field",
"=",
"null",
",",
"$",
"id",
"=",
"0",
")",
"{",
"$",
"field",
"=",
"new",
"SwatDBField",
"(",
"$",
"field",
",",
"'int... | Query a single value from a specified table and column
Convenience method to query a single value in a single database column.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to query.
@param string $field The name of the database field to query. Can be
given in the fo... | [
"Query",
"a",
"single",
"value",
"from",
"a",
"specified",
"table",
"and",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L359-L386 |
33,873 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.queryRowFromTable | public static function queryRowFromTable(
$db,
$table,
$fields,
$id_field,
$id
) {
self::initFields($fields);
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'select %s from %s where %s = %s';
$field_list = implode(',', self::getField... | php | public static function queryRowFromTable(
$db,
$table,
$fields,
$id_field,
$id
) {
self::initFields($fields);
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'select %s from %s where %s = %s';
$field_list = implode(',', self::getField... | [
"public",
"static",
"function",
"queryRowFromTable",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"id_field",
",",
"$",
"id",
")",
"{",
"self",
"::",
"initFields",
"(",
"$",
"fields",
")",
";",
"$",
"id_field",
"=",
"new",
"SwatDB... | Query a single row from a specified table and column
Convenience method to query for a single row from a database table.
One convenient use of this method is for loading data on an edit page.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to query.
@param array $field... | [
"Query",
"a",
"single",
"row",
"from",
"a",
"specified",
"table",
"and",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L417-L445 |
33,874 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.executeStoredProc | public static function executeStoredProc(
$db,
$proc,
$params,
$wrapper = 'SwatDBDefaultRecordsetWrapper',
$types = null
) {
if (!is_array($params)) {
$params = array($params);
}
$mdb2_types = $types === null ? true : $types;
$db-... | php | public static function executeStoredProc(
$db,
$proc,
$params,
$wrapper = 'SwatDBDefaultRecordsetWrapper',
$types = null
) {
if (!is_array($params)) {
$params = array($params);
}
$mdb2_types = $types === null ? true : $types;
$db-... | [
"public",
"static",
"function",
"executeStoredProc",
"(",
"$",
"db",
",",
"$",
"proc",
",",
"$",
"params",
",",
"$",
"wrapper",
"=",
"'SwatDBDefaultRecordsetWrapper'",
",",
"$",
"types",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"param... | Performs a stored procedure
@param MDB2_Driver_Common $db the database connection.
@param string $proc the name of the stored
procedure to execute.
@param mixed $params the parameters to pass to
the stored procedure. Use
an array for more than one
para... | [
"Performs",
"a",
"stored",
"procedure"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L478-L514 |
33,875 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.executeStoredProcOne | public static function executeStoredProcOne($db, $proc, $params)
{
if (!is_array($params)) {
$params = array($params);
}
$rs = self::executeStoredProc($db, $proc, $params);
$row = $rs->getFirst();
return current($row);
} | php | public static function executeStoredProcOne($db, $proc, $params)
{
if (!is_array($params)) {
$params = array($params);
}
$rs = self::executeStoredProc($db, $proc, $params);
$row = $rs->getFirst();
return current($row);
} | [
"public",
"static",
"function",
"executeStoredProcOne",
"(",
"$",
"db",
",",
"$",
"proc",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
... | Execute a stored procedure that returns a single value
Convenience method to execute a stored procedure that returns a single
value.
@param MDB2_Driver_Common $db The database connection.
@param string $proc The name of the stored procedure to execute.
@param mixed $params The parameters to pass to the stored proce... | [
"Execute",
"a",
"stored",
"procedure",
"that",
"returns",
"a",
"single",
"value"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L536-L545 |
33,876 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.updateBinding | public static function updateBinding(
$db,
$table,
$id_field,
$id,
$value_field,
$values,
$bound_table,
$bound_field
) {
$id_field = new SwatDBField($id_field, 'integer');
$value_field = new SwatDBField($value_field, 'integer');
... | php | public static function updateBinding(
$db,
$table,
$id_field,
$id,
$value_field,
$values,
$bound_table,
$bound_field
) {
$id_field = new SwatDBField($id_field, 'integer');
$value_field = new SwatDBField($value_field, 'integer');
... | [
"public",
"static",
"function",
"updateBinding",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"id_field",
",",
"$",
"id",
",",
"$",
"value_field",
",",
"$",
"values",
",",
"$",
"bound_table",
",",
"$",
"bound_field",
")",
"{",
"$",
"id_field",
"=",
"... | Update a binding table
Convenience method to update rows in a binding table. It will delete
and insert rows as necessary.
@param MDB2_Driver_Common $db The database connection.
@param string $table The binding table to update.
@param string $id_field The name of the binding table field that contains
the fixed value... | [
"Update",
"a",
"binding",
"table"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L584-L656 |
33,877 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.updateRow | public static function updateRow(
$db,
$table,
$fields,
$values,
$id_field,
$id
) {
self::initFields($fields);
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'update %s set %s where %s = %s';
$updates = array();
fore... | php | public static function updateRow(
$db,
$table,
$fields,
$values,
$id_field,
$id
) {
self::initFields($fields);
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'update %s set %s where %s = %s';
$updates = array();
fore... | [
"public",
"static",
"function",
"updateRow",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"fields",
",",
"$",
"values",
",",
"$",
"id_field",
",",
"$",
"id",
")",
"{",
"self",
"::",
"initFields",
"(",
"$",
"fields",
")",
";",
"$",
"id_field",
"=",
... | Update a row
Convenience method to update multiple fields of a single database row.
One convenient use of this method is for save data on an edit page.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to update.
@param array $fields An array of fields to be updated. Can... | [
"Update",
"a",
"row"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L776-L812 |
33,878 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.deleteRow | public static function deleteRow($db, $table, $id_field, $id)
{
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'delete from %s where %s = %s';
$sql = sprintf(
$sql,
$table,
$id_field->name,
$db->quote($id, $id_field->type)
)... | php | public static function deleteRow($db, $table, $id_field, $id)
{
$id_field = new SwatDBField($id_field, 'integer');
$sql = 'delete from %s where %s = %s';
$sql = sprintf(
$sql,
$table,
$id_field->name,
$db->quote($id, $id_field->type)
)... | [
"public",
"static",
"function",
"deleteRow",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"id_field",
",",
"$",
"id",
")",
"{",
"$",
"id_field",
"=",
"new",
"SwatDBField",
"(",
"$",
"id_field",
",",
"'integer'",
")",
";",
"$",
"sql",
"=",
"'delete fr... | Delete a row
Convenience method to delete a single database row.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to delete from.
@param string $id_field The name of the database field that contains an
identifier of row to be deleted. Can be given in the form
type:name ... | [
"Delete",
"a",
"row"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L836-L849 |
33,879 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.getCascadeOptionArray | public static function getCascadeOptionArray(
$db,
$table,
$title_field,
$id_field,
$cascade_field,
$order_by_clause = null,
$where_clause = null
) {
$title_field = new SwatDBField($title_field, 'text');
$id_field = new SwatDBField($id_field, '... | php | public static function getCascadeOptionArray(
$db,
$table,
$title_field,
$id_field,
$cascade_field,
$order_by_clause = null,
$where_clause = null
) {
$title_field = new SwatDBField($title_field, 'text');
$id_field = new SwatDBField($id_field, '... | [
"public",
"static",
"function",
"getCascadeOptionArray",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"title_field",
",",
"$",
"id_field",
",",
"$",
"cascade_field",
",",
"$",
"order_by_clause",
"=",
"null",
",",
"$",
"where_clause",
"=",
"null",
")",
"{",... | Query for an option array cascaded by a field
Convenience method to query for a set of options, each consisting of
an id, title, and a group-by field. The returned option array in the form of
$cascade => array($id => $title, $id => $title) can be passed directly to
other classes, such as {@link SwatCascade} for exampl... | [
"Query",
"for",
"an",
"option",
"array",
"cascaded",
"by",
"a",
"field"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L973-L1028 |
33,880 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.getGroupedOptionArray | public static function getGroupedOptionArray(
$db,
$table,
$title_field,
$id_field,
$group_table,
$group_title_field,
$group_id_field,
$group_field,
$order_by_clause = null,
$where_clause = null,
$tree = null
) {
$title_... | php | public static function getGroupedOptionArray(
$db,
$table,
$title_field,
$id_field,
$group_table,
$group_title_field,
$group_id_field,
$group_field,
$order_by_clause = null,
$where_clause = null,
$tree = null
) {
$title_... | [
"public",
"static",
"function",
"getGroupedOptionArray",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"title_field",
",",
"$",
"id_field",
",",
"$",
"group_table",
",",
"$",
"group_title_field",
",",
"$",
"group_id_field",
",",
"$",
"group_field",
",",
"$",
... | Queries for a grouped option array
Convenience method to query a grouped list of {@link SwatDataTreeNode}
objects used for things like {@link SwatCheckboxList} where checkboxes
are grouped together under a title.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to query.... | [
"Queries",
"for",
"a",
"grouped",
"option",
"array"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L1089-L1164 |
33,881 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.getFieldMax | public static function getFieldMax($db, $table, $field)
{
$field = new SwatDBField($field, 'integer');
$sql = sprintf(
'select max(%s) as %s from %s',
$field->name,
$field->name,
$table
);
return self::queryOne($db, $sql);
} | php | public static function getFieldMax($db, $table, $field)
{
$field = new SwatDBField($field, 'integer');
$sql = sprintf(
'select max(%s) as %s from %s',
$field->name,
$field->name,
$table
);
return self::queryOne($db, $sql);
} | [
"public",
"static",
"function",
"getFieldMax",
"(",
"$",
"db",
",",
"$",
"table",
",",
"$",
"field",
")",
"{",
"$",
"field",
"=",
"new",
"SwatDBField",
"(",
"$",
"field",
",",
"'integer'",
")",
";",
"$",
"sql",
"=",
"sprintf",
"(",
"'select max(%s) as ... | Get max field value
Convenience method to grab the max value from a single field.
@param MDB2_Driver_Common $db The database connection.
@param string $table The database table to update.
@param string $field The field to be return the max value of. Can be
given in the form type:name where type is a standard MDB2
d... | [
"Get",
"max",
"field",
"value"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L1186-L1198 |
33,882 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.equalityOperator | public static function equalityOperator($value, $neg = false)
{
if ($value === null && $neg) {
return 'is not';
} elseif ($value === null) {
return 'is';
} elseif ($neg) {
return '!=';
} else {
return '=';
}
} | php | public static function equalityOperator($value, $neg = false)
{
if ($value === null && $neg) {
return 'is not';
} elseif ($value === null) {
return 'is';
} elseif ($neg) {
return '!=';
} else {
return '=';
}
} | [
"public",
"static",
"function",
"equalityOperator",
"(",
"$",
"value",
",",
"$",
"neg",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
"&&",
"$",
"neg",
")",
"{",
"return",
"'is not'",
";",
"}",
"elseif",
"(",
"$",
"value",
"===",
... | Get proper conditional operator
Convenience method to return proper operators for database values that
may be null.
@param mixed $value The value to check for null on
@param boolean $neg Whether to return the operator for a negative
comparison
@return string SQL operator | [
"Get",
"proper",
"conditional",
"operator"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L1216-L1227 |
33,883 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.getDataTree | public static function getDataTree(
$rs,
$title_field_name,
$id_field_name,
$level_field_name,
$tree = null
) {
$stack = array();
if ($tree !== null && $tree instanceof SwatDataTreeNode) {
$current_parent = $tree;
} else {
$curr... | php | public static function getDataTree(
$rs,
$title_field_name,
$id_field_name,
$level_field_name,
$tree = null
) {
$stack = array();
if ($tree !== null && $tree instanceof SwatDataTreeNode) {
$current_parent = $tree;
} else {
$curr... | [
"public",
"static",
"function",
"getDataTree",
"(",
"$",
"rs",
",",
"$",
"title_field_name",
",",
"$",
"id_field_name",
",",
"$",
"level_field_name",
",",
"$",
"tree",
"=",
"null",
")",
"{",
"$",
"stack",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
... | Get a tree of data nodes
Convenience method to take a structured query with each row consisting of
an id, levelnum, and a title, and turning it into a tree of
{@link SwatDataTreeNode} objects. The returned option array in the form
of a collection of {@link SwatDataTreeNode} objects can be used by other
classes, such a... | [
"Get",
"a",
"tree",
"of",
"data",
"nodes"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L1259-L1294 |
33,884 | silverorange/swat | SwatDB/SwatDB.php | SwatDB.implodeSelection | public static function implodeSelection(
MDB2_Driver_Common $db,
SwatViewSelection $selection,
$type = 'integer'
) {
$quoted_ids = array();
foreach ($selection as $id) {
$quoted_ids[] = $db->quote($id, $type);
}
return implode(',', $quoted_ids);
... | php | public static function implodeSelection(
MDB2_Driver_Common $db,
SwatViewSelection $selection,
$type = 'integer'
) {
$quoted_ids = array();
foreach ($selection as $id) {
$quoted_ids[] = $db->quote($id, $type);
}
return implode(',', $quoted_ids);
... | [
"public",
"static",
"function",
"implodeSelection",
"(",
"MDB2_Driver_Common",
"$",
"db",
",",
"SwatViewSelection",
"$",
"selection",
",",
"$",
"type",
"=",
"'integer'",
")",
"{",
"$",
"quoted_ids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"selectio... | Implodes a view selection object
Each item in the view is quoted using the specified type.
@param MDB2_Driver_Common $db the database connection to use to implode
the view.
@param SwatViewSelection $selection the selection to implode.
@param string $type optional. The datatype to use. Must be a valid MDB2
datatype. I... | [
"Implodes",
"a",
"view",
"selection",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/SwatDB/SwatDB.php#L1312-L1323 |
33,885 | rhoone/yii2-rhoone | models/ExtensionQuery.php | ExtensionQuery.enabled | public function enabled($enabled = true)
{
if (is_bool($enabled)) {
return $this->andWhere(['enabled' => $enabled == true ? 1 : 0]);
}
return $this;
} | php | public function enabled($enabled = true)
{
if (is_bool($enabled)) {
return $this->andWhere(['enabled' => $enabled == true ? 1 : 0]);
}
return $this;
} | [
"public",
"function",
"enabled",
"(",
"$",
"enabled",
"=",
"true",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"enabled",
")",
")",
"{",
"return",
"$",
"this",
"->",
"andWhere",
"(",
"[",
"'enabled'",
"=>",
"$",
"enabled",
"==",
"true",
"?",
"1",
":"... | Attach enabled condition.
@param mixed $enabled
@return \static | [
"Attach",
"enabled",
"condition",
"."
] | f6ae90d466ea6f34bba404be0aba03e37ef369ad | https://github.com/rhoone/yii2-rhoone/blob/f6ae90d466ea6f34bba404be0aba03e37ef369ad/models/ExtensionQuery.php#L30-L36 |
33,886 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.init | public function init()
{
foreach ($this->renderers as $renderer) {
$renderer->init();
}
if ($this->id === null) {
$this->id = $this->getUniqueId();
$this->has_auto_id = true;
}
// add the input cell to this column's view's input row
... | php | public function init()
{
foreach ($this->renderers as $renderer) {
$renderer->init();
}
if ($this->id === null) {
$this->id = $this->getUniqueId();
$this->has_auto_id = true;
}
// add the input cell to this column's view's input row
... | [
"public",
"function",
"init",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"renderer",
"->",
"init",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"id",
"===",
"null",
")",
"{",
"$",
"... | Initializes this column
Gets a unique identifier for this column if one is not provided
This calls init on all cell renderers and input cells in this column | [
"Initializes",
"this",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L138-L162 |
33,887 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.displayHeaderCell | public function displayHeaderCell()
{
if (!$this->visible) {
return;
}
$th_tag = new SwatHtmlTag('th', $this->getThAttributes());
$th_tag->scope = 'col';
$colspan = $this->getXhtmlColspan();
if ($colspan > 1) {
$th_tag->colspan = $colspan;
... | php | public function displayHeaderCell()
{
if (!$this->visible) {
return;
}
$th_tag = new SwatHtmlTag('th', $this->getThAttributes());
$th_tag->scope = 'col';
$colspan = $this->getXhtmlColspan();
if ($colspan > 1) {
$th_tag->colspan = $colspan;
... | [
"public",
"function",
"displayHeaderCell",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"th_tag",
"=",
"new",
"SwatHtmlTag",
"(",
"'th'",
",",
"$",
"this",
"->",
"getThAttributes",
"(",
")",
")",
";"... | Displays the table-view header cell for this column | [
"Displays",
"the",
"table",
"-",
"view",
"header",
"cell",
"for",
"this",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L191-L208 |
33,888 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.display | public function display($row)
{
if (!$this->visible) {
return;
}
$this->setupRenderers($row);
$this->displayRenderers($row);
} | php | public function display($row)
{
if (!$this->visible) {
return;
}
$this->setupRenderers($row);
$this->displayRenderers($row);
} | [
"public",
"function",
"display",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"setupRenderers",
"(",
"$",
"row",
")",
";",
"$",
"this",
"->",
"displayRenderers",
"(",
"$",... | Displays this column using a data object
The properties of the cell renderers are set from the data object
through the datafield property mappings.
@param mixed $row a data object used to display the cell renderers in
this column. | [
"Displays",
"this",
"column",
"using",
"a",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L257-L265 |
33,889 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.getMessages | public function getMessages($data)
{
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
}
$messages = array();
foreach ($this->renderers as $renderer) {
$messages = array_merge($messages, $renderer->getMessa... | php | public function getMessages($data)
{
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
}
$messages = array();
foreach ($this->renderers as $renderer) {
$messages = array_merge($messages, $renderer->getMessa... | [
"public",
"function",
"getMessages",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderers",
"->",
"applyMappingsToRenderer",
"(",
"$",
"renderer",
",",
"$",
"data",
")"... | Gathers all messages from this column for the given data object
@param mixed $data the data object to use to check this column for
messages.
@return array an array of {@link SwatMessage} objects. | [
"Gathers",
"all",
"messages",
"from",
"this",
"column",
"for",
"the",
"given",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L278-L290 |
33,890 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.hasMessage | public function hasMessage($data)
{
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
}
$has_message = false;
foreach ($this->renderers as $renderer) {
if ($renderer->hasMessage()) {
$has_me... | php | public function hasMessage($data)
{
foreach ($this->renderers as $renderer) {
$this->renderers->applyMappingsToRenderer($renderer, $data);
}
$has_message = false;
foreach ($this->renderers as $renderer) {
if ($renderer->hasMessage()) {
$has_me... | [
"public",
"function",
"hasMessage",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderers",
"->",
"applyMappingsToRenderer",
"(",
"$",
"renderer",
",",
"$",
"data",
")",... | Gets whether or not this column has any messages for the given data
object
@param mixed $data the data object to use to check this column for
messages.
@return boolean true if this table-view column has one or more messages
for the given data object and false if it does not. | [
"Gets",
"whether",
"or",
"not",
"this",
"column",
"has",
"any",
"messages",
"for",
"the",
"given",
"data",
"object"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L305-L320 |
33,891 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.getHtmlHeadEntrySet | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
if ($this->input_cell !== null) {
$set->addEntrySet($this->input_cell->getHtmlHeadEntrySet());
}
return $set;
} | php | public function getHtmlHeadEntrySet()
{
$set = parent::getHtmlHeadEntrySet();
if ($this->input_cell !== null) {
$set->addEntrySet($this->input_cell->getHtmlHeadEntrySet());
}
return $set;
} | [
"public",
"function",
"getHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getHtmlHeadEntrySet",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"input_cell",
"!==",
"null",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
"$",
"this",
"... | Gets the SwatHtmlHeadEntry objects needed by this column
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects needed by
this column.
@see SwatUIObject::getHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"needed",
"by",
"this",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L546-L555 |
33,892 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.getAvailableHtmlHeadEntrySet | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
if ($this->input_cell !== null) {
$set->addEntrySet(
$this->input_cell->getAvailableHtmlHeadEntrySet()
);
}
return $set;
} | php | public function getAvailableHtmlHeadEntrySet()
{
$set = parent::getAvailableHtmlHeadEntrySet();
if ($this->input_cell !== null) {
$set->addEntrySet(
$this->input_cell->getAvailableHtmlHeadEntrySet()
);
}
return $set;
} | [
"public",
"function",
"getAvailableHtmlHeadEntrySet",
"(",
")",
"{",
"$",
"set",
"=",
"parent",
"::",
"getAvailableHtmlHeadEntrySet",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"input_cell",
"!==",
"null",
")",
"{",
"$",
"set",
"->",
"addEntrySet",
"(",
... | Gets the SwatHtmlHeadEntry objects that may be needed by this column
@return SwatHtmlHeadEntrySet the SwatHtmlHeadEntry objects that may be
needed by this column.
@see SwatUIObject::getAvailableHtmlHeadEntrySet() | [
"Gets",
"the",
"SwatHtmlHeadEntry",
"objects",
"that",
"may",
"be",
"needed",
"by",
"this",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L568-L579 |
33,893 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.hasVisibleRenderer | public function hasVisibleRenderer($row)
{
$this->setupRenderers($row);
$visible_renderers = false;
foreach ($this->renderers as $renderer) {
if ($renderer->visible) {
$visible_renderers = true;
break;
}
}
return $vis... | php | public function hasVisibleRenderer($row)
{
$this->setupRenderers($row);
$visible_renderers = false;
foreach ($this->renderers as $renderer) {
if ($renderer->visible) {
$visible_renderers = true;
break;
}
}
return $vis... | [
"public",
"function",
"hasVisibleRenderer",
"(",
"$",
"row",
")",
"{",
"$",
"this",
"->",
"setupRenderers",
"(",
"$",
"row",
")",
";",
"$",
"visible_renderers",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"renderers",
"as",
"$",
"renderer",
")"... | Whether or not this column has one or more visible cell renderers
@param mixed $row a data object containing the data for a single row
in the table store for this group. This object may
affect the visibility of renderers in this column.
@return boolean true if this column has one or more visible cell
renderers and fa... | [
"Whether",
"or",
"not",
"this",
"column",
"has",
"one",
"or",
"more",
"visible",
"cell",
"renderers"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L642-L656 |
33,894 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.displayRenderersInternal | protected function displayRenderersInternal($data)
{
if (count($this->renderers) === 1) {
$this->renderers->getFirst()->render();
} else {
$div_tag = new SwatHtmlTag('div');
$first = true;
foreach ($this->renderers as $renderer) {
if (... | php | protected function displayRenderersInternal($data)
{
if (count($this->renderers) === 1) {
$this->renderers->getFirst()->render();
} else {
$div_tag = new SwatHtmlTag('div');
$first = true;
foreach ($this->renderers as $renderer) {
if (... | [
"protected",
"function",
"displayRenderersInternal",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"renderers",
")",
"===",
"1",
")",
"{",
"$",
"this",
"->",
"renderers",
"->",
"getFirst",
"(",
")",
"->",
"render",
"(",
")",
... | Renders each cell renderer in this column
If there is once cell renderer in this column, it is rendered by itself.
If there is more than one cell renderer in this column, cell renderers
are rendered in order inside separate <i>div</i> elements. Each
<i>div</i> element is separated with a breaking space character and t... | [
"Renders",
"each",
"cell",
"renderer",
"in",
"this",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L728-L772 |
33,895 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.setupRenderers | protected function setupRenderers($data)
{
if (count($this->renderers) === 0) {
throw new SwatException(
'No renderer has been provided for this column.'
);
}
$sensitive = $this->view->isSensitive();
// Set the properties of the renderers to ... | php | protected function setupRenderers($data)
{
if (count($this->renderers) === 0) {
throw new SwatException(
'No renderer has been provided for this column.'
);
}
$sensitive = $this->view->isSensitive();
// Set the properties of the renderers to ... | [
"protected",
"function",
"setupRenderers",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"renderers",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"SwatException",
"(",
"'No renderer has been provided for this column.'",
")",
";",
"}",
... | Sets properties of renderers using data from current row
@param mixed $data the data object being used to render the cell
renderers of this field. | [
"Sets",
"properties",
"of",
"renderers",
"using",
"data",
"from",
"current",
"row"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L783-L798 |
33,896 | silverorange/swat | Swat/SwatTableViewColumn.php | SwatTableViewColumn.getCSSClassNames | protected function getCSSClassNames()
{
$classes = array();
// instance specific class
if ($this->id !== null && !$this->has_auto_id) {
$column_class = str_replace('_', '-', $this->id);
$classes[] = $column_class;
}
// base classes
$classes =... | php | protected function getCSSClassNames()
{
$classes = array();
// instance specific class
if ($this->id !== null && !$this->has_auto_id) {
$column_class = str_replace('_', '-', $this->id);
$classes[] = $column_class;
}
// base classes
$classes =... | [
"protected",
"function",
"getCSSClassNames",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"// instance specific class",
"if",
"(",
"$",
"this",
"->",
"id",
"!==",
"null",
"&&",
"!",
"$",
"this",
"->",
"has_auto_id",
")",
"{",
"$",
"column_... | Gets the array of CSS classes that are applied to this table-view column
CSS classes are added to this column in the following order:
1. a CSS class representing cells in this column's instance if this
column has an id set,
2. hard-coded CSS classes from column subclasses,
3. user-specified CSS classes on this column... | [
"Gets",
"the",
"array",
"of",
"CSS",
"classes",
"that",
"are",
"applied",
"to",
"this",
"table",
"-",
"view",
"column"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatTableViewColumn.php#L829-L875 |
33,897 | silverorange/swat | Swat/SwatButton.php | SwatButton.display | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$input_tag = $this->getInputTag();
$input_tag->display();
if (
$this->show_processing_throbber ||
$this->confirmation_message !== null
) {
... | php | public function display()
{
if (!$this->visible) {
return;
}
parent::display();
$input_tag = $this->getInputTag();
$input_tag->display();
if (
$this->show_processing_throbber ||
$this->confirmation_message !== null
) {
... | [
"public",
"function",
"display",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
"{",
"return",
";",
"}",
"parent",
"::",
"display",
"(",
")",
";",
"$",
"input_tag",
"=",
"$",
"this",
"->",
"getInputTag",
"(",
")",
";",
"$",
"in... | Displays this button
Outputs an XHTML input tag. | [
"Displays",
"this",
"button"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatButton.php#L157-L174 |
33,898 | silverorange/swat | Swat/SwatButton.php | SwatButton.process | public function process()
{
parent::process();
$data = &$this->getForm()->getFormData();
if (isset($data[$this->id])) {
$this->clicked = true;
$this->getForm()->button = $this;
}
} | php | public function process()
{
parent::process();
$data = &$this->getForm()->getFormData();
if (isset($data[$this->id])) {
$this->clicked = true;
$this->getForm()->button = $this;
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"parent",
"::",
"process",
"(",
")",
";",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getFormData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"this",
... | Does button processing
Sets whether this button has been clicked and also updates the form
this button belongs to with a reference to this button if this button
submitted the form. | [
"Does",
"button",
"processing"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatButton.php#L186-L196 |
33,899 | silverorange/swat | Swat/SwatButton.php | SwatButton.setFromStock | public function setFromStock($stock_id, $overwrite_properties = true)
{
switch ($stock_id) {
case 'submit':
$title = Swat::_('Submit');
$class = 'swat-button-submit';
break;
case 'create':
$title = Swat::_('Create');
... | php | public function setFromStock($stock_id, $overwrite_properties = true)
{
switch ($stock_id) {
case 'submit':
$title = Swat::_('Submit');
$class = 'swat-button-submit';
break;
case 'create':
$title = Swat::_('Create');
... | [
"public",
"function",
"setFromStock",
"(",
"$",
"stock_id",
",",
"$",
"overwrite_properties",
"=",
"true",
")",
"{",
"switch",
"(",
"$",
"stock_id",
")",
"{",
"case",
"'submit'",
":",
"$",
"title",
"=",
"Swat",
"::",
"_",
"(",
"'Submit'",
")",
";",
"$"... | Sets the values of this button to a stock type
Valid stock type ids are:
- submit
- create
- add
- apply
- delete
- cancel
@param string $stock_id the identifier of the stock type to use.
@param boolean $overwrite_properties whether to overwrite properties if
they are already set.
@throws SwatUndefinedStockTypeExce... | [
"Sets",
"the",
"values",
"of",
"this",
"button",
"to",
"a",
"stock",
"type"
] | e65dc5bc351927c61f594068430cdeeb874c8bc5 | https://github.com/silverorange/swat/blob/e65dc5bc351927c61f594068430cdeeb874c8bc5/Swat/SwatButton.php#L232-L278 |
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.