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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7,300 | svanderburg/pndp | src/PNDP/NixGenerator.php | NixGenerator.generateIndentation | public static function generateIndentation($indentLevel, $format)
{
if($format)
{
$expr = "";
for($i = 0; $i < $indentLevel; $i++)
$expr .= " ";
return $expr;
}
else
return "";
} | php | public static function generateIndentation($indentLevel, $format)
{
if($format)
{
$expr = "";
for($i = 0; $i < $indentLevel; $i++)
$expr .= " ";
return $expr;
}
else
return "";
} | [
"public",
"static",
"function",
"generateIndentation",
"(",
"$",
"indentLevel",
",",
"$",
"format",
")",
"{",
"if",
"(",
"$",
"format",
")",
"{",
"$",
"expr",
"=",
"\"\"",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"indentLevel",... | Generates indentation to format the resulting output expression more nicely.
@param int $indentLevel The indentation level of the resulting sub expression
@param bool $format Indicates whether to nicely format to expression (i.e. generating whitespaces) or not
@return string A string with the amount of whitespaces cor... | [
"Generates",
"indentation",
"to",
"format",
"the",
"resulting",
"output",
"expression",
"more",
"nicely",
"."
] | 4bfe9c4120c23354ab8dc295957dc3009a39bff0 | https://github.com/svanderburg/pndp/blob/4bfe9c4120c23354ab8dc295957dc3009a39bff0/src/PNDP/NixGenerator.php#L20-L32 |
7,301 | svanderburg/pndp | src/PNDP/NixGenerator.php | NixGenerator.sequentialArrayToIndentedNix | public static function sequentialArrayToIndentedNix(array $array, $indentLevel, $format)
{
if(count($array) == 0)
return "[]"; // Not strictly required, but printing an empty list like this is better than putting a newline between the brackets
else
{
$expr = "[\n";
foreach($array as $value)
{
$l... | php | public static function sequentialArrayToIndentedNix(array $array, $indentLevel, $format)
{
if(count($array) == 0)
return "[]"; // Not strictly required, but printing an empty list like this is better than putting a newline between the brackets
else
{
$expr = "[\n";
foreach($array as $value)
{
$l... | [
"public",
"static",
"function",
"sequentialArrayToIndentedNix",
"(",
"array",
"$",
"array",
",",
"$",
"indentLevel",
",",
"$",
"format",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array",
")",
"==",
"0",
")",
"return",
"\"[]\"",
";",
"// Not strictly required,... | Converts an array to a Nix list.
@param array $array Array to convert
@param int $indentLevel The indentation level of the resulting sub expression
@param bool $format Indicates whether to nicely format to expression (i.e. generating whitespaces) or not
@return A string representing the corresponding Nix list | [
"Converts",
"an",
"array",
"to",
"a",
"Nix",
"list",
"."
] | 4bfe9c4120c23354ab8dc295957dc3009a39bff0 | https://github.com/svanderburg/pndp/blob/4bfe9c4120c23354ab8dc295957dc3009a39bff0/src/PNDP/NixGenerator.php#L61-L85 |
7,302 | svanderburg/pndp | src/PNDP/NixGenerator.php | NixGenerator.arrayMembersToAttrsMembers | public static function arrayMembersToAttrsMembers(array $array, $indentLevel, $format)
{
$expr = "";
/* Convert inherit objects separately, since they have to be generated differently */
$first = true;
$haveInherits = false;
$previousInherit = null;
foreach($array as $key => $value)
{
if($value ins... | php | public static function arrayMembersToAttrsMembers(array $array, $indentLevel, $format)
{
$expr = "";
/* Convert inherit objects separately, since they have to be generated differently */
$first = true;
$haveInherits = false;
$previousInherit = null;
foreach($array as $key => $value)
{
if($value ins... | [
"public",
"static",
"function",
"arrayMembersToAttrsMembers",
"(",
"array",
"$",
"array",
",",
"$",
"indentLevel",
",",
"$",
"format",
")",
"{",
"$",
"expr",
"=",
"\"\"",
";",
"/* Convert inherit objects separately, since they have to be generated differently */",
"$",
... | Converts members of an array to members of an attribute set
@param array $array Array to convert
@param int $indentLevel The indentation level of the resulting sub expression
@param bool $format Indicates whether to nicely format to expression (i.e. generating whitespaces) or not
@return string A string containing the... | [
"Converts",
"members",
"of",
"an",
"array",
"to",
"members",
"of",
"an",
"attribute",
"set"
] | 4bfe9c4120c23354ab8dc295957dc3009a39bff0 | https://github.com/svanderburg/pndp/blob/4bfe9c4120c23354ab8dc295957dc3009a39bff0/src/PNDP/NixGenerator.php#L103-L146 |
7,303 | svanderburg/pndp | src/PNDP/NixGenerator.php | NixGenerator.associativeArrayToIndentedNix | public static function associativeArrayToIndentedNix(array $array, $indentLevel, $format)
{
if(count($array) == 0)
return "{}"; // Not strictly required, but printing an empty attribute set like this is better that putting a newline between the braces
else
return "{\n".NixGenerator::arrayMembersToAttrsMember... | php | public static function associativeArrayToIndentedNix(array $array, $indentLevel, $format)
{
if(count($array) == 0)
return "{}"; // Not strictly required, but printing an empty attribute set like this is better that putting a newline between the braces
else
return "{\n".NixGenerator::arrayMembersToAttrsMember... | [
"public",
"static",
"function",
"associativeArrayToIndentedNix",
"(",
"array",
"$",
"array",
",",
"$",
"indentLevel",
",",
"$",
"format",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array",
")",
"==",
"0",
")",
"return",
"\"{}\"",
";",
"// Not strictly required... | Converts an array to a Nix attribute set.
@param array $array Array to convert
@param int $indentLevel The indentation level of the resulting sub expression
@param bool $format Indicates whether to nicely format to expression (i.e. generating whitespaces) or not
@return A string representing the corresponding Nix list | [
"Converts",
"an",
"array",
"to",
"a",
"Nix",
"attribute",
"set",
"."
] | 4bfe9c4120c23354ab8dc295957dc3009a39bff0 | https://github.com/svanderburg/pndp/blob/4bfe9c4120c23354ab8dc295957dc3009a39bff0/src/PNDP/NixGenerator.php#L156-L162 |
7,304 | svanderburg/pndp | src/PNDP/NixGenerator.php | NixGenerator.phpToIndentedNix | public static function phpToIndentedNix($obj, $indentLevel, $format)
{
$expr = "";
switch(gettype($obj))
{
case "boolean":
$expr .= NixGenerator::booleanToIndentedNix($obj);
break;
case "integer":
$expr .= $obj;
break;
case "double":
$expr .= $obj;
break;
case "string":
$... | php | public static function phpToIndentedNix($obj, $indentLevel, $format)
{
$expr = "";
switch(gettype($obj))
{
case "boolean":
$expr .= NixGenerator::booleanToIndentedNix($obj);
break;
case "integer":
$expr .= $obj;
break;
case "double":
$expr .= $obj;
break;
case "string":
$... | [
"public",
"static",
"function",
"phpToIndentedNix",
"(",
"$",
"obj",
",",
"$",
"indentLevel",
",",
"$",
"format",
")",
"{",
"$",
"expr",
"=",
"\"\"",
";",
"switch",
"(",
"gettype",
"(",
"$",
"obj",
")",
")",
"{",
"case",
"\"boolean\"",
":",
"$",
"exp... | Converts a PHP variable of any type to a semantically equivalent or
similar Nix expression language object. It also uses indentation to
format the resulting sub expression more nicely.
@param mixed $obj A variable of any type
@param int $indentLevel Contains the indentation level
@param bool $format Indicates whether ... | [
"Converts",
"a",
"PHP",
"variable",
"of",
"any",
"type",
"to",
"a",
"semantically",
"equivalent",
"or",
"similar",
"Nix",
"expression",
"language",
"object",
".",
"It",
"also",
"uses",
"indentation",
"to",
"format",
"the",
"resulting",
"sub",
"expression",
"mo... | 4bfe9c4120c23354ab8dc295957dc3009a39bff0 | https://github.com/svanderburg/pndp/blob/4bfe9c4120c23354ab8dc295957dc3009a39bff0/src/PNDP/NixGenerator.php#L206-L243 |
7,305 | skgroup/php-rbac | src/Permission.php | Permission.addRuleCallback | public function addRuleCallback($name, Callable $callback)
{
if (!is_string($name)) {
throw new \InvalidArgumentException('Rule must be a string');
}
$rule = $this->createRuleCallback($name, $callback);
$this->addRule($rule);
} | php | public function addRuleCallback($name, Callable $callback)
{
if (!is_string($name)) {
throw new \InvalidArgumentException('Rule must be a string');
}
$rule = $this->createRuleCallback($name, $callback);
$this->addRule($rule);
} | [
"public",
"function",
"addRuleCallback",
"(",
"$",
"name",
",",
"Callable",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Rule must be a string'",
")",
";",
... | Adds a rule callback to the Permission.
@param string $name
@param Callable $callback
@return void | [
"Adds",
"a",
"rule",
"callback",
"to",
"the",
"Permission",
"."
] | 89b08cacda9b1376b8f07d16038d2eade6dfb9e8 | https://github.com/skgroup/php-rbac/blob/89b08cacda9b1376b8f07d16038d2eade6dfb9e8/src/Permission.php#L60-L68 |
7,306 | skgroup/php-rbac | src/Permission.php | Permission.revokeRule | public function revokeRule($rule)
{
if ($this->hasRule($rule)) {
unset($this->rules[$rule]);
return true;
} else {
return false;
}
} | php | public function revokeRule($rule)
{
if ($this->hasRule($rule)) {
unset($this->rules[$rule]);
return true;
} else {
return false;
}
} | [
"public",
"function",
"revokeRule",
"(",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"rule",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"rules",
"[",
"$",
"rule",
"]",
")",
";",
"return",
"true",
";",
"}",
"el... | Revokes a rule from the Permission.
@param string $rule
@return bool | [
"Revokes",
"a",
"rule",
"from",
"the",
"Permission",
"."
] | 89b08cacda9b1376b8f07d16038d2eade6dfb9e8 | https://github.com/skgroup/php-rbac/blob/89b08cacda9b1376b8f07d16038d2eade6dfb9e8/src/Permission.php#L102-L110 |
7,307 | skgroup/php-rbac | src/Permission.php | Permission.getRule | public function getRule($name)
{
if ($this->hasRule($name)) {
return $this->rules[$name];
}
throw new \InvalidArgumentException(sprintf('No rule with name "%s" could be found', $name));
} | php | public function getRule($name)
{
if ($this->hasRule($name)) {
return $this->rules[$name];
}
throw new \InvalidArgumentException(sprintf('No rule with name "%s" could be found', $name));
} | [
"public",
"function",
"getRule",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"rules",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentExce... | Returns the named rule from the Permission.
@param string $name
@return RuleInterface | [
"Returns",
"the",
"named",
"rule",
"from",
"the",
"Permission",
"."
] | 89b08cacda9b1376b8f07d16038d2eade6dfb9e8 | https://github.com/skgroup/php-rbac/blob/89b08cacda9b1376b8f07d16038d2eade6dfb9e8/src/Permission.php#L118-L125 |
7,308 | skgroup/php-rbac | src/Permission.php | Permission.checkRules | public function checkRules($rules, Array $params = null)
{
if (is_string($rules)) {
$rules = (array)explode(',', $rules);
}
foreach ($rules as $name) {
if (!$this->hasRule($name) || !$this->getRule($name)->execute($this, $params)) {
return false;
... | php | public function checkRules($rules, Array $params = null)
{
if (is_string($rules)) {
$rules = (array)explode(',', $rules);
}
foreach ($rules as $name) {
if (!$this->hasRule($name) || !$this->getRule($name)->execute($this, $params)) {
return false;
... | [
"public",
"function",
"checkRules",
"(",
"$",
"rules",
",",
"Array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"rules",
")",
")",
"{",
"$",
"rules",
"=",
"(",
"array",
")",
"explode",
"(",
"','",
",",
"$",
"rules",
"... | Checks the rules for the Permission.
@param string|array $rules
@param array $params
@return bool | [
"Checks",
"the",
"rules",
"for",
"the",
"Permission",
"."
] | 89b08cacda9b1376b8f07d16038d2eade6dfb9e8 | https://github.com/skgroup/php-rbac/blob/89b08cacda9b1376b8f07d16038d2eade6dfb9e8/src/Permission.php#L144-L157 |
7,309 | Puzzlout/FrameworkMvcLegacy | src/Core/ResourceManagers/CommonResxBase.php | CommonResxBase.GetValue | public function GetValue($key) {
$resources = $this->GetList();
$keyExist = array_key_exists($key, $resources);
if ($keyExist) {
return $resources[$key][\Puzzlout\Framework\BO\F_common_resource::F_COMMON_RESOURCE_VALUE];
} else {
// throw new \Puzzlout\Framework\Exceptio... | php | public function GetValue($key) {
$resources = $this->GetList();
$keyExist = array_key_exists($key, $resources);
if ($keyExist) {
return $resources[$key][\Puzzlout\Framework\BO\F_common_resource::F_COMMON_RESOURCE_VALUE];
} else {
// throw new \Puzzlout\Framework\Exceptio... | [
"public",
"function",
"GetValue",
"(",
"$",
"key",
")",
"{",
"$",
"resources",
"=",
"$",
"this",
"->",
"GetList",
"(",
")",
";",
"$",
"keyExist",
"=",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"resources",
")",
";",
"if",
"(",
"$",
"keyExist",
... | Get the resource value by group and key.
@param string $key the resource key to find
@return string the resource value | [
"Get",
"the",
"resource",
"value",
"by",
"group",
"and",
"key",
"."
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Core/ResourceManagers/CommonResxBase.php#L37-L47 |
7,310 | Puzzlout/FrameworkMvcLegacy | src/Core/ResourceManagers/CommonResxBase.php | CommonResxBase.GetComment | public function GetComment($key) {
$resources = $this->GetList();
$keyExist = array_key_exists($key, $resources);
if ($keyExist) {
return $resources[$key][\Puzzlout\Framework\BO\F_common_resource::F_COMMON_RESOURCE_COMMENT];
} else {
// throw new \Puzzlout\Framework\Exce... | php | public function GetComment($key) {
$resources = $this->GetList();
$keyExist = array_key_exists($key, $resources);
if ($keyExist) {
return $resources[$key][\Puzzlout\Framework\BO\F_common_resource::F_COMMON_RESOURCE_COMMENT];
} else {
// throw new \Puzzlout\Framework\Exce... | [
"public",
"function",
"GetComment",
"(",
"$",
"key",
")",
"{",
"$",
"resources",
"=",
"$",
"this",
"->",
"GetList",
"(",
")",
";",
"$",
"keyExist",
"=",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"resources",
")",
";",
"if",
"(",
"$",
"keyExist",... | Get the resource comment by group and key.
@param string $key the resource key to find
@return string the resource comment | [
"Get",
"the",
"resource",
"comment",
"by",
"group",
"and",
"key",
"."
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Core/ResourceManagers/CommonResxBase.php#L55-L65 |
7,311 | remote-office/libx | src/Util/Address.php | Address.toArray | public function toArray()
{
$_address = [];
if($this->hasCountry())
$_address['country'] = $this->getCountry();
if($this->hasState())
$_address['state'] = $this->getState();
if($this->hasMunicipality())
$_address['municipality'] = $this->getMunicipality();
i... | php | public function toArray()
{
$_address = [];
if($this->hasCountry())
$_address['country'] = $this->getCountry();
if($this->hasState())
$_address['state'] = $this->getState();
if($this->hasMunicipality())
$_address['municipality'] = $this->getMunicipality();
i... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"_address",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"hasCountry",
"(",
")",
")",
"$",
"_address",
"[",
"'country'",
"]",
"=",
"$",
"this",
"->",
"getCountry",
"(",
")",
";",
"if",
"("... | Convert address to array
@param void
@return NULL[] | [
"Convert",
"address",
"to",
"array"
] | 8baeaae99a6110e7c588bc0388df89a0dc0768b5 | https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/Util/Address.php#L208-L243 |
7,312 | remote-office/libx | src/Util/Address.php | Address.fromStdClass | public static function fromStdClass($_address)
{
$address = new static();
if(isset($_address->country))
$address->setCountry($_address->country);
if(isset($_address->state))
$address->setState($_address->state);
if(isset($_address->municipality))
$address->setMunic... | php | public static function fromStdClass($_address)
{
$address = new static();
if(isset($_address->country))
$address->setCountry($_address->country);
if(isset($_address->state))
$address->setState($_address->state);
if(isset($_address->municipality))
$address->setMunic... | [
"public",
"static",
"function",
"fromStdClass",
"(",
"$",
"_address",
")",
"{",
"$",
"address",
"=",
"new",
"static",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_address",
"->",
"country",
")",
")",
"$",
"address",
"->",
"setCountry",
"(",
"$",
"_... | Convert from StdClass
@param StdClass $_address
@return \LibX\Util\Address | [
"Convert",
"from",
"StdClass"
] | 8baeaae99a6110e7c588bc0388df89a0dc0768b5 | https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/Util/Address.php#L251-L286 |
7,313 | vinala/kernel | src/Config/Config.php | Config.getPath | protected static function getPath($param)
{
$path = (is_null(Application::$root) ? "config/$param.php" : Application::$root."config/$param.php");
//
return Bus::need((is_null(Application::$root) ? "config/$param.php" : Application::$root."config/$param.php"));
} | php | protected static function getPath($param)
{
$path = (is_null(Application::$root) ? "config/$param.php" : Application::$root."config/$param.php");
//
return Bus::need((is_null(Application::$root) ? "config/$param.php" : Application::$root."config/$param.php"));
} | [
"protected",
"static",
"function",
"getPath",
"(",
"$",
"param",
")",
"{",
"$",
"path",
"=",
"(",
"is_null",
"(",
"Application",
"::",
"$",
"root",
")",
"?",
"\"config/$param.php\"",
":",
"Application",
"::",
"$",
"root",
".",
"\"config/$param.php\"",
")",
... | get path of config files.
@param $param(string) : file name | [
"get",
"path",
"of",
"config",
"files",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L26-L31 |
7,314 | vinala/kernel | src/Config/Config.php | Config.load | public static function load($kernelTest = false)
{
if ($kernelTest) {
return self::mock();
} else {
$levels = self::getFirstLevel();
//
foreach ($levels as $level) {
self::$params[$level] = self::getPath($level);
}
... | php | public static function load($kernelTest = false)
{
if ($kernelTest) {
return self::mock();
} else {
$levels = self::getFirstLevel();
//
foreach ($levels as $level) {
self::$params[$level] = self::getPath($level);
}
... | [
"public",
"static",
"function",
"load",
"(",
"$",
"kernelTest",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"kernelTest",
")",
"{",
"return",
"self",
"::",
"mock",
"(",
")",
";",
"}",
"else",
"{",
"$",
"levels",
"=",
"self",
"::",
"getFirstLevel",
"(",
... | load all params from file to virtual array. | [
"load",
"all",
"params",
"from",
"file",
"to",
"virtual",
"array",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L56-L69 |
7,315 | vinala/kernel | src/Config/Config.php | Config.check | public static function check($param, $default = false)
{
$p = self::separate($param);
//
if ($p['first'] == 'database') {
self::checkDatabase($p['second']);
}
//
else {
if (!in_array($p['first'], self::getFirstLevel())) {
if (!$... | php | public static function check($param, $default = false)
{
$p = self::separate($param);
//
if ($p['first'] == 'database') {
self::checkDatabase($p['second']);
}
//
else {
if (!in_array($p['first'], self::getFirstLevel())) {
if (!$... | [
"public",
"static",
"function",
"check",
"(",
"$",
"param",
",",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"p",
"=",
"self",
"::",
"separate",
"(",
"$",
"param",
")",
";",
"//",
"if",
"(",
"$",
"p",
"[",
"'first'",
"]",
"==",
"'database'",
")"... | check if parameter exists.
@param $param(string) primary and secondary parameter concatenated | [
"check",
"if",
"parameter",
"exists",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L87-L112 |
7,316 | vinala/kernel | src/Config/Config.php | Config.reach | protected static function reach($param, $default = null)
{
$p = self::separate($param);
//
if ($p['first'] == 'database') {
return self::callDatabase($p['second']);
}
return array_get(self::$params, $param, $default);
} | php | protected static function reach($param, $default = null)
{
$p = self::separate($param);
//
if ($p['first'] == 'database') {
return self::callDatabase($p['second']);
}
return array_get(self::$params, $param, $default);
} | [
"protected",
"static",
"function",
"reach",
"(",
"$",
"param",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"p",
"=",
"self",
"::",
"separate",
"(",
"$",
"param",
")",
";",
"//",
"if",
"(",
"$",
"p",
"[",
"'first'",
"]",
"==",
"'database'",
"... | find request parameter.
@param $param(string) primary and secondary parameter concatenated | [
"find",
"request",
"parameter",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L131-L140 |
7,317 | vinala/kernel | src/Config/Config.php | Config.checkDatabase | protected static function checkDatabase($key)
{
$driver = self::$params['database']['default'];
//
if (array_key_exists($key, self::$params['database'])) {
return true;
} elseif (array_key_exists($key, self::$params['database']['connections'][$driver])) {
retu... | php | protected static function checkDatabase($key)
{
$driver = self::$params['database']['default'];
//
if (array_key_exists($key, self::$params['database'])) {
return true;
} elseif (array_key_exists($key, self::$params['database']['connections'][$driver])) {
retu... | [
"protected",
"static",
"function",
"checkDatabase",
"(",
"$",
"key",
")",
"{",
"$",
"driver",
"=",
"self",
"::",
"$",
"params",
"[",
"'database'",
"]",
"[",
"'default'",
"]",
";",
"//",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"self",
"::",... | check if secondary parameter exists if primary parameter is 'database'.
@param $key(string) primary and secondary parameter concatenated | [
"check",
"if",
"secondary",
"parameter",
"exists",
"if",
"primary",
"parameter",
"is",
"database",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L147-L158 |
7,318 | vinala/kernel | src/Config/Config.php | Config.callDatabase | protected static function callDatabase($key)
{
$params = ['migration', 'prefixing', 'prefixe', 'default'];
$data = self::$params['database'];
$driver = $data['default'];
//
exception_if(!array_has($data['connections'], $driver), DatabaseDriverNotFoundException::class, $driver... | php | protected static function callDatabase($key)
{
$params = ['migration', 'prefixing', 'prefixe', 'default'];
$data = self::$params['database'];
$driver = $data['default'];
//
exception_if(!array_has($data['connections'], $driver), DatabaseDriverNotFoundException::class, $driver... | [
"protected",
"static",
"function",
"callDatabase",
"(",
"$",
"key",
")",
"{",
"$",
"params",
"=",
"[",
"'migration'",
",",
"'prefixing'",
",",
"'prefixe'",
",",
"'default'",
"]",
";",
"$",
"data",
"=",
"self",
"::",
"$",
"params",
"[",
"'database'",
"]",... | find request parameter if primary parameter is 'database'.
@param $key(string) secondary parameter concatenated | [
"find",
"request",
"parameter",
"if",
"primary",
"parameter",
"is",
"database",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L165-L174 |
7,319 | vinala/kernel | src/Config/Config.php | Config.get | public static function get($key, $value = null)
{
if (self::check($key, !is_null($value))) {
return self::reach($key, $value);
}
static::set($key, $value);
return $value;
} | php | public static function get($key, $value = null)
{
if (self::check($key, !is_null($value))) {
return self::reach($key, $value);
}
static::set($key, $value);
return $value;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"check",
"(",
"$",
"key",
",",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
")",
"{",
"return",
"self",
"::",
"reach",
"(... | get value of config parameter.
@param $value(string) primary and secondary parameter concatenated | [
"get",
"value",
"of",
"config",
"parameter",
"."
] | 346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a | https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Config/Config.php#L181-L190 |
7,320 | GrupaZero/core | src/Gzero/Core/Policies/UserPolicy.php | UserPolicy.delete | public function delete(User $user, User $entity)
{
if ($entity->id === $user->id) {
return true;
}
return $user->hasPermission('user-delete');
} | php | public function delete(User $user, User $entity)
{
if ($entity->id === $user->id) {
return true;
}
return $user->hasPermission('user-delete');
} | [
"public",
"function",
"delete",
"(",
"User",
"$",
"user",
",",
"User",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"id",
"===",
"$",
"user",
"->",
"id",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"user",
"->",
"hasPermission"... | Policy for deleting single element
@param User $user User trying to do it
@param User $entity User that we're trying to update
@return boolean | [
"Policy",
"for",
"deleting",
"single",
"element"
] | 093e515234fa0385b259ba4d8bc7832174a44eab | https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/Policies/UserPolicy.php#L71-L77 |
7,321 | phapi/serializer | src/Phapi/Serializer/Deserializer.php | Deserializer.getContentType | protected function getContentType(ServerRequestInterface $request)
{
// Check for an attribute
if (null !== $accept = $request->getAttribute('Content-Type', null)) {
return $accept;
}
// Check for an accept header
if ($request->hasHeader('Content-Type')) {
... | php | protected function getContentType(ServerRequestInterface $request)
{
// Check for an attribute
if (null !== $accept = $request->getAttribute('Content-Type', null)) {
return $accept;
}
// Check for an accept header
if ($request->hasHeader('Content-Type')) {
... | [
"protected",
"function",
"getContentType",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"// Check for an attribute",
"if",
"(",
"null",
"!==",
"$",
"accept",
"=",
"$",
"request",
"->",
"getAttribute",
"(",
"'Content-Type'",
",",
"null",
")",
")",
"{"... | Get content type from request. First check for an attribute. An attribute
is usually set if content negotiation are done.
If no attribute can be found, use the content type header.
@param ServerRequestInterface $request
@return mixed|null|string | [
"Get",
"content",
"type",
"from",
"request",
".",
"First",
"check",
"for",
"an",
"attribute",
".",
"An",
"attribute",
"is",
"usually",
"set",
"if",
"content",
"negotiation",
"are",
"done",
"."
] | 231b85de75f8e3bcf4907751110639bf8b6d7982 | https://github.com/phapi/serializer/blob/231b85de75f8e3bcf4907751110639bf8b6d7982/src/Phapi/Serializer/Deserializer.php#L126-L139 |
7,322 | mvccore/ext-form | src/MvcCore/Ext/Forms/Validator.php | Validator.& | public static function & CreateInstance (array $constructorConfig = []) {
$validator = new static($constructorConfig);
$validator::$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
return $validator;
} | php | public static function & CreateInstance (array $constructorConfig = []) {
$validator = new static($constructorConfig);
$validator::$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
return $validator;
} | [
"public",
"static",
"function",
"&",
"CreateInstance",
"(",
"array",
"$",
"constructorConfig",
"=",
"[",
"]",
")",
"{",
"$",
"validator",
"=",
"new",
"static",
"(",
"$",
"constructorConfig",
")",
";",
"$",
"validator",
"::",
"$",
"toolClass",
"=",
"\\",
... | Create every time new validator instance with configured form instance. No singleton.
@param array $constructorConfig Configuration arguments for constructor,
validator's constructor first param.
@return \MvcCore\Ext\Forms\Validator|\MvcCore\Ext\Forms\IValidator | [
"Create",
"every",
"time",
"new",
"validator",
"instance",
"with",
"configured",
"form",
"instance",
".",
"No",
"singleton",
"."
] | 8d81a3c7326236702f37dc4b9d968907b3230b9f | https://github.com/mvccore/ext-form/blob/8d81a3c7326236702f37dc4b9d968907b3230b9f/src/MvcCore/Ext/Forms/Validator.php#L80-L84 |
7,323 | mvccore/ext-form | src/MvcCore/Ext/Forms/Validator.php | Validator.throwNewInvalidArgumentException | protected function throwNewInvalidArgumentException ($errorMsg) {
$msgs = [];
if ($this->field)
$msgs[] = 'Field name: `'.$this->field->GetName() . '`, Field type: `'.get_class($this->field).'`';
if ($this->form)
$msgs[] = 'Form id: `'.$this->form->GetId() . '`, Form type: `'.get_class($this->form).'`';
... | php | protected function throwNewInvalidArgumentException ($errorMsg) {
$msgs = [];
if ($this->field)
$msgs[] = 'Field name: `'.$this->field->GetName() . '`, Field type: `'.get_class($this->field).'`';
if ($this->form)
$msgs[] = 'Form id: `'.$this->form->GetId() . '`, Form type: `'.get_class($this->form).'`';
... | [
"protected",
"function",
"throwNewInvalidArgumentException",
"(",
"$",
"errorMsg",
")",
"{",
"$",
"msgs",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"field",
")",
"$",
"msgs",
"[",
"]",
"=",
"'Field name: `'",
".",
"$",
"this",
"->",
"field",
"-... | Throw new `\InvalidArgumentException` with given
error message and append automatically current class,
field name, form id, field class name and form class name.
@param string $errorMsg
@throws \InvalidArgumentException | [
"Throw",
"new",
"\\",
"InvalidArgumentException",
"with",
"given",
"error",
"message",
"and",
"append",
"automatically",
"current",
"class",
"field",
"name",
"form",
"id",
"field",
"class",
"name",
"and",
"form",
"class",
"name",
"."
] | 8d81a3c7326236702f37dc4b9d968907b3230b9f | https://github.com/mvccore/ext-form/blob/8d81a3c7326236702f37dc4b9d968907b3230b9f/src/MvcCore/Ext/Forms/Validator.php#L160-L170 |
7,324 | slickframework/mvc | src/Controller/EntityBasedMethods.php | EntityBasedMethods.getEntity | protected function getEntity($entityId)
{
$entity = $this->getRepository()->get($entityId);
if (!$entity instanceof EntityInterface) {
throw new EntityNotFoundException(
"There are no entities with provided entity ID."
);
}
return $entity;
... | php | protected function getEntity($entityId)
{
$entity = $this->getRepository()->get($entityId);
if (!$entity instanceof EntityInterface) {
throw new EntityNotFoundException(
"There are no entities with provided entity ID."
);
}
return $entity;
... | [
"protected",
"function",
"getEntity",
"(",
"$",
"entityId",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"get",
"(",
"$",
"entityId",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"EntityInterface",
")",
"{... | Gets entity with provided primary key
@param mixed $entityId
@return EntityInterface
@throws EntityNotFoundException If no entity was found with
provided primary key | [
"Gets",
"entity",
"with",
"provided",
"primary",
"key"
] | 91a6c512f8aaa5a7fb9c1a96f8012d2274dc30ab | https://github.com/slickframework/mvc/blob/91a6c512f8aaa5a7fb9c1a96f8012d2274dc30ab/src/Controller/EntityBasedMethods.php#L47-L56 |
7,325 | youlweb/_Chain_ | src/Operator/_OR_.php | _OR_.EXE | public function EXE(I_O $IO)
{
while (true) {
try {
if (true === $IO->I_(Type::BOOL)) {
return $IO->_O(true);
}
} catch (I_O_InputIndexException $e) {
break;
}
}
return $IO->_O(false);
... | php | public function EXE(I_O $IO)
{
while (true) {
try {
if (true === $IO->I_(Type::BOOL)) {
return $IO->_O(true);
}
} catch (I_O_InputIndexException $e) {
break;
}
}
return $IO->_O(false);
... | [
"public",
"function",
"EXE",
"(",
"I_O",
"$",
"IO",
")",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"if",
"(",
"true",
"===",
"$",
"IO",
"->",
"I_",
"(",
"Type",
"::",
"BOOL",
")",
")",
"{",
"return",
"$",
"IO",
"->",
"_O",
"(",
"true",... | Applies the OR operator to the input values.
I/O contract
------------
<pre>
I bool
... bool
O bool Result of the OR operation.
X no
</pre>
@param I_O $IO
@return I_O | [
"Applies",
"the",
"OR",
"operator",
"to",
"the",
"input",
"values",
"."
] | 6ac1b8c0d5a056ab1a7ff3cc521f1a246a9ffed2 | https://github.com/youlweb/_Chain_/blob/6ac1b8c0d5a056ab1a7ff3cc521f1a246a9ffed2/src/Operator/_OR_.php#L38-L50 |
7,326 | artscorestudio/layout-bundle | Twig/FlashMessagesExtension.php | FlashMessagesExtension.flashMessages | public function flashMessages($environment, array $options = array())
{
$params = array_merge(array(
'close_button' => true, 'trans_domain' => null,
), $options);
$template = $environment->loadTemplate('ASFLayoutBundle:session:flash-messages.html.twig');
return $templat... | php | public function flashMessages($environment, array $options = array())
{
$params = array_merge(array(
'close_button' => true, 'trans_domain' => null,
), $options);
$template = $environment->loadTemplate('ASFLayoutBundle:session:flash-messages.html.twig');
return $templat... | [
"public",
"function",
"flashMessages",
"(",
"$",
"environment",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"array",
"(",
"'close_button'",
"=>",
"true",
",",
"'trans_domain'",
"=>",
"null",
",",
... | Return HTML of flash messages according to flash-messages.html.twig.
@param \Twig_Environment $environment
@param array $options
- button_close : display a close button
- trans_domain set the domain for translation
@return string | [
"Return",
"HTML",
"of",
"flash",
"messages",
"according",
"to",
"flash",
"-",
"messages",
".",
"html",
".",
"twig",
"."
] | 5ccd5f4a133e8af90fb2c46e1f68b6bcb4b66740 | https://github.com/artscorestudio/layout-bundle/blob/5ccd5f4a133e8af90fb2c46e1f68b6bcb4b66740/Twig/FlashMessagesExtension.php#L45-L54 |
7,327 | weew/console | src/Weew/Console/OutputBuffer.php | OutputBuffer.write | public function write($string) {
if ( ! is_array($string)) {
$string = [$string];
}
foreach ($string as $item) {
$this->buffer .= $item;
}
} | php | public function write($string) {
if ( ! is_array($string)) {
$string = [$string];
}
foreach ($string as $item) {
$this->buffer .= $item;
}
} | [
"public",
"function",
"write",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"string",
")",
")",
"{",
"$",
"string",
"=",
"[",
"$",
"string",
"]",
";",
"}",
"foreach",
"(",
"$",
"string",
"as",
"$",
"item",
")",
"{",
"$",
... | Add a string to buffer.
@param string $string | [
"Add",
"a",
"string",
"to",
"buffer",
"."
] | 083703f21fdeff3cfe6036ebd21ab9cb84ca74c7 | https://github.com/weew/console/blob/083703f21fdeff3cfe6036ebd21ab9cb84ca74c7/src/Weew/Console/OutputBuffer.php#L16-L24 |
7,328 | weew/console | src/Weew/Console/OutputBuffer.php | OutputBuffer.slice | public function slice($from, $length = null) {
if ($length === null) {
return substr($this->buffer, $from);
}
return substr($this->buffer, $from, $length);
} | php | public function slice($from, $length = null) {
if ($length === null) {
return substr($this->buffer, $from);
}
return substr($this->buffer, $from, $length);
} | [
"public",
"function",
"slice",
"(",
"$",
"from",
",",
"$",
"length",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"length",
"===",
"null",
")",
"{",
"return",
"substr",
"(",
"$",
"this",
"->",
"buffer",
",",
"$",
"from",
")",
";",
"}",
"return",
"subst... | Get a slice from the buffer.
@param int $from
@param int $length
@return string|false | [
"Get",
"a",
"slice",
"from",
"the",
"buffer",
"."
] | 083703f21fdeff3cfe6036ebd21ab9cb84ca74c7 | https://github.com/weew/console/blob/083703f21fdeff3cfe6036ebd21ab9cb84ca74c7/src/Weew/Console/OutputBuffer.php#L34-L40 |
7,329 | calgamo/util | src/Util.php | Util.dumpBacktrace | public static function dumpBacktrace(array $backtraces, string $format = "[%INDEX%]%CLASS%%TYPE%%FUNCTION%() in %FILE%(%LINE%)")
{
self::walkBacktrace($backtraces, function($index, $file, $line, $class, $type, $func) use($format){
$line = strtr($format, [
'%INDEX%' => $index + 1,... | php | public static function dumpBacktrace(array $backtraces, string $format = "[%INDEX%]%CLASS%%TYPE%%FUNCTION%() in %FILE%(%LINE%)")
{
self::walkBacktrace($backtraces, function($index, $file, $line, $class, $type, $func) use($format){
$line = strtr($format, [
'%INDEX%' => $index + 1,... | [
"public",
"static",
"function",
"dumpBacktrace",
"(",
"array",
"$",
"backtraces",
",",
"string",
"$",
"format",
"=",
"\"[%INDEX%]%CLASS%%TYPE%%FUNCTION%() in %FILE%(%LINE%)\"",
")",
"{",
"self",
"::",
"walkBacktrace",
"(",
"$",
"backtraces",
",",
"function",
"(",
"$... | Dump back traces
@param array $backtraces
@param string $format | [
"Dump",
"back",
"traces"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L72-L85 |
7,330 | calgamo/util | src/Util.php | Util.walkBacktrace | public static function walkBacktrace($backtraces, callable $callback)
{
foreach($backtraces as $index => $item){
$func = $item['function'] ?? '';
$class = $item['class'] ?? '';
$type = $item['type'] ?? '';
$file = $item['file'] ?? '';
$line = $... | php | public static function walkBacktrace($backtraces, callable $callback)
{
foreach($backtraces as $index => $item){
$func = $item['function'] ?? '';
$class = $item['class'] ?? '';
$type = $item['type'] ?? '';
$file = $item['file'] ?? '';
$line = $... | [
"public",
"static",
"function",
"walkBacktrace",
"(",
"$",
"backtraces",
",",
"callable",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"backtraces",
"as",
"$",
"index",
"=>",
"$",
"item",
")",
"{",
"$",
"func",
"=",
"$",
"item",
"[",
"'function'",
"... | Walk back traces
@param array|\Traversable $backtraces
@param callable $callback | [
"Walk",
"back",
"traces"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L93-L103 |
7,331 | calgamo/util | src/Util.php | Util.isBitSet | public static function isBitSet( int $target, int $flag, int $mode ) : bool
{
switch($mode){
case self::BITTEST_MODE_ALL:
return ($target & $flag) === $flag;
break;
case self::BITTEST_MODE_ANY:
return ($target & $flag) != 0;
}
return false... | php | public static function isBitSet( int $target, int $flag, int $mode ) : bool
{
switch($mode){
case self::BITTEST_MODE_ALL:
return ($target & $flag) === $flag;
break;
case self::BITTEST_MODE_ANY:
return ($target & $flag) != 0;
}
return false... | [
"public",
"static",
"function",
"isBitSet",
"(",
"int",
"$",
"target",
",",
"int",
"$",
"flag",
",",
"int",
"$",
"mode",
")",
":",
"bool",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
"self",
"::",
"BITTEST_MODE_ALL",
":",
"return",
"(",
"$",
... | Test if specified bit flag is set
@param int $target target value to test
@param int $flag target flag to test
@param int $mode test mode(see BITTEST_MODE_XXX constants)
@return bool | [
"Test",
"if",
"specified",
"bit",
"flag",
"is",
"set"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L145-L156 |
7,332 | calgamo/util | src/Util.php | Util.formatByteSize | public static function formatByteSize( $size, $precision = 1, $symbols = NULL )
{
if ( $symbols === NULL ){
$symbols = array('B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
}
$i=0;
while (($size/1024)>1) {
$size=$size/1024;
$i++;
}
return (roun... | php | public static function formatByteSize( $size, $precision = 1, $symbols = NULL )
{
if ( $symbols === NULL ){
$symbols = array('B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
}
$i=0;
while (($size/1024)>1) {
$size=$size/1024;
$i++;
}
return (roun... | [
"public",
"static",
"function",
"formatByteSize",
"(",
"$",
"size",
",",
"$",
"precision",
"=",
"1",
",",
"$",
"symbols",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"symbols",
"===",
"NULL",
")",
"{",
"$",
"symbols",
"=",
"array",
"(",
"'B'",
",",
"'Kb... | format byte size
@param int $size
@param int $precision
@param array $symbols
@return string | [
"format",
"byte",
"size"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L218-L229 |
7,333 | calgamo/util | src/Util.php | Util.hash | public static function hash( string $algo = 'sha1', string $data = NULL )
{
if (!$data){
$data = microtime().uniqid(mt_rand(),1);
}
return hash( $algo, $data );
} | php | public static function hash( string $algo = 'sha1', string $data = NULL )
{
if (!$data){
$data = microtime().uniqid(mt_rand(),1);
}
return hash( $algo, $data );
} | [
"public",
"static",
"function",
"hash",
"(",
"string",
"$",
"algo",
"=",
"'sha1'",
",",
"string",
"$",
"data",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"microtime",
"(",
")",
".",
"uniqid",
"(",
"mt_rand",
"... | generate hash value
@param string $algo
@param string $data
@return string | [
"generate",
"hash",
"value"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L239-L245 |
7,334 | calgamo/util | src/Util.php | Util.escape | public static function escape( $value )
{
if ( is_string($value) ){
$res = htmlspecialchars($value, ENT_QUOTES, mb_internal_encoding());
//log_debug( "debug", "escape:" . print_r($res,true) );
return $res;
}
elseif ( is_array($value) ){
$ret = array();
... | php | public static function escape( $value )
{
if ( is_string($value) ){
$res = htmlspecialchars($value, ENT_QUOTES, mb_internal_encoding());
//log_debug( "debug", "escape:" . print_r($res,true) );
return $res;
}
elseif ( is_array($value) ){
$ret = array();
... | [
"public",
"static",
"function",
"escape",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"res",
"=",
"htmlspecialchars",
"(",
"$",
"value",
",",
"ENT_QUOTES",
",",
"mb_internal_encoding",
"(",
")",
")",
";",... | escape variable for HTML
@param mixed $value
@return mixed | [
"escape",
"variable",
"for",
"HTML"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L254-L277 |
7,335 | calgamo/util | src/Util.php | Util.decode | public static function decode( $value )
{
if ( is_string($value) ){
//log_debug( "debug", "decode before:" . print_r($value,true) );
$res = htmlspecialchars_decode($value, ENT_QUOTES);
//log_debug( "debug", "decode after:" . print_r($res,true) );
return $res;
}
elseif... | php | public static function decode( $value )
{
if ( is_string($value) ){
//log_debug( "debug", "decode before:" . print_r($value,true) );
$res = htmlspecialchars_decode($value, ENT_QUOTES);
//log_debug( "debug", "decode after:" . print_r($res,true) );
return $res;
}
elseif... | [
"public",
"static",
"function",
"decode",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"//log_debug( \"debug\", \"decode before:\" . print_r($value,true) );",
"$",
"res",
"=",
"htmlspecialchars_decode",
"(",
"$",
"value",
... | decode escaped value
@param mixed $value
@return mixed | [
"decode",
"escaped",
"value"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L286-L306 |
7,336 | calgamo/util | src/Util.php | Util.stripTags | public static function stripTags( $value, $allowable_tags = NULL )
{
if ( is_string($value) ){
$res = strip_tags($value, $allowable_tags);
return $res;
}
elseif ( is_array($value) ){
$array = $value;
foreach( $array as $key => $value ){
... | php | public static function stripTags( $value, $allowable_tags = NULL )
{
if ( is_string($value) ){
$res = strip_tags($value, $allowable_tags);
return $res;
}
elseif ( is_array($value) ){
$array = $value;
foreach( $array as $key => $value ){
... | [
"public",
"static",
"function",
"stripTags",
"(",
"$",
"value",
",",
"$",
"allowable_tags",
"=",
"NULL",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"res",
"=",
"strip_tags",
"(",
"$",
"value",
",",
"$",
"allowable_tags",
... | remove HTML tags
@param mixed $value
@param string $allowable_tags
@return mixed | [
"remove",
"HTML",
"tags"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L316-L338 |
7,337 | calgamo/util | src/Util.php | Util.escapeString | public static function escapeString( $string_data, $options = NULL )
{
if ( !$options ){
$options = array(
'quote_style' => 'ENT_QUOTES',
);
}
$quote_style = ENT_NOQUOTES;
if ( isset($options['quote_style']) && $options... | php | public static function escapeString( $string_data, $options = NULL )
{
if ( !$options ){
$options = array(
'quote_style' => 'ENT_QUOTES',
);
}
$quote_style = ENT_NOQUOTES;
if ( isset($options['quote_style']) && $options... | [
"public",
"static",
"function",
"escapeString",
"(",
"$",
"string_data",
",",
"$",
"options",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'quote_style'",
"=>",
"'ENT_QUOTES'",
",",
")",
";",
"}",... | escape string for HTML
@param string $string_data
@param array $options
@return mixed | [
"escape",
"string",
"for",
"HTML"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L378-L394 |
7,338 | calgamo/util | src/Util.php | Util.makeRandomString | public static function makeRandomString( $length, $char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' )
{
$ret = '';
$char_set_cnt = strlen($char_set);
mt_srand();
for($i = 0; $i < $length; $i++){
$idx = mt_rand(0, $char_set_cnt - 1);
... | php | public static function makeRandomString( $length, $char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' )
{
$ret = '';
$char_set_cnt = strlen($char_set);
mt_srand();
for($i = 0; $i < $length; $i++){
$idx = mt_rand(0, $char_set_cnt - 1);
... | [
"public",
"static",
"function",
"makeRandomString",
"(",
"$",
"length",
",",
"$",
"char_set",
"=",
"'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'",
")",
"{",
"$",
"ret",
"=",
"''",
";",
"$",
"char_set_cnt",
"=",
"strlen",
"(",
"$",
"char_set",
... | make random string
@param int $length
@param string $char_set
@return string | [
"make",
"random",
"string"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L404-L416 |
7,339 | calgamo/util | src/Util.php | Util.caller | public static function caller(int $back = 0)
{
$bt = debug_backtrace();
$trace = $bt[$back] ?? null;
$file = $trace['file'] ?? '';
$line = $trace['line'] ?? -1;
return array( $file, intval($line) );
} | php | public static function caller(int $back = 0)
{
$bt = debug_backtrace();
$trace = $bt[$back] ?? null;
$file = $trace['file'] ?? '';
$line = $trace['line'] ?? -1;
return array( $file, intval($line) );
} | [
"public",
"static",
"function",
"caller",
"(",
"int",
"$",
"back",
"=",
"0",
")",
"{",
"$",
"bt",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"trace",
"=",
"$",
"bt",
"[",
"$",
"back",
"]",
"??",
"null",
";",
"$",
"file",
"=",
"$",
"trace",
"["... | return file and line number of called position
@param int $back
@return array | [
"return",
"file",
"and",
"line",
"number",
"of",
"called",
"position"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L425-L434 |
7,340 | calgamo/util | src/Util.php | Util.callerAsString | public static function callerAsString( $back = 0, $fullpath = FALSE )
{
list( $file, $line ) = self::caller( $back );
if ( $fullpath ){
return "$file($line)";
}
$file = basename($file);
return "$file($line)";
} | php | public static function callerAsString( $back = 0, $fullpath = FALSE )
{
list( $file, $line ) = self::caller( $back );
if ( $fullpath ){
return "$file($line)";
}
$file = basename($file);
return "$file($line)";
} | [
"public",
"static",
"function",
"callerAsString",
"(",
"$",
"back",
"=",
"0",
",",
"$",
"fullpath",
"=",
"FALSE",
")",
"{",
"list",
"(",
"$",
"file",
",",
"$",
"line",
")",
"=",
"self",
"::",
"caller",
"(",
"$",
"back",
")",
";",
"if",
"(",
"$",
... | return file and line number of called position as string
@param int $back
@param bool $fullpath
@return string | [
"return",
"file",
"and",
"line",
"number",
"of",
"called",
"position",
"as",
"string"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L444-L455 |
7,341 | calgamo/util | src/Util.php | Util.getType | public static function getType( $value )
{
$type = gettype($value);
switch( $type ){
case 'string':
return $type . '(' . strlen($value) . ')';
break;
case 'integer':
case 'float':
case 'boolean':
return $type . '(' . $value . ')';
... | php | public static function getType( $value )
{
$type = gettype($value);
switch( $type ){
case 'string':
return $type . '(' . strlen($value) . ')';
break;
case 'integer':
case 'float':
case 'boolean':
return $type . '(' . $value . ')';
... | [
"public",
"static",
"function",
"getType",
"(",
"$",
"value",
")",
"{",
"$",
"type",
"=",
"gettype",
"(",
"$",
"value",
")",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'string'",
":",
"return",
"$",
"type",
".",
"'('",
".",
"strlen",
"(",
... | get type of primitive, resource, array, or object
@param mixed $value
@return string | [
"get",
"type",
"of",
"primitive",
"resource",
"array",
"or",
"object"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L464-L494 |
7,342 | calgamo/util | src/Util.php | Util.toString | public static function toString( $value, $with_type = FALSE, $max_size = self::TOSTRING_MAX_LENGTH, $tostring_methods = '__toString,toString' )
{
$ret = '';
if ( $value === NULL ){
$ret = 'NULL';
}
else{
$type = gettype($value);
switch( $type ){
... | php | public static function toString( $value, $with_type = FALSE, $max_size = self::TOSTRING_MAX_LENGTH, $tostring_methods = '__toString,toString' )
{
$ret = '';
if ( $value === NULL ){
$ret = 'NULL';
}
else{
$type = gettype($value);
switch( $type ){
... | [
"public",
"static",
"function",
"toString",
"(",
"$",
"value",
",",
"$",
"with_type",
"=",
"FALSE",
",",
"$",
"max_size",
"=",
"self",
"::",
"TOSTRING_MAX_LENGTH",
",",
"$",
"tostring_methods",
"=",
"'__toString,toString'",
")",
"{",
"$",
"ret",
"=",
"''",
... | make string expression about a variable
@param mixed $value
@param bool $with_type
@param int $max_size
@param string $tostring_methods
@return string | [
"make",
"string",
"expression",
"about",
"a",
"variable"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L506-L560 |
7,343 | calgamo/util | src/Util.php | Util.dump | public static function dump( $var, $format = 'html', $back = 0, $options = NULL, $return = FALSE, $max_depth = 6 )
{
list( $file, $line ) = self::caller( $back );
if ( !$options ){
$options = array();
}
$default_options = array(
'title' => 'system dump',
... | php | public static function dump( $var, $format = 'html', $back = 0, $options = NULL, $return = FALSE, $max_depth = 6 )
{
list( $file, $line ) = self::caller( $back );
if ( !$options ){
$options = array();
}
$default_options = array(
'title' => 'system dump',
... | [
"public",
"static",
"function",
"dump",
"(",
"$",
"var",
",",
"$",
"format",
"=",
"'html'",
",",
"$",
"back",
"=",
"0",
",",
"$",
"options",
"=",
"NULL",
",",
"$",
"return",
"=",
"FALSE",
",",
"$",
"max_depth",
"=",
"6",
")",
"{",
"list",
"(",
... | dump a variable
@param mixed $var
@param string $format
@param int $back
@param array $options
@param bool $return
@param int $max_depth
@return string | [
"dump",
"a",
"variable"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L574-L628 |
7,344 | calgamo/util | src/Util.php | Util.convertEncodingRecursive | public static function convertEncodingRecursive( $var, $to_encoding = NULL, $from_encoding = NULL )
{
$type = gettype($var);
switch( $type ){
case 'string':
{
return mb_convert_encoding($var,$to_encoding, $from_encoding);
}
break;
c... | php | public static function convertEncodingRecursive( $var, $to_encoding = NULL, $from_encoding = NULL )
{
$type = gettype($var);
switch( $type ){
case 'string':
{
return mb_convert_encoding($var,$to_encoding, $from_encoding);
}
break;
c... | [
"public",
"static",
"function",
"convertEncodingRecursive",
"(",
"$",
"var",
",",
"$",
"to_encoding",
"=",
"NULL",
",",
"$",
"from_encoding",
"=",
"NULL",
")",
"{",
"$",
"type",
"=",
"gettype",
"(",
"$",
"var",
")",
";",
"switch",
"(",
"$",
"type",
")"... | convert encoding recursively
@param mixed $var
@param string $to_encoding
@param string $from_encoding
@return mixed | [
"convert",
"encoding",
"recursively"
] | 13ef5caf3d4cce423854a0cb8fb8010c0d40326a | https://github.com/calgamo/util/blob/13ef5caf3d4cce423854a0cb8fb8010c0d40326a/src/Util.php#L731-L779 |
7,345 | nattreid/app-manager | src/Helpers/Deploy/Deploy.php | Deploy.authentication | protected function authentication(): bool
{
if ($this->url === null) {
throw new InvalidArgumentException('Project URL is not set');
}
$payload = file_get_contents('php://input');
switch ($this->type) {
case 'gitlab':
$authenticated = $this->authenticateGitlab($payload);
break;
case 'github... | php | protected function authentication(): bool
{
if ($this->url === null) {
throw new InvalidArgumentException('Project URL is not set');
}
$payload = file_get_contents('php://input');
switch ($this->type) {
case 'gitlab':
$authenticated = $this->authenticateGitlab($payload);
break;
case 'github... | [
"protected",
"function",
"authentication",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"url",
"===",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Project URL is not set'",
")",
";",
"}",
"$",
"payload",
"=",
"file_get_co... | Je povolen pristup
@return bool
@throws InvalidArgumentException | [
"Je",
"povolen",
"pristup"
] | 7821d09a0b3e58ba9c6eb81d44e35aacce55de75 | https://github.com/nattreid/app-manager/blob/7821d09a0b3e58ba9c6eb81d44e35aacce55de75/src/Helpers/Deploy/Deploy.php#L41-L72 |
7,346 | mizmoz/config | src/Config.php | Config.parseReferences | private function parseReferences($name): string
{
if (preg_match_all('/\$\{(.*[a-z\.0-9])\}/si', $name, $results, PREG_SET_ORDER)) {
foreach ($results as $match) {
$replace = $match[0];
$key = $match[1];
// Handle using relative placement like get... | php | private function parseReferences($name): string
{
if (preg_match_all('/\$\{(.*[a-z\.0-9])\}/si', $name, $results, PREG_SET_ORDER)) {
foreach ($results as $match) {
$replace = $match[0];
$key = $match[1];
// Handle using relative placement like get... | [
"private",
"function",
"parseReferences",
"(",
"$",
"name",
")",
":",
"string",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/\\$\\{(.*[a-z\\.0-9])\\}/si'",
",",
"$",
"name",
",",
"$",
"results",
",",
"PREG_SET_ORDER",
")",
")",
"{",
"foreach",
"(",
"$",
"result... | Parse any references in the name
@param $name
@return string | [
"Parse",
"any",
"references",
"in",
"the",
"name"
] | 777f66de31603fc65a88416a7b502c1a2fe6d62b | https://github.com/mizmoz/config/blob/777f66de31603fc65a88416a7b502c1a2fe6d62b/src/Config.php#L34-L60 |
7,347 | mizmoz/config | src/Config.php | Config.fromDirectory | public static function fromDirectory(string $directory, string $suffix = '.php'): ConfigInterface
{
$config = [];
foreach (new \DirectoryIterator($directory) as $file) {
if ($file->isDot()) {
continue;
}
$suffixLen = strlen($suffix);
i... | php | public static function fromDirectory(string $directory, string $suffix = '.php'): ConfigInterface
{
$config = [];
foreach (new \DirectoryIterator($directory) as $file) {
if ($file->isDot()) {
continue;
}
$suffixLen = strlen($suffix);
i... | [
"public",
"static",
"function",
"fromDirectory",
"(",
"string",
"$",
"directory",
",",
"string",
"$",
"suffix",
"=",
"'.php'",
")",
":",
"ConfigInterface",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"foreach",
"(",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
... | Fetch the config from the directory
@param string $directory
@param string $suffix
@return ConfigInterface | [
"Fetch",
"the",
"config",
"from",
"the",
"directory"
] | 777f66de31603fc65a88416a7b502c1a2fe6d62b | https://github.com/mizmoz/config/blob/777f66de31603fc65a88416a7b502c1a2fe6d62b/src/Config.php#L145-L166 |
7,348 | mizmoz/config | src/Config.php | Config.fromEnvironment | public static function fromEnvironment(
EnvironmentInterface $environment,
string $directory = './config'
): ConfigInterface
{
$name = $environment->name();
$projectRoot = $environment->projectRoot();
// get the config directory
$directory = (strpos($directory, '... | php | public static function fromEnvironment(
EnvironmentInterface $environment,
string $directory = './config'
): ConfigInterface
{
$name = $environment->name();
$projectRoot = $environment->projectRoot();
// get the config directory
$directory = (strpos($directory, '... | [
"public",
"static",
"function",
"fromEnvironment",
"(",
"EnvironmentInterface",
"$",
"environment",
",",
"string",
"$",
"directory",
"=",
"'./config'",
")",
":",
"ConfigInterface",
"{",
"$",
"name",
"=",
"$",
"environment",
"->",
"name",
"(",
")",
";",
"$",
... | From the environment object
@param EnvironmentInterface $environment
@param string $directory To be relative to the environment project root use ./config or /configs for full path
@return ConfigInterface | [
"From",
"the",
"environment",
"object"
] | 777f66de31603fc65a88416a7b502c1a2fe6d62b | https://github.com/mizmoz/config/blob/777f66de31603fc65a88416a7b502c1a2fe6d62b/src/Config.php#L175-L216 |
7,349 | ellipsephp/type-errors | src/Value.php | Value.type | public function type(): string
{
if (is_string($this->value)) {
return $this->string($this->value);
}
if (is_array($this->value)) {
return $this->array($this->value);
}
if (is_object($this->value)) {
return $this->object($this->value... | php | public function type(): string
{
if (is_string($this->value)) {
return $this->string($this->value);
}
if (is_array($this->value)) {
return $this->array($this->value);
}
if (is_object($this->value)) {
return $this->object($this->value... | [
"public",
"function",
"type",
"(",
")",
":",
"string",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"string",
"(",
"$",
"this",
"->",
"value",
")",
";",
"}",
"if",
"(",
"is_array",
"(",... | Return a detailled string representation of the value.
@return string | [
"Return",
"a",
"detailled",
"string",
"representation",
"of",
"the",
"value",
"."
] | 822df4d5d4df9ff2a09e903315d9aeadbe80be67 | https://github.com/ellipsephp/type-errors/blob/822df4d5d4df9ff2a09e903315d9aeadbe80be67/src/Value.php#L31-L52 |
7,350 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withHtml | public function withHtml(string $name, string $label, string $containerElementCssSelector = null)
{
$this->contentGroup->htmlAreas[$name] = [
'name' => $name,
'label' => $label,
'selector' => $containerElementCssSelector,
'order' => $this->order++,
... | php | public function withHtml(string $name, string $label, string $containerElementCssSelector = null)
{
$this->contentGroup->htmlAreas[$name] = [
'name' => $name,
'label' => $label,
'selector' => $containerElementCssSelector,
'order' => $this->order++,
... | [
"public",
"function",
"withHtml",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
",",
"string",
"$",
"containerElementCssSelector",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"contentGroup",
"->",
"htmlAreas",
"[",
"$",
"name",
"]",
"=",
"[",
"'... | Defines a HTML field.
@param string $name
@param string $label
@param string $containerElementCssSelector
@return static | [
"Defines",
"a",
"HTML",
"field",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L79-L89 |
7,351 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withText | public function withText(string $name, string $label)
{
$this->contentGroup->textAreas[$name] = ['name' => $name, 'label' => $label, 'order' => $this->order++];
return $this;
} | php | public function withText(string $name, string $label)
{
$this->contentGroup->textAreas[$name] = ['name' => $name, 'label' => $label, 'order' => $this->order++];
return $this;
} | [
"public",
"function",
"withText",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
")",
"{",
"$",
"this",
"->",
"contentGroup",
"->",
"textAreas",
"[",
"$",
"name",
"]",
"=",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'label'",
"=>",
"$",
"label... | Defines a text field.
@param string $name
@param string $label
@return static | [
"Defines",
"a",
"text",
"field",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L99-L104 |
7,352 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withFile | public function withFile(string $name, string $label, array $allowedExtensions = null)
{
$this->contentGroup->fileAreas[$name] = ['name' => $name, 'label' => $label, 'allowed_extensions' => $allowedExtensions, 'order' => $this->order++];
return $this;
} | php | public function withFile(string $name, string $label, array $allowedExtensions = null)
{
$this->contentGroup->fileAreas[$name] = ['name' => $name, 'label' => $label, 'allowed_extensions' => $allowedExtensions, 'order' => $this->order++];
return $this;
} | [
"public",
"function",
"withFile",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
",",
"array",
"$",
"allowedExtensions",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"contentGroup",
"->",
"fileAreas",
"[",
"$",
"name",
"]",
"=",
"[",
"'name'",
"... | Defines a file upload field.
@param string $name
@param string $label
@param array|null $allowedExtensions
@return static | [
"Defines",
"a",
"file",
"upload",
"field",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L115-L120 |
7,353 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withTextFromOptions | public function withTextFromOptions(string $name, string $label, array $valueLabelMap)
{
$this->contentGroup->textAreas[$name] = ['name' => $name, 'label' => $label, 'options' => $valueLabelMap, 'order' => $this->order++];
return $this;
} | php | public function withTextFromOptions(string $name, string $label, array $valueLabelMap)
{
$this->contentGroup->textAreas[$name] = ['name' => $name, 'label' => $label, 'options' => $valueLabelMap, 'order' => $this->order++];
return $this;
} | [
"public",
"function",
"withTextFromOptions",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
",",
"array",
"$",
"valueLabelMap",
")",
"{",
"$",
"this",
"->",
"contentGroup",
"->",
"textAreas",
"[",
"$",
"name",
"]",
"=",
"[",
"'name'",
"=>",
"$"... | Defines a text field that must contain a value from one of the supplied options.
@param string $name
@param string $label
@param string[] $valueLabelMap
@return static | [
"Defines",
"a",
"text",
"field",
"that",
"must",
"contain",
"a",
"value",
"from",
"one",
"of",
"the",
"supplied",
"options",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L131-L136 |
7,354 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withMetadata | public function withMetadata(string $name, string $label)
{
$this->contentGroup->metadata[$name] = ['name' => $name, 'label' => $label, 'order' => $this->order++];
return $this;
} | php | public function withMetadata(string $name, string $label)
{
$this->contentGroup->metadata[$name] = ['name' => $name, 'label' => $label, 'order' => $this->order++];
return $this;
} | [
"public",
"function",
"withMetadata",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
")",
"{",
"$",
"this",
"->",
"contentGroup",
"->",
"metadata",
"[",
"$",
"name",
"]",
"=",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'label'",
"=>",
"$",
"la... | Defines a metadata field.
@param string $name
@param string $label
@return static | [
"Defines",
"a",
"metadata",
"field",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L146-L151 |
7,355 | dms-org/package.content | src/Cms/Definition/ContentGroupDefiner.php | ContentGroupDefiner.withArrayOf | public function withArrayOf(string $name, string $label, callable $elementContentDefinitionCallback)
{
$definition = new ContentGroupDefinition('__element__', $name);
$elementContentDefinitionCallback(new self($definition));
$this->contentGroup->nestedArrayContentGroups[$name] = [
... | php | public function withArrayOf(string $name, string $label, callable $elementContentDefinitionCallback)
{
$definition = new ContentGroupDefinition('__element__', $name);
$elementContentDefinitionCallback(new self($definition));
$this->contentGroup->nestedArrayContentGroups[$name] = [
... | [
"public",
"function",
"withArrayOf",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"label",
",",
"callable",
"$",
"elementContentDefinitionCallback",
")",
"{",
"$",
"definition",
"=",
"new",
"ContentGroupDefinition",
"(",
"'__element__'",
",",
"$",
"name",
")"... | Defines an array field.
Example:
<code>
->withArrayOf('some-slider', 'Multiple Images', function (ContentGroupDefiner $group) {
$group->withImage(...);
})
</code>
@param string $name
@param string $label
@param callable $elementContentDefinitionCallback
@return static | [
"Defines",
"an",
"array",
"field",
"."
] | 6511e805c5be586c1f3740e095b49adabd621f80 | https://github.com/dms-org/package.content/blob/6511e805c5be586c1f3740e095b49adabd621f80/src/Cms/Definition/ContentGroupDefiner.php#L169-L182 |
7,356 | indigophp-archive/queue | src/Connector/BeanstalkdConnector.php | BeanstalkdConnector.doClear | protected function doClear($queue, $state)
{
try {
while ($item = $this->pheanstalk->{'peek'.$state}($queue)) {
$this->pheanstalk->delete($item);
}
} catch (ServerException $e) {
}
return true;
} | php | protected function doClear($queue, $state)
{
try {
while ($item = $this->pheanstalk->{'peek'.$state}($queue)) {
$this->pheanstalk->delete($item);
}
} catch (ServerException $e) {
}
return true;
} | [
"protected",
"function",
"doClear",
"(",
"$",
"queue",
",",
"$",
"state",
")",
"{",
"try",
"{",
"while",
"(",
"$",
"item",
"=",
"$",
"this",
"->",
"pheanstalk",
"->",
"{",
"'peek'",
".",
"$",
"state",
"}",
"(",
"$",
"queue",
")",
")",
"{",
"$",
... | Clears a specific state
@param string $queue
@param string $state
@return boolean
@codeCoverageIgnore | [
"Clears",
"a",
"specific",
"state"
] | d364d5a1fc3b00d59846b19aa472d7f2aa130ff8 | https://github.com/indigophp-archive/queue/blob/d364d5a1fc3b00d59846b19aa472d7f2aa130ff8/src/Connector/BeanstalkdConnector.php#L174-L184 |
7,357 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.checkPermission | public static function checkPermission(array $config, $registro = 0, $action = "") {
if ($action == "") {
$action = substr(request()->route()->getName(), stripos(request()->route()->getName(), "::") + 2);
}
$resultado = true;
$general = false;
if (isset($config['permi... | php | public static function checkPermission(array $config, $registro = 0, $action = "") {
if ($action == "") {
$action = substr(request()->route()->getName(), stripos(request()->route()->getName(), "::") + 2);
}
$resultado = true;
$general = false;
if (isset($config['permi... | [
"public",
"static",
"function",
"checkPermission",
"(",
"array",
"$",
"config",
",",
"$",
"registro",
"=",
"0",
",",
"$",
"action",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"action",
"==",
"\"\"",
")",
"{",
"$",
"action",
"=",
"substr",
"(",
"request",... | Evaluate the "permissions" callbacks in the configuration array
@param array $config The configuration array
@param int $registro Optional The id of the registry
@param string $action Optional The actual action
@return boolean if the user has or not permission | [
"Evaluate",
"the",
"permissions",
"callbacks",
"in",
"the",
"configuration",
"array"
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L14-L46 |
7,358 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.evaluateFilterWithSingleQuery | private static function evaluateFilterWithSingleQuery($registro, $query, $attri) {
//echo "<p>evaluando {$registro->name}</p><pre>" . print_r([$query, $attri], true) . "</pre>";
$contiene = false;
if (stripos($query, "*%") !== false) {
$contiene = true;
$query = str_repla... | php | private static function evaluateFilterWithSingleQuery($registro, $query, $attri) {
//echo "<p>evaluando {$registro->name}</p><pre>" . print_r([$query, $attri], true) . "</pre>";
$contiene = false;
if (stripos($query, "*%") !== false) {
$contiene = true;
$query = str_repla... | [
"private",
"static",
"function",
"evaluateFilterWithSingleQuery",
"(",
"$",
"registro",
",",
"$",
"query",
",",
"$",
"attri",
")",
"{",
"//echo \"<p>evaluando {$registro->name}</p><pre>\" . print_r([$query, $attri], true) . \"</pre>\";",
"$",
"contiene",
"=",
"false",
";",
... | Filter an object of a model with a single query. It will use AND operation.
If $attri is a method or function fo the object it will try to evaluate it with
$query as parametter. Use a Json string to pass more than one parametter.
If the returned value is not a boolean or null, will use the $query or the las value of
t... | [
"Filter",
"an",
"object",
"of",
"a",
"model",
"with",
"a",
"single",
"query",
".",
"It",
"will",
"use",
"AND",
"operation",
"."
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L539-L580 |
7,359 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.filterWithQuery | private static function filterWithQuery($registros, $config, $datos = [], $orOperation = "_or", $queryStr = "_q", $attriStr = "_a", $aByAStr = "_aByA") {
if (count($datos) == 0) {
$datos = request()->all();
}
//echo "<pre>" . print_r($datos, true) . "</pre>";
if (!is_bool($or... | php | private static function filterWithQuery($registros, $config, $datos = [], $orOperation = "_or", $queryStr = "_q", $attriStr = "_a", $aByAStr = "_aByA") {
if (count($datos) == 0) {
$datos = request()->all();
}
//echo "<pre>" . print_r($datos, true) . "</pre>";
if (!is_bool($or... | [
"private",
"static",
"function",
"filterWithQuery",
"(",
"$",
"registros",
",",
"$",
"config",
",",
"$",
"datos",
"=",
"[",
"]",
",",
"$",
"orOperation",
"=",
"\"_or\"",
",",
"$",
"queryStr",
"=",
"\"_q\"",
",",
"$",
"attriStr",
"=",
"\"_a\"",
",",
"$"... | Filter a collection of object models using a query an attribute sets in an array.
The values in the $datos object must be strings, if using arrays, use json notation or separate the values with an |.
If not attribute is given, it will compare against the $config('nombre'] attribute
If $query contains "*%" it will er... | [
"Filter",
"a",
"collection",
"of",
"object",
"models",
"using",
"a",
"query",
"an",
"attribute",
"sets",
"in",
"an",
"array",
"."
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L745-L780 |
7,360 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.syncHasMany | public static function syncHasMany($model, $campo, $children_items, $config) {
$children = $model->{$campo};
$children_items = collect($children_items);
$deleted_ids = $children->filter(
function ($child) use ($children_items) {
return empty(
... | php | public static function syncHasMany($model, $campo, $children_items, $config) {
$children = $model->{$campo};
$children_items = collect($children_items);
$deleted_ids = $children->filter(
function ($child) use ($children_items) {
return empty(
... | [
"public",
"static",
"function",
"syncHasMany",
"(",
"$",
"model",
",",
"$",
"campo",
",",
"$",
"children_items",
",",
"$",
"config",
")",
"{",
"$",
"children",
"=",
"$",
"model",
"->",
"{",
"$",
"campo",
"}",
";",
"$",
"children_items",
"=",
"collect",... | Sync a HasMany relationsihp
@param object $model The model to sync
@param string $campo The name of the method with the hasMany relationsihp
@param array $children_items An array with the models to sync with
@param array $config The configuration array of the model | [
"Sync",
"a",
"HasMany",
"relationsihp"
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L789-L813 |
7,361 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.validateModel | public static function validateModel(array $config, \Illuminate\Http\Request $request = null) {
if (is_null($request)) {
$request = request();
}
$rules = [];
$modeloM = class_basename($config["modelo"]);
$modelo = strtolower($modeloM);
if (isset($config['rules... | php | public static function validateModel(array $config, \Illuminate\Http\Request $request = null) {
if (is_null($request)) {
$request = request();
}
$rules = [];
$modeloM = class_basename($config["modelo"]);
$modelo = strtolower($modeloM);
if (isset($config['rules... | [
"public",
"static",
"function",
"validateModel",
"(",
"array",
"$",
"config",
",",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"request",
")",
")",
"{",
"$",
"request",
"=",
... | Runs a validation of a request based on a model and its configuration array
@param array $config The configuration array
@param Request $request Optional the request. If null, it will use request() function
@return mix Retuns the validator or false if there are no rules | [
"Runs",
"a",
"validation",
"of",
"a",
"request",
"based",
"on",
"a",
"model",
"and",
"its",
"configuration",
"array"
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L821-L872 |
7,362 | sirgrimorum/crudgenerator | src/Traits/CrudModels.php | CrudModels.buildConditionalArray | public static function buildConditionalArray(array $config, string $action = "-") {
if ($action == "") {
$action = substr(request()->route()->getName(), stripos(request()->route()->getName(), "::") + 2);
}
$condiciones = [];
$validadores = [];
$tabla = $config['tabla'... | php | public static function buildConditionalArray(array $config, string $action = "-") {
if ($action == "") {
$action = substr(request()->route()->getName(), stripos(request()->route()->getName(), "::") + 2);
}
$condiciones = [];
$validadores = [];
$tabla = $config['tabla'... | [
"public",
"static",
"function",
"buildConditionalArray",
"(",
"array",
"$",
"config",
",",
"string",
"$",
"action",
"=",
"\"-\"",
")",
"{",
"if",
"(",
"$",
"action",
"==",
"\"\"",
")",
"{",
"$",
"action",
"=",
"substr",
"(",
"request",
"(",
")",
"->",
... | Build the array for conditional fields using a configuration array
@param array $config The ocnfiguration array
@param string $action Optional the action (create, edit, etc) where the conditionals are needed | [
"Build",
"the",
"array",
"for",
"conditional",
"fields",
"using",
"a",
"configuration",
"array"
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudModels.php#L1278-L1302 |
7,363 | lucidphp/xml | src/Writer.php | Writer.useKeyAsValue | public function useKeyAsValue($key, $normalize = false)
{
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
}
$this->nodeValueKey = $normalize ? $this->normalizer->normalize($key) : $key;... | php | public function useKeyAsValue($key, $normalize = false)
{
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
}
$this->nodeValueKey = $normalize ? $this->normalizer->normalize($key) : $key;... | [
"public",
"function",
"useKeyAsValue",
"(",
"$",
"key",
",",
"$",
"normalize",
"=",
"false",
")",
"{",
"if",
"(",
"true",
"!==",
"$",
"normalize",
"&&",
"!",
"$",
"this",
"->",
"isValidNodeName",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
... | Sets the key that indicates a node value.
@param string $key
@param bool $normalize
@throws \InvalidArgumentException if $key is not null and an invalid nodename.
@return void | [
"Sets",
"the",
"key",
"that",
"indicates",
"a",
"node",
"value",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L181-L188 |
7,364 | lucidphp/xml | src/Writer.php | Writer.useKeyAsIndex | public function useKeyAsIndex($key, $normalize = false)
{
if (null === $key) {
$this->indexKey = null;
return;
}
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
... | php | public function useKeyAsIndex($key, $normalize = false)
{
if (null === $key) {
$this->indexKey = null;
return;
}
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
... | [
"public",
"function",
"useKeyAsIndex",
"(",
"$",
"key",
",",
"$",
"normalize",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"indexKey",
"=",
"null",
";",
"return",
";",
"}",
"if",
"(",
"true",
"!==",
... | Sets the index key used as key -> node identifier.
@param string $key
@param bool $normalize
@throws \InvalidArgumentException if $key is an invalid nodename.
@return void | [
"Sets",
"the",
"index",
"key",
"used",
"as",
"key",
"-",
">",
"node",
"identifier",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L199-L211 |
7,365 | lucidphp/xml | src/Writer.php | Writer.useKeyAsIndexAttribute | public function useKeyAsIndexAttribute($key, $normalize = false)
{
if (null === $key) {
$this->indexAttrKey = null;
return;
}
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid attribu... | php | public function useKeyAsIndexAttribute($key, $normalize = false)
{
if (null === $key) {
$this->indexAttrKey = null;
return;
}
if (true !== $normalize && !$this->isValidNodeName($key)) {
throw new \InvalidArgumentException(sprintf('%s is an invalid attribu... | [
"public",
"function",
"useKeyAsIndexAttribute",
"(",
"$",
"key",
",",
"$",
"normalize",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"indexAttrKey",
"=",
"null",
";",
"return",
";",
"}",
"if",
"(",
"true"... | Sets the index key used in attributes.
@param string $key
@param bool $normalize
@return void | [
"Sets",
"the",
"index",
"key",
"used",
"in",
"attributes",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L221-L233 |
7,366 | lucidphp/xml | src/Writer.php | Writer.dump | public function dump($data, $rootName = 'root')
{
$dom = $this->writeToDom($data, $rootName);
return $dom->saveXML();
} | php | public function dump($data, $rootName = 'root')
{
$dom = $this->writeToDom($data, $rootName);
return $dom->saveXML();
} | [
"public",
"function",
"dump",
"(",
"$",
"data",
",",
"$",
"rootName",
"=",
"'root'",
")",
"{",
"$",
"dom",
"=",
"$",
"this",
"->",
"writeToDom",
"(",
"$",
"data",
",",
"$",
"rootName",
")",
";",
"return",
"$",
"dom",
"->",
"saveXML",
"(",
")",
";... | Dump the input data to a xml string.
@param mixed $data
@param string $rootName the xml root element name
@return string | [
"Dump",
"the",
"input",
"data",
"to",
"a",
"xml",
"string",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L243-L248 |
7,367 | lucidphp/xml | src/Writer.php | Writer.writeToDom | public function writeToDom($data, $rootName = 'root')
{
$this->buildXML(
$dom = new DOMDocument('1.0', $this->getEncoding()),
$root = $dom->createElement($rootName),
$data
);
$dom->appendChild($root);
return $dom;
} | php | public function writeToDom($data, $rootName = 'root')
{
$this->buildXML(
$dom = new DOMDocument('1.0', $this->getEncoding()),
$root = $dom->createElement($rootName),
$data
);
$dom->appendChild($root);
return $dom;
} | [
"public",
"function",
"writeToDom",
"(",
"$",
"data",
",",
"$",
"rootName",
"=",
"'root'",
")",
"{",
"$",
"this",
"->",
"buildXML",
"(",
"$",
"dom",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"$",
"this",
"->",
"getEncoding",
"(",
")",
")",
",",
... | Write the input data to a DOMDocument
@param mixed $data
@param string $rootName the xml root element name
@return DOMDocument | [
"Write",
"the",
"input",
"data",
"to",
"a",
"DOMDocument"
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L258-L268 |
7,368 | lucidphp/xml | src/Writer.php | Writer.appendDOMNode | private function appendDOMNode(\DOMDocument $dom, $node, $name, $value = null, $hasAttributes = false)
{
$element = $dom->createElement($name);
if ($hasAttributes && $this->nodeValueKey === $name) {
$this->setElementValue($dom, $node, $value);
return;
}
$th... | php | private function appendDOMNode(\DOMDocument $dom, $node, $name, $value = null, $hasAttributes = false)
{
$element = $dom->createElement($name);
if ($hasAttributes && $this->nodeValueKey === $name) {
$this->setElementValue($dom, $node, $value);
return;
}
$th... | [
"private",
"function",
"appendDOMNode",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"$",
"node",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"hasAttributes",
"=",
"false",
")",
"{",
"$",
"element",
"=",
"$",
"dom",
"->",
"createElement",... | Appends a dom node to the DOM.
@param DOMNode $node
@param string $name
@param mixed $value
@param bool $hasAttributes
@return void | [
"Appends",
"a",
"dom",
"node",
"to",
"the",
"DOM",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L525-L537 |
7,369 | lucidphp/xml | src/Writer.php | Writer.getAttributeName | private function getAttributeName($key)
{
if (0 === strpos($key, '@') && $this->isValidNodeName($attrName = substr($key, 1))) {
return $attrName;
}
return null;
} | php | private function getAttributeName($key)
{
if (0 === strpos($key, '@') && $this->isValidNodeName($attrName = substr($key, 1))) {
return $attrName;
}
return null;
} | [
"private",
"function",
"getAttributeName",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"key",
",",
"'@'",
")",
"&&",
"$",
"this",
"->",
"isValidNodeName",
"(",
"$",
"attrName",
"=",
"substr",
"(",
"$",
"key",
",",
"1",
")"... | Extracts the raw attribute indicator.
@param string $key string with leading `@`.
@return string | [
"Extracts",
"the",
"raw",
"attribute",
"indicator",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L546-L553 |
7,370 | lucidphp/xml | src/Writer.php | Writer.createText | private function createText(\DOMDocument $dom, \DOMNode $node, $value)
{
$text = $dom->createTextNode($value);
$node->appendChild($text);
} | php | private function createText(\DOMDocument $dom, \DOMNode $node, $value)
{
$text = $dom->createTextNode($value);
$node->appendChild($text);
} | [
"private",
"function",
"createText",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"value",
")",
"{",
"$",
"text",
"=",
"$",
"dom",
"->",
"createTextNode",
"(",
"$",
"value",
")",
";",
"$",
"node",
"->",
"appendCh... | Creates a text node on a DOMNode.
@param DOMNode $node
@param string $value
@return bool | [
"Creates",
"a",
"text",
"node",
"on",
"a",
"DOMNode",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L563-L567 |
7,371 | lucidphp/xml | src/Writer.php | Writer.createCDATASection | private function createCDATASection(\DOMDocument $dom, \DOMNode $node, $value)
{
$cdata = $dom->createCDATASection($value);
$node->appendChild($cdata);
} | php | private function createCDATASection(\DOMDocument $dom, \DOMNode $node, $value)
{
$cdata = $dom->createCDATASection($value);
$node->appendChild($cdata);
} | [
"private",
"function",
"createCDATASection",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"value",
")",
"{",
"$",
"cdata",
"=",
"$",
"dom",
"->",
"createCDATASection",
"(",
"$",
"value",
")",
";",
"$",
"node",
"->"... | Creates a CDATA section node on a DOMNode.
@param DOMNode $node
@param string $value
@return void | [
"Creates",
"a",
"CDATA",
"section",
"node",
"on",
"a",
"DOMNode",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L577-L581 |
7,372 | lucidphp/xml | src/Writer.php | Writer.createTextNodeWithTypeAttribute | private function createTextNodeWithTypeAttribute(\DOMDocument $dom, \DOMNode $node, $value, $type = 'int')
{
$text = $dom->createTextNode($value);
$attr = $dom->createAttribute('type');
$attr->value = $type;
$node->appendChild($text);
$node->appendChild($attr);
} | php | private function createTextNodeWithTypeAttribute(\DOMDocument $dom, \DOMNode $node, $value, $type = 'int')
{
$text = $dom->createTextNode($value);
$attr = $dom->createAttribute('type');
$attr->value = $type;
$node->appendChild($text);
$node->appendChild($attr);
} | [
"private",
"function",
"createTextNodeWithTypeAttribute",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"value",
",",
"$",
"type",
"=",
"'int'",
")",
"{",
"$",
"text",
"=",
"$",
"dom",
"->",
"createTextNode",
"(",
"$"... | Add a value and an associated type attribute to a DOMNode.
@param DOMNode $node
@param mixed $value
@param string $type
@return void | [
"Add",
"a",
"value",
"and",
"an",
"associated",
"type",
"attribute",
"to",
"a",
"DOMNode",
"."
] | 4ff1e92c4071887c2802eb7ee3f3c46632ad7db2 | https://github.com/lucidphp/xml/blob/4ff1e92c4071887c2802eb7ee3f3c46632ad7db2/src/Writer.php#L592-L600 |
7,373 | GustavSoftware/Cache | src/CacheException.php | CacheException.invalidImplementation | public static function invalidImplementation(
string $className,
\Exception $previous = null
): self {
return new self(
"invalid class name: {$className}",
self::INVALID_IMPLEMENTATION,
$previous
);
} | php | public static function invalidImplementation(
string $className,
\Exception $previous = null
): self {
return new self(
"invalid class name: {$className}",
self::INVALID_IMPLEMENTATION,
$previous
);
} | [
"public",
"static",
"function",
"invalidImplementation",
"(",
"string",
"$",
"className",
",",
"\\",
"Exception",
"$",
"previous",
"=",
"null",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"\"invalid class name: {$className}\"",
",",
"self",
"::",
"INVAL... | This method creates an exception if the given class name of the cache
implementation to use does not implement \Gustav\Cache\ACacheManager.
@param string $className
The class name
@param \Exception|null $previous
Previous exception
@return \Gustav\Cache\CacheException
The new exception | [
"This",
"method",
"creates",
"an",
"exception",
"if",
"the",
"given",
"class",
"name",
"of",
"the",
"cache",
"implementation",
"to",
"use",
"does",
"not",
"implement",
"\\",
"Gustav",
"\\",
"Cache",
"\\",
"ACacheManager",
"."
] | 2a70db567aa13499487c24b399f7c9d46937df0d | https://github.com/GustavSoftware/Cache/blob/2a70db567aa13499487c24b399f7c9d46937df0d/src/CacheException.php#L57-L66 |
7,374 | GustavSoftware/Cache | src/CacheException.php | CacheException.badFileName | public static function badFileName(
string $fileName,
\Exception $previous = null
): self {
return new self(
"bad file name: {$fileName}",
self::BAD_FILE_NAME,
$previous
);
} | php | public static function badFileName(
string $fileName,
\Exception $previous = null
): self {
return new self(
"bad file name: {$fileName}",
self::BAD_FILE_NAME,
$previous
);
} | [
"public",
"static",
"function",
"badFileName",
"(",
"string",
"$",
"fileName",
",",
"\\",
"Exception",
"$",
"previous",
"=",
"null",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"\"bad file name: {$fileName}\"",
",",
"self",
"::",
"BAD_FILE_NAME",
",",... | This method creates an exception if the given file-name contains
invalid symbols.
@param string $fileName
The file-name
@param \Exception|null $previous
Previous exception
@return \Gustav\Cache\CacheException
The new exception | [
"This",
"method",
"creates",
"an",
"exception",
"if",
"the",
"given",
"file",
"-",
"name",
"contains",
"invalid",
"symbols",
"."
] | 2a70db567aa13499487c24b399f7c9d46937df0d | https://github.com/GustavSoftware/Cache/blob/2a70db567aa13499487c24b399f7c9d46937df0d/src/CacheException.php#L79-L88 |
7,375 | GustavSoftware/Cache | src/CacheException.php | CacheException.fileUnreadable | public static function fileUnreadable(
$fileName,
\Exception $previous = null
): self {
return new self(
"cannot read file: {$fileName}",
self::FILE_UNREADABLE,
$previous
);
} | php | public static function fileUnreadable(
$fileName,
\Exception $previous = null
): self {
return new self(
"cannot read file: {$fileName}",
self::FILE_UNREADABLE,
$previous
);
} | [
"public",
"static",
"function",
"fileUnreadable",
"(",
"$",
"fileName",
",",
"\\",
"Exception",
"$",
"previous",
"=",
"null",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"\"cannot read file: {$fileName}\"",
",",
"self",
"::",
"FILE_UNREADABLE",
",",
"... | This method creates an exception if reading of this file failed.
@param string $fileName
The file-name
@param \Exception|null $previous
Previous exception
@return \Gustav\Cache\CacheException
The new exception | [
"This",
"method",
"creates",
"an",
"exception",
"if",
"reading",
"of",
"this",
"file",
"failed",
"."
] | 2a70db567aa13499487c24b399f7c9d46937df0d | https://github.com/GustavSoftware/Cache/blob/2a70db567aa13499487c24b399f7c9d46937df0d/src/CacheException.php#L100-L109 |
7,376 | lembarek/auth | src/Repositories/UserRepository.php | UserRepository.byUsername | public function byUsername($username, $with=[])
{
$user = $this->model->whereUsername($username);
foreach($with as $relation)
$user = $user->with($relation);
return $user->first();
} | php | public function byUsername($username, $with=[])
{
$user = $this->model->whereUsername($username);
foreach($with as $relation)
$user = $user->with($relation);
return $user->first();
} | [
"public",
"function",
"byUsername",
"(",
"$",
"username",
",",
"$",
"with",
"=",
"[",
"]",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"model",
"->",
"whereUsername",
"(",
"$",
"username",
")",
";",
"foreach",
"(",
"$",
"with",
"as",
"$",
"relat... | get a single user by its username
@param string $username
@return User | [
"get",
"a",
"single",
"user",
"by",
"its",
"username"
] | 783aad2bcde9d8014be34092ba0cbe38b2bbc60a | https://github.com/lembarek/auth/blob/783aad2bcde9d8014be34092ba0cbe38b2bbc60a/src/Repositories/UserRepository.php#L23-L29 |
7,377 | AfterBug/afterbug-php | src/Exceptions/Formatter.php | Formatter.getWhoopsRunner | private function getWhoopsRunner()
{
$whoops = new Whoops();
$whoops->allowQuit(false);
$whoops->writeToOutput(false);
return $whoops;
} | php | private function getWhoopsRunner()
{
$whoops = new Whoops();
$whoops->allowQuit(false);
$whoops->writeToOutput(false);
return $whoops;
} | [
"private",
"function",
"getWhoopsRunner",
"(",
")",
"{",
"$",
"whoops",
"=",
"new",
"Whoops",
"(",
")",
";",
"$",
"whoops",
"->",
"allowQuit",
"(",
"false",
")",
";",
"$",
"whoops",
"->",
"writeToOutput",
"(",
"false",
")",
";",
"return",
"$",
"whoops"... | Get Whoops Runner.
@return Whoops | [
"Get",
"Whoops",
"Runner",
"."
] | 3eba5ed782a5922b09170c0ae29679afea6839d8 | https://github.com/AfterBug/afterbug-php/blob/3eba5ed782a5922b09170c0ae29679afea6839d8/src/Exceptions/Formatter.php#L52-L59 |
7,378 | AfterBug/afterbug-php | src/Exceptions/Formatter.php | Formatter.toArray | public function toArray()
{
$hasChainedException = PHP_VERSION_ID >= 50300;
$exception = $this->exception;
do {
$whoops = $this->getWhoopsRunner();
$whoops->pushHandler(new WhoopsHandler($this->config))->register();
$exceptions[] = json_decode(
... | php | public function toArray()
{
$hasChainedException = PHP_VERSION_ID >= 50300;
$exception = $this->exception;
do {
$whoops = $this->getWhoopsRunner();
$whoops->pushHandler(new WhoopsHandler($this->config))->register();
$exceptions[] = json_decode(
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"hasChainedException",
"=",
"PHP_VERSION_ID",
">=",
"50300",
";",
"$",
"exception",
"=",
"$",
"this",
"->",
"exception",
";",
"do",
"{",
"$",
"whoops",
"=",
"$",
"this",
"->",
"getWhoopsRunner",
"(",
"... | Format exception as array.
@return array | [
"Format",
"exception",
"as",
"array",
"."
] | 3eba5ed782a5922b09170c0ae29679afea6839d8 | https://github.com/AfterBug/afterbug-php/blob/3eba5ed782a5922b09170c0ae29679afea6839d8/src/Exceptions/Formatter.php#L104-L147 |
7,379 | cundd/test-flight | src/Assert.php | Assert.assert | public static function assert($assertion, string $message = '')
{
self::$count += 1;
assert($assertion, new AssertionError($message));
} | php | public static function assert($assertion, string $message = '')
{
self::$count += 1;
assert($assertion, new AssertionError($message));
} | [
"public",
"static",
"function",
"assert",
"(",
"$",
"assertion",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"assert",
"(",
"$",
"assertion",
",",
"new",
"AssertionError",
"(",
"$",
"message",
")",
... | Test if the assertion is true
@example
\Cundd\TestFlight\Assert::assert(true);
test_flight_throws(function() {
\Cundd\TestFlight\Assert::assert(false);
});
@param mixed $assertion
@param string $message | [
"Test",
"if",
"the",
"assertion",
"is",
"true"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L33-L37 |
7,380 | cundd/test-flight | src/Assert.php | Assert.assertSame | public static function assertSame($expected, $actual, string $message = '')
{
self::$count += 1;
if ($expected === $actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s matches %s',
var_export($act... | php | public static function assertSame($expected, $actual, string $message = '')
{
self::$count += 1;
if ($expected === $actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s matches %s',
var_export($act... | [
"public",
"static",
"function",
"assertSame",
"(",
"$",
"expected",
",",
"$",
"actual",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"if",
"(",
"$",
"expected",
"===",
"$",
"actual",
")",
"{",
"ret... | Test if the actual value matches the expected
@example
\Cundd\TestFlight\Assert::assertSame([], []);
\Cundd\TestFlight\Assert::assertSame(true, true);
\Cundd\TestFlight\Assert::assertSame(PHP_INT_MAX, PHP_INT_MAX);
$object = new stdClass(); \Cundd\TestFlight\Assert::assertSame($object, $object);
test_flight_throws(fun... | [
"Test",
"if",
"the",
"actual",
"value",
"matches",
"the",
"expected"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L56-L71 |
7,381 | cundd/test-flight | src/Assert.php | Assert.assertTrue | public static function assertTrue($actual, string $message = '')
{
self::$count += 1;
if ((bool)$actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is truthy',
var_export($actual, true)
... | php | public static function assertTrue($actual, string $message = '')
{
self::$count += 1;
if ((bool)$actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is truthy',
var_export($actual, true)
... | [
"public",
"static",
"function",
"assertTrue",
"(",
"$",
"actual",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"if",
"(",
"(",
"bool",
")",
"$",
"actual",
")",
"{",
"return",
";",
"}",
"if",
"(",... | Test if the value is truthy
@example
\Cundd\TestFlight\Assert::assertTrue(true);
\Cundd\TestFlight\Assert::assertTrue(1);
\Cundd\TestFlight\Assert::assertTrue(' ');
\Cundd\TestFlight\Assert::assertTrue('1');
\Cundd\TestFlight\Assert::assertTrue(new stdClass());
\Cundd\TestFlight\Assert::assertTrue([1]);
test_flight_th... | [
"Test",
"if",
"the",
"value",
"is",
"truthy"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L93-L108 |
7,382 | cundd/test-flight | src/Assert.php | Assert.assertFalse | public static function assertFalse($actual, string $message = '')
{
self::$count += 1;
if (false === (bool)$actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is falsy',
var_export($actual, true... | php | public static function assertFalse($actual, string $message = '')
{
self::$count += 1;
if (false === (bool)$actual) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is falsy',
var_export($actual, true... | [
"public",
"static",
"function",
"assertFalse",
"(",
"$",
"actual",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"if",
"(",
"false",
"===",
"(",
"bool",
")",
"$",
"actual",
")",
"{",
"return",
";",
... | Test if the value is falsy
@example
\Cundd\TestFlight\Assert::assertFalse(false);
\Cundd\TestFlight\Assert::assertFalse(0);
\Cundd\TestFlight\Assert::assertFalse('');
\Cundd\TestFlight\Assert::assertFalse(null);
\Cundd\TestFlight\Assert::assertFalse([]);
test_flight_throws(function() { \Cundd\TestFlight\Assert::assert... | [
"Test",
"if",
"the",
"value",
"is",
"falsy"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L130-L145 |
7,383 | cundd/test-flight | src/Assert.php | Assert.throws | public static function throws(callable $callback, string $expectedException = '', string $message = '')
{
self::$count += 1;
$exception = null;
try {
$callback();
} catch (\Error $exception) {
} catch (\Exception $exception) {
}
if ($exception ... | php | public static function throws(callable $callback, string $expectedException = '', string $message = '')
{
self::$count += 1;
$exception = null;
try {
$callback();
} catch (\Error $exception) {
} catch (\Exception $exception) {
}
if ($exception ... | [
"public",
"static",
"function",
"throws",
"(",
"callable",
"$",
"callback",
",",
"string",
"$",
"expectedException",
"=",
"''",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"$",
"exception",
"=",
"null... | Test if the callback throws an exception
@example
test_flight_throws(function() { throw new \Exception(); });
test_flight_throws(function() { throw new \RuntimeException(); }, 'RuntimeException');
$didThrow = false;
try {
test_flight_throws(function() { return true; });
} catch (\Cundd\TestFlight\Exception\Assertion... | [
"Test",
"if",
"the",
"callback",
"throws",
"an",
"exception"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L179-L203 |
7,384 | cundd/test-flight | src/Assert.php | Assert.assertInstanceOf | public static function assertInstanceOf(string $className, $actual, string $message = '')
{
self::$count += 1;
if ($actual instanceof $className) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is an instance of %s'... | php | public static function assertInstanceOf(string $className, $actual, string $message = '')
{
self::$count += 1;
if ($actual instanceof $className) {
return;
}
if (!$message) {
$message = sprintf(
'Failed asserting that %s is an instance of %s'... | [
"public",
"static",
"function",
"assertInstanceOf",
"(",
"string",
"$",
"className",
",",
"$",
"actual",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"if",
"(",
"$",
"actual",
"instanceof",
"$",
"class... | Test if the given object is an instance of the given class
@example
\Cundd\TestFlight\Assert::assertInstanceOf(stdClass::class, new stdClass());
\Cundd\TestFlight\Assert::assertInstanceOf('stdClass', new stdClass());
test_flight_throws(function() { \Cundd\TestFlight\Assert::assertInstanceOf('stdClass', new Exception()... | [
"Test",
"if",
"the",
"given",
"object",
"is",
"an",
"instance",
"of",
"the",
"given",
"class"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L218-L234 |
7,385 | cundd/test-flight | src/Assert.php | Assert.assertTypeOf | public static function assertTypeOf(string $type, $actual, string $message = '')
{
self::$count += 1;
switch (strtolower($type)) {
case 'array':
if (is_array($actual)) {
return;
}
break;
case 'resource':
... | php | public static function assertTypeOf(string $type, $actual, string $message = '')
{
self::$count += 1;
switch (strtolower($type)) {
case 'array':
if (is_array($actual)) {
return;
}
break;
case 'resource':
... | [
"public",
"static",
"function",
"assertTypeOf",
"(",
"string",
"$",
"type",
",",
"$",
"actual",
",",
"string",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"$",
"count",
"+=",
"1",
";",
"switch",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
... | Test if the given value is an instance of the given type
@example
\Cundd\TestFlight\Assert::assertTypeOf('array', []);
\Cundd\TestFlight\Assert::assertTypeOf('Array', []);
\Cundd\TestFlight\Assert::assertTypeOf('object', new stdClass());
\Cundd\TestFlight\Assert::assertTypeOf('int', 0);
\Cundd\TestFlight\Assert::asser... | [
"Test",
"if",
"the",
"given",
"value",
"is",
"an",
"instance",
"of",
"the",
"given",
"type"
] | 9d8424dfb586f823f9dad2dcb81ff3986e255d56 | https://github.com/cundd/test-flight/blob/9d8424dfb586f823f9dad2dcb81ff3986e255d56/src/Assert.php#L262-L343 |
7,386 | blenderdeluxe/khipu | src/Khipu.php | Khipu.loadService | public function loadService($service_name) {
// Definimos el nombre de la clase completa del servicio.
$class = 'BlenderDeluxe\Khipu\KhipuService\KhipuService' . $service_name;
// Asignamos la ruta del archivo que contiene la clase.
// Consultamos si existe el archivo.
if (class_exists($class)) {
... | php | public function loadService($service_name) {
// Definimos el nombre de la clase completa del servicio.
$class = 'BlenderDeluxe\Khipu\KhipuService\KhipuService' . $service_name;
// Asignamos la ruta del archivo que contiene la clase.
// Consultamos si existe el archivo.
if (class_exists($class)) {
... | [
"public",
"function",
"loadService",
"(",
"$",
"service_name",
")",
"{",
"// Definimos el nombre de la clase completa del servicio.",
"$",
"class",
"=",
"'BlenderDeluxe\\Khipu\\KhipuService\\KhipuService'",
".",
"$",
"service_name",
";",
"// Asignamos la ruta del archivo que contie... | Carga el servicio y retorna el objeto, en caso de no existir el servicio,
se invoca un excepcion. | [
"Carga",
"el",
"servicio",
"y",
"retorna",
"el",
"objeto",
"en",
"caso",
"de",
"no",
"existir",
"el",
"servicio",
"se",
"invoca",
"un",
"excepcion",
"."
] | ef78fa8ba372c7784936ce95a3d0bd46a35e0143 | https://github.com/blenderdeluxe/khipu/blob/ef78fa8ba372c7784936ce95a3d0bd46a35e0143/src/Khipu.php#L75-L104 |
7,387 | blenderdeluxe/khipu | src/Khipu.php | Khipu.getUrlService | public static function getUrlService($service_name) {
$url_khipu = 'https://khipu.com/api/' . self::VERSION_KHIPU_SERVICE . '/';
$services_name = self::getAllServicesName();
if (array_key_exists($service_name, $services_name)) {
$str = $service_name;
$str[0] = strtolower($str[0]);
re... | php | public static function getUrlService($service_name) {
$url_khipu = 'https://khipu.com/api/' . self::VERSION_KHIPU_SERVICE . '/';
$services_name = self::getAllServicesName();
if (array_key_exists($service_name, $services_name)) {
$str = $service_name;
$str[0] = strtolower($str[0]);
re... | [
"public",
"static",
"function",
"getUrlService",
"(",
"$",
"service_name",
")",
"{",
"$",
"url_khipu",
"=",
"'https://khipu.com/api/'",
".",
"self",
"::",
"VERSION_KHIPU_SERVICE",
".",
"'/'",
";",
"$",
"services_name",
"=",
"self",
"::",
"getAllServicesName",
"(",... | Funcion que retorna las URL de los servicios de Khipu.
@param string $service_name
Nombre del servicio | [
"Funcion",
"que",
"retorna",
"las",
"URL",
"de",
"los",
"servicios",
"de",
"Khipu",
"."
] | ef78fa8ba372c7784936ce95a3d0bd46a35e0143 | https://github.com/blenderdeluxe/khipu/blob/ef78fa8ba372c7784936ce95a3d0bd46a35e0143/src/Khipu.php#L112-L123 |
7,388 | blenderdeluxe/khipu | src/Khipu.php | Khipu.getAllServicesName | public static function getAllServicesName() {
return array(
'CreateEmail' => TRUE,
'CreatePaymentPage' => TRUE,
'CreatePaymentURL' => TRUE,
'VerifyPaymentNotification' => FALSE,
'ReceiverStatus' => TRUE,
'SetBillExpired' => TRUE,
'SetPaidByReceiver' => TRUE,
'SetRejec... | php | public static function getAllServicesName() {
return array(
'CreateEmail' => TRUE,
'CreatePaymentPage' => TRUE,
'CreatePaymentURL' => TRUE,
'VerifyPaymentNotification' => FALSE,
'ReceiverStatus' => TRUE,
'SetBillExpired' => TRUE,
'SetPaidByReceiver' => TRUE,
'SetRejec... | [
"public",
"static",
"function",
"getAllServicesName",
"(",
")",
"{",
"return",
"array",
"(",
"'CreateEmail'",
"=>",
"TRUE",
",",
"'CreatePaymentPage'",
"=>",
"TRUE",
",",
"'CreatePaymentURL'",
"=>",
"TRUE",
",",
"'VerifyPaymentNotification'",
"=>",
"FALSE",
",",
"... | Funcion que retorna los nombre de servicios que existen y si se requiere
identificarse. | [
"Funcion",
"que",
"retorna",
"los",
"nombre",
"de",
"servicios",
"que",
"existen",
"y",
"si",
"se",
"requiere",
"identificarse",
"."
] | ef78fa8ba372c7784936ce95a3d0bd46a35e0143 | https://github.com/blenderdeluxe/khipu/blob/ef78fa8ba372c7784936ce95a3d0bd46a35e0143/src/Khipu.php#L130-L145 |
7,389 | Dhii/normalization-helper-base | src/NormalizeStringableCapableTrait.php | NormalizeStringableCapableTrait._normalizeStringable | protected function _normalizeStringable($stringable)
{
if (!is_scalar($stringable)
&& !($stringable instanceof Stringable)
) {
throw $this->_createInvalidArgumentException($this->__('Not a stringable value'), null, null, $stringable);
}
return $stringable;
... | php | protected function _normalizeStringable($stringable)
{
if (!is_scalar($stringable)
&& !($stringable instanceof Stringable)
) {
throw $this->_createInvalidArgumentException($this->__('Not a stringable value'), null, null, $stringable);
}
return $stringable;
... | [
"protected",
"function",
"_normalizeStringable",
"(",
"$",
"stringable",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"stringable",
")",
"&&",
"!",
"(",
"$",
"stringable",
"instanceof",
"Stringable",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"_createI... | Normalizes a stringable value.
Useful to make sure that a value can be converted to string in a meaningful way.
@since [*next-version*]
@param Stringable|string|int|float|bool $stringable The value to normalize.
Can be an object that implements {@see Stringable}, or scalar type -
basically anything that can be conve... | [
"Normalizes",
"a",
"stringable",
"value",
"."
] | 1b64f0ea6b3e32f9478f854f6049500795b51da7 | https://github.com/Dhii/normalization-helper-base/blob/1b64f0ea6b3e32f9478f854f6049500795b51da7/src/NormalizeStringableCapableTrait.php#L32-L41 |
7,390 | dmitrymomot/slim-mvc | src/Model.php | Model.setConnectionConfig | public static function setConnectionConfig()
{
if (!static::$_dbConnectionConfig) {
$config = static::_getDbConnectionConfig();
if (!is_array($config) || empty($config))
throw new \ErrorException(
'Not set configuration of database in file '
.APPPATH.'config/database.php. '
.'See example '._... | php | public static function setConnectionConfig()
{
if (!static::$_dbConnectionConfig) {
$config = static::_getDbConnectionConfig();
if (!is_array($config) || empty($config))
throw new \ErrorException(
'Not set configuration of database in file '
.APPPATH.'config/database.php. '
.'See example '._... | [
"public",
"static",
"function",
"setConnectionConfig",
"(",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"_dbConnectionConfig",
")",
"{",
"$",
"config",
"=",
"static",
"::",
"_getDbConnectionConfig",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Set connection settings
@return void | [
"Set",
"connection",
"settings"
] | 432f694bc7263204e09a1261177d5df84353a8af | https://github.com/dmitrymomot/slim-mvc/blob/432f694bc7263204e09a1261177d5df84353a8af/src/Model.php#L21-L34 |
7,391 | dmitrymomot/slim-mvc | src/Model.php | Model._setDbConnectionConfig | protected static function _setDbConnectionConfig(array $config)
{
$app = \Slim\Slim::getInstance();
$cfg = Config::instance();
$cfg->set_connections($config);
$cfg->set_default_connection($app->config('mode'));
} | php | protected static function _setDbConnectionConfig(array $config)
{
$app = \Slim\Slim::getInstance();
$cfg = Config::instance();
$cfg->set_connections($config);
$cfg->set_default_connection($app->config('mode'));
} | [
"protected",
"static",
"function",
"_setDbConnectionConfig",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"app",
"=",
"\\",
"Slim",
"\\",
"Slim",
"::",
"getInstance",
"(",
")",
";",
"$",
"cfg",
"=",
"Config",
"::",
"instance",
"(",
")",
";",
"$",
"cfg",... | Sets database configs
@param array $config
@return void | [
"Sets",
"database",
"configs"
] | 432f694bc7263204e09a1261177d5df84353a8af | https://github.com/dmitrymomot/slim-mvc/blob/432f694bc7263204e09a1261177d5df84353a8af/src/Model.php#L54-L60 |
7,392 | hglattergotz/metrics | src/HGG/Metrics/Metrics.php | Metrics.toArray | public function toArray()
{
if ($this->timer !== null) {
$this->values['elapsed-time'] = $this->timer->getElapsedTime(true);
}
return $this->values;
} | php | public function toArray()
{
if ($this->timer !== null) {
$this->values['elapsed-time'] = $this->timer->getElapsedTime(true);
}
return $this->values;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"timer",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"'elapsed-time'",
"]",
"=",
"$",
"this",
"->",
"timer",
"->",
"getElapsedTime",
"(",
"true",
")",
";",
... | Return the results as an array
If the timer option is on also add the elapsed time to the result array and
format it to hh:mm:ss if greater than one second
@return array | [
"Return",
"the",
"results",
"as",
"an",
"array"
] | 0fc0c445ee78a53b0b1fa4c36179e47ac1fa0538 | https://github.com/hglattergotz/metrics/blob/0fc0c445ee78a53b0b1fa4c36179e47ac1fa0538/src/HGG/Metrics/Metrics.php#L123-L130 |
7,393 | stakhanovist/worker | library/ProcessStrategy/ForwardProcessorStrategy.php | ForwardProcessorStrategy.postProcess | public function postProcess(ProcessEvent $e)
{
$appEvent = clone $e->getWorker()->getEvent();
$appEvent->setTarget($appEvent->getApplication());
$appEvents = $appEvent->getApplication()->getEventManager();
$appResponse = clone $appEvent->getResponse();
$appEve... | php | public function postProcess(ProcessEvent $e)
{
$appEvent = clone $e->getWorker()->getEvent();
$appEvent->setTarget($appEvent->getApplication());
$appEvents = $appEvent->getApplication()->getEventManager();
$appResponse = clone $appEvent->getResponse();
$appEve... | [
"public",
"function",
"postProcess",
"(",
"ProcessEvent",
"$",
"e",
")",
"{",
"$",
"appEvent",
"=",
"clone",
"$",
"e",
"->",
"getWorker",
"(",
")",
"->",
"getEvent",
"(",
")",
";",
"$",
"appEvent",
"->",
"setTarget",
"(",
"$",
"appEvent",
"->",
"getApp... | Render the processor result.
The result is rendered triggering a "render" event on a cloned MvcEvent,
simulating the usual MVC render flow.
@todo investigate if simulation works in all cases
@param ProcessEvent $e | [
"Render",
"the",
"processor",
"result",
"."
] | 63f6aaeb06986a7c39b5e5c4be742b92942b5d3f | https://github.com/stakhanovist/worker/blob/63f6aaeb06986a7c39b5e5c4be742b92942b5d3f/library/ProcessStrategy/ForwardProcessorStrategy.php#L88-L106 |
7,394 | FelixOnline/Core | src/FelixOnline/Core/CurrentUser.php | CurrentUser.createSession | public function createSession()
{
if (!$this->getUser()) {
throw new \Exceptions\InternalException('Will not create session where no user is set');
}
$this->destroySessions(); // Delete old sessions for user
$app = App::getInstance();
$sql = $app['safesql']->qu... | php | public function createSession()
{
if (!$this->getUser()) {
throw new \Exceptions\InternalException('Will not create session where no user is set');
}
$this->destroySessions(); // Delete old sessions for user
$app = App::getInstance();
$sql = $app['safesql']->qu... | [
"public",
"function",
"createSession",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exceptions",
"\\",
"InternalException",
"(",
"'Will not create session where no user is set'",
")",
";",
"}",
"$",
... | Create session for user | [
"Create",
"session",
"for",
"user"
] | b29f50cd96cee73da83968ee1eb88d8b3ab1c430 | https://github.com/FelixOnline/Core/blob/b29f50cd96cee73da83968ee1eb88d8b3ab1c430/src/FelixOnline/Core/CurrentUser.php#L73-L113 |
7,395 | indigophp-archive/codeception-fuel-module | fuel/fuel/packages/email/classes/email/driver/sendmail.php | Email_Driver_Sendmail._send | protected function _send()
{
// Build the message
$message = $this->build_message();
// Open a connection
$return_path = ($this->config['return_path'] !== false) ? $this->config['return_path'] : $this->config['from']['email'];
$handle = @popen($this->config['sendmail_path'] . " -oi -f ".$return_path." -t", ... | php | protected function _send()
{
// Build the message
$message = $this->build_message();
// Open a connection
$return_path = ($this->config['return_path'] !== false) ? $this->config['return_path'] : $this->config['from']['email'];
$handle = @popen($this->config['sendmail_path'] . " -oi -f ".$return_path." -t", ... | [
"protected",
"function",
"_send",
"(",
")",
"{",
"// Build the message",
"$",
"message",
"=",
"$",
"this",
"->",
"build_message",
"(",
")",
";",
"// Open a connection",
"$",
"return_path",
"=",
"(",
"$",
"this",
"->",
"config",
"[",
"'return_path'",
"]",
"!=... | Initalted all needed for Sendmail mailing.
@throws \SendmailConnectionException Could not open a sendmail connection
@throws \SendmailFailedException Failed sending email through sendmail
@return bool Success boolean | [
"Initalted",
"all",
"needed",
"for",
"Sendmail",
"mailing",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/packages/email/classes/email/driver/sendmail.php#L32-L59 |
7,396 | bd808/moar-net-http | src/Moar/Net/Http/Request.php | Request.addQueryData | public function addQueryData ($parms) {
$this->setUrl(Util::addQueryData($this->getUrl(), $parms));
return $this;
} | php | public function addQueryData ($parms) {
$this->setUrl(Util::addQueryData($this->getUrl(), $parms));
return $this;
} | [
"public",
"function",
"addQueryData",
"(",
"$",
"parms",
")",
"{",
"$",
"this",
"->",
"setUrl",
"(",
"Util",
"::",
"addQueryData",
"(",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"$",
"parms",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Append a query string to the current URL.
@param string|array $parms Parameters to add as query string to url
@return Request Self, for message chaining | [
"Append",
"a",
"query",
"string",
"to",
"the",
"current",
"URL",
"."
] | 828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf | https://github.com/bd808/moar-net-http/blob/828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf/src/Moar/Net/Http/Request.php#L267-L270 |
7,397 | bd808/moar-net-http | src/Moar/Net/Http/Request.php | Request.setCredentials | public function setCredentials ($user, $password, $type = CURLAUTH_ANYSAFE) {
$this->addCurlOption(CURLOPT_HTTPAUTH, $type);
$this->addCurlOption(CURLOPT_USERPWD, "{$user}:{$password}");
return $this;
} | php | public function setCredentials ($user, $password, $type = CURLAUTH_ANYSAFE) {
$this->addCurlOption(CURLOPT_HTTPAUTH, $type);
$this->addCurlOption(CURLOPT_USERPWD, "{$user}:{$password}");
return $this;
} | [
"public",
"function",
"setCredentials",
"(",
"$",
"user",
",",
"$",
"password",
",",
"$",
"type",
"=",
"CURLAUTH_ANYSAFE",
")",
"{",
"$",
"this",
"->",
"addCurlOption",
"(",
"CURLOPT_HTTPAUTH",
",",
"$",
"type",
")",
";",
"$",
"this",
"->",
"addCurlOption"... | Set credentials for authenticating to remote host.
@param string $user Username
@param string $password Password
@param int $type Auth type to attempt. See CURLOPT_HTTPAUTH section of
curl_setopt page at php.net for options.
@return Request Self, for message chaining | [
"Set",
"credentials",
"for",
"authenticating",
"to",
"remote",
"host",
"."
] | 828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf | https://github.com/bd808/moar-net-http/blob/828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf/src/Moar/Net/Http/Request.php#L385-L389 |
7,398 | bd808/moar-net-http | src/Moar/Net/Http/Request.php | Request.setX509Credentials | public function setX509Credentials ($cert, $key, $keypass, $type = 'PEM') {
$this->addCurlOption(CURLOPT_SSLCERTTYPE, $type);
$this->addCurlOption(CURLOPT_SSLCERT, $cert);
$this->addCurlOption(CURLOPT_SSLKEY, $key);
$this->addCurlOption(CURLOPT_SSLKEYPASSWD, $keypass);
return $this;
} | php | public function setX509Credentials ($cert, $key, $keypass, $type = 'PEM') {
$this->addCurlOption(CURLOPT_SSLCERTTYPE, $type);
$this->addCurlOption(CURLOPT_SSLCERT, $cert);
$this->addCurlOption(CURLOPT_SSLKEY, $key);
$this->addCurlOption(CURLOPT_SSLKEYPASSWD, $keypass);
return $this;
} | [
"public",
"function",
"setX509Credentials",
"(",
"$",
"cert",
",",
"$",
"key",
",",
"$",
"keypass",
",",
"$",
"type",
"=",
"'PEM'",
")",
"{",
"$",
"this",
"->",
"addCurlOption",
"(",
"CURLOPT_SSLCERTTYPE",
",",
"$",
"type",
")",
";",
"$",
"this",
"->",... | Set x509 credentials for authenticating to remote host.
@param string $cert Path to x509 certificate
@param string $key Patch to x509 private key
@param string $keypass Passphrase to decrypt private key
@param string $type Certificate encoding (PEM|DER|ENG)
@return Request Self, for message chaining | [
"Set",
"x509",
"credentials",
"for",
"authenticating",
"to",
"remote",
"host",
"."
] | 828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf | https://github.com/bd808/moar-net-http/blob/828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf/src/Moar/Net/Http/Request.php#L401-L407 |
7,399 | bd808/moar-net-http | src/Moar/Net/Http/Request.php | Request.setCookieJar | public function setCookieJar ($file) {
if (null !== $file) {
$this->addCurlOption(CURLOPT_COOKIEFILE, $file); //read from file
$this->addCurlOption(CURLOPT_COOKIEJAR, $file); //write to file
}
return $this;
} | php | public function setCookieJar ($file) {
if (null !== $file) {
$this->addCurlOption(CURLOPT_COOKIEFILE, $file); //read from file
$this->addCurlOption(CURLOPT_COOKIEJAR, $file); //write to file
}
return $this;
} | [
"public",
"function",
"setCookieJar",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"addCurlOption",
"(",
"CURLOPT_COOKIEFILE",
",",
"$",
"file",
")",
";",
"//read from file",
"$",
"this",
"->",
"addCurlO... | Read and store cookies in the provided file.
@param string $file Path to cookie storage file
@return Request Self, for message chaining | [
"Read",
"and",
"store",
"cookies",
"in",
"the",
"provided",
"file",
"."
] | 828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf | https://github.com/bd808/moar-net-http/blob/828ddb020f6f6b87d0e5e4506c17b5b9c0c25eaf/src/Moar/Net/Http/Request.php#L416-L422 |
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.