id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
200,000 | ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents.php | HTMLServerComponents.addTag | public function addTag(string $tagName, string $src): self
{
$this->tagNames[$tagName] = $src;
return $this;
} | php | public function addTag(string $tagName, string $src): self
{
$this->tagNames[$tagName] = $src;
return $this;
} | [
"public",
"function",
"addTag",
"(",
"string",
"$",
"tagName",
",",
"string",
"$",
"src",
")",
":",
"self",
"{",
"$",
"this",
"->",
"tagNames",
"[",
"$",
"tagName",
"]",
"=",
"$",
"src",
";",
"return",
"$",
"this",
";",
"}"
] | Defines a new tag
@param string $tagName The alias
@param string $src The original source name
@return IvoPetkov\BearFramework\Addons\HTMLServerComponents Instance of itself. | [
"Defines",
"a",
"new",
"tag"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents.php#L64-L68 |
200,001 | ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents.php | HTMLServerComponents.make | public function make()
{
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
return clone(self::$newComponentCache);
} | php | public function make()
{
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
return clone(self::$newComponentCache);
} | [
"public",
"function",
"make",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"newComponentCache",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"newComponentCache",
"=",
"new",
"\\",
"IvoPetkov",
"\\",
"BearFramework",
"\\",
"Addons",
"\\",
"HTMLServerComponents... | Creates new component and return it
@return \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component | [
"Creates",
"new",
"component",
"and",
"return",
"it"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents.php#L114-L120 |
200,002 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createCreateForm | private function createCreateForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_create'),
'method' => 'POS... | php | private function createCreateForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_create'),
'method' => 'POS... | [
"private",
"function",
"createCreateForm",
"(",
"Country",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CountryType",
"(",
"$",
"this",
"->",
"get",
"(",
"'doctrine.orm.entity_manager'",
")",
"->",
"getRepository",
... | Creates a form to create a Country entity.
@param Country $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L74-L84 |
200,003 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.newAction | public function newAction()
{
$entity = new Country();
$form = $this->createCreateForm($entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | php | public function newAction()
{
$entity = new Country();
$form = $this->createCreateForm($entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"entity",
"=",
"new",
"Country",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"entity",
")",
";",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"entity",
","... | Displays a form to create a new Country entity.
@Route("/new", name="orkestro_backend_country_new")
@Method("GET")
@Template() | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L93-L102 |
200,004 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.showAction | public function showAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | php | public function showAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | [
"public",
"function",
"showAction",
"(",
"$",
"iso_code",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'OrkestroCountryBundle:Country'",... | Finds and displays a Country entity.
@Route("/{iso_code}", name="orkestro_backend_country_show")
@Method("GET")
@Template() | [
"Finds",
"and",
"displays",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L111-L129 |
200,005 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.editAction | public function editAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | php | public function editAction($iso_code)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OrkestroCountryBundle:Country')->findOneBy(array(
'isoCode' => $iso_code,
));
if (!$entity) {
throw $this->createNotFoundException('Unable... | [
"public",
"function",
"editAction",
"(",
"$",
"iso_code",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'OrkestroCountryBundle:Country'",... | Displays a form to edit an existing Country entity.
@Route("/{iso_code}/edit", name="orkestro_backend_country_edit")
@Method("GET")
@Template() | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L138-L158 |
200,006 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createEditForm | private function createEditForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->ge... | php | private function createEditForm(Country $entity)
{
$form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->ge... | [
"private",
"function",
"createEditForm",
"(",
"Country",
"$",
"entity",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CountryType",
"(",
"$",
"this",
"->",
"get",
"(",
"'doctrine.orm.entity_manager'",
")",
"->",
"getRepository",
"... | Creates a form to edit a Country entity.
@param Country $entity The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"Country",
"entity",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L167-L177 |
200,007 | Orkestro/CountryBundle | Controller/Backend/CountryController.php | CountryController.createDeleteForm | private function createDeleteForm($iso_code)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('orkestro_backend_country_delete', array('iso_code' => $iso_code)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->ge... | php | private function createDeleteForm($iso_code)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('orkestro_backend_country_delete', array('iso_code' => $iso_code)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->ge... | [
"private",
"function",
"createDeleteForm",
"(",
"$",
"iso_code",
")",
"{",
"return",
"$",
"this",
"->",
"createFormBuilder",
"(",
")",
"->",
"setAction",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'orkestro_backend_country_delete'",
",",
"array",
"(",
"'iso_co... | Creates a form to delete a Country entity by iso code.
@param mixed $iso_code The entity iso code
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"delete",
"a",
"Country",
"entity",
"by",
"iso",
"code",
"."
] | fa4989b489791f156938062a0f197e10dc0b42ed | https://github.com/Orkestro/CountryBundle/blob/fa4989b489791f156938062a0f197e10dc0b42ed/Controller/Backend/CountryController.php#L250-L258 |
200,008 | Dhii/exception-helper-base | src/CreateOutOfBoundsExceptionCapableTrait.php | CreateOutOfBoundsExceptionCapableTrait._createOutOfBoundsException | protected function _createOutOfBoundsException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfBoundsException($message, $code, $previous, $argument);
} | php | protected function _createOutOfBoundsException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfBoundsException($message, $code, $previous, $argument);
} | [
"protected",
"function",
"_createOutOfBoundsException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"RootException",
"$",
"previous",
"=",
"null",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"return",
"new",
"OutOfBoundsException",
... | Creates a new Dhii Out Of Bounds exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@pa... | [
"Creates",
"a",
"new",
"Dhii",
"Out",
"Of",
"Bounds",
"exception",
"."
] | e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5 | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateOutOfBoundsExceptionCapableTrait.php#L27-L34 |
200,009 | modulusphp/support | Arr.php | Arr.replace_key | public static function replace_key(array $array, $oldKey, $newKey) : array
{
$newArray = array();
foreach ($array as $key => $value) {
if ($key == $oldKey) {
$newArray = array_merge($newArray, [$newKey => $value]);
} else {
$newArray = array_merge($newArray, [$key => $value]);
... | php | public static function replace_key(array $array, $oldKey, $newKey) : array
{
$newArray = array();
foreach ($array as $key => $value) {
if ($key == $oldKey) {
$newArray = array_merge($newArray, [$newKey => $value]);
} else {
$newArray = array_merge($newArray, [$key => $value]);
... | [
"public",
"static",
"function",
"replace_key",
"(",
"array",
"$",
"array",
",",
"$",
"oldKey",
",",
"$",
"newKey",
")",
":",
"array",
"{",
"$",
"newArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"val... | Replace array key
@param array $array
@param mixed $oldKey
@param mixed $newKey
@return array $newArray | [
"Replace",
"array",
"key"
] | b5c5b48dcbeb379e6cd1f29159dc8cdacef3adab | https://github.com/modulusphp/support/blob/b5c5b48dcbeb379e6cd1f29159dc8cdacef3adab/Arr.php#L31-L44 |
200,010 | SlaxWeb/Router | src/Route.php | Route.set | public function set(string $uri, int $method, callable $action, bool $default = false): self
{
if ((self::METHOD_ANY & $method) !== $method) {
throw new Exception\InvalidMethodException(
"Route does not contain a valid HTTP Method."
);
}
$this->uri = ... | php | public function set(string $uri, int $method, callable $action, bool $default = false): self
{
if ((self::METHOD_ANY & $method) !== $method) {
throw new Exception\InvalidMethodException(
"Route does not contain a valid HTTP Method."
);
}
$this->uri = ... | [
"public",
"function",
"set",
"(",
"string",
"$",
"uri",
",",
"int",
"$",
"method",
",",
"callable",
"$",
"action",
",",
"bool",
"$",
"default",
"=",
"false",
")",
":",
"self",
"{",
"if",
"(",
"(",
"self",
"::",
"METHOD_ANY",
"&",
"$",
"method",
")"... | Set Route data
Sets the retrieved data to internal properties. Prior to setting, the
method is checked, that it is valid, and raises an
'InvalidMethodException' on error.
@param string $uri Request URI regex without delimiter
@param int $method HTTP Request Method, accepts METHODO_* constant
@param callable $action R... | [
"Set",
"Route",
"data"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Route.php#L128-L148 |
200,011 | SlaxWeb/Router | src/Route.php | Route.set404Route | public function set404Route(callable $action): self
{
$this->uri = "404RouteNotFound";
$this->method = self::METHOD_ANY;
$this->action = $action;
$this->is404 = true;
return $this;
} | php | public function set404Route(callable $action): self
{
$this->uri = "404RouteNotFound";
$this->method = self::METHOD_ANY;
$this->action = $action;
$this->is404 = true;
return $this;
} | [
"public",
"function",
"set404Route",
"(",
"callable",
"$",
"action",
")",
":",
"self",
"{",
"$",
"this",
"->",
"uri",
"=",
"\"404RouteNotFound\"",
";",
"$",
"this",
"->",
"method",
"=",
"self",
"::",
"METHOD_ANY",
";",
"$",
"this",
"->",
"action",
"=",
... | Set 404 Route
Sets the '404NoRouteFound' Route to its properties. This Route is used by
the Dispatcher if it can not find a matching Route for its Request.
@param callable $action Route action
@return self | [
"Set",
"404",
"Route"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Route.php#L159-L167 |
200,012 | codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.iterate | protected function iterate($value, PropertyDefinitionInterface $definition = null)
{
if (empty($value) || !is_array($value)) {
return $value;
}
$type = $definition->getGenericType();
foreach ($value as $key => $item) {
if (is_null($item)) {
c... | php | protected function iterate($value, PropertyDefinitionInterface $definition = null)
{
if (empty($value) || !is_array($value)) {
return $value;
}
$type = $definition->getGenericType();
foreach ($value as $key => $item) {
if (is_null($item)) {
c... | [
"protected",
"function",
"iterate",
"(",
"$",
"value",
",",
"PropertyDefinitionInterface",
"$",
"definition",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
"||",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"va... | Attempte to iterate the value and cast all child items to the require generic type.
@param $value
@param PropertyDefinitionInterface $definition
@return array | [
"Attempte",
"to",
"iterate",
"the",
"value",
"and",
"cast",
"all",
"child",
"items",
"to",
"the",
"require",
"generic",
"type",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L106-L123 |
200,013 | codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.castValue | protected function castValue($value, $type)
{
if (isset($this->scalarMap[$type])) {
$cast = $this->castToScalar($value, $this->scalarMap[$type]);
return $cast == $value ? $cast : $value;
}
if (is_null($value)) {
return null;
}
if (!is_ar... | php | protected function castValue($value, $type)
{
if (isset($this->scalarMap[$type])) {
$cast = $this->castToScalar($value, $this->scalarMap[$type]);
return $cast == $value ? $cast : $value;
}
if (is_null($value)) {
return null;
}
if (!is_ar... | [
"protected",
"function",
"castValue",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"scalarMap",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"cast",
"=",
"$",
"this",
"->",
"castToScalar",
"(",
"$",
"va... | Cast a value to the desired type non-destructively.
@param mixed $value
@param string $type
@return mixed Cast value | [
"Cast",
"a",
"value",
"to",
"the",
"desired",
"type",
"non",
"-",
"destructively",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L133-L154 |
200,014 | codeblanche/Entity | src/Entity/Marshal/Typed.php | Typed.castToScalar | protected function castToScalar($value, $type)
{
if ($type === 'integer') {
return (integer) $value;
}
if ($type === 'boolean') {
return (boolean) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'st... | php | protected function castToScalar($value, $type)
{
if ($type === 'integer') {
return (integer) $value;
}
if ($type === 'boolean') {
return (boolean) $value;
}
if ($type === 'float') {
return (float) $value;
}
if ($type === 'st... | [
"protected",
"function",
"castToScalar",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"'integer'",
")",
"{",
"return",
"(",
"integer",
")",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"type",
"===",
"'boolean'",
")",
"{... | Cast a value to the desired scalar type. Value remains unchanged if type is not scalar.
@param mixed $value The value you went to cast
@param string $type The type you want to cast to
@return mixed | [
"Cast",
"a",
"value",
"to",
"the",
"desired",
"scalar",
"type",
".",
"Value",
"remains",
"unchanged",
"if",
"type",
"is",
"not",
"scalar",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Marshal/Typed.php#L164-L180 |
200,015 | TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/PluginManager.php | PluginManager.loadPlugins | public function loadPlugins($plugins)
{
foreach($plugins as $plugin) {
$pluginClass = str_replace(':','\\',$plugin);
$this->plugins[] = new $pluginClass($this->core);
}
} | php | public function loadPlugins($plugins)
{
foreach($plugins as $plugin) {
$pluginClass = str_replace(':','\\',$plugin);
$this->plugins[] = new $pluginClass($this->core);
}
} | [
"public",
"function",
"loadPlugins",
"(",
"$",
"plugins",
")",
"{",
"foreach",
"(",
"$",
"plugins",
"as",
"$",
"plugin",
")",
"{",
"$",
"pluginClass",
"=",
"str_replace",
"(",
"':'",
",",
"'\\\\'",
",",
"$",
"plugin",
")",
";",
"$",
"this",
"->",
"pl... | Load all plugins from an array
@param array $plugins The array containing the plugins to load | [
"Load",
"all",
"plugins",
"from",
"an",
"array"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/PluginManager.php#L28-L35 |
200,016 | TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/PluginManager.php | PluginManager.invokePluginHook | public function invokePluginHook($hookName)
{
$args = func_get_args();
array_shift($args);
foreach($this->plugins as $plugin) {
if(method_exists($plugin, $hookName) === false)
continue;
call_user_func_array(array($plugin, $hookName), $args);
}
} | php | public function invokePluginHook($hookName)
{
$args = func_get_args();
array_shift($args);
foreach($this->plugins as $plugin) {
if(method_exists($plugin, $hookName) === false)
continue;
call_user_func_array(array($plugin, $hookName), $args);
}
} | [
"public",
"function",
"invokePluginHook",
"(",
"$",
"hookName",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"args",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"plugins",
"as",
"$",
"plugin",
")",
"{",
"if",
... | Invokes a specific plugin hook
@param string $hookName The name of the hook to invoke
@param mixed $parameter,... Parameters for the hook | [
"Invokes",
"a",
"specific",
"plugin",
"hook"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/PluginManager.php#L43-L54 |
200,017 | Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Model/LazyPropertiesTrait.php | LazyPropertiesTrait.load | protected function load($field)
{
if (!is_null($this->$field)
|| !$this->delegatesCollection
|| !$this->delegatesCollection->containsKey($key = strtolower($field))
) {
return $this->$field;
}
$loader = $this->delegatesCollection->get($key);
... | php | protected function load($field)
{
if (!is_null($this->$field)
|| !$this->delegatesCollection
|| !$this->delegatesCollection->containsKey($key = strtolower($field))
) {
return $this->$field;
}
$loader = $this->delegatesCollection->get($key);
... | [
"protected",
"function",
"load",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"$",
"field",
")",
"||",
"!",
"$",
"this",
"->",
"delegatesCollection",
"||",
"!",
"$",
"this",
"->",
"delegatesCollection",
"->",
"contain... | Load given field if able to, define his value and return it.
@example
public function getRelatedEntity()
{
return $this->load('relatedEntity');
}
@param string $field
@return mixed|null field value if retrieved | [
"Load",
"given",
"field",
"if",
"able",
"to",
"define",
"his",
"value",
"and",
"return",
"it",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Model/LazyPropertiesTrait.php#L50-L63 |
200,018 | eureka-framework/component-controller | src/Controller/Controller.php | Controller.setMetas | protected function setMetas($title = null, $description = null)
{
$meta = Config::getInstance()->get('Eureka\Global\Meta');
if ($title !== null) {
$meta['title'] = strip_tags($title . ' - ' . $meta['title']);
}
if ($description !== null) {
$meta['description... | php | protected function setMetas($title = null, $description = null)
{
$meta = Config::getInstance()->get('Eureka\Global\Meta');
if ($title !== null) {
$meta['title'] = strip_tags($title . ' - ' . $meta['title']);
}
if ($description !== null) {
$meta['description... | [
"protected",
"function",
"setMetas",
"(",
"$",
"title",
"=",
"null",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"meta",
"=",
"Config",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"'Eureka\\Global\\Meta'",
")",
";",
"if",
"(",
"$",
"title... | Override meta description with given description.
@param string $description
@return $this | [
"Override",
"meta",
"description",
"with",
"given",
"description",
"."
] | 368efb6fb9eece4f7f69233e6190e1fdbb0ace2c | https://github.com/eureka-framework/component-controller/blob/368efb6fb9eece4f7f69233e6190e1fdbb0ace2c/src/Controller/Controller.php#L207-L222 |
200,019 | stubbles/stubbles-peer | src/main/php/http/Http.php | Http.statusClassFor | public static function statusClassFor(int $statusCode): string
{
$class = substr((string) $statusCode, 0, 1);
return self::$statusClass[$class] ?? self::STATUS_CLASS_UNKNOWN;
} | php | public static function statusClassFor(int $statusCode): string
{
$class = substr((string) $statusCode, 0, 1);
return self::$statusClass[$class] ?? self::STATUS_CLASS_UNKNOWN;
} | [
"public",
"static",
"function",
"statusClassFor",
"(",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"$",
"class",
"=",
"substr",
"(",
"(",
"string",
")",
"$",
"statusCode",
",",
"0",
",",
"1",
")",
";",
"return",
"self",
"::",
"$",
"statusClass",... | returns status class for given status code
Returns null if given status code is empty.
@api
@param int $statusCode
@return string
@since 4.0.0 | [
"returns",
"status",
"class",
"for",
"given",
"status",
"code"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L191-L195 |
200,020 | stubbles/stubbles-peer | src/main/php/http/Http.php | Http.reasonPhraseFor | public static function reasonPhraseFor(int $statusCode): string
{
if (isset(self::$reasonPhrases[$statusCode])) {
return self::$reasonPhrases[$statusCode];
}
throw new \InvalidArgumentException(
'Invalid or unknown HTTP status code ' . $statusCode
);
... | php | public static function reasonPhraseFor(int $statusCode): string
{
if (isset(self::$reasonPhrases[$statusCode])) {
return self::$reasonPhrases[$statusCode];
}
throw new \InvalidArgumentException(
'Invalid or unknown HTTP status code ' . $statusCode
);
... | [
"public",
"static",
"function",
"reasonPhraseFor",
"(",
"int",
"$",
"statusCode",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"reasonPhrases",
"[",
"$",
"statusCode",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"reasonPhrase... | returns reason phrase for given status code
@api
@param int $statusCode
@return string
@throws \InvalidArgumentException
@since 4.0.0 | [
"returns",
"reason",
"phrase",
"for",
"given",
"status",
"code"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L218-L227 |
200,021 | stubbles/stubbles-peer | src/main/php/http/Http.php | Http.lines | public static function lines(string ...$lines): string
{
$head = true;
return join(
'',
array_map(
function($line) use (&$head)
{
if (empty($line) && $head) {
$... | php | public static function lines(string ...$lines): string
{
$head = true;
return join(
'',
array_map(
function($line) use (&$head)
{
if (empty($line) && $head) {
$... | [
"public",
"static",
"function",
"lines",
"(",
"string",
"...",
"$",
"lines",
")",
":",
"string",
"{",
"$",
"head",
"=",
"true",
";",
"return",
"join",
"(",
"''",
",",
"array_map",
"(",
"function",
"(",
"$",
"line",
")",
"use",
"(",
"&",
"$",
"head"... | creates valid http lines from given input lines
If the array contains an empty line all lines after this empty line are
considered to belong to the body and will be returned as they are.
@param string[] $lines
@return string
@since 4.0.0 | [
"creates",
"valid",
"http",
"lines",
"from",
"given",
"input",
"lines"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L250-L272 |
200,022 | stubbles/stubbles-peer | src/main/php/http/Http.php | Http.isValidRfc | public static function isValidRfc(string $rfc): bool
{
return in_array($rfc, [self::RFC_2616, self::RFC_7230]);
} | php | public static function isValidRfc(string $rfc): bool
{
return in_array($rfc, [self::RFC_2616, self::RFC_7230]);
} | [
"public",
"static",
"function",
"isValidRfc",
"(",
"string",
"$",
"rfc",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"$",
"rfc",
",",
"[",
"self",
"::",
"RFC_2616",
",",
"self",
"::",
"RFC_7230",
"]",
")",
";",
"}"
] | checks if given RFC is a valid and known RFC
@param string $rfc
@return bool | [
"checks",
"if",
"given",
"RFC",
"is",
"a",
"valid",
"and",
"known",
"RFC"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/Http.php#L290-L293 |
200,023 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.toModel | public function toModel()
{
$nodeClass = $this->getElement()->NodeClass;
if ($nodeClass === 'Node') {
throw new LogicException('You must set a custom node in <node_class/> for element: ' . $this->getElement()->getSlug());
} else {
throw new LogicException('You must cr... | php | public function toModel()
{
$nodeClass = $this->getElement()->NodeClass;
if ($nodeClass === 'Node') {
throw new LogicException('You must set a custom node in <node_class/> for element: ' . $this->getElement()->getSlug());
} else {
throw new LogicException('You must cr... | [
"public",
"function",
"toModel",
"(",
")",
"{",
"$",
"nodeClass",
"=",
"$",
"this",
"->",
"getElement",
"(",
")",
"->",
"NodeClass",
";",
"if",
"(",
"$",
"nodeClass",
"===",
"'Node'",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'You must set a custom... | You must implement a toModel method in a subclass of Node, defined in
a plugin.xml or system.xml in order to have toModel functionality.
@return mixed
@throws LogicException | [
"You",
"must",
"implement",
"a",
"toModel",
"method",
"in",
"a",
"subclass",
"of",
"Node",
"defined",
"in",
"a",
"plugin",
".",
"xml",
"or",
"system",
".",
"xml",
"in",
"order",
"to",
"have",
"toModel",
"functionality",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L71-L79 |
200,024 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.setNodeRef | public function setNodeRef($newNodeRef)
{
$this->fields['NodeRef'] = $newNodeRef;
$this->fields['Slug'] = $newNodeRef->isFullyQualified()?$newNodeRef->getSlug():'';
} | php | public function setNodeRef($newNodeRef)
{
$this->fields['NodeRef'] = $newNodeRef;
$this->fields['Slug'] = $newNodeRef->isFullyQualified()?$newNodeRef->getSlug():'';
} | [
"public",
"function",
"setNodeRef",
"(",
"$",
"newNodeRef",
")",
"{",
"$",
"this",
"->",
"fields",
"[",
"'NodeRef'",
"]",
"=",
"$",
"newNodeRef",
";",
"$",
"this",
"->",
"fields",
"[",
"'Slug'",
"]",
"=",
"$",
"newNodeRef",
"->",
"isFullyQualified",
"(",... | Changes our NodeRef
@param NodeRef $newNodeRef | [
"Changes",
"our",
"NodeRef"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L96-L100 |
200,025 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.setSlug | public function setSlug($slug)
{
if(empty($this->fields['Slug']) || empty($this->fields['OriginalSlug']))
{
$this->fields['NodeRef'] = new NodeRef($this->getNodeRef()->getElement(), $slug);
}
$this->fields['Slug'] = $slug;
} | php | public function setSlug($slug)
{
if(empty($this->fields['Slug']) || empty($this->fields['OriginalSlug']))
{
$this->fields['NodeRef'] = new NodeRef($this->getNodeRef()->getElement(), $slug);
}
$this->fields['Slug'] = $slug;
} | [
"public",
"function",
"setSlug",
"(",
"$",
"slug",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"fields",
"[",
"'Slug'",
"]",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"fields",
"[",
"'OriginalSlug'",
"]",
")",
")",
"{",
"$",
"this",
"... | Sets the Slug
@param string $slug A valid
@return void | [
"Sets",
"the",
"Slug"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L177-L185 |
200,026 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/model/Node.php | Node.getNodePartials | public function getNodePartials()
{
if(!array_key_exists('NodePartials', $this->fields) || is_null($this->fields['NodePartials']))
$this->fields['NodePartials'] = new NodePartials();
return $this->fields['NodePartials'];
} | php | public function getNodePartials()
{
if(!array_key_exists('NodePartials', $this->fields) || is_null($this->fields['NodePartials']))
$this->fields['NodePartials'] = new NodePartials();
return $this->fields['NodePartials'];
} | [
"public",
"function",
"getNodePartials",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'NodePartials'",
",",
"$",
"this",
"->",
"fields",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"fields",
"[",
"'NodePartials'",
"]",
")",
")",
"$",
"this"... | Returns a reference to the partials for this node.
@return NodePartials | [
"Returns",
"a",
"reference",
"to",
"the",
"partials",
"for",
"this",
"node",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/model/Node.php#L555-L561 |
200,027 | jenskooij/cloudcontrol | src/cc/application/UrlMatcher.php | UrlMatcher.redirectMatching | public function redirectMatching(Request $request)
{
$redirects = $this->storage->getRedirects()->getRedirects();
$relativeUri = '/' . $request::$relativeUri;
foreach ($redirects as $redirect) {
if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
$t... | php | public function redirectMatching(Request $request)
{
$redirects = $this->storage->getRedirects()->getRedirects();
$relativeUri = '/' . $request::$relativeUri;
foreach ($redirects as $redirect) {
if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
$t... | [
"public",
"function",
"redirectMatching",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"redirects",
"=",
"$",
"this",
"->",
"storage",
"->",
"getRedirects",
"(",
")",
"->",
"getRedirects",
"(",
")",
";",
"$",
"relativeUri",
"=",
"'/'",
".",
"$",
"reque... | Loop through the redirects and see if a redirect needs to take place
@param Request $request
@throws \Exception | [
"Loop",
"through",
"the",
"redirects",
"and",
"see",
"if",
"a",
"redirect",
"needs",
"to",
"take",
"place"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/UrlMatcher.php#L36-L59 |
200,028 | jenskooij/cloudcontrol | src/cc/application/UrlMatcher.php | UrlMatcher.sitemapMatching | public function sitemapMatching($request)
{
$sitemap = $this->storage->getSitemap()->getSitemap();
$relativeUri = '/' . $request::$relativeUri;
foreach ($sitemap as $sitemapItem) {
if ($sitemapItem->regex) {
$matches = array();
if (preg_match_all(... | php | public function sitemapMatching($request)
{
$sitemap = $this->storage->getSitemap()->getSitemap();
$relativeUri = '/' . $request::$relativeUri;
foreach ($sitemap as $sitemapItem) {
if ($sitemapItem->regex) {
$matches = array();
if (preg_match_all(... | [
"public",
"function",
"sitemapMatching",
"(",
"$",
"request",
")",
"{",
"$",
"sitemap",
"=",
"$",
"this",
"->",
"storage",
"->",
"getSitemap",
"(",
")",
"->",
"getSitemap",
"(",
")",
";",
"$",
"relativeUri",
"=",
"'/'",
".",
"$",
"request",
"::",
"$",
... | Loop through sitemap items and see if one matches the requestUri.
If it does, add it tot the matchedSitemapItems array
@param Request $request | [
"Loop",
"through",
"sitemap",
"items",
"and",
"see",
"if",
"one",
"matches",
"the",
"requestUri",
".",
"If",
"it",
"does",
"add",
"it",
"tot",
"the",
"matchedSitemapItems",
"array"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/UrlMatcher.php#L67-L89 |
200,029 | SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.connect | public function connect($host, $port, $secure = true)
{
$this->socket->setBlocking(false);
if (!$this->socket->connect($host, $port, $secure)) {
throw new Exception\ConnectionFailedException(
sprintf(
'%s failed to %s:%d with error %s (%d).',
... | php | public function connect($host, $port, $secure = true)
{
$this->socket->setBlocking(false);
if (!$this->socket->connect($host, $port, $secure)) {
throw new Exception\ConnectionFailedException(
sprintf(
'%s failed to %s:%d with error %s (%d).',
... | [
"public",
"function",
"connect",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"secure",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"socket",
"->",
"setBlocking",
"(",
"false",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"socket",
"->",
"connect",
... | Set up a connection to the server.
@param string $host
@param integer $port
@param boolean $secure
@return void | [
"Set",
"up",
"a",
"connection",
"to",
"the",
"server",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L69-L85 |
200,030 | SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.read | protected function read()
{
$data = '';
// TODO Invesigate if a time out is required
do {
if ($this->socket->closed()) {
throw new Exception\ConnectionDroppedException('The connection has been dropped.');
}
$data .= $this->socket->read();... | php | protected function read()
{
$data = '';
// TODO Invesigate if a time out is required
do {
if ($this->socket->closed()) {
throw new Exception\ConnectionDroppedException('The connection has been dropped.');
}
$data .= $this->socket->read();... | [
"protected",
"function",
"read",
"(",
")",
"{",
"$",
"data",
"=",
"''",
";",
"// TODO Invesigate if a time out is required",
"do",
"{",
"if",
"(",
"$",
"this",
"->",
"socket",
"->",
"closed",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"Connecti... | Retrieve a response from the server.
@return string
@throws ConnectionDroppedException
@todo Always UTF8 decode? | [
"Retrieve",
"a",
"response",
"from",
"the",
"server",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L106-L120 |
200,031 | SCLInternet/SclRequestResponse | src/SclRequestResponse/Communicator/PersistentCommunicator.php | PersistentCommunicator.getResponse | public function getResponse(RequestInterface $request)
{
$this->write($request->getPacket());
return $request->getResponse()->init($this->read());
} | php | public function getResponse(RequestInterface $request)
{
$this->write($request->getPacket());
return $request->getResponse()->init($this->read());
} | [
"public",
"function",
"getResponse",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"write",
"(",
"$",
"request",
"->",
"getPacket",
"(",
")",
")",
";",
"return",
"$",
"request",
"->",
"getResponse",
"(",
")",
"->",
"init",
"(",
... | Send a request to the server and construct an appropriate response.
@param RequestInterface $request
@return ResponseInterface | [
"Send",
"a",
"request",
"to",
"the",
"server",
"and",
"construct",
"an",
"appropriate",
"response",
"."
] | 40e5e24288c70be6c7e4e54992069aba969f562c | https://github.com/SCLInternet/SclRequestResponse/blob/40e5e24288c70be6c7e4e54992069aba969f562c/src/SclRequestResponse/Communicator/PersistentCommunicator.php#L129-L134 |
200,032 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.setTransactionMethod | public function setTransactionMethod($method)
{
// check if is array
if (!is_array($this->transactionMethods)) {
$this->transactionMethods = [$method];
return $this;
}
// check if method is already in array
if (!in_array($method, $this->transactionMe... | php | public function setTransactionMethod($method)
{
// check if is array
if (!is_array($this->transactionMethods)) {
$this->transactionMethods = [$method];
return $this;
}
// check if method is already in array
if (!in_array($method, $this->transactionMe... | [
"public",
"function",
"setTransactionMethod",
"(",
"$",
"method",
")",
"{",
"// check if is array",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"transactionMethods",
")",
")",
"{",
"$",
"this",
"->",
"transactionMethods",
"=",
"[",
"$",
"method",
"]"... | Set transaction method.
@param string $method - method name
@return $this | [
"Set",
"transaction",
"method",
"."
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L133-L148 |
200,033 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.removeTransactionMethod | public function removeTransactionMethod($method)
{
// if it's not an array, there are no transaction methods
if (!is_array($this->transactionMethods)) {
return $this;
}
// find method in transactionMethods
$index = array_search($method, $this->transaction... | php | public function removeTransactionMethod($method)
{
// if it's not an array, there are no transaction methods
if (!is_array($this->transactionMethods)) {
return $this;
}
// find method in transactionMethods
$index = array_search($method, $this->transaction... | [
"public",
"function",
"removeTransactionMethod",
"(",
"$",
"method",
")",
"{",
"// if it's not an array, there are no transaction methods",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"transactionMethods",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"/... | Remove transaction method.
@param string $method - method name
@return $this | [
"Remove",
"transaction",
"method",
"."
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L157-L179 |
200,034 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.proxy | protected function proxy($method, $args)
{
// logic before executing the method
//
$this->beforeProxy($method, $args);
// executing the domain method
$result = call_user_func_array(array($this, $method), $args);
// logic after executin the method
/... | php | protected function proxy($method, $args)
{
// logic before executing the method
//
$this->beforeProxy($method, $args);
// executing the domain method
$result = call_user_func_array(array($this, $method), $args);
// logic after executin the method
/... | [
"protected",
"function",
"proxy",
"(",
"$",
"method",
",",
"$",
"args",
")",
"{",
"// logic before executing the method",
"//",
"$",
"this",
"->",
"beforeProxy",
"(",
"$",
"method",
",",
"$",
"args",
")",
";",
"// executing the domain method",
"$",
"result",
"... | Proxy function through which domain methods will be called
This method should be overridden in extending classes
@param $method string - domain method name
@param $arg array - array of arguments for domain method
@return mixed | [
"Proxy",
"function",
"through",
"which",
"domain",
"methods",
"will",
"be",
"called",
"This",
"method",
"should",
"be",
"overridden",
"in",
"extending",
"classes"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L200-L217 |
200,035 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.beforeProxy | protected function beforeProxy($method, $args)
{
// if method is defined as transaction method
if (is_array($this->transactionMethods) && in_array($method, $this->transactionMethods)) {
// begin transaction
$this->db->beginTransaction();
}
} | php | protected function beforeProxy($method, $args)
{
// if method is defined as transaction method
if (is_array($this->transactionMethods) && in_array($method, $this->transactionMethods)) {
// begin transaction
$this->db->beginTransaction();
}
} | [
"protected",
"function",
"beforeProxy",
"(",
"$",
"method",
",",
"$",
"args",
")",
"{",
"// if method is defined as transaction method",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"transactionMethods",
")",
"&&",
"in_array",
"(",
"$",
"method",
",",
"$",
"... | Logic before proxy call to domain method
@param $method string - domain method name
@param $arg array - array of arguments for domain method
@return void | [
"Logic",
"before",
"proxy",
"call",
"to",
"domain",
"method"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L227-L234 |
200,036 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.afterProxy | protected function afterProxy($method, $args, $result)
{
// if method is defined as transaction method
if (is_array($this->transactionMethods) && in_array($method, $this->transactionMethods)) {
// commit transaction
$this->db->commit();
}
} | php | protected function afterProxy($method, $args, $result)
{
// if method is defined as transaction method
if (is_array($this->transactionMethods) && in_array($method, $this->transactionMethods)) {
// commit transaction
$this->db->commit();
}
} | [
"protected",
"function",
"afterProxy",
"(",
"$",
"method",
",",
"$",
"args",
",",
"$",
"result",
")",
"{",
"// if method is defined as transaction method",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"transactionMethods",
")",
"&&",
"in_array",
"(",
"$",
"m... | Logic after proxy call to domain method
@param $method string - domain method name
@param $arg array - array of arguments for domain method
@return void | [
"Logic",
"after",
"proxy",
"call",
"to",
"domain",
"method"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L244-L251 |
200,037 | congraphcms/core | Repositories/AbstractRepository.php | AbstractRepository.update | public function update($id, $model)
{
// arguments for private method
$args = func_get_args();
// proxy call
$result = $this->proxy('_update', $args);
// if($this->shouldUseCache())
// {
// // Cache::put($this->type . ':' . $result->id, $result, $this->cach... | php | public function update($id, $model)
{
// arguments for private method
$args = func_get_args();
// proxy call
$result = $this->proxy('_update', $args);
// if($this->shouldUseCache())
// {
// // Cache::put($this->type . ':' . $result->id, $result, $this->cach... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"model",
")",
"{",
"// arguments for private method",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"// proxy call",
"$",
"result",
"=",
"$",
"this",
"->",
"proxy",
"(",
"'_update'",
",",
"$",
... | DB UPDATE of object
@param $model string - data for object update
@return mixed | [
"DB",
"UPDATE",
"of",
"object"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/AbstractRepository.php#L284-L299 |
200,038 | lasallecms/lasallecms-l5-usermanagement-pkg | src/Http/Controllers/Frontendauth/FrontendAuthController.php | FrontendAuthController.post2FALogin | public function post2FALogin(Request $request) {
$userId = $request->session()->get('user_id');
// Did the user take too much time to fill out the form?
if ($this->twoFactorAuthHelper->isTwoFactorAuthFormTimeout($userId)) {
return view('usermanagement::frontend.'.$this->frontend_temp... | php | public function post2FALogin(Request $request) {
$userId = $request->session()->get('user_id');
// Did the user take too much time to fill out the form?
if ($this->twoFactorAuthHelper->isTwoFactorAuthFormTimeout($userId)) {
return view('usermanagement::frontend.'.$this->frontend_temp... | [
"public",
"function",
"post2FALogin",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"userId",
"=",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"get",
"(",
"'user_id'",
")",
";",
"// Did the user take too much time to fill out the form?",
"if",
"(",
"$",
... | Handle the front-end Two Factor Authorization login
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | [
"Handle",
"the",
"front",
"-",
"end",
"Two",
"Factor",
"Authorization",
"login"
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Http/Controllers/Frontendauth/FrontendAuthController.php#L307-L365 |
200,039 | xelax90/l2p-client | src/L2PClient/Client.php | Client.request | public function request($endpoint, $isPost = false, $params = array()){
$accessToken = $this->getAccessToken();
if($accessToken === null){
return null;
}
$params['accessToken'] = $accessToken->getAccessToken();
$url = $this->getConfig()->getApiUrl().$endpoint;
if(!$isPost){
$url .= '?'.http_build_quer... | php | public function request($endpoint, $isPost = false, $params = array()){
$accessToken = $this->getAccessToken();
if($accessToken === null){
return null;
}
$params['accessToken'] = $accessToken->getAccessToken();
$url = $this->getConfig()->getApiUrl().$endpoint;
if(!$isPost){
$url .= '?'.http_build_quer... | [
"public",
"function",
"request",
"(",
"$",
"endpoint",
",",
"$",
"isPost",
"=",
"false",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"getAccessToken",
"(",
")",
";",
"if",
"(",
"$",
"accessToken",... | Request an API endpoint with post or get method and given parameters. Returns null if no AccessToken is provided
@param string $endpoint
@param boolean $isPost
@param array $params
@return array|null | [
"Request",
"an",
"API",
"endpoint",
"with",
"post",
"or",
"get",
"method",
"and",
"given",
"parameters",
".",
"Returns",
"null",
"if",
"no",
"AccessToken",
"is",
"provided"
] | e4e53dfa1ee6e785acc4d3c632d3ebf70fe3d4fb | https://github.com/xelax90/l2p-client/blob/e4e53dfa1ee6e785acc4d3c632d3ebf70fe3d4fb/src/L2PClient/Client.php#L94-L118 |
200,040 | OliverMonneke/pennePHP | src/Filesystem/Directory.php | Directory.evaluateDirectory | private function evaluateDirectory($directory = null)
{
$directory = $this->setDirectoryFallback($directory);
/** @noinspection PhpAssignmentInConditionInspection */
$this->run($directory);
} | php | private function evaluateDirectory($directory = null)
{
$directory = $this->setDirectoryFallback($directory);
/** @noinspection PhpAssignmentInConditionInspection */
$this->run($directory);
} | [
"private",
"function",
"evaluateDirectory",
"(",
"$",
"directory",
"=",
"null",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
"setDirectoryFallback",
"(",
"$",
"directory",
")",
";",
"/** @noinspection PhpAssignmentInConditionInspection */",
"$",
"this",
"->",... | Walk through directory
@param string $directory Directory
@return void | [
"Walk",
"through",
"directory"
] | dd0de7944685a3f1947157e1254fc54b55ff9942 | https://github.com/OliverMonneke/pennePHP/blob/dd0de7944685a3f1947157e1254fc54b55ff9942/src/Filesystem/Directory.php#L82-L88 |
200,041 | yvoyer/collection | lib/Star/Component/Collection/IdentityCollection.php | IdentityCollection.remove | public function remove($key)
{
if ($key instanceof UniqueId) {
$key = $key->id();
}
return $this->elements->remove($key);
} | php | public function remove($key)
{
if ($key instanceof UniqueId) {
$key = $key->id();
}
return $this->elements->remove($key);
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"instanceof",
"UniqueId",
")",
"{",
"$",
"key",
"=",
"$",
"key",
"->",
"id",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"elements",
"->",
"remove",
"(",
"$",
... | Removes the element at the specified index from the collection.
@param string|integer $key The kex/index of the element to remove.
@return mixed The removed element or NULL, if the collection did not contain the element. | [
"Removes",
"the",
"element",
"at",
"the",
"specified",
"index",
"from",
"the",
"collection",
"."
] | 08babb9996bece44e01aaa4d3b244bf48139c3ea | https://github.com/yvoyer/collection/blob/08babb9996bece44e01aaa4d3b244bf48139c3ea/lib/Star/Component/Collection/IdentityCollection.php#L116-L123 |
200,042 | yvoyer/collection | lib/Star/Component/Collection/IdentityCollection.php | IdentityCollection.map | public function map(Closure $func)
{
return new static($this->type, $this->elements->map($func)->toArray());
} | php | public function map(Closure $func)
{
return new static($this->type, $this->elements->map($func)->toArray());
} | [
"public",
"function",
"map",
"(",
"Closure",
"$",
"func",
")",
"{",
"return",
"new",
"static",
"(",
"$",
"this",
"->",
"type",
",",
"$",
"this",
"->",
"elements",
"->",
"map",
"(",
"$",
"func",
")",
"->",
"toArray",
"(",
")",
")",
";",
"}"
] | Applies the given public function to each element in the collection and returns
a new collection with the elements returned by the public function.
@param Closure $func
@return Collection | [
"Applies",
"the",
"given",
"public",
"function",
"to",
"each",
"element",
"in",
"the",
"collection",
"and",
"returns",
"a",
"new",
"collection",
"with",
"the",
"elements",
"returned",
"by",
"the",
"public",
"function",
"."
] | 08babb9996bece44e01aaa4d3b244bf48139c3ea | https://github.com/yvoyer/collection/blob/08babb9996bece44e01aaa4d3b244bf48139c3ea/lib/Star/Component/Collection/IdentityCollection.php#L316-L319 |
200,043 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validate | public static function validate($data, $type, callable $filter=null) {
$type = strtoupper($type);
if ( !array_key_exists($type, self::$supported_types) ) {
throw new UnexpectedValueException("Bad validation type");
}
return call_user_func(self::$supported_types[$type], $da... | php | public static function validate($data, $type, callable $filter=null) {
$type = strtoupper($type);
if ( !array_key_exists($type, self::$supported_types) ) {
throw new UnexpectedValueException("Bad validation type");
}
return call_user_func(self::$supported_types[$type], $da... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"data",
",",
"$",
"type",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"strtoupper",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"type",
... | Generic validator.
@param mixed $data Data to validate
@param string $type Type (one of self::$supported_types)
@param callable $filter Custom filter
@return bool
@throws UnexpectedValueException | [
"Generic",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L69-L79 |
200,044 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateString | public static function validateString($data, callable $filter=null) {
if ( is_string($data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateString($data, callable $filter=null) {
if ( is_string($data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateString",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
"===",
"false",
")",
"return",
"false",
";",
"return",
"self",
"::",
"applyFilter",
... | String validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"String",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L88-L91 |
200,045 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateBoolean | public static function validateBoolean($data, callable $filter=null) {
if ( is_bool($data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateBoolean($data, callable $filter=null) {
if ( is_bool($data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateBoolean",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"data",
")",
"===",
"false",
")",
"return",
"false",
";",
"return",
"self",
"::",
"applyFilter",
... | Bool validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Bool",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L100-L103 |
200,046 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateInteger | public static function validateInteger($data, callable $filter=null) {
if ( is_int($data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateInteger($data, callable $filter=null) {
if ( is_int($data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateInteger",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"data",
")",
"===",
"false",
")",
"return",
"false",
";",
"return",
"self",
"::",
"applyFilter",
... | Int validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Int",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L112-L115 |
200,047 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateNumeric | public static function validateNumeric($data, callable $filter=null) {
if ( is_numeric($data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateNumeric($data, callable $filter=null) {
if ( is_numeric($data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateNumeric",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"data",
")",
"===",
"false",
")",
"return",
"false",
";",
"return",
"self",
"::",
"applyFilter"... | Numeric validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Numeric",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L124-L127 |
200,048 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateFloat | public static function validateFloat($data, callable $filter=null) {
if ( is_float($data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateFloat($data, callable $filter=null) {
if ( is_float($data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateFloat",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_float",
"(",
"$",
"data",
")",
"===",
"false",
")",
"return",
"false",
";",
"return",
"self",
"::",
"applyFilter",
... | Float validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Float",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L136-L139 |
200,049 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateJson | public static function validateJson($data, callable $filter=null) {
$decoded = json_decode($data);
if ( is_null($decoded) ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateJson($data, callable $filter=null) {
$decoded = json_decode($data);
if ( is_null($decoded) ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateJson",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"decoded",
"=",
"json_decode",
"(",
"$",
"data",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"decoded",
")",
")",
"return",
"f... | Json validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Json",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L148-L152 |
200,050 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateSerialized | public static function validateSerialized($data, callable $filter=null) {
$decoded = @unserialize($data);
if ( $decoded === false && $data != @serialize(false) ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateSerialized($data, callable $filter=null) {
$decoded = @unserialize($data);
if ( $decoded === false && $data != @serialize(false) ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateSerialized",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"decoded",
"=",
"@",
"unserialize",
"(",
"$",
"data",
")",
";",
"if",
"(",
"$",
"decoded",
"===",
"false",
"&&",
"$",
... | Serialized values validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Serialized",
"values",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L161-L165 |
200,051 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateDatetimeIso8601 | public static function validateDatetimeIso8601($data, callable $filter=null) {
if ( DateTime::createFromFormat(DateTime::ATOM, $data) === false ) return false;
return self::applyFilter($data, $filter);
} | php | public static function validateDatetimeIso8601($data, callable $filter=null) {
if ( DateTime::createFromFormat(DateTime::ATOM, $data) === false ) return false;
return self::applyFilter($data, $filter);
} | [
"public",
"static",
"function",
"validateDatetimeIso8601",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"DateTime",
"::",
"createFromFormat",
"(",
"DateTime",
"::",
"ATOM",
",",
"$",
"data",
")",
"===",
"false",
")",
... | Iso8601-datetime validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Iso8601",
"-",
"datetime",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L201-L204 |
200,052 | comodojo/foundation | src/Comodojo/Foundation/Validation/DataValidation.php | DataValidation.validateBase64 | public static function validateBase64($data, callable $filter=null) {
return base64_encode(base64_decode($data, true)) === $data ?
self::applyFilter($data, $filter)
: false;
} | php | public static function validateBase64($data, callable $filter=null) {
return base64_encode(base64_decode($data, true)) === $data ?
self::applyFilter($data, $filter)
: false;
} | [
"public",
"static",
"function",
"validateBase64",
"(",
"$",
"data",
",",
"callable",
"$",
"filter",
"=",
"null",
")",
"{",
"return",
"base64_encode",
"(",
"base64_decode",
"(",
"$",
"data",
",",
"true",
")",
")",
"===",
"$",
"data",
"?",
"self",
"::",
... | Base64 validator.
@param mixed $data Data to validate
@param callable $filter Custom filter
@return bool | [
"Base64",
"validator",
"."
] | 21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a | https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataValidation.php#L213-L217 |
200,053 | brunschgi/TerrificComposerBundle | DependencyInjection/TerrificComposerExtension.php | TerrificComposerExtension.load | public function load(array $configs, ContainerBuilder $container)
{
// Parse configuration
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));... | php | public function load(array $configs, ContainerBuilder $container)
{
// Parse configuration
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// Parse configuration",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfigur... | Loads the terrific composer configuration.
@param array $configs An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance | [
"Loads",
"the",
"terrific",
"composer",
"configuration",
"."
] | 6eef4ace887c19ef166ab6654de385bc1ffbf5f1 | https://github.com/brunschgi/TerrificComposerBundle/blob/6eef4ace887c19ef166ab6654de385bc1ffbf5f1/DependencyInjection/TerrificComposerExtension.php#L39-L67 |
200,054 | togucms/TemplateBundle | Compiler/Compiler.php | Compiler.parseFragment | protected function parseFragment($name) {
$fileName = $this->loader->findFilename($name);
$html5 = new HTML5();
$dom = $html5->loadHTMLFragment(file_get_contents($fileName));
if($html5->getErrors()) {
$errors = "";
foreach($html5->getErrors() as $error) {
$errors .= "\n". $error;
}
throw new \E... | php | protected function parseFragment($name) {
$fileName = $this->loader->findFilename($name);
$html5 = new HTML5();
$dom = $html5->loadHTMLFragment(file_get_contents($fileName));
if($html5->getErrors()) {
$errors = "";
foreach($html5->getErrors() as $error) {
$errors .= "\n". $error;
}
throw new \E... | [
"protected",
"function",
"parseFragment",
"(",
"$",
"name",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"loader",
"->",
"findFilename",
"(",
"$",
"name",
")",
";",
"$",
"html5",
"=",
"new",
"HTML5",
"(",
")",
";",
"$",
"dom",
"=",
"$",
"html... | Parses an HTML Togu component
@param string $name
@return HTML5 The parsed DOM | [
"Parses",
"an",
"HTML",
"Togu",
"component"
] | b07d3bff948d547e95f81154503dfa3a333eef64 | https://github.com/togucms/TemplateBundle/blob/b07d3bff948d547e95f81154503dfa3a333eef64/Compiler/Compiler.php#L108-L122 |
200,055 | Aviogram/Common | src/StringUtils.php | StringUtils.underscoreToCamelCase | public static function underscoreToCamelCase($string)
{
static $cache = array();
if (array_key_exists($string, $cache) == true) {
return $cache[$string];
}
$replacer = function(array $matches) {
return strtoupper($matches[1]);
};
... | php | public static function underscoreToCamelCase($string)
{
static $cache = array();
if (array_key_exists($string, $cache) == true) {
return $cache[$string];
}
$replacer = function(array $matches) {
return strtoupper($matches[1]);
};
... | [
"public",
"static",
"function",
"underscoreToCamelCase",
"(",
"$",
"string",
")",
"{",
"static",
"$",
"cache",
"=",
"array",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"string",
",",
"$",
"cache",
")",
"==",
"true",
")",
"{",
"return",
"$"... | Convert a underscore defined string to his camelCase format
@param string $string
@return string | [
"Convert",
"a",
"underscore",
"defined",
"string",
"to",
"his",
"camelCase",
"format"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/StringUtils.php#L25-L38 |
200,056 | Aviogram/Common | src/StringUtils.php | StringUtils.camelCaseToUnderscore | public static function camelCaseToUnderscore($string)
{
static $cache = array();
if (array_key_exists($string, $cache) === true) {
return $cache[$string];
}
$replacer = function(array $matches) {
return '_' . strtolower($matches[0]);
};
... | php | public static function camelCaseToUnderscore($string)
{
static $cache = array();
if (array_key_exists($string, $cache) === true) {
return $cache[$string];
}
$replacer = function(array $matches) {
return '_' . strtolower($matches[0]);
};
... | [
"public",
"static",
"function",
"camelCaseToUnderscore",
"(",
"$",
"string",
")",
"{",
"static",
"$",
"cache",
"=",
"array",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"string",
",",
"$",
"cache",
")",
"===",
"true",
")",
"{",
"return",
"$... | Convert a camelCased defined string to his underscore format
@param string $string
@return string | [
"Convert",
"a",
"camelCased",
"defined",
"string",
"to",
"his",
"underscore",
"format"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/StringUtils.php#L59-L72 |
200,057 | OUTRAGElib/psr7-file-stream | lib/File.php | File.setStream | public function setStream(PsrStreamInterface $stream)
{
$this->stream = $stream;
$this->error = UPLOAD_ERR_OK;
return true;
} | php | public function setStream(PsrStreamInterface $stream)
{
$this->stream = $stream;
$this->error = UPLOAD_ERR_OK;
return true;
} | [
"public",
"function",
"setStream",
"(",
"PsrStreamInterface",
"$",
"stream",
")",
"{",
"$",
"this",
"->",
"stream",
"=",
"$",
"stream",
";",
"$",
"this",
"->",
"error",
"=",
"UPLOAD_ERR_OK",
";",
"return",
"true",
";",
"}"
] | Set the stream which this uploaded file refers to. | [
"Set",
"the",
"stream",
"which",
"this",
"uploaded",
"file",
"refers",
"to",
"."
] | 8da9ecad1e4190f31f8776aeadd9c7db41107f68 | https://github.com/OUTRAGElib/psr7-file-stream/blob/8da9ecad1e4190f31f8776aeadd9c7db41107f68/lib/File.php#L40-L46 |
200,058 | wasinger/adaptimage | src/AdaptiveImageResizer.php | AdaptiveImageResizer.addImageSizeDefinition | public function addImageSizeDefinition(ImageResizeDefinition $ird)
{
$this->image_resize_definitions[$ird->getWidth()] = $ird;
ksort($this->image_resize_definitions);
} | php | public function addImageSizeDefinition(ImageResizeDefinition $ird)
{
$this->image_resize_definitions[$ird->getWidth()] = $ird;
ksort($this->image_resize_definitions);
} | [
"public",
"function",
"addImageSizeDefinition",
"(",
"ImageResizeDefinition",
"$",
"ird",
")",
"{",
"$",
"this",
"->",
"image_resize_definitions",
"[",
"$",
"ird",
"->",
"getWidth",
"(",
")",
"]",
"=",
"$",
"ird",
";",
"ksort",
"(",
"$",
"this",
"->",
"ima... | Add another allowed image size
@param ImageResizeDefinition $ird | [
"Add",
"another",
"allowed",
"image",
"size"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/AdaptiveImageResizer.php#L44-L48 |
200,059 | wasinger/adaptimage | src/AdaptiveImageResizer.php | AdaptiveImageResizer.getImageResizeDefinitionForWidth | public function getImageResizeDefinitionForWidth($width, $fit_in_width = false)
{
if (empty($this->image_resize_definitions)) { // no image sizes defined
return null;
}
if ($fit_in_width) {
foreach ($this->image_resize_definitions as $w => $ird) {
if ... | php | public function getImageResizeDefinitionForWidth($width, $fit_in_width = false)
{
if (empty($this->image_resize_definitions)) { // no image sizes defined
return null;
}
if ($fit_in_width) {
foreach ($this->image_resize_definitions as $w => $ird) {
if ... | [
"public",
"function",
"getImageResizeDefinitionForWidth",
"(",
"$",
"width",
",",
"$",
"fit_in_width",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"image_resize_definitions",
")",
")",
"{",
"// no image sizes defined",
"return",
"null",
"... | Get nearest available ImageSizeDefinition for given screen width
@param int $width
@param boolean $fit_in_width If false, returns ImageSizeDefinition greater than width; if true, returns ImageSizeDefinition smaller than width
@return ImageResizeDefinition|null Matching ImageSizeDefinition or NULL if no ImageSizeDefini... | [
"Get",
"nearest",
"available",
"ImageSizeDefinition",
"for",
"given",
"screen",
"width"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/AdaptiveImageResizer.php#L57-L81 |
200,060 | flipbox/spark | src/services/Element.php | Element.isCachedById | protected function isCachedById(int $id, int $siteId = null)
{
// Resolve siteId
$siteId = SiteHelper::resolveSiteId($siteId);
if (!isset($this->cacheById[$siteId])) {
$this->cacheById[$siteId] = [];
}
return array_key_exists($id, $this->cacheById[$siteId]);
... | php | protected function isCachedById(int $id, int $siteId = null)
{
// Resolve siteId
$siteId = SiteHelper::resolveSiteId($siteId);
if (!isset($this->cacheById[$siteId])) {
$this->cacheById[$siteId] = [];
}
return array_key_exists($id, $this->cacheById[$siteId]);
... | [
"protected",
"function",
"isCachedById",
"(",
"int",
"$",
"id",
",",
"int",
"$",
"siteId",
"=",
"null",
")",
"{",
"// Resolve siteId",
"$",
"siteId",
"=",
"SiteHelper",
"::",
"resolveSiteId",
"(",
"$",
"siteId",
")",
";",
"if",
"(",
"!",
"isset",
"(",
... | Identify whether in cached by ID
@param int $id
@param int|null $siteId
@return bool | [
"Identify",
"whether",
"in",
"cached",
"by",
"ID"
] | 9d75fd3d95744b9c9187921c4f3b9eea42c035d4 | https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/services/Element.php#L276-L286 |
200,061 | andela-doladosu/liteorm | src/Origins/Connection.php | Connection.getEnv | public static function getEnv()
{
if (null !== (getenv('P_DRIVER'))) {
$dotEnv = new Dotenv($_SERVER['DOCUMENT_ROOT']);
$dotEnv->load();
}
self::$driver = getenv('P_DRIVER');
self::$host = getenv('P_HOST');
self::$dbname = getenv('P... | php | public static function getEnv()
{
if (null !== (getenv('P_DRIVER'))) {
$dotEnv = new Dotenv($_SERVER['DOCUMENT_ROOT']);
$dotEnv->load();
}
self::$driver = getenv('P_DRIVER');
self::$host = getenv('P_HOST');
self::$dbname = getenv('P... | [
"public",
"static",
"function",
"getEnv",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"(",
"getenv",
"(",
"'P_DRIVER'",
")",
")",
")",
"{",
"$",
"dotEnv",
"=",
"new",
"Dotenv",
"(",
"$",
"_SERVER",
"[",
"'DOCUMENT_ROOT'",
"]",
")",
";",
"$",
"dotEnv",
... | Get environment values from .env file
@return null | [
"Get",
"environment",
"values",
"from",
".",
"env",
"file"
] | e97f69e20be4ce0c078a0c25a9a777307d85e9e4 | https://github.com/andela-doladosu/liteorm/blob/e97f69e20be4ce0c078a0c25a9a777307d85e9e4/src/Origins/Connection.php#L28-L41 |
200,062 | andela-doladosu/liteorm | src/Origins/Connection.php | Connection.connect | public static function connect()
{
self::getEnv();
return new PDO(self::$driver.':host='.self::$host.';dbname='.self::$dbname, self::$user, self::$pass);
} | php | public static function connect()
{
self::getEnv();
return new PDO(self::$driver.':host='.self::$host.';dbname='.self::$dbname, self::$user, self::$pass);
} | [
"public",
"static",
"function",
"connect",
"(",
")",
"{",
"self",
"::",
"getEnv",
"(",
")",
";",
"return",
"new",
"PDO",
"(",
"self",
"::",
"$",
"driver",
".",
"':host='",
".",
"self",
"::",
"$",
"host",
".",
"';dbname='",
".",
"self",
"::",
"$",
"... | Create PDO connections
@return PDO | [
"Create",
"PDO",
"connections"
] | e97f69e20be4ce0c078a0c25a9a777307d85e9e4 | https://github.com/andela-doladosu/liteorm/blob/e97f69e20be4ce0c078a0c25a9a777307d85e9e4/src/Origins/Connection.php#L48-L52 |
200,063 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Mapping/Driver/AnnotationDriver.php | AnnotationDriver.propertyNeedsMapping | private function propertyNeedsMapping(ClassMetadata $class, \ReflectionProperty $property)
{
if ($class->isMappedSuperclass && !$property->isPrivate()) {
return false;
}
$inherited = $class->hasAttribute($property->name) && $class->getPropertyMetadata($property->name)->isInherit... | php | private function propertyNeedsMapping(ClassMetadata $class, \ReflectionProperty $property)
{
if ($class->isMappedSuperclass && !$property->isPrivate()) {
return false;
}
$inherited = $class->hasAttribute($property->name) && $class->getPropertyMetadata($property->name)->isInherit... | [
"private",
"function",
"propertyNeedsMapping",
"(",
"ClassMetadata",
"$",
"class",
",",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"class",
"->",
"isMappedSuperclass",
"&&",
"!",
"$",
"property",
"->",
"isPrivate",
"(",
")",
")",
... | Check if the specified property needs to be mapped.
For superclasses, mapping is handled at the child class level except in case
of private properties. For inheritance, it's handled by the declaring class.
@param ClassMetadata $class
@param \ReflectionProperty $property
@return bool
@todo move to ClassMetadat... | [
"Check",
"if",
"the",
"specified",
"property",
"needs",
"to",
"be",
"mapped",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Mapping/Driver/AnnotationDriver.php#L308-L317 |
200,064 | bkstg/schedule-bundle | Entity/Schedule.php | Schedule.removeGroup | public function removeGroup(GroupInterface $group): void
{
if (!$group instanceof Production) {
throw new Exception('Group type not supported.');
}
$this->groups->removeElement($group);
} | php | public function removeGroup(GroupInterface $group): void
{
if (!$group instanceof Production) {
throw new Exception('Group type not supported.');
}
$this->groups->removeElement($group);
} | [
"public",
"function",
"removeGroup",
"(",
"GroupInterface",
"$",
"group",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"group",
"instanceof",
"Production",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Group type not supported.'",
")",
";",
"}",
"$",
"this",
... | Remove group.
@param Production $group The group to remove.
@return void | [
"Remove",
"group",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Entity/Schedule.php#L294-L300 |
200,065 | bkstg/schedule-bundle | Entity/Schedule.php | Schedule.addEvent | public function addEvent(Event $event): self
{
$event->setSchedule($this);
$this->events[] = $event;
return $this;
} | php | public function addEvent(Event $event): self
{
$event->setSchedule($this);
$this->events[] = $event;
return $this;
} | [
"public",
"function",
"addEvent",
"(",
"Event",
"$",
"event",
")",
":",
"self",
"{",
"$",
"event",
"->",
"setSchedule",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"events",
"[",
"]",
"=",
"$",
"event",
";",
"return",
"$",
"this",
";",
"}"
] | Add event.
@param Event $event The event to add.
@return self | [
"Add",
"event",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Entity/Schedule.php#L337-L343 |
200,066 | bkstg/schedule-bundle | Entity/Schedule.php | Schedule.getStart | public function getStart(): ?\DateTimeInterface
{
$lowest_date = null;
foreach ($this->events as $event) {
if (null === $lowest_date || $event->getStart() < $lowest_date) {
$lowest_date = $event->getStart();
}
}
return $lowest_date;
} | php | public function getStart(): ?\DateTimeInterface
{
$lowest_date = null;
foreach ($this->events as $event) {
if (null === $lowest_date || $event->getStart() < $lowest_date) {
$lowest_date = $event->getStart();
}
}
return $lowest_date;
} | [
"public",
"function",
"getStart",
"(",
")",
":",
"?",
"\\",
"DateTimeInterface",
"{",
"$",
"lowest_date",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"event",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"lowest_date",
"||",
... | Get the start date of the schedule.
@return ?\DateTimeInterface | [
"Get",
"the",
"start",
"date",
"of",
"the",
"schedule",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Entity/Schedule.php#L372-L382 |
200,067 | bkstg/schedule-bundle | Entity/Schedule.php | Schedule.getEnd | public function getEnd(): ?\DateTimeInterface
{
$highest_date = null;
foreach ($this->events as $event) {
if (null === $highest_date || $event->getEnd() > $highest_date) {
$highest_date = $event->getEnd();
}
}
return $highest_date;
} | php | public function getEnd(): ?\DateTimeInterface
{
$highest_date = null;
foreach ($this->events as $event) {
if (null === $highest_date || $event->getEnd() > $highest_date) {
$highest_date = $event->getEnd();
}
}
return $highest_date;
} | [
"public",
"function",
"getEnd",
"(",
")",
":",
"?",
"\\",
"DateTimeInterface",
"{",
"$",
"highest_date",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"event",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"highest_date",
"||",
... | Get the end date of the schedule.
@return ?\DateTimeInterface | [
"Get",
"the",
"end",
"date",
"of",
"the",
"schedule",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Entity/Schedule.php#L389-L399 |
200,068 | staticka/staticka | src/Matter.php | Matter.parse | public static function parse($content)
{
$matter = array();
$text = str_replace(PHP_EOL, $id = uniqid(), $content);
$regex = '/^---' . $id . '(.*?)' . $id . '---/';
if (preg_match($regex, $text, $matches) === 1) {
$yaml = str_replace($id, PHP_EOL, $matches[1]);
... | php | public static function parse($content)
{
$matter = array();
$text = str_replace(PHP_EOL, $id = uniqid(), $content);
$regex = '/^---' . $id . '(.*?)' . $id . '---/';
if (preg_match($regex, $text, $matches) === 1) {
$yaml = str_replace($id, PHP_EOL, $matches[1]);
... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"content",
")",
"{",
"$",
"matter",
"=",
"array",
"(",
")",
";",
"$",
"text",
"=",
"str_replace",
"(",
"PHP_EOL",
",",
"$",
"id",
"=",
"uniqid",
"(",
")",
",",
"$",
"content",
")",
";",
"$",
"reg... | Retrieves the contents from a YAML format.
@param string $content
@return array | [
"Retrieves",
"the",
"contents",
"from",
"a",
"YAML",
"format",
"."
] | 6e3b814c391ed03b0bd409803e11579bae677ce4 | https://github.com/staticka/staticka/blob/6e3b814c391ed03b0bd409803e11579bae677ce4/src/Matter.php#L21-L40 |
200,069 | sndsgd/sndsgd-field | src/field/Error.php | Error.setValue | public function setValue($value)
{
if (is_string($value) && strlen($value) > 100) {
$value = substr($value, 0, 96).'...';
}
$this->value = $value;
} | php | public function setValue($value)
{
if (is_string($value) && strlen($value) > 100) {
$value = substr($value, 0, 96).'...';
}
$this->value = $value;
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"strlen",
"(",
"$",
"value",
")",
">",
"100",
")",
"{",
"$",
"value",
"=",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"96",
")... | Set the value in the field that failed to validate
@param mixed $value | [
"Set",
"the",
"value",
"in",
"the",
"field",
"that",
"failed",
"to",
"validate"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Error.php#L107-L113 |
200,070 | prolic/HumusMvc | src/HumusMvc/MvcEvent.php | MvcEvent.setApplication | public function setApplication(ApplicationInterface $application)
{
$this->setParam('application', $application);
$this->application = $application;
return $this;
} | php | public function setApplication(ApplicationInterface $application)
{
$this->setParam('application', $application);
$this->application = $application;
return $this;
} | [
"public",
"function",
"setApplication",
"(",
"ApplicationInterface",
"$",
"application",
")",
"{",
"$",
"this",
"->",
"setParam",
"(",
"'application'",
",",
"$",
"application",
")",
";",
"$",
"this",
"->",
"application",
"=",
"$",
"application",
";",
"return",... | Set application instance
@param ApplicationInterface $application
@return MvcEvent | [
"Set",
"application",
"instance"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/MvcEvent.php#L69-L74 |
200,071 | agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/ChangePasswordConfirmForm.php | ChangePasswordConfirmForm.Wordings | protected function Wordings()
{
$result = array();
$result[] = 'Success';
$result[] = 'Error';
$result[] = 'Password';
$result[] = 'Password.Validation.Required.Missing';
$result[] = 'PasswordRepeat';
$result[] = 'PasswordRepeat.Validation.Required.Missing';
... | php | protected function Wordings()
{
$result = array();
$result[] = 'Success';
$result[] = 'Error';
$result[] = 'Password';
$result[] = 'Password.Validation.Required.Missing';
$result[] = 'PasswordRepeat';
$result[] = 'PasswordRepeat.Validation.Required.Missing';
... | [
"protected",
"function",
"Wordings",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"result",
"[",
"]",
"=",
"'Success'",
";",
"$",
"result",
"[",
"]",
"=",
"'Error'",
";",
"$",
"result",
"[",
"]",
"=",
"'Password'",
";",
"$",
"r... | Returns the wording labels for success and error
@return string[] Returns the wording labels | [
"Returns",
"the",
"wording",
"labels",
"for",
"success",
"and",
"error"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/ChangePasswordConfirmForm.php#L92-L104 |
200,072 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.create | public static function create($template = null, $action = null, $method = 'POST', $encType = null) {
return new static($template, $action, $method, $encType);
} | php | public static function create($template = null, $action = null, $method = 'POST', $encType = null) {
return new static($template, $action, $method, $encType);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"template",
"=",
"null",
",",
"$",
"action",
"=",
"null",
",",
"$",
"method",
"=",
"'POST'",
",",
"$",
"encType",
"=",
"null",
")",
"{",
"return",
"new",
"static",
"(",
"$",
"template",
",",
"$",
... | Create instance
allows chaining
@param string $template filename
@param string $action attribute
@param string $method request method attribute
@param string $encType encoding type attribute
@return HtmlForm | [
"Create",
"instance",
"allows",
"chaining"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L220-L224 |
200,073 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.bindRequestParameters | public function bindRequestParameters(ParameterBag $bag = null) {
if($bag) {
$this->requestValues = $bag;
}
else {
if($this->request->getMethod() == 'GET') {
$this->requestValues = $this->request->query;
}
else {
$this->requestValues = $this->request->request;
}
}
// set form element... | php | public function bindRequestParameters(ParameterBag $bag = null) {
if($bag) {
$this->requestValues = $bag;
}
else {
if($this->request->getMethod() == 'GET') {
$this->requestValues = $this->request->query;
}
else {
$this->requestValues = $this->request->request;
}
}
// set form element... | [
"public",
"function",
"bindRequestParameters",
"(",
"ParameterBag",
"$",
"bag",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"bag",
")",
"{",
"$",
"this",
"->",
"requestValues",
"=",
"$",
"bag",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"request... | initialize parameter bag
parameterbag is either supplied, or depending on request method retrieved from request object
@param ParameterBag $bag
@return HtmlForm | [
"initialize",
"parameter",
"bag",
"parameterbag",
"is",
"either",
"supplied",
"or",
"depending",
"on",
"request",
"method",
"retrieved",
"from",
"request",
"object"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L234-L261 |
200,074 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.setMethod | public function setMethod($method) {
$method = strtoupper($method);
if($method != 'GET' && $method != 'POST') {
throw new HtmlFormException(sprintf("Invalid form method: '%s'.", $method), HtmlFormException::INVALID_METHOD);
}
$this->method = $method;
return $this;
} | php | public function setMethod($method) {
$method = strtoupper($method);
if($method != 'GET' && $method != 'POST') {
throw new HtmlFormException(sprintf("Invalid form method: '%s'.", $method), HtmlFormException::INVALID_METHOD);
}
$this->method = $method;
return $this;
} | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtoupper",
"(",
"$",
"method",
")",
";",
"if",
"(",
"$",
"method",
"!=",
"'GET'",
"&&",
"$",
"method",
"!=",
"'POST'",
")",
"{",
"throw",
"new",
"HtmlFormException"... | set submission method
'GET' and 'POST' are the only allowed values
@param string $method
@return HtmlForm
@throws HtmlFormException | [
"set",
"submission",
"method",
"GET",
"and",
"POST",
"are",
"the",
"only",
"allowed",
"values"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L272-L282 |
200,075 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.setAttribute | public function setAttribute($attr, $value) {
$attr = strtolower($attr);
switch($attr) {
case 'action':
$this->setAction($value);
return $this;
case 'enctype':
$this->setEncType($value);
return $this;
case 'method':
$this->setMethod($value);
return $this;
default:
$this-... | php | public function setAttribute($attr, $value) {
$attr = strtolower($attr);
switch($attr) {
case 'action':
$this->setAction($value);
return $this;
case 'enctype':
$this->setEncType($value);
return $this;
case 'method':
$this->setMethod($value);
return $this;
default:
$this-... | [
"public",
"function",
"setAttribute",
"(",
"$",
"attr",
",",
"$",
"value",
")",
"{",
"$",
"attr",
"=",
"strtolower",
"(",
"$",
"attr",
")",
";",
"switch",
"(",
"$",
"attr",
")",
"{",
"case",
"'action'",
":",
"$",
"this",
"->",
"setAction",
"(",
"$"... | set miscellaneous attribute of form
@param string $attr
@param string $value
@return HtmlForm
@throws HtmlFormException | [
"set",
"miscellaneous",
"attribute",
"of",
"form"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L331-L354 |
200,076 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.getAttribute | public function getAttribute($attr, $default = null) {
return ($attr && array_key_exists($attr, $this->attributes)) ? $this->attributes[$attr] : $default;
} | php | public function getAttribute($attr, $default = null) {
return ($attr && array_key_exists($attr, $this->attributes)) ? $this->attributes[$attr] : $default;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"attr",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"(",
"$",
"attr",
"&&",
"array_key_exists",
"(",
"$",
"attr",
",",
"$",
"this",
"->",
"attributes",
")",
")",
"?",
"$",
"this",
"->",
"attri... | get an attribute, if the attribute was not set previously a
default value can be supplied
@param string $attr
@param string $default
@return string | [
"get",
"an",
"attribute",
"if",
"the",
"attribute",
"was",
"not",
"set",
"previously",
"a",
"default",
"value",
"can",
"be",
"supplied"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L364-L368 |
200,077 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.setAttributes | public function setAttributes(array $attrs) {
foreach($attrs as $k => $v) {
$this->setAttribute($k, $v);
}
return $this;
} | php | public function setAttributes(array $attrs) {
foreach($attrs as $k => $v) {
$this->setAttribute($k, $v);
}
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"array",
"$",
"attrs",
")",
"{",
"foreach",
"(",
"$",
"attrs",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"$",
"k",
",",
"$",
"v",
")",
";",
"}",
"return",
"$",
... | sets sevaral form attributes stored in associative array
@param array $attrs
@return HtmlForm
@throws HtmlFormException | [
"sets",
"sevaral",
"form",
"attributes",
"stored",
"in",
"associative",
"array"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L377-L385 |
200,078 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.getSubmittingElement | public function getSubmittingElement() {
// cache submitting element
if(!empty($this->clickedSubmit)) {
return $this->clickedSubmit;
}
if(is_null($this->requestValues)) {
return null;
}
foreach($this->elements as $name => $e) {
if(is_array($e)) {
// parse one-dimensional arrays
forea... | php | public function getSubmittingElement() {
// cache submitting element
if(!empty($this->clickedSubmit)) {
return $this->clickedSubmit;
}
if(is_null($this->requestValues)) {
return null;
}
foreach($this->elements as $name => $e) {
if(is_array($e)) {
// parse one-dimensional arrays
forea... | [
"public",
"function",
"getSubmittingElement",
"(",
")",
"{",
"// cache submitting element",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"clickedSubmit",
")",
")",
"{",
"return",
"$",
"this",
"->",
"clickedSubmit",
";",
"}",
"if",
"(",
"is_null",
"(",
... | Returns FormElement which submitted form, result is cached
@return FormElement | [
"Returns",
"FormElement",
"which",
"submitted",
"form",
"result",
"is",
"cached"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L392-L456 |
200,079 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.render | public function render() {
if($this->loadTemplate()) {
$this
->primeTemplate()
->insertFormFields()
->insertErrorMessages()
->insertFormStart()
->insertFormEnd()
->cleanupHtml()
;
return $this->html;
}
} | php | public function render() {
if($this->loadTemplate()) {
$this
->primeTemplate()
->insertFormFields()
->insertErrorMessages()
->insertFormStart()
->insertFormEnd()
->cleanupHtml()
;
return $this->html;
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loadTemplate",
"(",
")",
")",
"{",
"$",
"this",
"->",
"primeTemplate",
"(",
")",
"->",
"insertFormFields",
"(",
")",
"->",
"insertErrorMessages",
"(",
")",
"->",
"insertFormSta... | renders complete form markup
@throws HtmlFormException | [
"renders",
"complete",
"form",
"markup"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L478-L495 |
200,080 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.getValidFormValues | public function getValidFormValues($getSubmits = false) {
if(is_null($this->requestValues)) {
throw new HtmlFormException('Values can not be evaluated. No request bound.', HtmlFormException::NO_REQUEST_BOUND);
}
$tmp = new ValuesBag();
foreach($this->elements as $name => $e) {
if(is_array($e)) {
... | php | public function getValidFormValues($getSubmits = false) {
if(is_null($this->requestValues)) {
throw new HtmlFormException('Values can not be evaluated. No request bound.', HtmlFormException::NO_REQUEST_BOUND);
}
$tmp = new ValuesBag();
foreach($this->elements as $name => $e) {
if(is_array($e)) {
... | [
"public",
"function",
"getValidFormValues",
"(",
"$",
"getSubmits",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"requestValues",
")",
")",
"{",
"throw",
"new",
"HtmlFormException",
"(",
"'Values can not be evaluated. No request bound.'",
... | deliver all valid form values
@param boolean $getSubmits,deliver submit buttons when TRUE, defaults to FALSE
@return ValuesBag
@throws HtmlFormException | [
"deliver",
"all",
"valid",
"form",
"values"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L505-L561 |
200,081 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.setInitFormValues | public function setInitFormValues(array $values) {
$this->initFormValues = $values;
foreach($values as $name => $value) {
if(isset($this->elements[$name]) && is_object($this->elements[$name])) {
if($this->elements[$name] instanceof CheckboxElement) {
if(empty($this->requestValues)) {
$this->ele... | php | public function setInitFormValues(array $values) {
$this->initFormValues = $values;
foreach($values as $name => $value) {
if(isset($this->elements[$name]) && is_object($this->elements[$name])) {
if($this->elements[$name] instanceof CheckboxElement) {
if(empty($this->requestValues)) {
$this->ele... | [
"public",
"function",
"setInitFormValues",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"initFormValues",
"=",
"$",
"values",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"... | sets initial form values stored in associative array
values will only be applied to elements with previously declared value NULL
checkbox elements will be checked when their value equals form value
@param array $values
@return HtmlForm | [
"sets",
"initial",
"form",
"values",
"stored",
"in",
"associative",
"array",
"values",
"will",
"only",
"be",
"applied",
"to",
"elements",
"with",
"previously",
"declared",
"value",
"NULL",
"checkbox",
"elements",
"will",
"be",
"checked",
"when",
"their",
"value"... | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L572-L596 |
200,082 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.setError | public function setError($errorName, $errorNameIndex = null, $message = null) {
if(is_null($errorNameIndex)) {
$this->formErrors[$errorName] = new FormError($message);
}
else {
$this->formErrors[$errorName][$errorNameIndex] = new FormError($message);
}
return $this;
} | php | public function setError($errorName, $errorNameIndex = null, $message = null) {
if(is_null($errorNameIndex)) {
$this->formErrors[$errorName] = new FormError($message);
}
else {
$this->formErrors[$errorName][$errorNameIndex] = new FormError($message);
}
return $this;
} | [
"public",
"function",
"setError",
"(",
"$",
"errorName",
",",
"$",
"errorNameIndex",
"=",
"null",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"errorNameIndex",
")",
")",
"{",
"$",
"this",
"->",
"formErrors",
"[",
"$",
... | add custom error and force error message in template
@param string $errorName
@param mixed $errorNameIndex
@param string message
@return HtmlForm | [
"add",
"custom",
"error",
"and",
"force",
"error",
"message",
"in",
"template"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L707-L718 |
200,083 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.getElementsByName | public function getElementsByName($name) {
if(isset($this->elements[$name])) {
return $this->elements[$name];
}
throw new \InvalidArgumentException(sprintf("Unknown form element '%s'", $name));
} | php | public function getElementsByName($name) {
if(isset($this->elements[$name])) {
return $this->elements[$name];
}
throw new \InvalidArgumentException(sprintf("Unknown form element '%s'", $name));
} | [
"public",
"function",
"getElementsByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"elements",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
... | get one or more elements by name
@param string $name of element or elements
@return FormElement|array
@throws \InvalidArgumentException | [
"get",
"one",
"or",
"more",
"elements",
"by",
"name"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L738-L746 |
200,084 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.addElement | public function addElement(FormElement $element) {
if(!empty($this->elements[$element->getName()])) {
throw new HtmlFormException(sprintf("Element '%s' already assigned.", $element->getName()));
}
$this->elements[$element->getName()] = $element;
$element->setForm($this);
return $this;
} | php | public function addElement(FormElement $element) {
if(!empty($this->elements[$element->getName()])) {
throw new HtmlFormException(sprintf("Element '%s' already assigned.", $element->getName()));
}
$this->elements[$element->getName()] = $element;
$element->setForm($this);
return $this;
} | [
"public",
"function",
"addElement",
"(",
"FormElement",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"element",
"->",
"getName",
"(",
")",
"]",
")",
")",
"{",
"throw",
"new",
"HtmlFormException",
"(",... | add form element to form
@param FormElement $element
@throws HtmlFormException
@return \vxPHP\Form\HtmlForm | [
"add",
"form",
"element",
"to",
"form"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L755-L768 |
200,085 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.addElementArray | public function addElementArray(array $elements) {
if(count($elements)) {
$firstElement = array_shift($elements);
$name = $firstElement->getName();
// remove any array indexes from name
$name = preg_replace('~\[\w*\]$~i', '', $name);
if(!empty($this->elements[$name])) {
throw new HtmlFormE... | php | public function addElementArray(array $elements) {
if(count($elements)) {
$firstElement = array_shift($elements);
$name = $firstElement->getName();
// remove any array indexes from name
$name = preg_replace('~\[\w*\]$~i', '', $name);
if(!empty($this->elements[$name])) {
throw new HtmlFormE... | [
"public",
"function",
"addElementArray",
"(",
"array",
"$",
"elements",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"elements",
")",
")",
"{",
"$",
"firstElement",
"=",
"array_shift",
"(",
"$",
"elements",
")",
";",
"$",
"name",
"=",
"$",
"firstElement",
"... | add several form elements stored in array to form
the elements have to be of same type and have to have the same
name or an empty name
@param array FormElement[]
@throws HtmlFormException
@return \vxPHP\Form\HtmlForm | [
"add",
"several",
"form",
"elements",
"stored",
"in",
"array",
"to",
"form"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L781-L836 |
200,086 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.renderCsrfToken | private function renderCsrfToken() {
$tokenManager = new CsrfTokenManager();
$token = $tokenManager->refreshToken('_' . $this->action . '_');
$e = new InputElement(self::CSRF_TOKEN_NAME, $token->getValue());
$e->setAttribute('type', 'hidden');
return $e->render();
} | php | private function renderCsrfToken() {
$tokenManager = new CsrfTokenManager();
$token = $tokenManager->refreshToken('_' . $this->action . '_');
$e = new InputElement(self::CSRF_TOKEN_NAME, $token->getValue());
$e->setAttribute('type', 'hidden');
return $e->render();
} | [
"private",
"function",
"renderCsrfToken",
"(",
")",
"{",
"$",
"tokenManager",
"=",
"new",
"CsrfTokenManager",
"(",
")",
";",
"$",
"token",
"=",
"$",
"tokenManager",
"->",
"refreshToken",
"(",
"'_'",
".",
"$",
"this",
"->",
"action",
".",
"'_'",
")",
";",... | render CSRF token element
the token will use the form action as id
@return string | [
"render",
"CSRF",
"token",
"element",
"the",
"token",
"will",
"use",
"the",
"form",
"action",
"as",
"id"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1009-L1018 |
200,087 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.checkCsrfToken | private function checkCsrfToken() {
$tokenManager = new CsrfTokenManager();
$token = new CsrfToken(
'_' . $this->action . '_',
$this->requestValues->get(self::CSRF_TOKEN_NAME)
);
return $tokenManager->isTokenValid($token);
} | php | private function checkCsrfToken() {
$tokenManager = new CsrfTokenManager();
$token = new CsrfToken(
'_' . $this->action . '_',
$this->requestValues->get(self::CSRF_TOKEN_NAME)
);
return $tokenManager->isTokenValid($token);
} | [
"private",
"function",
"checkCsrfToken",
"(",
")",
"{",
"$",
"tokenManager",
"=",
"new",
"CsrfTokenManager",
"(",
")",
";",
"$",
"token",
"=",
"new",
"CsrfToken",
"(",
"'_'",
".",
"$",
"this",
"->",
"action",
".",
"'_'",
",",
"$",
"this",
"->",
"reques... | check whether a CSRF token remained untainted
compares the stored token with the request value
@return boolean | [
"check",
"whether",
"a",
"CSRF",
"token",
"remained",
"untainted",
"compares",
"the",
"stored",
"token",
"with",
"the",
"request",
"value"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1026-L1037 |
200,088 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.renderAntiSpam | private function renderAntiSpam() {
$secret = md5(uniqid(null, true));
$label = md5($secret);
Session::getSessionDataBag()->set('antiSpamTimer', [$secret => microtime(true)]);
$e = new InputElement('verify', null);
$e->setAttribute('type', 'hidden');
$this->addElement($e);
$e->setValue($secret);
... | php | private function renderAntiSpam() {
$secret = md5(uniqid(null, true));
$label = md5($secret);
Session::getSessionDataBag()->set('antiSpamTimer', [$secret => microtime(true)]);
$e = new InputElement('verify', null);
$e->setAttribute('type', 'hidden');
$this->addElement($e);
$e->setValue($secret);
... | [
"private",
"function",
"renderAntiSpam",
"(",
")",
"{",
"$",
"secret",
"=",
"md5",
"(",
"uniqid",
"(",
"null",
",",
"true",
")",
")",
";",
"$",
"label",
"=",
"md5",
"(",
"$",
"secret",
")",
";",
"Session",
"::",
"getSessionDataBag",
"(",
")",
"->",
... | render spam countermeasures
@throws HtmlFormException | [
"render",
"spam",
"countermeasures"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1043-L1064 |
200,089 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.detectSpam | public function detectSpam(array $fields = [], $threshold = 3) {
$verify = $this->requestValues->get('verify');
$timer = Session::getSessionDataBag()->get('antiSpamTimer');
if(
!$verify ||
!isset($timer[$verify]) ||
(microtime(true) - $timer[$verify] < 1)
) {
return true;
}
$label = md5($veri... | php | public function detectSpam(array $fields = [], $threshold = 3) {
$verify = $this->requestValues->get('verify');
$timer = Session::getSessionDataBag()->get('antiSpamTimer');
if(
!$verify ||
!isset($timer[$verify]) ||
(microtime(true) - $timer[$verify] < 1)
) {
return true;
}
$label = md5($veri... | [
"public",
"function",
"detectSpam",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"threshold",
"=",
"3",
")",
"{",
"$",
"verify",
"=",
"$",
"this",
"->",
"requestValues",
"->",
"get",
"(",
"'verify'",
")",
";",
"$",
"timer",
"=",
"Session",
... | check for spam
@param array $fields names of fields to check against spam
@param int $threshold number of suspicious content which when exceeded will indicate spam
@return boolean $spam_detected | [
"check",
"for",
"spam"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1073-L1102 |
200,090 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.insertFormFields | private function insertFormFields() {
$this->html = preg_replace_callback(
'/\{\s*(dropdown|input|image|button|textarea|options|checkbox|selectbox|label|element):(\w+)(?:\s+(\{.*?\}))?\s*\}/i',
function($matches) {
// check whether element was assigned
if(empty($this->elements[$matches[2]])) {
... | php | private function insertFormFields() {
$this->html = preg_replace_callback(
'/\{\s*(dropdown|input|image|button|textarea|options|checkbox|selectbox|label|element):(\w+)(?:\s+(\{.*?\}))?\s*\}/i',
function($matches) {
// check whether element was assigned
if(empty($this->elements[$matches[2]])) {
... | [
"private",
"function",
"insertFormFields",
"(",
")",
"{",
"$",
"this",
"->",
"html",
"=",
"preg_replace_callback",
"(",
"'/\\{\\s*(dropdown|input|image|button|textarea|options|checkbox|selectbox|label|element):(\\w+)(?:\\s+(\\{.*?\\}))?\\s*\\}/i'",
",",
"function",
"(",
"$",
"mat... | insert form fields into template
form fields are expected in the following form
{element: <name> [ {attributes}]}
the optional attributes are provided as JSON encoded key-value pairs
future versions may observe *only* the "element" string and deprecate
specific element types
@return HtmlForm | [
"insert",
"form",
"fields",
"into",
"template"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1448-L1540 |
200,091 | Vectrex/vxPHP | src/Form/HtmlForm.php | HtmlForm.insertErrorMessages | private function insertErrorMessages() {
$rex = '/\{(?:\w+\|)*error_%s(?:\|\w+)*:([^\}]+)\}/i';
foreach($this->formErrors as $name => $v) {
if(!is_array($v)) {
$this->html = preg_replace(
sprintf($rex, $name),
'$1',
$this->html
);
}
else {
foreach(array_keys($this->formErrors[$... | php | private function insertErrorMessages() {
$rex = '/\{(?:\w+\|)*error_%s(?:\|\w+)*:([^\}]+)\}/i';
foreach($this->formErrors as $name => $v) {
if(!is_array($v)) {
$this->html = preg_replace(
sprintf($rex, $name),
'$1',
$this->html
);
}
else {
foreach(array_keys($this->formErrors[$... | [
"private",
"function",
"insertErrorMessages",
"(",
")",
"{",
"$",
"rex",
"=",
"'/\\{(?:\\w+\\|)*error_%s(?:\\|\\w+)*:([^\\}]+)\\}/i'",
";",
"foreach",
"(",
"$",
"this",
"->",
"formErrors",
"as",
"$",
"name",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"!",
"is_array"... | insert error messages into template
placeholder for error messages are replaced
@return HtmlForm | [
"insert",
"error",
"messages",
"into",
"template",
"placeholder",
"for",
"error",
"messages",
"are",
"replaced"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/HtmlForm.php#L1694-L1720 |
200,092 | TitaPHP/framework | src/TitaPHP/Http/Router.php | Router.match | public function match()
{
$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
$method = $this->getRequestMethod();
$uri = $this->getCurrentUri();
// Loop all routes
foreach ($this->routes[$method] as $route) {
// we have a match!
if (preg_match_all('#^' . $route['pattern'] . ... | php | public function match()
{
$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
$method = $this->getRequestMethod();
$uri = $this->getCurrentUri();
// Loop all routes
foreach ($this->routes[$method] as $route) {
// we have a match!
if (preg_match_all('#^' . $route['pattern'] . ... | [
"public",
"function",
"match",
"(",
")",
"{",
"$",
"requestUrl",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
":",
"'/'",
";",
"$",
"method",
"=",
"$",
"this",
"->",
"getRequestMetho... | match a current request
@return string The Request method to handle | [
"match",
"a",
"current",
"request"
] | 72283a45733a49c1d9c1fc0eba22ff13a802295c | https://github.com/TitaPHP/framework/blob/72283a45733a49c1d9c1fc0eba22ff13a802295c/src/TitaPHP/Http/Router.php#L40-L54 |
200,093 | fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php | PositionalQueryRewriter.determinePlaceholderPosition | private static function determinePlaceholderPosition($query, $index, array $placeholdersPositions = array())
{
// The placeholder position.
$placeholderPosition = null;
// Find the previous cached placeholder position in the stack to optimize the current placeholder position
// sear... | php | private static function determinePlaceholderPosition($query, $index, array $placeholdersPositions = array())
{
// The placeholder position.
$placeholderPosition = null;
// Find the previous cached placeholder position in the stack to optimize the current placeholder position
// sear... | [
"private",
"static",
"function",
"determinePlaceholderPosition",
"(",
"$",
"query",
",",
"$",
"index",
",",
"array",
"$",
"placeholdersPositions",
"=",
"array",
"(",
")",
")",
"{",
"// The placeholder position.",
"$",
"placeholderPosition",
"=",
"null",
";",
"// F... | Determines the placeholder position in the query.
Example:
- parameters:
- query: SELECT * FROM foo WHERE foo IN (?) AND bar IN (?)
^ (33) ^ (47)
- index: 1
- cachedPlaceholdersPositions: array(33)
- result:
- placeholderPosition: 47
@param string $query The query.
@param integer $index ... | [
"Determines",
"the",
"placeholder",
"position",
"in",
"the",
"query",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php#L124-L192 |
200,094 | fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php | PositionalQueryRewriter.rewriteQuery | private static function rewriteQuery($query, $placeholderPosition, array $newPlaceholders)
{
return substr($query, 0, $placeholderPosition).
implode(', ', $newPlaceholders).
substr($query, $placeholderPosition + 1);
} | php | private static function rewriteQuery($query, $placeholderPosition, array $newPlaceholders)
{
return substr($query, 0, $placeholderPosition).
implode(', ', $newPlaceholders).
substr($query, $placeholderPosition + 1);
} | [
"private",
"static",
"function",
"rewriteQuery",
"(",
"$",
"query",
",",
"$",
"placeholderPosition",
",",
"array",
"$",
"newPlaceholders",
")",
"{",
"return",
"substr",
"(",
"$",
"query",
",",
"0",
",",
"$",
"placeholderPosition",
")",
".",
"implode",
"(",
... | Rewrites the query according to the placeholder position and new placeholders.
Example:
- parameters:
- query: SELECT * FROM foo WHERE foo IN (?)
^ (32)
- placeholderPosition: 32
- newPlaceholders: array('?', '?', '?')
- result:
- rewrittenQuery: SELECT * FROM foo WHERE foo IN (?, ?, ?)
@param string $query ... | [
"Rewrites",
"the",
"query",
"according",
"to",
"the",
"placeholder",
"position",
"and",
"new",
"placeholders",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php#L212-L217 |
200,095 | fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php | PositionalQueryRewriter.rewriteParameterAndType | private static function rewriteParameterAndType(array $parameters, array $types, $index)
{
// The parameter value according.
$parameterValue = $parameters[$index];
// The parameter count.
$parameterCount = count($parameterValue);
// Extract the fridge type.
$type = ... | php | private static function rewriteParameterAndType(array $parameters, array $types, $index)
{
// The parameter value according.
$parameterValue = $parameters[$index];
// The parameter count.
$parameterCount = count($parameterValue);
// Extract the fridge type.
$type = ... | [
"private",
"static",
"function",
"rewriteParameterAndType",
"(",
"array",
"$",
"parameters",
",",
"array",
"$",
"types",
",",
"$",
"index",
")",
"{",
"// The parameter value according.",
"$",
"parameterValue",
"=",
"$",
"parameters",
"[",
"$",
"index",
"]",
";",... | Rewrites the parameter & type according to the parameter index .
Example:
- parameters:
- parameters: array(array(1, 3, 5))
- types: array('integer[]')
- index: 0
- result:
- rewrittenParameters: array(1, 3, 5)
- rewrittenTypes: array('integer', 'integer', 'integer')
@param array $parameters The query parameters.
@... | [
"Rewrites",
"the",
"parameter",
"&",
"type",
"according",
"to",
"the",
"parameter",
"index",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/PositionalQueryRewriter.php#L237-L284 |
200,096 | ReputationVIP/composer-assets-installer | src/AssetsInstallerPlugin.php | AssetsInstallerPlugin.activate | public function activate(Composer $composer, IOInterface $io)
{
$this->assetsInstaller = new AssetsInstaller($composer, $io);
} | php | public function activate(Composer $composer, IOInterface $io)
{
$this->assetsInstaller = new AssetsInstaller($composer, $io);
} | [
"public",
"function",
"activate",
"(",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
")",
"{",
"$",
"this",
"->",
"assetsInstaller",
"=",
"new",
"AssetsInstaller",
"(",
"$",
"composer",
",",
"$",
"io",
")",
";",
"}"
] | Initializes the plugin
Reads the composer.json file and
retrieves the assets-dir set if any.
This assets-dir is the path where
the other packages assets will be installed
@param Composer $composer
@param IOInterface $io | [
"Initializes",
"the",
"plugin",
"Reads",
"the",
"composer",
".",
"json",
"file",
"and",
"retrieves",
"the",
"assets",
"-",
"dir",
"set",
"if",
"any",
".",
"This",
"assets",
"-",
"dir",
"is",
"the",
"path",
"where",
"the",
"other",
"packages",
"assets",
"... | c8dea009795fe23dcd7f41d8b9a5bf4a970d842b | https://github.com/ReputationVIP/composer-assets-installer/blob/c8dea009795fe23dcd7f41d8b9a5bf4a970d842b/src/AssetsInstallerPlugin.php#L29-L32 |
200,097 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Expr.php | Expr.addCriteria | public function addCriteria(array $criteria)
{
foreach ($criteria as $key => $value) {
$this->attr($key)->matches($value);
}
return $this;
} | php | public function addCriteria(array $criteria)
{
foreach ($criteria as $key => $value) {
$this->attr($key)->matches($value);
}
return $this;
} | [
"public",
"function",
"addCriteria",
"(",
"array",
"$",
"criteria",
")",
"{",
"foreach",
"(",
"$",
"criteria",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"attr",
"(",
"$",
"key",
")",
"->",
"matches",
"(",
"$",
"value",
")",... | Add an array of criteria to the expression as AND clauses.
@see QueryBuilder::addCriteria()
@param array $criteria values indexed by property name
@return QueryBuilder|$this | [
"Add",
"an",
"array",
"of",
"criteria",
"to",
"the",
"expression",
"as",
"AND",
"clauses",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Expr.php#L68-L75 |
200,098 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Expr.php | Expr.addOr | public function addOr(Expr $subexpression /*, $subexpression2, ... */)
{
$or = new Condition\Logical\AddOr;
$or->add(...array_map(
function (Expr $expr) {
return $expr->condition;
},
func_get_args()
));
$this->addCondition($or);
... | php | public function addOr(Expr $subexpression /*, $subexpression2, ... */)
{
$or = new Condition\Logical\AddOr;
$or->add(...array_map(
function (Expr $expr) {
return $expr->condition;
},
func_get_args()
));
$this->addCondition($or);
... | [
"public",
"function",
"addOr",
"(",
"Expr",
"$",
"subexpression",
"/*, $subexpression2, ... */",
")",
"{",
"$",
"or",
"=",
"new",
"Condition",
"\\",
"Logical",
"\\",
"AddOr",
";",
"$",
"or",
"->",
"add",
"(",
"...",
"array_map",
"(",
"function",
"(",
"Expr... | Add one or more OR clauses to the expression.
@see QueryBuilder::addOr()
@param Expr $subexpression,...
@return QueryBuilder|$this | [
"Add",
"one",
"or",
"more",
"OR",
"clauses",
"to",
"the",
"expression",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Expr.php#L86-L99 |
200,099 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Expression/Expr.php | Expr.attr | public function attr($name, $discriminatorValue = null)
{
if (empty($name)) {
throw new \InvalidArgumentException;
}
return new Operand\Attribute($this, $name, $discriminatorValue);
} | php | public function attr($name, $discriminatorValue = null)
{
if (empty($name)) {
throw new \InvalidArgumentException;
}
return new Operand\Attribute($this, $name, $discriminatorValue);
} | [
"public",
"function",
"attr",
"(",
"$",
"name",
",",
"$",
"discriminatorValue",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
";",
"}",
"return",
"new",
"Operand",
"\\",
"A... | Return an attribute object, used for building an expression.
@see QueryBuilder::attr()
@param string $name Top-level attribute name.
@param string|null $discriminatorValue
@return Operand\Attribute|Operand\RootAttribute | [
"Return",
"an",
"attribute",
"object",
"used",
"for",
"building",
"an",
"expression",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Expression/Expr.php#L111-L118 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.