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 |
|---|---|---|---|---|---|---|---|---|---|---|
o2system/html | src/Element.php | Element.render | public function render()
{
$selfClosingTags = [
'area',
'base',
'br',
'col',
'command',
'embed',
'hr',
'img',
'input',
'keygen',
'link',
'meta',
'param'... | php | public function render()
{
$selfClosingTags = [
'area',
'base',
'br',
'col',
'command',
'embed',
'hr',
'img',
'input',
'keygen',
'link',
'meta',
'param'... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"selfClosingTags",
"=",
"[",
"'area'",
",",
"'base'",
",",
"'br'",
",",
"'col'",
",",
"'command'",
",",
"'embed'",
",",
"'hr'",
",",
"'img'",
",",
"'input'",
",",
"'keygen'",
",",
"'link'",
",",
"'met... | Element::render
@return string | [
"Element",
"::",
"render"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element.php#L145-L196 |
o2system/html | src/Element.php | Element.open | public function open()
{
$attr = $this->attributes;
unset($attr[ 'realpath' ]);
if ($this->hasAttributes()) {
return '<' . $this->tagName . ' ' . trim($this->attributes->__toString()) . '>';
}
return '<' . $this->tagName . '>';
} | php | public function open()
{
$attr = $this->attributes;
unset($attr[ 'realpath' ]);
if ($this->hasAttributes()) {
return '<' . $this->tagName . ' ' . trim($this->attributes->__toString()) . '>';
}
return '<' . $this->tagName . '>';
} | [
"public",
"function",
"open",
"(",
")",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"attributes",
";",
"unset",
"(",
"$",
"attr",
"[",
"'realpath'",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasAttributes",
"(",
")",
")",
"{",
"return",
"'<'",
... | Element::open
@return string | [
"Element",
"::",
"open"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element.php#L217-L227 |
gdbots/pbjx-bundle-php | src/DependencyInjection/Compiler/ValidateTransportsPass.php | ValidateTransportsPass.ensureTransportExists | private function ensureTransportExists(ContainerBuilder $container, string $busName, string $transport): void
{
$serviceId = 'gdbots_pbjx.transport.' . $transport;
if ($container->hasDefinition($serviceId)) {
return;
}
throw new \LogicException(
sprintf(
... | php | private function ensureTransportExists(ContainerBuilder $container, string $busName, string $transport): void
{
$serviceId = 'gdbots_pbjx.transport.' . $transport;
if ($container->hasDefinition($serviceId)) {
return;
}
throw new \LogicException(
sprintf(
... | [
"private",
"function",
"ensureTransportExists",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"busName",
",",
"string",
"$",
"transport",
")",
":",
"void",
"{",
"$",
"serviceId",
"=",
"'gdbots_pbjx.transport.'",
".",
"$",
"transport",
";",
"if",... | @param ContainerBuilder $container
@param string $busName
@param string $transport
@throws \LogicException | [
"@param",
"ContainerBuilder",
"$container",
"@param",
"string",
"$busName",
"@param",
"string",
"$transport"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/DependencyInjection/Compiler/ValidateTransportsPass.php#L52-L67 |
gdbots/pbjx-bundle-php | src/DependencyInjection/Compiler/ValidateTransportsPass.php | ValidateTransportsPass.validateFirehoseTransport | private function validateFirehoseTransport(ContainerBuilder $container): void
{
if (!$container->hasDefinition('gdbots_pbjx.transport.firehose_router')) {
throw new \LogicException(
'The service "gdbots_pbjx.transport.firehose" has a dependency on a non-existent ' .
... | php | private function validateFirehoseTransport(ContainerBuilder $container): void
{
if (!$container->hasDefinition('gdbots_pbjx.transport.firehose_router')) {
throw new \LogicException(
'The service "gdbots_pbjx.transport.firehose" has a dependency on a non-existent ' .
... | [
"private",
"function",
"validateFirehoseTransport",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"'gdbots_pbjx.transport.firehose_router'",
")",
")",
"{",
"throw",
"new",
"\\",
"Log... | @param ContainerBuilder $container
@throws \LogicException | [
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/DependencyInjection/Compiler/ValidateTransportsPass.php#L82-L99 |
gdbots/pbjx-bundle-php | src/DependencyInjection/Compiler/ValidateTransportsPass.php | ValidateTransportsPass.validateGearmanTransport | private function validateGearmanTransport(ContainerBuilder $container): void
{
$parameter = 'gdbots_pbjx.transport.gearman.servers';
if (!$container->hasParameter($parameter)) {
throw new \LogicException(sprintf(
'The service "gdbots_pbjx.transport.gearman" has a dependen... | php | private function validateGearmanTransport(ContainerBuilder $container): void
{
$parameter = 'gdbots_pbjx.transport.gearman.servers';
if (!$container->hasParameter($parameter)) {
throw new \LogicException(sprintf(
'The service "gdbots_pbjx.transport.gearman" has a dependen... | [
"private",
"function",
"validateGearmanTransport",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"$",
"parameter",
"=",
"'gdbots_pbjx.transport.gearman.servers'",
";",
"if",
"(",
"!",
"$",
"container",
"->",
"hasParameter",
"(",
"$",
"parameter",... | @param ContainerBuilder $container
@throws \LogicException | [
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/DependencyInjection/Compiler/ValidateTransportsPass.php#L106-L123 |
gdbots/pbjx-bundle-php | src/DependencyInjection/Compiler/ValidateTransportsPass.php | ValidateTransportsPass.validateKinesisTransport | private function validateKinesisTransport(ContainerBuilder $container): void
{
if (!$container->hasDefinition('gdbots_pbjx.transport.kinesis_router')) {
throw new \LogicException(
'The service "gdbots_pbjx.transport.kinesis" has a dependency on a non-existent ' .
... | php | private function validateKinesisTransport(ContainerBuilder $container): void
{
if (!$container->hasDefinition('gdbots_pbjx.transport.kinesis_router')) {
throw new \LogicException(
'The service "gdbots_pbjx.transport.kinesis" has a dependency on a non-existent ' .
... | [
"private",
"function",
"validateKinesisTransport",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"'gdbots_pbjx.transport.kinesis_router'",
")",
")",
"{",
"throw",
"new",
"\\",
"Logic... | @param ContainerBuilder $container
@throws \LogicException | [
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/DependencyInjection/Compiler/ValidateTransportsPass.php#L130-L147 |
vsilva472/phpcpf | src/CPF.php | CPF.validate | public function validate($cpf)
{
$raw_cpf = $cpf;
$cpf = $this->clean($cpf);
$has_mask = preg_match("/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/", $raw_cpf);
if (!$has_mask && !is_numeric($raw_cpf)) {
return false;
}
if (!$this->isLengthValid(... | php | public function validate($cpf)
{
$raw_cpf = $cpf;
$cpf = $this->clean($cpf);
$has_mask = preg_match("/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/", $raw_cpf);
if (!$has_mask && !is_numeric($raw_cpf)) {
return false;
}
if (!$this->isLengthValid(... | [
"public",
"function",
"validate",
"(",
"$",
"cpf",
")",
"{",
"$",
"raw_cpf",
"=",
"$",
"cpf",
";",
"$",
"cpf",
"=",
"$",
"this",
"->",
"clean",
"(",
"$",
"cpf",
")",
";",
"$",
"has_mask",
"=",
"preg_match",
"(",
"\"/^[0-9]{3}\\.[0-9]{3}\\.[0-9]{3}\\-[0-9... | Validate a given Brazilian CPF number
@param $cpf
@return bool | [
"Validate",
"a",
"given",
"Brazilian",
"CPF",
"number"
] | train | https://github.com/vsilva472/phpcpf/blob/3c37fc1af43de31ed93acc5a9538f349e361af43/src/CPF.php#L26-L45 |
vsilva472/phpcpf | src/CPF.php | CPF.isDummyValue | public function isDummyValue($cpf)
{
return (
$cpf == '00000000000' ||
$cpf == '11111111111' ||
$cpf == '22222222222' ||
$cpf == '33333333333' ||
$cpf == '44444444444' ||
$cpf == '55555555555' ||
$cpf == '66666666666' ||
... | php | public function isDummyValue($cpf)
{
return (
$cpf == '00000000000' ||
$cpf == '11111111111' ||
$cpf == '22222222222' ||
$cpf == '33333333333' ||
$cpf == '44444444444' ||
$cpf == '55555555555' ||
$cpf == '66666666666' ||
... | [
"public",
"function",
"isDummyValue",
"(",
"$",
"cpf",
")",
"{",
"return",
"(",
"$",
"cpf",
"==",
"'00000000000'",
"||",
"$",
"cpf",
"==",
"'11111111111'",
"||",
"$",
"cpf",
"==",
"'22222222222'",
"||",
"$",
"cpf",
"==",
"'33333333333'",
"||",
"$",
"cpf"... | Check if a given CPF value is a dummy sequence
@param $cpf
@return bool | [
"Check",
"if",
"a",
"given",
"CPF",
"value",
"is",
"a",
"dummy",
"sequence"
] | train | https://github.com/vsilva472/phpcpf/blob/3c37fc1af43de31ed93acc5a9538f349e361af43/src/CPF.php#L76-L90 |
gdbots/pbjx-bundle-php | src/Command/RunGearmanConsumerCommand.php | RunGearmanConsumerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$channels = $input->getOption('channel');
$maxRuntime = (int)$input->getOption('max-runtime');
$id = $input->getOption('id');
$container = $this->getContainer();
$servers = $container->getParameter(... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$channels = $input->getOption('channel');
$maxRuntime = (int)$input->getOption('max-runtime');
$id = $input->getOption('id');
$container = $this->getContainer();
$servers = $container->getParameter(... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"channels",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'channel'",
")",
";",
"$",
"maxRuntime",
"=",
"(",
"int",
")",
"$",
"in... | @param InputInterface $input
@param OutputInterface $output
@return null | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/RunGearmanConsumerCommand.php#L74-L98 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addElement | public function addElement(\FrenchFrogs\Form\Element\Element $element, FrenchFrogs\Renderer\Renderer $renderer = null)
{
// Join element to the form
$element->setForm($this);
$this->elements[$element->getName()] = $element;
return $this;
} | php | public function addElement(\FrenchFrogs\Form\Element\Element $element, FrenchFrogs\Renderer\Renderer $renderer = null)
{
// Join element to the form
$element->setForm($this);
$this->elements[$element->getName()] = $element;
return $this;
} | [
"public",
"function",
"addElement",
"(",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Element",
"$",
"element",
",",
"FrenchFrogs",
"\\",
"Renderer",
"\\",
"Renderer",
"$",
"renderer",
"=",
"null",
")",
"{",
"// Join element to the form",
"$",
"e... | Add a single element to the elements container
@param \FrenchFrogs\Form\Element\Element $element
@return $this | [
"Add",
"a",
"single",
"element",
"to",
"the",
"elements",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L32-L40 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.removeElement | public function removeElement($name)
{
if (isset($this->elements[$name])) {
unset($this->elements[$name]);
}
return $this;
} | php | public function removeElement($name)
{
if (isset($this->elements[$name])) {
unset($this->elements[$name]);
}
return $this;
} | [
"public",
"function",
"removeElement",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"name",
"]",
")",
";",
"}",
... | Remove element $name from elements container
@param $name
@return $this | [
"Remove",
"element",
"$name",
"from",
"elements",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L48-L56 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.getElement | public function getElement($name)
{
if (!isset($this->elements[$name])) {
throw new InvalidArgumentException(" Element not found : {$name}");
}
return $this->elements[$name];
} | php | public function getElement($name)
{
if (!isset($this->elements[$name])) {
throw new InvalidArgumentException(" Element not found : {$name}");
}
return $this->elements[$name];
} | [
"public",
"function",
"getElement",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\" Element not found : {$name}\"",
")",
";"... | Return the element $name from the elements container
@param $name
@throws InvalidArgumentException
@return \FrenchFrogs\Form\Element\Element | [
"Return",
"the",
"element",
"$name",
"from",
"the",
"elements",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L78-L86 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addAction | public function addAction(\FrenchFrogs\Form\Element\Element $element)
{
$element->setForm($this);
$this->actions[$element->getName()] = $element;
return $this;
} | php | public function addAction(\FrenchFrogs\Form\Element\Element $element)
{
$element->setForm($this);
$this->actions[$element->getName()] = $element;
return $this;
} | [
"public",
"function",
"addAction",
"(",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Element",
"$",
"element",
")",
"{",
"$",
"element",
"->",
"setForm",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"actions",
"[",
"$",
"element",
"->",... | Add an action to the action container
@param \FrenchFrogs\Form\Element\Element $element
@return $this | [
"Add",
"an",
"action",
"to",
"the",
"action",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L130-L135 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.removeAction | public function removeAction($name)
{
if (isset($this->actions[$name])) {
unset($this->actions[$name]);
}
return $this;
} | php | public function removeAction($name)
{
if (isset($this->actions[$name])) {
unset($this->actions[$name]);
}
return $this;
} | [
"public",
"function",
"removeAction",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"actions",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"actions",
"[",
"$",
"name",
"]",
")",
";",
"}",
"re... | Remove the action $name from the actions container
@param $name
@return $this | [
"Remove",
"the",
"action",
"$name",
"from",
"the",
"actions",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L143-L151 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addText | public function addText($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Text($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | php | public function addText($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Text($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | [
"public",
"function",
"addText",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Text",
"(",
"$",
"name",
",",
"$",
... | Add a input:text element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Text | [
"Add",
"a",
"input",
":",
"text",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L212-L224 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addDate | public function addDate($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Date($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | php | public function addDate($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Date($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | [
"public",
"function",
"addDate",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Date",
"(",
"$",
"name",
",",
"$",
... | Add a input:text with datepicker element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Date | [
"Add",
"a",
"input",
":",
"text",
"with",
"datepicker",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L235-L247 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addDateRange | public function addDateRange($name, $label = '', $from = '', $to = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\DateRange($name, $label, $from, $to);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter... | php | public function addDateRange($name, $label = '', $from = '', $to = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\DateRange($name, $label, $from, $to);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter... | [
"public",
"function",
"addDateRange",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"from",
"=",
"''",
",",
"$",
"to",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form"... | Add 2 input for a date range element
@param $name
@param string $label
@param string $from
@param string $to
@param bool $is_mandatory
@return FrenchFrogs\Form\Element\DateRange | [
"Add",
"2",
"input",
"for",
"a",
"date",
"range",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L259-L271 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addPassword | public function addPassword($name, $label = '', $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Password($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
r... | php | public function addPassword($name, $label = '', $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Password($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
r... | [
"public",
"function",
"addPassword",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Password",
"(",
"$",
"name",
",",
... | Add input:password element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Password | [
"Add",
"input",
":",
"password",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L304-L316 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addTextarea | public function addTextarea($name, $label = '', $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Textarea($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
re... | php | public function addTextarea($name, $label = '', $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Textarea($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
re... | [
"public",
"function",
"addTextarea",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Textarea",
"(",
"$",
"name",
",",
... | Add textarea element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Textarea | [
"Add",
"textarea",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L326-L338 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addSubmit | public function addSubmit($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Submit($name, $attr);
$e->setValue($name);
$e->setOptionAsPrimary();
$this->addAction($e);
return $e;
} | php | public function addSubmit($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Submit($name, $attr);
$e->setValue($name);
$e->setOptionAsPrimary();
$this->addAction($e);
return $e;
} | [
"public",
"function",
"addSubmit",
"(",
"$",
"name",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Submit",
"(",
"$",
"name",
",",
"$",
"attr",
")",
";",
"$",
"e",
"-... | Add action button
@param $name
@param array $attr
@return \FrenchFrogs\Form\Element\Submit | [
"Add",
"action",
"button"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L347-L354 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addCheckbox | public function addCheckbox($name, $label = '', $multi = [], $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Checkbox($name, $label, $multi, $attr);
$this->addElement($e);
return $e;
} | php | public function addCheckbox($name, $label = '', $multi = [], $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Checkbox($name, $label, $multi, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addCheckbox",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"multi",
"=",
"[",
"]",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"C... | Add input checkbox element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Checkbox | [
"Add",
"input",
"checkbox",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L365-L370 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addBoolean | public function addBoolean($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Boolean($name, $label, $attr);
$this->addElement($e);
return $e;
} | php | public function addBoolean($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Boolean($name, $label, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addBoolean",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Boolean",
"(",
"$",
"name",
",",
"$",
... | Add Boolean Element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Boolean | [
"Add",
"Boolean",
"Element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L381-L386 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addTel | public function addTel($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Tel($name, $label);
$this->addElement($e);
$e->addRule('laravel','laravel', ['regex:/^[+]{0,1}[0-9]{9,13}$/'],['regex' => 'Le champ doit être un numero valide . Il peut commencer par un + et... | php | public function addTel($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Tel($name, $label);
$this->addElement($e);
$e->addRule('laravel','laravel', ['regex:/^[+]{0,1}[0-9]{9,13}$/'],['regex' => 'Le champ doit être un numero valide . Il peut commencer par un + et... | [
"public",
"function",
"addTel",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Tel",
"(",
"$",
"name",
",",
"$",
"l... | Add phone element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Tel | [
"Add",
"phone",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L397-L410 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addEmail | public function addEmail($name, $label = '',$is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Email($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
$e->addRul... | php | public function addEmail($name, $label = '',$is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Email($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
$e->addRul... | [
"public",
"function",
"addEmail",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Email",
"(",
"$",
"name",
",",
"$",
... | Add input:mail element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Email | [
"Add",
"input",
":",
"mail",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L420-L433 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addHidden | public function addHidden($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Hidden($name, $attr);
$this->addElement($e);
return $e;
} | php | public function addHidden($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Hidden($name, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addHidden",
"(",
"$",
"name",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Hidden",
"(",
"$",
"name",
",",
"$",
"attr",
")",
";",
"$",
"this",
... | Add input:hidden element
@param $name
@param array $attr
@return \FrenchFrogs\Form\Element\Hidden | [
"Add",
"input",
":",
"hidden",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L444-L449 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addSelectRemote | public function addSelectRemote($name, $label = '', $url = '#', $length = 1, $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\SelectRemote($name, $label, $url, $length);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$... | php | public function addSelectRemote($name, $label = '', $url = '#', $length = 1, $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\SelectRemote($name, $label, $url, $length);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$... | [
"public",
"function",
"addSelectRemote",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"url",
"=",
"'#'",
",",
"$",
"length",
"=",
"1",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
... | Add input:hidden element
@param $name
@param array $attr
@return \FrenchFrogs\Form\Element\Hidden | [
"Add",
"input",
":",
"hidden",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L459-L471 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addLabel | public function addLabel($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Label($name, $label, $attr);
$this->addElement($e);
return $e;
} | php | public function addLabel($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Label($name, $label, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addLabel",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Label",
"(",
"$",
"name",
",",
"$",
"l... | Add label element (read-only element)
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Label | [
"Add",
"label",
"element",
"(",
"read",
"-",
"only",
"element",
")"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L483-L488 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addLabelDate | public function addLabelDate($name, $label = '')
{
$e = new \FrenchFrogs\Form\Element\LabelDate($name, $label);
$this->addElement($e);
return $e;
} | php | public function addLabelDate($name, $label = '')
{
$e = new \FrenchFrogs\Form\Element\LabelDate($name, $label);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addLabelDate",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"LabelDate",
"(",
"$",
"name",
",",
"$",
"label",
")",
";",
"$",
"this",... | Add label date element (read-only element)
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Label | [
"Add",
"label",
"date",
"element",
"(",
"read",
"-",
"only",
"element",
")"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L498-L504 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addPre | public function addPre($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Pre($name, $label, $attr);
$this->addElement($e);
return $e;
} | php | public function addPre($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Pre($name, $label, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addPre",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Pre",
"(",
"$",
"name",
",",
"$",
"label... | Add label element (read-only element)
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Label | [
"Add",
"label",
"element",
"(",
"read",
"-",
"only",
"element",
")"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L515-L520 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addLink | public function addLink($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Link($name, $label, $attr);
$this->addElement($e);
return $e;
} | php | public function addLink($name, $label = '', $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Link($name, $label, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addLink",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Link",
"(",
"$",
"name",
",",
"$",
"lab... | Add Link element (read-only element)
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Label | [
"Add",
"Link",
"element",
"(",
"read",
"-",
"only",
"element",
")"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L530-L535 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addImage | public function addImage($name, $label = '', $width = null, $height = null )
{
$e = new \FrenchFrogs\Form\Element\Image($name, $label, $width, $height);
$this->addElement($e);
return $e;
} | php | public function addImage($name, $label = '', $width = null, $height = null )
{
$e = new \FrenchFrogs\Form\Element\Image($name, $label, $width, $height);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addImage",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Image",
... | Add Image element (read-only element)
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Label | [
"Add",
"Image",
"element",
"(",
"read",
"-",
"only",
"element",
")"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L545-L550 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addButton | public function addButton($name, $label, $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Button($name, $label, $attr);
$this->addElement($e);
return $e;
} | php | public function addButton($name, $label, $attr = [] )
{
$e = new \FrenchFrogs\Form\Element\Button($name, $label, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addButton",
"(",
"$",
"name",
",",
"$",
"label",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Button",
"(",
"$",
"name",
",",
"$",
"label",
",",... | Add button element
@param $label
@param array $attr
@return \FrenchFrogs\Form\Element\Button | [
"Add",
"button",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L560-L565 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addSeparator | public function addSeparator()
{
$e = new \FrenchFrogs\Form\Element\Separator();
$e->setName('separator-' . rand(1111, 9999));
$e->enableDiscreet();
$this->addElement($e);
return $e;
} | php | public function addSeparator()
{
$e = new \FrenchFrogs\Form\Element\Separator();
$e->setName('separator-' . rand(1111, 9999));
$e->enableDiscreet();
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addSeparator",
"(",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Separator",
"(",
")",
";",
"$",
"e",
"->",
"setName",
"(",
"'separator-'",
".",
"rand",
"(",
"1111",
",",
"9999",
")... | Add separation
@return \FrenchFrogs\Form\Element\Separator | [
"Add",
"separation"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L573-L580 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addTitle | public function addTitle($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Title($name, $attr);
$this->addElement($e);
return $e;
} | php | public function addTitle($name, $attr = [])
{
$e = new \FrenchFrogs\Form\Element\Title($name, $attr);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addTitle",
"(",
"$",
"name",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Title",
"(",
"$",
"name",
",",
"$",
"attr",
")",
";",
"$",
"this",
"... | Add a Title element
@param $name
@param array $attr
@return \FrenchFrogs\Form\Element\Title | [
"Add",
"a",
"Title",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L590-L595 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addContent | public function addContent($label, $value = '', $fullwidth = true)
{
$e = new \FrenchFrogs\Form\Element\Content($label, $value, $fullwidth);
$this->addElement($e);
return $e;
} | php | public function addContent($label, $value = '', $fullwidth = true)
{
$e = new \FrenchFrogs\Form\Element\Content($label, $value, $fullwidth);
$this->addElement($e);
return $e;
} | [
"public",
"function",
"addContent",
"(",
"$",
"label",
",",
"$",
"value",
"=",
"''",
",",
"$",
"fullwidth",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Content",
"(",
"$",
"label",
",",
"$... | Add format content
@param $label
@param string $content
@param array $attr
@return \FrenchFrogs\Form\Element\Content | [
"Add",
"format",
"content"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L606-L611 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addNumber | public function addNumber($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Number($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return ... | php | public function addNumber($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Number($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return ... | [
"public",
"function",
"addNumber",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Number",
"(",
"$",
"name",
",",
"$"... | Add input:number element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\Number | [
"Add",
"input",
":",
"number",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L622-L634 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addRadio | public function addRadio($name, $label = '', $multi = [], $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Radio($name, $label, $multi);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
... | php | public function addRadio($name, $label = '', $multi = [], $is_mandatory = true )
{
$e = new \FrenchFrogs\Form\Element\Radio($name, $label, $multi);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
... | [
"public",
"function",
"addRadio",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"multi",
"=",
"[",
"]",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"... | Add input:radio element
@param $name
@param string $label
@param array $multi
@param array $attr
@return \FrenchFrogs\Form\Element\Radio | [
"Add",
"input",
":",
"radio",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L646-L658 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addSelect | public function addSelect($name, $label, $multi = [], $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Select($name, $label, $multi);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}... | php | public function addSelect($name, $label, $multi = [], $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\Select($name, $label, $multi);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}... | [
"public",
"function",
"addSelect",
"(",
"$",
"name",
",",
"$",
"label",
",",
"$",
"multi",
"=",
"[",
"]",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"Select",
"("... | Add select element
@param $name
@param $label
@param array $multi
@param array $attr
@return \FrenchFrogs\Form\Element\Select | [
"Add",
"select",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L671-L683 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addDataList | public function addDataList($name, $label, $options = [], $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\DataList($name, $label, $options);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
... | php | public function addDataList($name, $label, $options = [], $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\DataList($name, $label, $options);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
... | [
"public",
"function",
"addDataList",
"(",
"$",
"name",
",",
"$",
"label",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"DataList",... | Add list element
@param $name
@param $label
@param array $options
@param bool|true $is_mandatory
@return FrenchFrogs\Form\Element\DataList | [
"Add",
"list",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L694-L706 |
FrenchFrogs/framework | src/Form/Form/Element.php | Element.addFile | public function addFile($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\File($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | php | public function addFile($name, $label = '', $is_mandatory = true)
{
$e = new \FrenchFrogs\Form\Element\File($name, $label);
$this->addElement($e);
if ($is_mandatory) {
$e->addRule('required');
} else {
$e->addFilter('nullable');
}
return $e;
... | [
"public",
"function",
"addFile",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"is_mandatory",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"new",
"\\",
"FrenchFrogs",
"\\",
"Form",
"\\",
"Element",
"\\",
"File",
"(",
"$",
"name",
",",
"$",
... | Add file element
@param $name
@param string $label
@param array $attr
@return \FrenchFrogs\Form\Element\File | [
"Add",
"file",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Form/Element.php#L717-L729 |
phpmob/twig-modify-bundle | Modifier/HTMLPurify.php | HTMLPurify.purify | public static function purify($content, array $options = [])
{
$config = HTMLPurifier_Config::createDefault();
foreach ($options as $key => $value) {
$config->set($key, $value);
}
if (!file_exists($config->get('Cache.SerializerPath'))) {
mkdir($config->get('... | php | public static function purify($content, array $options = [])
{
$config = HTMLPurifier_Config::createDefault();
foreach ($options as $key => $value) {
$config->set($key, $value);
}
if (!file_exists($config->get('Cache.SerializerPath'))) {
mkdir($config->get('... | [
"public",
"static",
"function",
"purify",
"(",
"$",
"content",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"HTMLPurifier_Config",
"::",
"createDefault",
"(",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>... | @param $content
@param array $options
@return bool|string | [
"@param",
"$content",
"@param",
"array",
"$options"
] | train | https://github.com/phpmob/twig-modify-bundle/blob/30b70ca3ea7b902f2f29c8457cd4f8da45b1d29e/Modifier/HTMLPurify.php#L28-L43 |
e0ipso/drupal-unit-autoload | src/Discovery/PathFinderBase.php | PathFinderBase.cleanDirPath | protected function cleanDirPath($dir_path) {
// Remove annoying /. at the end. This is needed because the
// DirectoryIterator adds that to the end of the dir name.
$dir_path = rtrim($dir_path, '.');
$dir_path = rtrim($dir_path, DIRECTORY_SEPARATOR);
return $dir_path;
} | php | protected function cleanDirPath($dir_path) {
// Remove annoying /. at the end. This is needed because the
// DirectoryIterator adds that to the end of the dir name.
$dir_path = rtrim($dir_path, '.');
$dir_path = rtrim($dir_path, DIRECTORY_SEPARATOR);
return $dir_path;
} | [
"protected",
"function",
"cleanDirPath",
"(",
"$",
"dir_path",
")",
"{",
"// Remove annoying /. at the end. This is needed because the",
"// DirectoryIterator adds that to the end of the dir name.",
"$",
"dir_path",
"=",
"rtrim",
"(",
"$",
"dir_path",
",",
"'.'",
")",
";",
... | Cleans a directory path by removing /. from the end.
@param string $dir_path
The path name to clean.
@return string
The clean path name. | [
"Cleans",
"a",
"directory",
"path",
"by",
"removing",
"/",
".",
"from",
"the",
"end",
"."
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/Discovery/PathFinderBase.php#L49-L55 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.getArgbHexString | public function getArgbHexString(Color $color)
{
$alpha = dechex(255 * $color->alpha);
return '#' . $alpha . $color->hex;
} | php | public function getArgbHexString(Color $color)
{
$alpha = dechex(255 * $color->alpha);
return '#' . $alpha . $color->hex;
} | [
"public",
"function",
"getArgbHexString",
"(",
"Color",
"$",
"color",
")",
"{",
"$",
"alpha",
"=",
"dechex",
"(",
"255",
"*",
"$",
"color",
"->",
"alpha",
")",
";",
"return",
"'#'",
".",
"$",
"alpha",
".",
"$",
"color",
"->",
"hex",
";",
"}"
] | Given a Color object, returns a formatted argb hex string
@param object $color Color object
@return string | [
"Given",
"a",
"Color",
"object",
"returns",
"a",
"formatted",
"argb",
"hex",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L34-L38 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.getRgbaHexString | public function getRgbaHexString(Color $color)
{
$alpha = dechex(255 * $color->alpha);
return '#' . $color->hex . $alpha;
} | php | public function getRgbaHexString(Color $color)
{
$alpha = dechex(255 * $color->alpha);
return '#' . $color->hex . $alpha;
} | [
"public",
"function",
"getRgbaHexString",
"(",
"Color",
"$",
"color",
")",
"{",
"$",
"alpha",
"=",
"dechex",
"(",
"255",
"*",
"$",
"color",
"->",
"alpha",
")",
";",
"return",
"'#'",
".",
"$",
"color",
"->",
"hex",
".",
"$",
"alpha",
";",
"}"
] | Given a Color object, returns a formatted rgba hex string
@param object $color Color object
@return string | [
"Given",
"a",
"Color",
"object",
"returns",
"a",
"formatted",
"rgba",
"hex",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L46-L50 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.getRgbaString | public function getRgbaString(Color $color)
{
return 'rgba('. $color->red . ', ' . $color->green . ', ' . $color->blue . ', ' . $color->alpha . ')';
} | php | public function getRgbaString(Color $color)
{
return 'rgba('. $color->red . ', ' . $color->green . ', ' . $color->blue . ', ' . $color->alpha . ')';
} | [
"public",
"function",
"getRgbaString",
"(",
"Color",
"$",
"color",
")",
"{",
"return",
"'rgba('",
".",
"$",
"color",
"->",
"red",
".",
"', '",
".",
"$",
"color",
"->",
"green",
".",
"', '",
".",
"$",
"color",
"->",
"blue",
".",
"', '",
".",
"$",
"c... | Given a Color object, returns a formatted rgba string
@param object $color Color object
@return string | [
"Given",
"a",
"Color",
"object",
"returns",
"a",
"formatted",
"rgba",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L69-L72 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.getHslString | public function getHslString(Color $color)
{
return 'hsl('. round($color->hue) . ', ' . round($color->saturation * 100) . '%, ' . round($color->lightness * 100) . '%)';
} | php | public function getHslString(Color $color)
{
return 'hsl('. round($color->hue) . ', ' . round($color->saturation * 100) . '%, ' . round($color->lightness * 100) . '%)';
} | [
"public",
"function",
"getHslString",
"(",
"Color",
"$",
"color",
")",
"{",
"return",
"'hsl('",
".",
"round",
"(",
"$",
"color",
"->",
"hue",
")",
".",
"', '",
".",
"round",
"(",
"$",
"color",
"->",
"saturation",
"*",
"100",
")",
".",
"'%, '",
".",
... | Given a Color object, returns a formatted hsl string
@param object $color Color object
@return string | [
"Given",
"a",
"Color",
"object",
"returns",
"a",
"formatted",
"hsl",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L80-L83 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.getHslaString | public function getHslaString(Color $color)
{
return 'hsla('. round($color->hue) . ', ' . round($color->saturation * 100) . '%, ' . round($color->lightness * 100) . '%, ' . $color->alpha . ')';
} | php | public function getHslaString(Color $color)
{
return 'hsla('. round($color->hue) . ', ' . round($color->saturation * 100) . '%, ' . round($color->lightness * 100) . '%, ' . $color->alpha . ')';
} | [
"public",
"function",
"getHslaString",
"(",
"Color",
"$",
"color",
")",
"{",
"return",
"'hsla('",
".",
"round",
"(",
"$",
"color",
"->",
"hue",
")",
".",
"', '",
".",
"round",
"(",
"$",
"color",
"->",
"saturation",
"*",
"100",
")",
".",
"'%, '",
".",... | Given a Color object, returns a formatted hsla string
@param object $color Color object
@return string | [
"Given",
"a",
"Color",
"object",
"returns",
"a",
"formatted",
"hsla",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L91-L94 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.load | public function load(Color $color, $value)
{
$value = strtolower(trim($value));
$format = $this->guess($value);
if (is_callable(__CLASS__ . '::' . $format)) {
$this->$format($color, $value);
}
return $color;
} | php | public function load(Color $color, $value)
{
$value = strtolower(trim($value));
$format = $this->guess($value);
if (is_callable(__CLASS__ . '::' . $format)) {
$this->$format($color, $value);
}
return $color;
} | [
"public",
"function",
"load",
"(",
"Color",
"$",
"color",
",",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"value",
")",
")",
";",
"$",
"format",
"=",
"$",
"this",
"->",
"guess",
"(",
"$",
"value",
")",
";",
... | Pass a var in subject param and this method
will attempt to parse it into a color object
and return it
@param object $color Color object
@param mixed $subject
@return object Color object | [
"Pass",
"a",
"var",
"in",
"subject",
"param",
"and",
"this",
"method",
"will",
"attempt",
"to",
"parse",
"it",
"into",
"a",
"color",
"object",
"and",
"return",
"it"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L105-L116 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.guess | private function guess($value)
{
if (is_string($value)) {
$len = strlen($value);
if (strpos($value, ' ') === false && strpos($value, ',') === false) {
if (substr($value, 0, 1) === '#' && ($len === 7 || $len === 4)) {
return 'loadHexString';
... | php | private function guess($value)
{
if (is_string($value)) {
$len = strlen($value);
if (strpos($value, ' ') === false && strpos($value, ',') === false) {
if (substr($value, 0, 1) === '#' && ($len === 7 || $len === 4)) {
return 'loadHexString';
... | [
"private",
"function",
"guess",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"value",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"' '",
")",
"===",
"fals... | Given a subject tries to discover the format,
then return the appropriate method name
@param mixed
@return string|boolean string if found, boolean false if not found | [
"Given",
"a",
"subject",
"tries",
"to",
"discover",
"the",
"format",
"then",
"return",
"the",
"appropriate",
"method",
"name"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L125-L150 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.loadHexString | public function loadHexString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('#', ';', ' '), '', $subject);
if (strlen($subject) !== 3 && strlen($subject) !== 6) {
//Bad Input
return false;
} elseif (strlen($subject) === 3)... | php | public function loadHexString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('#', ';', ' '), '', $subject);
if (strlen($subject) !== 3 && strlen($subject) !== 6) {
//Bad Input
return false;
} elseif (strlen($subject) === 3)... | [
"public",
"function",
"loadHexString",
"(",
"Color",
"$",
"color",
",",
"$",
"subject",
")",
"{",
"$",
"subject",
"=",
"trim",
"(",
"$",
"subject",
")",
";",
"$",
"subject",
"=",
"str_replace",
"(",
"array",
"(",
"'#'",
",",
"';'",
",",
"' '",
")",
... | Loads a color object from a hex string
@param object $color Color object
@param mixed
@return object Color object | [
"Loads",
"a",
"color",
"object",
"from",
"a",
"hex",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L159-L177 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.loadRgbString | public function loadRgbString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('rgba', 'rgb', '(', ')', ';', ' '), '', $subject);
$rgbnum = explode(',', $subject);
if (count($rgbnum) !== 3 && count($rgbnum) !== 4) {
return false;
... | php | public function loadRgbString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('rgba', 'rgb', '(', ')', ';', ' '), '', $subject);
$rgbnum = explode(',', $subject);
if (count($rgbnum) !== 3 && count($rgbnum) !== 4) {
return false;
... | [
"public",
"function",
"loadRgbString",
"(",
"Color",
"$",
"color",
",",
"$",
"subject",
")",
"{",
"$",
"subject",
"=",
"trim",
"(",
"$",
"subject",
")",
";",
"$",
"subject",
"=",
"str_replace",
"(",
"array",
"(",
"'rgba'",
",",
"'rgb'",
",",
"'('",
"... | Loads a color object from an rgb or rgba string
@param object $color Color object
@param mixed
@return object Color object | [
"Loads",
"a",
"color",
"object",
"from",
"an",
"rgb",
"or",
"rgba",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L186-L215 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Formatter.php | Formatter.loadHslString | public function loadHslString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('hsla', 'hsl', '(', ')', ';', ' '), '', $subject);
$hslnum = explode(',', $subject);
if (count($hslnum) !== 3 && count($hslnum) !== 4) {
return false;
... | php | public function loadHslString(Color $color, $subject)
{
$subject = trim($subject);
$subject = str_replace(array('hsla', 'hsl', '(', ')', ';', ' '), '', $subject);
$hslnum = explode(',', $subject);
if (count($hslnum) !== 3 && count($hslnum) !== 4) {
return false;
... | [
"public",
"function",
"loadHslString",
"(",
"Color",
"$",
"color",
",",
"$",
"subject",
")",
"{",
"$",
"subject",
"=",
"trim",
"(",
"$",
"subject",
")",
";",
"$",
"subject",
"=",
"str_replace",
"(",
"array",
"(",
"'hsla'",
",",
"'hsl'",
",",
"'('",
"... | Loads a color object from a hsl or hsla string
@param object $color Color object
@param mixed
@return object Color object | [
"Loads",
"a",
"color",
"object",
"from",
"a",
"hsl",
"or",
"hsla",
"string"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Formatter.php#L224-L253 |
opis/storages | cache/Database.php | Database.write | public function write($key, $value, $ttl = 0)
{
$ttl = ((int) $ttl <= 0) ? 0 : ((int) $ttl + time());
try {
$this->delete($key);
return $this->db
->insert(array(
$this->columns['key'] => $this->prefix . $key,
... | php | public function write($key, $value, $ttl = 0)
{
$ttl = ((int) $ttl <= 0) ? 0 : ((int) $ttl + time());
try {
$this->delete($key);
return $this->db
->insert(array(
$this->columns['key'] => $this->prefix . $key,
... | [
"public",
"function",
"write",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
"=",
"0",
")",
"{",
"$",
"ttl",
"=",
"(",
"(",
"int",
")",
"$",
"ttl",
"<=",
"0",
")",
"?",
"0",
":",
"(",
"(",
"int",
")",
"$",
"ttl",
"+",
"time",
"(",
... | Store variable in the cache.
@param string $key Cache key
@param mixed $value The variable to store
@param int $ttl (optional) Time to live
@return boolean | [
"Store",
"variable",
"in",
"the",
"cache",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/cache/Database.php#L79-L96 |
opis/storages | cache/Database.php | Database.read | public function read($key)
{
try {
$cache = $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->select()
->fetchAssoc()
->first();
} catch (PDOException $e) {
return false;
... | php | public function read($key)
{
try {
$cache = $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->select()
->fetchAssoc()
->first();
} catch (PDOException $e) {
return false;
... | [
"public",
"function",
"read",
"(",
"$",
"key",
")",
"{",
"try",
"{",
"$",
"cache",
"=",
"$",
"this",
"->",
"db",
"->",
"from",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"columns",
"[",
"'key'",
"]",
")",
"->",... | Fetch variable from the cache.
@param string $key Cache key
@return mixed | [
"Fetch",
"variable",
"from",
"the",
"cache",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/cache/Database.php#L105-L128 |
opis/storages | cache/Database.php | Database.has | public function has($key)
{
try {
$ttlColumn = $this->columns['ttl'];
return (bool) $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->andWhere(function ($group) use ($ttlColumn) {
... | php | public function has($key)
{
try {
$ttlColumn = $this->columns['ttl'];
return (bool) $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->andWhere(function ($group) use ($ttlColumn) {
... | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"try",
"{",
"$",
"ttlColumn",
"=",
"$",
"this",
"->",
"columns",
"[",
"'ttl'",
"]",
";",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"db",
"->",
"from",
"(",
"$",
"this",
"->",
"table",
... | Returns TRUE if the cache key exists and FALSE if not.
@param string $key Cache key
@return boolean | [
"Returns",
"TRUE",
"if",
"the",
"cache",
"key",
"exists",
"and",
"FALSE",
"if",
"not",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/cache/Database.php#L137-L152 |
opis/storages | cache/Database.php | Database.delete | public function delete($key)
{
try {
return (bool) $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->delete();
} catch (PDOException $e) {
return false;
}
} | php | public function delete($key)
{
try {
return (bool) $this->db->from($this->table)
->where($this->columns['key'])->eq($this->prefix . $key)
->delete();
} catch (PDOException $e) {
return false;
}
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"try",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"db",
"->",
"from",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"columns",
"[",
"'key'",
"]",
... | Delete a variable from the cache.
@param string $key Cache key
@return boolean | [
"Delete",
"a",
"variable",
"from",
"the",
"cache",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/cache/Database.php#L161-L170 |
opis/storages | cache/Database.php | Database.clear | public function clear()
{
try {
$this->db->from($this->table)->delete();
} catch (PDOException $e) {
return false;
}
return true;
} | php | public function clear()
{
try {
$this->db->from($this->table)->delete();
} catch (PDOException $e) {
return false;
}
return true;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"db",
"->",
"from",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"delete",
"(",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"e",
")",
"{",
"return",
"false",
";",
... | Clears the user cache.
@return boolean | [
"Clears",
"the",
"user",
"cache",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/cache/Database.php#L177-L186 |
Nayjest/Tree | src/ParentNodeTrait.php | ParentNodeTrait.children | public function children()
{
if ($this->collection === null) {
$this->initializeCollection($this->defaultChildren());
}
return $this->collection;
} | php | public function children()
{
if ($this->collection === null) {
$this->initializeCollection($this->defaultChildren());
}
return $this->collection;
} | [
"public",
"function",
"children",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collection",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initializeCollection",
"(",
"$",
"this",
"->",
"defaultChildren",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
... | Returns collection of child nodes.
@return \Nayjest\Collection\CollectionInterface|ChildNodeInterface[] | [
"Returns",
"collection",
"of",
"child",
"nodes",
"."
] | train | https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/ParentNodeTrait.php#L56-L63 |
Nayjest/Tree | src/ParentNodeTrait.php | ParentNodeTrait.getChildrenRecursive | public function getChildrenRecursive()
{
$res = new ObjectCollection();
foreach ($this->children() as $child) {
$res->add($child);
if ($child instanceof ParentNodeInterface) {
$res->addMany($child->getChildrenRecursive());
}
}
retu... | php | public function getChildrenRecursive()
{
$res = new ObjectCollection();
foreach ($this->children() as $child) {
$res->add($child);
if ($child instanceof ParentNodeInterface) {
$res->addMany($child->getChildrenRecursive());
}
}
retu... | [
"public",
"function",
"getChildrenRecursive",
"(",
")",
"{",
"$",
"res",
"=",
"new",
"ObjectCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"res",
"->",
"add",
"(",
"$",
"child",... | Returns collection containing all descendant nodes.
@return CollectionInterface|ObjectCollection|ChildNodeInterface[] | [
"Returns",
"collection",
"containing",
"all",
"descendant",
"nodes",
"."
] | train | https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/ParentNodeTrait.php#L80-L91 |
acasademont/wurfl | WURFL/WURFLUtils.php | WURFL_WURFLUtils.getUserAgent | public static function getUserAgent($request, $override_sideloaded_browser_ua = true)
{
if (!$override_sideloaded_browser_ua) {
return $request['HTTP_USER_AGENT'];
}
if (isset($request[WURFL_Constants::UA])) {
return $request[WURFL_Constants::UA];
}
... | php | public static function getUserAgent($request, $override_sideloaded_browser_ua = true)
{
if (!$override_sideloaded_browser_ua) {
return $request['HTTP_USER_AGENT'];
}
if (isset($request[WURFL_Constants::UA])) {
return $request[WURFL_Constants::UA];
}
... | [
"public",
"static",
"function",
"getUserAgent",
"(",
"$",
"request",
",",
"$",
"override_sideloaded_browser_ua",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"override_sideloaded_browser_ua",
")",
"{",
"return",
"$",
"request",
"[",
"'HTTP_USER_AGENT'",
"]",
";",... | returns the User Agent From $request or empty string if not found
@param array $request HTTP Request array (normally $_SERVER)
@return string | [
"returns",
"the",
"User",
"Agent",
"From",
"$request",
"or",
"empty",
"string",
"if",
"not",
"found"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLUtils.php#L36-L53 |
acasademont/wurfl | WURFL/WURFLUtils.php | WURFL_WURFLUtils.getUserAgentProfile | public static function getUserAgentProfile($request)
{
if (isset($request["HTTP_X_WAP_PROFILE"])) {
return $request["HTTP_X_WAP_PROFILE"];
}
if (isset($request["HTTP_PROFILE"])) {
return $request["HTTP_PROFILE"];
}
if (isset($request["Opt"])) {
... | php | public static function getUserAgentProfile($request)
{
if (isset($request["HTTP_X_WAP_PROFILE"])) {
return $request["HTTP_X_WAP_PROFILE"];
}
if (isset($request["HTTP_PROFILE"])) {
return $request["HTTP_PROFILE"];
}
if (isset($request["Opt"])) {
... | [
"public",
"static",
"function",
"getUserAgentProfile",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"request",
"[",
"\"HTTP_X_WAP_PROFILE\"",
"]",
")",
")",
"{",
"return",
"$",
"request",
"[",
"\"HTTP_X_WAP_PROFILE\"",
"]",
";",
"}",
"if",
... | Returns the UA Profile from the $request
@param array $request HTTP Request array (normally $_SERVER)
@return string UAProf URL | [
"Returns",
"the",
"UA",
"Profile",
"from",
"the",
"$request"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLUtils.php#L60-L82 |
acasademont/wurfl | WURFL/WURFLUtils.php | WURFL_WURFLUtils.isXhtmlRequester | public static function isXhtmlRequester($request)
{
if (!isset($request["accept"])) {
return false;
}
$accept = $request["accept"];
if (isset($accept)) {
if ((strpos($accept, WURFL_Constants::ACCEPT_HEADER_VND_WAP_XHTML_XML) !== 0)
|| (str... | php | public static function isXhtmlRequester($request)
{
if (!isset($request["accept"])) {
return false;
}
$accept = $request["accept"];
if (isset($accept)) {
if ((strpos($accept, WURFL_Constants::ACCEPT_HEADER_VND_WAP_XHTML_XML) !== 0)
|| (str... | [
"public",
"static",
"function",
"isXhtmlRequester",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"request",
"[",
"\"accept\"",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"accept",
"=",
"$",
"request",
"[",
"\"accept\"",
... | Checks if the requester device is xhtml enabled
@param array $request HTTP Request array (normally $_SERVER)
@return bool | [
"Checks",
"if",
"the",
"requester",
"device",
"is",
"xhtml",
"enabled"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLUtils.php#L90-L106 |
acasademont/wurfl | WURFL/WURFLUtils.php | WURFL_WURFLUtils.array_merge_recursive_unique | public static function array_merge_recursive_unique($array1, $array2)
{
// LOOP THROUGH $array2
foreach ($array2 as $k => $v) {
// CHECK IF VALUE EXISTS IN $array1
if (!empty($array1[$k])) {
// IF VALUE EXISTS CHECK IF IT'S AN ARRAY OR A STRING
... | php | public static function array_merge_recursive_unique($array1, $array2)
{
// LOOP THROUGH $array2
foreach ($array2 as $k => $v) {
// CHECK IF VALUE EXISTS IN $array1
if (!empty($array1[$k])) {
// IF VALUE EXISTS CHECK IF IT'S AN ARRAY OR A STRING
... | [
"public",
"static",
"function",
"array_merge_recursive_unique",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"// LOOP THROUGH $array2",
"foreach",
"(",
"$",
"array2",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"// CHECK IF VALUE EXISTS IN $array1",
"if",
"("... | Recursively merges $array1 with $array2, returning the result
@param array $array1
@param array $array2
@return array | [
"Recursively",
"merges",
"$array1",
"with",
"$array2",
"returning",
"the",
"result"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLUtils.php#L127-L150 |
activecollab/databasestructure | src/Builder/AssociationsBuilder.php | AssociationsBuilder.postBuild | public function postBuild()
{
if ($this->getConnection()) {
foreach ($this->getStructure()->getTypes() as $type) {
foreach ($type->getAssociations() as $association) {
if ($association instanceof BelongsToAssociation) {
$create_constrai... | php | public function postBuild()
{
if ($this->getConnection()) {
foreach ($this->getStructure()->getTypes() as $type) {
foreach ($type->getAssociations() as $association) {
if ($association instanceof BelongsToAssociation) {
$create_constrai... | [
"public",
"function",
"postBuild",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getConnection",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getStructure",
"(",
")",
"->",
"getTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"foreach",
"(... | Execute after types are built. | [
"Execute",
"after",
"types",
"are",
"built",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/AssociationsBuilder.php#L57-L112 |
activecollab/databasestructure | src/Builder/AssociationsBuilder.php | AssociationsBuilder.prepareBelongsToConstraintStatement | public function prepareBelongsToConstraintStatement(TypeInterface $type, BelongsToAssociation $association)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($type->getName());
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->escapeFieldName($as... | php | public function prepareBelongsToConstraintStatement(TypeInterface $type, BelongsToAssociation $association)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($type->getName());
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->escapeFieldName($as... | [
"public",
"function",
"prepareBelongsToConstraintStatement",
"(",
"TypeInterface",
"$",
"type",
",",
"BelongsToAssociation",
"$",
"association",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"]",
"=",
"'ALTER TABLE '",
".",
"$",
"this",
"->"... | Prepare belongs to constraint statement.
@param TypeInterface $type
@param BelongsToAssociation $association
@return string | [
"Prepare",
"belongs",
"to",
"constraint",
"statement",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/AssociationsBuilder.php#L121-L136 |
activecollab/databasestructure | src/Builder/AssociationsBuilder.php | AssociationsBuilder.prepareHasOneConstraintStatement | public function prepareHasOneConstraintStatement(TypeInterface $type, HasOneAssociation $association)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($type->getName());
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->escapeFieldName($associat... | php | public function prepareHasOneConstraintStatement(TypeInterface $type, HasOneAssociation $association)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($type->getName());
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->escapeFieldName($associat... | [
"public",
"function",
"prepareHasOneConstraintStatement",
"(",
"TypeInterface",
"$",
"type",
",",
"HasOneAssociation",
"$",
"association",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"]",
"=",
"'ALTER TABLE '",
".",
"$",
"this",
"->",
"g... | Prepare has one constraint statement.
@param TypeInterface $type
@param HasOneAssociation $association
@return string | [
"Prepare",
"has",
"one",
"constraint",
"statement",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/AssociationsBuilder.php#L145-L160 |
activecollab/databasestructure | src/Builder/AssociationsBuilder.php | AssociationsBuilder.prepareHasAndBelongsToManyConstraintStatement | public function prepareHasAndBelongsToManyConstraintStatement($type_name, $connection_table, $constraint_name, $field_name)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($connection_table);
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->es... | php | public function prepareHasAndBelongsToManyConstraintStatement($type_name, $connection_table, $constraint_name, $field_name)
{
$result = [];
$result[] = 'ALTER TABLE ' . $this->getConnection()->escapeTableName($connection_table);
$result[] = ' ADD CONSTRAINT ' . $this->getConnection()->es... | [
"public",
"function",
"prepareHasAndBelongsToManyConstraintStatement",
"(",
"$",
"type_name",
",",
"$",
"connection_table",
",",
"$",
"constraint_name",
",",
"$",
"field_name",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"]",
"=",
"'ALTER ... | Prepare has and belongs to many constraint statement.
@param string $type_name
@param string $connection_table
@param string $constraint_name
@param string $field_name
@return string | [
"Prepare",
"has",
"and",
"belongs",
"to",
"many",
"constraint",
"statement",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/AssociationsBuilder.php#L171-L181 |
seeren/http | src/Stream/Stream.php | Stream.setReadableWritable | private final function setReadableWritable(string $mode)
{
if (self::MODE_R === $mode) {
$this->meta["readable"] = true;
$this->meta["writable"] = false;
} else if (self::MODE_W === $mode
|| self::MODE_A === $mode
|| self::MODE_C === $mode
... | php | private final function setReadableWritable(string $mode)
{
if (self::MODE_R === $mode) {
$this->meta["readable"] = true;
$this->meta["writable"] = false;
} else if (self::MODE_W === $mode
|| self::MODE_A === $mode
|| self::MODE_C === $mode
... | [
"private",
"final",
"function",
"setReadableWritable",
"(",
"string",
"$",
"mode",
")",
"{",
"if",
"(",
"self",
"::",
"MODE_R",
"===",
"$",
"mode",
")",
"{",
"$",
"this",
"->",
"meta",
"[",
"\"readable\"",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"m... | Set stream readable and writable status
@param string $mode ressource mode
@return null | [
"Set",
"stream",
"readable",
"and",
"writable",
"status"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L76-L95 |
seeren/http | src/Stream/Stream.php | Stream.detach | public final function detach()
{
$stream = null;
if ($this->stream) {
$this->close();
$stream = $this->stream;
$this->stream = null;
}
return $stream;
} | php | public final function detach()
{
$stream = null;
if ($this->stream) {
$this->close();
$stream = $this->stream;
$this->stream = null;
}
return $stream;
} | [
"public",
"final",
"function",
"detach",
"(",
")",
"{",
"$",
"stream",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"stream",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"stream",
";",
"$",
"th... | Detach stream
@return resource|null ressource if any stream | [
"Detach",
"stream"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L131-L140 |
seeren/http | src/Stream/Stream.php | Stream.rewind | public final function rewind()
{
if (!$this->isReadable() || !$this->isSeekable()) {
throw new RuntimeException("Can't rewind: stream is not readable");
}
rewind($this->stream);
$this->meta["eof"] = false;
} | php | public final function rewind()
{
if (!$this->isReadable() || !$this->isSeekable()) {
throw new RuntimeException("Can't rewind: stream is not readable");
}
rewind($this->stream);
$this->meta["eof"] = false;
} | [
"public",
"final",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReadable",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"isSeekable",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can't rewind: stream is not reada... | Rewind stream
@return null
@throws RuntimeException | [
"Rewind",
"stream"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L212-L219 |
seeren/http | src/Stream/Stream.php | Stream.write | public final function write($string): int
{
if (!$this->isWritable()) {
throw new RuntimeException("Can't write: stream is not writable");
}
$this->meta["eof"] = true;
if (($size = (int) fwrite($this->stream, (string) $string))) {
$this->meta["size"] = $this->getMetad... | php | public final function write($string): int
{
if (!$this->isWritable()) {
throw new RuntimeException("Can't write: stream is not writable");
}
$this->meta["eof"] = true;
if (($size = (int) fwrite($this->stream, (string) $string))) {
$this->meta["size"] = $this->getMetad... | [
"public",
"final",
"function",
"write",
"(",
"$",
"string",
")",
":",
"int",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWritable",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can't write: stream is not writable\"",
")",
";",
"}",
"$",
... | Write
@param string $string body part
@return int number of bytes
@throws RuntimeException | [
"Write"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L249-L259 |
seeren/http | src/Stream/Stream.php | Stream.read | public final function read($length): string
{
if (!$this->isReadable()) {
throw new RuntimeException("Can't read: stream is not readable");
}
$read = (string) fread($this->stream, (int) $length);
$this->meta["eof"] = !$read ? true : false;
return $read;
} | php | public final function read($length): string
{
if (!$this->isReadable()) {
throw new RuntimeException("Can't read: stream is not readable");
}
$read = (string) fread($this->stream, (int) $length);
$this->meta["eof"] = !$read ? true : false;
return $read;
} | [
"public",
"final",
"function",
"read",
"(",
"$",
"length",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReadable",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can't read: stream is not readable\"",
")",
";",
"}",
"$",
... | Read
@param int $length number of bytes
@return string data read
@throws RuntimeException | [
"Read"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L269-L277 |
seeren/http | src/Stream/Stream.php | Stream.getContents | public final function getContents(): string
{
if (!$this->isReadable()) {
throw new RuntimeException(
"Can't getContents: stream is not readable");
}
$this->meta["eof"] = true;
return (string) stream_get_contents($this->stream);
} | php | public final function getContents(): string
{
if (!$this->isReadable()) {
throw new RuntimeException(
"Can't getContents: stream is not readable");
}
$this->meta["eof"] = true;
return (string) stream_get_contents($this->stream);
} | [
"public",
"final",
"function",
"getContents",
"(",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReadable",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can't getContents: stream is not readable\"",
")",
";",
"}",
"$",
"th... | Returns the remaining contents in a string
@return string
@throws RuntimeException | [
"Returns",
"the",
"remaining",
"contents",
"in",
"a",
"string"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L285-L293 |
seeren/http | src/Stream/Stream.php | Stream.getMetadata | public final function getMetadata($key = null)
{
return isset($key)
? (array_key_exists($key, $this->meta) ? $this->meta[$key] : null)
: $this->meta;
} | php | public final function getMetadata($key = null)
{
return isset($key)
? (array_key_exists($key, $this->meta) ? $this->meta[$key] : null)
: $this->meta;
} | [
"public",
"final",
"function",
"getMetadata",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"key",
")",
"?",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"meta",
")",
"?",
"$",
"this",
"->",
"meta",
"[",
... | Get stream metadata
@param string $key metadata key
@return array|mixed|null meta or value for key or null | [
"Get",
"stream",
"metadata"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/Stream.php#L301-L306 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Toolkit.php | Toolkit.sync | public function sync(Color $firstcolor, Color $secondcolor)
{
foreach ($this->colorprops as $name) {
$firstcolor->$name = $secondcolor->$name;
}
return $firstcolor;
} | php | public function sync(Color $firstcolor, Color $secondcolor)
{
foreach ($this->colorprops as $name) {
$firstcolor->$name = $secondcolor->$name;
}
return $firstcolor;
} | [
"public",
"function",
"sync",
"(",
"Color",
"$",
"firstcolor",
",",
"Color",
"$",
"secondcolor",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"colorprops",
"as",
"$",
"name",
")",
"{",
"$",
"firstcolor",
"->",
"$",
"name",
"=",
"$",
"secondcolor",
"->"... | Sync first color with second color
The first color will receive all property values from the second color
@param object $firstcolor first Color object to receive the values
@param object $secondcolor second Color object to give the values
@return object self | [
"Sync",
"first",
"color",
"with",
"second",
"color"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Toolkit.php#L56-L63 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Toolkit.php | Toolkit.getCssGradient | public function getCssGradient(Color $color, $amount = null)
{
// Get gradient colors
if (self::isLight($color)) {
$lightColor = $color->hex;
$darkColor = self::darken($color->copy(), $amount)->hex;
} else {
$lightColor = self::lighten($color->copy(), $amo... | php | public function getCssGradient(Color $color, $amount = null)
{
// Get gradient colors
if (self::isLight($color)) {
$lightColor = $color->hex;
$darkColor = self::darken($color->copy(), $amount)->hex;
} else {
$lightColor = self::lighten($color->copy(), $amo... | [
"public",
"function",
"getCssGradient",
"(",
"Color",
"$",
"color",
",",
"$",
"amount",
"=",
"null",
")",
"{",
"// Get gradient colors",
"if",
"(",
"self",
"::",
"isLight",
"(",
"$",
"color",
")",
")",
"{",
"$",
"lightColor",
"=",
"$",
"color",
"->",
"... | Returns the cross browser CSS3 gradient
@param object $color Color object
@param integer $amount Optional: percentage amount to light/darken the gradient
@return string CSS3 gradient for chrome, safari, firefox, opera and IE10 with fallbacks | [
"Returns",
"the",
"cross",
"browser",
"CSS3",
"gradient"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Toolkit.php#L120-L154 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Toolkit.php | Toolkit.darken | public function darken(Color $color, $amount = null)
{
$current = $color->lightness;
$amount = ($amount === null) ? self::DEFAULT_ADJUST : $amount ;
$amount = intval($amount) / 100;
$new = $current - $amount;
$new = ($new < 0) ? 0 : $new;
$new = ($new > 1) ? 1 : ... | php | public function darken(Color $color, $amount = null)
{
$current = $color->lightness;
$amount = ($amount === null) ? self::DEFAULT_ADJUST : $amount ;
$amount = intval($amount) / 100;
$new = $current - $amount;
$new = ($new < 0) ? 0 : $new;
$new = ($new > 1) ? 1 : ... | [
"public",
"function",
"darken",
"(",
"Color",
"$",
"color",
",",
"$",
"amount",
"=",
"null",
")",
"{",
"$",
"current",
"=",
"$",
"color",
"->",
"lightness",
";",
"$",
"amount",
"=",
"(",
"$",
"amount",
"===",
"null",
")",
"?",
"self",
"::",
"DEFAUL... | Darkens color by a percentage a given Color object
@param object $color Color object
@param integer
@return object Color | [
"Darkens",
"color",
"by",
"a",
"percentage",
"a",
"given",
"Color",
"object"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Toolkit.php#L163-L180 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Toolkit.php | Toolkit.merge | public function merge(Color $color1, Color $color2, $percentage = 50)
{
return new Color(array(
'red' => $this->getMergedColorPart('red', $color1, $color2, $percentage),
'green' => $this->getMergedColorPart('green', $color1, $color2, $percentage),
'blue' => $this->getMerg... | php | public function merge(Color $color1, Color $color2, $percentage = 50)
{
return new Color(array(
'red' => $this->getMergedColorPart('red', $color1, $color2, $percentage),
'green' => $this->getMergedColorPart('green', $color1, $color2, $percentage),
'blue' => $this->getMerg... | [
"public",
"function",
"merge",
"(",
"Color",
"$",
"color1",
",",
"Color",
"$",
"color2",
",",
"$",
"percentage",
"=",
"50",
")",
"{",
"return",
"new",
"Color",
"(",
"array",
"(",
"'red'",
"=>",
"$",
"this",
"->",
"getMergedColorPart",
"(",
"'red'",
","... | Merges the current color with a second color with an optional percentage
@param object $color1 Color object
@param object $color2 Color object
@param integer $percentage
@return object Color | [
"Merges",
"the",
"current",
"color",
"with",
"a",
"second",
"color",
"with",
"an",
"optional",
"percentage"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Toolkit.php#L216-L223 |
syhol/mrcolor | src/SyHolloway/MrColor/Extension/Toolkit.php | Toolkit.getMergedColorPart | private function getMergedColorPart($type, $color1, $color2, $percentage)
{
return $color1->$type - ( ($percentage / 100) * ( $color1->$type - $color2->$type ) );
} | php | private function getMergedColorPart($type, $color1, $color2, $percentage)
{
return $color1->$type - ( ($percentage / 100) * ( $color1->$type - $color2->$type ) );
} | [
"private",
"function",
"getMergedColorPart",
"(",
"$",
"type",
",",
"$",
"color1",
",",
"$",
"color2",
",",
"$",
"percentage",
")",
"{",
"return",
"$",
"color1",
"->",
"$",
"type",
"-",
"(",
"(",
"$",
"percentage",
"/",
"100",
")",
"*",
"(",
"$",
"... | Get a new r/g/b value between color1 and color2 bases on percentage
@param string $type
@param object $color1 Color object
@param object $color2 Color object
@param integer $percentage
@return integer | [
"Get",
"a",
"new",
"r",
"/",
"g",
"/",
"b",
"value",
"between",
"color1",
"and",
"color2",
"bases",
"on",
"percentage"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Extension/Toolkit.php#L234-L237 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.getFullAddress | public function getFullAddress()
{
$parts = [
$this->owner->Address,
$this->owner->Address2,
$this->owner->City,
$this->owner->State,
$this->owner->PostalCode,
$this->owner->Country,
];
return implode(', ', array_filter... | php | public function getFullAddress()
{
$parts = [
$this->owner->Address,
$this->owner->Address2,
$this->owner->City,
$this->owner->State,
$this->owner->PostalCode,
$this->owner->Country,
];
return implode(', ', array_filter... | [
"public",
"function",
"getFullAddress",
"(",
")",
"{",
"$",
"parts",
"=",
"[",
"$",
"this",
"->",
"owner",
"->",
"Address",
",",
"$",
"this",
"->",
"owner",
"->",
"Address2",
",",
"$",
"this",
"->",
"owner",
"->",
"City",
",",
"$",
"this",
"->",
"o... | Returns the full address as a simple string.
@return string | [
"Returns",
"the",
"full",
"address",
"as",
"a",
"simple",
"string",
"."
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L59-L71 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.AddressMap | public function AddressMap($width = 320, $height = 240, $scale = 1)
{
$styleJSON = static::getMapStyleJSONPath();
$style = false;
if ($styleJSON !== false) {
$style = $this->mapStylesUrlArgs(file_get_contents($styleJSON));
}
$icon = Director::absoluteURL(static::... | php | public function AddressMap($width = 320, $height = 240, $scale = 1)
{
$styleJSON = static::getMapStyleJSONPath();
$style = false;
if ($styleJSON !== false) {
$style = $this->mapStylesUrlArgs(file_get_contents($styleJSON));
}
$icon = Director::absoluteURL(static::... | [
"public",
"function",
"AddressMap",
"(",
"$",
"width",
"=",
"320",
",",
"$",
"height",
"=",
"240",
",",
"$",
"scale",
"=",
"1",
")",
"{",
"$",
"styleJSON",
"=",
"static",
"::",
"getMapStyleJSONPath",
"(",
")",
";",
"$",
"style",
"=",
"false",
";",
... | Returns a static google map of the address, linking out to the address.
@param int $width (optional)
@param int $height (optional)
@param int $scale (optional)
@return string | [
"Returns",
"a",
"static",
"google",
"map",
"of",
"the",
"address",
"linking",
"out",
"to",
"the",
"address",
"."
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L95-L116 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.getMapStyleJSON | public static function getMapStyleJSON()
{
$folders = [
'client/dist/js/',
'client/dist/javascript/',
'dist/js/',
'dist/javascript/',
'src/javascript/thirdparty',
'js/',
'javascript/',
];
$file = 'mapStyle.js... | php | public static function getMapStyleJSON()
{
$folders = [
'client/dist/js/',
'client/dist/javascript/',
'dist/js/',
'dist/javascript/',
'src/javascript/thirdparty',
'js/',
'javascript/',
];
$file = 'mapStyle.js... | [
"public",
"static",
"function",
"getMapStyleJSON",
"(",
")",
"{",
"$",
"folders",
"=",
"[",
"'client/dist/js/'",
",",
"'client/dist/javascript/'",
",",
"'dist/js/'",
",",
"'dist/javascript/'",
",",
"'src/javascript/thirdparty'",
",",
"'js/'",
",",
"'javascript/'",
","... | Gets the style of the map
@return string|null | [
"Gets",
"the",
"style",
"of",
"the",
"map"
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L134-L157 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.getIconImage | public static function getIconImage($svg = true)
{
$folders = [
'client/dist/img/',
'client/dist/images/',
'dist/img/',
'dist/images/',
'img/',
'images/',
];
$extensions = [
'png',
'jpg',
... | php | public static function getIconImage($svg = true)
{
$folders = [
'client/dist/img/',
'client/dist/images/',
'dist/img/',
'dist/images/',
'img/',
'images/',
];
$extensions = [
'png',
'jpg',
... | [
"public",
"static",
"function",
"getIconImage",
"(",
"$",
"svg",
"=",
"true",
")",
"{",
"$",
"folders",
"=",
"[",
"'client/dist/img/'",
",",
"'client/dist/images/'",
",",
"'dist/img/'",
",",
"'dist/images/'",
",",
"'img/'",
",",
"'images/'",
",",
"]",
";",
"... | Gets the maker icon image
@var boolean $svg if svgs should be included
@return null|string | [
"Gets",
"the",
"maker",
"icon",
"image"
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L164-L200 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.mapStylesUrlArgs | public function mapStylesUrlArgs($mapStyleJson)
{
$params = [];
foreach (json_decode($mapStyleJson, true) as $style) {
$styleString = '';
if (isset($style['stylers']) && count($style['stylers']) > 0) {
$styleString .= (isset($style['featureType']) ? ('feature:... | php | public function mapStylesUrlArgs($mapStyleJson)
{
$params = [];
foreach (json_decode($mapStyleJson, true) as $style) {
$styleString = '';
if (isset($style['stylers']) && count($style['stylers']) > 0) {
$styleString .= (isset($style['featureType']) ? ('feature:... | [
"public",
"function",
"mapStylesUrlArgs",
"(",
"$",
"mapStyleJson",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"json_decode",
"(",
"$",
"mapStyleJson",
",",
"true",
")",
"as",
"$",
"style",
")",
"{",
"$",
"styleString",
"=",
"''",
";"... | From https://gist.github.com/wouterds/5942b891cdad4fc90f40
@param $mapStyleJson
@return string | [
"From",
"https",
":",
"//",
"gist",
".",
"github",
".",
"com",
"/",
"wouterds",
"/",
"5942b891cdad4fc90f40",
"@param",
"$mapStyleJson"
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L208-L227 |
dynamic/silverstripe-geocoder | src/AddressDataExtension.php | AddressDataExtension.isAddressChanged | public function isAddressChanged($level = 1)
{
$fields = ['Address', 'Address2', 'City', 'State', 'PostalCode', 'Country'];
$changed = $this->owner->getChangedFields(false, $level);
foreach ($fields as $field) {
if (array_key_exists($field, $changed)) {
return tru... | php | public function isAddressChanged($level = 1)
{
$fields = ['Address', 'Address2', 'City', 'State', 'PostalCode', 'Country'];
$changed = $this->owner->getChangedFields(false, $level);
foreach ($fields as $field) {
if (array_key_exists($field, $changed)) {
return tru... | [
"public",
"function",
"isAddressChanged",
"(",
"$",
"level",
"=",
"1",
")",
"{",
"$",
"fields",
"=",
"[",
"'Address'",
",",
"'Address2'",
",",
"'City'",
",",
"'State'",
",",
"'PostalCode'",
",",
"'Country'",
"]",
";",
"$",
"changed",
"=",
"$",
"this",
... | Returns TRUE if any of the address fields have changed.
@param int $level
@return bool | [
"Returns",
"TRUE",
"if",
"any",
"of",
"the",
"address",
"fields",
"have",
"changed",
"."
] | train | https://github.com/dynamic/silverstripe-geocoder/blob/234ec4caa8f73f7a6432a098548f8d55c7894251/src/AddressDataExtension.php#L236-L247 |
dragosprotung/stc-core | src/Workout/Dumper/TCX.php | TCX.dump | public function dump(Workout $workout): string
{
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->setIndent(true);
$xmlWriter->startDocument('1.0', 'UTF-8');
$xmlWriter->startElement('TrainingCenterDatabase');
$xmlWriter->writeAttributeNS(
... | php | public function dump(Workout $workout): string
{
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->setIndent(true);
$xmlWriter->startDocument('1.0', 'UTF-8');
$xmlWriter->startElement('TrainingCenterDatabase');
$xmlWriter->writeAttributeNS(
... | [
"public",
"function",
"dump",
"(",
"Workout",
"$",
"workout",
")",
":",
"string",
"{",
"$",
"xmlWriter",
"=",
"new",
"\\",
"XMLWriter",
"(",
")",
";",
"$",
"xmlWriter",
"->",
"openMemory",
"(",
")",
";",
"$",
"xmlWriter",
"->",
"setIndent",
"(",
"true"... | {@inheritdoc} | [
"{"
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/TCX.php#L21-L44 |
dragosprotung/stc-core | src/Workout/Dumper/TCX.php | TCX.writeTracks | private function writeTracks(\XMLWriter $xmlWriter, Workout $workout)
{
$xmlWriter->startElement('Activities');
foreach ($workout->tracks() as $track) {
$xmlWriter->startElement('Activity');
$xmlWriter->writeAttribute('Sport', ucfirst($track->sport()));
// Use the... | php | private function writeTracks(\XMLWriter $xmlWriter, Workout $workout)
{
$xmlWriter->startElement('Activities');
foreach ($workout->tracks() as $track) {
$xmlWriter->startElement('Activity');
$xmlWriter->writeAttribute('Sport', ucfirst($track->sport()));
// Use the... | [
"private",
"function",
"writeTracks",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
",",
"Workout",
"$",
"workout",
")",
"{",
"$",
"xmlWriter",
"->",
"startElement",
"(",
"'Activities'",
")",
";",
"foreach",
"(",
"$",
"workout",
"->",
"tracks",
"(",
")",
"as",... | Write the tracks to the TCX.
@param \XMLWriter $xmlWriter The XML writer.
@param Workout $workout The workout. | [
"Write",
"the",
"tracks",
"to",
"the",
"TCX",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/TCX.php#L52-L78 |
dragosprotung/stc-core | src/Workout/Dumper/TCX.php | TCX.writeTrackPoints | private function writeTrackPoints(\XMLWriter $xmlWriter, array $trackPoints)
{
$previousTrackPoint = null;
foreach ($trackPoints as $trackPoint) {
$xmlWriter->startElement('Trackpoint');
// Time of position
$dateTime = clone $trackPoint->dateTime();
$... | php | private function writeTrackPoints(\XMLWriter $xmlWriter, array $trackPoints)
{
$previousTrackPoint = null;
foreach ($trackPoints as $trackPoint) {
$xmlWriter->startElement('Trackpoint');
// Time of position
$dateTime = clone $trackPoint->dateTime();
$... | [
"private",
"function",
"writeTrackPoints",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
",",
"array",
"$",
"trackPoints",
")",
"{",
"$",
"previousTrackPoint",
"=",
"null",
";",
"foreach",
"(",
"$",
"trackPoints",
"as",
"$",
"trackPoint",
")",
"{",
"$",
"xmlWrit... | Write the track points to the TCX.
@param \XMLWriter $xmlWriter The XML writer.
@param TrackPoint[] $trackPoints The track points to write. | [
"Write",
"the",
"track",
"points",
"to",
"the",
"TCX",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/TCX.php#L86-L120 |
dragosprotung/stc-core | src/Workout/Dumper/TCX.php | TCX.writeLapHeartRateDate | protected function writeLapHeartRateDate(\XMLWriter $xmlWriter, Track $track)
{
$averageHeartRate = array();
$maxHearRate = null;
foreach ($track->trackPoints() as $trackPoint) {
if ($trackPoint->hasExtension(HR::ID()) === true) {
$pointHearRate = $trackPoint->ext... | php | protected function writeLapHeartRateDate(\XMLWriter $xmlWriter, Track $track)
{
$averageHeartRate = array();
$maxHearRate = null;
foreach ($track->trackPoints() as $trackPoint) {
if ($trackPoint->hasExtension(HR::ID()) === true) {
$pointHearRate = $trackPoint->ext... | [
"protected",
"function",
"writeLapHeartRateDate",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
",",
"Track",
"$",
"track",
")",
"{",
"$",
"averageHeartRate",
"=",
"array",
"(",
")",
";",
"$",
"maxHearRate",
"=",
"null",
";",
"foreach",
"(",
"$",
"track",
"->"... | Write the heart rate data for a lap.
@param \XMLWriter $xmlWriter The XML writer.
@param Track $track The track to write. | [
"Write",
"the",
"heart",
"rate",
"data",
"for",
"a",
"lap",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/TCX.php#L128-L155 |
dragosprotung/stc-core | src/Workout/Dumper/TCX.php | TCX.writeExtensions | protected function writeExtensions(\XMLWriter $xmlWriter, array $extensions)
{
foreach ($extensions as $extension) {
switch ($extension::ID()) {
case HR::ID():
$xmlWriter->startElement('HeartRateBpm');
$xmlWriter->writeElement('Value', (str... | php | protected function writeExtensions(\XMLWriter $xmlWriter, array $extensions)
{
foreach ($extensions as $extension) {
switch ($extension::ID()) {
case HR::ID():
$xmlWriter->startElement('HeartRateBpm');
$xmlWriter->writeElement('Value', (str... | [
"protected",
"function",
"writeExtensions",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
",",
"array",
"$",
"extensions",
")",
"{",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"extension",
")",
"{",
"switch",
"(",
"$",
"extension",
"::",
"ID",
"(",
")",
"... | Write the extensions into the TCX.
@param \XMLWriter $xmlWriter The XMLWriter.
@param ExtensionInterface[] $extensions The extensions to write. | [
"Write",
"the",
"extensions",
"into",
"the",
"TCX",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/TCX.php#L163-L174 |
tequila/mongodb-php-lib | src/Write/Model/InsertMany.php | InsertMany.writeToBulk | public function writeToBulk(BulkWrite $bulk)
{
foreach ($this->documents as $document) {
$bulk->insert($document);
}
} | php | public function writeToBulk(BulkWrite $bulk)
{
foreach ($this->documents as $document) {
$bulk->insert($document);
}
} | [
"public",
"function",
"writeToBulk",
"(",
"BulkWrite",
"$",
"bulk",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"documents",
"as",
"$",
"document",
")",
"{",
"$",
"bulk",
"->",
"insert",
"(",
"$",
"document",
")",
";",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Write/Model/InsertMany.php#L52-L57 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Storer/FileStorer.php | FileStorer.add | public function add($data, Resource $resource)
{
file_put_contents($this->getFilename($resource), serialize($data));
} | php | public function add($data, Resource $resource)
{
file_put_contents($this->getFilename($resource), serialize($data));
} | [
"public",
"function",
"add",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"file_put_contents",
"(",
"$",
"this",
"->",
"getFilename",
"(",
"$",
"resource",
")",
",",
"serialize",
"(",
"$",
"data",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Storer/FileStorer.php#L25-L28 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Storer/FileStorer.php | FileStorer.get | public function get(Resource $resource)
{
$file = $this->getFilename($resource);
return unserialize(file_get_contents($file));
} | php | public function get(Resource $resource)
{
$file = $this->getFilename($resource);
return unserialize(file_get_contents($file));
} | [
"public",
"function",
"get",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFilename",
"(",
"$",
"resource",
")",
";",
"return",
"unserialize",
"(",
"file_get_contents",
"(",
"$",
"file",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Storer/FileStorer.php#L43-L48 |
e0ipso/drupal-unit-autoload | src/TokenResolver.php | TokenResolver.resolve | public function resolve() {
// If the path is not tokenized, then return the NULL discovery object.
if (file_exists($this->path)) {
return new Discovery\PathFinderNull(array($this->path));
}
if (!$this->getToken()) {
return NULL;
}
// Get the name of the class of the PathFinder depen... | php | public function resolve() {
// If the path is not tokenized, then return the NULL discovery object.
if (file_exists($this->path)) {
return new Discovery\PathFinderNull(array($this->path));
}
if (!$this->getToken()) {
return NULL;
}
// Get the name of the class of the PathFinder depen... | [
"public",
"function",
"resolve",
"(",
")",
"{",
"// If the path is not tokenized, then return the NULL discovery object.",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"return",
"new",
"Discovery",
"\\",
"PathFinderNull",
"(",
"array",
"(... | {@inheritdoc} | [
"{"
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/TokenResolver.php#L45-L62 |
e0ipso/drupal-unit-autoload | src/TokenResolver.php | TokenResolver.trimPath | public function trimPath() {
if (!$token = $this->getToken()) {
return $this->path;
}
$pos = strpos($this->path, $token);
return substr($this->path, $pos);
} | php | public function trimPath() {
if (!$token = $this->getToken()) {
return $this->path;
}
$pos = strpos($this->path, $token);
return substr($this->path, $pos);
} | [
"public",
"function",
"trimPath",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"token",
"=",
"$",
"this",
"->",
"getToken",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"path",
";",
"}",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"this",
"->",
"path",
","... | {@inheritdoc} | [
"{"
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/TokenResolver.php#L74-L80 |
e0ipso/drupal-unit-autoload | src/TokenResolver.php | TokenResolver.cleanToken | protected function cleanToken() {
if ($token_name = $this->getToken()) {
// Remove the token and arguments and return the path.
$path = substr($this->path, strlen($token_name));
return preg_replace('/<.*>/', '', $path);
}
$message = sprintf('No token could be found in "%s". Available token... | php | protected function cleanToken() {
if ($token_name = $this->getToken()) {
// Remove the token and arguments and return the path.
$path = substr($this->path, strlen($token_name));
return preg_replace('/<.*>/', '', $path);
}
$message = sprintf('No token could be found in "%s". Available token... | [
"protected",
"function",
"cleanToken",
"(",
")",
"{",
"if",
"(",
"$",
"token_name",
"=",
"$",
"this",
"->",
"getToken",
"(",
")",
")",
"{",
"// Remove the token and arguments and return the path.",
"$",
"path",
"=",
"substr",
"(",
"$",
"this",
"->",
"path",
... | Removes the token from the tokenized path.
@throws ClassLoaderException
If no token can be found.
@return string
The cleaned path. | [
"Removes",
"the",
"token",
"from",
"the",
"tokenized",
"path",
"."
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/TokenResolver.php#L91-L99 |
e0ipso/drupal-unit-autoload | src/TokenResolver.php | TokenResolver.getToken | protected function getToken() {
// Iterate over the supported tokens to find the token in the tokenized
// path.
foreach (array_keys($this->supportedTokens) as $token_name) {
if (strpos($this->path, $token_name) !== FALSE) {
return $token_name;
}
}
return NULL;
} | php | protected function getToken() {
// Iterate over the supported tokens to find the token in the tokenized
// path.
foreach (array_keys($this->supportedTokens) as $token_name) {
if (strpos($this->path, $token_name) !== FALSE) {
return $token_name;
}
}
return NULL;
} | [
"protected",
"function",
"getToken",
"(",
")",
"{",
"// Iterate over the supported tokens to find the token in the tokenized",
"// path.",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"supportedTokens",
")",
"as",
"$",
"token_name",
")",
"{",
"if",
"(",
"strp... | Checks if the current tokenized path contains a known token.
@return string
The token found. NULL otherwise. | [
"Checks",
"if",
"the",
"current",
"tokenized",
"path",
"contains",
"a",
"known",
"token",
"."
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/TokenResolver.php#L107-L116 |
e0ipso/drupal-unit-autoload | src/TokenResolver.php | TokenResolver.parseArguments | protected function parseArguments() {
$token_name = $this->getToken();
$delimiter = '/';
$matches = array();
if (preg_match($delimiter . preg_quote($token_name) . '<(.+)>.*' . $delimiter, $this->path, $matches)) {
// Some arguments were found.
return explode(',', $matches[1]);
}
retu... | php | protected function parseArguments() {
$token_name = $this->getToken();
$delimiter = '/';
$matches = array();
if (preg_match($delimiter . preg_quote($token_name) . '<(.+)>.*' . $delimiter, $this->path, $matches)) {
// Some arguments were found.
return explode(',', $matches[1]);
}
retu... | [
"protected",
"function",
"parseArguments",
"(",
")",
"{",
"$",
"token_name",
"=",
"$",
"this",
"->",
"getToken",
"(",
")",
";",
"$",
"delimiter",
"=",
"'/'",
";",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"$",
"delimi... | Gets the arguments in the token.
@return string[]
A numeric array containing the token arguments. | [
"Gets",
"the",
"arguments",
"in",
"the",
"token",
"."
] | train | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/TokenResolver.php#L135-L144 |
stubbles/stubbles-webapp-core | src/main/php/routing/Route.php | Route.arrayFrom | private function arrayFrom($requestMethod): array
{
if (is_string($requestMethod)) {
return [$requestMethod];
}
if (null === $requestMethod) {
return [Http::GET, Http::HEAD, Http::POST, Http::PUT, Http::DELETE];
}
if (is_array($requestMethod)) {
... | php | private function arrayFrom($requestMethod): array
{
if (is_string($requestMethod)) {
return [$requestMethod];
}
if (null === $requestMethod) {
return [Http::GET, Http::HEAD, Http::POST, Http::PUT, Http::DELETE];
}
if (is_array($requestMethod)) {
... | [
"private",
"function",
"arrayFrom",
"(",
"$",
"requestMethod",
")",
":",
"array",
"{",
"if",
"(",
"is_string",
"(",
"$",
"requestMethod",
")",
")",
"{",
"return",
"[",
"$",
"requestMethod",
"]",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"requestMethod",
... | turns given value into a list
@param string|string[] $requestMethod
@return string[]
@throws \InvalidArgumentException | [
"turns",
"given",
"value",
"into",
"a",
"list"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Route.php#L135-L153 |
stubbles/stubbles-webapp-core | src/main/php/routing/Route.php | Route.matches | public function matches(CalledUri $calledUri): bool
{
if (!$this->matchesPath($calledUri)) {
return false;
}
if (in_array($calledUri->method(), $this->allowedRequestMethods)) {
return true;
}
if (in_array(Http::GET, $this->allowedRequestMethods)) {
... | php | public function matches(CalledUri $calledUri): bool
{
if (!$this->matchesPath($calledUri)) {
return false;
}
if (in_array($calledUri->method(), $this->allowedRequestMethods)) {
return true;
}
if (in_array(Http::GET, $this->allowedRequestMethods)) {
... | [
"public",
"function",
"matches",
"(",
"CalledUri",
"$",
"calledUri",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"matchesPath",
"(",
"$",
"calledUri",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"in_array",
"(",
"$",
"calledU... | checks if this route is applicable for given request
@param \stubbles\webapp\CalledUri $calledUri current request uri
@return bool | [
"checks",
"if",
"this",
"route",
"is",
"applicable",
"for",
"given",
"request"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Route.php#L171-L186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.