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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
211,700 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.secure | public function secure(array $fields = [], array $secureAttributes = [])
{
if (!$this->_View->getRequest()->getParam('_Token')) {
return '';
}
$debugSecurity = Configure::read('debug');
if (isset($secureAttributes['debugSecurity'])) {
$debugSecurity = $debugSe... | php | public function secure(array $fields = [], array $secureAttributes = [])
{
if (!$this->_View->getRequest()->getParam('_Token')) {
return '';
}
$debugSecurity = Configure::read('debug');
if (isset($secureAttributes['debugSecurity'])) {
$debugSecurity = $debugSe... | [
"public",
"function",
"secure",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"secureAttributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_View",
"->",
"getRequest",
"(",
")",
"->",
"getParam",
"(",
"'_Token'",
... | Generates a hidden field with a security hash based on the fields used in
the form.
If $secureAttributes is set, these HTML attributes will be merged into
the hidden input tags generated for the Security Component. This is
especially useful to set HTML5 attributes like 'form'.
@param array $fields If set specifies th... | [
"Generates",
"a",
"hidden",
"field",
"with",
"a",
"security",
"hash",
"based",
"on",
"the",
"fields",
"used",
"in",
"the",
"form",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L654-L692 |
211,701 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.unlockField | public function unlockField($name = null)
{
if ($name === null) {
return $this->_unlockedFields;
}
if (!in_array($name, $this->_unlockedFields)) {
$this->_unlockedFields[] = $name;
}
$index = array_search($name, $this->fields);
if ($index !== f... | php | public function unlockField($name = null)
{
if ($name === null) {
return $this->_unlockedFields;
}
if (!in_array($name, $this->_unlockedFields)) {
$this->_unlockedFields[] = $name;
}
$index = array_search($name, $this->fields);
if ($index !== f... | [
"public",
"function",
"unlockField",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_unlockedFields",
";",
"}",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",... | Add to or get the list of fields that are currently unlocked.
Unlocked fields are not included in the field hash used by SecurityComponent
unlocking a field once its been added to the list of secured fields will remove
it from the list of fields.
@param string|null $name The dot separated name for the field.
@return a... | [
"Add",
"to",
"or",
"get",
"the",
"list",
"of",
"fields",
"that",
"are",
"currently",
"unlocked",
".",
"Unlocked",
"fields",
"are",
"not",
"included",
"in",
"the",
"field",
"hash",
"used",
"by",
"SecurityComponent",
"unlocking",
"a",
"field",
"once",
"its",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L704-L717 |
211,702 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.error | public function error($field, $text = null, array $options = [])
{
if (substr($field, -5) === '._ids') {
$field = substr($field, 0, -5);
}
$options += ['escape' => true];
$context = $this->_getContext();
if (!$context->hasError($field)) {
return '';
... | php | public function error($field, $text = null, array $options = [])
{
if (substr($field, -5) === '._ids') {
$field = substr($field, 0, -5);
}
$options += ['escape' => true];
$context = $this->_getContext();
if (!$context->hasError($field)) {
return '';
... | [
"public",
"function",
"error",
"(",
"$",
"field",
",",
"$",
"text",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"field",
",",
"-",
"5",
")",
"===",
"'._ids'",
")",
"{",
"$",
"field",
"=",
... | Returns a formatted error message for given form field, '' if no errors.
Uses the `error`, `errorList` and `errorItem` templates. The `errorList` and
`errorItem` templates are used to format multiple error messages per field.
### Options:
- `escape` boolean - Whether or not to html escape the contents of the error.
... | [
"Returns",
"a",
"formatted",
"error",
"message",
"for",
"given",
"form",
"field",
"if",
"no",
"errors",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L796-L847 |
211,703 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.label | public function label($fieldName, $text = null, array $options = [])
{
if ($text === null) {
$text = $fieldName;
if (substr($text, -5) === '._ids') {
$text = substr($text, 0, -5);
}
if (strpos($text, '.') !== false) {
$fieldElem... | php | public function label($fieldName, $text = null, array $options = [])
{
if ($text === null) {
$text = $fieldName;
if (substr($text, -5) === '._ids') {
$text = substr($text, 0, -5);
}
if (strpos($text, '.') !== false) {
$fieldElem... | [
"public",
"function",
"label",
"(",
"$",
"fieldName",
",",
"$",
"text",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"text",
"===",
"null",
")",
"{",
"$",
"text",
"=",
"$",
"fieldName",
";",
"if",
"(",
"su... | Returns a formatted LABEL element for HTML forms.
Will automatically generate a `for` attribute if one is not provided.
### Options
- `for` - Set the for attribute, if its not defined the for attribute
will be generated from the $fieldName parameter using
FormHelper::_domId().
- `escape` - Set to `false` to turn off... | [
"Returns",
"a",
"formatted",
"LABEL",
"element",
"for",
"HTML",
"forms",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L907-L943 |
211,704 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.fieldset | public function fieldset($fields = '', array $options = [])
{
$fieldset = $legend = true;
$context = $this->_getContext();
$out = $fields;
if (isset($options['legend'])) {
$legend = $options['legend'];
}
if (isset($options['fieldset'])) {
$fie... | php | public function fieldset($fields = '', array $options = [])
{
$fieldset = $legend = true;
$context = $this->_getContext();
$out = $fields;
if (isset($options['legend'])) {
$legend = $options['legend'];
}
if (isset($options['fieldset'])) {
$fie... | [
"public",
"function",
"fieldset",
"(",
"$",
"fields",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"fieldset",
"=",
"$",
"legend",
"=",
"true",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"_getContext",
"(",
")",
";",
"... | Wrap a set of inputs in a fieldset
@param string $fields the form inputs to wrap in a fieldset
@param array $options Options array. Valid keys are:
- `fieldset` Set to false to disable the fieldset. You can also pass an array of params to be
applied as HTML attributes to the fieldset tag. If you pass an empty array, t... | [
"Wrap",
"a",
"set",
"of",
"inputs",
"in",
"a",
"fieldset"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1090-L1126 |
211,705 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._getInput | protected function _getInput($fieldName, $options)
{
$label = $options['labelOptions'];
unset($options['labelOptions']);
switch (strtolower($options['type'])) {
case 'select':
$opts = $options['options'];
unset($options['options']);
... | php | protected function _getInput($fieldName, $options)
{
$label = $options['labelOptions'];
unset($options['labelOptions']);
switch (strtolower($options['type'])) {
case 'select':
$opts = $options['options'];
unset($options['options']);
... | [
"protected",
"function",
"_getInput",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
"{",
"$",
"label",
"=",
"$",
"options",
"[",
"'labelOptions'",
"]",
";",
"unset",
"(",
"$",
"options",
"[",
"'labelOptions'",
"]",
")",
";",
"switch",
"(",
"strtolower... | Generates an input element
@param string $fieldName the field name
@param array $options The options for the input element
@return string The generated input element | [
"Generates",
"an",
"input",
"element"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1311-L1337 |
211,706 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._inputType | protected function _inputType($fieldName, $options)
{
$context = $this->_getContext();
if ($context->isPrimaryKey($fieldName)) {
return 'hidden';
}
if (substr($fieldName, -3) === '_id') {
return 'select';
}
$internalType = $context->type($fi... | php | protected function _inputType($fieldName, $options)
{
$context = $this->_getContext();
if ($context->isPrimaryKey($fieldName)) {
return 'hidden';
}
if (substr($fieldName, -3) === '_id') {
return 'select';
}
$internalType = $context->type($fi... | [
"protected",
"function",
"_inputType",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"_getContext",
"(",
")",
";",
"if",
"(",
"$",
"context",
"->",
"isPrimaryKey",
"(",
"$",
"fieldName",
")",
")",
"{",
... | Returns the input type that was guessed for the provided fieldName,
based on the internal type it is associated too, its name and the
variables that can be found in the view template
@param string $fieldName the name of the field to guess a type for
@param array $options the options passed to the input method
@return ... | [
"Returns",
"the",
"input",
"type",
"that",
"was",
"guessed",
"for",
"the",
"provided",
"fieldName",
"based",
"on",
"the",
"internal",
"type",
"it",
"is",
"associated",
"too",
"its",
"name",
"and",
"the",
"variables",
"that",
"can",
"be",
"found",
"in",
"th... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1368-L1401 |
211,707 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._optionsOptions | protected function _optionsOptions($fieldName, $options)
{
if (isset($options['options'])) {
return $options;
}
$pluralize = true;
if (substr($fieldName, -5) === '._ids') {
$fieldName = substr($fieldName, 0, -5);
$pluralize = false;
} else... | php | protected function _optionsOptions($fieldName, $options)
{
if (isset($options['options'])) {
return $options;
}
$pluralize = true;
if (substr($fieldName, -5) === '._ids') {
$fieldName = substr($fieldName, 0, -5);
$pluralize = false;
} else... | [
"protected",
"function",
"_optionsOptions",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'options'",
"]",
")",
")",
"{",
"return",
"$",
"options",
";",
"}",
"$",
"pluralize",
"=",
"true",
";",
"... | Selects the variable containing the options for a select field if present,
and sets the value to the 'options' key in the options array.
@param string $fieldName The name of the field to find options for.
@param array $options Options list.
@return array | [
"Selects",
"the",
"variable",
"containing",
"the",
"options",
"for",
"a",
"select",
"field",
"if",
"present",
"and",
"sets",
"the",
"value",
"to",
"the",
"options",
"key",
"in",
"the",
"options",
"array",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1411-L1439 |
211,708 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.radio | public function radio($fieldName, $options = [], array $attributes = [])
{
$attributes['options'] = $options;
$attributes['idPrefix'] = $this->_idPrefix;
$attributes = $this->_initInputField($fieldName, $attributes);
$hiddenField = isset($attributes['hiddenField']) ? $attributes['hi... | php | public function radio($fieldName, $options = [], array $attributes = [])
{
$attributes['options'] = $options;
$attributes['idPrefix'] = $this->_idPrefix;
$attributes = $this->_initInputField($fieldName, $attributes);
$hiddenField = isset($attributes['hiddenField']) ? $attributes['hi... | [
"public",
"function",
"radio",
"(",
"$",
"fieldName",
",",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributes",
"[",
"'options'",
"]",
"=",
"$",
"options",
";",
"$",
"attributes",
"[",
"'idPrefix... | Creates a set of radio widgets.
### Attributes:
- `value` - Indicates the value when this radio button is checked.
- `label` - Either `false` to disable label around the widget or an array of attributes for
the label tag. `selected` will be added to any classes e.g. `'class' => 'myclass'` where widget
is checked
- `h... | [
"Creates",
"a",
"set",
"of",
"radio",
"widgets",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1690-L1711 |
211,709 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.textarea | public function textarea($fieldName, array $options = [])
{
$options = $this->_initInputField($fieldName, $options);
unset($options['type']);
return $this->widget('textarea', $options);
} | php | public function textarea($fieldName, array $options = [])
{
$options = $this->_initInputField($fieldName, $options);
unset($options['type']);
return $this->widget('textarea', $options);
} | [
"public",
"function",
"textarea",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_initInputField",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
";",
"unset",
"(",
"$",
"optio... | Creates a textarea widget.
### Options:
- `escape` - Whether or not the contents of the textarea should be escaped. Defaults to true.
@param string $fieldName Name of a field, in the form "modelname.fieldname"
@param array $options Array of HTML attributes, and special options above.
@return string A generated HTML ... | [
"Creates",
"a",
"textarea",
"widget",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1765-L1771 |
211,710 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.hidden | public function hidden($fieldName, array $options = [])
{
$options += ['required' => false, 'secure' => true];
$secure = $options['secure'];
unset($options['secure']);
$options = $this->_initInputField($fieldName, array_merge(
$options,
['secure' => static::... | php | public function hidden($fieldName, array $options = [])
{
$options += ['required' => false, 'secure' => true];
$secure = $options['secure'];
unset($options['secure']);
$options = $this->_initInputField($fieldName, array_merge(
$options,
['secure' => static::... | [
"public",
"function",
"hidden",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'required'",
"=>",
"false",
",",
"'secure'",
"=>",
"true",
"]",
";",
"$",
"secure",
"=",
"$",
"options",
"[",
... | Creates a hidden input field.
@param string $fieldName Name of a field, in the form of "modelname.fieldname"
@param array $options Array of HTML attributes.
@return string A generated hidden input
@link https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-hidden-inputs | [
"Creates",
"a",
"hidden",
"input",
"field",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L1781-L1800 |
211,711 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.multiCheckbox | public function multiCheckbox($fieldName, $options, array $attributes = [])
{
$attributes += [
'disabled' => null,
'escape' => true,
'hiddenField' => true,
'secure' => true,
];
$attributes = $this->_initInputField($fieldName, $attributes);
... | php | public function multiCheckbox($fieldName, $options, array $attributes = [])
{
$attributes += [
'disabled' => null,
'escape' => true,
'hiddenField' => true,
'secure' => true,
];
$attributes = $this->_initInputField($fieldName, $attributes);
... | [
"public",
"function",
"multiCheckbox",
"(",
"$",
"fieldName",
",",
"$",
"options",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributes",
"+=",
"[",
"'disabled'",
"=>",
"null",
",",
"'escape'",
"=>",
"true",
",",
"'hiddenField'",
"=... | Creates a set of checkboxes out of options.
### Options
- `escape` - If true contents of options will be HTML entity encoded. Defaults to true.
- `val` The selected value of the input.
- `class` - When using multiple = checkbox the class name to apply to the divs. Defaults to 'checkbox'.
- `disabled` - Control the di... | [
"Creates",
"a",
"set",
"of",
"checkboxes",
"out",
"of",
"options",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2212-L2237 |
211,712 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._singleDatetime | protected function _singleDatetime($options, $keep)
{
$off = array_diff($this->_datetimeParts, [$keep]);
$off = array_combine(
$off,
array_fill(0, count($off), false)
);
$attributes = array_diff_key(
$options,
array_flip(array_merge($t... | php | protected function _singleDatetime($options, $keep)
{
$off = array_diff($this->_datetimeParts, [$keep]);
$off = array_combine(
$off,
array_fill(0, count($off), false)
);
$attributes = array_diff_key(
$options,
array_flip(array_merge($t... | [
"protected",
"function",
"_singleDatetime",
"(",
"$",
"options",
",",
"$",
"keep",
")",
"{",
"$",
"off",
"=",
"array_diff",
"(",
"$",
"this",
"->",
"_datetimeParts",
",",
"[",
"$",
"keep",
"]",
")",
";",
"$",
"off",
"=",
"array_combine",
"(",
"$",
"o... | Helper method for the various single datetime component methods.
@param array $options The options array.
@param string $keep The option to not disable.
@return array | [
"Helper",
"method",
"for",
"the",
"various",
"single",
"datetime",
"component",
"methods",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2246-L2265 |
211,713 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.day | public function day($fieldName = null, array $options = [])
{
$options = $this->_singleDatetime($options, 'day');
if (isset($options['val']) && $options['val'] > 0 && $options['val'] <= 31) {
$options['val'] = [
'year' => date('Y'),
'month' => date('m'),
... | php | public function day($fieldName = null, array $options = [])
{
$options = $this->_singleDatetime($options, 'day');
if (isset($options['val']) && $options['val'] > 0 && $options['val'] <= 31) {
$options['val'] = [
'year' => date('Y'),
'month' => date('m'),
... | [
"public",
"function",
"day",
"(",
"$",
"fieldName",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_singleDatetime",
"(",
"$",
"options",
",",
"'day'",
")",
";",
"if",
"(",
"isset",
"(",... | Returns a SELECT element for days.
### Options:
- `empty` - If true, the empty select option is shown. If a string,
that string is displayed as the empty element.
- `value` The selected value of the input.
@param string|null $fieldName Prefix name for the SELECT element
@param array $options Options & HTML attribute... | [
"Returns",
"a",
"SELECT",
"element",
"for",
"days",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2281-L2294 |
211,714 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.year | public function year($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'year');
$len = isset($options['val']) ? strlen($options['val']) : 0;
if (isset($options['val']) && $len > 0 && $len < 5) {
$options['val'] = [
'year' => (int)$opt... | php | public function year($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'year');
$len = isset($options['val']) ? strlen($options['val']) : 0;
if (isset($options['val']) && $len > 0 && $len < 5) {
$options['val'] = [
'year' => (int)$opt... | [
"public",
"function",
"year",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_singleDatetime",
"(",
"$",
"options",
",",
"'year'",
")",
";",
"$",
"len",
"=",
"isset",
"(",
"$",... | Returns a SELECT element for years
### Attributes:
- `empty` - If true, the empty select option is shown. If a string,
that string is displayed as the empty element.
- `orderYear` - Ordering of year values in select options.
Possible values 'asc', 'desc'. Default 'desc'
- `value` The selected value of the input.
- `m... | [
"Returns",
"a",
"SELECT",
"element",
"for",
"years"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2314-L2328 |
211,715 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.month | public function month($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'month');
if (isset($options['val']) && $options['val'] > 0 && $options['val'] <= 12) {
$options['val'] = [
'year' => date('Y'),
'month' => (int)$options[... | php | public function month($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'month');
if (isset($options['val']) && $options['val'] > 0 && $options['val'] <= 12) {
$options['val'] = [
'year' => date('Y'),
'month' => (int)$options[... | [
"public",
"function",
"month",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_singleDatetime",
"(",
"$",
"options",
",",
"'month'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"op... | Returns a SELECT element for months.
### Options:
- `monthNames` - If false, 2 digit numbers will be used instead of text.
If an array, the given array will be used.
- `empty` - If true, the empty select option is shown. If a string,
that string is displayed as the empty element.
- `value` The selected value of the i... | [
"Returns",
"a",
"SELECT",
"element",
"for",
"months",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2346-L2359 |
211,716 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.meridian | public function meridian($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'meridian');
if (isset($options['val'])) {
$hour = date('H');
$options['val'] = [
'hour' => $hour,
'minute' => (int)$options['val'],
... | php | public function meridian($fieldName, array $options = [])
{
$options = $this->_singleDatetime($options, 'meridian');
if (isset($options['val'])) {
$hour = date('H');
$options['val'] = [
'hour' => $hour,
'minute' => (int)$options['val'],
... | [
"public",
"function",
"meridian",
"(",
"$",
"fieldName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_singleDatetime",
"(",
"$",
"options",
",",
"'meridian'",
")",
";",
"if",
"(",
"isset",
"(",
"$",... | Returns a SELECT element for AM or PM.
### Attributes:
- `empty` - If true, the empty select option is shown. If a string,
that string is displayed as the empty element.
- `value` The selected value of the input.
@param string $fieldName Prefix name for the SELECT element
@param array $options Array of options
@retu... | [
"Returns",
"a",
"SELECT",
"element",
"for",
"AM",
"or",
"PM",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2439-L2453 |
211,717 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._isDisabled | protected function _isDisabled(array $options)
{
if (!isset($options['disabled'])) {
return false;
}
if (is_scalar($options['disabled'])) {
return ($options['disabled'] === true || $options['disabled'] === 'disabled');
}
if (!isset($options['options'])... | php | protected function _isDisabled(array $options)
{
if (!isset($options['disabled'])) {
return false;
}
if (is_scalar($options['disabled'])) {
return ($options['disabled'] === true || $options['disabled'] === 'disabled');
}
if (!isset($options['options'])... | [
"protected",
"function",
"_isDisabled",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'disabled'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_scalar",
"(",
"$",
"options",
"[",
"'disa... | Determine if a field is disabled.
@param array $options The option set.
@return bool Whether or not the field is disabled. | [
"Determine",
"if",
"a",
"field",
"is",
"disabled",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2736-L2764 |
211,718 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.context | public function context($context = null)
{
if ($context instanceof ContextInterface) {
$this->_context = $context;
}
return $this->_getContext();
} | php | public function context($context = null)
{
if ($context instanceof ContextInterface) {
$this->_context = $context;
}
return $this->_getContext();
} | [
"public",
"function",
"context",
"(",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"context",
"instanceof",
"ContextInterface",
")",
"{",
"$",
"this",
"->",
"_context",
"=",
"$",
"context",
";",
"}",
"return",
"$",
"this",
"->",
"_getContext",
... | Get the context instance for the current form set.
If there is no active form null will be returned.
@param \Cake\View\Form\ContextInterface|null $context Either the new context when setting, or null to get.
@return \Cake\View\Form\ContextInterface The context for the form. | [
"Get",
"the",
"context",
"instance",
"for",
"the",
"current",
"form",
"set",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2822-L2829 |
211,719 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper._getContext | protected function _getContext($data = [])
{
if (isset($this->_context) && empty($data)) {
return $this->_context;
}
$data += ['entity' => null];
return $this->_context = $this->contextFactory()
->get($this->_View->getRequest(), $data);
} | php | protected function _getContext($data = [])
{
if (isset($this->_context) && empty($data)) {
return $this->_context;
}
$data += ['entity' => null];
return $this->_context = $this->contextFactory()
->get($this->_View->getRequest(), $data);
} | [
"protected",
"function",
"_getContext",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_context",
")",
"&&",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_context",
";",
"}",
"$"... | Find the matching context provider for the data.
If no type can be matched a NullContext will be returned.
@param mixed $data The data to get a context provider for.
@return \Cake\View\Form\ContextInterface Context provider.
@throws \RuntimeException when the context class does not implement the
ContextInterface. | [
"Find",
"the",
"matching",
"context",
"provider",
"for",
"the",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2841-L2850 |
211,720 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.widget | public function widget($name, array $data = [])
{
$secure = null;
if (isset($data['secure'])) {
$secure = $data['secure'];
unset($data['secure']);
}
$widget = $this->_locator->get($name);
$out = $widget->render($data, $this->context());
if (iss... | php | public function widget($name, array $data = [])
{
$secure = null;
if (isset($data['secure'])) {
$secure = $data['secure'];
unset($data['secure']);
}
$widget = $this->_locator->get($name);
$out = $widget->render($data, $this->context());
if (iss... | [
"public",
"function",
"widget",
"(",
"$",
"name",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"secure",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'secure'",
"]",
")",
")",
"{",
"$",
"secure",
"=",
"$",
"data",
... | Render a named widget.
This is a lower level method. For built-in widgets, you should be using
methods like `text`, `hidden`, and `radio`. If you are using additional
widgets you should use this method render the widget without the label
or wrapping div.
@param string $name The name of the widget. e.g. 'text'.
@param... | [
"Render",
"a",
"named",
"widget",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2879-L2895 |
211,721 | cakephp/cakephp | src/View/Helper/FormHelper.php | FormHelper.getSourceValue | public function getSourceValue($fieldname, $options = [])
{
$valueMap = [
'data' => 'getData',
'query' => 'getQuery'
];
foreach ($this->getValueSources() as $valuesSource) {
if ($valuesSource === 'context') {
$val = $this->_getContext()->va... | php | public function getSourceValue($fieldname, $options = [])
{
$valueMap = [
'data' => 'getData',
'query' => 'getQuery'
];
foreach ($this->getValueSources() as $valuesSource) {
if ($valuesSource === 'context') {
$val = $this->_getContext()->va... | [
"public",
"function",
"getSourceValue",
"(",
"$",
"fieldname",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"valueMap",
"=",
"[",
"'data'",
"=>",
"'getData'",
",",
"'query'",
"=>",
"'getQuery'",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getVa... | Gets a single field value from the sources available.
@param string $fieldname The fieldname to fetch the value for.
@param array|null $options The options containing default values.
@return string|null Field value derived from sources or defaults. | [
"Gets",
"a",
"single",
"field",
"value",
"from",
"the",
"sources",
"available",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/FormHelper.php#L2954-L2977 |
211,722 | cakephp/cakephp | src/Shell/Task/CommandTask.php | CommandTask.getShellList | public function getShellList()
{
$skipFiles = ['app'];
$hiddenCommands = ['command_list', 'completion'];
$plugins = Plugin::loaded();
$shellList = array_fill_keys($plugins, null) + ['CORE' => null, 'app' => null];
$appPath = App::path('Shell');
$shellList = $this->_f... | php | public function getShellList()
{
$skipFiles = ['app'];
$hiddenCommands = ['command_list', 'completion'];
$plugins = Plugin::loaded();
$shellList = array_fill_keys($plugins, null) + ['CORE' => null, 'app' => null];
$appPath = App::path('Shell');
$shellList = $this->_f... | [
"public",
"function",
"getShellList",
"(",
")",
"{",
"$",
"skipFiles",
"=",
"[",
"'app'",
"]",
";",
"$",
"hiddenCommands",
"=",
"[",
"'command_list'",
",",
"'completion'",
"]",
";",
"$",
"plugins",
"=",
"Plugin",
"::",
"loaded",
"(",
")",
";",
"$",
"sh... | Gets the shell command listing.
@return array | [
"Gets",
"the",
"shell",
"command",
"listing",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/CommandTask.php#L37-L63 |
211,723 | cakephp/cakephp | src/Shell/Task/CommandTask.php | CommandTask.commands | public function commands()
{
$shellList = $this->getShellList();
$flatten = Hash::flatten($shellList);
$duplicates = array_intersect($flatten, array_unique(array_diff_key($flatten, array_unique($flatten))));
$duplicates = Hash::expand($duplicates);
$options = [];
for... | php | public function commands()
{
$shellList = $this->getShellList();
$flatten = Hash::flatten($shellList);
$duplicates = array_intersect($flatten, array_unique(array_diff_key($flatten, array_unique($flatten))));
$duplicates = Hash::expand($duplicates);
$options = [];
for... | [
"public",
"function",
"commands",
"(",
")",
"{",
"$",
"shellList",
"=",
"$",
"this",
"->",
"getShellList",
"(",
")",
";",
"$",
"flatten",
"=",
"Hash",
"::",
"flatten",
"(",
"$",
"shellList",
")",
";",
"$",
"duplicates",
"=",
"array_intersect",
"(",
"$"... | Return a list of all commands
@return array | [
"Return",
"a",
"list",
"of",
"all",
"commands"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/CommandTask.php#L137-L160 |
211,724 | cakephp/cakephp | src/Shell/Task/CommandTask.php | CommandTask.subCommands | public function subCommands($commandName)
{
$Shell = $this->getShell($commandName);
if (!$Shell) {
return [];
}
$taskMap = $this->Tasks->normalizeArray((array)$Shell->tasks);
$return = array_keys($taskMap);
$return = array_map('Cake\Utility\Inflector::un... | php | public function subCommands($commandName)
{
$Shell = $this->getShell($commandName);
if (!$Shell) {
return [];
}
$taskMap = $this->Tasks->normalizeArray((array)$Shell->tasks);
$return = array_keys($taskMap);
$return = array_map('Cake\Utility\Inflector::un... | [
"public",
"function",
"subCommands",
"(",
"$",
"commandName",
")",
"{",
"$",
"Shell",
"=",
"$",
"this",
"->",
"getShell",
"(",
"$",
"commandName",
")",
";",
"if",
"(",
"!",
"$",
"Shell",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"taskMap",
"=",
... | Return a list of subcommands for a given command
@param string $commandName The command you want subcommands from.
@return string[]
@throws \ReflectionException | [
"Return",
"a",
"list",
"of",
"subcommands",
"for",
"a",
"given",
"command"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/CommandTask.php#L169-L199 |
211,725 | cakephp/cakephp | src/Shell/Task/CommandTask.php | CommandTask.getShell | public function getShell($commandName)
{
list($pluginDot, $name) = pluginSplit($commandName, true);
if (in_array(strtolower($pluginDot), ['app.', 'core.'])) {
$commandName = $name;
$pluginDot = '';
}
if (!in_array($commandName, $this->commands()) && (empty($... | php | public function getShell($commandName)
{
list($pluginDot, $name) = pluginSplit($commandName, true);
if (in_array(strtolower($pluginDot), ['app.', 'core.'])) {
$commandName = $name;
$pluginDot = '';
}
if (!in_array($commandName, $this->commands()) && (empty($... | [
"public",
"function",
"getShell",
"(",
"$",
"commandName",
")",
"{",
"list",
"(",
"$",
"pluginDot",
",",
"$",
"name",
")",
"=",
"pluginSplit",
"(",
"$",
"commandName",
",",
"true",
")",
";",
"if",
"(",
"in_array",
"(",
"strtolower",
"(",
"$",
"pluginDo... | Get Shell instance for the given command
@param string $commandName The command you want.
@return \Cake\Console\Shell|bool Shell instance if the command can be found, false otherwise. | [
"Get",
"Shell",
"instance",
"for",
"the",
"given",
"command"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/CommandTask.php#L207-L247 |
211,726 | cakephp/cakephp | src/Shell/Task/CommandTask.php | CommandTask.options | public function options($commandName, $subCommandName = '')
{
$Shell = $this->getShell($commandName);
if (!$Shell) {
return [];
}
$parser = $Shell->getOptionParser();
if (!empty($subCommandName)) {
$subCommandName = Inflector::camelize($subCommandNa... | php | public function options($commandName, $subCommandName = '')
{
$Shell = $this->getShell($commandName);
if (!$Shell) {
return [];
}
$parser = $Shell->getOptionParser();
if (!empty($subCommandName)) {
$subCommandName = Inflector::camelize($subCommandNa... | [
"public",
"function",
"options",
"(",
"$",
"commandName",
",",
"$",
"subCommandName",
"=",
"''",
")",
"{",
"$",
"Shell",
"=",
"$",
"this",
"->",
"getShell",
"(",
"$",
"commandName",
")",
";",
"if",
"(",
"!",
"$",
"Shell",
")",
"{",
"return",
"[",
"... | Get options list for the given command or subcommand
@param string $commandName The command to get options for.
@param string $subCommandName The subcommand to get options for. Can be empty to get options for the command.
If this parameter is used, the subcommand must be a valid subcommand of the command passed
@retur... | [
"Get",
"options",
"list",
"for",
"the",
"given",
"command",
"or",
"subcommand"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/CommandTask.php#L257-L288 |
211,727 | cakephp/cakephp | src/Utility/Inflector.php | Inflector.delimit | public static function delimit($string, $delimiter = '_')
{
$cacheKey = __FUNCTION__ . $delimiter;
$result = static::_cache($cacheKey, $string);
if ($result === false) {
$result = mb_strtolower(preg_replace('/(?<=\\w)([A-Z])/', $delimiter . '\\1', $string));
static:... | php | public static function delimit($string, $delimiter = '_')
{
$cacheKey = __FUNCTION__ . $delimiter;
$result = static::_cache($cacheKey, $string);
if ($result === false) {
$result = mb_strtolower(preg_replace('/(?<=\\w)([A-Z])/', $delimiter . '\\1', $string));
static:... | [
"public",
"static",
"function",
"delimit",
"(",
"$",
"string",
",",
"$",
"delimiter",
"=",
"'_'",
")",
"{",
"$",
"cacheKey",
"=",
"__FUNCTION__",
".",
"$",
"delimiter",
";",
"$",
"result",
"=",
"static",
"::",
"_cache",
"(",
"$",
"cacheKey",
",",
"$",
... | Expects a CamelCasedInputString, and produces a lower_case_delimited_string
@param string $string String to delimit
@param string $delimiter the character to use as a delimiter
@return string delimited string | [
"Expects",
"a",
"CamelCasedInputString",
"and",
"produces",
"a",
"lower_case_delimited_string"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Inflector.php#L669-L681 |
211,728 | cakephp/cakephp | src/Routing/Route/EntityRoute.php | EntityRoute.match | public function match(array $url, array $context = [])
{
if (empty($this->_compiledRoute)) {
$this->compile();
}
if (isset($url['_entity'])) {
$entity = $url['_entity'];
$this->_checkEntity($entity);
foreach ($this->keys as $field) {
... | php | public function match(array $url, array $context = [])
{
if (empty($this->_compiledRoute)) {
$this->compile();
}
if (isset($url['_entity'])) {
$entity = $url['_entity'];
$this->_checkEntity($entity);
foreach ($this->keys as $field) {
... | [
"public",
"function",
"match",
"(",
"array",
"$",
"url",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_compiledRoute",
")",
")",
"{",
"$",
"this",
"->",
"compile",
"(",
")",
";",
"}",
"if",
... | Match by entity and map its fields to the URL pattern by comparing the
field names with the template vars.
If a routing key is defined in both `$url` and the entity, the value defined
in `$url` will be preferred.
@param array $url Array of parameters to convert to a string.
@param array $context An array of the curre... | [
"Match",
"by",
"entity",
"and",
"map",
"its",
"fields",
"to",
"the",
"URL",
"pattern",
"by",
"comparing",
"the",
"field",
"names",
"with",
"the",
"template",
"vars",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/EntityRoute.php#L42-L60 |
211,729 | cakephp/cakephp | src/Routing/Route/EntityRoute.php | EntityRoute._checkEntity | protected function _checkEntity($entity)
{
if (!$entity instanceof ArrayAccess && !is_array($entity)) {
throw new RuntimeException(sprintf(
'Route `%s` expects the URL option `_entity` to be an array or object implementing \ArrayAccess, but `%s` passed.',
$this->t... | php | protected function _checkEntity($entity)
{
if (!$entity instanceof ArrayAccess && !is_array($entity)) {
throw new RuntimeException(sprintf(
'Route `%s` expects the URL option `_entity` to be an array or object implementing \ArrayAccess, but `%s` passed.',
$this->t... | [
"protected",
"function",
"_checkEntity",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"ArrayAccess",
"&&",
"!",
"is_array",
"(",
"$",
"entity",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"sprintf",
"(",
"'Route `%... | Checks that we really deal with an entity object
@throws \RuntimeException
@param \ArrayAccess|array $entity Entity value from the URL options
@return void | [
"Checks",
"that",
"we",
"really",
"deal",
"with",
"an",
"entity",
"object"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/EntityRoute.php#L69-L78 |
211,730 | cakephp/cakephp | src/Shell/CompletionShell.php | CompletionShell.options | public function options()
{
$commandName = $subCommandName = '';
if (!empty($this->args[0])) {
$commandName = $this->args[0];
}
if (!empty($this->args[1])) {
$subCommandName = $this->args[1];
}
$options = $this->Command->options($commandName, $... | php | public function options()
{
$commandName = $subCommandName = '';
if (!empty($this->args[0])) {
$commandName = $this->args[0];
}
if (!empty($this->args[1])) {
$subCommandName = $this->args[1];
}
$options = $this->Command->options($commandName, $... | [
"public",
"function",
"options",
"(",
")",
"{",
"$",
"commandName",
"=",
"$",
"subCommandName",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"args",
"[",
"0",
"]",
")",
")",
"{",
"$",
"commandName",
"=",
"$",
"this",
"->",
"ar... | list options for the named command
@return int|bool|null Returns the number of bytes returned from writing to stdout. | [
"list",
"options",
"for",
"the",
"named",
"command"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/CompletionShell.php#L70-L82 |
211,731 | cakephp/cakephp | src/Shell/CompletionShell.php | CompletionShell.subcommands | public function subcommands()
{
if (!$this->args) {
return $this->_output();
}
$options = $this->Command->subCommands($this->args[0]);
return $this->_output($options);
} | php | public function subcommands()
{
if (!$this->args) {
return $this->_output();
}
$options = $this->Command->subCommands($this->args[0]);
return $this->_output($options);
} | [
"public",
"function",
"subcommands",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"args",
")",
"{",
"return",
"$",
"this",
"->",
"_output",
"(",
")",
";",
"}",
"$",
"options",
"=",
"$",
"this",
"->",
"Command",
"->",
"subCommands",
"(",
"$",
... | list subcommands for the named command
@return int|bool|null Returns the number of bytes returned from writing to stdout.
@throws \ReflectionException | [
"list",
"subcommands",
"for",
"the",
"named",
"command"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/CompletionShell.php#L90-L99 |
211,732 | cakephp/cakephp | src/Routing/Filter/LocaleSelectorFilter.php | LocaleSelectorFilter.beforeDispatch | public function beforeDispatch(Event $event)
{
/* @var \Cake\Http\ServerRequest $request */
$request = $event->getData('request');
$locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language'));
if (!$locale || (!empty($this->_locales) && !in_array($locale, $this->_loc... | php | public function beforeDispatch(Event $event)
{
/* @var \Cake\Http\ServerRequest $request */
$request = $event->getData('request');
$locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language'));
if (!$locale || (!empty($this->_locales) && !in_array($locale, $this->_loc... | [
"public",
"function",
"beforeDispatch",
"(",
"Event",
"$",
"event",
")",
"{",
"/* @var \\Cake\\Http\\ServerRequest $request */",
"$",
"request",
"=",
"$",
"event",
"->",
"getData",
"(",
"'request'",
")",
";",
"$",
"locale",
"=",
"Locale",
"::",
"acceptFromHttp",
... | Inspects the request for the Accept-Language header and sets the
Locale for the current runtime if it matches the list of valid locales
as passed in the configuration.
@param \Cake\Event\Event $event The event instance.
@return void | [
"Inspects",
"the",
"request",
"for",
"the",
"Accept",
"-",
"Language",
"header",
"and",
"sets",
"the",
"Locale",
"for",
"the",
"current",
"runtime",
"if",
"it",
"matches",
"the",
"list",
"of",
"valid",
"locales",
"as",
"passed",
"in",
"the",
"configuration",... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Filter/LocaleSelectorFilter.php#L59-L70 |
211,733 | cakephp/cakephp | src/View/Helper/TimeHelper.php | TimeHelper.toAtom | public function toAtom($dateString, $timezone = null)
{
$timezone = $this->_getTimezone($timezone) ?: date_default_timezone_get();
return (new Time($dateString))->timezone($timezone)->toAtomString();
} | php | public function toAtom($dateString, $timezone = null)
{
$timezone = $this->_getTimezone($timezone) ?: date_default_timezone_get();
return (new Time($dateString))->timezone($timezone)->toAtomString();
} | [
"public",
"function",
"toAtom",
"(",
"$",
"dateString",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"$",
"timezone",
"=",
"$",
"this",
"->",
"_getTimezone",
"(",
"$",
"timezone",
")",
"?",
":",
"date_default_timezone_get",
"(",
")",
";",
"return",
"(",
... | Returns a date formatted for Atom RSS feeds.
@param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@param string|\DateTimeZone|null $timezone User's timezone string or DateTimeZone object
@return string Formatted date string
@see \Cake\I18n\Time::toAtom() | [
"Returns",
"a",
"date",
"formatted",
"for",
"Atom",
"RSS",
"feeds",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/TimeHelper.php#L219-L224 |
211,734 | cakephp/cakephp | src/View/Helper/TimeHelper.php | TimeHelper.toRss | public function toRss($dateString, $timezone = null)
{
$timezone = $this->_getTimezone($timezone) ?: date_default_timezone_get();
return (new Time($dateString))->timezone($timezone)->toRssString();
} | php | public function toRss($dateString, $timezone = null)
{
$timezone = $this->_getTimezone($timezone) ?: date_default_timezone_get();
return (new Time($dateString))->timezone($timezone)->toRssString();
} | [
"public",
"function",
"toRss",
"(",
"$",
"dateString",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"$",
"timezone",
"=",
"$",
"this",
"->",
"_getTimezone",
"(",
"$",
"timezone",
")",
"?",
":",
"date_default_timezone_get",
"(",
")",
";",
"return",
"(",
... | Formats date for RSS feeds
@param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
@param string|\DateTimeZone|null $timezone User's timezone string or DateTimeZone object
@return string Formatted date string | [
"Formats",
"date",
"for",
"RSS",
"feeds"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/TimeHelper.php#L233-L238 |
211,735 | cakephp/cakephp | src/View/Helper/TimeHelper.php | TimeHelper.timeAgoInWords | public function timeAgoInWords($dateTime, array $options = [])
{
$element = null;
$options += [
'element' => null,
'timezone' => null
];
$options['timezone'] = $this->_getTimezone($options['timezone']);
if ($options['timezone']) {
$dateTime... | php | public function timeAgoInWords($dateTime, array $options = [])
{
$element = null;
$options += [
'element' => null,
'timezone' => null
];
$options['timezone'] = $this->_getTimezone($options['timezone']);
if ($options['timezone']) {
$dateTime... | [
"public",
"function",
"timeAgoInWords",
"(",
"$",
"dateTime",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"element",
"=",
"null",
";",
"$",
"options",
"+=",
"[",
"'element'",
"=>",
"null",
",",
"'timezone'",
"=>",
"null",
"]",
";",
"$... | Formats a date into a phrase expressing the relative time.
### Additional options
- `element` - The element to wrap the formatted time in.
Has a few additional options:
- `tag` - The tag to use, defaults to 'span'.
- `class` - The class name to use, defaults to `time-ago-in-words`.
- `title` - Defaults to the $dateTi... | [
"Formats",
"a",
"date",
"into",
"a",
"phrase",
"expressing",
"the",
"relative",
"time",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/TimeHelper.php#L256-L296 |
211,736 | cakephp/cakephp | src/View/Helper/TimeHelper.php | TimeHelper.wasWithinLast | public function wasWithinLast($timeInterval, $dateString, $timezone = null)
{
return (new Time($dateString, $timezone))->wasWithinLast($timeInterval);
} | php | public function wasWithinLast($timeInterval, $dateString, $timezone = null)
{
return (new Time($dateString, $timezone))->wasWithinLast($timeInterval);
} | [
"public",
"function",
"wasWithinLast",
"(",
"$",
"timeInterval",
",",
"$",
"dateString",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"return",
"(",
"new",
"Time",
"(",
"$",
"dateString",
",",
"$",
"timezone",
")",
")",
"->",
"wasWithinLast",
"(",
"$",
... | Returns true if specified datetime was within the interval specified, else false.
@param string|int $timeInterval the numeric value with space then time type.
Example of valid types: 6 hours, 2 days, 1 minute.
Integer input values are deprecated and support will be removed in 4.0.0
@param int|string|\DateTime $dateStr... | [
"Returns",
"true",
"if",
"specified",
"datetime",
"was",
"within",
"the",
"interval",
"specified",
"else",
"false",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/TimeHelper.php#L309-L312 |
211,737 | cakephp/cakephp | src/View/Helper/TimeHelper.php | TimeHelper.isWithinNext | public function isWithinNext($timeInterval, $dateString, $timezone = null)
{
return (new Time($dateString, $timezone))->isWithinNext($timeInterval);
} | php | public function isWithinNext($timeInterval, $dateString, $timezone = null)
{
return (new Time($dateString, $timezone))->isWithinNext($timeInterval);
} | [
"public",
"function",
"isWithinNext",
"(",
"$",
"timeInterval",
",",
"$",
"dateString",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"return",
"(",
"new",
"Time",
"(",
"$",
"dateString",
",",
"$",
"timezone",
")",
")",
"->",
"isWithinNext",
"(",
"$",
"... | Returns true if specified datetime is within the interval specified, else false.
@param string|int $timeInterval the numeric value with space then time type.
Example of valid types: 6 hours, 2 days, 1 minute.
Integer input values are deprecated and support will be removed in 4.0.0
@param int|string|\DateTime $dateStri... | [
"Returns",
"true",
"if",
"specified",
"datetime",
"is",
"within",
"the",
"interval",
"specified",
"else",
"false",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/TimeHelper.php#L325-L328 |
211,738 | cakephp/cakephp | src/Core/Configure/Engine/IniConfig.php | IniConfig.read | public function read($key)
{
$file = $this->_getFilePath($key, true);
$contents = parse_ini_file($file, true);
if ($this->_section && isset($contents[$this->_section])) {
$values = $this->_parseNestedValues($contents[$this->_section]);
} else {
$values = [];
... | php | public function read($key)
{
$file = $this->_getFilePath($key, true);
$contents = parse_ini_file($file, true);
if ($this->_section && isset($contents[$this->_section])) {
$values = $this->_parseNestedValues($contents[$this->_section]);
} else {
$values = [];
... | [
"public",
"function",
"read",
"(",
"$",
"key",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"_getFilePath",
"(",
"$",
"key",
",",
"true",
")",
";",
"$",
"contents",
"=",
"parse_ini_file",
"(",
"$",
"file",
",",
"true",
")",
";",
"if",
"(",
"$",... | Read an ini file and return the results as an array.
@param string $key The identifier to read from. If the key has a . it will be treated
as a plugin prefix. The chosen file must be on the engine's path.
@return array Parsed configuration values.
@throws \Cake\Core\Exception\Exception when files don't exist.
Or when ... | [
"Read",
"an",
"ini",
"file",
"and",
"return",
"the",
"results",
"as",
"an",
"array",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/Configure/Engine/IniConfig.php#L99-L119 |
211,739 | cakephp/cakephp | src/Core/Configure/Engine/IniConfig.php | IniConfig._parseNestedValues | protected function _parseNestedValues($values)
{
foreach ($values as $key => $value) {
if ($value === '1') {
$value = true;
}
if ($value === '') {
$value = false;
}
unset($values[$key]);
if (strpos($key, ... | php | protected function _parseNestedValues($values)
{
foreach ($values as $key => $value) {
if ($value === '1') {
$value = true;
}
if ($value === '') {
$value = false;
}
unset($values[$key]);
if (strpos($key, ... | [
"protected",
"function",
"_parseNestedValues",
"(",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"'1'",
")",
"{",
"$",
"value",
"=",
"true",
";",
"}",
"if",
... | parses nested values out of keys.
@param array $values Values to be exploded.
@return array Array of values exploded | [
"parses",
"nested",
"values",
"out",
"of",
"keys",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/Configure/Engine/IniConfig.php#L127-L145 |
211,740 | cakephp/cakephp | src/Core/Configure/Engine/IniConfig.php | IniConfig.dump | public function dump($key, array $data)
{
$result = [];
foreach ($data as $k => $value) {
$isSection = false;
if ($k[0] !== '[') {
$result[] = "[$k]";
$isSection = true;
}
if (is_array($value)) {
$kValues... | php | public function dump($key, array $data)
{
$result = [];
foreach ($data as $k => $value) {
$isSection = false;
if ($k[0] !== '[') {
$result[] = "[$k]";
$isSection = true;
}
if (is_array($value)) {
$kValues... | [
"public",
"function",
"dump",
"(",
"$",
"key",
",",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"k",
"=>",
"$",
"value",
")",
"{",
"$",
"isSection",
"=",
"false",
";",
"if",
"(",
... | Dumps the state of Configure data into an ini formatted string.
@param string $key The identifier to write to. If the key has a . it will be treated
as a plugin prefix.
@param array $data The data to convert to ini file.
@return bool Success. | [
"Dumps",
"the",
"state",
"of",
"Configure",
"data",
"into",
"an",
"ini",
"formatted",
"string",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/Configure/Engine/IniConfig.php#L155-L179 |
211,741 | cakephp/cakephp | src/Core/Configure/Engine/IniConfig.php | IniConfig._value | protected function _value($value)
{
if ($value === null) {
return 'null';
}
if ($value === true) {
return 'true';
}
if ($value === false) {
return 'false';
}
return (string)$value;
} | php | protected function _value($value)
{
if ($value === null) {
return 'null';
}
if ($value === true) {
return 'true';
}
if ($value === false) {
return 'false';
}
return (string)$value;
} | [
"protected",
"function",
"_value",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"'null'",
";",
"}",
"if",
"(",
"$",
"value",
"===",
"true",
")",
"{",
"return",
"'true'",
";",
"}",
"if",
"(",
"$",
"value... | Converts a value into the ini equivalent
@param mixed $value Value to export.
@return string String value for ini file. | [
"Converts",
"a",
"value",
"into",
"the",
"ini",
"equivalent"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/Configure/Engine/IniConfig.php#L187-L200 |
211,742 | cakephp/cakephp | src/View/Widget/RadioWidget.php | RadioWidget._isDisabled | protected function _isDisabled($radio, $disabled)
{
if (!$disabled) {
return false;
}
if ($disabled === true) {
return true;
}
$isNumeric = is_numeric($radio['value']);
return (!is_array($disabled) || in_array((string)$radio['value'], $disable... | php | protected function _isDisabled($radio, $disabled)
{
if (!$disabled) {
return false;
}
if ($disabled === true) {
return true;
}
$isNumeric = is_numeric($radio['value']);
return (!is_array($disabled) || in_array((string)$radio['value'], $disable... | [
"protected",
"function",
"_isDisabled",
"(",
"$",
"radio",
",",
"$",
"disabled",
")",
"{",
"if",
"(",
"!",
"$",
"disabled",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"disabled",
"===",
"true",
")",
"{",
"return",
"true",
";",
"}",
"$",... | Disabled attribute detection.
@param array $radio Radio info.
@param array|null|true $disabled The disabled values.
@return bool | [
"Disabled",
"attribute",
"detection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/RadioWidget.php#L128-L139 |
211,743 | cakephp/cakephp | src/Database/Expression/FunctionExpression.php | FunctionExpression.add | public function add($params, $types = [], $prepend = false)
{
$put = $prepend ? 'array_unshift' : 'array_push';
$typeMap = $this->getTypeMap()->setTypes($types);
foreach ($params as $k => $p) {
if ($p === 'literal') {
$put($this->_conditions, $k);
... | php | public function add($params, $types = [], $prepend = false)
{
$put = $prepend ? 'array_unshift' : 'array_push';
$typeMap = $this->getTypeMap()->setTypes($types);
foreach ($params as $k => $p) {
if ($p === 'literal') {
$put($this->_conditions, $k);
... | [
"public",
"function",
"add",
"(",
"$",
"params",
",",
"$",
"types",
"=",
"[",
"]",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"$",
"put",
"=",
"$",
"prepend",
"?",
"'array_unshift'",
":",
"'array_push'",
";",
"$",
"typeMap",
"=",
"$",
"this",
"->... | Adds one or more arguments for the function call.
@param array $params list of arguments to be passed to the function
If associative the key would be used as argument when value is 'literal'
@param array $types associative array of types to be associated with the
passed arguments
@param bool $prepend Whether to prepen... | [
"Adds",
"one",
"or",
"more",
"arguments",
"for",
"the",
"function",
"call",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/FunctionExpression.php#L129-L159 |
211,744 | cakephp/cakephp | src/Console/Command.php | Command.getOptionParser | public function getOptionParser()
{
list($root, $name) = explode(' ', $this->name, 2);
$parser = new ConsoleOptionParser($name);
$parser->setRootName($root);
$parser = $this->buildOptionParser($parser);
if (!($parser instanceof ConsoleOptionParser)) {
throw new R... | php | public function getOptionParser()
{
list($root, $name) = explode(' ', $this->name, 2);
$parser = new ConsoleOptionParser($name);
$parser->setRootName($root);
$parser = $this->buildOptionParser($parser);
if (!($parser instanceof ConsoleOptionParser)) {
throw new R... | [
"public",
"function",
"getOptionParser",
"(",
")",
"{",
"list",
"(",
"$",
"root",
",",
"$",
"name",
")",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"name",
",",
"2",
")",
";",
"$",
"parser",
"=",
"new",
"ConsoleOptionParser",
"(",
"$",
"na... | Get the option parser.
You can override buildOptionParser() to define your options & arguments.
@return \Cake\Console\ConsoleOptionParser
@throws \RuntimeException When the parser is invalid | [
"Get",
"the",
"option",
"parser",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/Command.php#L109-L125 |
211,745 | cakephp/cakephp | src/Console/Command.php | Command.displayHelp | protected function displayHelp(ConsoleOptionParser $parser, Arguments $args, ConsoleIo $io)
{
$format = 'text';
if ($args->getArgumentAt(0) === 'xml') {
$format = 'xml';
$io->setOutputAs(ConsoleOutput::RAW);
}
$io->out($parser->help(null, $format));
} | php | protected function displayHelp(ConsoleOptionParser $parser, Arguments $args, ConsoleIo $io)
{
$format = 'text';
if ($args->getArgumentAt(0) === 'xml') {
$format = 'xml';
$io->setOutputAs(ConsoleOutput::RAW);
}
$io->out($parser->help(null, $format));
} | [
"protected",
"function",
"displayHelp",
"(",
"ConsoleOptionParser",
"$",
"parser",
",",
"Arguments",
"$",
"args",
",",
"ConsoleIo",
"$",
"io",
")",
"{",
"$",
"format",
"=",
"'text'",
";",
"if",
"(",
"$",
"args",
"->",
"getArgumentAt",
"(",
"0",
")",
"===... | Output help content
@param \Cake\Console\ConsoleOptionParser $parser The option parser.
@param \Cake\Console\Arguments $args The command arguments.
@param \Cake\Console\ConsoleIo $io The console io
@return void | [
"Output",
"help",
"content"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/Command.php#L194-L203 |
211,746 | cakephp/cakephp | src/Console/Command.php | Command.setOutputLevel | protected function setOutputLevel(Arguments $args, ConsoleIo $io)
{
$io->setLoggers(ConsoleIo::NORMAL);
if ($args->getOption('quiet')) {
$io->level(ConsoleIo::QUIET);
$io->setLoggers(ConsoleIo::QUIET);
}
if ($args->getOption('verbose')) {
$io->leve... | php | protected function setOutputLevel(Arguments $args, ConsoleIo $io)
{
$io->setLoggers(ConsoleIo::NORMAL);
if ($args->getOption('quiet')) {
$io->level(ConsoleIo::QUIET);
$io->setLoggers(ConsoleIo::QUIET);
}
if ($args->getOption('verbose')) {
$io->leve... | [
"protected",
"function",
"setOutputLevel",
"(",
"Arguments",
"$",
"args",
",",
"ConsoleIo",
"$",
"io",
")",
"{",
"$",
"io",
"->",
"setLoggers",
"(",
"ConsoleIo",
"::",
"NORMAL",
")",
";",
"if",
"(",
"$",
"args",
"->",
"getOption",
"(",
"'quiet'",
")",
... | Set the output level based on the Arguments.
@param \Cake\Console\Arguments $args The command arguments.
@param \Cake\Console\ConsoleIo $io The console io
@return void | [
"Set",
"the",
"output",
"level",
"based",
"on",
"the",
"Arguments",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/Command.php#L212-L223 |
211,747 | cakephp/cakephp | src/Utility/MergeVariablesTrait.php | MergeVariablesTrait._mergeProperty | protected function _mergeProperty($property, $parentClasses, $options)
{
$thisValue = $this->{$property};
$isAssoc = false;
if (isset($options['associative']) &&
in_array($property, (array)$options['associative'])
) {
$isAssoc = true;
}
if ($i... | php | protected function _mergeProperty($property, $parentClasses, $options)
{
$thisValue = $this->{$property};
$isAssoc = false;
if (isset($options['associative']) &&
in_array($property, (array)$options['associative'])
) {
$isAssoc = true;
}
if ($i... | [
"protected",
"function",
"_mergeProperty",
"(",
"$",
"property",
",",
"$",
"parentClasses",
",",
"$",
"options",
")",
"{",
"$",
"thisValue",
"=",
"$",
"this",
"->",
"{",
"$",
"property",
"}",
";",
"$",
"isAssoc",
"=",
"false",
";",
"if",
"(",
"isset",
... | Merge a single property with the values declared in all parent classes.
@param string $property The name of the property being merged.
@param array $parentClasses An array of classes you want to merge with.
@param array $options Options for merging the property, see _mergeVars()
@return void | [
"Merge",
"a",
"single",
"property",
"with",
"the",
"values",
"declared",
"in",
"all",
"parent",
"classes",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/MergeVariablesTrait.php#L67-L92 |
211,748 | cakephp/cakephp | src/Utility/MergeVariablesTrait.php | MergeVariablesTrait._mergePropertyData | protected function _mergePropertyData($current, $parent, $isAssoc)
{
if (!$isAssoc) {
return array_merge($parent, $current);
}
$parent = Hash::normalize($parent);
foreach ($parent as $key => $value) {
if (!isset($current[$key])) {
$current[$key... | php | protected function _mergePropertyData($current, $parent, $isAssoc)
{
if (!$isAssoc) {
return array_merge($parent, $current);
}
$parent = Hash::normalize($parent);
foreach ($parent as $key => $value) {
if (!isset($current[$key])) {
$current[$key... | [
"protected",
"function",
"_mergePropertyData",
"(",
"$",
"current",
",",
"$",
"parent",
",",
"$",
"isAssoc",
")",
"{",
"if",
"(",
"!",
"$",
"isAssoc",
")",
"{",
"return",
"array_merge",
"(",
"$",
"parent",
",",
"$",
"current",
")",
";",
"}",
"$",
"pa... | Merge each of the keys in a property together.
@param array $current The current merged value.
@param array $parent The parent class' value.
@param bool $isAssoc Whether or not the merging should be done in associative mode.
@return mixed The updated value. | [
"Merge",
"each",
"of",
"the",
"keys",
"in",
"a",
"property",
"together",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/MergeVariablesTrait.php#L102-L115 |
211,749 | cakephp/cakephp | src/Http/Middleware/SecurityHeadersMiddleware.php | SecurityHeadersMiddleware.setReferrerPolicy | public function setReferrerPolicy($policy = self::SAME_ORIGIN)
{
$available = [
self::NO_REFERRER,
self::NO_REFERRER_WHEN_DOWNGRADE,
self::ORIGIN,
self::ORIGIN_WHEN_CROSS_ORIGIN,
self::SAME_ORIGIN,
self::STRICT_ORIGIN,
self:... | php | public function setReferrerPolicy($policy = self::SAME_ORIGIN)
{
$available = [
self::NO_REFERRER,
self::NO_REFERRER_WHEN_DOWNGRADE,
self::ORIGIN,
self::ORIGIN_WHEN_CROSS_ORIGIN,
self::SAME_ORIGIN,
self::STRICT_ORIGIN,
self:... | [
"public",
"function",
"setReferrerPolicy",
"(",
"$",
"policy",
"=",
"self",
"::",
"SAME_ORIGIN",
")",
"{",
"$",
"available",
"=",
"[",
"self",
"::",
"NO_REFERRER",
",",
"self",
"::",
"NO_REFERRER_WHEN_DOWNGRADE",
",",
"self",
"::",
"ORIGIN",
",",
"self",
"::... | Referrer-Policy
@link https://w3c.github.io/webappsec-referrer-policy
@param string $policy Policy value. Available Value: 'no-referrer', 'no-referrer-when-downgrade', 'origin',
'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url'
@return $this | [
"Referrer",
"-",
"Policy"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Middleware/SecurityHeadersMiddleware.php#L139-L156 |
211,750 | cakephp/cakephp | src/Http/Middleware/SecurityHeadersMiddleware.php | SecurityHeadersMiddleware.setXFrameOptions | public function setXFrameOptions($option = self::SAMEORIGIN, $url = null)
{
$this->checkValues($option, [self::DENY, self::SAMEORIGIN, self::ALLOW_FROM]);
if ($option === self::ALLOW_FROM) {
if (empty($url)) {
throw new InvalidArgumentException('The 2nd arg $url can not ... | php | public function setXFrameOptions($option = self::SAMEORIGIN, $url = null)
{
$this->checkValues($option, [self::DENY, self::SAMEORIGIN, self::ALLOW_FROM]);
if ($option === self::ALLOW_FROM) {
if (empty($url)) {
throw new InvalidArgumentException('The 2nd arg $url can not ... | [
"public",
"function",
"setXFrameOptions",
"(",
"$",
"option",
"=",
"self",
"::",
"SAMEORIGIN",
",",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkValues",
"(",
"$",
"option",
",",
"[",
"self",
"::",
"DENY",
",",
"self",
"::",
"SAMEORIGIN"... | X-Frame-Options
@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
@param string $option Option value. Available Values: 'deny', 'sameorigin', 'allow-from <uri>'
@param string $url URL if mode is `allow-from`
@return $this | [
"X",
"-",
"Frame",
"-",
"Options"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Middleware/SecurityHeadersMiddleware.php#L166-L180 |
211,751 | cakephp/cakephp | src/Http/Middleware/SecurityHeadersMiddleware.php | SecurityHeadersMiddleware.setXssProtection | public function setXssProtection($mode = self::XSS_BLOCK)
{
$mode = (string)$mode;
if ($mode === self::XSS_BLOCK) {
$mode = self::XSS_ENABLED_BLOCK;
}
$this->checkValues($mode, [self::XSS_ENABLED, self::XSS_DISABLED, self::XSS_ENABLED_BLOCK]);
$this->headers['x-... | php | public function setXssProtection($mode = self::XSS_BLOCK)
{
$mode = (string)$mode;
if ($mode === self::XSS_BLOCK) {
$mode = self::XSS_ENABLED_BLOCK;
}
$this->checkValues($mode, [self::XSS_ENABLED, self::XSS_DISABLED, self::XSS_ENABLED_BLOCK]);
$this->headers['x-... | [
"public",
"function",
"setXssProtection",
"(",
"$",
"mode",
"=",
"self",
"::",
"XSS_BLOCK",
")",
"{",
"$",
"mode",
"=",
"(",
"string",
")",
"$",
"mode",
";",
"if",
"(",
"$",
"mode",
"===",
"self",
"::",
"XSS_BLOCK",
")",
"{",
"$",
"mode",
"=",
"sel... | X-XSS-Protection
@link https://blogs.msdn.microsoft.com/ieinternals/2011/01/31/controlling-the-xss-filter
@param string $mode Mode value. Available Values: '1', '0', 'block'
@return $this | [
"X",
"-",
"XSS",
"-",
"Protection"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Middleware/SecurityHeadersMiddleware.php#L189-L201 |
211,752 | cakephp/cakephp | src/Http/Middleware/SecurityHeadersMiddleware.php | SecurityHeadersMiddleware.setCrossDomainPolicy | public function setCrossDomainPolicy($policy = self::ALL)
{
$this->checkValues($policy, [
self::ALL,
self::NONE,
self::MASTER_ONLY,
self::BY_CONTENT_TYPE,
self::BY_FTP_FILENAME,
]);
$this->headers['x-permitted-cross-domain-policies'... | php | public function setCrossDomainPolicy($policy = self::ALL)
{
$this->checkValues($policy, [
self::ALL,
self::NONE,
self::MASTER_ONLY,
self::BY_CONTENT_TYPE,
self::BY_FTP_FILENAME,
]);
$this->headers['x-permitted-cross-domain-policies'... | [
"public",
"function",
"setCrossDomainPolicy",
"(",
"$",
"policy",
"=",
"self",
"::",
"ALL",
")",
"{",
"$",
"this",
"->",
"checkValues",
"(",
"$",
"policy",
",",
"[",
"self",
"::",
"ALL",
",",
"self",
"::",
"NONE",
",",
"self",
"::",
"MASTER_ONLY",
",",... | X-Permitted-Cross-Domain-Policies
@link https://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html
@param string $policy Policy value. Available Values: 'all', 'none', 'master-only', 'by-content-type',
'by-ftp-filename'
@return $this | [
"X",
"-",
"Permitted",
"-",
"Cross",
"-",
"Domain",
"-",
"Policies"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Middleware/SecurityHeadersMiddleware.php#L211-L223 |
211,753 | cakephp/cakephp | src/Http/Middleware/SecurityHeadersMiddleware.php | SecurityHeadersMiddleware.checkValues | protected function checkValues($value, array $allowed)
{
if (!in_array($value, $allowed)) {
throw new InvalidArgumentException(sprintf(
'Invalid arg `%s`, use one of these: %s',
$value,
implode(', ', $allowed)
));
}
} | php | protected function checkValues($value, array $allowed)
{
if (!in_array($value, $allowed)) {
throw new InvalidArgumentException(sprintf(
'Invalid arg `%s`, use one of these: %s',
$value,
implode(', ', $allowed)
));
}
} | [
"protected",
"function",
"checkValues",
"(",
"$",
"value",
",",
"array",
"$",
"allowed",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"value",
",",
"$",
"allowed",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Inval... | Convenience method to check if a value is in the list of allowed args
@throws \InvalidArgumentException Thrown when a value is invalid.
@param string $value Value to check
@param array $allowed List of allowed values
@return void | [
"Convenience",
"method",
"to",
"check",
"if",
"a",
"value",
"is",
"in",
"the",
"list",
"of",
"allowed",
"args"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Middleware/SecurityHeadersMiddleware.php#L233-L242 |
211,754 | cakephp/cakephp | src/View/Helper/RssHelper.php | RssHelper.elem | public function elem($name, $attrib = [], $content = null, $endTag = true)
{
$namespace = null;
if (isset($attrib['namespace'])) {
$namespace = $attrib['namespace'];
unset($attrib['namespace']);
}
$cdata = false;
if (is_array($content) && isset($conten... | php | public function elem($name, $attrib = [], $content = null, $endTag = true)
{
$namespace = null;
if (isset($attrib['namespace'])) {
$namespace = $attrib['namespace'];
unset($attrib['namespace']);
}
$cdata = false;
if (is_array($content) && isset($conten... | [
"public",
"function",
"elem",
"(",
"$",
"name",
",",
"$",
"attrib",
"=",
"[",
"]",
",",
"$",
"content",
"=",
"null",
",",
"$",
"endTag",
"=",
"true",
")",
"{",
"$",
"namespace",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"attrib",
"[",
"'n... | Generates an XML element
@param string $name The name of the XML element
@param array $attrib The attributes of the XML element
@param string|array|null $content XML element content
@param bool $endTag Whether the end tag of the element should be printed
@return string XML | [
"Generates",
"an",
"XML",
"element"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/RssHelper.php#L308-L367 |
211,755 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet.rewind | public function rewind()
{
if ($this->_index == 0) {
return;
}
if (!$this->_useBuffering) {
$msg = 'You cannot rewind an un-buffered ResultSet. Use Query::bufferResults() to get a buffered ResultSet.';
throw new Exception($msg);
}
$this->... | php | public function rewind()
{
if ($this->_index == 0) {
return;
}
if (!$this->_useBuffering) {
$msg = 'You cannot rewind an un-buffered ResultSet. Use Query::bufferResults() to get a buffered ResultSet.';
throw new Exception($msg);
}
$this->... | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_index",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"_useBuffering",
")",
"{",
"$",
"msg",
"=",
"'You cannot rewind an un-buffered ResultSet. U... | Rewinds a ResultSet.
Part of Iterator interface.
@throws \Cake\Database\Exception
@return void | [
"Rewinds",
"a",
"ResultSet",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L241-L253 |
211,756 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet.first | public function first()
{
foreach ($this as $result) {
if ($this->_statement && !$this->_useBuffering) {
$this->_statement->closeCursor();
}
return $result;
}
} | php | public function first()
{
foreach ($this as $result) {
if ($this->_statement && !$this->_useBuffering) {
$this->_statement->closeCursor();
}
return $result;
}
} | [
"public",
"function",
"first",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"as",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_statement",
"&&",
"!",
"$",
"this",
"->",
"_useBuffering",
")",
"{",
"$",
"this",
"->",
"_statement",
"->",
"c... | Get the first record from a result set.
This method will also close the underlying statement cursor.
@return array|object | [
"Get",
"the",
"first",
"record",
"from",
"a",
"result",
"set",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L296-L305 |
211,757 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet.serialize | public function serialize()
{
if (!$this->_useBuffering) {
$msg = 'You cannot serialize an un-buffered ResultSet. Use Query::bufferResults() to get a buffered ResultSet.';
throw new Exception($msg);
}
while ($this->valid()) {
$this->next();
}
... | php | public function serialize()
{
if (!$this->_useBuffering) {
$msg = 'You cannot serialize an un-buffered ResultSet. Use Query::bufferResults() to get a buffered ResultSet.';
throw new Exception($msg);
}
while ($this->valid()) {
$this->next();
}
... | [
"public",
"function",
"serialize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_useBuffering",
")",
"{",
"$",
"msg",
"=",
"'You cannot serialize an un-buffered ResultSet. Use Query::bufferResults() to get a buffered ResultSet.'",
";",
"throw",
"new",
"Exception",
... | Serializes a resultset.
Part of Serializable interface.
@return string Serialized object | [
"Serializes",
"a",
"resultset",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L314-L330 |
211,758 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet.unserialize | public function unserialize($serialized)
{
$results = (array)(unserialize($serialized) ?: []);
$this->_results = SplFixedArray::fromArray($results);
$this->_useBuffering = true;
$this->_count = $this->_results->count();
} | php | public function unserialize($serialized)
{
$results = (array)(unserialize($serialized) ?: []);
$this->_results = SplFixedArray::fromArray($results);
$this->_useBuffering = true;
$this->_count = $this->_results->count();
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"$",
"results",
"=",
"(",
"array",
")",
"(",
"unserialize",
"(",
"$",
"serialized",
")",
"?",
":",
"[",
"]",
")",
";",
"$",
"this",
"->",
"_results",
"=",
"SplFixedArray",
"::",
"... | Unserializes a resultset.
Part of Serializable interface.
@param string $serialized Serialized object
@return void | [
"Unserializes",
"a",
"resultset",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L340-L346 |
211,759 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet.count | public function count()
{
if ($this->_count !== null) {
return $this->_count;
}
if ($this->_statement) {
return $this->_count = $this->_statement->rowCount();
}
if ($this->_results instanceof SplFixedArray) {
$this->_count = $this->_result... | php | public function count()
{
if ($this->_count !== null) {
return $this->_count;
}
if ($this->_statement) {
return $this->_count = $this->_statement->rowCount();
}
if ($this->_results instanceof SplFixedArray) {
$this->_count = $this->_result... | [
"public",
"function",
"count",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_count",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_count",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_statement",
")",
"{",
"return",
"$",
"this",
"->",
"_c... | Gives the number of rows in the result set.
Part of the Countable interface.
@return int | [
"Gives",
"the",
"number",
"of",
"rows",
"in",
"the",
"result",
"set",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L355-L371 |
211,760 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet._calculateAssociationMap | protected function _calculateAssociationMap($query)
{
$map = $query->getEagerLoader()->associationsMap($this->_defaultTable);
$this->_matchingMap = (new Collection($map))
->match(['matching' => true])
->indexBy('alias')
->toArray();
$this->_containMap = (... | php | protected function _calculateAssociationMap($query)
{
$map = $query->getEagerLoader()->associationsMap($this->_defaultTable);
$this->_matchingMap = (new Collection($map))
->match(['matching' => true])
->indexBy('alias')
->toArray();
$this->_containMap = (... | [
"protected",
"function",
"_calculateAssociationMap",
"(",
"$",
"query",
")",
"{",
"$",
"map",
"=",
"$",
"query",
"->",
"getEagerLoader",
"(",
")",
"->",
"associationsMap",
"(",
"$",
"this",
"->",
"_defaultTable",
")",
";",
"$",
"this",
"->",
"_matchingMap",
... | Calculates the list of associations that should get eager loaded
when fetching each record
@param \Cake\ORM\Query $query The query from where to derive the associations
@return void | [
"Calculates",
"the",
"list",
"of",
"associations",
"that",
"should",
"get",
"eager",
"loaded",
"when",
"fetching",
"each",
"record"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L380-L392 |
211,761 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet._calculateColumnMap | protected function _calculateColumnMap($query)
{
$map = [];
foreach ($query->clause('select') as $key => $field) {
$key = trim($key, '"`[]');
if (strpos($key, '__') <= 0) {
$map[$this->_defaultAlias][$key] = $key;
continue;
}
... | php | protected function _calculateColumnMap($query)
{
$map = [];
foreach ($query->clause('select') as $key => $field) {
$key = trim($key, '"`[]');
if (strpos($key, '__') <= 0) {
$map[$this->_defaultAlias][$key] = $key;
continue;
}
... | [
"protected",
"function",
"_calculateColumnMap",
"(",
"$",
"query",
")",
"{",
"$",
"map",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"query",
"->",
"clause",
"(",
"'select'",
")",
"as",
"$",
"key",
"=>",
"$",
"field",
")",
"{",
"$",
"key",
"=",
"trim"... | Creates a map of row keys out of the query select clause that can be
used to hydrate nested result sets more quickly.
@param \Cake\ORM\Query $query The query from where to derive the column map
@return void | [
"Creates",
"a",
"map",
"of",
"row",
"keys",
"out",
"of",
"the",
"query",
"select",
"clause",
"that",
"can",
"be",
"used",
"to",
"hydrate",
"nested",
"result",
"sets",
"more",
"quickly",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L401-L425 |
211,762 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet._getTypes | protected function _getTypes($table, $fields)
{
$types = [];
$schema = $table->getSchema();
$map = array_keys((array)Type::getMap() + ['string' => 1, 'text' => 1, 'boolean' => 1]);
$typeMap = array_combine(
$map,
array_map(['Cake\Database\Type', 'build'], $map... | php | protected function _getTypes($table, $fields)
{
$types = [];
$schema = $table->getSchema();
$map = array_keys((array)Type::getMap() + ['string' => 1, 'text' => 1, 'boolean' => 1]);
$typeMap = array_combine(
$map,
array_map(['Cake\Database\Type', 'build'], $map... | [
"protected",
"function",
"_getTypes",
"(",
"$",
"table",
",",
"$",
"fields",
")",
"{",
"$",
"types",
"=",
"[",
"]",
";",
"$",
"schema",
"=",
"$",
"table",
"->",
"getSchema",
"(",
")",
";",
"$",
"map",
"=",
"array_keys",
"(",
"(",
"array",
")",
"T... | Returns the Type classes for each of the passed fields belonging to the
table.
@param \Cake\ORM\Table $table The table from which to get the schema
@param array $fields The fields whitelist to use for fields in the schema.
@return array | [
"Returns",
"the",
"Type",
"classes",
"for",
"each",
"of",
"the",
"passed",
"fields",
"belonging",
"to",
"the",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L447-L471 |
211,763 | cakephp/cakephp | src/ORM/ResultSet.php | ResultSet._fetchResult | protected function _fetchResult()
{
if (!$this->_statement) {
return false;
}
$row = $this->_statement->fetch('assoc');
if ($row === false) {
return $row;
}
return $this->_groupResult($row);
} | php | protected function _fetchResult()
{
if (!$this->_statement) {
return false;
}
$row = $this->_statement->fetch('assoc');
if ($row === false) {
return $row;
}
return $this->_groupResult($row);
} | [
"protected",
"function",
"_fetchResult",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_statement",
")",
"{",
"return",
"false",
";",
"}",
"$",
"row",
"=",
"$",
"this",
"->",
"_statement",
"->",
"fetch",
"(",
"'assoc'",
")",
";",
"if",
"(",
"$... | Helper function to fetch the next result from the statement or
seeded results.
@return mixed | [
"Helper",
"function",
"to",
"fetch",
"the",
"next",
"result",
"from",
"the",
"statement",
"or",
"seeded",
"results",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/ResultSet.php#L479-L491 |
211,764 | cakephp/cakephp | src/Database/TypedResultTrait.php | TypedResultTrait.returnType | public function returnType($type = null)
{
deprecationWarning(
'TypedResultTrait::returnType() is deprecated. ' .
'Use TypedResultTrait::setReturnType()/getReturnType() instead.'
);
if ($type !== null) {
$this->_returnType = $type;
return $thi... | php | public function returnType($type = null)
{
deprecationWarning(
'TypedResultTrait::returnType() is deprecated. ' .
'Use TypedResultTrait::setReturnType()/getReturnType() instead.'
);
if ($type !== null) {
$this->_returnType = $type;
return $thi... | [
"public",
"function",
"returnType",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'TypedResultTrait::returnType() is deprecated. '",
".",
"'Use TypedResultTrait::setReturnType()/getReturnType() instead.'",
")",
";",
"if",
"(",
"$",
"type",
"!==",
"n... | Sets the type of the value this object will generate.
If called without arguments, returns the current known type
@deprecated 3.5.0 Use getReturnType()/setReturnType() instead.
@param string|null $type The name of the type that is to be returned
@return string|$this | [
"Sets",
"the",
"type",
"of",
"the",
"value",
"this",
"object",
"will",
"generate",
".",
"If",
"called",
"without",
"arguments",
"returns",
"the",
"current",
"known",
"type"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/TypedResultTrait.php#L61-L74 |
211,765 | cakephp/cakephp | src/View/JsonView.php | JsonView.render | public function render($view = null, $layout = null)
{
$return = parent::render($view, $layout);
if (!empty($this->viewVars['_jsonp'])) {
$jsonpParam = $this->viewVars['_jsonp'];
if ($this->viewVars['_jsonp'] === true) {
$jsonpParam = 'callback';
... | php | public function render($view = null, $layout = null)
{
$return = parent::render($view, $layout);
if (!empty($this->viewVars['_jsonp'])) {
$jsonpParam = $this->viewVars['_jsonp'];
if ($this->viewVars['_jsonp'] === true) {
$jsonpParam = 'callback';
... | [
"public",
"function",
"render",
"(",
"$",
"view",
"=",
"null",
",",
"$",
"layout",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"parent",
"::",
"render",
"(",
"$",
"view",
",",
"$",
"layout",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"... | Render a JSON view.
### Special parameters
`_serialize` To convert a set of view variables into a JSON response.
Its value can be a string for single variable name or array for multiple
names. If true all view variables will be serialized. It unset normal
view template will be rendered.
`_jsonp` Enables JSONP support ... | [
"Render",
"a",
"JSON",
"view",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/JsonView.php#L105-L121 |
211,766 | cakephp/cakephp | src/View/JsonView.php | JsonView._serialize | protected function _serialize($serialize)
{
$data = $this->_dataToSerialize($serialize);
$jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT |
JSON_PARTIAL_OUTPUT_ON_ERROR;
if (isset($this->viewVars['_jsonOptions'])) {
if ($this->viewVars['_js... | php | protected function _serialize($serialize)
{
$data = $this->_dataToSerialize($serialize);
$jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT |
JSON_PARTIAL_OUTPUT_ON_ERROR;
if (isset($this->viewVars['_jsonOptions'])) {
if ($this->viewVars['_js... | [
"protected",
"function",
"_serialize",
"(",
"$",
"serialize",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_dataToSerialize",
"(",
"$",
"serialize",
")",
";",
"$",
"jsonOptions",
"=",
"JSON_HEX_TAG",
"|",
"JSON_HEX_APOS",
"|",
"JSON_HEX_AMP",
"|",
"JSON_H... | Serialize view vars
### Special parameters
`_jsonOptions` You can set custom options for json_encode() this way,
e.g. `JSON_HEX_TAG | JSON_HEX_APOS`.
@param array|string|bool $serialize The name(s) of the view variable(s)
that need(s) to be serialized. If true all available view variables.
@return string|false The se... | [
"Serialize",
"view",
"vars"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/JsonView.php#L134-L154 |
211,767 | cakephp/cakephp | src/Database/FunctionsBuilder.php | FunctionsBuilder._literalArgumentFunction | protected function _literalArgumentFunction($name, $expression, $types = [], $return = 'string')
{
if (!is_string($expression)) {
$expression = [$expression];
} else {
$expression = [$expression => 'literal'];
}
return $this->_build($name, $expression, $types... | php | protected function _literalArgumentFunction($name, $expression, $types = [], $return = 'string')
{
if (!is_string($expression)) {
$expression = [$expression];
} else {
$expression = [$expression => 'literal'];
}
return $this->_build($name, $expression, $types... | [
"protected",
"function",
"_literalArgumentFunction",
"(",
"$",
"name",
",",
"$",
"expression",
",",
"$",
"types",
"=",
"[",
"]",
",",
"$",
"return",
"=",
"'string'",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"expression",
")",
")",
"{",
"$",
"... | Helper function to build a function expression that only takes one literal
argument.
@param string $name name of the function to build
@param mixed $expression the function argument
@param array $types list of types to bind to the arguments
@param string $return The return type for the function
@return \Cake\Database\... | [
"Helper",
"function",
"to",
"build",
"a",
"function",
"expression",
"that",
"only",
"takes",
"one",
"literal",
"argument",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/FunctionsBuilder.php#L52-L61 |
211,768 | cakephp/cakephp | src/Database/FunctionsBuilder.php | FunctionsBuilder.sum | public function sum($expression, $types = [])
{
$returnType = 'float';
if (current($types) === 'integer') {
$returnType = 'integer';
}
return $this->_literalArgumentFunction('SUM', $expression, $types, $returnType);
} | php | public function sum($expression, $types = [])
{
$returnType = 'float';
if (current($types) === 'integer') {
$returnType = 'integer';
}
return $this->_literalArgumentFunction('SUM', $expression, $types, $returnType);
} | [
"public",
"function",
"sum",
"(",
"$",
"expression",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"$",
"returnType",
"=",
"'float'",
";",
"if",
"(",
"current",
"(",
"$",
"types",
")",
"===",
"'integer'",
")",
"{",
"$",
"returnType",
"=",
"'integer'",
... | Returns a FunctionExpression representing a call to SQL SUM function.
@param mixed $expression the function argument
@param array $types list of types to bind to the arguments
@return \Cake\Database\Expression\FunctionExpression | [
"Returns",
"a",
"FunctionExpression",
"representing",
"a",
"call",
"to",
"SQL",
"SUM",
"function",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/FunctionsBuilder.php#L80-L88 |
211,769 | cakephp/cakephp | src/Database/FunctionsBuilder.php | FunctionsBuilder.extract | public function extract($part, $expression, $types = [])
{
$expression = $this->_literalArgumentFunction('EXTRACT', $expression, $types, 'integer');
$expression->setConjunction(' FROM')->add([$part => 'literal'], [], true);
return $expression;
} | php | public function extract($part, $expression, $types = [])
{
$expression = $this->_literalArgumentFunction('EXTRACT', $expression, $types, 'integer');
$expression->setConjunction(' FROM')->add([$part => 'literal'], [], true);
return $expression;
} | [
"public",
"function",
"extract",
"(",
"$",
"part",
",",
"$",
"expression",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"$",
"expression",
"=",
"$",
"this",
"->",
"_literalArgumentFunction",
"(",
"'EXTRACT'",
",",
"$",
"expression",
",",
"$",
"types",
"... | Returns the specified date part from the SQL expression.
@param string $part Part of the date to return.
@param string $expression Expression to obtain the date part from.
@param array $types list of types to bind to the arguments
@return \Cake\Database\Expression\FunctionExpression | [
"Returns",
"the",
"specified",
"date",
"part",
"from",
"the",
"SQL",
"expression",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/FunctionsBuilder.php#L196-L202 |
211,770 | cakephp/cakephp | src/Database/FunctionsBuilder.php | FunctionsBuilder.dateAdd | public function dateAdd($expression, $value, $unit, $types = [])
{
if (!is_numeric($value)) {
$value = 0;
}
$interval = $value . ' ' . $unit;
$expression = $this->_literalArgumentFunction('DATE_ADD', $expression, $types, 'datetime');
$expression->setConjunction(',... | php | public function dateAdd($expression, $value, $unit, $types = [])
{
if (!is_numeric($value)) {
$value = 0;
}
$interval = $value . ' ' . $unit;
$expression = $this->_literalArgumentFunction('DATE_ADD', $expression, $types, 'datetime');
$expression->setConjunction(',... | [
"public",
"function",
"dateAdd",
"(",
"$",
"expression",
",",
"$",
"value",
",",
"$",
"unit",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"0",
";",
"}",
"$",
"... | Add the time unit to the date expression
@param string $expression Expression to obtain the date part from.
@param string $value Value to be added. Use negative to subtract.
@param string $unit Unit of the value e.g. hour or day.
@param array $types list of types to bind to the arguments
@return \Cake\Database\Express... | [
"Add",
"the",
"time",
"unit",
"to",
"the",
"date",
"expression"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/FunctionsBuilder.php#L213-L223 |
211,771 | cakephp/cakephp | src/Database/FunctionsBuilder.php | FunctionsBuilder.now | public function now($type = 'datetime')
{
if ($type === 'datetime') {
return $this->_build('NOW')->setReturnType('datetime');
}
if ($type === 'date') {
return $this->_build('CURRENT_DATE')->setReturnType('date');
}
if ($type === 'time') {
r... | php | public function now($type = 'datetime')
{
if ($type === 'datetime') {
return $this->_build('NOW')->setReturnType('datetime');
}
if ($type === 'date') {
return $this->_build('CURRENT_DATE')->setReturnType('date');
}
if ($type === 'time') {
r... | [
"public",
"function",
"now",
"(",
"$",
"type",
"=",
"'datetime'",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"'datetime'",
")",
"{",
"return",
"$",
"this",
"->",
"_build",
"(",
"'NOW'",
")",
"->",
"setReturnType",
"(",
"'datetime'",
")",
";",
"}",
"if"... | Returns a FunctionExpression representing a call that will return the current
date and time. By default it returns both date and time, but you can also
make it generate only the date or only the time.
@param string $type (datetime|date|time)
@return \Cake\Database\Expression\FunctionExpression | [
"Returns",
"a",
"FunctionExpression",
"representing",
"a",
"call",
"that",
"will",
"return",
"the",
"current",
"date",
"and",
"time",
".",
"By",
"default",
"it",
"returns",
"both",
"date",
"and",
"time",
"but",
"you",
"can",
"also",
"make",
"it",
"generate",... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/FunctionsBuilder.php#L259-L270 |
211,772 | cakephp/cakephp | src/Routing/Filter/ControllerFactoryFilter.php | ControllerFactoryFilter.beforeDispatch | public function beforeDispatch(Event $event)
{
$request = $event->getData('request');
$response = $event->getData('response');
$event->setData('controller', $this->_getController($request, $response));
} | php | public function beforeDispatch(Event $event)
{
$request = $event->getData('request');
$response = $event->getData('response');
$event->setData('controller', $this->_getController($request, $response));
} | [
"public",
"function",
"beforeDispatch",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getData",
"(",
"'request'",
")",
";",
"$",
"response",
"=",
"$",
"event",
"->",
"getData",
"(",
"'response'",
")",
";",
"$",
"event"... | Resolve the request parameters into a controller and attach the controller
to the event object.
@param \Cake\Event\Event $event The event instance.
@return void | [
"Resolve",
"the",
"request",
"parameters",
"into",
"a",
"controller",
"and",
"attach",
"the",
"controller",
"to",
"the",
"event",
"object",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Filter/ControllerFactoryFilter.php#L45-L50 |
211,773 | cakephp/cakephp | src/Http/Client/Request.php | Request.addHeaders | protected function addHeaders(array $headers)
{
foreach ($headers as $key => $val) {
$normalized = strtolower($key);
$this->headers[$key] = (array)$val;
$this->headerNames[$normalized] = $key;
}
} | php | protected function addHeaders(array $headers)
{
foreach ($headers as $key => $val) {
$normalized = strtolower($key);
$this->headers[$key] = (array)$val;
$this->headerNames[$normalized] = $key;
}
} | [
"protected",
"function",
"addHeaders",
"(",
"array",
"$",
"headers",
")",
"{",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"normalized",
"=",
"strtolower",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"headers"... | Add an array of headers to the request.
@param array $headers The headers to add.
@return void | [
"Add",
"an",
"array",
"of",
"headers",
"to",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Request.php#L171-L178 |
211,774 | cakephp/cakephp | src/ORM/RulesChecker.php | RulesChecker.isUnique | public function isUnique(array $fields, $message = null)
{
$options = [];
if (is_array($message)) {
$options = $message + ['message' => null];
$message = $options['message'];
unset($options['message']);
}
if (!$message) {
if ($this->_us... | php | public function isUnique(array $fields, $message = null)
{
$options = [];
if (is_array($message)) {
$options = $message + ['message' => null];
$message = $options['message'];
unset($options['message']);
}
if (!$message) {
if ($this->_us... | [
"public",
"function",
"isUnique",
"(",
"array",
"$",
"fields",
",",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"message",
")",
")",
"{",
"$",
"options",
"=",
"$",
"message",
"+",
"[... | Returns a callable that can be used as a rule for checking the uniqueness of a value
in the table.
### Example:
```
$rules->add($rules->isUnique(['email'], 'The email should be unique'));
```
@param array $fields The list of fields to check for uniqueness.
@param string|array|null $message The error message to show ... | [
"Returns",
"a",
"callable",
"that",
"can",
"be",
"used",
"as",
"a",
"rule",
"for",
"checking",
"the",
"uniqueness",
"of",
"a",
"value",
"in",
"the",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/RulesChecker.php#L47-L66 |
211,775 | cakephp/cakephp | src/ORM/RulesChecker.php | RulesChecker.existsIn | public function existsIn($field, $table, $message = null)
{
$options = [];
if (is_array($message)) {
$options = $message + ['message' => null];
$message = $options['message'];
unset($options['message']);
}
if (!$message) {
if ($this->_... | php | public function existsIn($field, $table, $message = null)
{
$options = [];
if (is_array($message)) {
$options = $message + ['message' => null];
$message = $options['message'];
unset($options['message']);
}
if (!$message) {
if ($this->_... | [
"public",
"function",
"existsIn",
"(",
"$",
"field",
",",
"$",
"table",
",",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"message",
")",
")",
"{",
"$",
"options",
"=",
"$",
"message"... | Returns a callable that can be used as a rule for checking that the values
extracted from the entity to check exist as the primary key in another table.
This is useful for enforcing foreign key integrity checks.
### Example:
```
$rules->add($rules->existsIn('author_id', 'Authors', 'Invalid Author'));
$rules->add($r... | [
"Returns",
"a",
"callable",
"that",
"can",
"be",
"used",
"as",
"a",
"rule",
"for",
"checking",
"that",
"the",
"values",
"extracted",
"from",
"the",
"entity",
"to",
"check",
"exist",
"as",
"the",
"primary",
"key",
"in",
"another",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/RulesChecker.php#L93-L113 |
211,776 | cakephp/cakephp | src/ORM/RulesChecker.php | RulesChecker.validCount | public function validCount($field, $count = 0, $operator = '>', $message = null)
{
if (!$message) {
if ($this->_useI18n) {
$message = __d('cake', 'The count does not match {0}{1}', [$operator, $count]);
} else {
$message = sprintf('The count does not m... | php | public function validCount($field, $count = 0, $operator = '>', $message = null)
{
if (!$message) {
if ($this->_useI18n) {
$message = __d('cake', 'The count does not match {0}{1}', [$operator, $count]);
} else {
$message = sprintf('The count does not m... | [
"public",
"function",
"validCount",
"(",
"$",
"field",
",",
"$",
"count",
"=",
"0",
",",
"$",
"operator",
"=",
"'>'",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_useI18n",
... | Validates the count of associated records.
@param string $field The field to check the count on.
@param int $count The expected count.
@param string $operator The operator for the count comparison.
@param string|null $message The error message to show in case the rule does not pass.
@return callable | [
"Validates",
"the",
"count",
"of",
"associated",
"records",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/RulesChecker.php#L124-L141 |
211,777 | cakephp/cakephp | src/ORM/EagerLoadable.php | EagerLoadable.canBeJoined | public function canBeJoined($possible = null)
{
if ($possible !== null) {
deprecationWarning(
'Using EagerLoadable::canBeJoined() as a setter is deprecated. ' .
'Use setCanBeJoined() instead.'
);
$this->setCanBeJoined($possible);
}
... | php | public function canBeJoined($possible = null)
{
if ($possible !== null) {
deprecationWarning(
'Using EagerLoadable::canBeJoined() as a setter is deprecated. ' .
'Use setCanBeJoined() instead.'
);
$this->setCanBeJoined($possible);
}
... | [
"public",
"function",
"canBeJoined",
"(",
"$",
"possible",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"possible",
"!==",
"null",
")",
"{",
"deprecationWarning",
"(",
"'Using EagerLoadable::canBeJoined() as a setter is deprecated. '",
".",
"'Use setCanBeJoined() instead.'",
... | Gets whether or not this level can be fetched using a join.
If called with arguments it sets the value.
As of 3.4.0 the setter part is deprecated, use setCanBeJoined() instead.
@param bool|null $possible The value to set.
@return bool | [
"Gets",
"whether",
"or",
"not",
"this",
"level",
"can",
"be",
"fetched",
"using",
"a",
"join",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/EagerLoadable.php#L228-L239 |
211,778 | cakephp/cakephp | src/ORM/EagerLoadable.php | EagerLoadable.config | public function config(array $config = null)
{
deprecationWarning(
'EagerLoadable::config() is deprecated. ' .
'Use setConfig()/getConfig() instead.'
);
if ($config !== null) {
$this->setConfig($config);
}
return $this->getConfig();
} | php | public function config(array $config = null)
{
deprecationWarning(
'EagerLoadable::config() is deprecated. ' .
'Use setConfig()/getConfig() instead.'
);
if ($config !== null) {
$this->setConfig($config);
}
return $this->getConfig();
} | [
"public",
"function",
"config",
"(",
"array",
"$",
"config",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'EagerLoadable::config() is deprecated. '",
".",
"'Use setConfig()/getConfig() instead.'",
")",
";",
"if",
"(",
"$",
"config",
"!==",
"null",
")",
"{",
... | Sets the list of options to pass to the association object for loading
the records.
If called with no arguments it returns the current
value.
@deprecated 3.4.0 Use setConfig()/getConfig() instead.
@param array|null $config The value to set.
@return array | [
"Sets",
"the",
"list",
"of",
"options",
"to",
"pass",
"to",
"the",
"association",
"object",
"for",
"loading",
"the",
"records",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/EagerLoadable.php#L277-L288 |
211,779 | cakephp/cakephp | src/Database/Expression/CaseExpression.php | CaseExpression.add | public function add($conditions = [], $values = [], $types = [])
{
if (!is_array($conditions)) {
$conditions = [$conditions];
}
if (!is_array($values)) {
$values = [$values];
}
if (!is_array($types)) {
$types = [$types];
}
... | php | public function add($conditions = [], $values = [], $types = [])
{
if (!is_array($conditions)) {
$conditions = [$conditions];
}
if (!is_array($values)) {
$values = [$values];
}
if (!is_array($types)) {
$types = [$types];
}
... | [
"public",
"function",
"add",
"(",
"$",
"conditions",
"=",
"[",
"]",
",",
"$",
"values",
"=",
"[",
"]",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"conditions",
")",
")",
"{",
"$",
"conditions",
"=",
"[",
... | Adds one or more conditions and their respective true values to the case object.
Conditions must be a one dimensional array or a QueryExpression.
The trueValues must be a similar structure, but may contain a string value.
@param array|\Cake\Database\ExpressionInterface $conditions Must be a ExpressionInterface instanc... | [
"Adds",
"one",
"or",
"more",
"conditions",
"and",
"their",
"respective",
"true",
"values",
"to",
"the",
"case",
"object",
".",
"Conditions",
"must",
"be",
"a",
"one",
"dimensional",
"array",
"or",
"a",
"QueryExpression",
".",
"The",
"trueValues",
"must",
"be... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/CaseExpression.php#L86-L101 |
211,780 | cakephp/cakephp | src/Database/Expression/CaseExpression.php | CaseExpression._addExpressions | protected function _addExpressions($conditions, $values, $types)
{
$rawValues = array_values($values);
$keyValues = array_keys($values);
foreach ($conditions as $k => $c) {
$numericKey = is_numeric($k);
if ($numericKey && empty($c)) {
continue;
... | php | protected function _addExpressions($conditions, $values, $types)
{
$rawValues = array_values($values);
$keyValues = array_keys($values);
foreach ($conditions as $k => $c) {
$numericKey = is_numeric($k);
if ($numericKey && empty($c)) {
continue;
... | [
"protected",
"function",
"_addExpressions",
"(",
"$",
"conditions",
",",
"$",
"values",
",",
"$",
"types",
")",
"{",
"$",
"rawValues",
"=",
"array_values",
"(",
"$",
"values",
")",
";",
"$",
"keyValues",
"=",
"array_keys",
"(",
"$",
"values",
")",
";",
... | Iterates over the passed in conditions and ensures that there is a matching true value for each.
If no matching true value, then it is defaulted to '1'.
@param array|\Cake\Database\ExpressionInterface $conditions Must be a ExpressionInterface instance, or an array of ExpressionInterface instances.
@param array|\Cake\D... | [
"Iterates",
"over",
"the",
"passed",
"in",
"conditions",
"and",
"ensures",
"that",
"there",
"is",
"a",
"matching",
"true",
"value",
"for",
"each",
".",
"If",
"no",
"matching",
"true",
"value",
"then",
"it",
"is",
"defaulted",
"to",
"1",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/CaseExpression.php#L113-L157 |
211,781 | cakephp/cakephp | src/Database/Expression/CaseExpression.php | CaseExpression._compile | protected function _compile($part, ValueBinder $generator)
{
if ($part instanceof ExpressionInterface) {
$part = $part->sql($generator);
} elseif (is_array($part)) {
$placeholder = $generator->placeholder('param');
$generator->bind($placeholder, $part['value'], $p... | php | protected function _compile($part, ValueBinder $generator)
{
if ($part instanceof ExpressionInterface) {
$part = $part->sql($generator);
} elseif (is_array($part)) {
$placeholder = $generator->placeholder('param');
$generator->bind($placeholder, $part['value'], $p... | [
"protected",
"function",
"_compile",
"(",
"$",
"part",
",",
"ValueBinder",
"$",
"generator",
")",
"{",
"if",
"(",
"$",
"part",
"instanceof",
"ExpressionInterface",
")",
"{",
"$",
"part",
"=",
"$",
"part",
"->",
"sql",
"(",
"$",
"generator",
")",
";",
"... | Compiles the relevant parts into sql
@param array|string|\Cake\Database\ExpressionInterface $part The part to compile
@param \Cake\Database\ValueBinder $generator Sql generator
@return string | [
"Compiles",
"the",
"relevant",
"parts",
"into",
"sql"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/CaseExpression.php#L193-L204 |
211,782 | cakephp/cakephp | src/Database/Expression/CaseExpression.php | CaseExpression.sql | public function sql(ValueBinder $generator)
{
$parts = [];
$parts[] = 'CASE';
foreach ($this->_conditions as $k => $part) {
$value = $this->_values[$k];
$parts[] = 'WHEN ' . $this->_compile($part, $generator) . ' THEN ' . $this->_compile($value, $generator);
}... | php | public function sql(ValueBinder $generator)
{
$parts = [];
$parts[] = 'CASE';
foreach ($this->_conditions as $k => $part) {
$value = $this->_values[$k];
$parts[] = 'WHEN ' . $this->_compile($part, $generator) . ' THEN ' . $this->_compile($value, $generator);
}... | [
"public",
"function",
"sql",
"(",
"ValueBinder",
"$",
"generator",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"$",
"parts",
"[",
"]",
"=",
"'CASE'",
";",
"foreach",
"(",
"$",
"this",
"->",
"_conditions",
"as",
"$",
"k",
"=>",
"$",
"part",
")",
"... | Converts the Node into a SQL string fragment.
@param \Cake\Database\ValueBinder $generator Placeholder generator object
@return string | [
"Converts",
"the",
"Node",
"into",
"a",
"SQL",
"string",
"fragment",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/CaseExpression.php#L213-L228 |
211,783 | cakephp/cakephp | src/Log/LogEngineRegistry.php | LogEngineRegistry._create | protected function _create($class, $alias, $settings)
{
if (is_callable($class)) {
$class = $class($alias);
}
if (is_object($class)) {
$instance = $class;
}
if (!isset($instance)) {
$instance = new $class($settings);
}
if... | php | protected function _create($class, $alias, $settings)
{
if (is_callable($class)) {
$class = $class($alias);
}
if (is_object($class)) {
$instance = $class;
}
if (!isset($instance)) {
$instance = new $class($settings);
}
if... | [
"protected",
"function",
"_create",
"(",
"$",
"class",
",",
"$",
"alias",
",",
"$",
"settings",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class",
"=",
"$",
"class",
"(",
"$",
"alias",
")",
";",
"}",
"if",
"(",
... | Create the logger instance.
Part of the template method for Cake\Core\ObjectRegistry::load()
@param string|\Psr\Log\LoggerInterface $class The classname or object to make.
@param string $alias The alias of the object.
@param array $settings An array of settings to use for the logger.
@return \Psr\Log\LoggerInterface ... | [
"Create",
"the",
"logger",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Log/LogEngineRegistry.php#L71-L92 |
211,784 | cakephp/cakephp | src/Console/HelpFormatter.php | HelpFormatter.text | public function text($width = 72)
{
$parser = $this->_parser;
$out = [];
$description = $parser->getDescription();
if (!empty($description)) {
$out[] = Text::wrap($description, $width);
$out[] = '';
}
$out[] = '<info>Usage:</info>';
$ou... | php | public function text($width = 72)
{
$parser = $this->_parser;
$out = [];
$description = $parser->getDescription();
if (!empty($description)) {
$out[] = Text::wrap($description, $width);
$out[] = '';
}
$out[] = '<info>Usage:</info>';
$ou... | [
"public",
"function",
"text",
"(",
"$",
"width",
"=",
"72",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"_parser",
";",
"$",
"out",
"=",
"[",
"]",
";",
"$",
"description",
"=",
"$",
"parser",
"->",
"getDescription",
"(",
")",
";",
"if",
"(",... | Get the help as formatted text suitable for output on the command line.
@param int $width The width of the help output.
@return string | [
"Get",
"the",
"help",
"as",
"formatted",
"text",
"suitable",
"for",
"output",
"on",
"the",
"command",
"line",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/HelpFormatter.php#L93-L158 |
211,785 | cakephp/cakephp | src/Console/HelpFormatter.php | HelpFormatter._getMaxLength | protected function _getMaxLength($collection)
{
$max = 0;
foreach ($collection as $item) {
$max = (strlen($item->name()) > $max) ? strlen($item->name()) : $max;
}
return $max;
} | php | protected function _getMaxLength($collection)
{
$max = 0;
foreach ($collection as $item) {
$max = (strlen($item->name()) > $max) ? strlen($item->name()) : $max;
}
return $max;
} | [
"protected",
"function",
"_getMaxLength",
"(",
"$",
"collection",
")",
"{",
"$",
"max",
"=",
"0",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"item",
")",
"{",
"$",
"max",
"=",
"(",
"strlen",
"(",
"$",
"item",
"->",
"name",
"(",
")",
")",
... | Iterate over a collection and find the longest named thing.
@param array $collection The collection to find a max length of.
@return int | [
"Iterate",
"over",
"a",
"collection",
"and",
"find",
"the",
"longest",
"named",
"thing",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/HelpFormatter.php#L200-L208 |
211,786 | cakephp/cakephp | src/Console/HelpFormatter.php | HelpFormatter.xml | public function xml($string = true)
{
$parser = $this->_parser;
$xml = new SimpleXMLElement('<shell></shell>');
$xml->addChild('command', $parser->getCommand());
$xml->addChild('description', $parser->getDescription());
$subcommands = $xml->addChild('subcommands');
f... | php | public function xml($string = true)
{
$parser = $this->_parser;
$xml = new SimpleXMLElement('<shell></shell>');
$xml->addChild('command', $parser->getCommand());
$xml->addChild('description', $parser->getDescription());
$subcommands = $xml->addChild('subcommands');
f... | [
"public",
"function",
"xml",
"(",
"$",
"string",
"=",
"true",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"_parser",
";",
"$",
"xml",
"=",
"new",
"SimpleXMLElement",
"(",
"'<shell></shell>'",
")",
";",
"$",
"xml",
"->",
"addChild",
"(",
"'command'... | Get the help as an xml string.
@param bool $string Return the SimpleXml object or a string. Defaults to true.
@return string|\SimpleXMLElement See $string | [
"Get",
"the",
"help",
"as",
"an",
"xml",
"string",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/HelpFormatter.php#L216-L238 |
211,787 | cakephp/cakephp | src/Shell/Task/LoadTask.php | LoadTask.makeOptions | protected function makeOptions()
{
$autoloadString = $this->param('autoload') ? "'autoload' => true" : '';
$bootstrapString = $this->param('bootstrap') ? "'bootstrap' => true" : '';
$routesString = $this->param('routes') ? "'routes' => true" : '';
return implode(', ', array_filter([... | php | protected function makeOptions()
{
$autoloadString = $this->param('autoload') ? "'autoload' => true" : '';
$bootstrapString = $this->param('bootstrap') ? "'bootstrap' => true" : '';
$routesString = $this->param('routes') ? "'routes' => true" : '';
return implode(', ', array_filter([... | [
"protected",
"function",
"makeOptions",
"(",
")",
"{",
"$",
"autoloadString",
"=",
"$",
"this",
"->",
"param",
"(",
"'autoload'",
")",
"?",
"\"'autoload' => true\"",
":",
"''",
";",
"$",
"bootstrapString",
"=",
"$",
"this",
"->",
"param",
"(",
"'bootstrap'",... | Create options string for the load call.
@return string | [
"Create",
"options",
"string",
"for",
"the",
"load",
"call",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/LoadTask.php#L72-L79 |
211,788 | cakephp/cakephp | src/Shell/Task/LoadTask.php | LoadTask.modifyApplication | protected function modifyApplication($app, $plugin, $options)
{
$file = new File($app, false);
$contents = $file->read();
$append = "\n \$this->addPlugin('%s', [%s]);\n";
$insert = str_replace(', []', '', sprintf($append, $plugin, $options));
if (!preg_match('/functi... | php | protected function modifyApplication($app, $plugin, $options)
{
$file = new File($app, false);
$contents = $file->read();
$append = "\n \$this->addPlugin('%s', [%s]);\n";
$insert = str_replace(', []', '', sprintf($append, $plugin, $options));
if (!preg_match('/functi... | [
"protected",
"function",
"modifyApplication",
"(",
"$",
"app",
",",
"$",
"plugin",
",",
"$",
"options",
")",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"app",
",",
"false",
")",
";",
"$",
"contents",
"=",
"$",
"file",
"->",
"read",
"(",
")",
... | Modify the application class
@param string $app The Application file to modify.
@param string $plugin The plugin name to add.
@param string $options The plugin options to add
@return void | [
"Modify",
"the",
"application",
"class"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Task/LoadTask.php#L89-L106 |
211,789 | cakephp/cakephp | src/Console/ConsoleInputOption.php | ConsoleInputOption.help | public function help($width = 0)
{
$default = $short = '';
if ($this->_default && $this->_default !== true) {
$default = sprintf(' <comment>(default: %s)</comment>', $this->_default);
}
if ($this->_choices) {
$default .= sprintf(' <comment>(choices: %s)</comme... | php | public function help($width = 0)
{
$default = $short = '';
if ($this->_default && $this->_default !== true) {
$default = sprintf(' <comment>(default: %s)</comment>', $this->_default);
}
if ($this->_choices) {
$default .= sprintf(' <comment>(choices: %s)</comme... | [
"public",
"function",
"help",
"(",
"$",
"width",
"=",
"0",
")",
"{",
"$",
"default",
"=",
"$",
"short",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"_default",
"&&",
"$",
"this",
"->",
"_default",
"!==",
"true",
")",
"{",
"$",
"default",
"=",
... | Generate the help for this this option.
@param int $width The width to make the name of the option.
@return string | [
"Generate",
"the",
"help",
"for",
"this",
"this",
"option",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleInputOption.php#L145-L163 |
211,790 | cakephp/cakephp | src/Console/ConsoleInputOption.php | ConsoleInputOption.usage | public function usage()
{
$name = (strlen($this->_short) > 0) ? ('-' . $this->_short) : ('--' . $this->_name);
$default = '';
if (strlen($this->_default) > 0 && $this->_default !== true) {
$default = ' ' . $this->_default;
}
if ($this->_choices) {
$def... | php | public function usage()
{
$name = (strlen($this->_short) > 0) ? ('-' . $this->_short) : ('--' . $this->_name);
$default = '';
if (strlen($this->_default) > 0 && $this->_default !== true) {
$default = ' ' . $this->_default;
}
if ($this->_choices) {
$def... | [
"public",
"function",
"usage",
"(",
")",
"{",
"$",
"name",
"=",
"(",
"strlen",
"(",
"$",
"this",
"->",
"_short",
")",
">",
"0",
")",
"?",
"(",
"'-'",
".",
"$",
"this",
"->",
"_short",
")",
":",
"(",
"'--'",
".",
"$",
"this",
"->",
"_name",
")... | Get the usage value for this option
@return string | [
"Get",
"the",
"usage",
"value",
"for",
"this",
"option"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleInputOption.php#L170-L182 |
211,791 | cakephp/cakephp | src/Console/ConsoleInputOption.php | ConsoleInputOption.xml | public function xml(SimpleXMLElement $parent)
{
$option = $parent->addChild('option');
$option->addAttribute('name', '--' . $this->_name);
$short = '';
if (strlen($this->_short) > 0) {
$short = '-' . $this->_short;
}
$option->addAttribute('short', $short);... | php | public function xml(SimpleXMLElement $parent)
{
$option = $parent->addChild('option');
$option->addAttribute('name', '--' . $this->_name);
$short = '';
if (strlen($this->_short) > 0) {
$short = '-' . $this->_short;
}
$option->addAttribute('short', $short);... | [
"public",
"function",
"xml",
"(",
"SimpleXMLElement",
"$",
"parent",
")",
"{",
"$",
"option",
"=",
"$",
"parent",
"->",
"addChild",
"(",
"'option'",
")",
";",
"$",
"option",
"->",
"addAttribute",
"(",
"'name'",
",",
"'--'",
".",
"$",
"this",
"->",
"_na... | Append the option's xml into the parent.
@param \SimpleXMLElement $parent The parent element.
@return \SimpleXMLElement The parent with this option appended. | [
"Append",
"the",
"option",
"s",
"xml",
"into",
"the",
"parent",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleInputOption.php#L246-L264 |
211,792 | cakephp/cakephp | src/Database/Expression/TupleComparison.php | TupleComparison._stringifyValues | protected function _stringifyValues($generator)
{
$values = [];
$parts = $this->getValue();
if ($parts instanceof ExpressionInterface) {
return $parts->sql($generator);
}
foreach ($parts as $i => $value) {
if ($value instanceof ExpressionInterface) {... | php | protected function _stringifyValues($generator)
{
$values = [];
$parts = $this->getValue();
if ($parts instanceof ExpressionInterface) {
return $parts->sql($generator);
}
foreach ($parts as $i => $value) {
if ($value instanceof ExpressionInterface) {... | [
"protected",
"function",
"_stringifyValues",
"(",
"$",
"generator",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"$",
"parts",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"$",
"parts",
"instanceof",
"ExpressionInterface",
")",
"{",
"r... | Returns a string with the values as placeholders in a string to be used
for the SQL version of this expression
@param \Cake\Database\ValueBinder $generator The value binder to convert expressions with.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"values",
"as",
"placeholders",
"in",
"a",
"string",
"to",
"be",
"used",
"for",
"the",
"SQL",
"version",
"of",
"this",
"expression"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/TupleComparison.php#L76-L113 |
211,793 | cakephp/cakephp | src/Database/Expression/TupleComparison.php | TupleComparison.traverse | public function traverse(callable $callable)
{
foreach ($this->getField() as $field) {
$this->_traverseValue($field, $callable);
}
$value = $this->getValue();
if ($value instanceof ExpressionInterface) {
$callable($value);
$value->traverse($callab... | php | public function traverse(callable $callable)
{
foreach ($this->getField() as $field) {
$this->_traverseValue($field, $callable);
}
$value = $this->getValue();
if ($value instanceof ExpressionInterface) {
$callable($value);
$value->traverse($callab... | [
"public",
"function",
"traverse",
"(",
"callable",
"$",
"callable",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getField",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"_traverseValue",
"(",
"$",
"field",
",",
"$",
"callable",
")",
";... | Traverses the tree of expressions stored in this object, visiting first
expressions in the left hand side and then the rest.
Callback function receives as its only argument an instance of an ExpressionInterface
@param callable $callable The callable to apply to sub-expressions
@return void | [
"Traverses",
"the",
"tree",
"of",
"expressions",
"stored",
"in",
"this",
"object",
"visiting",
"first",
"expressions",
"in",
"the",
"left",
"hand",
"side",
"and",
"then",
"the",
"rest",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/TupleComparison.php#L141-L164 |
211,794 | cakephp/cakephp | src/Http/ControllerFactory.php | ControllerFactory.getControllerClass | public function getControllerClass(ServerRequest $request)
{
$pluginPath = $controller = null;
$namespace = 'Controller';
if ($request->getParam('controller')) {
$controller = $request->getParam('controller');
}
if ($request->getParam('plugin')) {
$plu... | php | public function getControllerClass(ServerRequest $request)
{
$pluginPath = $controller = null;
$namespace = 'Controller';
if ($request->getParam('controller')) {
$controller = $request->getParam('controller');
}
if ($request->getParam('plugin')) {
$plu... | [
"public",
"function",
"getControllerClass",
"(",
"ServerRequest",
"$",
"request",
")",
"{",
"$",
"pluginPath",
"=",
"$",
"controller",
"=",
"null",
";",
"$",
"namespace",
"=",
"'Controller'",
";",
"if",
"(",
"$",
"request",
"->",
"getParam",
"(",
"'controlle... | Determine the controller class name based on current request and controller param
@param \Cake\Http\ServerRequest $request The request to build a controller for.
@return string|null | [
"Determine",
"the",
"controller",
"class",
"name",
"based",
"on",
"current",
"request",
"and",
"controller",
"param"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ControllerFactory.php#L58-L93 |
211,795 | cakephp/cakephp | src/Http/ControllerFactory.php | ControllerFactory.missingController | protected function missingController($request)
{
throw new MissingControllerException([
'class' => $request->getParam('controller'),
'plugin' => $request->getParam('plugin'),
'prefix' => $request->getParam('prefix'),
'_ext' => $request->getParam('_ext')
... | php | protected function missingController($request)
{
throw new MissingControllerException([
'class' => $request->getParam('controller'),
'plugin' => $request->getParam('plugin'),
'prefix' => $request->getParam('prefix'),
'_ext' => $request->getParam('_ext')
... | [
"protected",
"function",
"missingController",
"(",
"$",
"request",
")",
"{",
"throw",
"new",
"MissingControllerException",
"(",
"[",
"'class'",
"=>",
"$",
"request",
"->",
"getParam",
"(",
"'controller'",
")",
",",
"'plugin'",
"=>",
"$",
"request",
"->",
"getP... | Throws an exception when a controller is missing.
@param \Cake\Http\ServerRequest $request The request.
@throws \Cake\Routing\Exception\MissingControllerException
@return void | [
"Throws",
"an",
"exception",
"when",
"a",
"controller",
"is",
"missing",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ControllerFactory.php#L102-L110 |
211,796 | moodle/moodle | admin/tool/usertours/classes/local/filter/course.php | course.add_filter_to_form | public static function add_filter_to_form(\MoodleQuickForm &$mform) {
$options = ['multiple' => true];
$filtername = self::get_filter_name();
$key = "filter_{$filtername}";
$mform->addElement('course', $key, get_string($key, 'tool_usertours'), $options);
$mform->setDefault($key... | php | public static function add_filter_to_form(\MoodleQuickForm &$mform) {
$options = ['multiple' => true];
$filtername = self::get_filter_name();
$key = "filter_{$filtername}";
$mform->addElement('course', $key, get_string($key, 'tool_usertours'), $options);
$mform->setDefault($key... | [
"public",
"static",
"function",
"add_filter_to_form",
"(",
"\\",
"MoodleQuickForm",
"&",
"$",
"mform",
")",
"{",
"$",
"options",
"=",
"[",
"'multiple'",
"=>",
"true",
"]",
";",
"$",
"filtername",
"=",
"self",
"::",
"get_filter_name",
"(",
")",
";",
"$",
... | Overrides the base add form element with a course selector.
@param \MoodleQuickForm $mform | [
"Overrides",
"the",
"base",
"add",
"form",
"element",
"with",
"a",
"course",
"selector",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/local/filter/course.php#L53-L62 |
211,797 | moodle/moodle | admin/tool/usertours/classes/local/filter/course.php | course.prepare_filter_values_for_form | public static function prepare_filter_values_for_form(tour $tour, \stdClass $data) {
$filtername = static::get_filter_name();
$key = "filter_{$filtername}";
$values = $tour->get_filter_values($filtername);
if (empty($values)) {
$values = 0;
}
$data->$key = $va... | php | public static function prepare_filter_values_for_form(tour $tour, \stdClass $data) {
$filtername = static::get_filter_name();
$key = "filter_{$filtername}";
$values = $tour->get_filter_values($filtername);
if (empty($values)) {
$values = 0;
}
$data->$key = $va... | [
"public",
"static",
"function",
"prepare_filter_values_for_form",
"(",
"tour",
"$",
"tour",
",",
"\\",
"stdClass",
"$",
"data",
")",
"{",
"$",
"filtername",
"=",
"static",
"::",
"get_filter_name",
"(",
")",
";",
"$",
"key",
"=",
"\"filter_{$filtername}\"",
";"... | Overrides the base prepare the filter values for the form with an integer value.
@param tour $tour The tour to prepare values from
@param stdClass $data The data value
@return stdClass | [
"Overrides",
"the",
"base",
"prepare",
"the",
"filter",
"values",
"for",
"the",
"form",
"with",
"an",
"integer",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/local/filter/course.php#L91-L100 |
211,798 | moodle/moodle | admin/tool/usertours/classes/local/filter/course.php | course.save_filter_values_from_form | public static function save_filter_values_from_form(tour $tour, \stdClass $data) {
$filtername = static::get_filter_name();
$key = "filter_{$filtername}";
$newvalue = $data->$key;
if (empty($data->$key)) {
$newvalue = [];
}
$tour->set_filter_values($filtername... | php | public static function save_filter_values_from_form(tour $tour, \stdClass $data) {
$filtername = static::get_filter_name();
$key = "filter_{$filtername}";
$newvalue = $data->$key;
if (empty($data->$key)) {
$newvalue = [];
}
$tour->set_filter_values($filtername... | [
"public",
"static",
"function",
"save_filter_values_from_form",
"(",
"tour",
"$",
"tour",
",",
"\\",
"stdClass",
"$",
"data",
")",
"{",
"$",
"filtername",
"=",
"static",
"::",
"get_filter_name",
"(",
")",
";",
"$",
"key",
"=",
"\"filter_{$filtername}\"",
";",
... | Overrides the base save the filter values from the form to the tour.
@param tour $tour The tour to save values to
@param stdClass $data The data submitted in the form | [
"Overrides",
"the",
"base",
"save",
"the",
"filter",
"values",
"from",
"the",
"form",
"to",
"the",
"tour",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/local/filter/course.php#L108-L116 |
211,799 | moodle/moodle | mod/forum/locallib.php | forum_portfolio_caller.prepare_package | function prepare_package() {
global $CFG;
// set up the leap2a writer if we need it
$writingleap = false;
if ($this->exporter->get('formatclass') == PORTFOLIO_FORMAT_LEAP2A) {
$leapwriter = $this->exporter->get('format')->leap2a_writer();
$writingleap = true;
... | php | function prepare_package() {
global $CFG;
// set up the leap2a writer if we need it
$writingleap = false;
if ($this->exporter->get('formatclass') == PORTFOLIO_FORMAT_LEAP2A) {
$leapwriter = $this->exporter->get('format')->leap2a_writer();
$writingleap = true;
... | [
"function",
"prepare_package",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// set up the leap2a writer if we need it",
"$",
"writingleap",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"exporter",
"->",
"get",
"(",
"'formatclass'",
")",
"==",
"PORTFOLIO_FORMAT... | either a whole discussion
a single post, with or without attachment
or just an attachment with no post
@global object
@global object
@uses PORTFOLIO_FORMAT_RICH
@return mixed | [
"either",
"a",
"whole",
"discussion",
"a",
"single",
"post",
"with",
"or",
"without",
"attachment",
"or",
"just",
"an",
"attachment",
"with",
"no",
"post"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/locallib.php#L184-L241 |
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.