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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2,300 | slickframework/validator | src/StaticValidator.php | StaticValidator.checkValidator | private static function checkValidator($validator)
{
if (!array_key_exists($validator, self::$validators)) {
return self::checkClass($validator);
}
return self::$validators[$validator];
} | php | private static function checkValidator($validator)
{
if (!array_key_exists($validator, self::$validators)) {
return self::checkClass($validator);
}
return self::$validators[$validator];
} | [
"private",
"static",
"function",
"checkValidator",
"(",
"$",
"validator",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"validator",
",",
"self",
"::",
"$",
"validators",
")",
")",
"{",
"return",
"self",
"::",
"checkClass",
"(",
"$",
"validator",... | Check if the provided validator is a known alias or a valid validator
interface class
@param string $validator Alias or FQ class name of the validator
@return string | [
"Check",
"if",
"the",
"provided",
"validator",
"is",
"a",
"known",
"alias",
"or",
"a",
"valid",
"validator",
"interface",
"class"
] | d93f91e36b1d12f8fe9559f9e038b6a9f9357d8e | https://github.com/slickframework/validator/blob/d93f91e36b1d12f8fe9559f9e038b6a9f9357d8e/src/StaticValidator.php#L144-L150 |
2,301 | slickframework/validator | src/StaticValidator.php | StaticValidator.checkClass | private static function checkClass($validator)
{
if (! class_exists($validator)) {
throw new InvalidArgumentException(
"Class {$validator} does not exists."
);
}
if (! is_subclass_of($validator, ValidatorInterface::class)) {
throw new Exce... | php | private static function checkClass($validator)
{
if (! class_exists($validator)) {
throw new InvalidArgumentException(
"Class {$validator} does not exists."
);
}
if (! is_subclass_of($validator, ValidatorInterface::class)) {
throw new Exce... | [
"private",
"static",
"function",
"checkClass",
"(",
"$",
"validator",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"validator",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Class {$validator} does not exists.\"",
")",
";",
"}",
"if",... | Check if is a valid validator class
@param string $validator FQ class name of validator
@return string | [
"Check",
"if",
"is",
"a",
"valid",
"validator",
"class"
] | d93f91e36b1d12f8fe9559f9e038b6a9f9357d8e | https://github.com/slickframework/validator/blob/d93f91e36b1d12f8fe9559f9e038b6a9f9357d8e/src/StaticValidator.php#L159-L175 |
2,302 | ilya-dev/block | src/Block/Parser.php | Parser.transformRaw | public function transformRaw($comment)
{
$comment = preg_replace('/[\/\*]/', '', $comment);
$chunks = array_map('trim', explode(PHP_EOL, $comment));
return implode(PHP_EOL, array_filter($chunks));
} | php | public function transformRaw($comment)
{
$comment = preg_replace('/[\/\*]/', '', $comment);
$chunks = array_map('trim', explode(PHP_EOL, $comment));
return implode(PHP_EOL, array_filter($chunks));
} | [
"public",
"function",
"transformRaw",
"(",
"$",
"comment",
")",
"{",
"$",
"comment",
"=",
"preg_replace",
"(",
"'/[\\/\\*]/'",
",",
"''",
",",
"$",
"comment",
")",
";",
"$",
"chunks",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"PHP_EOL",
",",
... | Prettify a raw comment.
@param string $comment
@return string | [
"Prettify",
"a",
"raw",
"comment",
"."
] | 46aeff9abd1e61a4247e1cf3aed3f8c7561e2bd8 | https://github.com/ilya-dev/block/blob/46aeff9abd1e61a4247e1cf3aed3f8c7561e2bd8/src/Block/Parser.php#L11-L17 |
2,303 | monolyth-php/formulaic | src/Radio.php | Radio.id | public function id() : string
{
$name = $this->name();
$name = preg_replace("@\[\]$@", '', $name);
if ($name) {
return $name.'-'.$this->value;
}
return $name;
} | php | public function id() : string
{
$name = $this->name();
$name = preg_replace("@\[\]$@", '', $name);
if ($name) {
return $name.'-'.$this->value;
}
return $name;
} | [
"public",
"function",
"id",
"(",
")",
":",
"string",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
"(",
")",
";",
"$",
"name",
"=",
"preg_replace",
"(",
"\"@\\[\\]$@\"",
",",
"''",
",",
"$",
"name",
")",
";",
"if",
"(",
"$",
"name",
")",
"{... | Returns the ID of the element.
@return string | [
"Returns",
"the",
"ID",
"of",
"the",
"element",
"."
] | 4bf7853a0c29cc17957f1b26c79f633867742c14 | https://github.com/monolyth-php/formulaic/blob/4bf7853a0c29cc17957f1b26c79f633867742c14/src/Radio.php#L16-L24 |
2,304 | monolyth-php/formulaic | src/Radio.php | Radio.isRequired | public function isRequired() : Testable
{
$this->attributes['required'] = true;
return $this->addTest('required', function($value) {
return $this->checked();
});
} | php | public function isRequired() : Testable
{
$this->attributes['required'] = true;
return $this->addTest('required', function($value) {
return $this->checked();
});
} | [
"public",
"function",
"isRequired",
"(",
")",
":",
"Testable",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'required'",
"]",
"=",
"true",
";",
"return",
"$",
"this",
"->",
"addTest",
"(",
"'required'",
",",
"function",
"(",
"$",
"value",
")",
"{",
"ret... | Mark the field as required.
@return self | [
"Mark",
"the",
"field",
"as",
"required",
"."
] | 4bf7853a0c29cc17957f1b26c79f633867742c14 | https://github.com/monolyth-php/formulaic/blob/4bf7853a0c29cc17957f1b26c79f633867742c14/src/Radio.php#L55-L61 |
2,305 | monolyth-php/formulaic | src/Radio.php | Radio.inGroup | public function inGroup(bool $status = null) : bool
{
if (!is_null($status)) {
$this->inGroup = $status;
}
return $this->inGroup;
} | php | public function inGroup(bool $status = null) : bool
{
if (!is_null($status)) {
$this->inGroup = $status;
}
return $this->inGroup;
} | [
"public",
"function",
"inGroup",
"(",
"bool",
"$",
"status",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"status",
")",
")",
"{",
"$",
"this",
"->",
"inGroup",
"=",
"$",
"status",
";",
"}",
"return",
"$",
"this",
"->"... | Get or set whether this element is part of a group.
@param bool $status
@return bool | [
"Get",
"or",
"set",
"whether",
"this",
"element",
"is",
"part",
"of",
"a",
"group",
"."
] | 4bf7853a0c29cc17957f1b26c79f633867742c14 | https://github.com/monolyth-php/formulaic/blob/4bf7853a0c29cc17957f1b26c79f633867742c14/src/Radio.php#L69-L75 |
2,306 | easy-system/es-view | src/Resolver.php | Resolver.registerModulePath | public function registerModulePath($moduleName, $path, $addPrefix = true)
{
$normalized = static::normalizePath($path) . PHP_DS;
if ($addPrefix) {
$normalized .= static::DEFAULT_PREFIX . PHP_DS;
}
$this->modulesMap[static::normalizeModule($moduleName)] = $normalized;
... | php | public function registerModulePath($moduleName, $path, $addPrefix = true)
{
$normalized = static::normalizePath($path) . PHP_DS;
if ($addPrefix) {
$normalized .= static::DEFAULT_PREFIX . PHP_DS;
}
$this->modulesMap[static::normalizeModule($moduleName)] = $normalized;
... | [
"public",
"function",
"registerModulePath",
"(",
"$",
"moduleName",
",",
"$",
"path",
",",
"$",
"addPrefix",
"=",
"true",
")",
"{",
"$",
"normalized",
"=",
"static",
"::",
"normalizePath",
"(",
"$",
"path",
")",
".",
"PHP_DS",
";",
"if",
"(",
"$",
"add... | Registers module path.
@param string $moduleName The module name
@param string $path The path to module directory
@param bool $addPrefix Optional; true by default. To add a prefix to
the directory path
@return self | [
"Registers",
"module",
"path",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L80-L89 |
2,307 | easy-system/es-view | src/Resolver.php | Resolver.registerTemplatePath | public function registerTemplatePath($templateName, $path)
{
$this->templatesMap[(string) $templateName] = (string) $path;
return $this;
} | php | public function registerTemplatePath($templateName, $path)
{
$this->templatesMap[(string) $templateName] = (string) $path;
return $this;
} | [
"public",
"function",
"registerTemplatePath",
"(",
"$",
"templateName",
",",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"templatesMap",
"[",
"(",
"string",
")",
"$",
"templateName",
"]",
"=",
"(",
"string",
")",
"$",
"path",
";",
"return",
"$",
"this",
... | Register the template path.
@param string $templateName The template name
@param string $path The path to template
@return self | [
"Register",
"the",
"template",
"path",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L123-L128 |
2,308 | easy-system/es-view | src/Resolver.php | Resolver.resolveModule | protected function resolveModule($template, $module)
{
$fullName = $module . '::' . $template;
if (isset($this->templatesMap[$fullName])) {
$file = $this->normalizePath($this->templatesMap[$fullName]);
if (! file_exists($file)) {
throw new RuntimeException(spr... | php | protected function resolveModule($template, $module)
{
$fullName = $module . '::' . $template;
if (isset($this->templatesMap[$fullName])) {
$file = $this->normalizePath($this->templatesMap[$fullName]);
if (! file_exists($file)) {
throw new RuntimeException(spr... | [
"protected",
"function",
"resolveModule",
"(",
"$",
"template",
",",
"$",
"module",
")",
"{",
"$",
"fullName",
"=",
"$",
"module",
".",
"'::'",
".",
"$",
"template",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"templatesMap",
"[",
"$",
"fullName",... | Resolves the specified module.
@param string $template The template
@param string $module The normalized module name
@throws \RuntimeException If the registered template file not exists
@return string|false Returns path to file if it found or false otherwise | [
"Resolves",
"the",
"specified",
"module",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L225-L242 |
2,309 | easy-system/es-view | src/Resolver.php | Resolver.findFile | protected function findFile($module, $template)
{
if (! isset($this->modulesMap[$module])) {
return false;
}
$tpl = str_replace('/', PHP_DS, $template);
$found = glob($this->modulesMap[$module] . $tpl . '.*');
if (! $found) {
return false;
}
... | php | protected function findFile($module, $template)
{
if (! isset($this->modulesMap[$module])) {
return false;
}
$tpl = str_replace('/', PHP_DS, $template);
$found = glob($this->modulesMap[$module] . $tpl . '.*');
if (! $found) {
return false;
}
... | [
"protected",
"function",
"findFile",
"(",
"$",
"module",
",",
"$",
"template",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"modulesMap",
"[",
"$",
"module",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"tpl",
"=",
"str_repla... | Finds file.
@param string $module The normalized module namespace
@param string $template The template name
@return string|false Returns path to file if it found or false otherwise | [
"Finds",
"file",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L252-L267 |
2,310 | easy-system/es-view | src/Resolver.php | Resolver.normalizeModule | public static function normalizeModule($module)
{
$module = (string) $module;
if (isset(static::$moduleNames[$module])) {
return static::$moduleNames[$module];
}
$normalized = trim(str_replace('\\', '/', $module), '/');
$result = strtolower(
preg_rep... | php | public static function normalizeModule($module)
{
$module = (string) $module;
if (isset(static::$moduleNames[$module])) {
return static::$moduleNames[$module];
}
$normalized = trim(str_replace('\\', '/', $module), '/');
$result = strtolower(
preg_rep... | [
"public",
"static",
"function",
"normalizeModule",
"(",
"$",
"module",
")",
"{",
"$",
"module",
"=",
"(",
"string",
")",
"$",
"module",
";",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"moduleNames",
"[",
"$",
"module",
"]",
")",
")",
"{",
"return"... | Normalizes module name.
@param string $module The module namespace
@return string The normalized module name | [
"Normalizes",
"module",
"name",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L276-L291 |
2,311 | easy-system/es-view | src/Resolver.php | Resolver.normalizePath | protected static function normalizePath($path)
{
$normalized = str_replace(['\\', '/'], PHP_DS, (string) $path);
return rtrim($normalized, PHP_DS);
} | php | protected static function normalizePath($path)
{
$normalized = str_replace(['\\', '/'], PHP_DS, (string) $path);
return rtrim($normalized, PHP_DS);
} | [
"protected",
"static",
"function",
"normalizePath",
"(",
"$",
"path",
")",
"{",
"$",
"normalized",
"=",
"str_replace",
"(",
"[",
"'\\\\'",
",",
"'/'",
"]",
",",
"PHP_DS",
",",
"(",
"string",
")",
"$",
"path",
")",
";",
"return",
"rtrim",
"(",
"$",
"n... | Normalizes path.
@param string $path The path
@return string Returns the normalized path | [
"Normalizes",
"path",
"."
] | 8a29efcef8cd59640c98f5440379a93d0f504212 | https://github.com/easy-system/es-view/blob/8a29efcef8cd59640c98f5440379a93d0f504212/src/Resolver.php#L300-L305 |
2,312 | AlexHowansky/ork-base | src/Filter/StringToTime.php | StringToTime.filter | public function filter($value)
{
// If it's already a timestamp, return it as is.
if (preg_match('/^-?\d+$/', $value) === 1) {
if ($value < 0) {
throw new \DomainException('Invalid value');
}
return $value;
}
// Allow SQL specials... | php | public function filter($value)
{
// If it's already a timestamp, return it as is.
if (preg_match('/^-?\d+$/', $value) === 1) {
if ($value < 0) {
throw new \DomainException('Invalid value');
}
return $value;
}
// Allow SQL specials... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"// If it's already a timestamp, return it as is.",
"if",
"(",
"preg_match",
"(",
"'/^-?\\d+$/'",
",",
"$",
"value",
")",
"===",
"1",
")",
"{",
"if",
"(",
"$",
"value",
"<",
"0",
")",
"{",
"throw... | Convert a string to a timestamp.
@param string $value A string to convert to a timestamp.
@return integer The converted timestamp. | [
"Convert",
"a",
"string",
"to",
"a",
"timestamp",
"."
] | 5f4ab14e63bbc8b17898639fd1fff86ee6659bb0 | https://github.com/AlexHowansky/ork-base/blob/5f4ab14e63bbc8b17898639fd1fff86ee6659bb0/src/Filter/StringToTime.php#L41-L68 |
2,313 | budkit/budkit-framework | src/Budkit/Validation/Sanitize.php | Sanitize.filterArray | private function filterArray(array $data, array $options)
{
$this->sanitized = true;
return filter_var_array($data, $options, true);
} | php | private function filterArray(array $data, array $options)
{
$this->sanitized = true;
return filter_var_array($data, $options, true);
} | [
"private",
"function",
"filterArray",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"sanitized",
"=",
"true",
";",
"return",
"filter_var_array",
"(",
"$",
"data",
",",
"$",
"options",
",",
"true",
")",
";",
"}"
] | Filters an Array recursively
@param type $array | [
"Filters",
"an",
"Array",
"recursively"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Validation/Sanitize.php#L130-L135 |
2,314 | budkit/budkit-framework | src/Budkit/Validation/Sanitize.php | Sanitize.word | public function word($data, $default = '', $options = [])
{
//First word in a sanitized string
$sentence = $this->string($data, $default, $options, false);
//@TODO validate string before breaking into words;
//Requires php5.3!!
return (string)strstr($sentence, ' ', true);
... | php | public function word($data, $default = '', $options = [])
{
//First word in a sanitized string
$sentence = $this->string($data, $default, $options, false);
//@TODO validate string before breaking into words;
//Requires php5.3!!
return (string)strstr($sentence, ' ', true);
... | [
"public",
"function",
"word",
"(",
"$",
"data",
",",
"$",
"default",
"=",
"''",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"//First word in a sanitized string",
"$",
"sentence",
"=",
"$",
"this",
"->",
"string",
"(",
"$",
"data",
",",
"$",
"default"... | Returns the first word a sanitised string
Strip tags, optionally strip or encode special characters.
@param string $name
@param string $verb
@param array $flags | [
"Returns",
"the",
"first",
"word",
"a",
"sanitised",
"string",
"Strip",
"tags",
"optionally",
"strip",
"or",
"encode",
"special",
"characters",
"."
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Validation/Sanitize.php#L420-L429 |
2,315 | vinala/kernel | src/Cubes/Cube.php | Cube.setInstance | public static function setInstance($args)
{
$name = array_shift($args);
$name = self::getAccessor($name);
$reflect = new \ReflectionClass($name);
return $reflect->newInstanceArgs($args);
} | php | public static function setInstance($args)
{
$name = array_shift($args);
$name = self::getAccessor($name);
$reflect = new \ReflectionClass($name);
return $reflect->newInstanceArgs($args);
} | [
"public",
"static",
"function",
"setInstance",
"(",
"$",
"args",
")",
"{",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"name",
"=",
"self",
"::",
"getAccessor",
"(",
"$",
"name",
")",
";",
"$",
"reflect",
"=",
"new",
"\\",
"Re... | Set Instance.
@param string $name
@return mixed | [
"Set",
"Instance",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Cubes/Cube.php#L40-L49 |
2,316 | flowcode/AmulenPageBundle | src/Flowcode/PageBundle/Controller/AdminPageController.php | AdminPageController.createBlockAction | public function createBlockAction(Request $request, $type)
{
$entity = new Block();
$entity->setType($type);
$form = $this->createBlockCreateForm($entity);
$form->handleRequest($request);
$availableLangs = $this->container->getParameter('flowcode_page.available_languages');
... | php | public function createBlockAction(Request $request, $type)
{
$entity = new Block();
$entity->setType($type);
$form = $this->createBlockCreateForm($entity);
$form->handleRequest($request);
$availableLangs = $this->container->getParameter('flowcode_page.available_languages');
... | [
"public",
"function",
"createBlockAction",
"(",
"Request",
"$",
"request",
",",
"$",
"type",
")",
"{",
"$",
"entity",
"=",
"new",
"Block",
"(",
")",
";",
"$",
"entity",
"->",
"setType",
"(",
"$",
"type",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->... | Creates a new Block entity.
@Route("/block/{type}", name="admin_page_block_create")
@Method("POST")
@Template("FlowcodePageBundle:AdminPage:new_block.html.twig") | [
"Creates",
"a",
"new",
"Block",
"entity",
"."
] | 41c90e1860d5f51aeda13cb42993b17cf14cf89f | https://github.com/flowcode/AmulenPageBundle/blob/41c90e1860d5f51aeda13cb42993b17cf14cf89f/src/Flowcode/PageBundle/Controller/AdminPageController.php#L326-L358 |
2,317 | flowcode/AmulenPageBundle | src/Flowcode/PageBundle/Controller/AdminPageController.php | AdminPageController.editBlockAction | public function editBlockAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('AmulenPageBundle:Block')->find($id);
$availableEntityLangs = $em->getRepository('AmulenPageBundle:Block')->findBy(array('page' => $entity->getPage(), 'name' => $entity->getName()))... | php | public function editBlockAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('AmulenPageBundle:Block')->find($id);
$availableEntityLangs = $em->getRepository('AmulenPageBundle:Block')->findBy(array('page' => $entity->getPage(), 'name' => $entity->getName()))... | [
"public",
"function",
"editBlockAction",
"(",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'AmulenPageBundle:Block'",
")",
... | Displays a form to edit an existing Block entity.
@Route("/block/{id}/edit", name="admin_page_block_edit")
@Method("GET")
@Template("FlowcodePageBundle:AdminPage:edit_block.html.twig") | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"Block",
"entity",
"."
] | 41c90e1860d5f51aeda13cb42993b17cf14cf89f | https://github.com/flowcode/AmulenPageBundle/blob/41c90e1860d5f51aeda13cb42993b17cf14cf89f/src/Flowcode/PageBundle/Controller/AdminPageController.php#L438-L458 |
2,318 | DevGroup-ru/yii2-admin-utils | src/Helper.php | Helper.returnUrl | public static function returnUrl()
{
if (self::$returnUrl === null) {
$url = ['/' . ltrim(Yii::$app->requestedRoute, '/')];
foreach (Yii::$app->request->queryParams as $key => $value) {
$url[$key] = $value;
}
self::$returnUrl = Url::to($url);
... | php | public static function returnUrl()
{
if (self::$returnUrl === null) {
$url = ['/' . ltrim(Yii::$app->requestedRoute, '/')];
foreach (Yii::$app->request->queryParams as $key => $value) {
$url[$key] = $value;
}
self::$returnUrl = Url::to($url);
... | [
"public",
"static",
"function",
"returnUrl",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"returnUrl",
"===",
"null",
")",
"{",
"$",
"url",
"=",
"[",
"'/'",
".",
"ltrim",
"(",
"Yii",
"::",
"$",
"app",
"->",
"requestedRoute",
",",
"'/'",
")",
"]",
... | returnURL param value.
Used for links from grids and etc. where we should return back to specified URL
@return string | [
"returnURL",
"param",
"value",
".",
"Used",
"for",
"links",
"from",
"grids",
"and",
"etc",
".",
"where",
"we",
"should",
"return",
"back",
"to",
"specified",
"URL"
] | 15c1853a5ec264602de3ad82dbf70f85de66adff | https://github.com/DevGroup-ru/yii2-admin-utils/blob/15c1853a5ec264602de3ad82dbf70f85de66adff/src/Helper.php#L23-L34 |
2,319 | unyx/console | input/Value.php | Value.setDefault | public function setDefault($default) : Value
{
if (isset($default) && !$this->mode->is(Value::OPTIONAL)) {
throw new \InvalidArgumentException('Cannot set a default value for non-optional values.');
}
$this->default = $default;
return $this;
} | php | public function setDefault($default) : Value
{
if (isset($default) && !$this->mode->is(Value::OPTIONAL)) {
throw new \InvalidArgumentException('Cannot set a default value for non-optional values.');
}
$this->default = $default;
return $this;
} | [
"public",
"function",
"setDefault",
"(",
"$",
"default",
")",
":",
"Value",
"{",
"if",
"(",
"isset",
"(",
"$",
"default",
")",
"&&",
"!",
"$",
"this",
"->",
"mode",
"->",
"is",
"(",
"Value",
"::",
"OPTIONAL",
")",
")",
"{",
"throw",
"new",
"\\",
... | Sets the default value for the underlying Parameter.
@param mixed $default The default value.
@return $this
@throws \InvalidArgumentException When an invalid default value is given. | [
"Sets",
"the",
"default",
"value",
"for",
"the",
"underlying",
"Parameter",
"."
] | b4a76e08bbb5428b0349c0ec4259a914f81a2957 | https://github.com/unyx/console/blob/b4a76e08bbb5428b0349c0ec4259a914f81a2957/input/Value.php#L89-L98 |
2,320 | CupOfTea696/WordPress-Lib | src/Application.php | Application.registerContainerAliases | protected function registerContainerAliases()
{
$aliases = [
'app' => ['Illuminate\Container\Container', 'Illuminate\Contracts\Container\Container'],
'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Repository'],
'log' => ['Psr\Log\LoggerInterface... | php | protected function registerContainerAliases()
{
$aliases = [
'app' => ['Illuminate\Container\Container', 'Illuminate\Contracts\Container\Container'],
'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Repository'],
'log' => ['Psr\Log\LoggerInterface... | [
"protected",
"function",
"registerContainerAliases",
"(",
")",
"{",
"$",
"aliases",
"=",
"[",
"'app'",
"=>",
"[",
"'Illuminate\\Container\\Container'",
",",
"'Illuminate\\Contracts\\Container\\Container'",
"]",
",",
"'config'",
"=>",
"[",
"'Illuminate\\Config\\Repository'",... | Register the core container aliases.
@return void | [
"Register",
"the",
"core",
"container",
"aliases",
"."
] | 7b31413dff6f4f70b3e2a2fc8172d0721152891d | https://github.com/CupOfTea696/WordPress-Lib/blob/7b31413dff6f4f70b3e2a2fc8172d0721152891d/src/Application.php#L182-L195 |
2,321 | vi-kon/laravel-support | src/ViKon/Support/SupportServiceProvider.php | SupportServiceProvider.registerParameterBinder | protected function registerParameterBinder()
{
$this->app->singleton(RouteBinderRegister::class, function (Container $container) {
return new RouteBinderRegister($container, $container->make('router'));
});
} | php | protected function registerParameterBinder()
{
$this->app->singleton(RouteBinderRegister::class, function (Container $container) {
return new RouteBinderRegister($container, $container->make('router'));
});
} | [
"protected",
"function",
"registerParameterBinder",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"RouteBinderRegister",
"::",
"class",
",",
"function",
"(",
"Container",
"$",
"container",
")",
"{",
"return",
"new",
"RouteBinderRegister",
"(",... | Register route parameter binder
@return void | [
"Register",
"route",
"parameter",
"binder"
] | b89dec01670108b92502d2c8095513f517475194 | https://github.com/vi-kon/laravel-support/blob/b89dec01670108b92502d2c8095513f517475194/src/ViKon/Support/SupportServiceProvider.php#L53-L58 |
2,322 | timersys/geotargetingwp | src/Record/AbstractRecord.php | AbstractRecord.name | public function name() {
if( empty($this->data->names) )
return null;
// check if we have result for locale
if ( isset( $this->data->names->{$this->default_locale} ) )
return $this->data->names->{$this->default_locale};
// otherwise fallback to english
if ( isset( $this->data->names->en )... | php | public function name() {
if( empty($this->data->names) )
return null;
// check if we have result for locale
if ( isset( $this->data->names->{$this->default_locale} ) )
return $this->data->names->{$this->default_locale};
// otherwise fallback to english
if ( isset( $this->data->names->en )... | [
"public",
"function",
"name",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"data",
"->",
"names",
")",
")",
"return",
"null",
";",
"// check if we have result for locale",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"->",
"names",
... | Return name in default locale
@return string | [
"Return",
"name",
"in",
"default",
"locale"
] | 289c1ec12bf5d0adf2eb301cc9efeeb20363c70e | https://github.com/timersys/geotargetingwp/blob/289c1ec12bf5d0adf2eb301cc9efeeb20363c70e/src/Record/AbstractRecord.php#L54-L65 |
2,323 | loopsframework/base | src/Loops/Service/Renderer.php | Renderer.addExtraAppearance | public function addExtraAppearance($appearance, $before = FALSE) {
if($before) {
array_unshift($this->extra_appearances, $appearance);
}
else {
array_push($this->extra_appearances, $appearance);
}
} | php | public function addExtraAppearance($appearance, $before = FALSE) {
if($before) {
array_unshift($this->extra_appearances, $appearance);
}
else {
array_push($this->extra_appearances, $appearance);
}
} | [
"public",
"function",
"addExtraAppearance",
"(",
"$",
"appearance",
",",
"$",
"before",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"before",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"extra_appearances",
",",
"$",
"appearance",
")",
";",
"}",
"else... | Adds an optional appearance tag that will be used for all render calls.
Additional optional appearance tags can be used to pass variables that define the environment.
For example 'cli' if working in a client interface environment.
Having these appearance tags, it is possible to define template files that will be prefe... | [
"Adds",
"an",
"optional",
"appearance",
"tag",
"that",
"will",
"be",
"used",
"for",
"all",
"render",
"calls",
"."
] | 5a15172ed4e543d7d5ecd8bd65e31f26bab3d192 | https://github.com/loopsframework/base/blob/5a15172ed4e543d7d5ecd8bd65e31f26bab3d192/src/Loops/Service/Renderer.php#L95-L102 |
2,324 | loopsframework/base | src/Loops/Service/Renderer.php | Renderer.loadViews | private function loadViews() {
if($this->views) {
return;
}
//scan views - and store result in cache
$cache = $this->getLoops()->getService("cache");
$key = "Loops-Renderer-".implode("-", $this->view_dir);
if($cache->contains($key)) {
$this->views... | php | private function loadViews() {
if($this->views) {
return;
}
//scan views - and store result in cache
$cache = $this->getLoops()->getService("cache");
$key = "Loops-Renderer-".implode("-", $this->view_dir);
if($cache->contains($key)) {
$this->views... | [
"private",
"function",
"loadViews",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"views",
")",
"{",
"return",
";",
"}",
"//scan views - and store result in cache",
"$",
"cache",
"=",
"$",
"this",
"->",
"getLoops",
"(",
")",
"->",
"getService",
"(",
"\"cach... | Helper that scans the view dirs and stores the inforation in the cache | [
"Helper",
"that",
"scans",
"the",
"view",
"dirs",
"and",
"stores",
"the",
"inforation",
"in",
"the",
"cache"
] | 5a15172ed4e543d7d5ecd8bd65e31f26bab3d192 | https://github.com/loopsframework/base/blob/5a15172ed4e543d7d5ecd8bd65e31f26bab3d192/src/Loops/Service/Renderer.php#L107-L124 |
2,325 | pdenis/SnideTravinizerBundle | Reader/ComposerReader.php | ComposerReader.load | public function load($slug, $branch = 'master')
{
$this->data = array();
$this->httpClient->setBaseUrl($this->helper->getRawFileUrl($slug, $branch, ''));
$this->data = $this->getResponse('composer.json');
} | php | public function load($slug, $branch = 'master')
{
$this->data = array();
$this->httpClient->setBaseUrl($this->helper->getRawFileUrl($slug, $branch, ''));
$this->data = $this->getResponse('composer.json');
} | [
"public",
"function",
"load",
"(",
"$",
"slug",
",",
"$",
"branch",
"=",
"'master'",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"httpClient",
"->",
"setBaseUrl",
"(",
"$",
"this",
"->",
"helper",
"->",
"get... | Load Composer data by reading composer.json file
@param string $slug Repository slug
@param string $branch Repository branch
@throws \UnexpectedValueException | [
"Load",
"Composer",
"data",
"by",
"reading",
"composer",
".",
"json",
"file"
] | 53a6fd647280d81a496018d379e4b5c446f81729 | https://github.com/pdenis/SnideTravinizerBundle/blob/53a6fd647280d81a496018d379e4b5c446f81729/Reader/ComposerReader.php#L65-L71 |
2,326 | wazoomie/support | AbstractFactory.php | AbstractFactory.getAttributes | public function getAttributes($key = null)
{
if (!($key)) {
return $this->attributes;
}
return $this->attributes->get($key);
} | php | public function getAttributes($key = null)
{
if (!($key)) {
return $this->attributes;
}
return $this->attributes->get($key);
} | [
"public",
"function",
"getAttributes",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"attributes",
";",
"}",
"return",
"$",
"this",
"->",
"attributes",
"->",
"get",
"(",
"$",
... | Get the attributes.
@param null $key
@return \Illuminate\Support\Collection|mixed | [
"Get",
"the",
"attributes",
"."
] | e0a853558a2dc5acd3dc20ee8071e2ebda283bb7 | https://github.com/wazoomie/support/blob/e0a853558a2dc5acd3dc20ee8071e2ebda283bb7/AbstractFactory.php#L51-L58 |
2,327 | wazoomie/support | AbstractFactory.php | AbstractFactory.process | public function process()
{
$this->data = array_values($this->data);
if (isset($this->data[0])) {
$data = $this->data;
} else {
$data = [$this->data];
}
foreach ($data as $key => $value) {
$model = $this->fill($key, collect($value));
... | php | public function process()
{
$this->data = array_values($this->data);
if (isset($this->data[0])) {
$data = $this->data;
} else {
$data = [$this->data];
}
foreach ($data as $key => $value) {
$model = $this->fill($key, collect($value));
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array_values",
"(",
"$",
"this",
"->",
"data",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"0",
"]",
")",
")",
"{",
"$",
"data",
"=",
"$",
... | Process the raw data and return a collection filled with populated models.
@return \Illuminate\Support\Collection | [
"Process",
"the",
"raw",
"data",
"and",
"return",
"a",
"collection",
"filled",
"with",
"populated",
"models",
"."
] | e0a853558a2dc5acd3dc20ee8071e2ebda283bb7 | https://github.com/wazoomie/support/blob/e0a853558a2dc5acd3dc20ee8071e2ebda283bb7/AbstractFactory.php#L108-L124 |
2,328 | dmeikle/pesedget | src/Gossamer/Pesedget/Commands/GetCommand.php | GetCommand.execute | public function execute($params = array(), $request = array()) {
//$passableParams = $this->httpRequest->getParameters();
//remove the uri
// array_shift($passableParams);
$this->getQueryBuilder()->where($params);
$query = '';
if ($this->entity instanceof AbstractI18nEnt... | php | public function execute($params = array(), $request = array()) {
//$passableParams = $this->httpRequest->getParameters();
//remove the uri
// array_shift($passableParams);
$this->getQueryBuilder()->where($params);
$query = '';
if ($this->entity instanceof AbstractI18nEnt... | [
"public",
"function",
"execute",
"(",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"request",
"=",
"array",
"(",
")",
")",
"{",
"//$passableParams = $this->httpRequest->getParameters();",
"//remove the uri",
"// array_shift($passableParams);",
"$",
"this",
"->",
... | retrieves a single row from the database
@param array URI params
@param array POST params | [
"retrieves",
"a",
"single",
"row",
"from",
"the",
"database"
] | bcfca25569d1f47c073f08906a710ed895f77b4d | https://github.com/dmeikle/pesedget/blob/bcfca25569d1f47c073f08906a710ed895f77b4d/src/Gossamer/Pesedget/Commands/GetCommand.php#L29-L59 |
2,329 | dmeikle/pesedget | src/Gossamer/Pesedget/Commands/GetCommand.php | GetCommand.loadI18nValues | private function loadI18nValues(&$firstResult, $params) {
if (!$this->entity instanceof AbstractI18nEntity) {
return;
}
$filter = array($this->entity->getI18nIdentifier() => $firstResult[0]['id']);
$localesKey = 'locales';
if (is_array($params) && array_key_exists('... | php | private function loadI18nValues(&$firstResult, $params) {
if (!$this->entity instanceof AbstractI18nEntity) {
return;
}
$filter = array($this->entity->getI18nIdentifier() => $firstResult[0]['id']);
$localesKey = 'locales';
if (is_array($params) && array_key_exists('... | [
"private",
"function",
"loadI18nValues",
"(",
"&",
"$",
"firstResult",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"entity",
"instanceof",
"AbstractI18nEntity",
")",
"{",
"return",
";",
"}",
"$",
"filter",
"=",
"array",
"(",
"$",
"... | load child rows from I18n specific to requested entity | [
"load",
"child",
"rows",
"from",
"I18n",
"specific",
"to",
"requested",
"entity"
] | bcfca25569d1f47c073f08906a710ed895f77b4d | https://github.com/dmeikle/pesedget/blob/bcfca25569d1f47c073f08906a710ed895f77b4d/src/Gossamer/Pesedget/Commands/GetCommand.php#L73-L97 |
2,330 | tunaqui-solutions/utils | src/Http/JsonResponse.php | JsonResponse.prepareResult | public function prepareResult($success, $message, $code, $data, $errors) {
$this->success = $success;
$this->code = $code;
$this->message = $message;
if(is_null($this->data)) {
$this->data = array();
} else {
if(!is_array($this->data)) {
$o... | php | public function prepareResult($success, $message, $code, $data, $errors) {
$this->success = $success;
$this->code = $code;
$this->message = $message;
if(is_null($this->data)) {
$this->data = array();
} else {
if(!is_array($this->data)) {
$o... | [
"public",
"function",
"prepareResult",
"(",
"$",
"success",
",",
"$",
"message",
",",
"$",
"code",
",",
"$",
"data",
",",
"$",
"errors",
")",
"{",
"$",
"this",
"->",
"success",
"=",
"$",
"success",
";",
"$",
"this",
"->",
"code",
"=",
"$",
"code",
... | Prepare an response
@param bool $success
@param string $message
@param int $code
@param mixed $data
@param array $errors | [
"Prepare",
"an",
"response"
] | f332f606df2ca4aea17352082182a6b21e859e0f | https://github.com/tunaqui-solutions/utils/blob/f332f606df2ca4aea17352082182a6b21e859e0f/src/Http/JsonResponse.php#L59-L88 |
2,331 | tunaqui-solutions/utils | src/Http/JsonResponse.php | JsonResponse.prepareSuccess | public function prepareSuccess($message, $data=[], $code=200) {
$this->prepareResult(true, $message, $code, $data, null);
} | php | public function prepareSuccess($message, $data=[], $code=200) {
$this->prepareResult(true, $message, $code, $data, null);
} | [
"public",
"function",
"prepareSuccess",
"(",
"$",
"message",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"code",
"=",
"200",
")",
"{",
"$",
"this",
"->",
"prepareResult",
"(",
"true",
",",
"$",
"message",
",",
"$",
"code",
",",
"$",
"data",
",",
"... | Produces a failed response
@param string $message
@param mixed $data
@param int $code | [
"Produces",
"a",
"failed",
"response"
] | f332f606df2ca4aea17352082182a6b21e859e0f | https://github.com/tunaqui-solutions/utils/blob/f332f606df2ca4aea17352082182a6b21e859e0f/src/Http/JsonResponse.php#L96-L98 |
2,332 | tunaqui-solutions/utils | src/Http/JsonResponse.php | JsonResponse.prepareError | public function prepareError($message, $errors=[], $code=404) {
$this->prepareResult(false, $message, $code, null , $errors);
} | php | public function prepareError($message, $errors=[], $code=404) {
$this->prepareResult(false, $message, $code, null , $errors);
} | [
"public",
"function",
"prepareError",
"(",
"$",
"message",
",",
"$",
"errors",
"=",
"[",
"]",
",",
"$",
"code",
"=",
"404",
")",
"{",
"$",
"this",
"->",
"prepareResult",
"(",
"false",
",",
"$",
"message",
",",
"$",
"code",
",",
"null",
",",
"$",
... | Produces a successful response
@param string $message
@param array $errors
@param int $code default 404 | [
"Produces",
"a",
"successful",
"response"
] | f332f606df2ca4aea17352082182a6b21e859e0f | https://github.com/tunaqui-solutions/utils/blob/f332f606df2ca4aea17352082182a6b21e859e0f/src/Http/JsonResponse.php#L106-L108 |
2,333 | tunaqui-solutions/utils | src/Http/JsonResponse.php | JsonResponse.message | public function message($message=null) {
if(is_null($message)) {
return $this->message;
}
$this->message = $message;
} | php | public function message($message=null) {
if(is_null($message)) {
return $this->message;
}
$this->message = $message;
} | [
"public",
"function",
"message",
"(",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"message",
")",
")",
"{",
"return",
"$",
"this",
"->",
"message",
";",
"}",
"$",
"this",
"->",
"message",
"=",
"$",
"message",
";",
"}"
] | Get or Set 'message' attribute
@param null $message
@return string | [
"Get",
"or",
"Set",
"message",
"attribute"
] | f332f606df2ca4aea17352082182a6b21e859e0f | https://github.com/tunaqui-solutions/utils/blob/f332f606df2ca4aea17352082182a6b21e859e0f/src/Http/JsonResponse.php#L160-L165 |
2,334 | tunaqui-solutions/utils | src/Http/JsonResponse.php | JsonResponse.errors | public function errors($errors = null) {
if(is_null($errors)) {
return $this->errors;
}
$this->errors = $errors;
} | php | public function errors($errors = null) {
if(is_null($errors)) {
return $this->errors;
}
$this->errors = $errors;
} | [
"public",
"function",
"errors",
"(",
"$",
"errors",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"errors",
")",
")",
"{",
"return",
"$",
"this",
"->",
"errors",
";",
"}",
"$",
"this",
"->",
"errors",
"=",
"$",
"errors",
";",
"}"
] | Get or Set 'errors' attribute
@param null $errors
@return array | [
"Get",
"or",
"Set",
"errors",
"attribute"
] | f332f606df2ca4aea17352082182a6b21e859e0f | https://github.com/tunaqui-solutions/utils/blob/f332f606df2ca4aea17352082182a6b21e859e0f/src/Http/JsonResponse.php#L184-L189 |
2,335 | digipolisgent/openbib-id-api | src/Value/UserActivities/Expense.php | Expense.fromXml | public static function fromXml(\DOMElement $xml)
{
$static = new static();
$static->libraryItemMetadata = LibraryItemMetadata::fromXml($xml);
$expenseId = $xml->getElementsByTagName('id');
$static->expenseId = StringLiteral::fromXml($expenseId);
$date = $xml->getElementsByT... | php | public static function fromXml(\DOMElement $xml)
{
$static = new static();
$static->libraryItemMetadata = LibraryItemMetadata::fromXml($xml);
$expenseId = $xml->getElementsByTagName('id');
$static->expenseId = StringLiteral::fromXml($expenseId);
$date = $xml->getElementsByT... | [
"public",
"static",
"function",
"fromXml",
"(",
"\\",
"DOMElement",
"$",
"xml",
")",
"{",
"$",
"static",
"=",
"new",
"static",
"(",
")",
";",
"$",
"static",
"->",
"libraryItemMetadata",
"=",
"LibraryItemMetadata",
"::",
"fromXml",
"(",
"$",
"xml",
")",
"... | Builds a Expense object from XML.
@param \DOMElement $xml
The xml element containing the expense.
@return Expense
A Expense object | [
"Builds",
"a",
"Expense",
"object",
"from",
"XML",
"."
] | 79f58dec53a91f44333d10fa4ef79f85f31fc2de | https://github.com/digipolisgent/openbib-id-api/blob/79f58dec53a91f44333d10fa4ef79f85f31fc2de/src/Value/UserActivities/Expense.php#L77-L101 |
2,336 | leoshtika/logger | src/Logger.php | Logger.add | public static function add($message = 'No message', $logCode = self::LEVEL_INFO)
{
// if file pointer doesn't exist, then open log file
if (!self::$_fileHandler) {
self::_openLogFile();
}
// Get user IP
if (!empty($_SERVER['REMOTE_ADDR'])) {
$userIP... | php | public static function add($message = 'No message', $logCode = self::LEVEL_INFO)
{
// if file pointer doesn't exist, then open log file
if (!self::$_fileHandler) {
self::_openLogFile();
}
// Get user IP
if (!empty($_SERVER['REMOTE_ADDR'])) {
$userIP... | [
"public",
"static",
"function",
"add",
"(",
"$",
"message",
"=",
"'No message'",
",",
"$",
"logCode",
"=",
"self",
"::",
"LEVEL_INFO",
")",
"{",
"// if file pointer doesn't exist, then open log file ",
"if",
"(",
"!",
"self",
"::",
"$",
"_fileHandler",
")",
"{"... | Write message to the log file
@param string $message Optional message
@param string $logCode Optional log code (example: INFO (default), ERROR, EMERGENCY) | [
"Write",
"message",
"to",
"the",
"log",
"file"
] | b75b8be0886b9d62cd92b8dffd75362f4603a34b | https://github.com/leoshtika/logger/blob/b75b8be0886b9d62cd92b8dffd75362f4603a34b/src/Logger.php#L47-L75 |
2,337 | leoshtika/logger | src/Logger.php | Logger._crateLogsFolder | private static function _crateLogsFolder()
{
// If folder doesn't exist attempt to create it
if (!file_exists(self::LOGS_FOLDER_PATH)) {
mkdir(self::LOGS_FOLDER_PATH, 0755, true);
$htaccessHandler = fopen(self::LOGS_FOLDER_PATH . '.htaccess', 'w');
fwrite($htacces... | php | private static function _crateLogsFolder()
{
// If folder doesn't exist attempt to create it
if (!file_exists(self::LOGS_FOLDER_PATH)) {
mkdir(self::LOGS_FOLDER_PATH, 0755, true);
$htaccessHandler = fopen(self::LOGS_FOLDER_PATH . '.htaccess', 'w');
fwrite($htacces... | [
"private",
"static",
"function",
"_crateLogsFolder",
"(",
")",
"{",
"// If folder doesn't exist attempt to create it",
"if",
"(",
"!",
"file_exists",
"(",
"self",
"::",
"LOGS_FOLDER_PATH",
")",
")",
"{",
"mkdir",
"(",
"self",
"::",
"LOGS_FOLDER_PATH",
",",
"0755",
... | Create LogsFolder if not exist
This method will create a .htaccess to deny access to logfiles | [
"Create",
"LogsFolder",
"if",
"not",
"exist",
"This",
"method",
"will",
"create",
"a",
".",
"htaccess",
"to",
"deny",
"access",
"to",
"logfiles"
] | b75b8be0886b9d62cd92b8dffd75362f4603a34b | https://github.com/leoshtika/logger/blob/b75b8be0886b9d62cd92b8dffd75362f4603a34b/src/Logger.php#L101-L110 |
2,338 | znframework/package-security | PHP.php | PHP.encode | public static function encode(String $str) : String
{
return str_replace(array_keys(self::$phpTagChars), array_values(self::$phpTagChars), $str);
} | php | public static function encode(String $str) : String
{
return str_replace(array_keys(self::$phpTagChars), array_values(self::$phpTagChars), $str);
} | [
"public",
"static",
"function",
"encode",
"(",
"String",
"$",
"str",
")",
":",
"String",
"{",
"return",
"str_replace",
"(",
"array_keys",
"(",
"self",
"::",
"$",
"phpTagChars",
")",
",",
"array_values",
"(",
"self",
"::",
"$",
"phpTagChars",
")",
",",
"$... | Encode PHP Tag
@param string $str
@return string | [
"Encode",
"PHP",
"Tag"
] | dfced60e243ab9f52a1b5bbdb695bfc39b26cac0 | https://github.com/znframework/package-security/blob/dfced60e243ab9f52a1b5bbdb695bfc39b26cac0/PHP.php#L32-L35 |
2,339 | znframework/package-security | PHP.php | PHP.decode | public static function decode(String $str) : String
{
return str_replace(array_values(self::$phpTagChars), array_keys(self::$phpTagChars), $str);
} | php | public static function decode(String $str) : String
{
return str_replace(array_values(self::$phpTagChars), array_keys(self::$phpTagChars), $str);
} | [
"public",
"static",
"function",
"decode",
"(",
"String",
"$",
"str",
")",
":",
"String",
"{",
"return",
"str_replace",
"(",
"array_values",
"(",
"self",
"::",
"$",
"phpTagChars",
")",
",",
"array_keys",
"(",
"self",
"::",
"$",
"phpTagChars",
")",
",",
"$... | Decode PHP Tag
@param string $str
@return string | [
"Decode",
"PHP",
"Tag"
] | dfced60e243ab9f52a1b5bbdb695bfc39b26cac0 | https://github.com/znframework/package-security/blob/dfced60e243ab9f52a1b5bbdb695bfc39b26cac0/PHP.php#L44-L47 |
2,340 | CatLabInteractive/Mailer | src/CatLab/Mailer/Models/Mail.php | Mail.getHtmlOrText | public function getHtmlOrText()
{
if ($template = $this->getTemplate ()) {
if (!isset ($this->isHTML))
$this->setIsHTML(true);
return $template->parse ();
} else if ($body = $this->getBody ()) {
$this->setIsHTML(true);
return $body;
} else if ($text = $this->getText ()) {
$this->setIsHTML(fals... | php | public function getHtmlOrText()
{
if ($template = $this->getTemplate ()) {
if (!isset ($this->isHTML))
$this->setIsHTML(true);
return $template->parse ();
} else if ($body = $this->getBody ()) {
$this->setIsHTML(true);
return $body;
} else if ($text = $this->getText ()) {
$this->setIsHTML(fals... | [
"public",
"function",
"getHtmlOrText",
"(",
")",
"{",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"getTemplate",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"isHTML",
")",
")",
"$",
"this",
"->",
"setIsHTML",
"(",
... | Return the html body or the text string, and fill in the isHTML property
@return string | [
"Return",
"the",
"html",
"body",
"or",
"the",
"text",
"string",
"and",
"fill",
"in",
"the",
"isHTML",
"property"
] | 701f09e11cfbd68d02ab18655d22a7f19124d2c1 | https://github.com/CatLabInteractive/Mailer/blob/701f09e11cfbd68d02ab18655d22a7f19124d2c1/src/CatLab/Mailer/Models/Mail.php#L119-L135 |
2,341 | psecio/validation | src/Check.php | Check.get | public function get($name = null)
{
if ($name !== null) {
return (isset($this->addl[$name])) ? $this->addl[$name] : null;
} else {
return $this->addl;
}
} | php | public function get($name = null)
{
if ($name !== null) {
return (isset($this->addl[$name])) ? $this->addl[$name] : null;
} else {
return $this->addl;
}
} | [
"public",
"function",
"get",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"null",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"addl",
"[",
"$",
"name",
"]",
")",
")",
"?",
"$",
"this",
"->",
"addl",
"[... | Get a value from the additional value set
If the "name" value is given, it tries to locate the value, returns null if not found
If no "name" is given, returns all values
@param string $name Name of value to locate [optional]
@return mixed Either all values, the value if found or null if not found | [
"Get",
"a",
"value",
"from",
"the",
"additional",
"value",
"set",
"If",
"the",
"name",
"value",
"is",
"given",
"it",
"tries",
"to",
"locate",
"the",
"value",
"returns",
"null",
"if",
"not",
"found",
"If",
"no",
"name",
"is",
"given",
"returns",
"all",
... | 79497de45e872f838b1e1398489f2e0f8167fa70 | https://github.com/psecio/validation/blob/79497de45e872f838b1e1398489f2e0f8167fa70/src/Check.php#L90-L97 |
2,342 | psecio/validation | src/Check.php | Check.getMessage | public function getMessage($name = null)
{
if ($name === null) {
return $this->message;
}
return str_replace(':name', $name, $this->message);
} | php | public function getMessage($name = null)
{
if ($name === null) {
return $this->message;
}
return str_replace(':name', $name, $this->message);
} | [
"public",
"function",
"getMessage",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"message",
";",
"}",
"return",
"str_replace",
"(",
"':name'",
",",
"$",
"name",
",",
"$",
"th... | Get the value of the message for the check
@param string $name Key name for the field
@return string Formatted/default message | [
"Get",
"the",
"value",
"of",
"the",
"message",
"for",
"the",
"check"
] | 79497de45e872f838b1e1398489f2e0f8167fa70 | https://github.com/psecio/validation/blob/79497de45e872f838b1e1398489f2e0f8167fa70/src/Check.php#L115-L121 |
2,343 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-stdlib/src/PriorityQueue.php | PriorityQueue.toArray | public function toArray($flag = self::EXTR_DATA)
{
switch ($flag) {
case self::EXTR_BOTH:
return $this->items;
case self::EXTR_PRIORITY:
return array_map(function ($item) {
return $item['priority'];
}, $this->items);... | php | public function toArray($flag = self::EXTR_DATA)
{
switch ($flag) {
case self::EXTR_BOTH:
return $this->items;
case self::EXTR_PRIORITY:
return array_map(function ($item) {
return $item['priority'];
}, $this->items);... | [
"public",
"function",
"toArray",
"(",
"$",
"flag",
"=",
"self",
"::",
"EXTR_DATA",
")",
"{",
"switch",
"(",
"$",
"flag",
")",
"{",
"case",
"self",
"::",
"EXTR_BOTH",
":",
"return",
"$",
"this",
"->",
"items",
";",
"case",
"self",
"::",
"EXTR_PRIORITY",... | Serialize to an array
By default, returns only the item data, and in the order registered (not
sorted). You may provide one of the EXTR_* flags as an argument, allowing
the ability to return priorities or both data and priority.
@param int $flag
@return array | [
"Serialize",
"to",
"an",
"array"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-stdlib/src/PriorityQueue.php#L206-L221 |
2,344 | glendmaatita/Tolkien | src/Tolkien/CompileSite.php | CompileSite.compile | public function compile()
{
$this->rrmdir($this->config['dir']['site']);
$this->compilePosts();
$this->compilePages();
$this->compileCategories();
$this->compileAssets();
$this->compilePaginations();
$this->compileAuthors();
} | php | public function compile()
{
$this->rrmdir($this->config['dir']['site']);
$this->compilePosts();
$this->compilePages();
$this->compileCategories();
$this->compileAssets();
$this->compilePaginations();
$this->compileAuthors();
} | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"this",
"->",
"rrmdir",
"(",
"$",
"this",
"->",
"config",
"[",
"'dir'",
"]",
"[",
"'site'",
"]",
")",
";",
"$",
"this",
"->",
"compilePosts",
"(",
")",
";",
"$",
"this",
"->",
"compilePages",
"("... | Main function to compile
@return void | [
"Main",
"function",
"to",
"compile"
] | e7c27a103f1a87411dfb8eef626cba381b27d233 | https://github.com/glendmaatita/Tolkien/blob/e7c27a103f1a87411dfb8eef626cba381b27d233/src/Tolkien/CompileSite.php#L44-L53 |
2,345 | glendmaatita/Tolkien | src/Tolkien/CompileSite.php | CompileSite.compileCategories | public function compileCategories()
{
foreach ($this->site->getCategories() as $category)
{
$template = $this->twig->loadTemplate( 'category.html.tpl' );
$content = $template->render(array('site' => $this->site, 'category' => $category));
$this->createFile($content, $category);
}
} | php | public function compileCategories()
{
foreach ($this->site->getCategories() as $category)
{
$template = $this->twig->loadTemplate( 'category.html.tpl' );
$content = $template->render(array('site' => $this->site, 'category' => $category));
$this->createFile($content, $category);
}
} | [
"public",
"function",
"compileCategories",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"site",
"->",
"getCategories",
"(",
")",
"as",
"$",
"category",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"twig",
"->",
"loadTemplate",
"(",
"'category.... | Compile Site Categories
@return void | [
"Compile",
"Site",
"Categories"
] | e7c27a103f1a87411dfb8eef626cba381b27d233 | https://github.com/glendmaatita/Tolkien/blob/e7c27a103f1a87411dfb8eef626cba381b27d233/src/Tolkien/CompileSite.php#L90-L98 |
2,346 | glendmaatita/Tolkien | src/Tolkien/CompileSite.php | CompileSite.compileAuthors | public function compileAuthors()
{
foreach ($this->site->getAuthors() as $author)
{
$template = $this->twig->loadTemplate( 'author.html.tpl' );
$content = $template->render(array('site' => $this->site, 'author' => $author));
$this->createFile($content, $author);
}
} | php | public function compileAuthors()
{
foreach ($this->site->getAuthors() as $author)
{
$template = $this->twig->loadTemplate( 'author.html.tpl' );
$content = $template->render(array('site' => $this->site, 'author' => $author));
$this->createFile($content, $author);
}
} | [
"public",
"function",
"compileAuthors",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"site",
"->",
"getAuthors",
"(",
")",
"as",
"$",
"author",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"twig",
"->",
"loadTemplate",
"(",
"'author.html.tpl'"... | Compile authors page
@return void | [
"Compile",
"authors",
"page"
] | e7c27a103f1a87411dfb8eef626cba381b27d233 | https://github.com/glendmaatita/Tolkien/blob/e7c27a103f1a87411dfb8eef626cba381b27d233/src/Tolkien/CompileSite.php#L105-L113 |
2,347 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configshow | static function Configshow(PHP_ParserGenerator_Config $cfp)
{
$fp = fopen('php://output', 'w');
while ($cfp) {
if ($cfp->dot == $cfp->rp->nrhs) {
$buf = sprintf('(%d)', $cfp->rp->index);
fprintf($fp, ' %5s ', $buf);
} else {
... | php | static function Configshow(PHP_ParserGenerator_Config $cfp)
{
$fp = fopen('php://output', 'w');
while ($cfp) {
if ($cfp->dot == $cfp->rp->nrhs) {
$buf = sprintf('(%d)', $cfp->rp->index);
fprintf($fp, ' %5s ', $buf);
} else {
... | [
"static",
"function",
"Configshow",
"(",
"PHP_ParserGenerator_Config",
"$",
"cfp",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"'php://output'",
",",
"'w'",
")",
";",
"while",
"(",
"$",
"cfp",
")",
"{",
"if",
"(",
"$",
"cfp",
"->",
"dot",
"==",
"$",
"cfp... | Display the current configuration for the .out file
@param PHP_ParserGenerator_Config $cfp
@see PHP_ParserGenerator_Data::ReportOutput() | [
"Display",
"the",
"current",
"configuration",
"for",
"the",
".",
"out",
"file"
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L194-L215 |
2,348 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_init | static function Configlist_init()
{
self::$current = 0;
self::$currentend = &self::$current;
self::$basis = 0;
self::$basisend = &self::$basis;
self::$x4a = array();
} | php | static function Configlist_init()
{
self::$current = 0;
self::$currentend = &self::$current;
self::$basis = 0;
self::$basisend = &self::$basis;
self::$x4a = array();
} | [
"static",
"function",
"Configlist_init",
"(",
")",
"{",
"self",
"::",
"$",
"current",
"=",
"0",
";",
"self",
"::",
"$",
"currentend",
"=",
"&",
"self",
"::",
"$",
"current",
";",
"self",
"::",
"$",
"basis",
"=",
"0",
";",
"self",
"::",
"$",
"basise... | Initialize the configuration list builder for a new state. | [
"Initialize",
"the",
"configuration",
"list",
"builder",
"for",
"a",
"new",
"state",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L220-L227 |
2,349 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configtable_reset | static function Configtable_reset($f)
{
self::$current = 0;
self::$currentend = &self::$current;
self::$basis = 0;
self::$basisend = &self::$basis;
self::Configtable_clear(0);
} | php | static function Configtable_reset($f)
{
self::$current = 0;
self::$currentend = &self::$current;
self::$basis = 0;
self::$basisend = &self::$basis;
self::Configtable_clear(0);
} | [
"static",
"function",
"Configtable_reset",
"(",
"$",
"f",
")",
"{",
"self",
"::",
"$",
"current",
"=",
"0",
";",
"self",
"::",
"$",
"currentend",
"=",
"&",
"self",
"::",
"$",
"current",
";",
"self",
"::",
"$",
"basis",
"=",
"0",
";",
"self",
"::",
... | Remove all data from the table.
Pass each data to the function $f as it is removed if
$f is a valid callback.
@param callback|null
@see Configtable_clear() | [
"Remove",
"all",
"data",
"from",
"the",
"table",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L237-L244 |
2,350 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configtable_clear | static function Configtable_clear($f)
{
if (!count(self::$x4a)) {
return;
}
if ($f) {
for ($i = 0; $i < count(self::$x4a); $i++) {
call_user_func($f, self::$x4a[$i]->data);
}
}
self::$x4a = array();
} | php | static function Configtable_clear($f)
{
if (!count(self::$x4a)) {
return;
}
if ($f) {
for ($i = 0; $i < count(self::$x4a); $i++) {
call_user_func($f, self::$x4a[$i]->data);
}
}
self::$x4a = array();
} | [
"static",
"function",
"Configtable_clear",
"(",
"$",
"f",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"self",
"::",
"$",
"x4a",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"f",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<"... | Remove all data from the associative array representation
of configurations.
Pass each data to the function $f as it is removed if
$f is a valid callback.
@param callback|null | [
"Remove",
"all",
"data",
"from",
"the",
"associative",
"array",
"representation",
"of",
"configurations",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L254-L265 |
2,351 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_add | static function Configlist_add($rp, $dot)
{
$model = new PHP_ParserGenerator_Config;
$model->rp = $rp;
$model->dot = $dot;
$cfp = self::Configtable_find($model);
if ($cfp === 0) {
$cfp = self::newconfig();
$cfp->rp = $rp;
$cfp->dot = $dot;
... | php | static function Configlist_add($rp, $dot)
{
$model = new PHP_ParserGenerator_Config;
$model->rp = $rp;
$model->dot = $dot;
$cfp = self::Configtable_find($model);
if ($cfp === 0) {
$cfp = self::newconfig();
$cfp->rp = $rp;
$cfp->dot = $dot;
... | [
"static",
"function",
"Configlist_add",
"(",
"$",
"rp",
",",
"$",
"dot",
")",
"{",
"$",
"model",
"=",
"new",
"PHP_ParserGenerator_Config",
";",
"$",
"model",
"->",
"rp",
"=",
"$",
"rp",
";",
"$",
"model",
"->",
"dot",
"=",
"$",
"dot",
";",
"$",
"cf... | Add another configuration to the configuration list for this parser state.
@param PHP_ParserGenerator_Rule the rule
@param int Index into the right-hand side of the rule where the dot goes
@return PHP_ParserGenerator_Config | [
"Add",
"another",
"configuration",
"to",
"the",
"configuration",
"list",
"for",
"this",
"parser",
"state",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L282-L302 |
2,352 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_closure | static function Configlist_closure(PHP_ParserGenerator_Data $lemp)
{
for ($cfp = self::$current; $cfp; $cfp = $cfp->next) {
$rp = $cfp->rp;
$dot = $cfp->dot;
if ($dot >= $rp->nrhs) {
continue;
}
$sp = $rp->rhs[$dot];
if ... | php | static function Configlist_closure(PHP_ParserGenerator_Data $lemp)
{
for ($cfp = self::$current; $cfp; $cfp = $cfp->next) {
$rp = $cfp->rp;
$dot = $cfp->dot;
if ($dot >= $rp->nrhs) {
continue;
}
$sp = $rp->rhs[$dot];
if ... | [
"static",
"function",
"Configlist_closure",
"(",
"PHP_ParserGenerator_Data",
"$",
"lemp",
")",
"{",
"for",
"(",
"$",
"cfp",
"=",
"self",
"::",
"$",
"current",
";",
"$",
"cfp",
";",
"$",
"cfp",
"=",
"$",
"cfp",
"->",
"next",
")",
"{",
"$",
"rp",
"=",
... | Compute the closure of the configuration list.
This calculates all of the possible continuations of
each configuration, ensuring that each state accounts
for every configuration that could arrive at that state. | [
"Compute",
"the",
"closure",
"of",
"the",
"configuration",
"list",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L345-L386 |
2,353 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_return | static function Configlist_return()
{
$old = self::$current;
self::$current = 0;
self::$currentend = &self::$current;
return $old;
} | php | static function Configlist_return()
{
$old = self::$current;
self::$current = 0;
self::$currentend = &self::$current;
return $old;
} | [
"static",
"function",
"Configlist_return",
"(",
")",
"{",
"$",
"old",
"=",
"self",
"::",
"$",
"current",
";",
"self",
"::",
"$",
"current",
"=",
"0",
";",
"self",
"::",
"$",
"currentend",
"=",
"&",
"self",
"::",
"$",
"current",
";",
"return",
"$",
... | Return a pointer to the head of the configuration list and
reset the list
@see $current
@return PHP_ParserGenerator_Config | [
"Return",
"a",
"pointer",
"to",
"the",
"head",
"of",
"the",
"configuration",
"list",
"and",
"reset",
"the",
"list"
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L420-L426 |
2,354 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_basis | static function Configlist_basis()
{
$old = self::$basis;
self::$basis = 0;
self::$basisend = &self::$basis;
return $old;
} | php | static function Configlist_basis()
{
$old = self::$basis;
self::$basis = 0;
self::$basisend = &self::$basis;
return $old;
} | [
"static",
"function",
"Configlist_basis",
"(",
")",
"{",
"$",
"old",
"=",
"self",
"::",
"$",
"basis",
";",
"self",
"::",
"$",
"basis",
"=",
"0",
";",
"self",
"::",
"$",
"basisend",
"=",
"&",
"self",
"::",
"$",
"basis",
";",
"return",
"$",
"old",
... | Return a pointer to the head of the basis list and
reset the list
@see $basis
@return PHP_ParserGenerator_Config | [
"Return",
"a",
"pointer",
"to",
"the",
"head",
"of",
"the",
"basis",
"list",
"and",
"reset",
"the",
"list"
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L434-L440 |
2,355 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configlist_eat | static function Configlist_eat($cfp)
{
for (; $cfp; $cfp = $nextcfp) {
$nextcfp = $cfp->next;
if ($cfp->fplp !=0) {
throw new Exception('fplp of configuration non-zero?');
}
if ($cfp->bplp !=0) {
throw new Exception('bplp of con... | php | static function Configlist_eat($cfp)
{
for (; $cfp; $cfp = $nextcfp) {
$nextcfp = $cfp->next;
if ($cfp->fplp !=0) {
throw new Exception('fplp of configuration non-zero?');
}
if ($cfp->bplp !=0) {
throw new Exception('bplp of con... | [
"static",
"function",
"Configlist_eat",
"(",
"$",
"cfp",
")",
"{",
"for",
"(",
";",
"$",
"cfp",
";",
"$",
"cfp",
"=",
"$",
"nextcfp",
")",
"{",
"$",
"nextcfp",
"=",
"$",
"cfp",
"->",
"next",
";",
"if",
"(",
"$",
"cfp",
"->",
"fplp",
"!=",
"0",
... | Free all elements of the given configuration list
@param PHP_ParserGenerator_Config | [
"Free",
"all",
"elements",
"of",
"the",
"given",
"configuration",
"list"
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L446-L460 |
2,356 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.Configcmp | static function Configcmp($a, $b)
{
$x = $a->rp->index - $b->rp->index;
if (!$x) {
$x = $a->dot - $b->dot;
}
return $x;
} | php | static function Configcmp($a, $b)
{
$x = $a->rp->index - $b->rp->index;
if (!$x) {
$x = $a->dot - $b->dot;
}
return $x;
} | [
"static",
"function",
"Configcmp",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"$",
"x",
"=",
"$",
"a",
"->",
"rp",
"->",
"index",
"-",
"$",
"b",
"->",
"rp",
"->",
"index",
";",
"if",
"(",
"!",
"$",
"x",
")",
"{",
"$",
"x",
"=",
"$",
"a",
"... | Compare two configurations for sorting purposes.
Configurations based on higher precedence rules
(those earlier in the file) are chosen first. Two
configurations that are the same rule are sorted by
dot (see {@link $dot}), and those configurations
with a dot closer to the left-hand side are chosen first.
@param unkno... | [
"Compare",
"two",
"configurations",
"for",
"sorting",
"purposes",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L474-L481 |
2,357 | rodchyn/elephant-lang | lib/ParserGenerator/PHP/ParserGenerator/Config.php | PHP_ParserGenerator_Config.ConfigPrint | function ConfigPrint($fp)
{
$rp = $this->rp;
fprintf($fp, "%s ::=", $rp->lhs->name);
for ($i = 0; $i <= $rp->nrhs; $i++) {
if ($i === $this->dot) {
fwrite($fp,' *');
}
if ($i === $rp->nrhs) {
break;
}
... | php | function ConfigPrint($fp)
{
$rp = $this->rp;
fprintf($fp, "%s ::=", $rp->lhs->name);
for ($i = 0; $i <= $rp->nrhs; $i++) {
if ($i === $this->dot) {
fwrite($fp,' *');
}
if ($i === $rp->nrhs) {
break;
}
... | [
"function",
"ConfigPrint",
"(",
"$",
"fp",
")",
"{",
"$",
"rp",
"=",
"$",
"this",
"->",
"rp",
";",
"fprintf",
"(",
"$",
"fp",
",",
"\"%s ::=\"",
",",
"$",
"rp",
"->",
"lhs",
"->",
"name",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
... | Print out information on this configuration.
@param resource $fp
@see PHP_ParserGenerator_Data::ReportOutput() | [
"Print",
"out",
"information",
"on",
"this",
"configuration",
"."
] | e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf | https://github.com/rodchyn/elephant-lang/blob/e0acc26eec1ab4dbfcc90ad79efc23318eaba5cf/lib/ParserGenerator/PHP/ParserGenerator/Config.php#L489-L508 |
2,358 | Stratadox/HydrationMapping | src/Property/Relationship/ProxyProductionFailed.php | ProxyProductionFailed.tryingToProduceFor | public static function tryingToProduceFor(
MapsProperty $mapping,
Throwable $exception
): Throwable {
return new self(
sprintf(
'Proxy production for in the `%s` property failed: %s',
$mapping->name(),
$exception->getMessage()
... | php | public static function tryingToProduceFor(
MapsProperty $mapping,
Throwable $exception
): Throwable {
return new self(
sprintf(
'Proxy production for in the `%s` property failed: %s',
$mapping->name(),
$exception->getMessage()
... | [
"public",
"static",
"function",
"tryingToProduceFor",
"(",
"MapsProperty",
"$",
"mapping",
",",
"Throwable",
"$",
"exception",
")",
":",
"Throwable",
"{",
"return",
"new",
"self",
"(",
"sprintf",
"(",
"'Proxy production for in the `%s` property failed: %s'",
",",
"$",... | Notifies the client code when an item could not be hydrated.
@param MapsProperty $mapping The proxy mapping that failed.
@param Throwable $exception The exception that was encountered.
@return Throwable The proxy production failure. | [
"Notifies",
"the",
"client",
"code",
"when",
"an",
"item",
"could",
"not",
"be",
"hydrated",
"."
] | b145deaaf76ab8c8060f0cba1a8c6f73da375982 | https://github.com/Stratadox/HydrationMapping/blob/b145deaaf76ab8c8060f0cba1a8c6f73da375982/src/Property/Relationship/ProxyProductionFailed.php#L27-L40 |
2,359 | OWeb/OWeb-Framework | OWeb/defaults/controllers/OWeb/Helpers/Form/Elements/AbstractElement.php | AbstractElement.validate | public function validate(){
if(empty($this->_validators)){
$this->_valid = true;
return true;
}
$valid = false;
$newValue = null;
foreach ($this->_validators as $validator) {
try{
$newGeneratedValue = $validator->valideteValue($this->getVal());
if(!$valid)
$newValue = $newGenerated... | php | public function validate(){
if(empty($this->_validators)){
$this->_valid = true;
return true;
}
$valid = false;
$newValue = null;
foreach ($this->_validators as $validator) {
try{
$newGeneratedValue = $validator->valideteValue($this->getVal());
if(!$valid)
$newValue = $newGenerated... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_validators",
")",
")",
"{",
"$",
"this",
"->",
"_valid",
"=",
"true",
";",
"return",
"true",
";",
"}",
"$",
"valid",
"=",
"false",
";",
"$",
"newValue",
... | Will start the validation procees.
@return boolean Whatever the validation was sucessfull or not | [
"Will",
"start",
"the",
"validation",
"procees",
"."
] | fb441f51afb16860b0c946a55c36c789fbb125fa | https://github.com/OWeb/OWeb-Framework/blob/fb441f51afb16860b0c946a55c36c789fbb125fa/OWeb/defaults/controllers/OWeb/Helpers/Form/Elements/AbstractElement.php#L195-L225 |
2,360 | milkyway-multimedia/ss-mwm-core | code/Core/Extensions/DataObject.php | DataObject.firstOrMake | public function firstOrMake($filter = [], $additionalData = [], $write = true)
{
if (!($record = $this->owner->get()->filter($filter)->first())) {
$record = $this->owner->create(array_merge($filter, $additionalData));
if ($write) {
$record->write();
$... | php | public function firstOrMake($filter = [], $additionalData = [], $write = true)
{
if (!($record = $this->owner->get()->filter($filter)->first())) {
$record = $this->owner->create(array_merge($filter, $additionalData));
if ($write) {
$record->write();
$... | [
"public",
"function",
"firstOrMake",
"(",
"$",
"filter",
"=",
"[",
"]",
",",
"$",
"additionalData",
"=",
"[",
"]",
",",
"$",
"write",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"record",
"=",
"$",
"this",
"->",
"owner",
"->",
"get",
"(",
... | Find a record using a filter, or create it if it doesn't exist
@param array $filter
@param array $additionalData
@param bool|true $write
@return static | [
"Find",
"a",
"record",
"using",
"a",
"filter",
"or",
"create",
"it",
"if",
"it",
"doesn",
"t",
"exist"
] | e7216653b7100ead5a7d56736a124bee1c76fcd5 | https://github.com/milkyway-multimedia/ss-mwm-core/blob/e7216653b7100ead5a7d56736a124bee1c76fcd5/code/Core/Extensions/DataObject.php#L36-L48 |
2,361 | milkyway-multimedia/ss-mwm-core | code/Core/Extensions/DataObject.php | DataObject.firstOrCreate | public function firstOrCreate($filter = [], $additionalData = [], $write = true)
{
return $this->owner->firstOrMake($filter, $additionalData, $write);
} | php | public function firstOrCreate($filter = [], $additionalData = [], $write = true)
{
return $this->owner->firstOrMake($filter, $additionalData, $write);
} | [
"public",
"function",
"firstOrCreate",
"(",
"$",
"filter",
"=",
"[",
"]",
",",
"$",
"additionalData",
"=",
"[",
"]",
",",
"$",
"write",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"firstOrMake",
"(",
"$",
"filter",
",",
"$",
... | Alias of ->firstOrMake
@param array $filter
@param array $additionalData
@param bool|true $write
@return static | [
"Alias",
"of",
"-",
">",
"firstOrMake"
] | e7216653b7100ead5a7d56736a124bee1c76fcd5 | https://github.com/milkyway-multimedia/ss-mwm-core/blob/e7216653b7100ead5a7d56736a124bee1c76fcd5/code/Core/Extensions/DataObject.php#L58-L61 |
2,362 | hubkat/hubkat.event | src/Event.php | Event.isValid | public function isValid($secret)
{
if (!extension_loaded('hash')) {
// @codeCoverageIgnoreStart
throw new \Exception('Hash extension not loaded');
// @codeCoverageIgnoreEnd
}
list($algo, $sig) = explode("=", $this->signature);
if (!in_array($algo... | php | public function isValid($secret)
{
if (!extension_loaded('hash')) {
// @codeCoverageIgnoreStart
throw new \Exception('Hash extension not loaded');
// @codeCoverageIgnoreEnd
}
list($algo, $sig) = explode("=", $this->signature);
if (!in_array($algo... | [
"public",
"function",
"isValid",
"(",
"$",
"secret",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'hash'",
")",
")",
"{",
"// @codeCoverageIgnoreStart",
"throw",
"new",
"\\",
"Exception",
"(",
"'Hash extension not loaded'",
")",
";",
"// @codeCoverageIgnore... | Validate the signature
@param string $secret secret string
@return bool
@access public | [
"Validate",
"the",
"signature"
] | 6b752c305e81f9ee5176bd7ac26127e68637fca6 | https://github.com/hubkat/hubkat.event/blob/6b752c305e81f9ee5176bd7ac26127e68637fca6/src/Event.php#L87-L104 |
2,363 | bytic/helpers | src/Color.php | Nip_Helper_Color.lumDiff | public function lumDiff($color1, $color2)
{
list($R1, $G1, $B1) = is_array($color1) ? $color1 : $this->rgb($color1);
list($R2, $G2, $B2) = is_array($color2) ? $color2 : $this->rgb($color2);
$L1 = 0.2126 * pow($R1 / 255, 2.2) +
0.7152 * pow($G1 / 255, 2.2) +
0.0722 * ... | php | public function lumDiff($color1, $color2)
{
list($R1, $G1, $B1) = is_array($color1) ? $color1 : $this->rgb($color1);
list($R2, $G2, $B2) = is_array($color2) ? $color2 : $this->rgb($color2);
$L1 = 0.2126 * pow($R1 / 255, 2.2) +
0.7152 * pow($G1 / 255, 2.2) +
0.0722 * ... | [
"public",
"function",
"lumDiff",
"(",
"$",
"color1",
",",
"$",
"color2",
")",
"{",
"list",
"(",
"$",
"R1",
",",
"$",
"G1",
",",
"$",
"B1",
")",
"=",
"is_array",
"(",
"$",
"color1",
")",
"?",
"$",
"color1",
":",
"$",
"this",
"->",
"rgb",
"(",
... | Uses luminosity to calculate the difference between the given colors.
The returned value should be bigger than 5 for best readability.
@param string|array $color1
@param string|array $color2
@return double | [
"Uses",
"luminosity",
"to",
"calculate",
"the",
"difference",
"between",
"the",
"given",
"colors",
".",
"The",
"returned",
"value",
"should",
"be",
"bigger",
"than",
"5",
"for",
"best",
"readability",
"."
] | 6a4f0388ba8653d65058ce63cf7627e38b9df041 | https://github.com/bytic/helpers/blob/6a4f0388ba8653d65058ce63cf7627e38b9df041/src/Color.php#L1700-L1718 |
2,364 | fond-of/active-campaign | src/Service.php | Service.getFormParams | protected function getFormParams($parameters = array())
{
$formParams = $parameters;
if (!array_key_exists('api_output', $formParams)) {
$formParams['api_output'] = Api::DEFAULT_OUTPUT;
}
if (!array_key_exists('api_key', $formParams)) {
$formParams['api_key'... | php | protected function getFormParams($parameters = array())
{
$formParams = $parameters;
if (!array_key_exists('api_output', $formParams)) {
$formParams['api_output'] = Api::DEFAULT_OUTPUT;
}
if (!array_key_exists('api_key', $formParams)) {
$formParams['api_key'... | [
"protected",
"function",
"getFormParams",
"(",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"formParams",
"=",
"$",
"parameters",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'api_output'",
",",
"$",
"formParams",
")",
")",
"{",
"$",
"form... | Get form params
@param array $parameters
@return array | [
"Get",
"form",
"params"
] | 389e6c3ca4e39f2f94f92a9673fe3207a9d15807 | https://github.com/fond-of/active-campaign/blob/389e6c3ca4e39f2f94f92a9673fe3207a9d15807/src/Service.php#L137-L150 |
2,365 | fond-of/active-campaign | src/Service.php | Service.removeResultInformation | protected function removeResultInformation($json) {
$object = json_decode($json, false);
if (property_exists($object, 'result_code')) {
unset($object->result_code);
}
if (property_exists($object, 'result_message')) {
unset($object->result_message);
}
... | php | protected function removeResultInformation($json) {
$object = json_decode($json, false);
if (property_exists($object, 'result_code')) {
unset($object->result_code);
}
if (property_exists($object, 'result_message')) {
unset($object->result_message);
}
... | [
"protected",
"function",
"removeResultInformation",
"(",
"$",
"json",
")",
"{",
"$",
"object",
"=",
"json_decode",
"(",
"$",
"json",
",",
"false",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"'result_code'",
")",
")",
"{",
"unset",
"... | Remove result information
@param $json
@return string | [
"Remove",
"result",
"information"
] | 389e6c3ca4e39f2f94f92a9673fe3207a9d15807 | https://github.com/fond-of/active-campaign/blob/389e6c3ca4e39f2f94f92a9673fe3207a9d15807/src/Service.php#L171-L187 |
2,366 | lucidphp/signal | src/EventName.php | EventName.parseEventName | private function parseEventName()
{
$name = basename(strtr(get_class($this->event), ['\\' => '/']));
return strtolower(preg_replace('#[A-Z]#', '.$0', lcfirst($name)));
} | php | private function parseEventName()
{
$name = basename(strtr(get_class($this->event), ['\\' => '/']));
return strtolower(preg_replace('#[A-Z]#', '.$0', lcfirst($name)));
} | [
"private",
"function",
"parseEventName",
"(",
")",
"{",
"$",
"name",
"=",
"basename",
"(",
"strtr",
"(",
"get_class",
"(",
"$",
"this",
"->",
"event",
")",
",",
"[",
"'\\\\'",
"=>",
"'/'",
"]",
")",
")",
";",
"return",
"strtolower",
"(",
"preg_replace"... | Parses an event object into a readable event name.
@return string | [
"Parses",
"an",
"event",
"object",
"into",
"a",
"readable",
"event",
"name",
"."
] | 387c545f95d077dda726469c68a464509990a1f0 | https://github.com/lucidphp/signal/blob/387c545f95d077dda726469c68a464509990a1f0/src/EventName.php#L80-L85 |
2,367 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.processError | public function processError($exception, $type = 'exception', $logonly = false, $forcelogtrace = false) {
// log information
// error function is from the trait . It will log something if there is logger inited
$this->countoferrors++;
if ($this->countoferrors > 500) {
// if there are so many errors th... | php | public function processError($exception, $type = 'exception', $logonly = false, $forcelogtrace = false) {
// log information
// error function is from the trait . It will log something if there is logger inited
$this->countoferrors++;
if ($this->countoferrors > 500) {
// if there are so many errors th... | [
"public",
"function",
"processError",
"(",
"$",
"exception",
",",
"$",
"type",
"=",
"'exception'",
",",
"$",
"logonly",
"=",
"false",
",",
"$",
"forcelogtrace",
"=",
"false",
")",
"{",
"// log information ",
"// error function is from the trait . It will log something... | The function logs an error and desides what to show to a user
It can be called from outside or from internal methods in case of warning or fatal error
@param Exception $exception An exception to log and display
@param string $type Type of exception error. Possible values: exception, warning, fatal
@return boolean | [
"The",
"function",
"logs",
"an",
"error",
"and",
"desides",
"what",
"to",
"show",
"to",
"a",
"user",
"It",
"can",
"be",
"called",
"from",
"outside",
"or",
"from",
"internal",
"methods",
"in",
"case",
"of",
"warning",
"or",
"fatal",
"error"
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L260-L321 |
2,368 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.getHTMLError | public function getHTMLError($exception) {
$html = '<div style="position: absolute; top:0; right:0; width:100%; height:100%; background: #ffffff;">'."\n".
'<table align="center" style="width:65%; margin-top: 30px; background: #FFCC66;" cellpadding="10" cellspacing="1" border="0">'."\n".
'<tr>'."\n".
'<td st... | php | public function getHTMLError($exception) {
$html = '<div style="position: absolute; top:0; right:0; width:100%; height:100%; background: #ffffff;">'."\n".
'<table align="center" style="width:65%; margin-top: 30px; background: #FFCC66;" cellpadding="10" cellspacing="1" border="0">'."\n".
'<tr>'."\n".
'<td st... | [
"public",
"function",
"getHTMLError",
"(",
"$",
"exception",
")",
"{",
"$",
"html",
"=",
"'<div style=\"position: absolute; top:0; right:0; width:100%; height:100%; background: #ffffff;\">'",
".",
"\"\\n\"",
".",
"'<table align=\"center\" style=\"width:65%; margin-top: 30px; background... | Build HTML to display error
@param Exception $exception Exception to show message from
@return string HTML of the error screen | [
"Build",
"HTML",
"to",
"display",
"error"
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L346-L370 |
2,369 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.showHTTP | protected function showHTTP($exception) {
header("HTTP/1.1 400 Unexpected error");
$message = preg_replace('![^a-z 0-9_-]!','',$this->getMessageForUser($exception));
header("X-Error-Message: ".$message);
} | php | protected function showHTTP($exception) {
header("HTTP/1.1 400 Unexpected error");
$message = preg_replace('![^a-z 0-9_-]!','',$this->getMessageForUser($exception));
header("X-Error-Message: ".$message);
} | [
"protected",
"function",
"showHTTP",
"(",
"$",
"exception",
")",
"{",
"header",
"(",
"\"HTTP/1.1 400 Unexpected error\"",
")",
";",
"$",
"message",
"=",
"preg_replace",
"(",
"'![^a-z 0-9_-]!'",
",",
"''",
",",
"$",
"this",
"->",
"getMessageForUser",
"(",
"$",
... | Return to user only headers with an error as part of a header | [
"Return",
"to",
"user",
"only",
"headers",
"with",
"an",
"error",
"as",
"part",
"of",
"a",
"header"
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L374-L378 |
2,370 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.showXML | protected function showXML($exception) {
$endline = "\r\n";
$xml = '<?xml version="1.0" encoding="UTF-8"?>'.$endline.
'<response>'.$endline.
'<status>error</status>'.$endline.
'<message>'.htmlspecialchars($this->getMessageForUser($exception)).'</message>'.$endline.
'</response>';
header('Conten... | php | protected function showXML($exception) {
$endline = "\r\n";
$xml = '<?xml version="1.0" encoding="UTF-8"?>'.$endline.
'<response>'.$endline.
'<status>error</status>'.$endline.
'<message>'.htmlspecialchars($this->getMessageForUser($exception)).'</message>'.$endline.
'</response>';
header('Conten... | [
"protected",
"function",
"showXML",
"(",
"$",
"exception",
")",
"{",
"$",
"endline",
"=",
"\"\\r\\n\"",
";",
"$",
"xml",
"=",
"'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'",
".",
"$",
"endline",
".",
"'<response>'",
".",
"$",
"endline",
".",
"'<status>error</statu... | Display error in XML format
@param Exception $exception Exception to show message from | [
"Display",
"error",
"in",
"XML",
"format"
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L394-L404 |
2,371 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.warningHandler | public function warningHandler($errno, $errstr, $errfile, $errline) {
if ($errno != E_WARNING && $errno != E_USER_WARNING) {
return false;
}
$message = "WARNING! [$errno] $errstr. Line $errline in file $errfile. ";
// because some more problems can happen during logging or display
// better to disabl... | php | public function warningHandler($errno, $errstr, $errfile, $errline) {
if ($errno != E_WARNING && $errno != E_USER_WARNING) {
return false;
}
$message = "WARNING! [$errno] $errstr. Line $errline in file $errfile. ";
// because some more problems can happen during logging or display
// better to disabl... | [
"public",
"function",
"warningHandler",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"if",
"(",
"$",
"errno",
"!=",
"E_WARNING",
"&&",
"$",
"errno",
"!=",
"E_USER_WARNING",
")",
"{",
"return",
"false",
";",... | To catch warnings. Notices are ignored in this function.
This is the callback for a function set_error_handler | [
"To",
"catch",
"warnings",
".",
"Notices",
"are",
"ignored",
"in",
"this",
"function",
".",
"This",
"is",
"the",
"callback",
"for",
"a",
"function",
"set_error_handler"
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L409-L425 |
2,372 | Gelembjuk/logger | src/Gelembjuk/Logger/ErrorScreen.php | ErrorScreen.getRequestInformation | protected function getRequestInformation() {
$postdata = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// build a request string
$t = array();
foreach ($_POST as $k => $v) {
$t[] = $k . '=' . $v;
}
// make a one line string
$postdata = preg_replace('![\n\r]!',"",implode('&',$t));
... | php | protected function getRequestInformation() {
$postdata = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// build a request string
$t = array();
foreach ($_POST as $k => $v) {
$t[] = $k . '=' . $v;
}
// make a one line string
$postdata = preg_replace('![\n\r]!',"",implode('&',$t));
... | [
"protected",
"function",
"getRequestInformation",
"(",
")",
"{",
"$",
"postdata",
"=",
"''",
";",
"if",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
"==",
"'POST'",
")",
"{",
"// build a request string",
"$",
"t",
"=",
"array",
"(",
")",
";",
"foreac... | Collect request information to log it. This can help to solve a problem later.
@return string Requets information, for logging | [
"Collect",
"request",
"information",
"to",
"log",
"it",
".",
"This",
"can",
"help",
"to",
"solve",
"a",
"problem",
"later",
"."
] | ab7aa3c27f5190908bbd4d11451fd7332d9f920d | https://github.com/Gelembjuk/logger/blob/ab7aa3c27f5190908bbd4d11451fd7332d9f920d/src/Gelembjuk/Logger/ErrorScreen.php#L464-L494 |
2,373 | harmony-project/modular-routing | source/Provider/SegmentProvider.php | SegmentProvider.matchRequest | protected function matchRequest(Request $request, array $parameters = [])
{
if (!isset($parameters['_modular_path'])) {
throw new \InvalidArgumentException('The routing provider expected parameter "_modular_path" but could not find it.');
}
// Grab the first segment from the rem... | php | protected function matchRequest(Request $request, array $parameters = [])
{
if (!isset($parameters['_modular_path'])) {
throw new \InvalidArgumentException('The routing provider expected parameter "_modular_path" but could not find it.');
}
// Grab the first segment from the rem... | [
"protected",
"function",
"matchRequest",
"(",
"Request",
"$",
"request",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"parameters",
"[",
"'_modular_path'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Inval... | Filters the module identity from the request path.
@param Request $request The request to match
@param array $parameters Parameters returned by an UrlMatcher
@return string
@throws \InvalidArgumentException If the "_modular_path" parameter is not set | [
"Filters",
"the",
"module",
"identity",
"from",
"the",
"request",
"path",
"."
] | 399bb427678ddc17c67295c738b96faea485e2d8 | https://github.com/harmony-project/modular-routing/blob/399bb427678ddc17c67295c738b96faea485e2d8/source/Provider/SegmentProvider.php#L114-L125 |
2,374 | Rehyved/php-utilities | src/Rehyved/Utilities/Base64Url.php | Base64Url.encode | public static function encode($arg)
{
$s = base64_encode($arg); // Standard base64 encoder
$s = explode('=', $s)[0]; // Remove any trailing '='s
$s = str_replace('+', '-', $s); // 62nd char of encoding
$s = str_replace('/', '_', $s); //63rd char of encoding
return $s;
} | php | public static function encode($arg)
{
$s = base64_encode($arg); // Standard base64 encoder
$s = explode('=', $s)[0]; // Remove any trailing '='s
$s = str_replace('+', '-', $s); // 62nd char of encoding
$s = str_replace('/', '_', $s); //63rd char of encoding
return $s;
} | [
"public",
"static",
"function",
"encode",
"(",
"$",
"arg",
")",
"{",
"$",
"s",
"=",
"base64_encode",
"(",
"$",
"arg",
")",
";",
"// Standard base64 encoder",
"$",
"s",
"=",
"explode",
"(",
"'='",
",",
"$",
"s",
")",
"[",
"0",
"]",
";",
"// Remove any... | Encodes the specified byte array.
@param $arg
@return mixed|string | [
"Encodes",
"the",
"specified",
"byte",
"array",
"."
] | fae3754576eab4cf33ad99c5143aa1f972c325bd | https://github.com/Rehyved/php-utilities/blob/fae3754576eab4cf33ad99c5143aa1f972c325bd/src/Rehyved/Utilities/Base64Url.php#L13-L22 |
2,375 | Rehyved/php-utilities | src/Rehyved/Utilities/Base64Url.php | Base64Url.decode | public static function decode(string $arg)
{
$s = $arg;
$s = str_replace('-', '+', $s);
$s = str_replace('_', '/', $s);
switch (strlen($s) % 4) {
case 0:
break;
case 2:
$s .= "==";
break;
case 3:
... | php | public static function decode(string $arg)
{
$s = $arg;
$s = str_replace('-', '+', $s);
$s = str_replace('_', '/', $s);
switch (strlen($s) % 4) {
case 0:
break;
case 2:
$s .= "==";
break;
case 3:
... | [
"public",
"static",
"function",
"decode",
"(",
"string",
"$",
"arg",
")",
"{",
"$",
"s",
"=",
"$",
"arg",
";",
"$",
"s",
"=",
"str_replace",
"(",
"'-'",
",",
"'+'",
",",
"$",
"s",
")",
";",
"$",
"s",
"=",
"str_replace",
"(",
"'_'",
",",
"'/'",
... | Decodes the specified string.
@param string $arg
@return bool|string
@throws \Exception Illegal base64url string | [
"Decodes",
"the",
"specified",
"string",
"."
] | fae3754576eab4cf33ad99c5143aa1f972c325bd | https://github.com/Rehyved/php-utilities/blob/fae3754576eab4cf33ad99c5143aa1f972c325bd/src/Rehyved/Utilities/Base64Url.php#L30-L50 |
2,376 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.setAllHeaders | public function setAllHeaders(array $headerArray)
{
foreach ($headerArray as $field => $value) {
$this->setHeader($field, $value);
}
return $this;
} | php | public function setAllHeaders(array $headerArray)
{
foreach ($headerArray as $field => $value) {
$this->setHeader($field, $value);
}
return $this;
} | [
"public",
"function",
"setAllHeaders",
"(",
"array",
"$",
"headerArray",
")",
"{",
"foreach",
"(",
"$",
"headerArray",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setHeader",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"... | Set multiple headers from a key-value array
Existing values matching the specified field are replaced.
Header field names are NOT case-sensitive.
@param array
@throws \InvalidArgumentException
@return Response Returns the current object instance | [
"Set",
"multiple",
"headers",
"from",
"a",
"key",
"-",
"value",
"array"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L84-L91 |
2,377 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.setHeader | public function setHeader($field, $value)
{
if (!$field = @trim($field)) {
throw new HTTPException(
'Non-empty string field name required at Argument 1'
);
}
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE') {
$this->s... | php | public function setHeader($field, $value)
{
if (!$field = @trim($field)) {
throw new HTTPException(
'Non-empty string field name required at Argument 1'
);
}
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE') {
$this->s... | [
"public",
"function",
"setHeader",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"=",
"@",
"trim",
"(",
"$",
"field",
")",
")",
"{",
"throw",
"new",
"HTTPException",
"(",
"'Non-empty string field name required at Argument 1'",... | Assign a header value
Existing values matching the specified field are replaced.
Header field names are NOT case-sensitive.
@param string $field
@param string $value
@throws \InvalidArgumentException
@return Response Returns the current object instance | [
"Assign",
"a",
"header",
"value"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L104-L136 |
2,378 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.addHeader | public function addHeader($field, $value)
{
if ($this->hasHeader($field)) {
$existing = $this->getHeader($field);
$existing = is_array($existing) ? $existing : [$existing];
$value = is_scalar($value) ? [$value] : $value;
$newHeaders = array_merge($existing, $v... | php | public function addHeader($field, $value)
{
if ($this->hasHeader($field)) {
$existing = $this->getHeader($field);
$existing = is_array($existing) ? $existing : [$existing];
$value = is_scalar($value) ? [$value] : $value;
$newHeaders = array_merge($existing, $v... | [
"public",
"function",
"addHeader",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasHeader",
"(",
"$",
"field",
")",
")",
"{",
"$",
"existing",
"=",
"$",
"this",
"->",
"getHeader",
"(",
"$",
"field",
")",
";",
"$"... | Append a header value
The header value is appended to existing fields with the same name.
Header field names are NOT case-sensitive.
@param string $field
@param string $value
@throws \InvalidArgumentException
@return Response Returns the current object instance | [
"Append",
"a",
"header",
"value"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L296-L309 |
2,379 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.hasHeader | public function hasHeader($field)
{
$ucField = strtoupper($field);
return isset($this->ucHeaders[$ucField]) || ($ucField === 'SET-COOKIE' && $this->cookies);
} | php | public function hasHeader($field)
{
$ucField = strtoupper($field);
return isset($this->ucHeaders[$ucField]) || ($ucField === 'SET-COOKIE' && $this->cookies);
} | [
"public",
"function",
"hasHeader",
"(",
"$",
"field",
")",
"{",
"$",
"ucField",
"=",
"strtoupper",
"(",
"$",
"field",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"ucHeaders",
"[",
"$",
"ucField",
"]",
")",
"||",
"(",
"$",
"ucField",
"===",
... | Does the response currently have a value for the specified header field?
Header field names are NOT case-sensitive.
@param string $field
@return bool | [
"Does",
"the",
"response",
"currently",
"have",
"a",
"value",
"for",
"the",
"specified",
"header",
"field?"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L319-L324 |
2,380 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.removeHeader | public function removeHeader($field)
{
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE') {
$this->cookies = [];
} elseif (isset($this->ucHeaders[$ucField])) {
$field = $this->ucHeaders[$ucField];
unset(
$this->ucHeaders[$ucFiel... | php | public function removeHeader($field)
{
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE') {
$this->cookies = [];
} elseif (isset($this->ucHeaders[$ucField])) {
$field = $this->ucHeaders[$ucField];
unset(
$this->ucHeaders[$ucFiel... | [
"public",
"function",
"removeHeader",
"(",
"$",
"field",
")",
"{",
"$",
"ucField",
"=",
"strtoupper",
"(",
"$",
"field",
")",
";",
"if",
"(",
"$",
"ucField",
"===",
"'SET-COOKIE'",
")",
"{",
"$",
"this",
"->",
"cookies",
"=",
"[",
"]",
";",
"}",
"e... | Removes assigned headers for the specified field
Header field names are NOT case-sensitive.
@param string $field
@return Response Returns the current object instance | [
"Removes",
"assigned",
"headers",
"for",
"the",
"specified",
"field"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L334-L349 |
2,381 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.setCookie | public function setCookie($name, $value = '', array $options = [])
{
$value = urlencode($value);
$this->assignCookieHeader($name, $value, $options);
return $this;
} | php | public function setCookie($name, $value = '', array $options = [])
{
$value = urlencode($value);
$this->assignCookieHeader($name, $value, $options);
return $this;
} | [
"public",
"function",
"setCookie",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"value",
"=",
"urlencode",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"assignCookieHeader",
"(",
"$"... | Set a cookie value to be sent with the response.
Cookie values will be available upon the client's next request. Extended cookie options
beyond the name-value pair may be specified using individual keys in the $options array:
[
'expire' => 0, // Expiration time (unix timestamp) for this cookie
'path' => '', ... | [
"Set",
"a",
"cookie",
"value",
"to",
"be",
"sent",
"with",
"the",
"response",
"."
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L384-L390 |
2,382 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.getHeader | public function getHeader($field)
{
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE' && $this->cookies) {
$result = array_values($this->cookies);
} elseif (isset($this->ucHeaders[$ucField])) {
$field = $this->ucHeaders[$ucField];
$result = $th... | php | public function getHeader($field)
{
$ucField = strtoupper($field);
if ($ucField === 'SET-COOKIE' && $this->cookies) {
$result = array_values($this->cookies);
} elseif (isset($this->ucHeaders[$ucField])) {
$field = $this->ucHeaders[$ucField];
$result = $th... | [
"public",
"function",
"getHeader",
"(",
"$",
"field",
")",
"{",
"$",
"ucField",
"=",
"strtoupper",
"(",
"$",
"field",
")",
";",
"if",
"(",
"$",
"ucField",
"===",
"'SET-COOKIE'",
"&&",
"$",
"this",
"->",
"cookies",
")",
"{",
"$",
"result",
"=",
"array... | Retrieve assigned header values for the specified field
If only one value is assigned for the specified field, that scalar value is returned. If
multiple values are assigned for the field an array of scalars is returned.
@param string $field
@throws \DomainException
@return string|array | [
"Retrieve",
"assigned",
"header",
"values",
"for",
"the",
"specified",
"field"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L488-L504 |
2,383 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.setBody | public function setBody(Body $body)
{
$this->body = $body;
$this->setAllHeaders($body->getHeaders());
$this->setStatus($body->getStatusCode());
return $this;
} | php | public function setBody(Body $body)
{
$this->body = $body;
$this->setAllHeaders($body->getHeaders());
$this->setStatus($body->getStatusCode());
return $this;
} | [
"public",
"function",
"setBody",
"(",
"Body",
"$",
"body",
")",
"{",
"$",
"this",
"->",
"body",
"=",
"$",
"body",
";",
"$",
"this",
"->",
"setAllHeaders",
"(",
"$",
"body",
"->",
"getHeaders",
"(",
")",
")",
";",
"$",
"this",
"->",
"setStatus",
"("... | Assign a response entity body
@param null|string|callable|Body $body
@throws \InvalidArgumentException
@return Response Returns the current object instance | [
"Assign",
"a",
"response",
"entity",
"body"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L513-L520 |
2,384 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.getAllHeaders | public function getAllHeaders()
{
$headers = $this->headers;
if ($this->cookies) {
$headers['Set-Cookie'] = array_values($this->cookies);
}
return $headers;
} | php | public function getAllHeaders()
{
$headers = $this->headers;
if ($this->cookies) {
$headers['Set-Cookie'] = array_values($this->cookies);
}
return $headers;
} | [
"public",
"function",
"getAllHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"headers",
";",
"if",
"(",
"$",
"this",
"->",
"cookies",
")",
"{",
"$",
"headers",
"[",
"'Set-Cookie'",
"]",
"=",
"array_values",
"(",
"$",
"this",
"->",
"c... | Retrieve an array mapping header field names to their assigned values
@return array | [
"Retrieve",
"an",
"array",
"mapping",
"header",
"field",
"names",
"to",
"their",
"assigned",
"values"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L527-L535 |
2,385 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.getAllHeaderLines | public function getAllHeaderLines()
{
$headers = [];
foreach ($this->getAllHeaders() as $field => $valueArray) {
foreach ($valueArray as $value) {
$headers[] = "{$field}: $value";
}
}
return $headers;
} | php | public function getAllHeaderLines()
{
$headers = [];
foreach ($this->getAllHeaders() as $field => $valueArray) {
foreach ($valueArray as $value) {
$headers[] = "{$field}: $value";
}
}
return $headers;
} | [
"public",
"function",
"getAllHeaderLines",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAllHeaders",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"valueArray",
")",
"{",
"foreach",
"(",
"$",
"valueArray",
"as",
... | Retrieve an array of header strings appropriate for output
@return array | [
"Retrieve",
"an",
"array",
"of",
"header",
"strings",
"appropriate",
"for",
"output"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L542-L552 |
2,386 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.import | public function import(Response $response)
{
$this->clear();
foreach ($response->toArray() as $key => $value) {
$this->offsetSet($key, $value);
}
return $this;
} | php | public function import(Response $response)
{
$this->clear();
foreach ($response->toArray() as $key => $value) {
$this->offsetSet($key, $value);
}
return $this;
} | [
"public",
"function",
"import",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"foreach",
"(",
"$",
"response",
"->",
"toArray",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
... | Import values from external Response instance
Calling import() will clear all previously assigned values before assigning those from the
new Response instance.
@param \Room11\HTTP\Response $response
@return Response Returns the current object instance | [
"Import",
"values",
"from",
"external",
"Response",
"instance"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L583-L591 |
2,387 | Danack/HTTP | src/Room11/HTTP/Response/Response.php | Response.clear | public function clear()
{
$this->status = 200;
$this->reasonPhrase = '';
$this->headers = [];
$this->ucHeaders = [];
$this->cookies = [];
$this->body = null;
$this->asgiMap = [];
return $this;
} | php | public function clear()
{
$this->status = 200;
$this->reasonPhrase = '';
$this->headers = [];
$this->ucHeaders = [];
$this->cookies = [];
$this->body = null;
$this->asgiMap = [];
return $this;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"status",
"=",
"200",
";",
"$",
"this",
"->",
"reasonPhrase",
"=",
"''",
";",
"$",
"this",
"->",
"headers",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"ucHeaders",
"=",
"[",
"]",
";",
... | Remove all assigned values and reset defaults
@return Response Returns the current object instance | [
"Remove",
"all",
"assigned",
"values",
"and",
"reset",
"defaults"
] | c4e19668b21de0c00bfaa1e0d1a18175764fd966 | https://github.com/Danack/HTTP/blob/c4e19668b21de0c00bfaa1e0d1a18175764fd966/src/Room11/HTTP/Response/Response.php#L624-L635 |
2,388 | Palmabit-IT/authenticator | src/Palmabit/Authentication/Presenters/GroupPresenter.php | GroupPresenter.permissions_obj | public function permissions_obj($model = null) {
$model = $model ? $model : new Permission;
$objs = [];
$permissions = $this->resource->permissions;
if (!empty($permissions)) {
foreach ($permissions as $permission => $status) {
$objs[] = (!$model::wherePermission($permission)->get()->isEmp... | php | public function permissions_obj($model = null) {
$model = $model ? $model : new Permission;
$objs = [];
$permissions = $this->resource->permissions;
if (!empty($permissions)) {
foreach ($permissions as $permission => $status) {
$objs[] = (!$model::wherePermission($permission)->get()->isEmp... | [
"public",
"function",
"permissions_obj",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"model",
"=",
"$",
"model",
"?",
"$",
"model",
":",
"new",
"Permission",
";",
"$",
"objs",
"=",
"[",
"]",
";",
"$",
"permissions",
"=",
"$",
"this",
"->",
"reso... | Obtains the permission obj associated to the model
@param null $model
@return array | [
"Obtains",
"the",
"permission",
"obj",
"associated",
"to",
"the",
"model"
] | 986cfc7e666e0e1b0312e518d586ec61b08cdb42 | https://github.com/Palmabit-IT/authenticator/blob/986cfc7e666e0e1b0312e518d586ec61b08cdb42/src/Palmabit/Authentication/Presenters/GroupPresenter.php#L16-L26 |
2,389 | harvestcloud/CoreBundle | Controller/Buyer/CartController.php | CartController.addProductAction | public function addProductAction(Product $product, $quantity, Request $request)
{
// Find OrderCollection
$orderCollection = $this->getCurrentCart();
$quantity = array_key_exists('quantity', $_POST) ? (int) $_POST['quantity'] : $quantity;
try
{
if ('-' == $reque... | php | public function addProductAction(Product $product, $quantity, Request $request)
{
// Find OrderCollection
$orderCollection = $this->getCurrentCart();
$quantity = array_key_exists('quantity', $_POST) ? (int) $_POST['quantity'] : $quantity;
try
{
if ('-' == $reque... | [
"public",
"function",
"addProductAction",
"(",
"Product",
"$",
"product",
",",
"$",
"quantity",
",",
"Request",
"$",
"request",
")",
"{",
"// Find OrderCollection",
"$",
"orderCollection",
"=",
"$",
"this",
"->",
"getCurrentCart",
"(",
")",
";",
"$",
"quantity... | add Product to Cart
@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since 2012-04-09
@Route("/cart/add-product/{id}/{quantity}")
@ParamConverter("product", class="HarvestCloudCoreBundle:Product")
@param Product $product
@param Request $request | [
"add",
"Product",
"to",
"Cart"
] | f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc | https://github.com/harvestcloud/CoreBundle/blob/f33e079c4a6191cf674aa2678f2fb2e6f0dd89cc/Controller/Buyer/CartController.php#L110-L165 |
2,390 | budkit/budkit-framework | src/Budkit/Session/Registry.php | Registry.set | final public function set($varname, $value)
{
//If its lock we can't edit
if ($this->lock)
return false;
//Continue
$previous = isset($this->data[$varname]) ? $this->data[$varname] : null;
$this->data[$varname] = $value;
//what to do with previous?
... | php | final public function set($varname, $value)
{
//If its lock we can't edit
if ($this->lock)
return false;
//Continue
$previous = isset($this->data[$varname]) ? $this->data[$varname] : null;
$this->data[$varname] = $value;
//what to do with previous?
... | [
"final",
"public",
"function",
"set",
"(",
"$",
"varname",
",",
"$",
"value",
")",
"{",
"//If its lock we can't edit",
"if",
"(",
"$",
"this",
"->",
"lock",
")",
"return",
"false",
";",
"//Continue",
"$",
"previous",
"=",
"isset",
"(",
"$",
"this",
"->",... | Adds a value to the registry
@param type $varname
@param type $value
@return Registry | [
"Adds",
"a",
"value",
"to",
"the",
"registry"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Session/Registry.php#L68-L82 |
2,391 | budkit/budkit-framework | src/Budkit/Session/Registry.php | Registry.get | final public function get($varname)
{
$previous = isset($this->data[$varname]) ? $this->data[$varname] : null;
return $previous;
} | php | final public function get($varname)
{
$previous = isset($this->data[$varname]) ? $this->data[$varname] : null;
return $previous;
} | [
"final",
"public",
"function",
"get",
"(",
"$",
"varname",
")",
"{",
"$",
"previous",
"=",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"varname",
"]",
")",
"?",
"$",
"this",
"->",
"data",
"[",
"$",
"varname",
"]",
":",
"null",
";",
"return... | Gets the value of an item in the registry
@param type $varname
@return type | [
"Gets",
"the",
"value",
"of",
"an",
"item",
"in",
"the",
"registry"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Session/Registry.php#L100-L105 |
2,392 | budkit/budkit-framework | src/Budkit/Session/Registry.php | Registry.lock | final public function lock()
{
if (!isset($this->name) || empty($this->name) || ($this->name === 'default')) {
//@TODO throw exception, namespace cannot be locked;
return false;
}
//echo $this->name." is ".$locked;
$this->lock = TRUE;
} | php | final public function lock()
{
if (!isset($this->name) || empty($this->name) || ($this->name === 'default')) {
//@TODO throw exception, namespace cannot be locked;
return false;
}
//echo $this->name." is ".$locked;
$this->lock = TRUE;
} | [
"final",
"public",
"function",
"lock",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"name",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"name",
")",
"||",
"(",
"$",
"this",
"->",
"name",
"===",
"'default'",
")",
")",
"{",
"//... | Locks the registry
@return void | [
"Locks",
"the",
"registry"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Session/Registry.php#L122-L130 |
2,393 | AyeAyeApi/Formatters | src/Reader/Xml.php | Xml.read | public function read($string)
{
try {
$wasUsingErrors = libxml_use_internal_errors();
@$xmlObject = simplexml_load_string($string);
libxml_use_internal_errors($wasUsingErrors);
if ($xmlObject) {
return $this->recurseToArray($xmlObject);
... | php | public function read($string)
{
try {
$wasUsingErrors = libxml_use_internal_errors();
@$xmlObject = simplexml_load_string($string);
libxml_use_internal_errors($wasUsingErrors);
if ($xmlObject) {
return $this->recurseToArray($xmlObject);
... | [
"public",
"function",
"read",
"(",
"$",
"string",
")",
"{",
"try",
"{",
"$",
"wasUsingErrors",
"=",
"libxml_use_internal_errors",
"(",
")",
";",
"@",
"$",
"xmlObject",
"=",
"simplexml_load_string",
"(",
"$",
"string",
")",
";",
"libxml_use_internal_errors",
"(... | Attempt to read an XML document
@param string $string
@return array|null | [
"Attempt",
"to",
"read",
"an",
"XML",
"document"
] | 0141d0186e0555f7583be419f22280ac7ed24a6f | https://github.com/AyeAyeApi/Formatters/blob/0141d0186e0555f7583be419f22280ac7ed24a6f/src/Reader/Xml.php#L29-L42 |
2,394 | AyeAyeApi/Formatters | src/Reader/Xml.php | Xml.recurseToArray | protected function recurseToArray($object)
{
if (is_scalar($object)) {
return $object;
}
$array = (array)$object;
foreach ($array as &$value) {
if (!is_scalar(($value))) {
$value = $this->recurseToArray($value);
continue;
... | php | protected function recurseToArray($object)
{
if (is_scalar($object)) {
return $object;
}
$array = (array)$object;
foreach ($array as &$value) {
if (!is_scalar(($value))) {
$value = $this->recurseToArray($value);
continue;
... | [
"protected",
"function",
"recurseToArray",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"object",
")",
")",
"{",
"return",
"$",
"object",
";",
"}",
"$",
"array",
"=",
"(",
"array",
")",
"$",
"object",
";",
"foreach",
"(",
"$",
"a... | Recurse through non scalars turning them into arrays, just returns scalars as is.
@param $object
@return mixed | [
"Recurse",
"through",
"non",
"scalars",
"turning",
"them",
"into",
"arrays",
"just",
"returns",
"scalars",
"as",
"is",
"."
] | 0141d0186e0555f7583be419f22280ac7ed24a6f | https://github.com/AyeAyeApi/Formatters/blob/0141d0186e0555f7583be419f22280ac7ed24a6f/src/Reader/Xml.php#L49-L62 |
2,395 | tekkla/core-security | Core/Security/User/UserHandler.php | UserHandler.loadUser | public function loadUser(User $user)
{
// Guests do not have a user id. So do not try to load data for guests.
if ($user->isGuest()) {
return;
}
$this->db->qb([
'table' => $this->table,
'field' => [
'username',
'dis... | php | public function loadUser(User $user)
{
// Guests do not have a user id. So do not try to load data for guests.
if ($user->isGuest()) {
return;
}
$this->db->qb([
'table' => $this->table,
'field' => [
'username',
'dis... | [
"public",
"function",
"loadUser",
"(",
"User",
"$",
"user",
")",
"{",
"// Guests do not have a user id. So do not try to load data for guests.",
"if",
"(",
"$",
"user",
"->",
"isGuest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"db",
"->",
"qb... | Loads user from DB.
Takes care about not to load a user more than once
@param User $user | [
"Loads",
"user",
"from",
"DB",
"."
] | 66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582 | https://github.com/tekkla/core-security/blob/66a09ca63a2f5a2239ea7537d2d6bdaa89b0a582/Core/Security/User/UserHandler.php#L136-L213 |
2,396 | gourmet/common | View/Helper/TableHelper.php | TableHelper._extractAttributes | protected function _extractAttributes($str) {
$str = preg_replace("/[\x{00a0}\x{200b}]+/u", ' ', $str);
$attributes = array();
$patterns = array(
'name-value-quotes-dble' => '(\w+)\s*=\s*"([^"]*)"',
'name-value-quotes-sgle' => "(\w+)\s*=\s*'([^']*)'",
'name-value-quotes-none' => '(\w+)\s*=\s*([^\s\'"]+)'... | php | protected function _extractAttributes($str) {
$str = preg_replace("/[\x{00a0}\x{200b}]+/u", ' ', $str);
$attributes = array();
$patterns = array(
'name-value-quotes-dble' => '(\w+)\s*=\s*"([^"]*)"',
'name-value-quotes-sgle' => "(\w+)\s*=\s*'([^']*)'",
'name-value-quotes-none' => '(\w+)\s*=\s*([^\s\'"]+)'... | [
"protected",
"function",
"_extractAttributes",
"(",
"$",
"str",
")",
"{",
"$",
"str",
"=",
"preg_replace",
"(",
"\"/[\\x{00a0}\\x{200b}]+/u\"",
",",
"' '",
",",
"$",
"str",
")",
";",
"$",
"attributes",
"=",
"array",
"(",
")",
";",
"$",
"patterns",
"=",
"... | Extract attributes from string.
@param string $str String to parse.
@return array Attributes. | [
"Extract",
"attributes",
"from",
"string",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/View/Helper/TableHelper.php#L265-L299 |
2,397 | gourmet/common | View/Helper/TableHelper.php | TableHelper._renderCell | protected function _renderCell($str, $data) {
// The order is VERY important.
$str = $this->_replaceData($str, $data);
$str = $this->_replaceEval($str);
$str = $this->_replaceData($str, $data);
$str = $this->_replaceCurrency($str);
$str = $this->_replaceTime($str);
$str = $this->_replaceTranslate($str);
... | php | protected function _renderCell($str, $data) {
// The order is VERY important.
$str = $this->_replaceData($str, $data);
$str = $this->_replaceEval($str);
$str = $this->_replaceData($str, $data);
$str = $this->_replaceCurrency($str);
$str = $this->_replaceTime($str);
$str = $this->_replaceTranslate($str);
... | [
"protected",
"function",
"_renderCell",
"(",
"$",
"str",
",",
"$",
"data",
")",
"{",
"// The order is VERY important.",
"$",
"str",
"=",
"$",
"this",
"->",
"_replaceData",
"(",
"$",
"str",
",",
"$",
"data",
")",
";",
"$",
"str",
"=",
"$",
"this",
"->",... | Render table's cell.
@param string $str Cell's content.
@param array $data Cell's row data.
@return Table cell's HTML. | [
"Render",
"table",
"s",
"cell",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/View/Helper/TableHelper.php#L308-L321 |
2,398 | gourmet/common | View/Helper/TableHelper.php | TableHelper._renderHeaders | protected function _renderHeaders($options, $tag = 'thead') {
$th = array();
foreach ($options['columns'] as $name => $thOptions) {
$thOptions = Hash::merge(
$this->__colDefaults,
array('th' => $options['th']['attrs']),
$thOptions
);
if (false !== $options['paginate'] && false !== $thOptions['... | php | protected function _renderHeaders($options, $tag = 'thead') {
$th = array();
foreach ($options['columns'] as $name => $thOptions) {
$thOptions = Hash::merge(
$this->__colDefaults,
array('th' => $options['th']['attrs']),
$thOptions
);
if (false !== $options['paginate'] && false !== $thOptions['... | [
"protected",
"function",
"_renderHeaders",
"(",
"$",
"options",
",",
"$",
"tag",
"=",
"'thead'",
")",
"{",
"$",
"th",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"options",
"[",
"'columns'",
"]",
"as",
"$",
"name",
"=>",
"$",
"thOptions",
")",
... | Render table's headers row.
@param array $options Table's options.
@param string $tag Optional. Tag to group header's content. Options: 'thead' or 'tfoot'.
@return string Table's header or footer HTML. | [
"Render",
"table",
"s",
"headers",
"row",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/View/Helper/TableHelper.php#L330-L363 |
2,399 | gourmet/common | View/Helper/TableHelper.php | TableHelper._renderPagination | public function _renderPagination($options) {
if ($this->Paginator->request->params['paging'][$this->Paginator->defaultModel()]['pageCount'] < 2) {
return '';
}
if (CakePlugin::loaded('TwitterBootstrap')) {
}
$out = array();
$paginate = $options['paginate'];
$prev = $paginate['prev'];
$next = $pag... | php | public function _renderPagination($options) {
if ($this->Paginator->request->params['paging'][$this->Paginator->defaultModel()]['pageCount'] < 2) {
return '';
}
if (CakePlugin::loaded('TwitterBootstrap')) {
}
$out = array();
$paginate = $options['paginate'];
$prev = $paginate['prev'];
$next = $pag... | [
"public",
"function",
"_renderPagination",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Paginator",
"->",
"request",
"->",
"params",
"[",
"'paging'",
"]",
"[",
"$",
"this",
"->",
"Paginator",
"->",
"defaultModel",
"(",
")",
"]",
"[",
"... | Render table's pagination row.
@param array $options Table's options.
@return string Table's pagination HTML. | [
"Render",
"table",
"s",
"pagination",
"row",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/View/Helper/TableHelper.php#L371-L424 |
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.