repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormHelper.php | FormHelper.appendMessagesWithPrefix | public function appendMessagesWithPrefix(MessageBag $messageBag, $prefix, array $keyedMessages)
{
foreach ($keyedMessages as $key => $messages) {
if ($prefix) {
$key = $this->transformToDotSyntax($prefix . '[' . $key . ']');
}
foreach ((array) $messages a... | php | public function appendMessagesWithPrefix(MessageBag $messageBag, $prefix, array $keyedMessages)
{
foreach ($keyedMessages as $key => $messages) {
if ($prefix) {
$key = $this->transformToDotSyntax($prefix . '[' . $key . ']');
}
foreach ((array) $messages a... | [
"public",
"function",
"appendMessagesWithPrefix",
"(",
"MessageBag",
"$",
"messageBag",
",",
"$",
"prefix",
",",
"array",
"$",
"keyedMessages",
")",
"{",
"foreach",
"(",
"$",
"keyedMessages",
"as",
"$",
"key",
"=>",
"$",
"messages",
")",
"{",
"if",
"(",
"$... | Add unprefixed messages with prefix to a MessageBag.
@return void | [
"Add",
"unprefixed",
"messages",
"with",
"prefix",
"to",
"a",
"MessageBag",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormHelper.php#L391-L402 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormHelper.php | FormHelper.checkFieldName | public function checkFieldName($name, $className)
{
if (!$name || trim($name) == '') {
throw new \InvalidArgumentException(
"Please provide valid field name for class [{$className}]"
);
}
if (in_array($name, static::$reservedFieldNames)) {
... | php | public function checkFieldName($name, $className)
{
if (!$name || trim($name) == '') {
throw new \InvalidArgumentException(
"Please provide valid field name for class [{$className}]"
);
}
if (in_array($name, static::$reservedFieldNames)) {
... | [
"public",
"function",
"checkFieldName",
"(",
"$",
"name",
",",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"name",
"||",
"trim",
"(",
"$",
"name",
")",
"==",
"''",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Please provide va... | Check if field name is valid and not reserved.
@throws \InvalidArgumentException
@param string $name
@param string $className | [
"Check",
"if",
"field",
"name",
"is",
"valid",
"and",
"not",
"reserved",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormHelper.php#L443-L459 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormBuilderTrait.php | FormBuilderTrait.form | protected function form($name, array $options = [], array $data = [])
{
return \App::make('laravel-form-builder')->create($name, $options, $data);
} | php | protected function form($name, array $options = [], array $data = [])
{
return \App::make('laravel-form-builder')->create($name, $options, $data);
} | [
"protected",
"function",
"form",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"\\",
"App",
"::",
"make",
"(",
"'laravel-form-builder'",
")",
"->",
"create",
"(",
"$",
"... | Create a Form instance.
@param string $name Full class name of the form class.
@param array $options Options to pass to the form.
@param array $data additional data to pass to the form.
@return \Kris\LaravelFormBuilder\Form | [
"Create",
"a",
"Form",
"instance",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormBuilderTrait.php#L17-L20 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Filters/Collection/HtmlEntities.php | HtmlEntities.filter | public function filter($value, $options = [])
{
$value = (string) $value;
$filtered = htmlentities(
$value,
$this->getQuoteStyle(),
$this->getEncoding(),
$this->getDoubleQuote()
);
if (strlen($value) && !strlen($filtered)) {
... | php | public function filter($value, $options = [])
{
$value = (string) $value;
$filtered = htmlentities(
$value,
$this->getQuoteStyle(),
$this->getEncoding(),
$this->getDoubleQuote()
);
if (strlen($value) && !strlen($filtered)) {
... | [
"public",
"function",
"filter",
"(",
"$",
"value",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"filtered",
"=",
"htmlentities",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"getQuoteSty... | @param string $value
@param array $options
@return mixed
@throws \Exception | [
"@param",
"string",
"$value",
"@param",
"array",
"$options"
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Filters/Collection/HtmlEntities.php#L160-L187 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Fields/CollectionType.php | CollectionType.setupChild | protected function setupChild(FormField $field, $name, $value = null)
{
$newFieldName = $field->getName().$name;
$firstFieldOptions = $this->formHelper->mergeOptions(
$this->getOption('options'),
['attr' => ['id' => $newFieldName]]
);
$field->setName($newFie... | php | protected function setupChild(FormField $field, $name, $value = null)
{
$newFieldName = $field->getName().$name;
$firstFieldOptions = $this->formHelper->mergeOptions(
$this->getOption('options'),
['attr' => ['id' => $newFieldName]]
);
$field->setName($newFie... | [
"protected",
"function",
"setupChild",
"(",
"FormField",
"$",
"field",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"newFieldName",
"=",
"$",
"field",
"->",
"getName",
"(",
")",
".",
"$",
"name",
";",
"$",
"firstFieldOptions",
"=",
... | Set up a single child element for a collection.
@param FormField $field
@param $name
@param null $value
@return FormField | [
"Set",
"up",
"a",
"single",
"child",
"element",
"for",
"a",
"collection",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Fields/CollectionType.php#L147-L170 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Fields/CollectionType.php | CollectionType.generatePrototype | protected function generatePrototype(FormField $field)
{
$value = $field instanceof ChildFormType ? false : null;
$field->setOption('is_prototype', true);
$field = $this->setupChild($field, $this->getPrototypeName(), $value);
if ($field instanceof ChildFormType) {
foreac... | php | protected function generatePrototype(FormField $field)
{
$value = $field instanceof ChildFormType ? false : null;
$field->setOption('is_prototype', true);
$field = $this->setupChild($field, $this->getPrototypeName(), $value);
if ($field instanceof ChildFormType) {
foreac... | [
"protected",
"function",
"generatePrototype",
"(",
"FormField",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"$",
"field",
"instanceof",
"ChildFormType",
"?",
"false",
":",
"null",
";",
"$",
"field",
"->",
"setOption",
"(",
"'is_prototype'",
",",
"true",
")",
... | Generate prototype for regular form field.
@param FormField $field
@return void | [
"Generate",
"prototype",
"for",
"regular",
"form",
"field",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Fields/CollectionType.php#L178-L193 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Fields/CollectionType.php | CollectionType.preparePrototype | public function preparePrototype(FormField $field)
{
if (!$field->getOption('is_prototype')) {
throw new \InvalidArgumentException(
'Field ['.$field->getRealName().'] is not a valid prototype object.'
);
}
$this->children = [];
$this->children... | php | public function preparePrototype(FormField $field)
{
if (!$field->getOption('is_prototype')) {
throw new \InvalidArgumentException(
'Field ['.$field->getRealName().'] is not a valid prototype object.'
);
}
$this->children = [];
$this->children... | [
"public",
"function",
"preparePrototype",
"(",
"FormField",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"->",
"getOption",
"(",
"'is_prototype'",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Field ['",
".",
"$",
"field",
... | Prepare collection for prototype by adding prototype as child.
@param FormField $field
@return void | [
"Prepare",
"collection",
"for",
"prototype",
"by",
"adding",
"prototype",
"as",
"child",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Fields/CollectionType.php#L211-L221 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Filters/Collection/PregReplace.php | PregReplace.filter | public function filter($value, $options = [])
{
if ($this->getPattern() == null) {
$ex = new \Exception(get_class($this) . ' does not have a valid MatchPattern set.');
throw $ex;
}
return preg_replace($this->getPattern(), $this->getReplacement(), $value);
} | php | public function filter($value, $options = [])
{
if ($this->getPattern() == null) {
$ex = new \Exception(get_class($this) . ' does not have a valid MatchPattern set.');
throw $ex;
}
return preg_replace($this->getPattern(), $this->getReplacement(), $value);
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPattern",
"(",
")",
"==",
"null",
")",
"{",
"$",
"ex",
"=",
"new",
"\\",
"Exception",
"(",
"get_class",
"(",
"$",
... | @param mixed $value
@param array $options
@return mixed
@throws \Exception | [
"@param",
"mixed",
"$value",
"@param",
"array",
"$options"
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Filters/Collection/PregReplace.php#L99-L107 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Filters/Collection/Trim.php | Trim.trimUnicode | protected function trimUnicode($value, $charList = '\\\\s')
{
$chars = preg_replace(
['/[\^\-\]\\\]/S', '/\\\{4}/S', '/\//'],
['\\\\\\0', '\\', '\/' ],
$charList
);
$pattern = '^[' . $chars . ']*|[' . $chars . ']*$';
return preg_replace("/$pattern... | php | protected function trimUnicode($value, $charList = '\\\\s')
{
$chars = preg_replace(
['/[\^\-\]\\\]/S', '/\\\{4}/S', '/\//'],
['\\\\\\0', '\\', '\/' ],
$charList
);
$pattern = '^[' . $chars . ']*|[' . $chars . ']*$';
return preg_replace("/$pattern... | [
"protected",
"function",
"trimUnicode",
"(",
"$",
"value",
",",
"$",
"charList",
"=",
"'\\\\\\\\s'",
")",
"{",
"$",
"chars",
"=",
"preg_replace",
"(",
"[",
"'/[\\^\\-\\]\\\\\\]/S'",
",",
"'/\\\\\\{4}/S'",
",",
"'/\\//'",
"]",
",",
"[",
"'\\\\\\\\\\\\0'",
",",
... | Unicode aware trim method
Fixes a PHP problem
@param string $value
@param string $charList
@return string | [
"Unicode",
"aware",
"trim",
"method",
"Fixes",
"a",
"PHP",
"problem"
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Filters/Collection/Trim.php#L79-L89 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Fields/ParentType.php | ParentType.render | public function render(array $options = [], $showLabel = true, $showField = true, $showError = true)
{
$options['children'] = $this->children;
return parent::render($options, $showLabel, $showField, $showError);
} | php | public function render(array $options = [], $showLabel = true, $showField = true, $showError = true)
{
$options['children'] = $this->children;
return parent::render($options, $showLabel, $showField, $showError);
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"showLabel",
"=",
"true",
",",
"$",
"showField",
"=",
"true",
",",
"$",
"showError",
"=",
"true",
")",
"{",
"$",
"options",
"[",
"'children'",
"]",
"=",
"$",
"th... | {inheritdoc} | [
"{",
"inheritdoc",
"}"
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Fields/ParentType.php#L57-L61 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.rebuildForm | public function rebuildForm()
{
$this->rebuilding = true;
// If form is plain, buildForm method is empty, so we need to take
// existing fields and add them again
if (get_class($this) === 'Kris\LaravelFormBuilder\Form') {
foreach ($this->fields as $name => $field) {
... | php | public function rebuildForm()
{
$this->rebuilding = true;
// If form is plain, buildForm method is empty, so we need to take
// existing fields and add them again
if (get_class($this) === 'Kris\LaravelFormBuilder\Form') {
foreach ($this->fields as $name => $field) {
... | [
"public",
"function",
"rebuildForm",
"(",
")",
"{",
"$",
"this",
"->",
"rebuilding",
"=",
"true",
";",
"// If form is plain, buildForm method is empty, so we need to take",
"// existing fields and add them again",
"if",
"(",
"get_class",
"(",
"$",
"this",
")",
"===",
"'... | Rebuild the form from scratch.
@return $this | [
"Rebuild",
"the",
"form",
"from",
"scratch",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L165-L182 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.makeField | protected function makeField($name, $type = 'text', array $options = [])
{
$this->setupFieldOptions($name, $options);
$fieldName = $this->getFieldName($name);
$fieldType = $this->getFieldType($type);
$field = new $fieldType($fieldName, $type, $this, $options);
$this->even... | php | protected function makeField($name, $type = 'text', array $options = [])
{
$this->setupFieldOptions($name, $options);
$fieldName = $this->getFieldName($name);
$fieldType = $this->getFieldType($type);
$field = new $fieldType($fieldName, $type, $this, $options);
$this->even... | [
"protected",
"function",
"makeField",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"'text'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setupFieldOptions",
"(",
"$",
"name",
",",
"$",
"options",
")",
";",
"$",
"fieldName",... | Create the FormField object.
@param string $name
@param string $type
@param array $options
@return FormField | [
"Create",
"the",
"FormField",
"object",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L192-L205 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.add | public function add($name, $type = 'text', array $options = [], $modify = false)
{
$this->formHelper->checkFieldName($name, get_class($this));
if ($this->rebuilding && !$this->has($name)) {
return $this;
}
$this->addField($this->makeField($name, $type, $options), $modif... | php | public function add($name, $type = 'text', array $options = [], $modify = false)
{
$this->formHelper->checkFieldName($name, get_class($this));
if ($this->rebuilding && !$this->has($name)) {
return $this;
}
$this->addField($this->makeField($name, $type, $options), $modif... | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"'text'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"modify",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"formHelper",
"->",
"checkFieldName",
"(",
"$",
"name",
",",... | Create a new field and add it to the form.
@param string $name
@param string $type
@param array $options
@param bool $modify
@return $this | [
"Create",
"a",
"new",
"field",
"and",
"add",
"it",
"to",
"the",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L216-L227 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.addField | protected function addField(FormField $field, $modify = false)
{
if (!$modify && !$this->rebuilding) {
$this->preventDuplicate($field->getRealName());
}
if ($field->getType() == 'file') {
$this->formOptions['files'] = true;
}
$this->fields[$field->g... | php | protected function addField(FormField $field, $modify = false)
{
if (!$modify && !$this->rebuilding) {
$this->preventDuplicate($field->getRealName());
}
if ($field->getType() == 'file') {
$this->formOptions['files'] = true;
}
$this->fields[$field->g... | [
"protected",
"function",
"addField",
"(",
"FormField",
"$",
"field",
",",
"$",
"modify",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"modify",
"&&",
"!",
"$",
"this",
"->",
"rebuilding",
")",
"{",
"$",
"this",
"->",
"preventDuplicate",
"(",
"$",
"fi... | Add a FormField to the form's fields.
@param FormField $field
@return $this | [
"Add",
"a",
"FormField",
"to",
"the",
"form",
"s",
"fields",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L235-L249 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.addBefore | public function addBefore($name, $fieldName, $type = 'text', $options = [], $modify = false)
{
$offset = array_search($name, array_keys($this->fields));
$beforeFields = array_slice($this->fields, 0, $offset);
$afterFields = array_slice($this->fields, $offset);
$this->fields = $befo... | php | public function addBefore($name, $fieldName, $type = 'text', $options = [], $modify = false)
{
$offset = array_search($name, array_keys($this->fields));
$beforeFields = array_slice($this->fields, 0, $offset);
$afterFields = array_slice($this->fields, $offset);
$this->fields = $befo... | [
"public",
"function",
"addBefore",
"(",
"$",
"name",
",",
"$",
"fieldName",
",",
"$",
"type",
"=",
"'text'",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"modify",
"=",
"false",
")",
"{",
"$",
"offset",
"=",
"array_search",
"(",
"$",
"name",
",",
... | Add field before another field.
@param string $name Name of the field before which new field is added.
@param string $fieldName Field name which will be added.
@param string $type
@param array $options
@param bool $modify
@return $this | [
"Add",
"field",
"before",
"another",
"field",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L261-L275 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.modify | public function modify($name, $type = 'text', array $options = [], $overwriteOptions = false)
{
// If we don't want to overwrite options, we merge them with old options.
if ($overwriteOptions === false && $this->has($name)) {
$options = $this->formHelper->mergeOptions(
$t... | php | public function modify($name, $type = 'text', array $options = [], $overwriteOptions = false)
{
// If we don't want to overwrite options, we merge them with old options.
if ($overwriteOptions === false && $this->has($name)) {
$options = $this->formHelper->mergeOptions(
$t... | [
"public",
"function",
"modify",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"'text'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"overwriteOptions",
"=",
"false",
")",
"{",
"// If we don't want to overwrite options, we merge them with old options.",
"if",... | Modify existing field. If it doesn't exist, it is added to form.
@param string $name
@param string $type
@param array $options
@param bool $overwriteOptions
@return Form | [
"Modify",
"existing",
"field",
".",
"If",
"it",
"doesn",
"t",
"exist",
"it",
"is",
"added",
"to",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L364-L375 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.renderForm | public function renderForm(array $options = [], $showStart = true, $showFields = true, $showEnd = true)
{
return $this->render($options, $this->fields, $showStart, $showFields, $showEnd);
} | php | public function renderForm(array $options = [], $showStart = true, $showFields = true, $showEnd = true)
{
return $this->render($options, $this->fields, $showStart, $showFields, $showEnd);
} | [
"public",
"function",
"renderForm",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"showStart",
"=",
"true",
",",
"$",
"showFields",
"=",
"true",
",",
"$",
"showEnd",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"render",
"(",
"$",
"... | Render full form.
@param array $options
@param bool $showStart
@param bool $showFields
@param bool $showEnd
@return string | [
"Render",
"full",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L386-L389 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.renderRest | public function renderRest($showFormEnd = true, $showFields = true)
{
$fields = $this->getUnrenderedFields();
return $this->render([], $fields, false, $showFields, $showFormEnd);
} | php | public function renderRest($showFormEnd = true, $showFields = true)
{
$fields = $this->getUnrenderedFields();
return $this->render([], $fields, false, $showFields, $showFormEnd);
} | [
"public",
"function",
"renderRest",
"(",
"$",
"showFormEnd",
"=",
"true",
",",
"$",
"showFields",
"=",
"true",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getUnrenderedFields",
"(",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"[",
"]",
... | Render rest of the form.
@param bool $showFormEnd
@param bool $showFields
@return string | [
"Render",
"rest",
"of",
"the",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L398-L403 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getField | public function getField($name)
{
if ($this->has($name)) {
return $this->fields[$name];
}
$this->fieldDoesNotExist($name);
} | php | public function getField($name)
{
if ($this->has($name)) {
return $this->fields[$name];
}
$this->fieldDoesNotExist($name);
} | [
"public",
"function",
"getField",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
";",
"}",
"$",
"this",
"->",
"fieldDoesNotExist",
"(... | Get single field instance from form object.
@param string $name
@return FormField | [
"Get",
"single",
"field",
"instance",
"from",
"form",
"object",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L440-L447 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getConfig | public function getConfig($key = null, $default = null)
{
return $this->formHelper->getConfig($key, $default, $this->formConfig);
} | php | public function getConfig($key = null, $default = null)
{
return $this->formHelper->getConfig($key, $default, $this->formConfig);
} | [
"public",
"function",
"getConfig",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"formHelper",
"->",
"getConfig",
"(",
"$",
"key",
",",
"$",
"default",
",",
"$",
"this",
"->",
"formConfig",
")"... | Get the passed config key using the custom
form config, if any.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"the",
"passed",
"config",
"key",
"using",
"the",
"custom",
"form",
"config",
"if",
"any",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L511-L514 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.setFormOptions | public function setFormOptions(array $formOptions)
{
$this->formOptions = $this->formHelper->mergeOptions($this->formOptions, $formOptions);
$this->checkIfNamedForm();
$this->pullFromOptions('data', 'addData');
$this->pullFromOptions('model', 'setupModel');
$this->pullFromOpt... | php | public function setFormOptions(array $formOptions)
{
$this->formOptions = $this->formHelper->mergeOptions($this->formOptions, $formOptions);
$this->checkIfNamedForm();
$this->pullFromOptions('data', 'addData');
$this->pullFromOptions('model', 'setupModel');
$this->pullFromOpt... | [
"public",
"function",
"setFormOptions",
"(",
"array",
"$",
"formOptions",
")",
"{",
"$",
"this",
"->",
"formOptions",
"=",
"$",
"this",
"->",
"formHelper",
"->",
"mergeOptions",
"(",
"$",
"this",
"->",
"formOptions",
",",
"$",
"formOptions",
")",
";",
"$",... | Set form options.
@param array $formOptions
@return $this | [
"Set",
"form",
"options",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L522-L535 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.pullFromOptions | protected function pullFromOptions($name, $method)
{
if (Arr::get($this->formOptions, $name) !== null) {
$this->{$method}(Arr::pull($this->formOptions, $name));
}
} | php | protected function pullFromOptions($name, $method)
{
if (Arr::get($this->formOptions, $name) !== null) {
$this->{$method}(Arr::pull($this->formOptions, $name));
}
} | [
"protected",
"function",
"pullFromOptions",
"(",
"$",
"name",
",",
"$",
"method",
")",
"{",
"if",
"(",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"formOptions",
",",
"$",
"name",
")",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"method",... | Get an option from provided options and call method with that value.
@param string $name
@param string $method | [
"Get",
"an",
"option",
"from",
"provided",
"options",
"and",
"call",
"method",
"with",
"that",
"value",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L543-L548 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.setName | public function setName($name, $rebuild = true)
{
$this->name = $name;
if ($rebuild) {
$this->rebuildForm();
}
return $this;
} | php | public function setName($name, $rebuild = true)
{
$this->name = $name;
if ($rebuild) {
$this->rebuildForm();
}
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
",",
"$",
"rebuild",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"rebuild",
")",
"{",
"$",
"this",
"->",
"rebuildForm",
"(",
")",
";",
"}",
"return",
... | Set the name of the form.
@param string $name
@param bool $rebuild
@return $this | [
"Set",
"the",
"name",
"of",
"the",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L613-L622 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.addCustomField | public function addCustomField($name, $class)
{
if ($this->rebuilding && $this->formHelper->hasCustomField($name)) {
return $this;
}
$this->formHelper->addCustomField($name, $class);
} | php | public function addCustomField($name, $class)
{
if ($this->rebuilding && $this->formHelper->hasCustomField($name)) {
return $this;
}
$this->formHelper->addCustomField($name, $class);
} | [
"public",
"function",
"addCustomField",
"(",
"$",
"name",
",",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"rebuilding",
"&&",
"$",
"this",
"->",
"formHelper",
"->",
"hasCustomField",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
... | Add custom field.
@param $name
@param $class | [
"Add",
"custom",
"field",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L739-L746 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getUnrenderedFields | protected function getUnrenderedFields()
{
$unrenderedFields = [];
foreach ($this->fields as $field) {
if (!$field->isRendered()) {
$unrenderedFields[] = $field;
continue;
}
}
return $unrenderedFields;
} | php | protected function getUnrenderedFields()
{
$unrenderedFields = [];
foreach ($this->fields as $field) {
if (!$field->isRendered()) {
$unrenderedFields[] = $field;
continue;
}
}
return $unrenderedFields;
} | [
"protected",
"function",
"getUnrenderedFields",
"(",
")",
"{",
"$",
"unrenderedFields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"->",
"isRendered",
"(",
")",
")",
"{... | Get all fields that are not rendered.
@return array | [
"Get",
"all",
"fields",
"that",
"are",
"not",
"rendered",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L978-L990 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.checkIfNamedForm | protected function checkIfNamedForm()
{
if ($this->getFormOption('name')) {
$this->name = Arr::pull($this->formOptions, 'name', $this->name);
}
} | php | protected function checkIfNamedForm()
{
if ($this->getFormOption('name')) {
$this->name = Arr::pull($this->formOptions, 'name', $this->name);
}
} | [
"protected",
"function",
"checkIfNamedForm",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getFormOption",
"(",
"'name'",
")",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"Arr",
"::",
"pull",
"(",
"$",
"this",
"->",
"formOptions",
",",
"'name'",
",",
"... | Check if form is named form.
@return void | [
"Check",
"if",
"form",
"is",
"named",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1024-L1029 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.setupNamedModel | protected function setupNamedModel()
{
if (!$this->getModel() || !$this->getName()) {
return false;
}
$dotName = $this->formHelper->transformToDotSyntax($this->getName());
$model = $this->formHelper->convertModelToArray($this->getModel());
$isCollectionFormModel ... | php | protected function setupNamedModel()
{
if (!$this->getModel() || !$this->getName()) {
return false;
}
$dotName = $this->formHelper->transformToDotSyntax($this->getName());
$model = $this->formHelper->convertModelToArray($this->getModel());
$isCollectionFormModel ... | [
"protected",
"function",
"setupNamedModel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getModel",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"getName",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"dotName",
"=",
"$",
"this",
"->",
... | Set namespace to model if form is named so the data is bound properly.
Returns true if model is changed, otherwise false.
@return bool | [
"Set",
"namespace",
"to",
"model",
"if",
"form",
"is",
"named",
"so",
"the",
"data",
"is",
"bound",
"properly",
".",
"Returns",
"true",
"if",
"model",
"is",
"changed",
"otherwise",
"false",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1048-L1068 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getFieldName | protected function getFieldName($name)
{
$formName = $this->getName();
if ($formName !== null) {
if (strpos($formName, '[') !== false || strpos($formName, ']') !== false) {
return $this->formHelper->transformToBracketSyntax(
$this->formHelper->transfor... | php | protected function getFieldName($name)
{
$formName = $this->getName();
if ($formName !== null) {
if (strpos($formName, '[') !== false || strpos($formName, ']') !== false) {
return $this->formHelper->transformToBracketSyntax(
$this->formHelper->transfor... | [
"protected",
"function",
"getFieldName",
"(",
"$",
"name",
")",
"{",
"$",
"formName",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"$",
"formName",
"!==",
"null",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"formName",
",",
"'['",
")",... | If form is named form, modify names to be contained in single key (parent[child_field_name]).
@param string $name
@return string | [
"If",
"form",
"is",
"named",
"form",
"modify",
"names",
"to",
"be",
"contained",
"in",
"single",
"key",
"(",
"parent",
"[",
"child_field_name",
"]",
")",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1134-L1150 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.validate | public function validate($validationRules = [], $messages = [])
{
$fieldRules = $this->formHelper->mergeFieldsRules($this->fields);
$rules = array_merge($fieldRules->getRules(), $validationRules);
$messages = array_merge($fieldRules->getMessages(), $messages);
$this->validator = $th... | php | public function validate($validationRules = [], $messages = [])
{
$fieldRules = $this->formHelper->mergeFieldsRules($this->fields);
$rules = array_merge($fieldRules->getRules(), $validationRules);
$messages = array_merge($fieldRules->getMessages(), $messages);
$this->validator = $th... | [
"public",
"function",
"validate",
"(",
"$",
"validationRules",
"=",
"[",
"]",
",",
"$",
"messages",
"=",
"[",
"]",
")",
"{",
"$",
"fieldRules",
"=",
"$",
"this",
"->",
"formHelper",
"->",
"mergeFieldsRules",
"(",
"$",
"this",
"->",
"fields",
")",
";",
... | Validate the form.
@param array $validationRules
@param array $messages
@return Validator | [
"Validate",
"the",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1179-L1191 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getRules | public function getRules($overrideRules = [])
{
$fieldRules = $this->formHelper->mergeFieldsRules($this->fields);
return array_merge($fieldRules->getRules(), $overrideRules);
} | php | public function getRules($overrideRules = [])
{
$fieldRules = $this->formHelper->mergeFieldsRules($this->fields);
return array_merge($fieldRules->getRules(), $overrideRules);
} | [
"public",
"function",
"getRules",
"(",
"$",
"overrideRules",
"=",
"[",
"]",
")",
"{",
"$",
"fieldRules",
"=",
"$",
"this",
"->",
"formHelper",
"->",
"mergeFieldsRules",
"(",
"$",
"this",
"->",
"fields",
")",
";",
"return",
"array_merge",
"(",
"$",
"field... | Get validation rules for the form.
@param array $overrideRules
@return array | [
"Get",
"validation",
"rules",
"for",
"the",
"form",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1199-L1204 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.redirectIfNotValid | public function redirectIfNotValid($destination = null)
{
if (! $this->isValid()) {
$response = redirect($destination);
if (is_null($destination)) {
$response = $response->back();
}
$response = $response->withErrors($this->getErrors(), $this-... | php | public function redirectIfNotValid($destination = null)
{
if (! $this->isValid()) {
$response = redirect($destination);
if (is_null($destination)) {
$response = $response->back();
}
$response = $response->withErrors($this->getErrors(), $this-... | [
"public",
"function",
"redirectIfNotValid",
"(",
"$",
"destination",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"response",
"=",
"redirect",
"(",
"$",
"destination",
")",
";",
"if",
"(",
"is_null",
"... | Redirects to a destination when form is invalid.
@param string|null $destination The target url.
@return HttpResponseException | [
"Redirects",
"to",
"a",
"destination",
"when",
"form",
"is",
"invalid",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1212-L1225 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.isValid | public function isValid()
{
if (!$this->validator) {
$this->validate();
}
$isValid = !$this->validator->fails();
$this->formHelper->alterValid($this, $this, $isValid);
$this->eventDispatcher->dispatch(new AfterFormValidation($this, $this->validator, $isValid));... | php | public function isValid()
{
if (!$this->validator) {
$this->validate();
}
$isValid = !$this->validator->fails();
$this->formHelper->alterValid($this, $this, $isValid);
$this->eventDispatcher->dispatch(new AfterFormValidation($this, $this->validator, $isValid));... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validator",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
")",
";",
"}",
"$",
"isValid",
"=",
"!",
"$",
"this",
"->",
"validator",
"->",
"fails",
"(",
")",
";",
... | Check if the form is valid.
@return bool | [
"Check",
"if",
"the",
"form",
"is",
"valid",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1242-L1255 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getErrors | public function getErrors()
{
if (!$this->validator || !$this->validator instanceof Validator) {
throw new \InvalidArgumentException(
sprintf(
'Form %s was not validated. To validate it, call "isValid" method before retrieving the errors',
... | php | public function getErrors()
{
if (!$this->validator || !$this->validator instanceof Validator) {
throw new \InvalidArgumentException(
sprintf(
'Form %s was not validated. To validate it, call "isValid" method before retrieving the errors',
... | [
"public",
"function",
"getErrors",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validator",
"||",
"!",
"$",
"this",
"->",
"validator",
"instanceof",
"Validator",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Form ... | Get validation errors.
@return array | [
"Get",
"validation",
"errors",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1274-L1286 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getFieldValues | public function getFieldValues($with_nulls = true)
{
$request_values = $this->getRequest()->all();
$values = [];
foreach ($this->getAllAttributes() as $attribute) {
$value = Arr::get($request_values, $attribute);
if ($with_nulls || $value !== null) {
... | php | public function getFieldValues($with_nulls = true)
{
$request_values = $this->getRequest()->all();
$values = [];
foreach ($this->getAllAttributes() as $attribute) {
$value = Arr::get($request_values, $attribute);
if ($with_nulls || $value !== null) {
... | [
"public",
"function",
"getFieldValues",
"(",
"$",
"with_nulls",
"=",
"true",
")",
"{",
"$",
"request_values",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"all",
"(",
")",
";",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
... | Get all Request values from all fields, and nothing else.
@param bool $with_nulls
@return array | [
"Get",
"all",
"Request",
"values",
"from",
"all",
"fields",
"and",
"nothing",
"else",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1294-L1316 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.filterFields | public function filterFields()
{
// If filtering is unlocked/allowed we can start with filtering process.
if (!$this->isFilteringLocked()) {
$filters = array_filter($this->getFilters());
if (count($filters)) {
$dotForm = $this->formHelper->transformToDotSynta... | php | public function filterFields()
{
// If filtering is unlocked/allowed we can start with filtering process.
if (!$this->isFilteringLocked()) {
$filters = array_filter($this->getFilters());
if (count($filters)) {
$dotForm = $this->formHelper->transformToDotSynta... | [
"public",
"function",
"filterFields",
"(",
")",
"{",
"// If filtering is unlocked/allowed we can start with filtering process.",
"if",
"(",
"!",
"$",
"this",
"->",
"isFilteringLocked",
"(",
")",
")",
"{",
"$",
"filters",
"=",
"array_filter",
"(",
"$",
"this",
"->",
... | Method filterFields used as *Main* method for starting
filtering and request field mutating process.
@return \Kris\LaravelFormBuilder\Form | [
"Method",
"filterFields",
"used",
"as",
"*",
"Main",
"*",
"method",
"for",
"starting",
"filtering",
"and",
"request",
"field",
"mutating",
"process",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1346-L1381 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getFilters | public function getFilters()
{
$filters = [];
foreach ($this->getFields() as $field) {
$filters[$field->getName()] = $field->getFilters();
}
return $filters;
} | php | public function getFilters()
{
$filters = [];
foreach ($this->getFields() as $field) {
$filters[$field->getName()] = $field->getFilters();
}
return $filters;
} | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"filters",
"[",
"$",
"field",
"->",
"getName",
"(",
")",
"]",
"=",... | Method getFilters used to return array of all binded filters to form fields.
@return array | [
"Method",
"getFilters",
"used",
"to",
"return",
"array",
"of",
"all",
"binded",
"filters",
"to",
"form",
"fields",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1388-L1396 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Form.php | Form.getRawValues | public function getRawValues()
{
$rawValues = [];
foreach ($this->getFields() as $field) {
$rawValues[$field->getName()] = $field->getRawValue();
}
return $rawValues;
} | php | public function getRawValues()
{
$rawValues = [];
foreach ($this->getFields() as $field) {
$rawValues[$field->getName()] = $field->getRawValue();
}
return $rawValues;
} | [
"public",
"function",
"getRawValues",
"(",
")",
"{",
"$",
"rawValues",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"rawValues",
"[",
"$",
"field",
"->",
"getName",
"(",
")",
"]",
... | Method getRawValues returns Unfiltered/Unmutated fields -> values.
@return array | [
"Method",
"getRawValues",
"returns",
"Unfiltered",
"/",
"Unmutated",
"fields",
"-",
">",
"values",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Form.php#L1437-L1445 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormBuilder.php | FormBuilder.create | public function create($formClass, array $options = [], array $data = [])
{
$class = $this->getNamespaceFromConfig() . $formClass;
if (!class_exists($class)) {
throw new \InvalidArgumentException(
'Form class with name ' . $class . ' does not exist.'
);
... | php | public function create($formClass, array $options = [], array $data = [])
{
$class = $this->getNamespaceFromConfig() . $formClass;
if (!class_exists($class)) {
throw new \InvalidArgumentException(
'Form class with name ' . $class . ' does not exist.'
);
... | [
"public",
"function",
"create",
"(",
"$",
"formClass",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getNamespaceFromConfig",
"(",
")",
".",
"$",
"formClass",
... | Create a Form instance.
@param string $formClass The name of the class that inherits \Kris\LaravelFormBuilder\Form.
@param array $options|null
@param array $data|null
@return Form | [
"Create",
"a",
"Form",
"instance",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormBuilder.php#L64-L83 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormBuilder.php | FormBuilder.plain | public function plain(array $options = [], array $data = [])
{
$form = $this->setDependenciesAndOptions(
$this->container->make($this->plainFormClass),
$options,
$data
);
$this->eventDispatcher->dispatch(new AfterFormCreation($form));
$form->filt... | php | public function plain(array $options = [], array $data = [])
{
$form = $this->setDependenciesAndOptions(
$this->container->make($this->plainFormClass),
$options,
$data
);
$this->eventDispatcher->dispatch(new AfterFormCreation($form));
$form->filt... | [
"public",
"function",
"plain",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"setDependenciesAndOptions",
"(",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
... | Get instance of the empty form which can be modified.
@param array $options
@param array $data
@return \Kris\LaravelFormBuilder\Form | [
"Get",
"instance",
"of",
"the",
"empty",
"form",
"which",
"can",
"be",
"modified",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormBuilder.php#L177-L190 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/FormBuilder.php | FormBuilder.setDependenciesAndOptions | public function setDependenciesAndOptions($instance, array $options = [], array $data = [])
{
return $instance
->addData($data)
->setRequest($this->container->make('request'))
->setFormHelper($this->formHelper)
->setEventDispatcher($this->eventDispatcher)
... | php | public function setDependenciesAndOptions($instance, array $options = [], array $data = [])
{
return $instance
->addData($data)
->setRequest($this->container->make('request'))
->setFormHelper($this->formHelper)
->setEventDispatcher($this->eventDispatcher)
... | [
"public",
"function",
"setDependenciesAndOptions",
"(",
"$",
"instance",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"instance",
"->",
"addData",
"(",
"$",
"data",
")",
"->",
"setReque... | Set depedencies and options on existing form instance
@param \Kris\LaravelFormBuilder\Form $instance
@param array $options
@param array $data
@return \Kris\LaravelFormBuilder\Form | [
"Set",
"depedencies",
"and",
"options",
"on",
"existing",
"form",
"instance"
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/FormBuilder.php#L200-L210 |
kristijanhusak/laravel-form-builder | src/Kris/LaravelFormBuilder/Fields/EntityType.php | EntityType.pluck | protected function pluck($value, $key, $data)
{
if (!is_object($data)) {
return $data;
}
if (method_exists($data, 'pluck') || $data instanceof Model) {
//laravel 5.3.*
return $data->pluck($value, $key);
} elseif (method_exists($data, 'lists')) {
... | php | protected function pluck($value, $key, $data)
{
if (!is_object($data)) {
return $data;
}
if (method_exists($data, 'pluck') || $data instanceof Model) {
//laravel 5.3.*
return $data->pluck($value, $key);
} elseif (method_exists($data, 'lists')) {
... | [
"protected",
"function",
"pluck",
"(",
"$",
"value",
",",
"$",
"key",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"data",
",",
... | Pluck data.
@param string $value
@param string $key
@param mixed $data
@return mixed | [
"Pluck",
"data",
"."
] | train | https://github.com/kristijanhusak/laravel-form-builder/blob/06a1202861e612d088306f6a329d6f01b0f51d71/src/Kris/LaravelFormBuilder/Fields/EntityType.php#L93-L106 |
schmittjoh/JMSSerializerBundle | DependencyInjection/Compiler/CustomHandlersPass.php | CustomHandlersPass.stable_uasort | private static function stable_uasort(array &$array, $value_compare_func)
{
$index = 0;
foreach ($array as &$item) {
$item = array($index++, $item);
}
$result = uasort($array, function ($a, $b) use ($value_compare_func) {
$result = call_user_func($value_compar... | php | private static function stable_uasort(array &$array, $value_compare_func)
{
$index = 0;
foreach ($array as &$item) {
$item = array($index++, $item);
}
$result = uasort($array, function ($a, $b) use ($value_compare_func) {
$result = call_user_func($value_compar... | [
"private",
"static",
"function",
"stable_uasort",
"(",
"array",
"&",
"$",
"array",
",",
"$",
"value_compare_func",
")",
"{",
"$",
"index",
"=",
"0",
";",
"foreach",
"(",
"$",
"array",
"as",
"&",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"array",
"(",
... | Performs stable sorting. Copied from http://php.net/manual/en/function.uasort.php#121283
@param array $array
@param $value_compare_func
@return bool | [
"Performs",
"stable",
"sorting",
".",
"Copied",
"from",
"http",
":",
"//",
"php",
".",
"net",
"/",
"manual",
"/",
"en",
"/",
"function",
".",
"uasort",
".",
"php#121283"
] | train | https://github.com/schmittjoh/JMSSerializerBundle/blob/96f3505b95a9bb7fa4b3408ef8d175856ef0be97/DependencyInjection/Compiler/CustomHandlersPass.php#L115-L129 |
schmittjoh/JMSSerializerBundle | Cache/CacheWarmer.php | CacheWarmer.findClasses | private static function findClasses($path)
{
$extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
$extraTypes .= '|enum';
}
// Use @ here instead of Silencer to actively suppress 'unhelpful' ou... | php | private static function findClasses($path)
{
$extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
$extraTypes .= '|enum';
}
// Use @ here instead of Silencer to actively suppress 'unhelpful' ou... | [
"private",
"static",
"function",
"findClasses",
"(",
"$",
"path",
")",
"{",
"$",
"extraTypes",
"=",
"PHP_VERSION_ID",
"<",
"50400",
"?",
"''",
":",
"'|trait'",
";",
"if",
"(",
"defined",
"(",
"'HHVM_VERSION'",
")",
"&&",
"version_compare",
"(",
"HHVM_VERSION... | Extract the classes in the given file.
This has been copied from https://github.com/composer/composer/blob/bfed974ae969635e622c4844e5e69526d8459baf/src/Composer/Autoload/ClassMapGenerator.php#L120-L214
@param string $path The file to check
@throws \RuntimeException
@return array The found classes | [
"Extract",
"the",
"classes",
"in",
"the",
"given",
"file",
"."
] | train | https://github.com/schmittjoh/JMSSerializerBundle/blob/96f3505b95a9bb7fa4b3408ef8d175856ef0be97/Cache/CacheWarmer.php#L66-L152 |
schmittjoh/JMSSerializerBundle | DependencyInjection/Compiler/ExpressionFunctionProviderPass.php | ExpressionFunctionProviderPass.process | public function process(ContainerBuilder $container)
{
try {
$registryDefinition = $container->findDefinition('jms_serializer.expression_language');
foreach (array_keys($container->findTaggedServiceIds('jms.expression.function_provider')) as $id) {
$registryDefinitio... | php | public function process(ContainerBuilder $container)
{
try {
$registryDefinition = $container->findDefinition('jms_serializer.expression_language');
foreach (array_keys($container->findTaggedServiceIds('jms.expression.function_provider')) as $id) {
$registryDefinitio... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"try",
"{",
"$",
"registryDefinition",
"=",
"$",
"container",
"->",
"findDefinition",
"(",
"'jms_serializer.expression_language'",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/schmittjoh/JMSSerializerBundle/blob/96f3505b95a9bb7fa4b3408ef8d175856ef0be97/DependencyInjection/Compiler/ExpressionFunctionProviderPass.php#L16-L27 |
schmittjoh/JMSSerializerBundle | ContextFactory/ConfiguredContextFactory.php | ConfiguredContextFactory.configureContext | private function configureContext(Context $context)
{
foreach ($this->attributes as $key => $value) {
$context->setAttribute($key, $value);
}
if (!empty($this->groups)) {
$context->setGroups($this->groups);
}
if (($context instanceof SerializationCont... | php | private function configureContext(Context $context)
{
foreach ($this->attributes as $key => $value) {
$context->setAttribute($key, $value);
}
if (!empty($this->groups)) {
$context->setGroups($this->groups);
}
if (($context instanceof SerializationCont... | [
"private",
"function",
"configureContext",
"(",
"Context",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"context",
"->",
"setAttribute",
"(",
"$",
"key",
",",
"$",
"valu... | Configures context according to configuration
@param Context $context The context
@return Context Given object | [
"Configures",
"context",
"according",
"to",
"configuration"
] | train | https://github.com/schmittjoh/JMSSerializerBundle/blob/96f3505b95a9bb7fa4b3408ef8d175856ef0be97/ContextFactory/ConfiguredContextFactory.php#L111-L133 |
Propaganistas/Laravel-Phone | src/Validation/Phone.php | Phone.validate | public function validate($attribute, $value, array $parameters, $validator)
{
$data = $validator->getData();
list(
$countries,
$types,
$detect,
$lenient) = $this->extractParameters($attribute, $parameters, $data);
// A "null" country is prepe... | php | public function validate($attribute, $value, array $parameters, $validator)
{
$data = $validator->getData();
list(
$countries,
$types,
$detect,
$lenient) = $this->extractParameters($attribute, $parameters, $data);
// A "null" country is prepe... | [
"public",
"function",
"validate",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"array",
"$",
"parameters",
",",
"$",
"validator",
")",
"{",
"$",
"data",
"=",
"$",
"validator",
"->",
"getData",
"(",
")",
";",
"list",
"(",
"$",
"countries",
",",
"$",... | Validates a phone number.
@param string $attribute
@param mixed $value
@param array $parameters
@param object $validator
@return bool | [
"Validates",
"a",
"phone",
"number",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Validation/Phone.php#L39-L91 |
Propaganistas/Laravel-Phone | src/Validation/Phone.php | Phone.extractParameters | protected function extractParameters($attribute, array $parameters, array $data)
{
$parameters = array_map('strtolower', $parameters);
// Discover if an input field was provided. If not, guess the field's name.
$inputField = Collection::make($parameters)
->in... | php | protected function extractParameters($attribute, array $parameters, array $data)
{
$parameters = array_map('strtolower', $parameters);
// Discover if an input field was provided. If not, guess the field's name.
$inputField = Collection::make($parameters)
->in... | [
"protected",
"function",
"extractParameters",
"(",
"$",
"attribute",
",",
"array",
"$",
"parameters",
",",
"array",
"$",
"data",
")",
"{",
"$",
"parameters",
"=",
"array_map",
"(",
"'strtolower'",
",",
"$",
"parameters",
")",
";",
"// Discover if an input field ... | Parse and extract parameters in the appropriate validation arguments.
@param string $attribute
@param array $parameters
@param array $data
@return array
@throws \Propaganistas\LaravelPhone\Exceptions\InvalidParameterException | [
"Parse",
"and",
"extract",
"parameters",
"in",
"the",
"appropriate",
"validation",
"arguments",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Validation/Phone.php#L102-L131 |
Propaganistas/Laravel-Phone | src/Traits/ParsesFormats.php | ParsesFormats.parseFormat | protected static function parseFormat($format)
{
static::loadFormats();
// If the format equals a constant's value, just return it.
if (in_array($format, static::$formats, true)) {
return $format;
}
// Otherwise we'll assume the format is the constant's name.
... | php | protected static function parseFormat($format)
{
static::loadFormats();
// If the format equals a constant's value, just return it.
if (in_array($format, static::$formats, true)) {
return $format;
}
// Otherwise we'll assume the format is the constant's name.
... | [
"protected",
"static",
"function",
"parseFormat",
"(",
"$",
"format",
")",
"{",
"static",
"::",
"loadFormats",
"(",
")",
";",
"// If the format equals a constant's value, just return it.",
"if",
"(",
"in_array",
"(",
"$",
"format",
",",
"static",
"::",
"$",
"forma... | Parse a phone format.
@param string $format
@return string | [
"Parse",
"a",
"phone",
"format",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Traits/ParsesFormats.php#L33-L44 |
Propaganistas/Laravel-Phone | src/Exceptions/NumberParseException.php | NumberParseException.countryMismatch | public static function countryMismatch($number, $countries)
{
$countries = array_filter(is_array($countries) ? $countries : [$countries]);
$exception = new static(
libNumberParseException::INVALID_COUNTRY_CODE,
'Number does not match the provided '. Str::plural('country', co... | php | public static function countryMismatch($number, $countries)
{
$countries = array_filter(is_array($countries) ? $countries : [$countries]);
$exception = new static(
libNumberParseException::INVALID_COUNTRY_CODE,
'Number does not match the provided '. Str::plural('country', co... | [
"public",
"static",
"function",
"countryMismatch",
"(",
"$",
"number",
",",
"$",
"countries",
")",
"{",
"$",
"countries",
"=",
"array_filter",
"(",
"is_array",
"(",
"$",
"countries",
")",
"?",
"$",
"countries",
":",
"[",
"$",
"countries",
"]",
")",
";",
... | Country mismatch static constructor.
@param string $number
@param string|array $country
@return static | [
"Country",
"mismatch",
"static",
"constructor",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Exceptions/NumberParseException.php#L43-L56 |
Propaganistas/Laravel-Phone | src/Traits/ParsesTypes.php | ParsesTypes.parseTypes | protected static function parseTypes($types)
{
static::loadTypes();
return Collection::make(is_array($types) ? $types : func_get_args())
->map(function ($type) {
// If the type equals a constant's value, just return it.
... | php | protected static function parseTypes($types)
{
static::loadTypes();
return Collection::make(is_array($types) ? $types : func_get_args())
->map(function ($type) {
// If the type equals a constant's value, just return it.
... | [
"protected",
"static",
"function",
"parseTypes",
"(",
"$",
"types",
")",
"{",
"static",
"::",
"loadTypes",
"(",
")",
";",
"return",
"Collection",
"::",
"make",
"(",
"is_array",
"(",
"$",
"types",
")",
"?",
"$",
"types",
":",
"func_get_args",
"(",
")",
... | Parse a phone type into constant's value.
@param string|array $types
@return array | [
"Parse",
"a",
"phone",
"type",
"into",
"constant",
"s",
"value",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Traits/ParsesTypes.php#L34-L51 |
Propaganistas/Laravel-Phone | src/PhoneServiceProvider.php | PhoneServiceProvider.register | public function register()
{
$this->app->singleton('libphonenumber', function ($app) {
return PhoneNumberUtil::getInstance();
});
$this->app->alias('libphonenumber', PhoneNumberUtil::class);
} | php | public function register()
{
$this->app->singleton('libphonenumber', function ($app) {
return PhoneNumberUtil::getInstance();
});
$this->app->alias('libphonenumber', PhoneNumberUtil::class);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'libphonenumber'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"PhoneNumberUtil",
"::",
"getInstance",
"(",
")",
";",
"}",
")",
";",
"$",
"thi... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneServiceProvider.php#L30-L37 |
Propaganistas/Laravel-Phone | src/Traits/ParsesCountries.php | ParsesCountries.isValidCountryCode | public static function isValidCountryCode($country)
{
$iso3166 = new ISO3166;
try {
$iso3166->alpha2($country);
return true;
} catch (\Exception $e) {
return false;
}
} | php | public static function isValidCountryCode($country)
{
$iso3166 = new ISO3166;
try {
$iso3166->alpha2($country);
return true;
} catch (\Exception $e) {
return false;
}
} | [
"public",
"static",
"function",
"isValidCountryCode",
"(",
"$",
"country",
")",
"{",
"$",
"iso3166",
"=",
"new",
"ISO3166",
";",
"try",
"{",
"$",
"iso3166",
"->",
"alpha2",
"(",
"$",
"country",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"\\",
... | Determine whether the given country code is valid.
@param string $country
@return bool | [
"Determine",
"whether",
"the",
"given",
"country",
"code",
"is",
"valid",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Traits/ParsesCountries.php#L14-L25 |
Propaganistas/Laravel-Phone | src/Traits/ParsesCountries.php | ParsesCountries.parseCountries | protected function parseCountries($countries)
{
return Collection::make(is_array($countries) ? $countries : func_get_args())
->map(function ($country) {
return strtoupper($country);
})
->filter(function (... | php | protected function parseCountries($countries)
{
return Collection::make(is_array($countries) ? $countries : func_get_args())
->map(function ($country) {
return strtoupper($country);
})
->filter(function (... | [
"protected",
"function",
"parseCountries",
"(",
"$",
"countries",
")",
"{",
"return",
"Collection",
"::",
"make",
"(",
"is_array",
"(",
"$",
"countries",
")",
"?",
"$",
"countries",
":",
"func_get_args",
"(",
")",
")",
"->",
"map",
"(",
"function",
"(",
... | Parse the provided phone countries to a valid array.
@param string|array $countries
@return array | [
"Parse",
"the",
"provided",
"phone",
"countries",
"to",
"a",
"valid",
"array",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Traits/ParsesCountries.php#L33-L42 |
Propaganistas/Laravel-Phone | src/Rules/Phone.php | Phone.country | public function country($country)
{
$countries = is_array($country) ? $country : func_get_args();
$this->countries = array_merge($this->countries, $countries);
return $this;
} | php | public function country($country)
{
$countries = is_array($country) ? $country : func_get_args();
$this->countries = array_merge($this->countries, $countries);
return $this;
} | [
"public",
"function",
"country",
"(",
"$",
"country",
")",
"{",
"$",
"countries",
"=",
"is_array",
"(",
"$",
"country",
")",
"?",
"$",
"country",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"countries",
"=",
"array_merge",
"(",
"$",
"this",... | Set the phone countries.
@param string|array $country
@return $this | [
"Set",
"the",
"phone",
"countries",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Rules/Phone.php#L52-L59 |
Propaganistas/Laravel-Phone | src/Rules/Phone.php | Phone.type | public function type($type)
{
$types = is_array($type) ? $type : func_get_args();
$this->types = array_merge($this->types, $types);
return $this;
} | php | public function type($type)
{
$types = is_array($type) ? $type : func_get_args();
$this->types = array_merge($this->types, $types);
return $this;
} | [
"public",
"function",
"type",
"(",
"$",
"type",
")",
"{",
"$",
"types",
"=",
"is_array",
"(",
"$",
"type",
")",
"?",
"$",
"type",
":",
"func_get_args",
"(",
")",
";",
"$",
"this",
"->",
"types",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"types",
... | Set the phone types.
@param string|array $type
@return $this | [
"Set",
"the",
"phone",
"types",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/Rules/Phone.php#L80-L87 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.ofCountry | public function ofCountry($country)
{
$countries = is_array($country) ? $country : func_get_args();
$instance = clone $this;
$instance->countries = array_unique(
array_merge($instance->countries, static::parseCountries($countries))
);
return $instance;
} | php | public function ofCountry($country)
{
$countries = is_array($country) ? $country : func_get_args();
$instance = clone $this;
$instance->countries = array_unique(
array_merge($instance->countries, static::parseCountries($countries))
);
return $instance;
} | [
"public",
"function",
"ofCountry",
"(",
"$",
"country",
")",
"{",
"$",
"countries",
"=",
"is_array",
"(",
"$",
"country",
")",
"?",
"$",
"country",
":",
"func_get_args",
"(",
")",
";",
"$",
"instance",
"=",
"clone",
"$",
"this",
";",
"$",
"instance",
... | Set the country to which the phone number belongs to.
@param string|array $country
@return static | [
"Set",
"the",
"country",
"to",
"which",
"the",
"phone",
"number",
"belongs",
"to",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L93-L103 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.format | public function format($format)
{
$parsedFormat = static::parseFormat($format);
if (is_null($parsedFormat)) {
throw NumberFormatException::invalid($format);
}
return $this->lib->format(
$this->getPhoneNumberInstance(),
$parsedFormat
);
... | php | public function format($format)
{
$parsedFormat = static::parseFormat($format);
if (is_null($parsedFormat)) {
throw NumberFormatException::invalid($format);
}
return $this->lib->format(
$this->getPhoneNumberInstance(),
$parsedFormat
);
... | [
"public",
"function",
"format",
"(",
"$",
"format",
")",
"{",
"$",
"parsedFormat",
"=",
"static",
"::",
"parseFormat",
"(",
"$",
"format",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"parsedFormat",
")",
")",
"{",
"throw",
"NumberFormatException",
"::",
"i... | Format the phone number in a given format.
@param string $format
@return string
@throws \Propaganistas\LaravelPhone\Exceptions\NumberFormatException | [
"Format",
"the",
"phone",
"number",
"in",
"a",
"given",
"format",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L152-L164 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.formatForCountry | public function formatForCountry($country)
{
if (! static::isValidCountryCode($country)) {
throw CountryCodeException::invalid($country);
}
return $this->lib->formatOutOfCountryCallingNumber(
$this->getPhoneNumberInstance(),
$country
);
} | php | public function formatForCountry($country)
{
if (! static::isValidCountryCode($country)) {
throw CountryCodeException::invalid($country);
}
return $this->lib->formatOutOfCountryCallingNumber(
$this->getPhoneNumberInstance(),
$country
);
} | [
"public",
"function",
"formatForCountry",
"(",
"$",
"country",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"isValidCountryCode",
"(",
"$",
"country",
")",
")",
"{",
"throw",
"CountryCodeException",
"::",
"invalid",
"(",
"$",
"country",
")",
";",
"}",
"return... | Format the phone number in a way that it can be dialled from the provided country.
@param string $country
@return string
@throws \Propaganistas\LaravelPhone\Exceptions\CountryCodeException | [
"Format",
"the",
"phone",
"number",
"in",
"a",
"way",
"that",
"it",
"can",
"be",
"dialled",
"from",
"the",
"provided",
"country",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L173-L183 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.formatForMobileDialingInCountry | public function formatForMobileDialingInCountry($country, $removeFormatting = false)
{
if (! static::isValidCountryCode($country)) {
throw CountryCodeException::invalid($country);
}
return $this->lib->formatNumberForMobileDialing(
$this->getPhoneNumberInstance(),
... | php | public function formatForMobileDialingInCountry($country, $removeFormatting = false)
{
if (! static::isValidCountryCode($country)) {
throw CountryCodeException::invalid($country);
}
return $this->lib->formatNumberForMobileDialing(
$this->getPhoneNumberInstance(),
... | [
"public",
"function",
"formatForMobileDialingInCountry",
"(",
"$",
"country",
",",
"$",
"removeFormatting",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"isValidCountryCode",
"(",
"$",
"country",
")",
")",
"{",
"throw",
"CountryCodeException",
"::",
... | Format the phone number in a way that it can be dialled from the provided country using a cellphone.
@param string $country
@param bool $removeFormatting
@return string
@throws \Propaganistas\LaravelPhone\Exceptions\CountryCodeException | [
"Format",
"the",
"phone",
"number",
"in",
"a",
"way",
"that",
"it",
"can",
"be",
"dialled",
"from",
"the",
"provided",
"country",
"using",
"a",
"cellphone",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L193-L204 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.getCountry | public function getCountry()
{
if (! $this->country) {
$this->country = $this->filterValidCountry($this->countries);
}
return $this->country;
} | php | public function getCountry()
{
if (! $this->country) {
$this->country = $this->filterValidCountry($this->countries);
}
return $this->country;
} | [
"public",
"function",
"getCountry",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"country",
")",
"{",
"$",
"this",
"->",
"country",
"=",
"$",
"this",
"->",
"filterValidCountry",
"(",
"$",
"this",
"->",
"countries",
")",
";",
"}",
"return",
"$",
... | Get the phone number's country.
@return string | [
"Get",
"the",
"phone",
"number",
"s",
"country",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L211-L218 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.filterValidCountry | protected function filterValidCountry($countries)
{
$result = Collection::make($countries)
->filter(function ($country) {
try {
$instance = $this->lib->parse($this->number, $country);
... | php | protected function filterValidCountry($countries)
{
$result = Collection::make($countries)
->filter(function ($country) {
try {
$instance = $this->lib->parse($this->number, $country);
... | [
"protected",
"function",
"filterValidCountry",
"(",
"$",
"countries",
")",
"{",
"$",
"result",
"=",
"Collection",
"::",
"make",
"(",
"$",
"countries",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"country",
")",
"{",
"try",
"{",
"$",
"instance",
"=",
... | Filter the provided countries to the one that is valid for the number.
@param string|array $countries
@return string
@throws \Propaganistas\LaravelPhone\Exceptions\NumberParseException | [
"Filter",
"the",
"provided",
"countries",
"to",
"the",
"one",
"that",
"is",
"valid",
"for",
"the",
"number",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L240-L278 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.getType | public function getType($asConstant = false)
{
$type = $this->lib->getNumberType($this->getPhoneNumberInstance());
if ($asConstant) {
return $type;
}
$stringType = Arr::get(static::parseTypesAsStrings($type), 0);
return $stringType ? strtolower($stringType) : n... | php | public function getType($asConstant = false)
{
$type = $this->lib->getNumberType($this->getPhoneNumberInstance());
if ($asConstant) {
return $type;
}
$stringType = Arr::get(static::parseTypesAsStrings($type), 0);
return $stringType ? strtolower($stringType) : n... | [
"public",
"function",
"getType",
"(",
"$",
"asConstant",
"=",
"false",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"lib",
"->",
"getNumberType",
"(",
"$",
"this",
"->",
"getPhoneNumberInstance",
"(",
")",
")",
";",
"if",
"(",
"$",
"asConstant",
")",... | Get the phone number's type.
@param bool $asConstant
@return string|int|null | [
"Get",
"the",
"phone",
"number",
"s",
"type",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L286-L297 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.isOfType | public function isOfType($type)
{
$types = static::parseTypes($type);
// Add the unsure type when applicable.
if (array_intersect([PhoneNumberType::FIXED_LINE, PhoneNumberType::MOBILE], $types)) {
$types[] = PhoneNumberType::FIXED_LINE_OR_MOBILE;
}
return in_arr... | php | public function isOfType($type)
{
$types = static::parseTypes($type);
// Add the unsure type when applicable.
if (array_intersect([PhoneNumberType::FIXED_LINE, PhoneNumberType::MOBILE], $types)) {
$types[] = PhoneNumberType::FIXED_LINE_OR_MOBILE;
}
return in_arr... | [
"public",
"function",
"isOfType",
"(",
"$",
"type",
")",
"{",
"$",
"types",
"=",
"static",
"::",
"parseTypes",
"(",
"$",
"type",
")",
";",
"// Add the unsure type when applicable.",
"if",
"(",
"array_intersect",
"(",
"[",
"PhoneNumberType",
"::",
"FIXED_LINE",
... | Check if the phone number is of (a) given type(s).
@param string $type
@return bool | [
"Check",
"if",
"the",
"phone",
"number",
"is",
"of",
"(",
"a",
")",
"given",
"type",
"(",
"s",
")",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L305-L315 |
Propaganistas/Laravel-Phone | src/PhoneNumber.php | PhoneNumber.unserialize | public function unserialize($serialized)
{
$this->lib = PhoneNumberUtil::getInstance();
$this->number = $serialized;
$this->country = $this->lib->getRegionCodeForNumber($this->getPhoneNumberInstance());
} | php | public function unserialize($serialized)
{
$this->lib = PhoneNumberUtil::getInstance();
$this->number = $serialized;
$this->country = $this->lib->getRegionCodeForNumber($this->getPhoneNumberInstance());
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"$",
"this",
"->",
"lib",
"=",
"PhoneNumberUtil",
"::",
"getInstance",
"(",
")",
";",
"$",
"this",
"->",
"number",
"=",
"$",
"serialized",
";",
"$",
"this",
"->",
"country",
"=",
"$... | Reconstructs the phone instance from a string representation.
@param string $serialized | [
"Reconstructs",
"the",
"phone",
"instance",
"from",
"a",
"string",
"representation",
"."
] | train | https://github.com/Propaganistas/Laravel-Phone/blob/f65d4e68e3200bfa40e83c92a33db5eeada78f29/src/PhoneNumber.php#L385-L390 |
bolt/bolt | src/Configuration/Check/DirectoryAccess.php | DirectoryAccess.runCheck | public function runCheck()
{
$fs = new Filesystem();
foreach ($this->options['directories'] as $directory) {
$directory = $this->app['path_resolver']->resolve($directory);
try {
$tmpfile = $directory . '/.check';
if ($fs->exists($directory) ... | php | public function runCheck()
{
$fs = new Filesystem();
foreach ($this->options['directories'] as $directory) {
$directory = $this->app['path_resolver']->resolve($directory);
try {
$tmpfile = $directory . '/.check';
if ($fs->exists($directory) ... | [
"public",
"function",
"runCheck",
"(",
")",
"{",
"$",
"fs",
"=",
"new",
"Filesystem",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"options",
"[",
"'directories'",
"]",
"as",
"$",
"directory",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/DirectoryAccess.php#L39-L62 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.getWhereExpression | public function getWhereExpression()
{
if (!count($this->filters)) {
return null;
}
$expr = $this->qb->expr()->andX();
foreach ($this->filters as $filter) {
$expr = $expr->add($filter->getExpression());
}
return $expr;
} | php | public function getWhereExpression()
{
if (!count($this->filters)) {
return null;
}
$expr = $this->qb->expr()->andX();
foreach ($this->filters as $filter) {
$expr = $expr->add($filter->getExpression());
}
return $expr;
} | [
"public",
"function",
"getWhereExpression",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"filters",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"expr",
"=",
"$",
"this",
"->",
"qb",
"->",
"expr",
"(",
")",
"->",
"andX",
"("... | Creates a composite expression that adds all the attached
filters individual expressions into a combined one.
@return CompositeExpression | [
"Creates",
"a",
"composite",
"expression",
"that",
"adds",
"all",
"the",
"attached",
"filters",
"individual",
"expressions",
"into",
"a",
"combined",
"one",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L113-L125 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.getWhereParameters | public function getWhereParameters()
{
$params = [];
foreach ($this->filters as $filter) {
$params = array_merge($params, $filter->getParameters());
}
return $params;
} | php | public function getWhereParameters()
{
$params = [];
foreach ($this->filters as $filter) {
$params = array_merge($params, $filter->getParameters());
}
return $params;
} | [
"public",
"function",
"getWhereParameters",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"filter",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"$",
"filter",
"->"... | Returns all the parameters for the query.
@return array | [
"Returns",
"all",
"the",
"parameters",
"for",
"the",
"query",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L132-L140 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.getWhereParametersFor | public function getWhereParametersFor($fieldName)
{
return array_intersect_key(
$this->getWhereParameters(),
array_flip(preg_grep('/^' . $fieldName . '_\d+$/', array_keys($this->getWhereParameters())))
);
} | php | public function getWhereParametersFor($fieldName)
{
return array_intersect_key(
$this->getWhereParameters(),
array_flip(preg_grep('/^' . $fieldName . '_\d+$/', array_keys($this->getWhereParameters())))
);
} | [
"public",
"function",
"getWhereParametersFor",
"(",
"$",
"fieldName",
")",
"{",
"return",
"array_intersect_key",
"(",
"$",
"this",
"->",
"getWhereParameters",
"(",
")",
",",
"array_flip",
"(",
"preg_grep",
"(",
"'/^'",
".",
"$",
"fieldName",
".",
"'_\\d+$/'",
... | Gets all the parameters for a specific field name.
@param string $fieldName
@return array array of key=>value parameters | [
"Gets",
"all",
"the",
"parameters",
"for",
"a",
"specific",
"field",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L149-L155 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.setWhereParameter | public function setWhereParameter($key, $value)
{
foreach ($this->filters as $filter) {
if ($filter->hasParameter($key)) {
$filter->setParameter($key, $value);
}
}
} | php | public function setWhereParameter($key, $value)
{
foreach ($this->filters as $filter) {
if ($filter->hasParameter($key)) {
$filter->setParameter($key, $value);
}
}
} | [
"public",
"function",
"setWhereParameter",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"filter",
"->",
"hasParameter",
"(",
"$",
"key",
")",
")",
"{",
"$... | Sets all the parameters for a specific field name.
@param string $key
@param mixed $value | [
"Sets",
"all",
"the",
"parameters",
"for",
"a",
"specific",
"field",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L163-L170 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.build | public function build()
{
$query = $this->qb;
if ($this->getWhereExpression()) {
$query->where($this->getWhereExpression());
}
foreach ($this->getWhereParameters() as $key => $param) {
$query->setParameter($key, $param, is_array($param) ? Connection::PARAM_STR... | php | public function build()
{
$query = $this->qb;
if ($this->getWhereExpression()) {
$query->where($this->getWhereExpression());
}
foreach ($this->getWhereParameters() as $key => $param) {
$query->setParameter($key, $param, is_array($param) ? Connection::PARAM_STR... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"qb",
";",
"if",
"(",
"$",
"this",
"->",
"getWhereExpression",
"(",
")",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"this",
"->",
"getWhereExpression",
"(",
"... | Part of the QueryInterface this turns all the input into a Doctrine
QueryBuilder object and is usually run just before query execution.
That allows modifications to be made to any of the parameters up until
query execution time.
@return QueryBuilder | [
"Part",
"of",
"the",
"QueryInterface",
"this",
"turns",
"all",
"the",
"input",
"into",
"a",
"Doctrine",
"QueryBuilder",
"object",
"and",
"is",
"usually",
"run",
"just",
"before",
"query",
"execution",
".",
"That",
"allows",
"modifications",
"to",
"be",
"made",... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L198-L209 |
bolt/bolt | src/Storage/Query/SelectQuery.php | SelectQuery.processFilters | protected function processFilters()
{
$this->filters = [];
foreach ($this->params as $key => $value) {
$this->parser->setAlias('_' . $this->contentType);
$filter = $this->parser->getFilter($key, $value);
if ($filter) {
$this->addFilter($filter);
... | php | protected function processFilters()
{
$this->filters = [];
foreach ($this->params as $key => $value) {
$this->parser->setAlias('_' . $this->contentType);
$filter = $this->parser->getFilter($key, $value);
if ($filter) {
$this->addFilter($filter);
... | [
"protected",
"function",
"processFilters",
"(",
")",
"{",
"$",
"this",
"->",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"parser",
"->",
"setAlias",
... | Internal method that runs the individual key/value input through
the QueryParameterParser. This allows complicated expressions to
be turned into simple sql expressions.
@throws \Bolt\Exception\QueryParseException | [
"Internal",
"method",
"that",
"runs",
"the",
"individual",
"key",
"/",
"value",
"input",
"through",
"the",
"QueryParameterParser",
".",
"This",
"allows",
"complicated",
"expressions",
"to",
"be",
"turned",
"into",
"simple",
"sql",
"expressions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SelectQuery.php#L268-L278 |
bolt/bolt | src/Storage/FieldManager.php | FieldManager.get | public function get($class, $mapping)
{
if (is_object($class)) {
$class = get_class($class);
}
if (array_key_exists($class, $this->handlers)) {
$handler = $this->handlers[$class];
$field = call_user_func($handler, $mapping, $this->em);
} else {
... | php | public function get($class, $mapping)
{
if (is_object($class)) {
$class = get_class($class);
}
if (array_key_exists($class, $this->handlers)) {
$handler = $this->handlers[$class];
$field = call_user_func($handler, $mapping, $this->em);
} else {
... | [
"public",
"function",
"get",
"(",
"$",
"class",
",",
"$",
"mapping",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"class",
")",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
"c... | Gets the field instance for the supplied class.
@param string $class
@param array $mapping
@return FieldTypeBase | [
"Gets",
"the",
"field",
"instance",
"for",
"the",
"supplied",
"class",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/FieldManager.php#L59-L77 |
bolt/bolt | src/Storage/FieldManager.php | FieldManager.getFieldFor | public function getFieldFor($type)
{
if (!isset($this->typemap[$type])) {
return false;
}
$class = $this->typemap[$type];
return $this->get($class, ['type' => $type]);
} | php | public function getFieldFor($type)
{
if (!isset($this->typemap[$type])) {
return false;
}
$class = $this->typemap[$type];
return $this->get($class, ['type' => $type]);
} | [
"public",
"function",
"getFieldFor",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"typemap",
"[",
"$",
"type",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"class",
"=",
"$",
"this",
"->",
"typemap",
"[",
... | Looks up a type from the typemap and returns a field class.
@param string $type
@return FieldTypeBase|false | [
"Looks",
"up",
"a",
"type",
"from",
"the",
"typemap",
"and",
"returns",
"a",
"field",
"class",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/FieldManager.php#L86-L94 |
bolt/bolt | src/Storage/FieldManager.php | FieldManager.addFieldType | public function addFieldType($name, Field\FieldInterface $field)
{
$this->setHandler($name, $field);
$this->customHandlers[] = $name;
$this->boltConfig->getFields()->addField($field);
} | php | public function addFieldType($name, Field\FieldInterface $field)
{
$this->setHandler($name, $field);
$this->customHandlers[] = $name;
$this->boltConfig->getFields()->addField($field);
} | [
"public",
"function",
"addFieldType",
"(",
"$",
"name",
",",
"Field",
"\\",
"FieldInterface",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"setHandler",
"(",
"$",
"name",
",",
"$",
"field",
")",
";",
"$",
"this",
"->",
"customHandlers",
"[",
"]",
"=",
... | Shorthand to add a field to both the new and legacy managers.
@param string $name
@param Field\FieldInterface $field | [
"Shorthand",
"to",
"add",
"a",
"field",
"to",
"both",
"the",
"new",
"and",
"legacy",
"managers",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/FieldManager.php#L113-L118 |
bolt/bolt | src/Storage/Entity/MagicAttributeTrait.php | MagicAttributeTrait.getFields | protected function getFields()
{
$fields = [];
foreach ($this as $k => $v) {
if (is_string($k) && strpos($k, '_') !== 0) {
$fields[] = $k;
}
}
foreach ($this->_fields as $k => $v) {
if (is_string($k)) {
$fields[] =... | php | protected function getFields()
{
$fields = [];
foreach ($this as $k => $v) {
if (is_string($k) && strpos($k, '_') !== 0) {
$fields[] = $k;
}
}
foreach ($this->_fields as $k => $v) {
if (is_string($k)) {
$fields[] =... | [
"protected",
"function",
"getFields",
"(",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"k",
")",
"&&",
"strpos",
"(",
"$",
"k",
",",
"'_... | An internal method that builds a list of available fields depending on context.
@return array | [
"An",
"internal",
"method",
"that",
"builds",
"a",
"list",
"of",
"available",
"fields",
"depending",
"on",
"context",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/MagicAttributeTrait.php#L120-L137 |
bolt/bolt | src/EventListener/GeneralListener.php | GeneralListener.onResponse | public function onResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
$response = $event->getResponse();
$this->setFrameOptions($request, $response);
} | php | public function onResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
$response = $event->getResponse();
$this->setFrameOptions($request, $response);
} | [
"public",
"function",
"onResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"$",
"this",
"->",
"se... | Kernel response listener callback.
@param FilterResponseEvent $event | [
"Kernel",
"response",
"listener",
"callback",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/GeneralListener.php#L38-L44 |
bolt/bolt | src/EventListener/GeneralListener.php | GeneralListener.setFrameOptions | protected function setFrameOptions(Request $request, Response $response)
{
if (Zone::isBackend($request) && $this->app['config']->get('general/headers/x_frame_options')) {
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
$response->headers->set('Frame-Options', 'SAMEORIGIN')... | php | protected function setFrameOptions(Request $request, Response $response)
{
if (Zone::isBackend($request) && $this->app['config']->get('general/headers/x_frame_options')) {
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
$response->headers->set('Frame-Options', 'SAMEORIGIN')... | [
"protected",
"function",
"setFrameOptions",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"Zone",
"::",
"isBackend",
"(",
"$",
"request",
")",
"&&",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"... | Set the 'X-Frame-Options' headers to prevent click-jacking, unless
specifically disabled. Backend only!
@param Request $request
@param Response $response | [
"Set",
"the",
"X",
"-",
"Frame",
"-",
"Options",
"headers",
"to",
"prevent",
"click",
"-",
"jacking",
"unless",
"specifically",
"disabled",
".",
"Backend",
"only!"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/GeneralListener.php#L53-L59 |
bolt/bolt | src/Form/FormType/UserNewType.php | UserNewType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$this
->addUserName($builder)
->addPassword($builder, ['required' => true])
->addEmail($builder)
->addDisplayName($builder)
-... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$this
->addUserName($builder)
->addPassword($builder, ['required' => true])
->addEmail($builder)
->addDisplayName($builder)
-... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"parent",
"::",
"buildForm",
"(",
"$",
"builder",
",",
"$",
"options",
")",
";",
"$",
"this",
"->",
"addUserName",
"(",
"$",
"builder",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/UserNewType.php#L18-L29 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.action | public function action(Content $content, ContentType $contentType, $duplicate)
{
$contentTypeSlug = $contentType['slug'];
$new = $content->getId() === null ?: false;
$oldStatus = $content->getStatus();
$allStatuses = ['published', 'held', 'draft', 'timed'];
$allowedStatuses =... | php | public function action(Content $content, ContentType $contentType, $duplicate)
{
$contentTypeSlug = $contentType['slug'];
$new = $content->getId() === null ?: false;
$oldStatus = $content->getStatus();
$allStatuses = ['published', 'held', 'draft', 'timed'];
$allowedStatuses =... | [
"public",
"function",
"action",
"(",
"Content",
"$",
"content",
",",
"ContentType",
"$",
"contentType",
",",
"$",
"duplicate",
")",
"{",
"$",
"contentTypeSlug",
"=",
"$",
"contentType",
"[",
"'slug'",
"]",
";",
"$",
"new",
"=",
"$",
"content",
"->",
"get... | Do the edit form for a record.
@param Content $content A content record
@param ContentType $contentType The ContentType data
@param bool $duplicate If TRUE create a duplicate record
@return array | [
"Do",
"the",
"edit",
"form",
"for",
"a",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L92-L210 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.getRelationsList | private function getRelationsList(ContentType $contentType)
{
$list = [];
if (!isset($contentType['relations']) || !is_array($contentType['relations'])) {
return $list;
}
foreach ($contentType['relations'] as $relationName => $relationValues) {
/** @var Repos... | php | private function getRelationsList(ContentType $contentType)
{
$list = [];
if (!isset($contentType['relations']) || !is_array($contentType['relations'])) {
return $list;
}
foreach ($contentType['relations'] as $relationName => $relationValues) {
/** @var Repos... | [
"private",
"function",
"getRelationsList",
"(",
"ContentType",
"$",
"contentType",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"contentType",
"[",
"'relations'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"contentType",
... | Convert POST relationship values to an array of Entity objects keyed by
ContentType.
@param ContentType $contentType
@return array | [
"Convert",
"POST",
"relationship",
"values",
"to",
"an",
"array",
"of",
"Entity",
"objects",
"keyed",
"by",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L220-L238 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.neededFields | private function neededFields($relationValues, $relationConfig)
{
$fields = [];
// Get the field names from the ContentType, including 'status'.
$fieldNames = array_merge(array_keys($relationConfig['fields']), ['status']);
// Regex the 'format' for things that look like 'item.foo',... | php | private function neededFields($relationValues, $relationConfig)
{
$fields = [];
// Get the field names from the ContentType, including 'status'.
$fieldNames = array_merge(array_keys($relationConfig['fields']), ['status']);
// Regex the 'format' for things that look like 'item.foo',... | [
"private",
"function",
"neededFields",
"(",
"$",
"relationValues",
",",
"$",
"relationConfig",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"// Get the field names from the ContentType, including 'status'.",
"$",
"fieldNames",
"=",
"array_merge",
"(",
"array_keys",
"(... | Get an array of fields mentioned in the 'format:' for a relationship in contenttypes.
@param array $relationValues
@param array $relationConfig
@return array | [
"Get",
"an",
"array",
"of",
"fields",
"mentioned",
"in",
"the",
"format",
":",
"for",
"a",
"relationship",
"in",
"contenttypes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L248-L262 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.getTemplateFieldTemplates | private function getTemplateFieldTemplates(ContentType $contentType, Content $content)
{
$templateFieldTemplates = [];
$templateFieldsConfig = $this->config->get('theme/templatefields');
if ($templateFieldsConfig) {
$templateFieldTemplates = array_keys($templateFieldsConfig);
... | php | private function getTemplateFieldTemplates(ContentType $contentType, Content $content)
{
$templateFieldTemplates = [];
$templateFieldsConfig = $this->config->get('theme/templatefields');
if ($templateFieldsConfig) {
$templateFieldTemplates = array_keys($templateFieldsConfig);
... | [
"private",
"function",
"getTemplateFieldTemplates",
"(",
"ContentType",
"$",
"contentType",
",",
"Content",
"$",
"content",
")",
"{",
"$",
"templateFieldTemplates",
"=",
"[",
"]",
";",
"$",
"templateFieldsConfig",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
... | Determine which templates will result in templatefields.
@param ContentType $contentType
@param Content $content
@return array | [
"Determine",
"which",
"templates",
"will",
"result",
"in",
"templatefields",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L272-L297 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.createGroupTabs | private function createGroupTabs(ContentType $contentType, array $has)
{
$groups = [];
$groupIds = [];
$addGroup = function ($group, $label) use (&$groups, &$groupIds) {
$nr = count($groups) + 1;
$id = rtrim('tab-' . Slugify::create()->slugify($group), '-');
... | php | private function createGroupTabs(ContentType $contentType, array $has)
{
$groups = [];
$groupIds = [];
$addGroup = function ($group, $label) use (&$groups, &$groupIds) {
$nr = count($groups) + 1;
$id = rtrim('tab-' . Slugify::create()->slugify($group), '-');
... | [
"private",
"function",
"createGroupTabs",
"(",
"ContentType",
"$",
"contentType",
",",
"array",
"$",
"has",
")",
"{",
"$",
"groups",
"=",
"[",
"]",
";",
"$",
"groupIds",
"=",
"[",
"]",
";",
"$",
"addGroup",
"=",
"function",
"(",
"$",
"group",
",",
"$... | Generate tab groups.
@param ContentType $contentType
@param array $has
@return array | [
"Generate",
"tab",
"groups",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L326-L380 |
bolt/bolt | src/Storage/ContentRequest/Edit.php | Edit.getUsedFieldtypes | private function getUsedFieldtypes(ContentType $contentType, Content $content, array $has)
{
$fieldtypes = [
'meta' => true,
];
if ($content->getTemplatefields() instanceof TemplateFields) {
$templateFields = $content->getTemplatefields()->getContenttype()->getFields... | php | private function getUsedFieldtypes(ContentType $contentType, Content $content, array $has)
{
$fieldtypes = [
'meta' => true,
];
if ($content->getTemplatefields() instanceof TemplateFields) {
$templateFields = $content->getTemplatefields()->getContenttype()->getFields... | [
"private",
"function",
"getUsedFieldtypes",
"(",
"ContentType",
"$",
"contentType",
",",
"Content",
"$",
"content",
",",
"array",
"$",
"has",
")",
"{",
"$",
"fieldtypes",
"=",
"[",
"'meta'",
"=>",
"true",
",",
"]",
";",
"if",
"(",
"$",
"content",
"->",
... | Create a list of fields types used in regular, template and virtual fields.
@param ContentType $contentType
@param Content $content
@param array $has
@return array | [
"Create",
"a",
"list",
"of",
"fields",
"types",
"used",
"in",
"regular",
"template",
"and",
"virtual",
"fields",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Edit.php#L391-L434 |
bolt/bolt | src/EventListener/ConfigListener.php | ConfigListener.onRequestEarly | public function onRequestEarly(GetResponseEvent $event)
{
$validator = $this->app['config.validator'];
$response = $validator->checks();
if ($response instanceof Response) {
$event->setResponse($response);
}
} | php | public function onRequestEarly(GetResponseEvent $event)
{
$validator = $this->app['config.validator'];
$response = $validator->checks();
if ($response instanceof Response) {
$event->setResponse($response);
}
} | [
"public",
"function",
"onRequestEarly",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"app",
"[",
"'config.validator'",
"]",
";",
"$",
"response",
"=",
"$",
"validator",
"->",
"checks",
"(",
")",
";",
"if",
"(... | Early functions.
@param GetResponseEvent $event | [
"Early",
"functions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ConfigListener.php#L48-L55 |
bolt/bolt | src/EventListener/ConfigListener.php | ConfigListener.onRequest | public function onRequest(GetResponseEvent $event)
{
if (Zone::isBackend($event->getRequest())) {
$this->setVersionChangeNotice();
}
// Twig globals
$this->setGlobals();
// Only cache if the config passes checks
if ($this->app['config']->checkConfig() ==... | php | public function onRequest(GetResponseEvent $event)
{
if (Zone::isBackend($event->getRequest())) {
$this->setVersionChangeNotice();
}
// Twig globals
$this->setGlobals();
// Only cache if the config passes checks
if ($this->app['config']->checkConfig() ==... | [
"public",
"function",
"onRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"Zone",
"::",
"isBackend",
"(",
"$",
"event",
"->",
"getRequest",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"setVersionChangeNotice",
"(",
")",
";",
"}",
"... | Normal functions.
@param GetResponseEvent $event | [
"Normal",
"functions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ConfigListener.php#L62-L83 |
bolt/bolt | src/EventListener/ConfigListener.php | ConfigListener.setVersionChangeNotice | private function setVersionChangeNotice()
{
if (!$this->app['config.environment']->hasVersionChange()) {
return;
}
$notice = Trans::__(
"Detected Bolt version change to <b>%VERSION%</b>, and the cache has been cleared. Please <a href=\"%URI%\">check the database</a>,... | php | private function setVersionChangeNotice()
{
if (!$this->app['config.environment']->hasVersionChange()) {
return;
}
$notice = Trans::__(
"Detected Bolt version change to <b>%VERSION%</b>, and the cache has been cleared. Please <a href=\"%URI%\">check the database</a>,... | [
"private",
"function",
"setVersionChangeNotice",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"[",
"'config.environment'",
"]",
"->",
"hasVersionChange",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"notice",
"=",
"Trans",
"::",
"__",
"(",
... | If required set a notification of version change, for admin users. | [
"If",
"required",
"set",
"a",
"notification",
"of",
"version",
"change",
"for",
"admin",
"users",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ConfigListener.php#L101-L116 |
bolt/bolt | src/EventListener/ConfigListener.php | ConfigListener.setGlobals | private function setGlobals()
{
/** @var Environment $twig */
$twig = $this->app['twig'];
/** @var \Bolt\Config $config */
$config = $this->app['config'];
/** @var \Bolt\Users $users */
$users = $this->app['users'];
$zone = null;
/** @var RequestStack ... | php | private function setGlobals()
{
/** @var Environment $twig */
$twig = $this->app['twig'];
/** @var \Bolt\Config $config */
$config = $this->app['config'];
/** @var \Bolt\Users $users */
$users = $this->app['users'];
$zone = null;
/** @var RequestStack ... | [
"private",
"function",
"setGlobals",
"(",
")",
"{",
"/** @var Environment $twig */",
"$",
"twig",
"=",
"$",
"this",
"->",
"app",
"[",
"'twig'",
"]",
";",
"/** @var \\Bolt\\Config $config */",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
... | Get the parameters that will be used to update Bolt's registered Twig
globals.
This is here as a transitory measure. | [
"Get",
"the",
"parameters",
"that",
"will",
"be",
"used",
"to",
"update",
"Bolt",
"s",
"registered",
"Twig",
"globals",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ConfigListener.php#L124-L161 |
bolt/bolt | src/Events/MountEvent.php | MountEvent.mount | public function mount($prefix, $controllers)
{
$controllers = $this->verifyCollection($controllers);
$this->collection->mount($prefix, $controllers);
} | php | public function mount($prefix, $controllers)
{
$controllers = $this->verifyCollection($controllers);
$this->collection->mount($prefix, $controllers);
} | [
"public",
"function",
"mount",
"(",
"$",
"prefix",
",",
"$",
"controllers",
")",
"{",
"$",
"controllers",
"=",
"$",
"this",
"->",
"verifyCollection",
"(",
"$",
"controllers",
")",
";",
"$",
"this",
"->",
"collection",
"->",
"mount",
"(",
"$",
"prefix",
... | Mounts controllers under the given route prefix.
@param string $prefix The route prefix
@param ControllerCollection|ControllerProviderInterface $controllers A ControllerCollection or a ControllerProviderInterface instance | [
"Mounts",
"controllers",
"under",
"the",
"given",
"route",
"prefix",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/MountEvent.php#L51-L55 |
bolt/bolt | src/Events/MountEvent.php | MountEvent.verifyCollection | protected function verifyCollection($collection)
{
if ($collection instanceof ControllerProviderInterface) {
$connectedControllers = $collection->connect($this->app);
if (!$connectedControllers instanceof ControllerCollection) {
throw new LogicException(
... | php | protected function verifyCollection($collection)
{
if ($collection instanceof ControllerProviderInterface) {
$connectedControllers = $collection->connect($this->app);
if (!$connectedControllers instanceof ControllerCollection) {
throw new LogicException(
... | [
"protected",
"function",
"verifyCollection",
"(",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"instanceof",
"ControllerProviderInterface",
")",
"{",
"$",
"connectedControllers",
"=",
"$",
"collection",
"->",
"connect",
"(",
"$",
"this",
"->",
"app... | Verifies collection is correct type and calls connect on providers.
Note: This is the same code as {@see Silex\Application::mount}
@param ControllerProviderInterface|ControllerCollection $collection
@throws LogicException If controllers is not an instance of ControllerProviderInterface or ControllerCollection
@retu... | [
"Verifies",
"collection",
"is",
"correct",
"type",
"and",
"calls",
"connect",
"on",
"providers",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/MountEvent.php#L68-L91 |
bolt/bolt | src/Extension/ControllerTrait.php | ControllerTrait.onMountRoutes | final public function onMountRoutes(MountEvent $event)
{
$app = $this->getContainer();
$collection = $app['controllers_factory'];
if ($collection instanceof DefaultControllerClassAwareInterface) {
$collection->setDefaultControllerClass($this);
}
$this->registerFr... | php | final public function onMountRoutes(MountEvent $event)
{
$app = $this->getContainer();
$collection = $app['controllers_factory'];
if ($collection instanceof DefaultControllerClassAwareInterface) {
$collection->setDefaultControllerClass($this);
}
$this->registerFr... | [
"final",
"public",
"function",
"onMountRoutes",
"(",
"MountEvent",
"$",
"event",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"collection",
"=",
"$",
"app",
"[",
"'controllers_factory'",
"]",
";",
"if",
"(",
"$",
"c... | Mounts the routes defined in registerFrontendRoutes() and registerBackendRoutes().
@param MountEvent $event
@internal | [
"Mounts",
"the",
"routes",
"defined",
"in",
"registerFrontendRoutes",
"()",
"and",
"registerBackendRoutes",
"()",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ControllerTrait.php#L42-L59 |
bolt/bolt | src/Storage/Entity/Content.php | Content.set | public function set($key, $value)
{
$setter = 'set' . ucfirst($key);
if (is_array($value)) {
// Filter empty values from the array
$value = array_filter($value, function ($item) {
return $item !== null && $item !== '';
});
}
$this->... | php | public function set($key, $value)
{
$setter = 'set' . ucfirst($key);
if (is_array($value)) {
// Filter empty values from the array
$value = array_filter($value, function ($item) {
return $item !== null && $item !== '';
});
}
$this->... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"setter",
"=",
"'set'",
".",
"ucfirst",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"// Filter empty values from the array",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L59-L69 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getRelation | public function getRelation($contentType = null)
{
if (!$this->relation instanceof Collection\Relations) {
$this->relation = new Collection\Relations();
}
if ($contentType !== null) {
return $this->relation[$contentType];
}
return $this->relation;
... | php | public function getRelation($contentType = null)
{
if (!$this->relation instanceof Collection\Relations) {
$this->relation = new Collection\Relations();
}
if ($contentType !== null) {
return $this->relation[$contentType];
}
return $this->relation;
... | [
"public",
"function",
"getRelation",
"(",
"$",
"contentType",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"relation",
"instanceof",
"Collection",
"\\",
"Relations",
")",
"{",
"$",
"this",
"->",
"relation",
"=",
"new",
"Collection",
"\\",
"R... | @param string|null $contentType
@return Collection\Relations|Collection\LazyCollection | [
"@param",
"string|null",
"$contentType"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L244-L255 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getRelated | public function getRelated($contentType = null)
{
if ($contentType !== null) {
return $this->getRelation($contentType);
}
return $this->getRelation()->all();
} | php | public function getRelated($contentType = null)
{
if ($contentType !== null) {
return $this->getRelation($contentType);
}
return $this->getRelation()->all();
} | [
"public",
"function",
"getRelated",
"(",
"$",
"contentType",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"contentType",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getRelation",
"(",
"$",
"contentType",
")",
";",
"}",
"return",
"$",
"this",
"->",... | Gets all related content items
@param $contentType
@return Collection\LazyCollection | [
"Gets",
"all",
"related",
"content",
"items"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L273-L280 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getValues | public function getValues()
{
$contentType = $this->getContenttype();
if (!isset($contentType['fields'])) {
return [];
}
$allValues = $this->toArray();
return array_intersect_key($allValues, ($contentType['fields']));
} | php | public function getValues()
{
$contentType = $this->getContenttype();
if (!isset($contentType['fields'])) {
return [];
}
$allValues = $this->toArray();
return array_intersect_key($allValues, ($contentType['fields']));
} | [
"public",
"function",
"getValues",
"(",
")",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"getContenttype",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"contentType",
"[",
"'fields'",
"]",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",... | Helper to return an array of user-defined values from the Entity.
This excludes meta fields set by Bolt. | [
"Helper",
"to",
"return",
"an",
"array",
"of",
"user",
"-",
"defined",
"values",
"from",
"the",
"Entity",
".",
"This",
"excludes",
"meta",
"fields",
"set",
"by",
"Bolt",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L338-L348 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getExcerpt | public function getExcerpt($length = 200, $includeTitle = false, $focus = null, $stripFields = null)
{
$excerpter = new Excerpt($this);
$excerpt = $excerpter->getExcerpt($length, $includeTitle, $focus, $stripFields);
return new Markup($excerpt, 'UTF-8');
} | php | public function getExcerpt($length = 200, $includeTitle = false, $focus = null, $stripFields = null)
{
$excerpter = new Excerpt($this);
$excerpt = $excerpter->getExcerpt($length, $includeTitle, $focus, $stripFields);
return new Markup($excerpt, 'UTF-8');
} | [
"public",
"function",
"getExcerpt",
"(",
"$",
"length",
"=",
"200",
",",
"$",
"includeTitle",
"=",
"false",
",",
"$",
"focus",
"=",
"null",
",",
"$",
"stripFields",
"=",
"null",
")",
"{",
"$",
"excerpter",
"=",
"new",
"Excerpt",
"(",
"$",
"this",
")"... | Create an excerpt for the Entity.
@param int $length
@param bool $includeTitle
@param array|string|null $focus
@param array|null $stripFields
@return string|null | [
"Create",
"an",
"excerpt",
"for",
"the",
"Entity",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L360-L366 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getTitle | public function getTitle()
{
$fields = $this->_fields;
if (array_key_exists('title', $fields)) {
return (string) $fields['title'];
}
$fieldNames = $this->getTitleColumnNames($this->contenttype);
$title = [];
foreach ($fieldNames as $fieldName) {
... | php | public function getTitle()
{
$fields = $this->_fields;
if (array_key_exists('title', $fields)) {
return (string) $fields['title'];
}
$fieldNames = $this->getTitleColumnNames($this->contenttype);
$title = [];
foreach ($fieldNames as $fieldName) {
... | [
"public",
"function",
"getTitle",
"(",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"_fields",
";",
"if",
"(",
"array_key_exists",
"(",
"'title'",
",",
"$",
"fields",
")",
")",
"{",
"return",
"(",
"string",
")",
"$",
"fields",
"[",
"'title'",
"]"... | Getter for a record's 'title' field.
If there is no field called 'title' then we just return the first text
type field.
@return string | [
"Getter",
"for",
"a",
"record",
"s",
"title",
"field",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L376-L395 |
bolt/bolt | src/Storage/Entity/Content.php | Content.getValidDateObject | protected function getValidDateObject($date)
{
if (empty($date)) {
return null;
}
if (is_string($date)) {
return new Carbon($date);
}
return $date;
} | php | protected function getValidDateObject($date)
{
if (empty($date)) {
return null;
}
if (is_string($date)) {
return new Carbon($date);
}
return $date;
} | [
"protected",
"function",
"getValidDateObject",
"(",
"$",
"date",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"date",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"date",
")",
")",
"{",
"return",
"new",
"Carbon",
"(",
"$"... | Get a valid date property to persist.
@param \DateTime|string|null $date
@return \DateTime|null | [
"Get",
"a",
"valid",
"date",
"property",
"to",
"persist",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Content.php#L456-L466 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.action | public function action(array $formValues, $contentType, $id, $new, $returnTo, $editReferrer)
{
$contentTypeSlug = $contentType['slug'];
$repo = $this->em->getRepository($contentTypeSlug);
// If we have an ID now, this is an existing record
if ($id) {
$content = $repo->fi... | php | public function action(array $formValues, $contentType, $id, $new, $returnTo, $editReferrer)
{
$contentTypeSlug = $contentType['slug'];
$repo = $this->em->getRepository($contentTypeSlug);
// If we have an ID now, this is an existing record
if ($id) {
$content = $repo->fi... | [
"public",
"function",
"action",
"(",
"array",
"$",
"formValues",
",",
"$",
"contentType",
",",
"$",
"id",
",",
"$",
"new",
",",
"$",
"returnTo",
",",
"$",
"editReferrer",
")",
"{",
"$",
"contentTypeSlug",
"=",
"$",
"contentType",
"[",
"'slug'",
"]",
";... | Do the save for a POSTed record.
@param array $formValues
@param array|ContentType $contentType The ContentType data
@param int $id The record ID
@param bool $new If TRUE this is a new record
@param string $returnTo
@param string $editReferrer
@throws AccessControlException
@throws InvalidRepositoryException
@return... | [
"Do",
"the",
"save",
"for",
"a",
"POSTed",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L100-L134 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.setTransitionStatus | private function setTransitionStatus(Entity\Content $content, $contentTypeSlug, $id, $oldStatus)
{
$canTransition = $this->users->isContentStatusTransitionAllowed($oldStatus, $content->getStatus(), $contentTypeSlug, $id);
if (!$canTransition) {
$content->setStatus($oldStatus);
}
... | php | private function setTransitionStatus(Entity\Content $content, $contentTypeSlug, $id, $oldStatus)
{
$canTransition = $this->users->isContentStatusTransitionAllowed($oldStatus, $content->getStatus(), $contentTypeSlug, $id);
if (!$canTransition) {
$content->setStatus($oldStatus);
}
... | [
"private",
"function",
"setTransitionStatus",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"contentTypeSlug",
",",
"$",
"id",
",",
"$",
"oldStatus",
")",
"{",
"$",
"canTransition",
"=",
"$",
"this",
"->",
"users",
"->",
"isContentStatusTransitionA... | Check whether the status is allowed.
We act as if a status *transition* were requested and fallback to the old
status otherwise.
@param Entity\Content $content
@param string $contentTypeSlug
@param int $id
@param string $oldStatus | [
"Check",
"whether",
"the",
"status",
"is",
"allowed",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L147-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.