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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
201,700 | fulgurio/LightCMSBundle | Form/Handler/AdminPageHandler.php | AdminPageHandler.initPageMetas | final protected function initPageMetas(Page $page)
{
if (!isset($this->pageMetas))
{
$this->pageMetas = array();
if ($page->getId() > 0)
{
$metas = $this->doctrine->getRepository('FulgurioLightCMSBundle:PageMeta')->findByPage($page->getId());
... | php | final protected function initPageMetas(Page $page)
{
if (!isset($this->pageMetas))
{
$this->pageMetas = array();
if ($page->getId() > 0)
{
$metas = $this->doctrine->getRepository('FulgurioLightCMSBundle:PageMeta')->findByPage($page->getId());
... | [
"final",
"protected",
"function",
"initPageMetas",
"(",
"Page",
"$",
"page",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"pageMetas",
")",
")",
"{",
"$",
"this",
"->",
"pageMetas",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"page",... | Init page meta of page
@param Page $page | [
"Init",
"page",
"meta",
"of",
"page"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Form/Handler/AdminPageHandler.php#L232-L246 |
201,701 | prolic/HumusMvc | src/HumusMvc/Controller/Action/HelperPluginManager.php | HelperPluginManager.getClassName | public function getClassName($name)
{
if (!$this->has($name)) {
return false;
}
$helper = $this->get($name);
return get_class($helper);
} | php | public function getClassName($name)
{
if (!$this->has($name)) {
return false;
}
$helper = $this->get($name);
return get_class($helper);
} | [
"public",
"function",
"getClassName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"helper",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
";",
... | Return full class name for a named helper
@param string $name
@return string|false | [
"Return",
"full",
"class",
"name",
"for",
"a",
"named",
"helper"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/Controller/Action/HelperPluginManager.php#L114-L121 |
201,702 | itcreator/custom-cmf | Module/Component/src/Cmf/Component/Grid/Pager/Adapter/Traversable.php | Traversable.getItems | public function getItems($offset, $limit, $sort = null)
{
$items = [];
$cnt = count($this->rawData);
for ($i = $offset; $i < $offset + $limit && $i < $cnt; $i++) {
$items[] = $this->rawData[$i];
}
return $items;
} | php | public function getItems($offset, $limit, $sort = null)
{
$items = [];
$cnt = count($this->rawData);
for ($i = $offset; $i < $offset + $limit && $i < $cnt; $i++) {
$items[] = $this->rawData[$i];
}
return $items;
} | [
"public",
"function",
"getItems",
"(",
"$",
"offset",
",",
"$",
"limit",
",",
"$",
"sort",
"=",
"null",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"$",
"cnt",
"=",
"count",
"(",
"$",
"this",
"->",
"rawData",
")",
";",
"for",
"(",
"$",
"i",
"... | This method return an collection of items for a page.
@param integer $offset
@param integer $limit
@param \Cmf\System\Sort $sort
@return array | [
"This",
"method",
"return",
"an",
"collection",
"of",
"items",
"for",
"a",
"page",
"."
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/Component/src/Cmf/Component/Grid/Pager/Adapter/Traversable.php#L35-L44 |
201,703 | khelonium/refactoring-time | src/Refactoring/Time/Interval.php | Interval.overlaps | public function overlaps(IntervalInterface $interval)
{
$startDate = $interval->getStart();
$endDate = $interval->getEnd();
return $this->checkOverlaping($startDate, $endDate);
} | php | public function overlaps(IntervalInterface $interval)
{
$startDate = $interval->getStart();
$endDate = $interval->getEnd();
return $this->checkOverlaping($startDate, $endDate);
} | [
"public",
"function",
"overlaps",
"(",
"IntervalInterface",
"$",
"interval",
")",
"{",
"$",
"startDate",
"=",
"$",
"interval",
"->",
"getStart",
"(",
")",
";",
"$",
"endDate",
"=",
"$",
"interval",
"->",
"getEnd",
"(",
")",
";",
"return",
"$",
"this",
... | Checks if the interval overlaps another interval
@param IntervalInterface $interval
@return bool true if overal occurs | [
"Checks",
"if",
"the",
"interval",
"overlaps",
"another",
"interval"
] | 6fad6a2ea329167789b09898dcf8e0b11db33109 | https://github.com/khelonium/refactoring-time/blob/6fad6a2ea329167789b09898dcf8e0b11db33109/src/Refactoring/Time/Interval.php#L47-L53 |
201,704 | khelonium/refactoring-time | src/Refactoring/Time/Interval.php | Interval.toArray | public function toArray()
{
$start = $this->intervalStart;
$end = $this->intervalEnd;
$period = new \DatePeriod($start, new \DateInterval('P1D'), $end);
$days = array();
foreach ($period as $current_day) {
$days[] = $current_day;
}
... | php | public function toArray()
{
$start = $this->intervalStart;
$end = $this->intervalEnd;
$period = new \DatePeriod($start, new \DateInterval('P1D'), $end);
$days = array();
foreach ($period as $current_day) {
$days[] = $current_day;
}
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"start",
"=",
"$",
"this",
"->",
"intervalStart",
";",
"$",
"end",
"=",
"$",
"this",
"->",
"intervalEnd",
";",
"$",
"period",
"=",
"new",
"\\",
"DatePeriod",
"(",
"$",
"start",
",",
"new",
"\\",
... | Array of \DateTime objects | [
"Array",
"of",
"\\",
"DateTime",
"objects"
] | 6fad6a2ea329167789b09898dcf8e0b11db33109 | https://github.com/khelonium/refactoring-time/blob/6fad6a2ea329167789b09898dcf8e0b11db33109/src/Refactoring/Time/Interval.php#L141-L155 |
201,705 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.initializeAttributeOnData | protected function initializeAttributeOnData( $attribute )
{
$explicitPath = $this->getLeadingExplicitAttributePath( $attribute );
$data = $this->extractDataFromPath( $explicitPath );
if ( !Str::contains( $attribute, '*' ) || Str::endsWith( $attribute, '*' ) )
{
return $data;
}
return data_set( $data... | php | protected function initializeAttributeOnData( $attribute )
{
$explicitPath = $this->getLeadingExplicitAttributePath( $attribute );
$data = $this->extractDataFromPath( $explicitPath );
if ( !Str::contains( $attribute, '*' ) || Str::endsWith( $attribute, '*' ) )
{
return $data;
}
return data_set( $data... | [
"protected",
"function",
"initializeAttributeOnData",
"(",
"$",
"attribute",
")",
"{",
"$",
"explicitPath",
"=",
"$",
"this",
"->",
"getLeadingExplicitAttributePath",
"(",
"$",
"attribute",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"extractDataFromPath",
"(... | Gather a copy of the attribute data filled with any missing attributes.
@param string $attribute
@return array | [
"Gather",
"a",
"copy",
"of",
"the",
"attribute",
"data",
"filled",
"with",
"any",
"missing",
"attributes",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L354-L366 |
201,706 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.shouldStopValidating | protected function shouldStopValidating( $attribute )
{
if ( !$this->hasRule( $attribute, ['Bail'] ) )
{
return false;
}
return $this->messages->has( $attribute );
} | php | protected function shouldStopValidating( $attribute )
{
if ( !$this->hasRule( $attribute, ['Bail'] ) )
{
return false;
}
return $this->messages->has( $attribute );
} | [
"protected",
"function",
"shouldStopValidating",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"attribute",
",",
"[",
"'Bail'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"... | Stop on error if "bail" rule is assigned and attribute has a message.
@param string $attribute
@return bool | [
"Stop",
"on",
"error",
"if",
"bail",
"rule",
"is",
"assigned",
"and",
"attribute",
"has",
"a",
"message",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L695-L703 |
201,707 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateArray | protected function validateArray( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_array( $value );
} | php | protected function validateArray( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_array( $value );
} | [
"protected",
"function",
"validateArray",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"is_null",
"(",
"$",
"value",
... | Validate that an attribute is an array.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"is",
"an",
"array",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1050-L1058 |
201,708 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateInteger | protected function validateInteger( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || filter_var( $value, FILTER_VALIDATE_INT ) !== false;
} | php | protected function validateInteger( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || filter_var( $value, FILTER_VALIDATE_INT ) !== false;
} | [
"protected",
"function",
"validateInteger",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"is_null",
"(",
"$",
"value",... | Validate that an attribute is an integer.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"is",
"an",
"integer",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1086-L1094 |
201,709 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateNumeric | protected function validateNumeric( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_numeric( $value );
} | php | protected function validateNumeric( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_numeric( $value );
} | [
"protected",
"function",
"validateNumeric",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"is_null",
"(",
"$",
"value",... | Validate that an attribute is numeric.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"is",
"numeric",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1103-L1111 |
201,710 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateString | protected function validateString( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_string( $value );
} | php | protected function validateString( $attribute, $value )
{
if ( !$this->hasAttribute( $attribute ) )
{
return true;
}
return is_null( $value ) || is_string( $value );
} | [
"protected",
"function",
"validateString",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAttribute",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"is_null",
"(",
"$",
"value",
... | Validate that an attribute is a string.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"is",
"a",
"string",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1120-L1128 |
201,711 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateActiveUrl | protected function validateActiveUrl( $attribute, $value )
{
if ( !is_string( $value ) )
{
return false;
}
if ( $url = parse_url( $value, PHP_URL_HOST ) )
{
return count( dns_get_record( $url, DNS_A | DNS_AAAA ) ) > 0;
}
return false;
} | php | protected function validateActiveUrl( $attribute, $value )
{
if ( !is_string( $value ) )
{
return false;
}
if ( $url = parse_url( $value, PHP_URL_HOST ) )
{
return count( dns_get_record( $url, DNS_A | DNS_AAAA ) ) > 0;
}
return false;
} | [
"protected",
"function",
"validateActiveUrl",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"value",
... | Validate that an attribute is an active URL.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"is",
"an",
"active",
"URL",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1591-L1604 |
201,712 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateAlphaNum | protected function validateAlphaNum( $attribute, $value )
{
if ( !is_string( $value ) && !is_numeric( $value ) )
{
return false;
}
return preg_match( '/^[\pL\pM\pN]+$/u', $value );
} | php | protected function validateAlphaNum( $attribute, $value )
{
if ( !is_string( $value ) && !is_numeric( $value ) )
{
return false;
}
return preg_match( '/^[\pL\pM\pN]+$/u', $value );
} | [
"protected",
"function",
"validateAlphaNum",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"p... | Validate that an attribute contains only alpha-numeric characters.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"contains",
"only",
"alpha",
"-",
"numeric",
"characters",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1737-L1745 |
201,713 | PenoaksDev/Milky-Framework | src/Milky/Validation/Validator.php | Validator.validateAlphaDash | protected function validateAlphaDash( $attribute, $value )
{
if ( !is_string( $value ) && !is_numeric( $value ) )
{
return false;
}
return preg_match( '/^[\pL\pM\pN_-]+$/u', $value );
} | php | protected function validateAlphaDash( $attribute, $value )
{
if ( !is_string( $value ) && !is_numeric( $value ) )
{
return false;
}
return preg_match( '/^[\pL\pM\pN_-]+$/u', $value );
} | [
"protected",
"function",
"validateAlphaDash",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"... | Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"contains",
"only",
"alpha",
"-",
"numeric",
"characters",
"dashes",
"and",
"underscores",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Validation/Validator.php#L1754-L1762 |
201,714 | Codifico/phpspec-rest-view-extension | features/bootstrap/FeatureContext.php | FeatureContext.iRunPhpspec | public function iRunPhpspec($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
$this->process->setWorkingDirectory($this->workingDir);
$this->process->setCommandLine(
sprintf(
'%s %s %s --no-interaction',
$thi... | php | public function iRunPhpspec($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
$this->process->setWorkingDirectory($this->workingDir);
$this->process->setCommandLine(
sprintf(
'%s %s %s --no-interaction',
$thi... | [
"public",
"function",
"iRunPhpspec",
"(",
"$",
"argumentsString",
"=",
"''",
")",
"{",
"$",
"argumentsString",
"=",
"strtr",
"(",
"$",
"argumentsString",
",",
"array",
"(",
"'\\''",
"=>",
"'\"'",
")",
")",
";",
"$",
"this",
"->",
"process",
"->",
"setWor... | Runs phpspec command with provided parameters
@When /^I run "phpspec(?: ((?:\"|[^"])*))?"$/
@param string $argumentsString | [
"Runs",
"phpspec",
"command",
"with",
"provided",
"parameters"
] | 2528f20e648f887a14ec94bafe486246d7deefb8 | https://github.com/Codifico/phpspec-rest-view-extension/blob/2528f20e648f887a14ec94bafe486246d7deefb8/features/bootstrap/FeatureContext.php#L144-L159 |
201,715 | Wedeto/Util | src/Validation/Validator.php | Validator.filter | public function filter($value)
{
$filtered = null;
if (!$this->validate($value, $filtered))
{
throw new \InvalidArgumentException(
"Not a valid value for " . $this->__toString() . ": " . WF::str($value)
);
}
return $filtered;
} | php | public function filter($value)
{
$filtered = null;
if (!$this->validate($value, $filtered))
{
throw new \InvalidArgumentException(
"Not a valid value for " . $this->__toString() . ": " . WF::str($value)
);
}
return $filtered;
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"$",
"filtered",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"validate",
"(",
"$",
"value",
",",
"$",
"filtered",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"... | Return a properly typed value
@param mixed $value The value to match and correct
@return mixed The filtered value
@throws InvalidArgumentException When the value is incompatible | [
"Return",
"a",
"properly",
"typed",
"value"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Validation/Validator.php#L109-L120 |
201,716 | Wedeto/Util | src/Validation/Validator.php | Validator.validate | public function validate($value, &$filtered = null)
{
$this->error = null;
if ($value === null)
return $this->options['nullable'] ?? false;
$filtered = $value;
if ($this->type === Validator::EXISTS)
return true;
$o = $this->options;
... | php | public function validate($value, &$filtered = null)
{
$this->error = null;
if ($value === null)
return $this->options['nullable'] ?? false;
$filtered = $value;
if ($this->type === Validator::EXISTS)
return true;
$o = $this->options;
... | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"&",
"$",
"filtered",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"error",
"=",
"null",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"options",
"[",
"'nullabl... | Check if the value matches the expected value
@param mixed $value
@return bool True if the value matches all constraints, false if it does not | [
"Check",
"if",
"the",
"value",
"matches",
"the",
"expected",
"value"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Validation/Validator.php#L127-L159 |
201,717 | Wedeto/Util | src/Validation/Validator.php | Validator.numRangeCheck | protected function numRangeCheck($value, $min, $max)
{
if ($min !== null && $value < $min)
return false;
if ($max !== null && $value > $max)
return false;
return true;
} | php | protected function numRangeCheck($value, $min, $max)
{
if ($min !== null && $value < $min)
return false;
if ($max !== null && $value > $max)
return false;
return true;
} | [
"protected",
"function",
"numRangeCheck",
"(",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
")",
"{",
"if",
"(",
"$",
"min",
"!==",
"null",
"&&",
"$",
"value",
"<",
"$",
"min",
")",
"return",
"false",
";",
"if",
"(",
"$",
"max",
"!==",
"null",... | Check if the numeric value is between the configured minimum and maximum
@param numeric $value The value to compare
@param numeric $min The minimum value
@param numeric $max The maximum value
@return bool True when the value is in range, false if it is out of range | [
"Check",
"if",
"the",
"numeric",
"value",
"is",
"between",
"the",
"configured",
"minimum",
"and",
"maximum"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/Validation/Validator.php#L284-L291 |
201,718 | ARCANESOFT/Backups | src/Http/Routes/StatusesRoutes.php | StatusesRoutes.map | public function map()
{
$this->prefix('statuses')->as('statuses.')->group(function () {
$this->get('/', 'StatusesController@index')
->name('index'); // admin::backups.statuses.index
$this->post('backup', 'StatusesController@backup')
->middleware('a... | php | public function map()
{
$this->prefix('statuses')->as('statuses.')->group(function () {
$this->get('/', 'StatusesController@index')
->name('index'); // admin::backups.statuses.index
$this->post('backup', 'StatusesController@backup')
->middleware('a... | [
"public",
"function",
"map",
"(",
")",
"{",
"$",
"this",
"->",
"prefix",
"(",
"'statuses'",
")",
"->",
"as",
"(",
"'statuses.'",
")",
"->",
"group",
"(",
"function",
"(",
")",
"{",
"$",
"this",
"->",
"get",
"(",
"'/'",
",",
"'StatusesController@index'"... | Map the routes for the application. | [
"Map",
"the",
"routes",
"for",
"the",
"application",
"."
] | e191f0ccf55c7684173b82b7244fce9c0803bfe0 | https://github.com/ARCANESOFT/Backups/blob/e191f0ccf55c7684173b82b7244fce9c0803bfe0/src/Http/Routes/StatusesRoutes.php#L21-L38 |
201,719 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/dates/DateFactory.php | DateFactory.newDate | protected function newDate($desiredTZ, $date = false)
{
if ($date === false) {
$date = 'now';
}
try {
$newDate = new Date(is_numeric('' . $date) ? '@' . $date : $date, $desiredTZ);
// if the string TZ was not the desired TZ, we must convert it
... | php | protected function newDate($desiredTZ, $date = false)
{
if ($date === false) {
$date = 'now';
}
try {
$newDate = new Date(is_numeric('' . $date) ? '@' . $date : $date, $desiredTZ);
// if the string TZ was not the desired TZ, we must convert it
... | [
"protected",
"function",
"newDate",
"(",
"$",
"desiredTZ",
",",
"$",
"date",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"date",
"===",
"false",
")",
"{",
"$",
"date",
"=",
"'now'",
";",
"}",
"try",
"{",
"$",
"newDate",
"=",
"new",
"Date",
"(",
"is_n... | Creates a new date in the desired timezone
@param string $desiredTZ The desired timezone in which to return the date
@param mixed $date An initialization string used to define the date.
@return Date
@throws \DateException | [
"Creates",
"a",
"new",
"date",
"in",
"the",
"desired",
"timezone"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/dates/DateFactory.php#L84-L105 |
201,720 | modulusphp/request | Cookies.php | Cookies.make | public function make(string $name, int $expireTime = 604800, string $path = "/", string $domain = "", bool $secure = false, bool $httpOnly = true)
{
return new PHPCookie($name, $expireTime, $path, $domain, $secure, $httpOnly);
} | php | public function make(string $name, int $expireTime = 604800, string $path = "/", string $domain = "", bool $secure = false, bool $httpOnly = true)
{
return new PHPCookie($name, $expireTime, $path, $domain, $secure, $httpOnly);
} | [
"public",
"function",
"make",
"(",
"string",
"$",
"name",
",",
"int",
"$",
"expireTime",
"=",
"604800",
",",
"string",
"$",
"path",
"=",
"\"/\"",
",",
"string",
"$",
"domain",
"=",
"\"\"",
",",
"bool",
"$",
"secure",
"=",
"false",
",",
"bool",
"$",
... | Create a new cookie
@return void | [
"Create",
"a",
"new",
"cookie"
] | 9328d81e71994e2944636ad5aed70f7a32f3fb87 | https://github.com/modulusphp/request/blob/9328d81e71994e2944636ad5aed70f7a32f3fb87/Cookies.php#L31-L34 |
201,721 | vaniocz/stdlib | src/UniversalJsonDeserializer.php | UniversalJsonDeserializer.deserialize | public static function deserialize(string $json)
{
$deserialized = json_decode($json, true);
$objects = [];
return self::decode($deserialized, $objects);
} | php | public static function deserialize(string $json)
{
$deserialized = json_decode($json, true);
$objects = [];
return self::decode($deserialized, $objects);
} | [
"public",
"static",
"function",
"deserialize",
"(",
"string",
"$",
"json",
")",
"{",
"$",
"deserialized",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"$",
"objects",
"=",
"[",
"]",
";",
"return",
"self",
"::",
"decode",
"(",
"$",
"de... | Deserialize the given JSON string.
@param string $json The JSON string to be deserialized.
@return mixed The deserialized value/array/object. | [
"Deserialize",
"the",
"given",
"JSON",
"string",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/UniversalJsonDeserializer.php#L18-L24 |
201,722 | vaniocz/stdlib | src/UniversalJsonDeserializer.php | UniversalJsonDeserializer.setObjectProperties | private static function setObjectProperties($object, array &$properties, bool $isInternal, Closure $propertyDecoder)
{
Closure::bind(function () use ($object, &$properties, $propertyDecoder) {
foreach ($properties as $key => &$value) {
$object->$key = $propertyDecoder($value);
... | php | private static function setObjectProperties($object, array &$properties, bool $isInternal, Closure $propertyDecoder)
{
Closure::bind(function () use ($object, &$properties, $propertyDecoder) {
foreach ($properties as $key => &$value) {
$object->$key = $propertyDecoder($value);
... | [
"private",
"static",
"function",
"setObjectProperties",
"(",
"$",
"object",
",",
"array",
"&",
"$",
"properties",
",",
"bool",
"$",
"isInternal",
",",
"Closure",
"$",
"propertyDecoder",
")",
"{",
"Closure",
"::",
"bind",
"(",
"function",
"(",
")",
"use",
"... | Set the given object properties.
@param mixed $object The object which properties should be set.
@param mixed[] $properties The object properties.
@param bool $isInternal Tells whether the object class is internal.
@param Closure $propertyDecoder The object property decoder. | [
"Set",
"the",
"given",
"object",
"properties",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/UniversalJsonDeserializer.php#L113-L120 |
201,723 | aicouto/image | src/Image.php | Image.thumb | public function thumb(string $src, string $dst, integer $width, integer $height)
{
$anchor='center';
return $this
->image($src)
->thumbnail($width, $height, $anchor)
->toFile($dst);
} | php | public function thumb(string $src, string $dst, integer $width, integer $height)
{
$anchor='center';
return $this
->image($src)
->thumbnail($width, $height, $anchor)
->toFile($dst);
} | [
"public",
"function",
"thumb",
"(",
"string",
"$",
"src",
",",
"string",
"$",
"dst",
",",
"integer",
"$",
"width",
",",
"integer",
"$",
"height",
")",
"{",
"$",
"anchor",
"=",
"'center'",
";",
"return",
"$",
"this",
"->",
"image",
"(",
"$",
"src",
... | Miniatura da imagem
@param string $src Imagem de origem
@param string $dst Imagem de destino
@param integer $width Largura da miniatura
@param integer $height Altura da miniatura
@return bool Retorna true ou false | [
"Miniatura",
"da",
"imagem"
] | ba94063b0554593a12c1e1f91d59ab33ff7c9520 | https://github.com/aicouto/image/blob/ba94063b0554593a12c1e1f91d59ab33ff7c9520/src/Image.php#L97-L104 |
201,724 | libreworks/caridea-validate | src/Rule/Compare.php | Compare.between | public static function between($min, $max): Compare
{
$value = $min > $max ? [$max, $min] : [$min, $max];
return new Compare('bt', $value);
} | php | public static function between($min, $max): Compare
{
$value = $min > $max ? [$max, $min] : [$min, $max];
return new Compare('bt', $value);
} | [
"public",
"static",
"function",
"between",
"(",
"$",
"min",
",",
"$",
"max",
")",
":",
"Compare",
"{",
"$",
"value",
"=",
"$",
"min",
">",
"$",
"max",
"?",
"[",
"$",
"max",
",",
"$",
"min",
"]",
":",
"[",
"$",
"min",
",",
"$",
"max",
"]",
"... | Gets a rule that requires numbers to be in a given range.
@param int|float $min The minimum value, inclusive
@param int|float $max The maximum value, inclusive
@return \Caridea\Validate\Rule\Compare the created rule | [
"Gets",
"a",
"rule",
"that",
"requires",
"numbers",
"to",
"be",
"in",
"a",
"given",
"range",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Rule/Compare.php#L166-L170 |
201,725 | dms-org/common.structure | src/FileSystem/FileSystemObject.php | FileSystemObject.getInfo | public function getInfo()
{
if ($this->info === null) {
$this->info = new \SplFileInfo($this->fullPath);
}
return $this->info;
} | php | public function getInfo()
{
if ($this->info === null) {
$this->info = new \SplFileInfo($this->fullPath);
}
return $this->info;
} | [
"public",
"function",
"getInfo",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"info",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"info",
"=",
"new",
"\\",
"SplFileInfo",
"(",
"$",
"this",
"->",
"fullPath",
")",
";",
"}",
"return",
"$",
"this",
"... | Get the info
@return \SplFileInfo | [
"Get",
"the",
"info"
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/FileSystem/FileSystemObject.php#L72-L79 |
201,726 | geoffadams/bedrest-core | library/BedRest/Content/Negotiation/EncodingList.php | EncodingList.parse | protected function parse(array $list)
{
$parsed = array();
foreach ($list as $item) {
$item = explode(';', trim($item));
$entry = array(
'encoding' => array_shift($item),
'q' => 1
);
foreach ($item as $param) {
... | php | protected function parse(array $list)
{
$parsed = array();
foreach ($list as $item) {
$item = explode(';', trim($item));
$entry = array(
'encoding' => array_shift($item),
'q' => 1
);
foreach ($item as $param) {
... | [
"protected",
"function",
"parse",
"(",
"array",
"$",
"list",
")",
"{",
"$",
"parsed",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"explode",
"(",
"';'",
",",
"trim",
"(",
"$",
"item",
... | Parses a list of media types out into a normalised structure.
@param array $list
@return array | [
"Parses",
"a",
"list",
"of",
"media",
"types",
"out",
"into",
"a",
"normalised",
"structure",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/EncodingList.php#L38-L65 |
201,727 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.authenticate | public function authenticate($username, $password, $type = self :: AUTH_ANY) {
if(false === is_string($username)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($username)), E_USER_ERROR);
}
if(false === is_str... | php | public function authenticate($username, $password, $type = self :: AUTH_ANY) {
if(false === is_string($username)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($username)), E_USER_ERROR);
}
if(false === is_str... | [
"public",
"function",
"authenticate",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"type",
"=",
"self",
"::",
"AUTH_ANY",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"username",
")",
")",
"{",
"return",
"trigger_error",
"(",
"s... | Adds a HTTP authentication method
@param string $username
@param string $password
@param string $type
@return sFire\HTTP\Client | [
"Adds",
"a",
"HTTP",
"authentication",
"method"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L265-L283 |
201,728 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.addParam | public function addParam($key, $value, $encode = false) {
if(false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
if(false === is_string($value) && false === is_arr... | php | public function addParam($key, $value, $encode = false) {
if(false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
if(false === is_string($value) && false === is_arr... | [
"public",
"function",
"addParam",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"encode",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passe... | Add a new key value param to the url or query
@param $key string
@param $value string|array
@param $encode boolean
@return sFire\HTTP\Client | [
"Add",
"a",
"new",
"key",
"value",
"param",
"to",
"the",
"url",
"or",
"query"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L293-L310 |
201,729 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.addFile | public function addFile($file, $name = null, $mime = null) {
if('post' !== $this -> method) {
return trigger_error('File uploads are only supported with POST request method', E_USER_ERROR);
}
if(false === $file instanceof File && false === is_string($file)) {
return trigger_error(sprintf('... | php | public function addFile($file, $name = null, $mime = null) {
if('post' !== $this -> method) {
return trigger_error('File uploads are only supported with POST request method', E_USER_ERROR);
}
if(false === $file instanceof File && false === is_string($file)) {
return trigger_error(sprintf('... | [
"public",
"function",
"addFile",
"(",
"$",
"file",
",",
"$",
"name",
"=",
"null",
",",
"$",
"mime",
"=",
"null",
")",
"{",
"if",
"(",
"'post'",
"!==",
"$",
"this",
"->",
"method",
")",
"{",
"return",
"trigger_error",
"(",
"'File uploads are only supporte... | Attach file to request
@param $file string|sFire\System\File
@param $name string
@param $string mime
@return sFire\HTTP\Client | [
"Attach",
"file",
"to",
"request"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L320-L357 |
201,730 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.userAgent | public function userAgent($useragent) {
if(false === is_string($useragent)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($useragent)), E_USER_ERROR);
}
$this -> options[CURLOPT_USERAGENT] = $useragent;
return ... | php | public function userAgent($useragent) {
if(false === is_string($useragent)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($useragent)), E_USER_ERROR);
}
$this -> options[CURLOPT_USERAGENT] = $useragent;
return ... | [
"public",
"function",
"userAgent",
"(",
"$",
"useragent",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"useragent",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
... | Set a user agent to the request
@param string $key
@return sFire\HTTP\Client | [
"Set",
"a",
"user",
"agent",
"to",
"the",
"request"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L365-L374 |
201,731 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.timeout | public function timeout($connection = 30, $response = 30) {
if(false === ('-' . intval($connection) == '-' . $connection)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($connection)), E_USER_ERROR);
}
if(fals... | php | public function timeout($connection = 30, $response = 30) {
if(false === ('-' . intval($connection) == '-' . $connection)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($connection)), E_USER_ERROR);
}
if(fals... | [
"public",
"function",
"timeout",
"(",
"$",
"connection",
"=",
"30",
",",
"$",
"response",
"=",
"30",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"connection",
")",
"==",
"'-'",
".",
"$",
"connection",
")",
")",
"{",
... | Set the connection and response timeout in seconds for the request
@param int $connection
@param int $response
@return sFire\HTTP\Client | [
"Set",
"the",
"connection",
"and",
"response",
"timeout",
"in",
"seconds",
"for",
"the",
"request"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L383-L397 |
201,732 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.referer | public function referer($referer) {
if(false === is_string($referer)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($referer)), E_USER_ERROR);
}
$this -> options[CURLOPT_REFERER] = $referer;
return $this;
} | php | public function referer($referer) {
if(false === is_string($referer)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($referer)), E_USER_ERROR);
}
$this -> options[CURLOPT_REFERER] = $referer;
return $this;
} | [
"public",
"function",
"referer",
"(",
"$",
"referer",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"referer",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
... | Set the referer
@param int $referer
@return sFire\HTTP\Client | [
"Set",
"the",
"referer"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L426-L435 |
201,733 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.httpVersion | public function httpVersion($version) {
if(false === defined($version)) {
return trigger_error(sprintf('Argument 1 passed to %s() is not a valid HTTP protocol version', __METHOD__), E_USER_ERROR);
}
$this -> options[CURLOPT_HTTP_VERSION] = constant($version);
return $this;
} | php | public function httpVersion($version) {
if(false === defined($version)) {
return trigger_error(sprintf('Argument 1 passed to %s() is not a valid HTTP protocol version', __METHOD__), E_USER_ERROR);
}
$this -> options[CURLOPT_HTTP_VERSION] = constant($version);
return $this;
} | [
"public",
"function",
"httpVersion",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"false",
"===",
"defined",
"(",
"$",
"version",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() is not a valid HTTP protocol version'",
",",
"... | Set the HTTP version protocol
@param int $version
@return sFire\HTTP\Client | [
"Set",
"the",
"HTTP",
"version",
"protocol"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L461-L470 |
201,734 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.addCookie | public function addCookie($key, $value) {
if(false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
if(false === is_string($value)) {
return trigger_error(sprintf('Argument 2 passed t... | php | public function addCookie($key, $value) {
if(false === is_string($key)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
}
if(false === is_string($value)) {
return trigger_error(sprintf('Argument 2 passed t... | [
"public",
"function",
"addCookie",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\... | Add a cookie to the request
@param string $key
@param string $value
@return sFire\HTTP\Client | [
"Add",
"a",
"cookie",
"to",
"the",
"request"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L501-L514 |
201,735 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.formatUrl | private function formatUrl() {
$jar = [];
$query = $this -> url -> getQuery();
if(null !== $query) {
$jar[] = $query;
}
$query = '';
if(count($this -> params) > 0 || count($jar) > 0) {
if($this -> method === 'get') {
foreach($this -> params as $param) {
$key ... | php | private function formatUrl() {
$jar = [];
$query = $this -> url -> getQuery();
if(null !== $query) {
$jar[] = $query;
}
$query = '';
if(count($this -> params) > 0 || count($jar) > 0) {
if($this -> method === 'get') {
foreach($this -> params as $param) {
$key ... | [
"private",
"function",
"formatUrl",
"(",
")",
"{",
"$",
"jar",
"=",
"[",
"]",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"url",
"->",
"getQuery",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"query",
")",
"{",
"$",
"jar",
"[",
"]",
"=",
"$",... | Adds new params to existing params to format the url
@return string | [
"Adds",
"new",
"params",
"to",
"existing",
"params",
"to",
"format",
"the",
"url"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L521-L549 |
201,736 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.formatParams | private function formatParams() {
$params = [];
//Params
foreach($this -> params as $param) {
$key = $param -> encode ? urlencode($param -> key) : $param -> key;
$value = $param -> encode ? urlencode($param -> value) : $param -> value;
$params[$key] = $value;
}
//Files
foreach... | php | private function formatParams() {
$params = [];
//Params
foreach($this -> params as $param) {
$key = $param -> encode ? urlencode($param -> key) : $param -> key;
$value = $param -> encode ? urlencode($param -> value) : $param -> value;
$params[$key] = $value;
}
//Files
foreach... | [
"private",
"function",
"formatParams",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"//Params\r",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"param",
")",
"{",
"$",
"key",
"=",
"$",
"param",
"->",
"encode",
"?",
"urlencode",
"(",
... | Formats all the parameters
@return array | [
"Formats",
"all",
"the",
"parameters"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L556-L583 |
201,737 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.send | public function send() {
//Set default status
$this -> response -> setStatus([
'code' => 0,
'protocol' => '',
'status' => '',
'text' => ''
]);
$curl = curl_init();
curl_setopt_array($curl, $this -> createOptions());
$response = curl_exec($curl);
if(false !... | php | public function send() {
//Set default status
$this -> response -> setStatus([
'code' => 0,
'protocol' => '',
'status' => '',
'text' => ''
]);
$curl = curl_init();
curl_setopt_array($curl, $this -> createOptions());
$response = curl_exec($curl);
if(false !... | [
"public",
"function",
"send",
"(",
")",
"{",
"//Set default status\r",
"$",
"this",
"->",
"response",
"->",
"setStatus",
"(",
"[",
"'code'",
"=>",
"0",
",",
"'protocol'",
"=>",
"''",
",",
"'status'",
"=>",
"''",
",",
"'text'",
"=>",
"''",
"]",
")",
";"... | Sends the request and sets all the response data
@return array | [
"Sends",
"the",
"request",
"and",
"sets",
"all",
"the",
"response",
"data"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L599-L640 |
201,738 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.parseHeaders | private function parseHeaders($str) {
if(false === is_string($str)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
}
$headers = [];
$status = [];
foreach(explode("\n", $str) as $header) {
... | php | private function parseHeaders($str) {
if(false === is_string($str)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
}
$headers = [];
$status = [];
foreach(explode("\n", $str) as $header) {
... | [
"private",
"function",
"parseHeaders",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"str",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"... | Parses headers and forms it into an Array
@param string $str
@return array | [
"Parses",
"headers",
"and",
"forms",
"it",
"into",
"an",
"Array"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L648-L688 |
201,739 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.parseCookies | private function parseCookies($str) {
if(false === is_string($str)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
}
$jar = [];
$headers = explode("\n", trim($str));
foreach($headers as... | php | private function parseCookies($str) {
if(false === is_string($str)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($str)), E_USER_ERROR);
}
$jar = [];
$headers = explode("\n", trim($str));
foreach($headers as... | [
"private",
"function",
"parseCookies",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"str",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"... | Parses the cookies from the headers and forms it into an Array
@param string $str
@return array | [
"Parses",
"the",
"cookies",
"from",
"the",
"headers",
"and",
"forms",
"it",
"into",
"an",
"Array"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L696-L764 |
201,740 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.createOptions | private function createOptions() {
$default = [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_URL => $this -> formatUrl(),
CURLOPT_COOKIE => $this -> formatCookies(),
CURLOPT_HTTPHEADER => $this -> headers
];
if('get' !== $this ... | php | private function createOptions() {
$default = [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_URL => $this -> formatUrl(),
CURLOPT_COOKIE => $this -> formatCookies(),
CURLOPT_HTTPHEADER => $this -> headers
];
if('get' !== $this ... | [
"private",
"function",
"createOptions",
"(",
")",
"{",
"$",
"default",
"=",
"[",
"CURLOPT_RETURNTRANSFER",
"=>",
"true",
",",
"CURLOPT_HEADER",
"=>",
"true",
",",
"CURLOPT_TIMEOUT",
"=>",
"30",
",",
"CURLOPT_URL",
"=>",
"$",
"this",
"->",
"formatUrl",
"(",
"... | Generates and returns all the options
@return array | [
"Generates",
"and",
"returns",
"all",
"the",
"options"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L771-L788 |
201,741 | Kris-Kuiper/sFire-Framework | src/HTTP/Client.php | Client.method | private function method($url, $closure, $method) {
if(false === is_string($url)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
}
if(false === is_string($method)) {
return trigger_error(sprintf('Argume... | php | private function method($url, $closure, $method) {
if(false === is_string($url)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
}
if(false === is_string($method)) {
return trigger_error(sprintf('Argume... | [
"private",
"function",
"method",
"(",
"$",
"url",
",",
"$",
"closure",
",",
"$",
"method",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be... | Sets the method and url and executes a user closure function if given
@param string $url
@param object $closure
@param string $method
@return sFire\HTTP\Client | [
"Sets",
"the",
"method",
"and",
"url",
"and",
"executes",
"a",
"user",
"closure",
"function",
"if",
"given"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/HTTP/Client.php#L798-L819 |
201,742 | wpsharks/dicer | src/includes/classes/Di.php | Di.addInstances | public function addInstances(array $instances): self
{
foreach ($instances as $_key => $_instance) {
if (is_string($_key)) {
$_class_name = ltrim($_key, '\\');
} else {
$_class_name = get_class($_instance);
}
$_class_key ... | php | public function addInstances(array $instances): self
{
foreach ($instances as $_key => $_instance) {
if (is_string($_key)) {
$_class_name = ltrim($_key, '\\');
} else {
$_class_name = get_class($_instance);
}
$_class_key ... | [
"public",
"function",
"addInstances",
"(",
"array",
"$",
"instances",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"instances",
"as",
"$",
"_key",
"=>",
"$",
"_instance",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"_key",
")",
")",
"{",
"$",
"_class_... | Add new instances.
@since 151115 Initial release.
@param array $instances Class instances.
@return self Reference; for chaining. | [
"Add",
"new",
"instances",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L109-L122 |
201,743 | wpsharks/dicer | src/includes/classes/Di.php | Di.addRule | public function addRule(string $name, array $rule): self
{
$name = ltrim($name, '\\');
$key = strtolower($name);
$global_default_rule = $this->rules['*'];
$this->rules[$key] = array_merge($global_default_rule, $rule);
$this->rules[$key] = array_intersect_key($this->rule... | php | public function addRule(string $name, array $rule): self
{
$name = ltrim($name, '\\');
$key = strtolower($name);
$global_default_rule = $this->rules['*'];
$this->rules[$key] = array_merge($global_default_rule, $rule);
$this->rules[$key] = array_intersect_key($this->rule... | [
"public",
"function",
"addRule",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"rule",
")",
":",
"self",
"{",
"$",
"name",
"=",
"ltrim",
"(",
"$",
"name",
",",
"'\\\\'",
")",
";",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"$",
... | Add a new rule.
@since 151115 Initial release.
@param string $name Rule name.
@param array $rule Rule properties.
@return self Reference; for chaining. | [
"Add",
"a",
"new",
"rule",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L134-L152 |
201,744 | wpsharks/dicer | src/includes/classes/Di.php | Di.getRule | protected function getRule(string $name, string $key, array $parent_names = []): array
{
if (isset($this->rules[$key])) {
return $this->rules[$key];
}
if ($this->total_rules === 1 || !$parent_names) {
return $this->rules['*']; // Done here.
}
foreach (... | php | protected function getRule(string $name, string $key, array $parent_names = []): array
{
if (isset($this->rules[$key])) {
return $this->rules[$key];
}
if ($this->total_rules === 1 || !$parent_names) {
return $this->rules['*']; // Done here.
}
foreach (... | [
"protected",
"function",
"getRule",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"key",
",",
"array",
"$",
"parent_names",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"rules",
"[",
"$",
"key",
"]",
")",
"... | Gets a specific rule.
@since 151115 Initial release.
@param string $name Rule name.
@param string $key Rule key.
@param array $parent_names Parent names.
@return array An array of rule properties. | [
"Gets",
"a",
"specific",
"rule",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L165-L180 |
201,745 | wpsharks/dicer | src/includes/classes/Di.php | Di.resolveJitClosures | protected function resolveJitClosures(array $array)
{
if (isset($array['di::jit'])) {
return $array['di::jit']($this);
}
foreach ($array as $_key => &$_value) {
if (is_array($_value)) {
$_value = $this->resolveJitClosures($_value);
}
... | php | protected function resolveJitClosures(array $array)
{
if (isset($array['di::jit'])) {
return $array['di::jit']($this);
}
foreach ($array as $_key => &$_value) {
if (is_array($_value)) {
$_value = $this->resolveJitClosures($_value);
}
... | [
"protected",
"function",
"resolveJitClosures",
"(",
"array",
"$",
"array",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"array",
"[",
"'di::jit'",
"]",
")",
")",
"{",
"return",
"$",
"array",
"[",
"'di::jit'",
"]",
"(",
"$",
"this",
")",
";",
"}",
"foreach... | Resolve just-in-time closures.
@since 151118 Resolve just-in-time closures.
@param array Input array to scan for `di::jit` keys.
@return array|mixed Output w/ resolved `di::jit` keys.
@note Objects not iterated, on purpose! This avoids a deeper scan
that really is unnecessary when trying to find `di::jit` keys. | [
"Resolve",
"just",
"-",
"in",
"-",
"time",
"closures",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L194-L205 |
201,746 | wpsharks/dicer | src/includes/classes/Di.php | Di.getClosure | protected function getClosure(string $class_name, string $class_key): callable
{
$parent_class_names = class_parents($class_name);
$all_class_names = $parent_class_names;
$all_class_names[] = $class_name;
$class = new \ReflectionClass($class_name);
$... | php | protected function getClosure(string $class_name, string $class_key): callable
{
$parent_class_names = class_parents($class_name);
$all_class_names = $parent_class_names;
$all_class_names[] = $class_name;
$class = new \ReflectionClass($class_name);
$... | [
"protected",
"function",
"getClosure",
"(",
"string",
"$",
"class_name",
",",
"string",
"$",
"class_key",
")",
":",
"callable",
"{",
"$",
"parent_class_names",
"=",
"class_parents",
"(",
"$",
"class_name",
")",
";",
"$",
"all_class_names",
"=",
"$",
"parent_cl... | Get closure for a specific class.
@since 151115 Initial release.
@param string $class_name Class name.
@param string $class_key Class key.
@return callable Closure returns instance. | [
"Get",
"closure",
"for",
"a",
"specific",
"class",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L217-L245 |
201,747 | wpsharks/dicer | src/includes/classes/Di.php | Di.getParamsClosure | protected function getParamsClosure(\ReflectionMethod $constructor, array $class_rule): callable
{
$param_details = []; // Initialize parameter details.
foreach ($constructor->getParameters() as $_parameter) {
$_name = $_parameter->getName();
$_class = $_parameter->get... | php | protected function getParamsClosure(\ReflectionMethod $constructor, array $class_rule): callable
{
$param_details = []; // Initialize parameter details.
foreach ($constructor->getParameters() as $_parameter) {
$_name = $_parameter->getName();
$_class = $_parameter->get... | [
"protected",
"function",
"getParamsClosure",
"(",
"\\",
"ReflectionMethod",
"$",
"constructor",
",",
"array",
"$",
"class_rule",
")",
":",
"callable",
"{",
"$",
"param_details",
"=",
"[",
"]",
";",
"// Initialize parameter details.",
"foreach",
"(",
"$",
"construc... | Magic happens here.
@since 151115 Initial release.
@param \ReflectionMethod $constructor Constructor.
@param array $class_rule A class-specific rule.
@return callable Closure that returns an array of parameters. | [
"Magic",
"happens",
"here",
"."
] | 72a4e1810b7f52265e192ecbcb30f57b9e994d04 | https://github.com/wpsharks/dicer/blob/72a4e1810b7f52265e192ecbcb30f57b9e994d04/src/includes/classes/Di.php#L257-L298 |
201,748 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/FileCacheStore.php | FileCacheStore.file | protected function file($key)
{
return $this->dir . DIRECTORY_SEPARATOR . $this->key($key) . "." . $this->fileExtension;
} | php | protected function file($key)
{
return $this->dir . DIRECTORY_SEPARATOR . $this->key($key) . "." . $this->fileExtension;
} | [
"protected",
"function",
"file",
"(",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"dir",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"key",
"(",
"$",
"key",
")",
".",
"\".\"",
".",
"$",
"this",
"->",
"fileExtension",
";",
"}"
] | Generates the filename to store based on the cachePrefix and given key
@param string $key The key we'll use to generate our key
@return string A unique filename | [
"Generates",
"the",
"filename",
"to",
"store",
"based",
"on",
"the",
"cachePrefix",
"and",
"given",
"key"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/FileCacheStore.php#L79-L82 |
201,749 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/FileCacheStore.php | FileCacheStore.isExpired | protected function isExpired($key, $storageArray = null)
{
if (!empty($key)) {
// Item is expired if key doesn't exist
if (!$this->containsKey($key))
return true;
$storageArray = $this->readFile($this->file($key));
}
if (is_array($storage... | php | protected function isExpired($key, $storageArray = null)
{
if (!empty($key)) {
// Item is expired if key doesn't exist
if (!$this->containsKey($key))
return true;
$storageArray = $this->readFile($this->file($key));
}
if (is_array($storage... | [
"protected",
"function",
"isExpired",
"(",
"$",
"key",
",",
"$",
"storageArray",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"// Item is expired if key doesn't exist",
"if",
"(",
"!",
"$",
"this",
"->",
"containsKey",
... | Determines if the key or storage array specified is expired
@param string $key The key used to lookup the data.
If doesn't exist, item is expired, so true is returned.
This value may be null if a value is specified for $storageArray
@param array $storageArray The stored value to check (in case it's already l... | [
"Determines",
"if",
"the",
"key",
"or",
"storage",
"array",
"specified",
"is",
"expired"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/FileCacheStore.php#L94-L112 |
201,750 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/FileCacheStore.php | FileCacheStore.getData | protected function getData($key)
{
$filename = $this->file($key);
if (!file_exists($filename))
return false;
else {
$data = $this->readFile($filename);
if ($this->isExpired(null, $data))
return false;
else {
//... | php | protected function getData($key)
{
$filename = $this->file($key);
if (!file_exists($filename))
return false;
else {
$data = $this->readFile($filename);
if ($this->isExpired(null, $data))
return false;
else {
//... | [
"protected",
"function",
"getData",
"(",
"$",
"key",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"file",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filename",
")",
")",
"return",
"false",
";",
"else",
"{",
"$",
"d... | Performs a fetch of our data from the filecache without logging in the logger.
That allows this method to be used in other locations.
@param string $key The key to fetch
@return mixed Data in this->storageFormat format or FALSE if data is invalid | [
"Performs",
"a",
"fetch",
"of",
"our",
"data",
"from",
"the",
"filecache",
"without",
"logging",
"in",
"the",
"logger",
".",
"That",
"allows",
"this",
"method",
"to",
"be",
"used",
"in",
"other",
"locations",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/FileCacheStore.php#L123-L148 |
201,751 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/FileCacheStore.php | FileCacheStore.writeFile | protected function writeFile($filename, $value)
{
try {
FileSystemUtils::safeFilePutContents($filename, serialize($value));
return true;
} catch (Exception $e)
{
return false;
}
} | php | protected function writeFile($filename, $value)
{
try {
FileSystemUtils::safeFilePutContents($filename, serialize($value));
return true;
} catch (Exception $e)
{
return false;
}
} | [
"protected",
"function",
"writeFile",
"(",
"$",
"filename",
",",
"$",
"value",
")",
"{",
"try",
"{",
"FileSystemUtils",
"::",
"safeFilePutContents",
"(",
"$",
"filename",
",",
"serialize",
"(",
"$",
"value",
")",
")",
";",
"return",
"true",
";",
"}",
"ca... | Performs a write to the filesystem of our data.
@param string $filename The filename to write to
@param string $value The data to write.
@return void | [
"Performs",
"a",
"write",
"to",
"the",
"filesystem",
"of",
"our",
"data",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/FileCacheStore.php#L173-L182 |
201,752 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/FileCacheStore.php | FileCacheStore.flushExpired | public function flushExpired()
{
$this->Logger->debug('Flush all expired called.');
try {
foreach ( new DirectoryIterator($this->dir) as $item ) {
$filename = $item->getPath() .DIRECTORY_SEPARATOR.$item->getFilename();
$pathinfo = pathinfo($filename);
... | php | public function flushExpired()
{
$this->Logger->debug('Flush all expired called.');
try {
foreach ( new DirectoryIterator($this->dir) as $item ) {
$filename = $item->getPath() .DIRECTORY_SEPARATOR.$item->getFilename();
$pathinfo = pathinfo($filename);
... | [
"public",
"function",
"flushExpired",
"(",
")",
"{",
"$",
"this",
"->",
"Logger",
"->",
"debug",
"(",
"'Flush all expired called.'",
")",
";",
"try",
"{",
"foreach",
"(",
"new",
"DirectoryIterator",
"(",
"$",
"this",
"->",
"dir",
")",
"as",
"$",
"item",
... | Removes all expired items from the cache store
@return boolean true on success, false on failure | [
"Removes",
"all",
"expired",
"items",
"from",
"the",
"cache",
"store"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/FileCacheStore.php#L480-L501 |
201,753 | itkg/core | src/Itkg/Core/Route/Route.php | Route.matches | public function matches($uri)
{
if (!preg_match($this->compiledRegex, $uri, $matches)) {
return false;
}
$params = array();
foreach ($matches as $key => $value) {
/** gestion des sous-repertoires : uniquement si controller contient des _ */
if ($... | php | public function matches($uri)
{
if (!preg_match($this->compiledRegex, $uri, $matches)) {
return false;
}
$params = array();
foreach ($matches as $key => $value) {
/** gestion des sous-repertoires : uniquement si controller contient des _ */
if ($... | [
"public",
"function",
"matches",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
"compiledRegex",
",",
"$",
"uri",
",",
"$",
"matches",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"params",
"=",
"array",
"(",
... | Tests if the route matches a given URI. A successful match will return
all of the routed parameters as an array. A failed match will return
boolean FALSE.
// This route will only match if the <controller>, <action>, and <id> exist
$params = self::factory('<controller>/<action>/<id>', array('id' => '\d+'))
->matches('u... | [
"Tests",
"if",
"the",
"route",
"matches",
"a",
"given",
"URI",
".",
"A",
"successful",
"match",
"will",
"return",
"all",
"of",
"the",
"routed",
"parameters",
"as",
"an",
"array",
".",
"A",
"failed",
"match",
"will",
"return",
"boolean",
"FALSE",
"."
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Route/Route.php#L172-L192 |
201,754 | itkg/core | src/Itkg/Core/Route/Route.php | Route.compile | protected function compile()
{
// The URI should be considered literal except for keys and optional parts
// Escape everything preg_quote would escape except for : ( ) < >
$regex = preg_replace('#' . self::REGEX_ESCAPE . '#', '\\\\$0', $this->uri);
if (strpos($regex, '(') !== false)... | php | protected function compile()
{
// The URI should be considered literal except for keys and optional parts
// Escape everything preg_quote would escape except for : ( ) < >
$regex = preg_replace('#' . self::REGEX_ESCAPE . '#', '\\\\$0', $this->uri);
if (strpos($regex, '(') !== false)... | [
"protected",
"function",
"compile",
"(",
")",
"{",
"// The URI should be considered literal except for keys and optional parts",
"// Escape everything preg_quote would escape except for : ( ) < >",
"$",
"regex",
"=",
"preg_replace",
"(",
"'#'",
".",
"self",
"::",
"REGEX_ESCAPE",
... | Returns the compiled regular expression for the route. This translates
keys and optional groups to a proper PCRE regular expression.
@access protected
@return string | [
"Returns",
"the",
"compiled",
"regular",
"expression",
"for",
"the",
"route",
".",
"This",
"translates",
"keys",
"and",
"optional",
"groups",
"to",
"a",
"proper",
"PCRE",
"regular",
"expression",
"."
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Route/Route.php#L201-L223 |
201,755 | shgysk8zer0/core_api | traits/datetime.php | DateTime._getTimeZone | final protected function _getTimeZone($timezone = null)
{
if ($timezone = strtoupper($timezone) and defined("\\DateTimeZone::{$timezone}")) {
$timezone = new \DateTimeZone($timezone);
} elseif (! ($timezone instanceof \DateTimeZone)) {
@date_default_timezone_set(date_default_timezone_get());
$timezone = n... | php | final protected function _getTimeZone($timezone = null)
{
if ($timezone = strtoupper($timezone) and defined("\\DateTimeZone::{$timezone}")) {
$timezone = new \DateTimeZone($timezone);
} elseif (! ($timezone instanceof \DateTimeZone)) {
@date_default_timezone_set(date_default_timezone_get());
$timezone = n... | [
"final",
"protected",
"function",
"_getTimeZone",
"(",
"$",
"timezone",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"timezone",
"=",
"strtoupper",
"(",
"$",
"timezone",
")",
"and",
"defined",
"(",
"\"\\\\DateTimeZone::{$timezone}\"",
")",
")",
"{",
"$",
"timezone... | Attempts to get timezone with fallback to default, which in turn defaults to UTC
@param mixed $timezone Most likely a string or null, but could be a DateTimeZone
@return DateTimeZone | [
"Attempts",
"to",
"get",
"timezone",
"with",
"fallback",
"to",
"default",
"which",
"in",
"turn",
"defaults",
"to",
"UTC"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/datetime.php#L51-L60 |
201,756 | randomhost/icinga-check-minecraft | src/php/PlayerCount.php | PlayerCount.check | protected function check()
{
try {
$options = $this->getOptions();
// retrieve player count
$response = $this->mcStatus->query(true);
if (!is_array($response)
|| !array_key_exists('player_count', $response)
) {
$th... | php | protected function check()
{
try {
$options = $this->getOptions();
// retrieve player count
$response = $this->mcStatus->query(true);
if (!is_array($response)
|| !array_key_exists('player_count', $response)
) {
$th... | [
"protected",
"function",
"check",
"(",
")",
"{",
"try",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"// retrieve player count",
"$",
"response",
"=",
"$",
"this",
"->",
"mcStatus",
"->",
"query",
"(",
"true",
")",
";",
"if... | Check the amount of players on the Minecraft server.
@see Base::check()
@return $this | [
"Check",
"the",
"amount",
"of",
"players",
"on",
"the",
"Minecraft",
"server",
"."
] | 0587ea307b0706654b4a996d76e20e7ec04176a0 | https://github.com/randomhost/icinga-check-minecraft/blob/0587ea307b0706654b4a996d76e20e7ec04176a0/src/php/PlayerCount.php#L44-L103 |
201,757 | mossphp/moss-storage | Moss/Storage/Query/Relation/RelationFactory.php | RelationFactory.build | public function build(ModelInterface $model, $relation)
{
list($current, $further) = $this->splitRelationName($relation);
$definition = $this->fetchDefinition($model, $current);
switch ($definition->type()) {
case self::RELATION_ONE:
$instance = new OneRelation($... | php | public function build(ModelInterface $model, $relation)
{
list($current, $further) = $this->splitRelationName($relation);
$definition = $this->fetchDefinition($model, $current);
switch ($definition->type()) {
case self::RELATION_ONE:
$instance = new OneRelation($... | [
"public",
"function",
"build",
"(",
"ModelInterface",
"$",
"model",
",",
"$",
"relation",
")",
"{",
"list",
"(",
"$",
"current",
",",
"$",
"further",
")",
"=",
"$",
"this",
"->",
"splitRelationName",
"(",
"$",
"relation",
")",
";",
"$",
"definition",
"... | Sets model and its relation
@param ModelInterface $model
@param string $relation
@return RelationInterface
@throws RelationException | [
"Sets",
"model",
"and",
"its",
"relation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/RelationFactory.php#L64-L91 |
201,758 | DreadLabs/VantomasWebsite | src/CodeSnippet/SyntaxHighlighterParser.php | SyntaxHighlighterParser.toStringFromYaml | public function toStringFromYaml(array $parseResult)
{
$this->parameters = $parseResult;
$this->removeNullValues();
$this->removeInvalidKeys();
$this->ensureDefaultBrush();
$brush = SyntaxHighlighterBrush::fromIdentifierOrAlias($this->parameters['brush']);
$this->e... | php | public function toStringFromYaml(array $parseResult)
{
$this->parameters = $parseResult;
$this->removeNullValues();
$this->removeInvalidKeys();
$this->ensureDefaultBrush();
$brush = SyntaxHighlighterBrush::fromIdentifierOrAlias($this->parameters['brush']);
$this->e... | [
"public",
"function",
"toStringFromYaml",
"(",
"array",
"$",
"parseResult",
")",
"{",
"$",
"this",
"->",
"parameters",
"=",
"$",
"parseResult",
";",
"$",
"this",
"->",
"removeNullValues",
"(",
")",
";",
"$",
"this",
"->",
"removeInvalidKeys",
"(",
")",
";"... | Parse to scalar string from YAML.
@param array $parseResult
@return string | [
"Parse",
"to",
"scalar",
"string",
"from",
"YAML",
"."
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/CodeSnippet/SyntaxHighlighterParser.php#L113-L130 |
201,759 | DreadLabs/VantomasWebsite | src/CodeSnippet/SyntaxHighlighterParser.php | SyntaxHighlighterParser.formatValues | private function formatValues()
{
array_walk($this->parameters, function (&$value, $key) {
$parameterValue = $value;
if (is_bool($parameterValue)) {
$parameterValue = var_export($parameterValue, true);
}
$formattedValue = sprintf(self::DEFAUL... | php | private function formatValues()
{
array_walk($this->parameters, function (&$value, $key) {
$parameterValue = $value;
if (is_bool($parameterValue)) {
$parameterValue = var_export($parameterValue, true);
}
$formattedValue = sprintf(self::DEFAUL... | [
"private",
"function",
"formatValues",
"(",
")",
"{",
"array_walk",
"(",
"$",
"this",
"->",
"parameters",
",",
"function",
"(",
"&",
"$",
"value",
",",
"$",
"key",
")",
"{",
"$",
"parameterValue",
"=",
"$",
"value",
";",
"if",
"(",
"is_bool",
"(",
"$... | Applies formats formatting to values.
@return void | [
"Applies",
"formats",
"formatting",
"to",
"values",
"."
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/CodeSnippet/SyntaxHighlighterParser.php#L172-L189 |
201,760 | romm/configuration_object | Classes/ConfigurationObjectInstance.php | ConfigurationObjectInstance.getObject | public function getObject($forceInstance = false)
{
if (false === $forceInstance
&& true === $this->getValidationResult()->hasErrors()
) {
throw new Exception(
'Trying to access a configuration object which contains errors. You should first check if it is erro... | php | public function getObject($forceInstance = false)
{
if (false === $forceInstance
&& true === $this->getValidationResult()->hasErrors()
) {
throw new Exception(
'Trying to access a configuration object which contains errors. You should first check if it is erro... | [
"public",
"function",
"getObject",
"(",
"$",
"forceInstance",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"forceInstance",
"&&",
"true",
"===",
"$",
"this",
"->",
"getValidationResult",
"(",
")",
"->",
"hasErrors",
"(",
")",
")",
"{",
"throw"... | Returns the real instance of the configuration object.
Please note that you should always check the validation result before
even getting the object.
Use: `$myObject->getValidationResult()->hasErrors()`
Warning: if you set `$forceInstance` to true, it means that the object
will be returned even if it contain errors, ... | [
"Returns",
"the",
"real",
"instance",
"of",
"the",
"configuration",
"object",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/ConfigurationObjectInstance.php#L81-L93 |
201,761 | romm/configuration_object | Classes/ConfigurationObjectInstance.php | ConfigurationObjectInstance.setValidationResult | public function setValidationResult(Result $result)
{
if (false === $this->mapperResult->hasErrors()) {
$this->validationResult = $result;
}
} | php | public function setValidationResult(Result $result)
{
if (false === $this->mapperResult->hasErrors()) {
$this->validationResult = $result;
}
} | [
"public",
"function",
"setValidationResult",
"(",
"Result",
"$",
"result",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"mapperResult",
"->",
"hasErrors",
"(",
")",
")",
"{",
"$",
"this",
"->",
"validationResult",
"=",
"$",
"result",
";",
"}",... | Manually set the validation result. Used in the cache service.
Should only be internally used, please be careful if you need to use this
function.
Note that if the mapping result given as constructor argument of this
object contains error, this function will do nothing.
@param Result $result | [
"Manually",
"set",
"the",
"validation",
"result",
".",
"Used",
"in",
"the",
"cache",
"service",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/ConfigurationObjectInstance.php#L120-L125 |
201,762 | romm/configuration_object | Classes/ConfigurationObjectInstance.php | ConfigurationObjectInstance.refreshValidationResult | public function refreshValidationResult()
{
if (false === $this->mapperResult->hasErrors()) {
$validator = Core::get()->getValidatorResolver()
->getBaseValidatorConjunction(get_class($this->object));
$this->validationResult = $validator->validate($this->object);
... | php | public function refreshValidationResult()
{
if (false === $this->mapperResult->hasErrors()) {
$validator = Core::get()->getValidatorResolver()
->getBaseValidatorConjunction(get_class($this->object));
$this->validationResult = $validator->validate($this->object);
... | [
"public",
"function",
"refreshValidationResult",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"mapperResult",
"->",
"hasErrors",
"(",
")",
")",
"{",
"$",
"validator",
"=",
"Core",
"::",
"get",
"(",
")",
"->",
"getValidatorResolver",
"(",
... | If the mapping result which was passed as a constructor argument of
this class contains error, the validation result will be the same.
Otherwise a recursive validation of the object is processed.
@return $this | [
"If",
"the",
"mapping",
"result",
"which",
"was",
"passed",
"as",
"a",
"constructor",
"argument",
"of",
"this",
"class",
"contains",
"error",
"the",
"validation",
"result",
"will",
"be",
"the",
"same",
".",
"Otherwise",
"a",
"recursive",
"validation",
"of",
... | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/ConfigurationObjectInstance.php#L144-L154 |
201,763 | blackknight467/AYAHBundle | Service/AYAHService.php | AYAHService.getPublisherHTML | public function getPublisherHTML($config = array())
{
// Initialize.
$session_secret = "";
$fields = array('config' => $config);
$webservice_url = '/ws/setruntimeoptions/' . $this->publisherKey;
// If necessary, process the config data.
if ( ! empty($config))
{
... | php | public function getPublisherHTML($config = array())
{
// Initialize.
$session_secret = "";
$fields = array('config' => $config);
$webservice_url = '/ws/setruntimeoptions/' . $this->publisherKey;
// If necessary, process the config data.
if ( ! empty($config))
{
... | [
"public",
"function",
"getPublisherHTML",
"(",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"// Initialize.",
"$",
"session_secret",
"=",
"\"\"",
";",
"$",
"fields",
"=",
"array",
"(",
"'config'",
"=>",
"$",
"config",
")",
";",
"$",
"webservice_url",
... | Returns the markup for PlayThru.=
@param array $config
@return string | [
"Returns",
"the",
"markup",
"for",
"PlayThru",
".",
"="
] | 38a724c5e28d1d6a6dbe1d86125974498b3e4f00 | https://github.com/blackknight467/AYAHBundle/blob/38a724c5e28d1d6a6dbe1d86125974498b3e4f00/Service/AYAHService.php#L82-L127 |
201,764 | blackknight467/AYAHBundle | Service/AYAHService.php | AYAHService.scoreResult | public function scoreResult()
{
$result = false;
if($this->sessionSecret)
{
$fields = array(
'session_secret' => urlencode($this->sessionSecret),
'scoring_key' => $this->scoringKey
);
$resp = $this->doHttpsPostReturnJSO... | php | public function scoreResult()
{
$result = false;
if($this->sessionSecret)
{
$fields = array(
'session_secret' => urlencode($this->sessionSecret),
'scoring_key' => $this->scoringKey
);
$resp = $this->doHttpsPostReturnJSO... | [
"public",
"function",
"scoreResult",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"sessionSecret",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"'session_secret'",
"=>",
"urlencode",
"(",
"$",
"this",
"->",
"sessionSecret... | Check whether the user is a human. Wrapper for the scoreGame API call
@return boolean | [
"Check",
"whether",
"the",
"user",
"is",
"a",
"human",
".",
"Wrapper",
"for",
"the",
"scoreGame",
"API",
"call"
] | 38a724c5e28d1d6a6dbe1d86125974498b3e4f00 | https://github.com/blackknight467/AYAHBundle/blob/38a724c5e28d1d6a6dbe1d86125974498b3e4f00/Service/AYAHService.php#L133-L152 |
201,765 | blackknight467/AYAHBundle | Service/AYAHService.php | AYAHService.doHttpsPostReturnJSONArray | protected function doHttpsPostReturnJSONArray($hostname, $path, $fields)
{
$result = $this->doHttpsPost($hostname, $path, $fields);
if ($result) {
$result = json_decode($result);
} else {
error_log("AYAH::doHttpsPostGetJSON: Post to https://$hostname$path returned no... | php | protected function doHttpsPostReturnJSONArray($hostname, $path, $fields)
{
$result = $this->doHttpsPost($hostname, $path, $fields);
if ($result) {
$result = json_decode($result);
} else {
error_log("AYAH::doHttpsPostGetJSON: Post to https://$hostname$path returned no... | [
"protected",
"function",
"doHttpsPostReturnJSONArray",
"(",
"$",
"hostname",
",",
"$",
"path",
",",
"$",
"fields",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"doHttpsPost",
"(",
"$",
"hostname",
",",
"$",
"path",
",",
"$",
"fields",
")",
";",
"if... | Do an HTTPS POST, return some JSON decoded as array.
@param $hostname hostname
@param $path path
@param $fields associative array of fields
@return array|mixed Decoded json structure or empty data structure | [
"Do",
"an",
"HTTPS",
"POST",
"return",
"some",
"JSON",
"decoded",
"as",
"array",
"."
] | 38a724c5e28d1d6a6dbe1d86125974498b3e4f00 | https://github.com/blackknight467/AYAHBundle/blob/38a724c5e28d1d6a6dbe1d86125974498b3e4f00/Service/AYAHService.php#L178-L190 |
201,766 | blackknight467/AYAHBundle | Service/AYAHService.php | AYAHService.doHttpsPost | protected function doHttpsPost($hostname, $path, $fields)
{
$result = '';
$fields_string = '';
//Url encode the string
foreach($fields as $key => $value)
{
if (is_array($value)) {
if (! empty($value)) {
foreach ($value as $k =>... | php | protected function doHttpsPost($hostname, $path, $fields)
{
$result = '';
$fields_string = '';
//Url encode the string
foreach($fields as $key => $value)
{
if (is_array($value)) {
if (! empty($value)) {
foreach ($value as $k =>... | [
"protected",
"function",
"doHttpsPost",
"(",
"$",
"hostname",
",",
"$",
"path",
",",
"$",
"fields",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"fields_string",
"=",
"''",
";",
"//Url encode the string",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"key",... | Initiate a request to the AYAH web service through curl or using a socket
if the system does not have curl available.
@param string $hostname
@param string $path
@param array $fields
@return string|mixed | [
"Initiate",
"a",
"request",
"to",
"the",
"AYAH",
"web",
"service",
"through",
"curl",
"or",
"using",
"a",
"socket",
"if",
"the",
"system",
"does",
"not",
"have",
"curl",
"available",
"."
] | 38a724c5e28d1d6a6dbe1d86125974498b3e4f00 | https://github.com/blackknight467/AYAHBundle/blob/38a724c5e28d1d6a6dbe1d86125974498b3e4f00/Service/AYAHService.php#L200-L265 |
201,767 | gangachris/potato-orm | src/Potato.php | Potato.tableExists | public static function tableExists($tableName)
{
$query = "SELECT 1 FROM $tableName LIMIT 1";
try {
$result = Connection::db()->query($query);
} catch (Exception $e) {
return false;
}
return $result !== false;
} | php | public static function tableExists($tableName)
{
$query = "SELECT 1 FROM $tableName LIMIT 1";
try {
$result = Connection::db()->query($query);
} catch (Exception $e) {
return false;
}
return $result !== false;
} | [
"public",
"static",
"function",
"tableExists",
"(",
"$",
"tableName",
")",
"{",
"$",
"query",
"=",
"\"SELECT 1 FROM $tableName LIMIT 1\"",
";",
"try",
"{",
"$",
"result",
"=",
"Connection",
"::",
"db",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
... | Checks if a given table exists in the database
@param string $tableName name of the table to be checked
@return bool true if table is found, false otherwise | [
"Checks",
"if",
"a",
"given",
"table",
"exists",
"in",
"the",
"database"
] | 12bb25ca31716aac97bbe78596810220e39626b0 | https://github.com/gangachris/potato-orm/blob/12bb25ca31716aac97bbe78596810220e39626b0/src/Potato.php#L53-L64 |
201,768 | gangachris/potato-orm | src/Potato.php | Potato.getAll | public static function getAll($fields = null)
{
$table = self::getTableNameFromClass();
if ($fields != null && is_array($fields)) {
$query = "SELECT ". implode(', ', $fields) ." FROM $table";
} else {
$query = "SELECT * FROM $table";
}
$res = [];
... | php | public static function getAll($fields = null)
{
$table = self::getTableNameFromClass();
if ($fields != null && is_array($fields)) {
$query = "SELECT ". implode(', ', $fields) ." FROM $table";
} else {
$query = "SELECT * FROM $table";
}
$res = [];
... | [
"public",
"static",
"function",
"getAll",
"(",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"self",
"::",
"getTableNameFromClass",
"(",
")",
";",
"if",
"(",
"$",
"fields",
"!=",
"null",
"&&",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",... | Get all records from the record table
@param array $fields array of fields to be retrieved
@return array associative array of the records received from the database | [
"Get",
"all",
"records",
"from",
"the",
"record",
"table"
] | 12bb25ca31716aac97bbe78596810220e39626b0 | https://github.com/gangachris/potato-orm/blob/12bb25ca31716aac97bbe78596810220e39626b0/src/Potato.php#L100-L120 |
201,769 | gangachris/potato-orm | src/Potato.php | Potato.getOne | public static function getOne($id, $fields = null)
{
$table = self::getTableNameFromClass();
if ($fields != null && is_array($fields)) {
$query = "SELECT ". implode(', ', $fields) ." FROM $table WHERE id = $id";
} else {
$query = "SELECT * FROM $table WHERE id = $id"... | php | public static function getOne($id, $fields = null)
{
$table = self::getTableNameFromClass();
if ($fields != null && is_array($fields)) {
$query = "SELECT ". implode(', ', $fields) ." FROM $table WHERE id = $id";
} else {
$query = "SELECT * FROM $table WHERE id = $id"... | [
"public",
"static",
"function",
"getOne",
"(",
"$",
"id",
",",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"self",
"::",
"getTableNameFromClass",
"(",
")",
";",
"if",
"(",
"$",
"fields",
"!=",
"null",
"&&",
"is_array",
"(",
"$",
"fields"... | Get one record from the table based on the id provided
@param integer $id id of the record to be retrieved
@param array $fields array of fields to be retrieved
@return array associative array of the record retrieved | [
"Get",
"one",
"record",
"from",
"the",
"table",
"based",
"on",
"the",
"id",
"provided"
] | 12bb25ca31716aac97bbe78596810220e39626b0 | https://github.com/gangachris/potato-orm/blob/12bb25ca31716aac97bbe78596810220e39626b0/src/Potato.php#L128-L152 |
201,770 | gangachris/potato-orm | src/Potato.php | Potato.save | public function save()
{
$result;
if (! self::$id) {
// new record so we insert
$query = "INSERT INTO $this->tableName (".implode(", ", array_keys($this->props)).") VALUES(";
for ($i = 0; $i < count($this->props); $i++) {
$query .= "?";
... | php | public function save()
{
$result;
if (! self::$id) {
// new record so we insert
$query = "INSERT INTO $this->tableName (".implode(", ", array_keys($this->props)).") VALUES(";
for ($i = 0; $i < count($this->props); $i++) {
$query .= "?";
... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"result",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"id",
")",
"{",
"// new record so we insert",
"$",
"query",
"=",
"\"INSERT INTO $this->tableName (\"",
".",
"implode",
"(",
"\", \"",
",",
"array_keys",
"(",
... | Save either a new or existing record
@return integer 1 is successful, 0 if false | [
"Save",
"either",
"a",
"new",
"or",
"existing",
"record"
] | 12bb25ca31716aac97bbe78596810220e39626b0 | https://github.com/gangachris/potato-orm/blob/12bb25ca31716aac97bbe78596810220e39626b0/src/Potato.php#L158-L200 |
201,771 | gangachris/potato-orm | src/Potato.php | Potato.destroy | public static function destroy($id)
{
$table = self::getTableNameFromClass();
self::getOne($id);
$query = "DELETE FROM $table WHERE id = ".$id;
try {
Connection::db()->query($query);
return true;
} catch (Exception $e) {
return false;
... | php | public static function destroy($id)
{
$table = self::getTableNameFromClass();
self::getOne($id);
$query = "DELETE FROM $table WHERE id = ".$id;
try {
Connection::db()->query($query);
return true;
} catch (Exception $e) {
return false;
... | [
"public",
"static",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"$",
"table",
"=",
"self",
"::",
"getTableNameFromClass",
"(",
")",
";",
"self",
"::",
"getOne",
"(",
"$",
"id",
")",
";",
"$",
"query",
"=",
"\"DELETE FROM $table WHERE id = \"",
".",
... | Delete a record by id from the table in context
@param id $id the id of the record to be deleted
@return [type] [description] | [
"Delete",
"a",
"record",
"by",
"id",
"from",
"the",
"table",
"in",
"context"
] | 12bb25ca31716aac97bbe78596810220e39626b0 | https://github.com/gangachris/potato-orm/blob/12bb25ca31716aac97bbe78596810220e39626b0/src/Potato.php#L219-L233 |
201,772 | rollerworks/search-core | Extension/Core/DataTransformer/NumberToStringTransformer.php | NumberToStringTransformer.transform | public function transform($value): string
{
if (null === $value || '' === $value) {
return '';
}
if (!is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric or null.');
}
if ($value >= PHP_INT_MAX || $value <= -PHP_INT_MAX)... | php | public function transform($value): string
{
if (null === $value || '' === $value) {
return '';
}
if (!is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric or null.');
}
if ($value >= PHP_INT_MAX || $value <= -PHP_INT_MAX)... | [
"public",
"function",
"transform",
"(",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
"||",
"''",
"===",
"$",
"value",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",... | Transforms a number type into number.
@param int|float|string|null $value Number value
@throws TransformationFailedException If the given value is not numeric
or if the value can not be transformed | [
"Transforms",
"a",
"number",
"type",
"into",
"number",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Extension/Core/DataTransformer/NumberToStringTransformer.php#L33-L48 |
201,773 | rollerworks/search-core | Extension/Core/DataTransformer/NumberToStringTransformer.php | NumberToStringTransformer.reverseTransform | public function reverseTransform($value)
{
if (!is_scalar($value)) {
throw new TransformationFailedException('Expected a scalar.');
}
if ('' === $value) {
return null;
}
$result = $value;
if (!is_numeric($result)) {
throw new Tra... | php | public function reverseTransform($value)
{
if (!is_scalar($value)) {
throw new TransformationFailedException('Expected a scalar.');
}
if ('' === $value) {
return null;
}
$result = $value;
if (!is_numeric($result)) {
throw new Tra... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",
"(",
"'Expected a scalar.'",
")",
";",
"}",
"if",
"(",
"''",
"===",
"$",
... | Transforms a normalized number into an integer or float.
@param string $value The localized value
@throws TransformationFailedException If the given value is not a string
or if the value can not be transformed
@return int|float|null The numeric value | [
"Transforms",
"a",
"normalized",
"number",
"into",
"an",
"integer",
"or",
"float",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Extension/Core/DataTransformer/NumberToStringTransformer.php#L60-L89 |
201,774 | miaoxing/plugin | src/Service/Asset.php | Asset.locateFile | protected function locateFile($file)
{
$this->locateFile && $file = call_user_func($this->locateFile, $file);
return $file;
} | php | protected function locateFile($file)
{
$this->locateFile && $file = call_user_func($this->locateFile, $file);
return $file;
} | [
"protected",
"function",
"locateFile",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"locateFile",
"&&",
"$",
"file",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"locateFile",
",",
"$",
"file",
")",
";",
"return",
"$",
"file",
";",
"}"
] | Convert file name by callback
@param string $file
@return mixed | [
"Convert",
"file",
"name",
"by",
"callback"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/Asset.php#L95-L100 |
201,775 | miaoxing/plugin | src/Service/Asset.php | Asset.getRevMap | public function getRevMap()
{
if ($this->revMap === null) {
if ($this->revFile && is_file($this->revFile)) {
$this->revMap = (array) json_decode(file_get_contents($this->revFile));
} else {
$this->revMap = [];
}
}
return $t... | php | public function getRevMap()
{
if ($this->revMap === null) {
if ($this->revFile && is_file($this->revFile)) {
$this->revMap = (array) json_decode(file_get_contents($this->revFile));
} else {
$this->revMap = [];
}
}
return $t... | [
"public",
"function",
"getRevMap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"revMap",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"revFile",
"&&",
"is_file",
"(",
"$",
"this",
"->",
"revFile",
")",
")",
"{",
"$",
"this",
"->",
"rev... | Returns rev file content that parsed to array
@return array | [
"Returns",
"rev",
"file",
"content",
"that",
"parsed",
"to",
"array"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/Asset.php#L118-L129 |
201,776 | miaoxing/plugin | src/Service/Asset.php | Asset.addRevFile | public function addRevFile($file)
{
// Load default rev file
$this->getRevMap();
if (is_file($file)) {
$this->revMap = json_decode(file_get_contents($file), true) + $this->revMap;
}
return $this;
} | php | public function addRevFile($file)
{
// Load default rev file
$this->getRevMap();
if (is_file($file)) {
$this->revMap = json_decode(file_get_contents($file), true) + $this->revMap;
}
return $this;
} | [
"public",
"function",
"addRevFile",
"(",
"$",
"file",
")",
"{",
"// Load default rev file",
"$",
"this",
"->",
"getRevMap",
"(",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"revMap",
"=",
"json_decode",
"(",
"fil... | Add rev map from file
@param string $file
@return $this | [
"Add",
"rev",
"map",
"from",
"file"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/Asset.php#L137-L147 |
201,777 | miaoxing/plugin | src/Service/Asset.php | Asset.getRevFile | public function getRevFile($file)
{
$map = $this->getRevMap();
if (isset($map[$file])) {
$index = strrpos($file, '.');
$file = $this->revPrefix . substr($file, 0, $index) . '-' . $map[$file] . substr($file, $index);
}
return $file;
} | php | public function getRevFile($file)
{
$map = $this->getRevMap();
if (isset($map[$file])) {
$index = strrpos($file, '.');
$file = $this->revPrefix . substr($file, 0, $index) . '-' . $map[$file] . substr($file, $index);
}
return $file;
} | [
"public",
"function",
"getRevFile",
"(",
"$",
"file",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"getRevMap",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"map",
"[",
"$",
"file",
"]",
")",
")",
"{",
"$",
"index",
"=",
"strrpos",
"(",
"$",
... | Returns the file path contains revision
eg 'assets/article.js' => 'assets/article-a123b456.js'
@param string $file
@return string | [
"Returns",
"the",
"file",
"path",
"contains",
"revision"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/Asset.php#L157-L166 |
201,778 | VTacius/ldapPM | src/Objetos/objetosLdap.php | objetosLdap.conectar | public function conectar($destino, $usuario, $password = false) {
parent::conectar($destino, $usuario, $password);
$this->destino = $destino;
$this->usuario = $usuario;
$this->password = $password;
$this->objeto = 'objetosLdap';
} | php | public function conectar($destino, $usuario, $password = false) {
parent::conectar($destino, $usuario, $password);
$this->destino = $destino;
$this->usuario = $usuario;
$this->password = $password;
$this->objeto = 'objetosLdap';
} | [
"public",
"function",
"conectar",
"(",
"$",
"destino",
",",
"$",
"usuario",
",",
"$",
"password",
"=",
"false",
")",
"{",
"parent",
"::",
"conectar",
"(",
"$",
"destino",
",",
"$",
"usuario",
",",
"$",
"password",
")",
";",
"$",
"this",
"->",
"destin... | Sobreescribirlo a este nivel obedece a que es en los objetos donde por ahora
he visto la necesidad de acceder a las credenciales de conexion
para tratar con diferentes objetos
@param string $destino
@param string $usuario
@param string $password | [
"Sobreescribirlo",
"a",
"este",
"nivel",
"obedece",
"a",
"que",
"es",
"en",
"los",
"objetos",
"donde",
"por",
"ahora",
"he",
"visto",
"la",
"necesidad",
"de",
"acceder",
"a",
"las",
"credenciales",
"de",
"conexion",
"para",
"tratar",
"con",
"diferentes",
"ob... | 728af24cd0a5ca4fbed76ffb52aa4800b118879f | https://github.com/VTacius/ldapPM/blob/728af24cd0a5ca4fbed76ffb52aa4800b118879f/src/Objetos/objetosLdap.php#L99-L105 |
201,779 | VTacius/ldapPM | src/Objetos/objetosLdap.php | objetosLdap.actualizarObjetoLdap | public function actualizarObjetoLdap(){
if ($this->existe) {
$dn = $this->entrada['dn'];
$cambios = array();
foreach ($this->cambios as $atributos) {
$cambios[$atributos] = $this->entrada[$atributos];
}
return $this->modificarEntradaLda... | php | public function actualizarObjetoLdap(){
if ($this->existe) {
$dn = $this->entrada['dn'];
$cambios = array();
foreach ($this->cambios as $atributos) {
$cambios[$atributos] = $this->entrada[$atributos];
}
return $this->modificarEntradaLda... | [
"public",
"function",
"actualizarObjetoLdap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"existe",
")",
"{",
"$",
"dn",
"=",
"$",
"this",
"->",
"entrada",
"[",
"'dn'",
"]",
";",
"$",
"cambios",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
... | Actualiza una entrada LDAP existente
@return string | [
"Actualiza",
"una",
"entrada",
"LDAP",
"existente"
] | 728af24cd0a5ca4fbed76ffb52aa4800b118879f | https://github.com/VTacius/ldapPM/blob/728af24cd0a5ca4fbed76ffb52aa4800b118879f/src/Objetos/objetosLdap.php#L369-L381 |
201,780 | VTacius/ldapPM | src/Objetos/objetosLdap.php | objetosLdap.borrarObjetoLdap | protected function borrarObjetoLdap(){
if ($this->existe) {
$dn = $this->dnObjeto;
return $this->borrarEntradaLdap($dn);
}else{
$this->configurarErrorLdap('Actualizacion', 'Esa entrada no existe');
return false;
}
} | php | protected function borrarObjetoLdap(){
if ($this->existe) {
$dn = $this->dnObjeto;
return $this->borrarEntradaLdap($dn);
}else{
$this->configurarErrorLdap('Actualizacion', 'Esa entrada no existe');
return false;
}
} | [
"protected",
"function",
"borrarObjetoLdap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"existe",
")",
"{",
"$",
"dn",
"=",
"$",
"this",
"->",
"dnObjeto",
";",
"return",
"$",
"this",
"->",
"borrarEntradaLdap",
"(",
"$",
"dn",
")",
";",
"}",
"else",... | Borra el objeto que se ha consultado
@return boolean | [
"Borra",
"el",
"objeto",
"que",
"se",
"ha",
"consultado"
] | 728af24cd0a5ca4fbed76ffb52aa4800b118879f | https://github.com/VTacius/ldapPM/blob/728af24cd0a5ca4fbed76ffb52aa4800b118879f/src/Objetos/objetosLdap.php#L423-L432 |
201,781 | TuumPHP/Web | src/Web.php | Web.setAppRoot | public function setAppRoot(array $config)
{
$this->app_name = $config['app_name'];
$this->app_dir = rtrim($config['app_dir'], '/');
$this->debug = $config['debug'];
$this->config_dir = $config['config_dir'];
$this->view_dir = $config['view_dir'];
$this->va... | php | public function setAppRoot(array $config)
{
$this->app_name = $config['app_name'];
$this->app_dir = rtrim($config['app_dir'], '/');
$this->debug = $config['debug'];
$this->config_dir = $config['config_dir'];
$this->view_dir = $config['view_dir'];
$this->va... | [
"public",
"function",
"setAppRoot",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"app_name",
"=",
"$",
"config",
"[",
"'app_name'",
"]",
";",
"$",
"this",
"->",
"app_dir",
"=",
"rtrim",
"(",
"$",
"config",
"[",
"'app_dir'",
"]",
",",
"'/... | set up working directories.
@param array $config
@return $this | [
"set",
"up",
"working",
"directories",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Web.php#L105-L114 |
201,782 | TuumPHP/Web | src/Web.php | Web.loadConfig | public function loadConfig($env_file=null)
{
$this->configure($this->config_dir . '/configure');
if ($this->debug) {
$this->configure($this->config_dir . '/configure-debug');
}
$this->loadEnvironment($env_file);
return $this;
} | php | public function loadConfig($env_file=null)
{
$this->configure($this->config_dir . '/configure');
if ($this->debug) {
$this->configure($this->config_dir . '/configure-debug');
}
$this->loadEnvironment($env_file);
return $this;
} | [
"public",
"function",
"loadConfig",
"(",
"$",
"env_file",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"configure",
"(",
"$",
"this",
"->",
"config_dir",
".",
"'/configure'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"debug",
")",
"{",
"$",
"this",
"->",
... | loads the main configuration for the application.
@param null|string $env_file
@return $this | [
"loads",
"the",
"main",
"configuration",
"for",
"the",
"application",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Web.php#L147-L155 |
201,783 | TuumPHP/Web | src/Web.php | Web.loadEnvironment | public function loadEnvironment($env_file)
{
$env_file .= '.php';
if (!file_exists($env_file)) {
return $this;
}
/** @noinspection PhpIncludeInspection */
$environments = (array)include($env_file);
foreach ($environments as $env) {
$this->conf... | php | public function loadEnvironment($env_file)
{
$env_file .= '.php';
if (!file_exists($env_file)) {
return $this;
}
/** @noinspection PhpIncludeInspection */
$environments = (array)include($env_file);
foreach ($environments as $env) {
$this->conf... | [
"public",
"function",
"loadEnvironment",
"(",
"$",
"env_file",
")",
"{",
"$",
"env_file",
".=",
"'.php'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"env_file",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"/** @noinspection PhpIncludeInspection */",
"... | loads the environment based configuration.
@param string $env_file
@return $this | [
"loads",
"the",
"environment",
"based",
"configuration",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Web.php#L163-L175 |
201,784 | TuumPHP/Web | src/Web.php | Web.catchError | public function catchError(array $error_files)
{
$this->app->set(Web::ERROR_VIEWS, $error_files);
$whoops = new Run;
if ($this->debug) {
error_reporting(E_ALL);
$whoops->pushHandler(new PrettyPageHandler);
} else {
error_reporting(E_ERROR);
... | php | public function catchError(array $error_files)
{
$this->app->set(Web::ERROR_VIEWS, $error_files);
$whoops = new Run;
if ($this->debug) {
error_reporting(E_ALL);
$whoops->pushHandler(new PrettyPageHandler);
} else {
error_reporting(E_ERROR);
... | [
"public",
"function",
"catchError",
"(",
"array",
"$",
"error_files",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"set",
"(",
"Web",
"::",
"ERROR_VIEWS",
",",
"$",
"error_files",
")",
";",
"$",
"whoops",
"=",
"new",
"Run",
";",
"if",
"(",
"$",
"this",
... | set up global exception handler.
@param array $error_files
@return $this | [
"set",
"up",
"global",
"exception",
"handler",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Web.php#L208-L221 |
201,785 | TuumPHP/Web | src/Web.php | Web.getLog | public function getLog()
{
if($this->app->exists(LoggerInterface::class)) {
return $this->app->get(LoggerInterface::class);
}
$var_dir = $this->vars_dir . '/log/app.log';
$logger = new Logger('log');
$logger->pushHandler(
new FingersCrossedHandler(new... | php | public function getLog()
{
if($this->app->exists(LoggerInterface::class)) {
return $this->app->get(LoggerInterface::class);
}
$var_dir = $this->vars_dir . '/log/app.log';
$logger = new Logger('log');
$logger->pushHandler(
new FingersCrossedHandler(new... | [
"public",
"function",
"getLog",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"exists",
"(",
"LoggerInterface",
"::",
"class",
")",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"get",
"(",
"LoggerInterface",
"::",
"class",
")",
";"... | get shared logger. use Monolog as default.
@return LoggerInterface | [
"get",
"shared",
"logger",
".",
"use",
"Monolog",
"as",
"default",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Web.php#L258-L270 |
201,786 | jtreminio/Zimple | src/jtreminio/Zimple/Zimple.php | Zimple.lock | public function lock($id, $value, array $parameters = array())
{
$id = ltrim($id, '\\');
$obj = $this->set($id, $value, $parameters);
$this->offsetSet("lock.{$id}", true);
return $obj;
} | php | public function lock($id, $value, array $parameters = array())
{
$id = ltrim($id, '\\');
$obj = $this->set($id, $value, $parameters);
$this->offsetSet("lock.{$id}", true);
return $obj;
} | [
"public",
"function",
"lock",
"(",
"$",
"id",
",",
"$",
"value",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"id",
"=",
"ltrim",
"(",
"$",
"id",
",",
"'\\\\'",
")",
";",
"$",
"obj",
"=",
"$",
"this",
"->",
"set",
"... | Set a value and prevent modification to return value
@param string $id The unique identifier for the parameter or object
@param mixed $value The value of the parameter or a closure to defined an object
@param array $parameters The default parameters to use when calling this object
@return self | [
"Set",
"a",
"value",
"and",
"prevent",
"modification",
"to",
"return",
"value"
] | c116c42d22a9d27d5ad7853b591fd5903e029647 | https://github.com/jtreminio/Zimple/blob/c116c42d22a9d27d5ad7853b591fd5903e029647/src/jtreminio/Zimple/Zimple.php#L101-L109 |
201,787 | jtreminio/Zimple | src/jtreminio/Zimple/Zimple.php | Zimple.getUndefined | private function getUndefined($fqClassName, array $parameters)
{
// Only use ReflectionClass if parameters are needed in constructor
if (!empty($parameters)) {
$reflectionClass = new ReflectionClass($fqClassName);
return $reflectionClass->newInstanceArgs($parameters);
... | php | private function getUndefined($fqClassName, array $parameters)
{
// Only use ReflectionClass if parameters are needed in constructor
if (!empty($parameters)) {
$reflectionClass = new ReflectionClass($fqClassName);
return $reflectionClass->newInstanceArgs($parameters);
... | [
"private",
"function",
"getUndefined",
"(",
"$",
"fqClassName",
",",
"array",
"$",
"parameters",
")",
"{",
"// Only use ReflectionClass if parameters are needed in constructor",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"reflectionClass",
... | If the service has not been defined within the container, attempt to instantiate the class directly
@param string $fqClassName Fully qualified class name
@param array $parameters Parameters object may require for constructor
@return object | [
"If",
"the",
"service",
"has",
"not",
"been",
"defined",
"within",
"the",
"container",
"attempt",
"to",
"instantiate",
"the",
"class",
"directly"
] | c116c42d22a9d27d5ad7853b591fd5903e029647 | https://github.com/jtreminio/Zimple/blob/c116c42d22a9d27d5ad7853b591fd5903e029647/src/jtreminio/Zimple/Zimple.php#L128-L137 |
201,788 | itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Locator.php | Locator.getFiles | private function getFiles($path)
{
$files = array();
foreach (new \DirectoryIterator($path) as $file) {
if ($file->isDot()
|| (null != $this->scriptName && sprintf('%s.php', $this->scriptName) != $file->getFilename())
) {
continue;
... | php | private function getFiles($path)
{
$files = array();
foreach (new \DirectoryIterator($path) as $file) {
if ($file->isDot()
|| (null != $this->scriptName && sprintf('%s.php', $this->scriptName) != $file->getFilename())
) {
continue;
... | [
"private",
"function",
"getFiles",
"(",
"$",
"path",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
"path",
")",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"isDot",
... | Get files for a specific path
@param $path
@return array | [
"Get",
"files",
"for",
"a",
"specific",
"path"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Locator.php#L87-L103 |
201,789 | dms-org/common.structure | src/DateTime/Date.php | Date.fromNative | public static function fromNative(\DateTimeInterface $dateTime) : Date
{
return new self((int)$dateTime->format('Y'), (int)$dateTime->format('m'), (int)$dateTime->format('d'));
} | php | public static function fromNative(\DateTimeInterface $dateTime) : Date
{
return new self((int)$dateTime->format('Y'), (int)$dateTime->format('m'), (int)$dateTime->format('d'));
} | [
"public",
"static",
"function",
"fromNative",
"(",
"\\",
"DateTimeInterface",
"$",
"dateTime",
")",
":",
"Date",
"{",
"return",
"new",
"self",
"(",
"(",
"int",
")",
"$",
"dateTime",
"->",
"format",
"(",
"'Y'",
")",
",",
"(",
"int",
")",
"$",
"dateTime"... | Creates a date object from the date part of the supplied date time.
@param \DateTimeInterface $dateTime
@return Date | [
"Creates",
"a",
"date",
"object",
"from",
"the",
"date",
"part",
"of",
"the",
"supplied",
"date",
"time",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/Date.php#L38-L41 |
201,790 | dms-org/common.structure | src/DateTime/Date.php | Date.fromFormat | public static function fromFormat(string $format, string $dateString) : Date
{
return self::fromNative(\DateTimeImmutable::createFromFormat($format, $dateString));
} | php | public static function fromFormat(string $format, string $dateString) : Date
{
return self::fromNative(\DateTimeImmutable::createFromFormat($format, $dateString));
} | [
"public",
"static",
"function",
"fromFormat",
"(",
"string",
"$",
"format",
",",
"string",
"$",
"dateString",
")",
":",
"Date",
"{",
"return",
"self",
"::",
"fromNative",
"(",
"\\",
"DateTimeImmutable",
"::",
"createFromFormat",
"(",
"$",
"format",
",",
"$",... | Creates a date object from the supplied format string
@param string $format
@param string $dateString
@return Date | [
"Creates",
"a",
"date",
"object",
"from",
"the",
"supplied",
"format",
"string"
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/Date.php#L51-L54 |
201,791 | dms-org/common.structure | src/DateTime/Date.php | Date.daysBetween | public function daysBetween(Date $other) : int
{
return $this->dateTime->diff($other->dateTime, true)->days;
} | php | public function daysBetween(Date $other) : int
{
return $this->dateTime->diff($other->dateTime, true)->days;
} | [
"public",
"function",
"daysBetween",
"(",
"Date",
"$",
"other",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"dateTime",
"->",
"diff",
"(",
"$",
"other",
"->",
"dateTime",
",",
"true",
")",
"->",
"days",
";",
"}"
] | Returns the amount of days between the supplied dates.
@param Date $other
@return int | [
"Returns",
"the",
"amount",
"of",
"days",
"between",
"the",
"supplied",
"dates",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/Date.php#L135-L138 |
201,792 | prolic/HumusMvc | src/HumusMvc/Service/ModuleManagerFactory.php | ModuleManagerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
if (!$serviceLocator->has('ServiceListener')) {
$serviceLocator->setFactory('ServiceListener', 'HumusMvc\Service\ServiceListenerFactory');
}
if (!$serviceLocator->has('Zf1MvcListener')) {
$servic... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
if (!$serviceLocator->has('ServiceListener')) {
$serviceLocator->setFactory('ServiceListener', 'HumusMvc\Service\ServiceListenerFactory');
}
if (!$serviceLocator->has('Zf1MvcListener')) {
$servic... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"if",
"(",
"!",
"$",
"serviceLocator",
"->",
"has",
"(",
"'ServiceListener'",
")",
")",
"{",
"$",
"serviceLocator",
"->",
"setFactory",
"(",
"'ServiceListener'"... | Creates and returns the module manager
Instantiates the default module listeners, providing them configuration
from the "module_listener_options" key of the ApplicationConfig
service. Also sets the default config glob path.
Module manager is instantiated and provided with an EventManager, to which
the default listene... | [
"Creates",
"and",
"returns",
"the",
"module",
"manager"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/Service/ModuleManagerFactory.php#L50-L96 |
201,793 | codeblanche/Web | src/Web/QueryString.php | QueryString.toArray | public function toArray($ignoreEmpty = false)
{
if (!$ignoreEmpty) {
return $this->data;
}
return array_filter(
$this->data,
function ($value) {
return !empty($value);
}
);
} | php | public function toArray($ignoreEmpty = false)
{
if (!$ignoreEmpty) {
return $this->data;
}
return array_filter(
$this->data,
function ($value) {
return !empty($value);
}
);
} | [
"public",
"function",
"toArray",
"(",
"$",
"ignoreEmpty",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"ignoreEmpty",
")",
"{",
"return",
"$",
"this",
"->",
"data",
";",
"}",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"data",
",",
"function",
... | Extract data to an array
@param boolean $ignoreEmpty
@return array | [
"Extract",
"data",
"to",
"an",
"array"
] | 3e9ebf1943d3ea468f619ba99f7cc10714cb16e9 | https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/QueryString.php#L156-L168 |
201,794 | codeblanche/Web | src/Web/QueryString.php | QueryString.toString | public function toString($ignoreEmpty = false, $numPrefix = null, $separator = null)
{
if (empty($separator)) {
$separator = '&';
}
return http_build_query(
$this->toArray($ignoreEmpty),
$numPrefix,
$separator
);
} | php | public function toString($ignoreEmpty = false, $numPrefix = null, $separator = null)
{
if (empty($separator)) {
$separator = '&';
}
return http_build_query(
$this->toArray($ignoreEmpty),
$numPrefix,
$separator
);
} | [
"public",
"function",
"toString",
"(",
"$",
"ignoreEmpty",
"=",
"false",
",",
"$",
"numPrefix",
"=",
"null",
",",
"$",
"separator",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"separator",
")",
")",
"{",
"$",
"separator",
"=",
"'&'",
";",
... | Extract data as a query string.
@param boolean $ignoreEmpty Omit empty values.
@param string $numPrefix Prefix numeric keys
@param string $separator Query string value separator.
@return string | [
"Extract",
"data",
"as",
"a",
"query",
"string",
"."
] | 3e9ebf1943d3ea468f619ba99f7cc10714cb16e9 | https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/QueryString.php#L179-L190 |
201,795 | codeblanche/Web | src/Web/QueryString.php | QueryString.fromArray | protected function fromArray($data)
{
if (empty($data)) {
return $this;
}
$this->data = array_replace_recursive($this->data, $data);
return $this;
} | php | protected function fromArray($data)
{
if (empty($data)) {
return $this;
}
$this->data = array_replace_recursive($this->data, $data);
return $this;
} | [
"protected",
"function",
"fromArray",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"data",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"data",
",",
... | Set data from an array
@param array $data
@return QueryString | [
"Set",
"data",
"from",
"an",
"array"
] | 3e9ebf1943d3ea468f619ba99f7cc10714cb16e9 | https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/QueryString.php#L211-L220 |
201,796 | codeblanche/Web | src/Web/QueryString.php | QueryString.fromString | protected function fromString($queryString)
{
if (empty($queryString)) {
return $this;
}
$data = array();
parse_str($queryString, $data);
$this->fromArray($data);
return $this;
} | php | protected function fromString($queryString)
{
if (empty($queryString)) {
return $this;
}
$data = array();
parse_str($queryString, $data);
$this->fromArray($data);
return $this;
} | [
"protected",
"function",
"fromString",
"(",
"$",
"queryString",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"queryString",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"data",
"=",
"array",
"(",
")",
";",
"parse_str",
"(",
"$",
"queryString",
","... | Set data from a query string
@param string $queryString
@return QueryString | [
"Set",
"data",
"from",
"a",
"query",
"string"
] | 3e9ebf1943d3ea468f619ba99f7cc10714cb16e9 | https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/QueryString.php#L229-L242 |
201,797 | ciims/ciims-modules-api | controllers/SettingController.php | SettingController.getThemeAttributes | private function getThemeAttributes()
{
$theme = Cii::getConfig('theme', 'default');
if (!file_exists(Yii::getPathOfAlias('webroot.themes.' . $theme) . DIRECTORY_SEPARATOR . 'Theme.php'))
throw new CHttpException(400, Yii::t('Api.setting', 'The requested theme type is not set. Please set a theme before a... | php | private function getThemeAttributes()
{
$theme = Cii::getConfig('theme', 'default');
if (!file_exists(Yii::getPathOfAlias('webroot.themes.' . $theme) . DIRECTORY_SEPARATOR . 'Theme.php'))
throw new CHttpException(400, Yii::t('Api.setting', 'The requested theme type is not set. Please set a theme before a... | [
"private",
"function",
"getThemeAttributes",
"(",
")",
"{",
"$",
"theme",
"=",
"Cii",
"::",
"getConfig",
"(",
"'theme'",
",",
"'default'",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"Yii",
"::",
"getPathOfAlias",
"(",
"'webroot.themes.'",
".",
"$",
"the... | Retrieves the appropriate model for the theme
@param string $type The data type to load
@return Theme | [
"Retrieves",
"the",
"appropriate",
"model",
"for",
"the",
"theme"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/SettingController.php#L186-L205 |
201,798 | ciims/ciims-modules-api | controllers/SettingController.php | SettingController.loadData | private function loadData($post, &$model)
{
$model->populate($_POST, false);
if ($model->save())
return $this->getModelAttributes($model);
return $this->returnError(400, NULL, $model->getErrors());
} | php | private function loadData($post, &$model)
{
$model->populate($_POST, false);
if ($model->save())
return $this->getModelAttributes($model);
return $this->returnError(400, NULL, $model->getErrors());
} | [
"private",
"function",
"loadData",
"(",
"$",
"post",
",",
"&",
"$",
"model",
")",
"{",
"$",
"model",
"->",
"populate",
"(",
"$",
"_POST",
",",
"false",
")",
";",
"if",
"(",
"$",
"model",
"->",
"save",
"(",
")",
")",
"return",
"$",
"this",
"->",
... | Populates and saves model attributes
@param $_POST $post $_POST data
@param CiiSettingsModel $model The model we want to populate
@return array The saved model attributes or an error message | [
"Populates",
"and",
"saves",
"model",
"attributes"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/SettingController.php#L213-L221 |
201,799 | ciims/ciims-modules-api | controllers/SettingController.php | SettingController.getModelAttributes | private function getModelAttributes(&$model)
{
$response = array();
$reflection = new ReflectionClass($model);
$properties = $reflection->getProperties(ReflectionProperty::IS_PROTECTED);
foreach ($properties as $property)
$response[$property->name] = $model[$property->name];
return $response;
... | php | private function getModelAttributes(&$model)
{
$response = array();
$reflection = new ReflectionClass($model);
$properties = $reflection->getProperties(ReflectionProperty::IS_PROTECTED);
foreach ($properties as $property)
$response[$property->name] = $model[$property->name];
return $response;
... | [
"private",
"function",
"getModelAttributes",
"(",
"&",
"$",
"model",
")",
"{",
"$",
"response",
"=",
"array",
"(",
")",
";",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"model",
")",
";",
"$",
"properties",
"=",
"$",
"reflection",
"->",
... | Retrieves model attributes for a particular model
@param CiiSettingsModel $model The model we want to query against
@return array | [
"Retrieves",
"model",
"attributes",
"for",
"a",
"particular",
"model"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/SettingController.php#L228-L238 |
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.