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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wb-crowdfusion/crowdfusion | system/core/classes/libraries/validation/Errors.php | Errors.hasFieldError | public function hasFieldError($field)
{
foreach ((array)$this->errors as $err) {
if ($err instanceof FieldValidationError) {
$tfield = $err->getFieldResolved();
if($tfield == $field)
return true;
}
}
return false;
... | php | public function hasFieldError($field)
{
foreach ((array)$this->errors as $err) {
if ($err instanceof FieldValidationError) {
$tfield = $err->getFieldResolved();
if($tfield == $field)
return true;
}
}
return false;
... | [
"public",
"function",
"hasFieldError",
"(",
"$",
"field",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"errors",
"as",
"$",
"err",
")",
"{",
"if",
"(",
"$",
"err",
"instanceof",
"FieldValidationError",
")",
"{",
"$",
"tfield",
"=",
... | Determines if an error has occurred for the supplied field already
@param $field Field name
@return boolean | [
"Determines",
"if",
"an",
"error",
"has",
"occurred",
"for",
"the",
"supplied",
"field",
"already"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L147-L159 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/validation/Errors.php | Errors.getErrorsAsArray | public function getErrorsAsArray()
{
$errors = array();
$errors['HasErrors'] = $this->hasErrors();
$errors['ErrorCount'] = $this->getErrorCount();
$errors['Errors'] = (array)$this->errors;
/*
$errors['ErrorString'] = '';
$errors['FieldErrorString'] = '';
... | php | public function getErrorsAsArray()
{
$errors = array();
$errors['HasErrors'] = $this->hasErrors();
$errors['ErrorCount'] = $this->getErrorCount();
$errors['Errors'] = (array)$this->errors;
/*
$errors['ErrorString'] = '';
$errors['FieldErrorString'] = '';
... | [
"public",
"function",
"getErrorsAsArray",
"(",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"$",
"errors",
"[",
"'HasErrors'",
"]",
"=",
"$",
"this",
"->",
"hasErrors",
"(",
")",
";",
"$",
"errors",
"[",
"'ErrorCount'",
"]",
"=",
"$",
"this"... | Extracts the errors from the collection as ValidationErrors into simple arrays
@return array | [
"Extracts",
"the",
"errors",
"from",
"the",
"collection",
"as",
"ValidationErrors",
"into",
"simple",
"arrays"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L178-L220 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/validation/Errors.php | Errors.toString | public function toString()
{
$errorString = '';
foreach ((array)$this->errors as $err) {
$errorString .= $err->getDefaultErrorMessage().", ";
}
return substr($errorString, 0, -2);
} | php | public function toString()
{
$errorString = '';
foreach ((array)$this->errors as $err) {
$errorString .= $err->getDefaultErrorMessage().", ";
}
return substr($errorString, 0, -2);
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"errorString",
"=",
"''",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"errors",
"as",
"$",
"err",
")",
"{",
"$",
"errorString",
".=",
"$",
"err",
"->",
"getDefaultErrorMessage",
"(",
... | Returns a string that's a combination of all errors
@return string | [
"Returns",
"a",
"string",
"that",
"s",
"a",
"combination",
"of",
"all",
"errors"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L227-L234 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/validation/Errors.php | Errors.rejectField | public function rejectField($errorCode, $fieldResolved, $fieldTitle, $value, $message = '')
{
$this->addFieldError($errorCode, $fieldResolved, 'field', $fieldTitle, $value, $message==''?"$fieldTitle is required.":$message);
return $this;
} | php | public function rejectField($errorCode, $fieldResolved, $fieldTitle, $value, $message = '')
{
$this->addFieldError($errorCode, $fieldResolved, 'field', $fieldTitle, $value, $message==''?"$fieldTitle is required.":$message);
return $this;
} | [
"public",
"function",
"rejectField",
"(",
"$",
"errorCode",
",",
"$",
"fieldResolved",
",",
"$",
"fieldTitle",
",",
"$",
"value",
",",
"$",
"message",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"addFieldError",
"(",
"$",
"errorCode",
",",
"$",
"fieldResolve... | Adds a field error to the specified field
@param string $errorCode The error code to use
@param string $fieldResolved The machine readable field identifier
@param string $fieldTitle The human readable field name
@param string $value The value to check
@param string $message (optional) A default er... | [
"Adds",
"a",
"field",
"error",
"to",
"the",
"specified",
"field"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L315-L319 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/validation/Errors.php | Errors.validateModelObject | public function validateModelObject(ModelObject $model)
{
$fields = $model->getPersistentFields();
foreach ( $fields as $fieldName ) {
$value = $model->$fieldName;
$fieldResolved = get_class($model).'.'.$fieldName;
$this->rejectIfInvalid($fieldResolved,... | php | public function validateModelObject(ModelObject $model)
{
$fields = $model->getPersistentFields();
foreach ( $fields as $fieldName ) {
$value = $model->$fieldName;
$fieldResolved = get_class($model).'.'.$fieldName;
$this->rejectIfInvalid($fieldResolved,... | [
"public",
"function",
"validateModelObject",
"(",
"ModelObject",
"$",
"model",
")",
"{",
"$",
"fields",
"=",
"$",
"model",
"->",
"getPersistentFields",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
")",
"{",
"$",
"value",
"=",
"$"... | Validates the model object, rejecting the fields that fail validation
@param ModelObject $model The object to validate
@return void | [
"Validates",
"the",
"model",
"object",
"rejecting",
"the",
"fields",
"that",
"fail",
"validation"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/validation/Errors.php#L366-L381 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.wordsTokenized | public static function wordsTokenized($string)
{
for ($tokens = array(), $nextToken = strtok($string, ' '); $nextToken !== false; $nextToken = strtok(' ')) {
if ($nextToken{0} == '"')
$nextToken = $nextToken{strlen($nextToken)-1} == '"' ?
'"' . sub... | php | public static function wordsTokenized($string)
{
for ($tokens = array(), $nextToken = strtok($string, ' '); $nextToken !== false; $nextToken = strtok(' ')) {
if ($nextToken{0} == '"')
$nextToken = $nextToken{strlen($nextToken)-1} == '"' ?
'"' . sub... | [
"public",
"static",
"function",
"wordsTokenized",
"(",
"$",
"string",
")",
"{",
"for",
"(",
"$",
"tokens",
"=",
"array",
"(",
")",
",",
"$",
"nextToken",
"=",
"strtok",
"(",
"$",
"string",
",",
"' '",
")",
";",
"$",
"nextToken",
"!==",
"false",
";",
... | Splits a string into an array, exploded by spaces.
However, it takes "quoted strings" into account,
will count them as a single item.
@param string $string String to split
@see http://us2.php.net/manual/en/function.strtok.php#53244
@author brian dot cairns dot remove dot this at commerx dot com
@return array An a... | [
"Splits",
"a",
"string",
"into",
"an",
"array",
"exploded",
"by",
"spaces",
".",
"However",
"it",
"takes",
"quoted",
"strings",
"into",
"account",
"will",
"count",
"them",
"as",
"a",
"single",
"item",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L106-L117 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.smartSplit | public static function smartSplit($data, $delimiter = ';', $quote = "'", $escape = "\\'", $limit = null)
{
$results = array ();
// Split like normal to start.
$lines = explode($delimiter, $data);
if (empty ($lines))
return array ();
$broke = false;
for ... | php | public static function smartSplit($data, $delimiter = ';', $quote = "'", $escape = "\\'", $limit = null)
{
$results = array ();
// Split like normal to start.
$lines = explode($delimiter, $data);
if (empty ($lines))
return array ();
$broke = false;
for ... | [
"public",
"static",
"function",
"smartSplit",
"(",
"$",
"data",
",",
"$",
"delimiter",
"=",
"';'",
",",
"$",
"quote",
"=",
"\"'\"",
",",
"$",
"escape",
"=",
"\"\\\\'\"",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"results",
"=",
"array",
"(",
"... | Split a string around a delimiter, taking into account quoted substrings
@param string $data big string with data
@param string $delimiter Field delimiter
@param string $quote quote field character
@param string $escape escaped quote character
@param int $limit Return at most this many parts
@retur... | [
"Split",
"a",
"string",
"around",
"a",
"delimiter",
"taking",
"into",
"account",
"quoted",
"substrings"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L131-L169 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.lineIsOpenQuoted | public static function lineIsOpenQuoted($line, $quote, $escape)
{
// Returns TRUE if line is valid
$pos = 0;
$quote_open = false;
$esc_len = strlen($escape);
for (; $pos < strlen($line); ++ $pos) {
$char = $line[$pos];
// If the character i... | php | public static function lineIsOpenQuoted($line, $quote, $escape)
{
// Returns TRUE if line is valid
$pos = 0;
$quote_open = false;
$esc_len = strlen($escape);
for (; $pos < strlen($line); ++ $pos) {
$char = $line[$pos];
// If the character i... | [
"public",
"static",
"function",
"lineIsOpenQuoted",
"(",
"$",
"line",
",",
"$",
"quote",
",",
"$",
"escape",
")",
"{",
"// Returns TRUE if line is valid",
"$",
"pos",
"=",
"0",
";",
"$",
"quote_open",
"=",
"false",
";",
"$",
"esc_len",
"=",
"strlen",
"(",
... | Determines if a line is "open-quoted" and continues to the next line.
Most useful for parsing CSV files.
@param string $line The line to examine
@param string $quote The quote character (must be one character)
@param string $escape The escape character or character set
@return void | [
"Determines",
"if",
"a",
"line",
"is",
"open",
"-",
"quoted",
"and",
"continues",
"to",
"the",
"next",
"line",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L182-L209 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.smartExplode | public static function smartExplode($string)
{
if (empty($string))
return array();
if (is_array($string))
return $string;
if (!is_array($string)) {
if (strpos($string, ';') !== false)
return explode(';', trim($string, ';'));
... | php | public static function smartExplode($string)
{
if (empty($string))
return array();
if (is_array($string))
return $string;
if (!is_array($string)) {
if (strpos($string, ';') !== false)
return explode(';', trim($string, ';'));
... | [
"public",
"static",
"function",
"smartExplode",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"return",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"string",
")",
")",
"return",
"$",
"string",
";",
"if... | Explodes a string into an array split upon ';' or ',' characters
@param string $string The string to *EXPLODE*
@return array | [
"Explodes",
"a",
"string",
"into",
"an",
"array",
"split",
"upon",
";",
"or",
"characters"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L366-L383 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.pluralize | public static function pluralize($word)
{
$plural = array(
'/(quiz)$/i' => '\1zes',
'/^(ox)$/i' => '\1en',
'/([m|l])ouse$/i' => '\1ice',
'/(matr|vert|ind)ix|ex$/i' => '\1ices',
'/(x|ch|ss|sh)$/i' => '\1es',
'/([^aeiouy]|qu)ies$/i' => '\1y',
'/([^aeiouy... | php | public static function pluralize($word)
{
$plural = array(
'/(quiz)$/i' => '\1zes',
'/^(ox)$/i' => '\1en',
'/([m|l])ouse$/i' => '\1ice',
'/(matr|vert|ind)ix|ex$/i' => '\1ices',
'/(x|ch|ss|sh)$/i' => '\1es',
'/([^aeiouy]|qu)ies$/i' => '\1y',
'/([^aeiouy... | [
"public",
"static",
"function",
"pluralize",
"(",
"$",
"word",
")",
"{",
"$",
"plural",
"=",
"array",
"(",
"'/(quiz)$/i'",
"=>",
"'\\1zes'",
",",
"'/^(ox)$/i'",
"=>",
"'\\1en'",
",",
"'/([m|l])ouse$/i'",
"=>",
"'\\1ice'",
",",
"'/(matr|vert|ind)ix|ex$/i'",
"=>",... | Takes a word, and makes it plural.
@param string $word The word to pluralize
@return string | [
"Takes",
"a",
"word",
"and",
"makes",
"it",
"plural",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L533-L584 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.strToBool | public static function strToBool($string)
{
if(is_bool($string))
return $string;
if (in_array(strtolower((string)$string), array('1', 'true', 'on', '+', 'yes', 'y')))
return true;
elseif (in_array(strtolower((string)$string), array('', '0','false', 'off', '-', 'no', ... | php | public static function strToBool($string)
{
if(is_bool($string))
return $string;
if (in_array(strtolower((string)$string), array('1', 'true', 'on', '+', 'yes', 'y')))
return true;
elseif (in_array(strtolower((string)$string), array('', '0','false', 'off', '-', 'no', ... | [
"public",
"static",
"function",
"strToBool",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"string",
")",
")",
"return",
"$",
"string",
";",
"if",
"(",
"in_array",
"(",
"strtolower",
"(",
"(",
"string",
")",
"$",
"string",
")",
",",
... | Translates the given string into a boolean value if it's in the proper format
@param string $string The string to convert
@return boolean true or false, translated
@throws Exception if string cannot be converted | [
"Translates",
"the",
"given",
"string",
"into",
"a",
"boolean",
"value",
"if",
"it",
"s",
"in",
"the",
"proper",
"format"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L594-L605 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.stripslashesDeep | public static function stripslashesDeep($value)
{
$value = is_array($value) ?
array_map(array('StringUtils', 'stripslashesDeep'), $value) :
stripslashes($value);
return $value;
} | php | public static function stripslashesDeep($value)
{
$value = is_array($value) ?
array_map(array('StringUtils', 'stripslashesDeep'), $value) :
stripslashes($value);
return $value;
} | [
"public",
"static",
"function",
"stripslashesDeep",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"is_array",
"(",
"$",
"value",
")",
"?",
"array_map",
"(",
"array",
"(",
"'StringUtils'",
",",
"'stripslashesDeep'",
")",
",",
"$",
"value",
")",
":",
"st... | Recursively strips slashes from all values in the array
@param mixed $value If an array, all values will be stripslashed()
If a string, then it will be stripslashed()
@return array The stripped array | [
"Recursively",
"strips",
"slashes",
"from",
"all",
"values",
"in",
"the",
"array"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L615-L622 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/StringUtils.php | StringUtils.stripHtml | public static function stripHtml($value, $tags = null, $keepContent = false)
{
$content = '';
if(!is_array($tags)) {
$tags = (strpos($value, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
if(end($tags) == '') array_pop($tags);
}
fo... | php | public static function stripHtml($value, $tags = null, $keepContent = false)
{
$content = '';
if(!is_array($tags)) {
$tags = (strpos($value, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
if(end($tags) == '') array_pop($tags);
}
fo... | [
"public",
"static",
"function",
"stripHtml",
"(",
"$",
"value",
",",
"$",
"tags",
"=",
"null",
",",
"$",
"keepContent",
"=",
"false",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"tags",
")",
")",
"{",
"$",
"tag... | Strips a string of HTML tags specified, can strip content or just remove tags
@param string $value Html/text to strip html from
@param string $tags Comma separated list of tags to strip (ie "<object>,<script>")
@param bool $keepContent Keep content within html tags (defaults to false)
@return string
@s... | [
"Strips",
"a",
"string",
"of",
"HTML",
"tags",
"specified",
"can",
"strip",
"content",
"or",
"just",
"remove",
"tags"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/StringUtils.php#L737-L750 | train |
netbull/CoreBundle | Utils/PDFUtils.php | PDFUtils.convertMetric | public static function convertMetric( $value, $from, $to, $precision = null ) {
switch ($from . $to) {
case 'incm':
$value *= 2.54;
break;
case 'inmm':
$value *= 25.4;
break;
case 'inpt':
$value *... | php | public static function convertMetric( $value, $from, $to, $precision = null ) {
switch ($from . $to) {
case 'incm':
$value *= 2.54;
break;
case 'inmm':
$value *= 25.4;
break;
case 'inpt':
$value *... | [
"public",
"static",
"function",
"convertMetric",
"(",
"$",
"value",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"precision",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"from",
".",
"$",
"to",
")",
"{",
"case",
"'incm'",
":",
"$",
"value",
"*=",
"... | convert value from one metric to another.
@param $value
@param $from
@param $to
@param null $precision
@return float|int | [
"convert",
"value",
"from",
"one",
"metric",
"to",
"another",
"."
] | 0bacc1d9e4733b6da613027400c48421e5a14645 | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PDFUtils.php#L21-L66 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.setValues | public function setValues($values) {
if(false === is_array($values)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($values)), E_USER_ERROR);
}
$this -> values = $values;
return $this;
} | php | public function setValues($values) {
if(false === is_array($values)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($values)), E_USER_ERROR);
}
$this -> values = $values;
return $this;
} | [
"public",
"function",
"setValues",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type array, \"%s\" given'",
",",
"... | Add one or multiple fields to combine them as one
@param string|array $fieldnames
@return sFire\Validator\Combine | [
"Add",
"one",
"or",
"multiple",
"fields",
"to",
"combine",
"them",
"as",
"one"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L51-L60 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.setFieldnames | public function setFieldnames($fieldnames) {
if(false === is_array($fieldnames)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($fieldnames)), E_USER_ERROR);
}
$this -> fieldnames = $fieldnames;
} | php | public function setFieldnames($fieldnames) {
if(false === is_array($fieldnames)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($fieldnames)), E_USER_ERROR);
}
$this -> fieldnames = $fieldnames;
} | [
"public",
"function",
"setFieldnames",
"(",
"$",
"fieldnames",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"fieldnames",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type array, \"%s\" given'"... | Sets the fieldnames
@param array $fieldnames
@return sFire\Validator\Combine | [
"Sets",
"the",
"fieldnames"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L67-L74 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.glue | public function glue($glue) {
if(false === is_string($glue)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($glue)), E_USER_ERROR);
}
$this -> glue = $glue;
return $this;
} | php | public function glue($glue) {
if(false === is_string($glue)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($glue)), E_USER_ERROR);
}
$this -> glue = $glue;
return $this;
} | [
"public",
"function",
"glue",
"(",
"$",
"glue",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"glue",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__METHO... | Joins the fieldnames with the glue string between each fieldname
@param string $glue
@return sFire\Validator\Combine | [
"Joins",
"the",
"fieldnames",
"with",
"the",
"glue",
"string",
"between",
"each",
"fieldname"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L82-L91 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.format | public function format($format) {
if(false === is_string($format)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($format)), E_USER_ERROR);
}
$this -> format = $format;
return $this;
} | php | public function format($format) {
if(false === is_string($format)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($format)), E_USER_ERROR);
}
$this -> format = $format;
return $this;
} | [
"public",
"function",
"format",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"format",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"_... | Converts the fieldname values to the specific given format
@param string $format
@return sFire\Validator\Combine | [
"Converts",
"the",
"fieldname",
"values",
"to",
"the",
"specific",
"given",
"format"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L99-L108 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.name | public function name($name) {
if(false === is_string($name)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
}
$this -> name = $name;
return $this;
} | php | public function name($name) {
if(false === is_string($name)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
}
$this -> name = $name;
return $this;
} | [
"public",
"function",
"name",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__METHO... | Gives the combined fieldnames a new single name
@param string $name
@return sFire\Validator\Combine | [
"Gives",
"the",
"combined",
"fieldnames",
"a",
"new",
"single",
"name"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L116-L125 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Form/Combine.php | Combine.combine | public function combine() {
if(count($this -> values) > 0) {
if(null !== $this -> glue) {
return implode($this -> glue, $this -> values);
}
return vsprintf($this -> format, $this -> values);
}
} | php | public function combine() {
if(count($this -> values) > 0) {
if(null !== $this -> glue) {
return implode($this -> glue, $this -> values);
}
return vsprintf($this -> format, $this -> values);
}
} | [
"public",
"function",
"combine",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"values",
")",
">",
"0",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"glue",
")",
"{",
"return",
"implode",
"(",
"$",
"this",
"->",
"glue",
"... | Combine the values with the glue or format
@return string | [
"Combine",
"the",
"values",
"with",
"the",
"glue",
"or",
"format"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Form/Combine.php#L168-L178 | train |
RocketPropelledTortoise/Core | src/Taxonomy/Utils/RecursiveQuery.php | RecursiveQuery.getRecursiveAncestry | protected function getRecursiveAncestry(Collection $all_results, $ids)
{
$all_results->merge($results = DB::table($this->hierarchyTable)->whereIn('term_id', $ids)->get());
if (count($results)) {
$this->getRecursiveAncestry($all_results, Arr::pluck($results, 'parent_id'));
}
... | php | protected function getRecursiveAncestry(Collection $all_results, $ids)
{
$all_results->merge($results = DB::table($this->hierarchyTable)->whereIn('term_id', $ids)->get());
if (count($results)) {
$this->getRecursiveAncestry($all_results, Arr::pluck($results, 'parent_id'));
}
... | [
"protected",
"function",
"getRecursiveAncestry",
"(",
"Collection",
"$",
"all_results",
",",
"$",
"ids",
")",
"{",
"$",
"all_results",
"->",
"merge",
"(",
"$",
"results",
"=",
"DB",
"::",
"table",
"(",
"$",
"this",
"->",
"hierarchyTable",
")",
"->",
"where... | Get the ancestry recursively
@param Collection $all_results
@param int[] $ids | [
"Get",
"the",
"ancestry",
"recursively"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Utils/RecursiveQuery.php#L66-L73 | train |
pluf/tenant | src/Tenant/Views/Ticket.php | Tenant_Views_Ticket.createManyToOne | public function createManyToOne($request, $match)
{
$parent = Pluf_Shortcuts_GetObjectOr404('Tenant_Ticket', $match['parentId']);
$object = new Tenant_Comment();
$form = Pluf_Shortcuts_GetFormForModel($object, $request->REQUEST);
$object = $form->save(false);
$object->ticket_... | php | public function createManyToOne($request, $match)
{
$parent = Pluf_Shortcuts_GetObjectOr404('Tenant_Ticket', $match['parentId']);
$object = new Tenant_Comment();
$form = Pluf_Shortcuts_GetFormForModel($object, $request->REQUEST);
$object = $form->save(false);
$object->ticket_... | [
"public",
"function",
"createManyToOne",
"(",
"$",
"request",
",",
"$",
"match",
")",
"{",
"$",
"parent",
"=",
"Pluf_Shortcuts_GetObjectOr404",
"(",
"'Tenant_Ticket'",
",",
"$",
"match",
"[",
"'parentId'",
"]",
")",
";",
"$",
"object",
"=",
"new",
"Tenant_Co... | Create new comment
@param Pluf_HTTP_Request $request
@param array $match
@param array $p | [
"Create",
"new",
"comment"
] | a06359c52b9a257b5a0a186264e8770acfc54b73 | https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/Ticket.php#L37-L47 | train |
mwyatt/core | src/Url.php | Url.generateVersioned | public function generateVersioned($pathBase, $pathAppend)
{
$pathAbsolute = $pathBase . $pathAppend;
if (!file_exists($pathAbsolute)) {
throw new \Exception("cannot get cache busting path for file '$pathAbsolute'");
}
// get mod time
$timeModified = filemtime($pa... | php | public function generateVersioned($pathBase, $pathAppend)
{
$pathAbsolute = $pathBase . $pathAppend;
if (!file_exists($pathAbsolute)) {
throw new \Exception("cannot get cache busting path for file '$pathAbsolute'");
}
// get mod time
$timeModified = filemtime($pa... | [
"public",
"function",
"generateVersioned",
"(",
"$",
"pathBase",
",",
"$",
"pathAppend",
")",
"{",
"$",
"pathAbsolute",
"=",
"$",
"pathBase",
".",
"$",
"pathAppend",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"pathAbsolute",
")",
")",
"{",
"throw",
"n... | gets absolute path of a single file with cache busting powers!
@param string $path
@return string | [
"gets",
"absolute",
"path",
"of",
"a",
"single",
"file",
"with",
"cache",
"busting",
"powers!"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Url.php#L101-L113 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.actionError | public function actionError()
{
$error = array();
if (!empty(Yii::app()->errorHandler->error))
$error=Yii::app()->errorHandler->error;
$this->render('error', array('error' => $error));
} | php | public function actionError()
{
$error = array();
if (!empty(Yii::app()->errorHandler->error))
$error=Yii::app()->errorHandler->error;
$this->render('error', array('error' => $error));
} | [
"public",
"function",
"actionError",
"(",
")",
"{",
"$",
"error",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"errorHandler",
"->",
"error",
")",
")",
"$",
"error",
"=",
"Yii",
"::",
"app",
"(",
... | Error Action
The installer shouldn't error, if this happens, flat out die and blame the developer | [
"Error",
"Action",
"The",
"installer",
"shouldn",
"t",
"error",
"if",
"this",
"happens",
"flat",
"out",
"die",
"and",
"blame",
"the",
"developer"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L23-L30 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.actionIndex | public function actionIndex()
{
$model = new DatabaseForm;
// Assign previously set credentials
if (Cii::get(Yii::app()->session['dsn']) != "")
$model->attributes = Yii::app()->session['dsn'];
// If a post request was sent
if (Cii::get($_POST, 'D... | php | public function actionIndex()
{
$model = new DatabaseForm;
// Assign previously set credentials
if (Cii::get(Yii::app()->session['dsn']) != "")
$model->attributes = Yii::app()->session['dsn'];
// If a post request was sent
if (Cii::get($_POST, 'D... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"DatabaseForm",
";",
"// Assign previously set credentials",
"if",
"(",
"Cii",
"::",
"get",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"session",
"[",
"'dsn'",
"]",
")",
"!=",
"\... | Initial action the user arrives to.
Handles setting up the database connection | [
"Initial",
"action",
"the",
"user",
"arrives",
"to",
".",
"Handles",
"setting",
"up",
"the",
"database",
"connection"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L36-L64 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.actionCreateAdmin | public function actionCreateAdmin()
{
$model = new UserForm;
if (Cii::get($_POST, 'UserForm') != NULL)
{
$model->attributes = Cii::get($_POST, 'UserForm', array());
if ($model->validate())
{
$response = $this->runInstaller(... | php | public function actionCreateAdmin()
{
$model = new UserForm;
if (Cii::get($_POST, 'UserForm') != NULL)
{
$model->attributes = Cii::get($_POST, 'UserForm', array());
if ($model->validate())
{
$response = $this->runInstaller(... | [
"public",
"function",
"actionCreateAdmin",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"UserForm",
";",
"if",
"(",
"Cii",
"::",
"get",
"(",
"$",
"_POST",
",",
"'UserForm'",
")",
"!=",
"NULL",
")",
"{",
"$",
"model",
"->",
"attributes",
"=",
"Cii",
"::",... | This action enables us to create an admin user for CiiMS | [
"This",
"action",
"enables",
"us",
"to",
"create",
"an",
"admin",
"user",
"for",
"CiiMS"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L86-L114 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.actionRunMigrations | public function actionRunMigrations()
{
header('Content-Type: application/json');
$response = $this->runMigrationTool();
$data = array('migrated' => false, 'details' => $response);
if (strpos($response, 'Migrated up successfully.') || strpos($response, 'Your system... | php | public function actionRunMigrations()
{
header('Content-Type: application/json');
$response = $this->runMigrationTool();
$data = array('migrated' => false, 'details' => $response);
if (strpos($response, 'Migrated up successfully.') || strpos($response, 'Your system... | [
"public",
"function",
"actionRunMigrations",
"(",
")",
"{",
"header",
"(",
"'Content-Type: application/json'",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"runMigrationTool",
"(",
")",
";",
"$",
"data",
"=",
"array",
"(",
"'migrated'",
"=>",
"false",
... | Ajax comment to run CDbMigrations | [
"Ajax",
"comment",
"to",
"run",
"CDbMigrations"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L119-L132 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.runInstaller | private function runInstaller($userModel)
{
return $this->runCommand(Yii::app()->session['dsn'], 'application.modules.install.InstallerCommand', array(
'yiic',
'installer',
'index',
'--dbHost='.Yii::app()->session['dsn']['host'],
'--dbName='.Yii::a... | php | private function runInstaller($userModel)
{
return $this->runCommand(Yii::app()->session['dsn'], 'application.modules.install.InstallerCommand', array(
'yiic',
'installer',
'index',
'--dbHost='.Yii::app()->session['dsn']['host'],
'--dbName='.Yii::a... | [
"private",
"function",
"runInstaller",
"(",
"$",
"userModel",
")",
"{",
"return",
"$",
"this",
"->",
"runCommand",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"session",
"[",
"'dsn'",
"]",
",",
"'application.modules.install.InstallerCommand'",
",",
"array",
"(",
... | Runs the CLI installer which writes the config files and create the initial admin user
@param $userModel UserForm
@return string | [
"Runs",
"the",
"CLI",
"installer",
"which",
"writes",
"the",
"config",
"files",
"and",
"create",
"the",
"initial",
"admin",
"user"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L153-L169 | train |
ciims/ciims-modules-install | controllers/DefaultController.php | DefaultController.runCommand | private function runCommand($dsn, $command, $data)
{
$runner=new CConsoleCommandRunner();
$runner->commands=array(
'migrate' => array(
'class' => $command,
'dsn' => $dsn,
'interactive' => 0,
),
'db'=>array(
... | php | private function runCommand($dsn, $command, $data)
{
$runner=new CConsoleCommandRunner();
$runner->commands=array(
'migrate' => array(
'class' => $command,
'dsn' => $dsn,
'interactive' => 0,
),
'db'=>array(
... | [
"private",
"function",
"runCommand",
"(",
"$",
"dsn",
",",
"$",
"command",
",",
"$",
"data",
")",
"{",
"$",
"runner",
"=",
"new",
"CConsoleCommandRunner",
"(",
")",
";",
"$",
"runner",
"->",
"commands",
"=",
"array",
"(",
"'migrate'",
"=>",
"array",
"(... | Runs a given command
@param array $dsn The DSN
@param string $command The CLI command to run
@param array $data The runner data to use
@return string | [
"Runs",
"a",
"given",
"command"
] | 54d6a93e5c42c2d98e19de38a90e27f77358e88b | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/controllers/DefaultController.php#L178-L209 | train |
linpax/microphp-framework | src/db/drivers/Connection.php | Connection.setDriver | public function setDriver($dsn, array $config = [], array $options = [])
{
$class = '\Micro\Db\Drivers\\'.ucfirst(substr($dsn, 0, strpos($dsn, ':'))).'Driver';
if (!class_exists($class)) {
throw new Exception('DB driver `'.$class.'` not supported');
}
unset($this->drive... | php | public function setDriver($dsn, array $config = [], array $options = [])
{
$class = '\Micro\Db\Drivers\\'.ucfirst(substr($dsn, 0, strpos($dsn, ':'))).'Driver';
if (!class_exists($class)) {
throw new Exception('DB driver `'.$class.'` not supported');
}
unset($this->drive... | [
"public",
"function",
"setDriver",
"(",
"$",
"dsn",
",",
"array",
"$",
"config",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"'\\Micro\\Db\\Drivers\\\\'",
".",
"ucfirst",
"(",
"substr",
"(",
"$",
"dsn",
",... | Set active connection driver
@access public
@param string $dsn DSN connection string
@param array $config Configuration of connection
@param array $options Other options
@return void
@throws Exception | [
"Set",
"active",
"connection",
"driver"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/db/drivers/Connection.php#L66-L77 | train |
siriusSupreme/sirius-redis | src/Connections/PhpRedisConnection.php | PhpRedisConnection.hmget | public function hmget($key, ...$dictionary)
{
if (count($dictionary) == 1) {
$dictionary = $dictionary[0];
}
return array_values($this->command('hmget', [$key, $dictionary]));
} | php | public function hmget($key, ...$dictionary)
{
if (count($dictionary) == 1) {
$dictionary = $dictionary[0];
}
return array_values($this->command('hmget', [$key, $dictionary]));
} | [
"public",
"function",
"hmget",
"(",
"$",
"key",
",",
"...",
"$",
"dictionary",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"dictionary",
")",
"==",
"1",
")",
"{",
"$",
"dictionary",
"=",
"$",
"dictionary",
"[",
"0",
"]",
";",
"}",
"return",
"array_valu... | Get the value of the given hash fields.
@param string $key
@param dynamic $dictionary
@return int | [
"Get",
"the",
"value",
"of",
"the",
"given",
"hash",
"fields",
"."
] | 30abe086fdc44ba424d1554e16db586fa95b27a1 | https://github.com/siriusSupreme/sirius-redis/blob/30abe086fdc44ba424d1554e16db586fa95b27a1/src/Connections/PhpRedisConnection.php#L104-L111 | train |
siriusSupreme/sirius-redis | src/Connections/PhpRedisConnection.php | PhpRedisConnection.eval | public function eval($script, $numberOfKeys, ...$arguments)
{
return $this->client->eval($script, $arguments, $numberOfKeys);
} | php | public function eval($script, $numberOfKeys, ...$arguments)
{
return $this->client->eval($script, $arguments, $numberOfKeys);
} | [
"public",
"function",
"eval",
"(",
"$",
"script",
",",
"$",
"numberOfKeys",
",",
"...",
"$",
"arguments",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"eval",
"(",
"$",
"script",
",",
"$",
"arguments",
",",
"$",
"numberOfKeys",
")",
";",
"}... | Evaluate a script and retunr its result.
@param string $script
@param int $numberOfKeys
@param dynamic $arguments
@return mixed | [
"Evaluate",
"a",
"script",
"and",
"retunr",
"its",
"result",
"."
] | 30abe086fdc44ba424d1554e16db586fa95b27a1 | https://github.com/siriusSupreme/sirius-redis/blob/30abe086fdc44ba424d1554e16db586fa95b27a1/src/Connections/PhpRedisConnection.php#L319-L322 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.read | public function read($entityName)
{
return new ReadQuery(
$this->connection,
$this->models->get($entityName),
$this->factory,
$this->accessor,
$this->dispatcher
);
} | php | public function read($entityName)
{
return new ReadQuery(
$this->connection,
$this->models->get($entityName),
$this->factory,
$this->accessor,
$this->dispatcher
);
} | [
"public",
"function",
"read",
"(",
"$",
"entityName",
")",
"{",
"return",
"new",
"ReadQuery",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"models",
"->",
"get",
"(",
"$",
"entityName",
")",
",",
"$",
"this",
"->",
"factory",
",",
"$... | Sets read operation
@param string $entityName
@return ReadQueryInterface | [
"Sets",
"read",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L107-L116 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.readOne | public function readOne($entityName)
{
return new ReadOneQuery(
$this->connection,
$this->models->get($entityName),
$this->factory,
$this->accessor,
$this->dispatcher
);
} | php | public function readOne($entityName)
{
return new ReadOneQuery(
$this->connection,
$this->models->get($entityName),
$this->factory,
$this->accessor,
$this->dispatcher
);
} | [
"public",
"function",
"readOne",
"(",
"$",
"entityName",
")",
"{",
"return",
"new",
"ReadOneQuery",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"models",
"->",
"get",
"(",
"$",
"entityName",
")",
",",
"$",
"this",
"->",
"factory",
","... | Sets read one operation
@param string $entityName
@return ReadQueryInterface | [
"Sets",
"read",
"one",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L125-L134 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.write | public function write($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new WriteQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | php | public function write($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new WriteQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | [
"public",
"function",
"write",
"(",
"$",
"instance",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
"=",
"$",
"this",
"->",
"reassignEntity",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
";",
"re... | Sets write operation
@param array|object $instance
@param null|string|object $entity
@return WriteQueryInterface | [
"Sets",
"write",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L144-L156 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.update | public function update($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new UpdateQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | php | public function update($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new UpdateQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | [
"public",
"function",
"update",
"(",
"$",
"instance",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
"=",
"$",
"this",
"->",
"reassignEntity",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
";",
"r... | Sets update operation
@param array|object $instance
@param null|string|object $entity
@return UpdateQueryInterface | [
"Sets",
"update",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L166-L178 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.insert | public function insert($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new InsertQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | php | public function insert($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new InsertQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | [
"public",
"function",
"insert",
"(",
"$",
"instance",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
"=",
"$",
"this",
"->",
"reassignEntity",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
";",
"r... | Sets insert operation
@param array|object $instance
@param null|string|object $entity
@return InsertQueryInterface | [
"Sets",
"insert",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L188-L200 | train |
mossphp/moss-storage | Moss/Storage/Query/Storage.php | Storage.delete | public function delete($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new DeleteQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | php | public function delete($instance, $entity = null)
{
list($instance, $entity) = $this->reassignEntity($instance, $entity);
return new DeleteQuery(
$this->connection,
$instance,
$this->models->get($entity),
$this->factory,
$this->accessor,
... | [
"public",
"function",
"delete",
"(",
"$",
"instance",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
"=",
"$",
"this",
"->",
"reassignEntity",
"(",
"$",
"instance",
",",
"$",
"entity",
")",
";",
"r... | Sets delete operation
@param array|object $instance
@param null|string|object $entity
@return DeleteQueryInterface | [
"Sets",
"delete",
"operation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Storage.php#L210-L222 | train |
Dhii/exception | src/InitBaseExceptionCapableTrait.php | InitBaseExceptionCapableTrait._initBaseException | public function _initBaseException($message = null, $code = null, RootException $previous = null)
{
$message = is_null($message)
? ''
: $this->_normalizeString($message);
$code = is_null($code)
? 0
: $this->_normalizeInt($code);
$this->_initPa... | php | public function _initBaseException($message = null, $code = null, RootException $previous = null)
{
$message = is_null($message)
? ''
: $this->_normalizeString($message);
$code = is_null($code)
? 0
: $this->_normalizeInt($code);
$this->_initPa... | [
"public",
"function",
"_initBaseException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"RootException",
"$",
"previous",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"is_null",
"(",
"$",
"message",
")",
"?",
"''",
":",
"$",
... | Initializes the base exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@throws BaseIn... | [
"Initializes",
"the",
"base",
"exception",
"."
] | d42828984c85a509af3f7fde709561a1e520b9e4 | https://github.com/Dhii/exception/blob/d42828984c85a509af3f7fde709561a1e520b9e4/src/InitBaseExceptionCapableTrait.php#L27-L37 | train |
ricardopedias/old-extended | src/Accessor.php | Accessor.dateTransform | public function dateTransform($date_value, $format_origin = 'd/m/Y H:i:s', $format_destiny = 'Y-m-d H:i:s')
{
$date = \DateTime::createFromFormat($format_origin, $date_value);
return $date !== false ? $date->format($format_destiny) : '';
} | php | public function dateTransform($date_value, $format_origin = 'd/m/Y H:i:s', $format_destiny = 'Y-m-d H:i:s')
{
$date = \DateTime::createFromFormat($format_origin, $date_value);
return $date !== false ? $date->format($format_destiny) : '';
} | [
"public",
"function",
"dateTransform",
"(",
"$",
"date_value",
",",
"$",
"format_origin",
"=",
"'d/m/Y H:i:s'",
",",
"$",
"format_destiny",
"=",
"'Y-m-d H:i:s'",
")",
"{",
"$",
"date",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"$",
"format_origin",
... | Transforma uma data de um formato para outro
@param string $date_value O valor da data
@param string $format_origin O formato original do valor Ex: d/m/Y
@param string $format_destiny O formato transformado Ex: Y-m-d | [
"Transforma",
"uma",
"data",
"de",
"um",
"formato",
"para",
"outro"
] | 381a1cfc6aa4915e701ad252a7c78733e8484f26 | https://github.com/ricardopedias/old-extended/blob/381a1cfc6aa4915e701ad252a7c78733e8484f26/src/Accessor.php#L165-L169 | train |
blueblazeassociates/geocode-postalcodes | src/php/Utils.php | Utils.validate_distance | public static function validate_distance( $distance ) {
$valid = filter_var( $distance, FILTER_VALIDATE_INT,
array( 'options' => array(
'min_range' => 1,
'max_range' => PHP_INT_MAX
))
);
return false !== $valid ? true : false;
} | php | public static function validate_distance( $distance ) {
$valid = filter_var( $distance, FILTER_VALIDATE_INT,
array( 'options' => array(
'min_range' => 1,
'max_range' => PHP_INT_MAX
))
);
return false !== $valid ? true : false;
} | [
"public",
"static",
"function",
"validate_distance",
"(",
"$",
"distance",
")",
"{",
"$",
"valid",
"=",
"filter_var",
"(",
"$",
"distance",
",",
"FILTER_VALIDATE_INT",
",",
"array",
"(",
"'options'",
"=>",
"array",
"(",
"'min_range'",
"=>",
"1",
",",
"'max_r... | Validate distance.
Distance must be a positive integer.
@param string|integer $distance
@return boolean | [
"Validate",
"distance",
"."
] | 3a9b6c68327b13f5dc15015e78223dd215e8d4ea | https://github.com/blueblazeassociates/geocode-postalcodes/blob/3a9b6c68327b13f5dc15015e78223dd215e8d4ea/src/php/Utils.php#L18-L27 | train |
dms-org/common.structure | src/DateTime/DateTimeBase.php | DateTimeBase.diff | public function diff(DateTimeBase $other, bool $absolute = false)
{
return $this->dateTime->diff($other->dateTime, $absolute);
} | php | public function diff(DateTimeBase $other, bool $absolute = false)
{
return $this->dateTime->diff($other->dateTime, $absolute);
} | [
"public",
"function",
"diff",
"(",
"DateTimeBase",
"$",
"other",
",",
"bool",
"$",
"absolute",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"dateTime",
"->",
"diff",
"(",
"$",
"other",
"->",
"dateTime",
",",
"$",
"absolute",
")",
";",
"}"
] | Returns a diff of the supplied date time.
@param DateTimeBase $other
@param bool $absolute
@return \DateInterval | [
"Returns",
"a",
"diff",
"of",
"the",
"supplied",
"date",
"time",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/DateTimeBase.php#L31-L34 | train |
dms-org/common.structure | src/DateTime/DateTimeBase.php | DateTimeBase.equals | public function equals(DateTimeBase $other) : bool
{
$dateTime = $this->dateTime;
$otherDateTime = $other->dateTime;
return $dateTime == $otherDateTime
&& $dateTime->getTimezone()->getName() === $otherDateTime->getTimezone()->getName();
} | php | public function equals(DateTimeBase $other) : bool
{
$dateTime = $this->dateTime;
$otherDateTime = $other->dateTime;
return $dateTime == $otherDateTime
&& $dateTime->getTimezone()->getName() === $otherDateTime->getTimezone()->getName();
} | [
"public",
"function",
"equals",
"(",
"DateTimeBase",
"$",
"other",
")",
":",
"bool",
"{",
"$",
"dateTime",
"=",
"$",
"this",
"->",
"dateTime",
";",
"$",
"otherDateTime",
"=",
"$",
"other",
"->",
"dateTime",
";",
"return",
"$",
"dateTime",
"==",
"$",
"o... | Returns whether the DateTimeBase is equal to the supplied date.
@param DateTimeBase $other
@return bool | [
"Returns",
"whether",
"the",
"DateTimeBase",
"is",
"equal",
"to",
"the",
"supplied",
"date",
"."
] | 23f122182f60df5ec847047a81a39c8aab019ff1 | https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/DateTimeBase.php#L43-L50 | train |
johnkrovitch/SamBundle | src/Command/AbstractCommand.php | AbstractCommand.buildTasks | protected function buildTasks(array $configuration)
{
$this->io->text('- Building tasks...');
$builder = new TaskBuilder($this->debug);
$tasks = $builder->build($configuration);
$this->io->text('- Tasks build !');
$this->io->newLine();
return $tasks;
} | php | protected function buildTasks(array $configuration)
{
$this->io->text('- Building tasks...');
$builder = new TaskBuilder($this->debug);
$tasks = $builder->build($configuration);
$this->io->text('- Tasks build !');
$this->io->newLine();
return $tasks;
} | [
"protected",
"function",
"buildTasks",
"(",
"array",
"$",
"configuration",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"text",
"(",
"'- Building tasks...'",
")",
";",
"$",
"builder",
"=",
"new",
"TaskBuilder",
"(",
"$",
"this",
"->",
"debug",
")",
";",
"$",... | Build tasks from the configuration array.
@param array $configuration
@return Task[] | [
"Build",
"tasks",
"from",
"the",
"configuration",
"array",
"."
] | 6cc08ef2dd8f7cd5c33ee27818edd4697afa435e | https://github.com/johnkrovitch/SamBundle/blob/6cc08ef2dd8f7cd5c33ee27818edd4697afa435e/src/Command/AbstractCommand.php#L48-L59 | train |
johnkrovitch/SamBundle | src/Command/AbstractCommand.php | AbstractCommand.buildFilters | protected function buildFilters(array $configuration)
{
$this->io->text('- Building filters...');
$builder = new FilterBuilder($this->eventDispatcher);
$filters = $builder->build($configuration);
$this->io->text('- Filters build !');
$this->io->newLine();
return $f... | php | protected function buildFilters(array $configuration)
{
$this->io->text('- Building filters...');
$builder = new FilterBuilder($this->eventDispatcher);
$filters = $builder->build($configuration);
$this->io->text('- Filters build !');
$this->io->newLine();
return $f... | [
"protected",
"function",
"buildFilters",
"(",
"array",
"$",
"configuration",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"text",
"(",
"'- Building filters...'",
")",
";",
"$",
"builder",
"=",
"new",
"FilterBuilder",
"(",
"$",
"this",
"->",
"eventDispatcher",
")... | Build the filter according to the configuration array.
@param array $configuration
@return FilterInterface[] | [
"Build",
"the",
"filter",
"according",
"to",
"the",
"configuration",
"array",
"."
] | 6cc08ef2dd8f7cd5c33ee27818edd4697afa435e | https://github.com/johnkrovitch/SamBundle/blob/6cc08ef2dd8f7cd5c33ee27818edd4697afa435e/src/Command/AbstractCommand.php#L68-L79 | train |
johnkrovitch/SamBundle | src/Command/AbstractCommand.php | AbstractCommand.loadConfigurationFile | protected function loadConfigurationFile($configurationFile)
{
if (!file_exists($configurationFile)) {
throw new Exception('The configuration yml file '.$configurationFile.' was not found');
}
$configuration = Yaml::parse(file_get_contents($configurationFile));
if (empty... | php | protected function loadConfigurationFile($configurationFile)
{
if (!file_exists($configurationFile)) {
throw new Exception('The configuration yml file '.$configurationFile.' was not found');
}
$configuration = Yaml::parse(file_get_contents($configurationFile));
if (empty... | [
"protected",
"function",
"loadConfigurationFile",
"(",
"$",
"configurationFile",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"configurationFile",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'The configuration yml file '",
".",
"$",
"configurationFile",
... | Load the configuration from a yml file.
@param $configurationFile
@return string[]
@throws Exception | [
"Load",
"the",
"configuration",
"from",
"a",
"yml",
"file",
"."
] | 6cc08ef2dd8f7cd5c33ee27818edd4697afa435e | https://github.com/johnkrovitch/SamBundle/blob/6cc08ef2dd8f7cd5c33ee27818edd4697afa435e/src/Command/AbstractCommand.php#L90-L102 | train |
johnkrovitch/SamBundle | src/Command/AbstractCommand.php | AbstractCommand.loadConfiguration | protected function loadConfiguration(InputInterface $input)
{
$loader = new ConfigurationLoader();
if ($input->hasOption('config') && $file = $input->getOption('config')) {
$configuration = $loader->loadFromFile($file);
} else {
if (null === $this->conta... | php | protected function loadConfiguration(InputInterface $input)
{
$loader = new ConfigurationLoader();
if ($input->hasOption('config') && $file = $input->getOption('config')) {
$configuration = $loader->loadFromFile($file);
} else {
if (null === $this->conta... | [
"protected",
"function",
"loadConfiguration",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"$",
"loader",
"=",
"new",
"ConfigurationLoader",
"(",
")",
";",
"if",
"(",
"$",
"input",
"->",
"hasOption",
"(",
"'config'",
")",
"&&",
"$",
"file",
"=",
"$",
"... | Load the configuration from a yml file or the container, according to the given option.
@param InputInterface $input
@return array
@throws Exception | [
"Load",
"the",
"configuration",
"from",
"a",
"yml",
"file",
"or",
"the",
"container",
"according",
"to",
"the",
"given",
"option",
"."
] | 6cc08ef2dd8f7cd5c33ee27818edd4697afa435e | https://github.com/johnkrovitch/SamBundle/blob/6cc08ef2dd8f7cd5c33ee27818edd4697afa435e/src/Command/AbstractCommand.php#L113-L128 | train |
johnkrovitch/SamBundle | src/Command/AbstractCommand.php | AbstractCommand.setContainer | public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
$this->eventDispatcher = $this->container->get('event_dispatcher');
} | php | public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
$this->eventDispatcher = $this->container->get('event_dispatcher');
} | [
"public",
"function",
"setContainer",
"(",
"ContainerInterface",
"$",
"container",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"container",
";",
"$",
"this",
"->",
"eventDispatcher",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(... | Sets the container.
@param ContainerInterface|null $container A ContainerInterface instance or null | [
"Sets",
"the",
"container",
"."
] | 6cc08ef2dd8f7cd5c33ee27818edd4697afa435e | https://github.com/johnkrovitch/SamBundle/blob/6cc08ef2dd8f7cd5c33ee27818edd4697afa435e/src/Command/AbstractCommand.php#L135-L139 | train |
spoom-php/core | src/extension/Event/Emitter.php | Emitter.sort | protected function sort() {
if( !empty( $this->_callback_list ) ) {
// sort by the priorities, but keep the original indexes (we need it for the repopulation)
$priority_list = $this->_priority_list;
asort( $priority_list );
// repopulate the callbacks based on the new priority "map"
... | php | protected function sort() {
if( !empty( $this->_callback_list ) ) {
// sort by the priorities, but keep the original indexes (we need it for the repopulation)
$priority_list = $this->_priority_list;
asort( $priority_list );
// repopulate the callbacks based on the new priority "map"
... | [
"protected",
"function",
"sort",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_callback_list",
")",
")",
"{",
"// sort by the priorities, but keep the original indexes (we need it for the repopulation)",
"$",
"priority_list",
"=",
"$",
"this",
"->"... | Sort callbacks based on their priority | [
"Sort",
"callbacks",
"based",
"on",
"their",
"priority"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Event/Emitter.php#L149-L166 | train |
lasallecms/lasallecms-l5-tokenbasedlogin-pkg | src/Repositories/UserTokenbasedloginRepository.php | UserTokenbasedloginRepository.createLoginToken | public function createLoginToken($userID) {
$user = $this->getFind($userID);
$user->login_token = hash_hmac('sha256', Str::random(40), 'secret');
$user->login_token_created_at = Carbon::now();
return $user->save();
} | php | public function createLoginToken($userID) {
$user = $this->getFind($userID);
$user->login_token = hash_hmac('sha256', Str::random(40), 'secret');
$user->login_token_created_at = Carbon::now();
return $user->save();
} | [
"public",
"function",
"createLoginToken",
"(",
"$",
"userID",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getFind",
"(",
"$",
"userID",
")",
";",
"$",
"user",
"->",
"login_token",
"=",
"hash_hmac",
"(",
"'sha256'",
",",
"Str",
"::",
"random",
"(",
... | UPDATE the "users" table with a login token
@param int $userID User's ID | [
"UPDATE",
"the",
"users",
"table",
"with",
"a",
"login",
"token"
] | 8b7bc14b959626c3b02111415dd5f0a9b96b11ac | https://github.com/lasallecms/lasallecms-l5-tokenbasedlogin-pkg/blob/8b7bc14b959626c3b02111415dd5f0a9b96b11ac/src/Repositories/UserTokenbasedloginRepository.php#L84-L91 | train |
lasallecms/lasallecms-l5-tokenbasedlogin-pkg | src/Repositories/UserTokenbasedloginRepository.php | UserTokenbasedloginRepository.isLoginTokenExpired | public function isLoginTokenExpired($user) {
$startTime = strtotime($user->login_token_created_at);
$now = strtotime(Carbon::now());
// The time difference is in seconds, we want in minutes
$timeDiff = ($now - $startTime)/60;
$minutes2faFormIsLive = config('lasallecmstokenbasedlo... | php | public function isLoginTokenExpired($user) {
$startTime = strtotime($user->login_token_created_at);
$now = strtotime(Carbon::now());
// The time difference is in seconds, we want in minutes
$timeDiff = ($now - $startTime)/60;
$minutes2faFormIsLive = config('lasallecmstokenbasedlo... | [
"public",
"function",
"isLoginTokenExpired",
"(",
"$",
"user",
")",
"{",
"$",
"startTime",
"=",
"strtotime",
"(",
"$",
"user",
"->",
"login_token_created_at",
")",
";",
"$",
"now",
"=",
"strtotime",
"(",
"Carbon",
"::",
"now",
"(",
")",
")",
";",
"// The... | Has a login token expired?
@param object $user User object
@return bool | [
"Has",
"a",
"login",
"token",
"expired?"
] | 8b7bc14b959626c3b02111415dd5f0a9b96b11ac | https://github.com/lasallecms/lasallecms-l5-tokenbasedlogin-pkg/blob/8b7bc14b959626c3b02111415dd5f0a9b96b11ac/src/Repositories/UserTokenbasedloginRepository.php#L109-L120 | train |
lasallecms/lasallecms-l5-tokenbasedlogin-pkg | src/Repositories/UserTokenbasedloginRepository.php | UserTokenbasedloginRepository.deleteUserLoginTokenFields | public function deleteUserLoginTokenFields($userID) {
$user = $this->getFind($userID);
$user->login_token = '';
$user->login_token_created_at = '';
return $user->save();
} | php | public function deleteUserLoginTokenFields($userID) {
$user = $this->getFind($userID);
$user->login_token = '';
$user->login_token_created_at = '';
return $user->save();
} | [
"public",
"function",
"deleteUserLoginTokenFields",
"(",
"$",
"userID",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getFind",
"(",
"$",
"userID",
")",
";",
"$",
"user",
"->",
"login_token",
"=",
"''",
";",
"$",
"user",
"->",
"login_token_created_at",
... | Remove the 'login_token' and 'login_token_created_at' fields.
@param int $userID The user's ID
@return mixed | [
"Remove",
"the",
"login_token",
"and",
"login_token_created_at",
"fields",
"."
] | 8b7bc14b959626c3b02111415dd5f0a9b96b11ac | https://github.com/lasallecms/lasallecms-l5-tokenbasedlogin-pkg/blob/8b7bc14b959626c3b02111415dd5f0a9b96b11ac/src/Repositories/UserTokenbasedloginRepository.php#L128-L135 | train |
nails/module-blog | blog/controllers/Blog.php | NAILS_Blog.index | public function index()
{
// Meta & Breadcrumbs
$this->data['page']->title = APP_NAME . ' Blog';
$this->data['page']->seo->description = '';
$this->data['page']->seo->keywords = '';
// --------------------------------------------------------------------------
... | php | public function index()
{
// Meta & Breadcrumbs
$this->data['page']->title = APP_NAME . ' Blog';
$this->data['page']->seo->description = '';
$this->data['page']->seo->keywords = '';
// --------------------------------------------------------------------------
... | [
"public",
"function",
"index",
"(",
")",
"{",
"// Meta & Breadcrumbs",
"$",
"this",
"->",
"data",
"[",
"'page'",
"]",
"->",
"title",
"=",
"APP_NAME",
".",
"' Blog'",
";",
"$",
"this",
"->",
"data",
"[",
"'page'",
"]",
"->",
"seo",
"->",
"description",
... | Browse all posts
@return void | [
"Browse",
"all",
"posts"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/controllers/Blog.php#L45-L99 | train |
nails/module-blog | blog/controllers/Blog.php | NAILS_Blog.rss | public function rss()
{
if (!appSetting('rss_enabled', 'blog-' . $this->oBlog->id)) {
show404();
}
// --------------------------------------------------------------------------
// Get posts
$data = array();
$data['include_body'] =... | php | public function rss()
{
if (!appSetting('rss_enabled', 'blog-' . $this->oBlog->id)) {
show404();
}
// --------------------------------------------------------------------------
// Get posts
$data = array();
$data['include_body'] =... | [
"public",
"function",
"rss",
"(",
")",
"{",
"if",
"(",
"!",
"appSetting",
"(",
"'rss_enabled'",
",",
"'blog-'",
".",
"$",
"this",
"->",
"oBlog",
"->",
"id",
")",
")",
"{",
"show404",
"(",
")",
";",
"}",
"// ---------------------------------------------------... | RSS Feed for the blog
@return void | [
"RSS",
"Feed",
"for",
"the",
"blog"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/controllers/Blog.php#L438-L467 | train |
nails/module-blog | blog/controllers/Blog.php | NAILS_Blog.fetchSidebarWidgets | protected function fetchSidebarWidgets()
{
$this->data['widget'] = new stdClass();
if (appSetting('sidebar_latest_posts', 'blog-' . $this->oBlog->id)) {
$this->data['widget']->latest_posts = $this->blog_widget_model->latestPosts($this->oBlog->id);
}
if (appSetting('sid... | php | protected function fetchSidebarWidgets()
{
$this->data['widget'] = new stdClass();
if (appSetting('sidebar_latest_posts', 'blog-' . $this->oBlog->id)) {
$this->data['widget']->latest_posts = $this->blog_widget_model->latestPosts($this->oBlog->id);
}
if (appSetting('sid... | [
"protected",
"function",
"fetchSidebarWidgets",
"(",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'widget'",
"]",
"=",
"new",
"stdClass",
"(",
")",
";",
"if",
"(",
"appSetting",
"(",
"'sidebar_latest_posts'",
",",
"'blog-'",
".",
"$",
"this",
"->",
"oBlog",
... | Loads all the enabled sidebar widgets
@return void | [
"Loads",
"all",
"the",
"enabled",
"sidebar",
"widgets"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/controllers/Blog.php#L498-L521 | train |
nails/module-blog | blog/controllers/Blog.php | NAILS_Blog.loadView | private function loadView($sView, $aData = array())
{
$oView = Factory::service('View');
$sFile = $this->oSkin->path . 'views/' . $sView;
if (is_file($sFile . '.php')) {
$oView->load($sFile, $aData);
} elseif (!empty($this->oSkinParent)) {
$sFile = $this->... | php | private function loadView($sView, $aData = array())
{
$oView = Factory::service('View');
$sFile = $this->oSkin->path . 'views/' . $sView;
if (is_file($sFile . '.php')) {
$oView->load($sFile, $aData);
} elseif (!empty($this->oSkinParent)) {
$sFile = $this->... | [
"private",
"function",
"loadView",
"(",
"$",
"sView",
",",
"$",
"aData",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oView",
"=",
"Factory",
"::",
"service",
"(",
"'View'",
")",
";",
"$",
"sFile",
"=",
"$",
"this",
"->",
"oSkin",
"->",
"path",
".",
"... | Loads a view from the skin, falls back tot he parent view if there is one.
@param string $sView The view to load
@return void | [
"Loads",
"a",
"view",
"from",
"the",
"skin",
"falls",
"back",
"tot",
"he",
"parent",
"view",
"if",
"there",
"is",
"one",
"."
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/controllers/Blog.php#L530-L552 | train |
nails/module-blog | blog/controllers/Blog.php | NAILS_Blog._remap | public function _remap()
{
$method = $this->uri->rsegment(3) ? $this->uri->rsegment(3) : 'index';
if (method_exists($this, $method) && substr($method, 0, 1) != '_' && $this->input->get('id')) {
// Permalink
$this->single($this->input->get('id'));
} elseif (method_... | php | public function _remap()
{
$method = $this->uri->rsegment(3) ? $this->uri->rsegment(3) : 'index';
if (method_exists($this, $method) && substr($method, 0, 1) != '_' && $this->input->get('id')) {
// Permalink
$this->single($this->input->get('id'));
} elseif (method_... | [
"public",
"function",
"_remap",
"(",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"uri",
"->",
"rsegment",
"(",
"3",
")",
"?",
"$",
"this",
"->",
"uri",
"->",
"rsegment",
"(",
"3",
")",
":",
"'index'",
";",
"if",
"(",
"method_exists",
"(",
"$... | Routes the URL
@return void | [
"Routes",
"the",
"URL"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/controllers/Blog.php#L560-L584 | train |
gplcart/cli | controllers/commands/Review.php | Review.cmdGetReview | public function cmdGetReview()
{
$result = $this->getListReview();
$this->outputFormat($result);
$this->outputFormatTableReview($result);
$this->output();
} | php | public function cmdGetReview()
{
$result = $this->getListReview();
$this->outputFormat($result);
$this->outputFormatTableReview($result);
$this->output();
} | [
"public",
"function",
"cmdGetReview",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListReview",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableReview",
"(",
"$",
"result",... | Callback for "review-get" command | [
"Callback",
"for",
"review",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L40-L46 | train |
gplcart/cli | controllers/commands/Review.php | Review.setStatusReview | protected function setStatusReview($status)
{
$id = $this->getParam(0);
$all = $this->getParam('all');
if (!isset($id) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (isset($id) && (empty($id) || !is_numeric($id))) {
$thi... | php | protected function setStatusReview($status)
{
$id = $this->getParam(0);
$all = $this->getParam('all');
if (!isset($id) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
if (isset($id) && (empty($id) || !is_numeric($id))) {
$thi... | [
"protected",
"function",
"setStatusReview",
"(",
"$",
"status",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"all",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'all'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$"... | Sets status for one or several reviews
@param bool $status | [
"Sets",
"status",
"for",
"one",
"or",
"several",
"reviews"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L121-L165 | train |
gplcart/cli | controllers/commands/Review.php | Review.cmdUpdateReview | public function cmdUpdateReview()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdateReview()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdateReview",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"$... | Callback for "review-update" command | [
"Callback",
"for",
"review",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L184-L202 | train |
gplcart/cli | controllers/commands/Review.php | Review.addReview | protected function addReview()
{
if (!$this->isError()) {
$id = $this->review->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addReview()
{
if (!$this->isError()) {
$id = $this->review->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addReview",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"review",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
"if",
"... | Add a new review | [
"Add",
"a",
"new",
"review"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L271-L280 | train |
gplcart/cli | controllers/commands/Review.php | Review.submitAddReview | protected function submitAddReview()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('review');
$this->addReview();
} | php | protected function submitAddReview()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('review');
$this->addReview();
} | [
"protected",
"function",
"submitAddReview",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'review'",
")",
";",
"$",
"this",
"->",
"ad... | Add a new review at once | [
"Add",
"a",
"new",
"review",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L296-L301 | train |
gplcart/cli | controllers/commands/Review.php | Review.wizardAddReview | protected function wizardAddReview()
{
$this->validatePrompt('user_id', $this->text('User'), 'review');
$this->validatePrompt('product_id', $this->text('Product'), 'review');
$this->validatePrompt('text', $this->text('Text'), 'review');
$this->validatePrompt('status', $this->text('St... | php | protected function wizardAddReview()
{
$this->validatePrompt('user_id', $this->text('User'), 'review');
$this->validatePrompt('product_id', $this->text('Product'), 'review');
$this->validatePrompt('text', $this->text('Text'), 'review');
$this->validatePrompt('status', $this->text('St... | [
"protected",
"function",
"wizardAddReview",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'user_id'",
",",
"$",
"this",
"->",
"text",
"(",
"'User'",
")",
",",
"'review'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'product_id'",
",",
... | Add a new review step by step | [
"Add",
"a",
"new",
"review",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Review.php#L306-L315 | train |
Vectrex/vxPHP | src/File/MimeTypeGetter.php | MimeTypeGetter.getTypeFinfoExt | protected static function getTypeFinfoExt($file) {
$type = (new \finfo(FILEINFO_MIME_TYPE))->file($file);
if($type) {
return $type;
}
else {
return self::getTypeFileExtList($file);
}
} | php | protected static function getTypeFinfoExt($file) {
$type = (new \finfo(FILEINFO_MIME_TYPE))->file($file);
if($type) {
return $type;
}
else {
return self::getTypeFileExtList($file);
}
} | [
"protected",
"static",
"function",
"getTypeFinfoExt",
"(",
"$",
"file",
")",
"{",
"$",
"type",
"=",
"(",
"new",
"\\",
"finfo",
"(",
"FILEINFO_MIME_TYPE",
")",
")",
"->",
"file",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"type",
")",
"{",
"return",
... | Gets the Mime Type using the Fileinfo Extension.
If the Extension returns nothing the extension list
is used.
@param string $file the path to the File
@return string the Mime Type | [
"Gets",
"the",
"Mime",
"Type",
"using",
"the",
"Fileinfo",
"Extension",
".",
"If",
"the",
"Extension",
"returns",
"nothing",
"the",
"extension",
"list",
"is",
"used",
"."
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/File/MimeTypeGetter.php#L1042-L1054 | train |
Vectrex/vxPHP | src/File/MimeTypeGetter.php | MimeTypeGetter.getTypeFileExtList | protected static function getTypeFileExtList($file) {
$info = pathinfo(strtolower($file));
if(isset(self::$extensionToMime[$info['extension']])) {
return self::$extensionToMime[$info['extension']];
}
else {
return self::DEFAULT_MIME_TYPE;
}
} | php | protected static function getTypeFileExtList($file) {
$info = pathinfo(strtolower($file));
if(isset(self::$extensionToMime[$info['extension']])) {
return self::$extensionToMime[$info['extension']];
}
else {
return self::DEFAULT_MIME_TYPE;
}
} | [
"protected",
"static",
"function",
"getTypeFileExtList",
"(",
"$",
"file",
")",
"{",
"$",
"info",
"=",
"pathinfo",
"(",
"strtolower",
"(",
"$",
"file",
")",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"extensionToMime",
"[",
"$",
"info",
"[",... | extracts the file extension and checks the extension array
for the extension. If it is found it returns the MIME type.
If not it returns the the default MIME type.
@param string $file the path to the file
@return string | [
"extracts",
"the",
"file",
"extension",
"and",
"checks",
"the",
"extension",
"array",
"for",
"the",
"extension",
".",
"If",
"it",
"is",
"found",
"it",
"returns",
"the",
"MIME",
"type",
".",
"If",
"not",
"it",
"returns",
"the",
"the",
"default",
"MIME",
"... | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/File/MimeTypeGetter.php#L1064-L1075 | train |
Vectrex/vxPHP | src/File/MimeTypeGetter.php | MimeTypeGetter.getDefaultFileExtension | public static function getDefaultFileExtension($mime) {
if(empty(self::$mimeToExtension)) {
self::$mimeToExtension = array_flip(self::$extensionToMime);
}
return isset(self::$mimeToExtension[$mime]) ? self::$mimeToExtension[$mime] : '';
} | php | public static function getDefaultFileExtension($mime) {
if(empty(self::$mimeToExtension)) {
self::$mimeToExtension = array_flip(self::$extensionToMime);
}
return isset(self::$mimeToExtension[$mime]) ? self::$mimeToExtension[$mime] : '';
} | [
"public",
"static",
"function",
"getDefaultFileExtension",
"(",
"$",
"mime",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"mimeToExtension",
")",
")",
"{",
"self",
"::",
"$",
"mimeToExtension",
"=",
"array_flip",
"(",
"self",
"::",
"$",
"extension... | returns a default extension by a given MIME type
since a single MIME type can be assigned to more than one
extension the one determined by the array structure is returned
returns an empty string if no match for the MIME type was found
@param string
@return string | [
"returns",
"a",
"default",
"extension",
"by",
"a",
"given",
"MIME",
"type"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/File/MimeTypeGetter.php#L1131-L1139 | train |
vaccuum/container | source/Traits/TContainerConfiguration.php | TContainerConfiguration.configure | protected function configure(IConfig $config)
{
$configuration = $config->get('container');
foreach ($configuration as $name => $group)
{
switch ($name)
{
case 'parameters':
$this->configureParameters($group);
b... | php | protected function configure(IConfig $config)
{
$configuration = $config->get('container');
foreach ($configuration as $name => $group)
{
switch ($name)
{
case 'parameters':
$this->configureParameters($group);
b... | [
"protected",
"function",
"configure",
"(",
"IConfig",
"$",
"config",
")",
"{",
"$",
"configuration",
"=",
"$",
"config",
"->",
"get",
"(",
"'container'",
")",
";",
"foreach",
"(",
"$",
"configuration",
"as",
"$",
"name",
"=>",
"$",
"group",
")",
"{",
"... | Configure container.
@param IConfig $config
@return void | [
"Configure",
"container",
"."
] | 7d474cf42656585a0f66b4cc6f697f1c3185c980 | https://github.com/vaccuum/container/blob/7d474cf42656585a0f66b4cc6f697f1c3185c980/source/Traits/TContainerConfiguration.php#L14-L43 | train |
craig-mcmahon/google-helper | src/GoogleHelper/GoogleHelper.php | GoogleHelper.cmdLineAuth | public function cmdLineAuth()
{
$authUrl = $this->client->createAuthUrl();
//Request authorization
print "Please visit:\n$authUrl\n\n";
print "Please enter the auth code:\n";
$authCode = trim(fgets(STDIN));
// Exchange authorization code for access token
$acc... | php | public function cmdLineAuth()
{
$authUrl = $this->client->createAuthUrl();
//Request authorization
print "Please visit:\n$authUrl\n\n";
print "Please enter the auth code:\n";
$authCode = trim(fgets(STDIN));
// Exchange authorization code for access token
$acc... | [
"public",
"function",
"cmdLineAuth",
"(",
")",
"{",
"$",
"authUrl",
"=",
"$",
"this",
"->",
"client",
"->",
"createAuthUrl",
"(",
")",
";",
"//Request authorization",
"print",
"\"Please visit:\\n$authUrl\\n\\n\"",
";",
"print",
"\"Please enter the auth code:\\n\"",
";... | Auth over command line | [
"Auth",
"over",
"command",
"line"
] | 6b877efd7c9827555ecac65ee01e337849db6611 | https://github.com/craig-mcmahon/google-helper/blob/6b877efd7c9827555ecac65ee01e337849db6611/src/GoogleHelper/GoogleHelper.php#L79-L93 | train |
ivopetkov/notifications-bearframework-addon | classes/Notifications.php | Notifications.make | public function make(string $title = null, string $text = null): Notification
{
if (self::$newNotificationCache === null) {
self::$newNotificationCache = new Notification();
}
$notification = clone(self::$newNotificationCache);
if ($title !== null) {
$notifica... | php | public function make(string $title = null, string $text = null): Notification
{
if (self::$newNotificationCache === null) {
self::$newNotificationCache = new Notification();
}
$notification = clone(self::$newNotificationCache);
if ($title !== null) {
$notifica... | [
"public",
"function",
"make",
"(",
"string",
"$",
"title",
"=",
"null",
",",
"string",
"$",
"text",
"=",
"null",
")",
":",
"Notification",
"{",
"if",
"(",
"self",
"::",
"$",
"newNotificationCache",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"newNotifi... | Constructs a new notification and returns it.
@param ?string $title The notification title.
@param ?string $text The notification text.
@return \BearFramework\Notifications\Notification | [
"Constructs",
"a",
"new",
"notification",
"and",
"returns",
"it",
"."
] | 78a3b5995fcceee98a462e333bd3b4dd4fa155af | https://github.com/ivopetkov/notifications-bearframework-addon/blob/78a3b5995fcceee98a462e333bd3b4dd4fa155af/classes/Notifications.php#L35-L48 | train |
ivopetkov/notifications-bearframework-addon | classes/Notifications.php | Notifications.send | public function send(string $recipientID, Notification $notification): void
{
$app = App::get();
if ($notification->id === null) {
$notification->id = 'n' . uniqid() . 'x' . base_convert(rand(0, 999999999), 10, 16);
}
if ($notification->dateCreated === null) {
... | php | public function send(string $recipientID, Notification $notification): void
{
$app = App::get();
if ($notification->id === null) {
$notification->id = 'n' . uniqid() . 'x' . base_convert(rand(0, 999999999), 10, 16);
}
if ($notification->dateCreated === null) {
... | [
"public",
"function",
"send",
"(",
"string",
"$",
"recipientID",
",",
"Notification",
"$",
"notification",
")",
":",
"void",
"{",
"$",
"app",
"=",
"App",
"::",
"get",
"(",
")",
";",
"if",
"(",
"$",
"notification",
"->",
"id",
"===",
"null",
")",
"{",... | Sends a notification.
@param string $recipientID The recipient ID.
@param \BearFramework\Notifications\Notification $notification The notification to send.
@return void No value is returned.
@throws \Exception | [
"Sends",
"a",
"notification",
"."
] | 78a3b5995fcceee98a462e333bd3b4dd4fa155af | https://github.com/ivopetkov/notifications-bearframework-addon/blob/78a3b5995fcceee98a462e333bd3b4dd4fa155af/classes/Notifications.php#L58-L92 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.setOptsByArray | public function setOptsByArray($options)
{
foreach (self::$_setableOptions as $optionKey) {
if (isset($options[$optionKey])) {
$this->$optionKey = $options[$optionKey];
}
}
return $this;
} | php | public function setOptsByArray($options)
{
foreach (self::$_setableOptions as $optionKey) {
if (isset($options[$optionKey])) {
$this->$optionKey = $options[$optionKey];
}
}
return $this;
} | [
"public",
"function",
"setOptsByArray",
"(",
"$",
"options",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"_setableOptions",
"as",
"$",
"optionKey",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"$",
"optionKey",
"]",
")",
")",
"{",
"$",
"t... | Retrieve an option array and set valid keys as instance variables.
@param array $options | [
"Retrieve",
"an",
"option",
"array",
"and",
"set",
"valid",
"keys",
"as",
"instance",
"variables",
"."
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L96-L105 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.getScope | public function getScope() {
$calledHere = $this->backTrace[$this->backTraceOffset+1];
if (isset($calledHere['class'])) {
return (object) array(
'type' => 'Method',
'name' => $calledHere['class'].$calledHere['type'].$calledHere['function']
);
} elseif(isset($calledHere['function'])) {
r... | php | public function getScope() {
$calledHere = $this->backTrace[$this->backTraceOffset+1];
if (isset($calledHere['class'])) {
return (object) array(
'type' => 'Method',
'name' => $calledHere['class'].$calledHere['type'].$calledHere['function']
);
} elseif(isset($calledHere['function'])) {
r... | [
"public",
"function",
"getScope",
"(",
")",
"{",
"$",
"calledHere",
"=",
"$",
"this",
"->",
"backTrace",
"[",
"$",
"this",
"->",
"backTraceOffset",
"+",
"1",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"calledHere",
"[",
"'class'",
"]",
")",
")",
"{",
... | Get the current function or method scope according to the backtraceOffset
@return object | [
"Get",
"the",
"current",
"function",
"or",
"method",
"scope",
"according",
"to",
"the",
"backtraceOffset"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L112-L130 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.getID | public function getID() {
if (!isset($this->ID)) {
$this->ID = md5($this->file.$this->line);
}
return $this->ID;
} | php | public function getID() {
if (!isset($this->ID)) {
$this->ID = md5($this->file.$this->line);
}
return $this->ID;
} | [
"public",
"function",
"getID",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"ID",
")",
")",
"{",
"$",
"this",
"->",
"ID",
"=",
"md5",
"(",
"$",
"this",
"->",
"file",
".",
"$",
"this",
"->",
"line",
")",
";",
"}",
"return",
... | Generate a hash from the file and line
@return string the id | [
"Generate",
"a",
"hash",
"from",
"the",
"file",
"and",
"line"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L137-L143 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.setLineAndFile | public function setLineAndFile()
{
if (isset($this->backTrace[$this->backTraceOffset])) {
/* Reset the ID because its based on the current line and file */
$this->ID = null;
$calledHere = $this->backTrace[$this->backTraceOffset];
if (isset($calledHere['line'])) {
$this->line = $calledHere['l... | php | public function setLineAndFile()
{
if (isset($this->backTrace[$this->backTraceOffset])) {
/* Reset the ID because its based on the current line and file */
$this->ID = null;
$calledHere = $this->backTrace[$this->backTraceOffset];
if (isset($calledHere['line'])) {
$this->line = $calledHere['l... | [
"public",
"function",
"setLineAndFile",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"backTrace",
"[",
"$",
"this",
"->",
"backTraceOffset",
"]",
")",
")",
"{",
"/* Reset the ID because its based on the current line and file */",
"$",
"this",
"->",
... | Use the backTraceOffset and find the file and line in which the debug was called
@return void | [
"Use",
"the",
"backTraceOffset",
"and",
"find",
"the",
"file",
"and",
"line",
"in",
"which",
"the",
"debug",
"was",
"called"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L150-L166 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.put | public function put() {
X\THEDEBUG::i()->doCallback('beforePut', array(&$this));
$this->doCallback('beforePut', array(&$this));
switch (strtolower($this->modus)) {
case 'firephp':
$this->putFirePHP();
break;
case 'chromephp':
$this->putChromePHP();
break;
default:
$this->putInlin... | php | public function put() {
X\THEDEBUG::i()->doCallback('beforePut', array(&$this));
$this->doCallback('beforePut', array(&$this));
switch (strtolower($this->modus)) {
case 'firephp':
$this->putFirePHP();
break;
case 'chromephp':
$this->putChromePHP();
break;
default:
$this->putInlin... | [
"public",
"function",
"put",
"(",
")",
"{",
"X",
"\\",
"THEDEBUG",
"::",
"i",
"(",
")",
"->",
"doCallback",
"(",
"'beforePut'",
",",
"array",
"(",
"&",
"$",
"this",
")",
")",
";",
"$",
"this",
"->",
"doCallback",
"(",
"'beforePut'",
",",
"array",
"... | fire the appropriate output method for the current modus
@return void | [
"fire",
"the",
"appropriate",
"output",
"method",
"for",
"the",
"current",
"modus"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L173-L188 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.putChromePHP | public function putChromePHP() {
$ChromePHP = X\THEDEBUG::getChromePHP();
$ChromePHP->backtrace = $this->file.': '.$this->line;
$this->_improveVar();
$args = array();
if (!empty($this->name)) {
$args[] = $this->name.':';
}
$args[] = $this->variable;
call_user_func_array(
array(
... | php | public function putChromePHP() {
$ChromePHP = X\THEDEBUG::getChromePHP();
$ChromePHP->backtrace = $this->file.': '.$this->line;
$this->_improveVar();
$args = array();
if (!empty($this->name)) {
$args[] = $this->name.':';
}
$args[] = $this->variable;
call_user_func_array(
array(
... | [
"public",
"function",
"putChromePHP",
"(",
")",
"{",
"$",
"ChromePHP",
"=",
"X",
"\\",
"THEDEBUG",
"::",
"getChromePHP",
"(",
")",
";",
"$",
"ChromePHP",
"->",
"backtrace",
"=",
"$",
"this",
"->",
"file",
".",
"': '",
".",
"$",
"this",
"->",
"line",
... | Pass the debug to ChromePHP
@return void | [
"Pass",
"the",
"debug",
"to",
"ChromePHP"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L195-L213 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG.putFirePHP | public function putFirePHP() {
$FirePHP = X\THEDEBUG::getFirePHP();
$this->_improveVar();
call_user_func_array(
array($FirePHP, $this->_getMethod()),
array(
$this->variable,
$this->name,
array(
'File' => $this->file,
'Line' => $this->line
)
)
);
} | php | public function putFirePHP() {
$FirePHP = X\THEDEBUG::getFirePHP();
$this->_improveVar();
call_user_func_array(
array($FirePHP, $this->_getMethod()),
array(
$this->variable,
$this->name,
array(
'File' => $this->file,
'Line' => $this->line
)
)
);
} | [
"public",
"function",
"putFirePHP",
"(",
")",
"{",
"$",
"FirePHP",
"=",
"X",
"\\",
"THEDEBUG",
"::",
"getFirePHP",
"(",
")",
";",
"$",
"this",
"->",
"_improveVar",
"(",
")",
";",
"call_user_func_array",
"(",
"array",
"(",
"$",
"FirePHP",
",",
"$",
"thi... | Pass the debug to firePHP
@return void | [
"Pass",
"the",
"debug",
"to",
"firePHP"
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L220-L236 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG._improveVar | private function _improveVar()
{
switch ($this->variableType) {
case 'boolean':
$this->variable = '(boolean) '.($this->variable ? 'true' : 'false');
break;
case 'NULL':
$this->variable = '(null) NULL';
break;
case 'string':
$this->variable = '"'.$this->variable.'"';
default:
bre... | php | private function _improveVar()
{
switch ($this->variableType) {
case 'boolean':
$this->variable = '(boolean) '.($this->variable ? 'true' : 'false');
break;
case 'NULL':
$this->variable = '(null) NULL';
break;
case 'string':
$this->variable = '"'.$this->variable.'"';
default:
bre... | [
"private",
"function",
"_improveVar",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"variableType",
")",
"{",
"case",
"'boolean'",
":",
"$",
"this",
"->",
"variable",
"=",
"'(boolean) '",
".",
"(",
"$",
"this",
"->",
"variable",
"?",
"'true'",
":",
... | Make our variable more understandable.
@return null | [
"Make",
"our",
"variable",
"more",
"understandable",
"."
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L290-L304 | train |
Xiphe/THEDEBUG | src/Xiphe/THEDEBUG/ADEBUG.php | ADEBUG._allocateArgs | private function _allocateArgs($arguments)
{
if (empty($arguments)) {
return;
}
/* First argument is the variable to be debugged */
$this->variable = $arguments[0];
$this->variableType = gettype($this->variable);
/*
* The second and third argument can be either an integer representing
... | php | private function _allocateArgs($arguments)
{
if (empty($arguments)) {
return;
}
/* First argument is the variable to be debugged */
$this->variable = $arguments[0];
$this->variableType = gettype($this->variable);
/*
* The second and third argument can be either an integer representing
... | [
"private",
"function",
"_allocateArgs",
"(",
"$",
"arguments",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"arguments",
")",
")",
"{",
"return",
";",
"}",
"/* First argument is the variable to be debugged */",
"$",
"this",
"->",
"variable",
"=",
"$",
"arguments",
... | Check which arguments were passed and name them.
@param array $arguments
@return void | [
"Check",
"which",
"arguments",
"were",
"passed",
"and",
"name",
"them",
"."
] | 76983738a781cc495241672d57e7650aee57a2db | https://github.com/Xiphe/THEDEBUG/blob/76983738a781cc495241672d57e7650aee57a2db/src/Xiphe/THEDEBUG/ADEBUG.php#L312-L346 | train |
Dhii/config | src/DereferenceTokensCapableTrait.php | DereferenceTokensCapableTrait._dereferenceTokens | protected function _dereferenceTokens($value)
{
if (is_scalar($value) && !is_string($value)) {
return $value;
}
try {
$value = $this->_normalizeString($value);
} catch (InvalidArgumentException $e) {
return $value;
}
$... | php | protected function _dereferenceTokens($value)
{
if (is_scalar($value) && !is_string($value)) {
return $value;
}
try {
$value = $this->_normalizeString($value);
} catch (InvalidArgumentException $e) {
return $value;
}
$... | [
"protected",
"function",
"_dereferenceTokens",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
"&&",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"try",
"{",
"$",
"value",
"=",
"... | Replaces tokens with their values.
@since [*next-version*]
@param string|Stringable|mixed $value The value, in which tokens may be found.
If value is not stringable, will return it as is.
@throws RuntimeException If tokens could not be replaced.
@return string|Stringable The value with tokens replaced. | [
"Replaces",
"tokens",
"with",
"their",
"values",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/DereferenceTokensCapableTrait.php#L31-L54 | train |
libreworks/caridea-dao | src/Exception/Translator/Doctrine.php | Doctrine.translate | public static function translate(\Exception $e): \Exception
{
if ($e instanceof \Doctrine\DBAL\Exception\ConnectionException) {
return new \Caridea\Dao\Exception\Unreachable("System unreachable or connection timed out", $e->getCode(), $e);
} elseif ($e instanceof \Doctrine\ORM\EntityNotF... | php | public static function translate(\Exception $e): \Exception
{
if ($e instanceof \Doctrine\DBAL\Exception\ConnectionException) {
return new \Caridea\Dao\Exception\Unreachable("System unreachable or connection timed out", $e->getCode(), $e);
} elseif ($e instanceof \Doctrine\ORM\EntityNotF... | [
"public",
"static",
"function",
"translate",
"(",
"\\",
"Exception",
"$",
"e",
")",
":",
"\\",
"Exception",
"{",
"if",
"(",
"$",
"e",
"instanceof",
"\\",
"Doctrine",
"\\",
"DBAL",
"\\",
"Exception",
"\\",
"ConnectionException",
")",
"{",
"return",
"new",
... | Translates a Doctrine exception.
@param \Exception $e The exception to translate
@return \Exception The exception to use | [
"Translates",
"a",
"Doctrine",
"exception",
"."
] | 22c2fc81f63050ad23f7b0c40e430ff026e1e767 | https://github.com/libreworks/caridea-dao/blob/22c2fc81f63050ad23f7b0c40e430ff026e1e767/src/Exception/Translator/Doctrine.php#L37-L61 | train |
Wedeto/DB | src/Query/OrderClause.php | OrderClause.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
$clauses = $this->getClauses();
$strs = array();
foreach ($clauses as $clause)
$strs[] = $drv->toSQL($params, $clause);
if (count($strs) === 0)
return;
... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
$clauses = $this->getClauses();
$strs = array();
foreach ($clauses as $clause)
$strs[] = $drv->toSQL($params, $clause);
if (count($strs) === 0)
return;
... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"drv",
"=",
"$",
"params",
"->",
"getDriver",
"(",
")",
";",
"$",
"clauses",
"=",
"$",
"this",
"->",
"getClauses",
"(",
")",
";",
"$",
... | Write a order clause as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param bool $inner_clause Unused
@return string The generated SQL | [
"Write",
"a",
"order",
"clause",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/OrderClause.php#L84-L97 | train |
Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractPhpClassContentModifier.php | AbstractPhpClassContentModifier.retrieveBundleInfoFromGeneratedFile | protected function retrieveBundleInfoFromGeneratedFile(SplFileInfo $generatedFile, Inflector $inflector)
{
if($generatedFile->getExtension() !== 'php'){
throw new UnsupportedFileForContentModifierException(sprintf(
'This content modifier requires to be used on a PHP file, "%s" is... | php | protected function retrieveBundleInfoFromGeneratedFile(SplFileInfo $generatedFile, Inflector $inflector)
{
if($generatedFile->getExtension() !== 'php'){
throw new UnsupportedFileForContentModifierException(sprintf(
'This content modifier requires to be used on a PHP file, "%s" is... | [
"protected",
"function",
"retrieveBundleInfoFromGeneratedFile",
"(",
"SplFileInfo",
"$",
"generatedFile",
",",
"Inflector",
"$",
"inflector",
")",
"{",
"if",
"(",
"$",
"generatedFile",
"->",
"getExtension",
"(",
")",
"!==",
"'php'",
")",
"{",
"throw",
"new",
"Un... | Retrieve information of the Bundle which contains the given file.
@param SplFileInfo $generatedFile
@param Inflector $inflector
@return BundleInfo
@throws UnsupportedFileForContentModifierException when file is not a PHP file
@throws \UnexpectedValueException when we could not retrieve bundle info from file | [
"Retrieve",
"information",
"of",
"the",
"Bundle",
"which",
"contains",
"the",
"given",
"file",
"."
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractPhpClassContentModifier.php#L26-L81 | train |
bkstg/schedule-bundle | Timeline/EventSubscriber/EventTimelineSubscriber.php | EventTimelineSubscriber.createInvitationTimelineEntries | public function createInvitationTimelineEntries(EntityPublishedEvent $published_event): void
{
// Only act on event objects.
$event = $published_event->getObject();
if (!$event instanceof Event) {
return;
}
// Get the author for the event.
$author = $this... | php | public function createInvitationTimelineEntries(EntityPublishedEvent $published_event): void
{
// Only act on event objects.
$event = $published_event->getObject();
if (!$event instanceof Event) {
return;
}
// Get the author for the event.
$author = $this... | [
"public",
"function",
"createInvitationTimelineEntries",
"(",
"EntityPublishedEvent",
"$",
"published_event",
")",
":",
"void",
"{",
"// Only act on event objects.",
"$",
"event",
"=",
"$",
"published_event",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"!",
"$",
... | Create invited timeline events.
@param EntityPublishedEvent $published_event The published event.
@return void | [
"Create",
"invited",
"timeline",
"events",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Timeline/EventSubscriber/EventTimelineSubscriber.php#L62-L93 | train |
bkstg/schedule-bundle | Timeline/EventSubscriber/EventTimelineSubscriber.php | EventTimelineSubscriber.createScheduleTimelineEntry | public function createScheduleTimelineEntry(EntityPublishedEvent $event): void
{
// Only act on schedule objects.
$schedule = $event->getObject();
if (!$schedule instanceof Schedule) {
return;
}
// Get the author for the schedule.
$author = $this->user_pr... | php | public function createScheduleTimelineEntry(EntityPublishedEvent $event): void
{
// Only act on schedule objects.
$schedule = $event->getObject();
if (!$schedule instanceof Schedule) {
return;
}
// Get the author for the schedule.
$author = $this->user_pr... | [
"public",
"function",
"createScheduleTimelineEntry",
"(",
"EntityPublishedEvent",
"$",
"event",
")",
":",
"void",
"{",
"// Only act on schedule objects.",
"$",
"schedule",
"=",
"$",
"event",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"!",
"$",
"schedule",
"ins... | Create the schedule timeline entry.
@param EntityPublishedEvent $event The published event.
@return void | [
"Create",
"the",
"schedule",
"timeline",
"entry",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Timeline/EventSubscriber/EventTimelineSubscriber.php#L102-L131 | train |
OxfordInfoLabs/kinikit-core | src/Util/CodeUtils.php | CodeUtils.normalisePropertyName | public function normalisePropertyName($propertyName) {
if ((strlen ( $propertyName ) > 1) && ((ord ( $propertyName [1] ) >= ord ( "a" )) || is_numeric ( $propertyName [1] ))) {
$propertyName = strtolower ( $propertyName [0] ) . substr ( $propertyName, 1 );
}
return $propertyName;
} | php | public function normalisePropertyName($propertyName) {
if ((strlen ( $propertyName ) > 1) && ((ord ( $propertyName [1] ) >= ord ( "a" )) || is_numeric ( $propertyName [1] ))) {
$propertyName = strtolower ( $propertyName [0] ) . substr ( $propertyName, 1 );
}
return $propertyName;
} | [
"public",
"function",
"normalisePropertyName",
"(",
"$",
"propertyName",
")",
"{",
"if",
"(",
"(",
"strlen",
"(",
"$",
"propertyName",
")",
">",
"1",
")",
"&&",
"(",
"(",
"ord",
"(",
"$",
"propertyName",
"[",
"1",
"]",
")",
">=",
"ord",
"(",
"\"a\"",... | Normalise the property name using the standard rules we might expect.
@param string $propertyName | [
"Normalise",
"the",
"property",
"name",
"using",
"the",
"standard",
"rules",
"we",
"might",
"expect",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/CodeUtils.php#L40-L47 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.select | public function select($columns = "*") : QueryBuilder
{
$this->_query[] = "SELECT";
//Parse column(s)
if(is_array($columns)) {
$select_columns = "";
$size = sizeof($columns);
for($i = 0; $i < $size; $i++) {
if($i > 0) {
... | php | public function select($columns = "*") : QueryBuilder
{
$this->_query[] = "SELECT";
//Parse column(s)
if(is_array($columns)) {
$select_columns = "";
$size = sizeof($columns);
for($i = 0; $i < $size; $i++) {
if($i > 0) {
... | [
"public",
"function",
"select",
"(",
"$",
"columns",
"=",
"\"*\"",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"SELECT\"",
";",
"//Parse column(s)",
"if",
"(",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"selec... | Begins the select query.
@param string|array $columns Column(s) to select, if empty has same effect as "*".
@return QueryBuilder Chainability object. | [
"Begins",
"the",
"select",
"query",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L63-L96 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.insert | public function insert(string $table) : QueryBuilder
{
$this->_query[] = "INSERT INTO";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | php | public function insert(string $table) : QueryBuilder
{
$this->_query[] = "INSERT INTO";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | [
"public",
"function",
"insert",
"(",
"string",
"$",
"table",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"INSERT INTO\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"`\"",
".",
"$",
"this",
"->",
"sanitize",
"... | Begins the insert query
@param string $table Table name
@return QueryBuilder Chainability object | [
"Begins",
"the",
"insert",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L105-L111 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.update | public function update(string $table) : QueryBuilder
{
$this->_query[] = "UPDATE";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | php | public function update(string $table) : QueryBuilder
{
$this->_query[] = "UPDATE";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | [
"public",
"function",
"update",
"(",
"string",
"$",
"table",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"UPDATE\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"`\"",
".",
"$",
"this",
"->",
"sanitize",
"(",
... | Begins the update query
@param string $table Table name
@return QueryBuilder Chainability object | [
"Begins",
"the",
"update",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L120-L126 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.delete | public function delete(string $table) : QueryBuilder
{
$this->_query[] = "DELETE FROM";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | php | public function delete(string $table) : QueryBuilder
{
$this->_query[] = "DELETE FROM";
$this->_query[] = "`". $this->sanitize($table) ."`";
return $this;
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"table",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"DELETE FROM\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"`\"",
".",
"$",
"this",
"->",
"sanitize",
"... | Begins the delete query
@param string $table Table name
@return QueryBuilder Chainability object | [
"Begins",
"the",
"delete",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L135-L141 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.from | public function from(string $tables) : QueryBuilder
{
$this->_query[] = "FROM";
$this->_query[] = '`'. $this->sanitize($tables) .'`';
return $this;
} | php | public function from(string $tables) : QueryBuilder
{
$this->_query[] = "FROM";
$this->_query[] = '`'. $this->sanitize($tables) .'`';
return $this;
} | [
"public",
"function",
"from",
"(",
"string",
"$",
"tables",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"FROM\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"'`'",
".",
"$",
"this",
"->",
"sanitize",
"(",
"$",... | Begins the FORM part of the query
@param string $tables Table name
@return QueryBuilder Chainability object | [
"Begins",
"the",
"FORM",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L150-L156 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.where | public function where(array $condition) : QueryBuilder
{
$this->_query[] = "WHERE";
foreach($condition as $key => $value) {
$this->_query[] = $this->parseTags([$key, $value]);
}
return $this;
} | php | public function where(array $condition) : QueryBuilder
{
$this->_query[] = "WHERE";
foreach($condition as $key => $value) {
$this->_query[] = $this->parseTags([$key, $value]);
}
return $this;
} | [
"public",
"function",
"where",
"(",
"array",
"$",
"condition",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"WHERE\"",
";",
"foreach",
"(",
"$",
"condition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",... | Begins the WHERE statement of the query
Example:
```php
$query->where([
"username" => "test"
]);
$query->where(
"AND" => [
["username" => "test"],
["password" => "test"]
]
);
```
@param array $condition Where condition
@return QueryBuilder Chainability object | [
"Begins",
"the",
"WHERE",
"statement",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L179-L188 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.order | public function order(string $column, string $method = "DESC") : QueryBuilder
{
$this->_query[] = "ORDER BY";
$this->_query[] = "`". $this->sanitize($column) ."`";
$this->_query[] = (strtoupper($method) === "DESC") ? "DESC" : "ASC";
return $this;
} | php | public function order(string $column, string $method = "DESC") : QueryBuilder
{
$this->_query[] = "ORDER BY";
$this->_query[] = "`". $this->sanitize($column) ."`";
$this->_query[] = (strtoupper($method) === "DESC") ? "DESC" : "ASC";
return $this;
} | [
"public",
"function",
"order",
"(",
"string",
"$",
"column",
",",
"string",
"$",
"method",
"=",
"\"DESC\"",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"ORDER BY\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\... | Begins the ORDER BY part of the query
@param string $column Column name
@param string $method Order method
@return QueryBuilder Chainability object | [
"Begins",
"the",
"ORDER",
"BY",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L198-L205 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.limit | public function limit($limit) : QueryBuilder
{
$this->_query[] = "LIMIT";
if(is_array($limit)) {
$this->_query[] = $this->getQuoted($limit[0]).",";
$this->_query[] = $this->getQuoted($limit[1]);
return $this;
}
$this->_query[] = $this->getQuoted... | php | public function limit($limit) : QueryBuilder
{
$this->_query[] = "LIMIT";
if(is_array($limit)) {
$this->_query[] = $this->getQuoted($limit[0]).",";
$this->_query[] = $this->getQuoted($limit[1]);
return $this;
}
$this->_query[] = $this->getQuoted... | [
"public",
"function",
"limit",
"(",
"$",
"limit",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"LIMIT\"",
";",
"if",
"(",
"is_array",
"(",
"$",
"limit",
")",
")",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"$... | Begins the LIMIT part of the query
@param int|array $limit Limit value
@return QueryBuilder Chainability object | [
"Begins",
"the",
"LIMIT",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L214-L228 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.offset | public function offset(int $offset) : QueryBuilder
{
$this->_query[] = "OFFSET";
$this->_query[] = $offset;
return $this;
} | php | public function offset(int $offset) : QueryBuilder
{
$this->_query[] = "OFFSET";
$this->_query[] = $offset;
return $this;
} | [
"public",
"function",
"offset",
"(",
"int",
"$",
"offset",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"OFFSET\"",
";",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"$",
"offset",
";",
"return",
"$",
"this",
";",
"}"... | Begins the OFFSET part of the query
@param int $offset Offset value
@return QueryBuilder Chainability object | [
"Begins",
"the",
"OFFSET",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L237-L243 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.set | public function set(array $values) : QueryBuilder
{
$this->_query[] = "SET";
$set = [];
foreach($values as $key => $val) {
$set[] = $this->parseTags([$key, $val]);
}
$this->_query[] = implode(", ", $set);
return $this;
} | php | public function set(array $values) : QueryBuilder
{
$this->_query[] = "SET";
$set = [];
foreach($values as $key => $val) {
$set[] = $this->parseTags([$key, $val]);
}
$this->_query[] = implode(", ", $set);
return $this;
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"values",
")",
":",
"QueryBuilder",
"{",
"$",
"this",
"->",
"_query",
"[",
"]",
"=",
"\"SET\"",
";",
"$",
"set",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"val"... | Begins the SET part of the query
@param array $values Values to set
@return QueryBuilder Chainability object | [
"Begins",
"the",
"SET",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L252-L264 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.values | public function values(array $values) : QueryBuilder
{
$args = func_get_args();
$columns = [];
$_values = [];
foreach($values as $key => $value) {
preg_match("/\(JSON\)\s*([\w]+)/i", $key, $jsonTag);
if(
is_array($value) ||
... | php | public function values(array $values) : QueryBuilder
{
$args = func_get_args();
$columns = [];
$_values = [];
foreach($values as $key => $value) {
preg_match("/\(JSON\)\s*([\w]+)/i", $key, $jsonTag);
if(
is_array($value) ||
... | [
"public",
"function",
"values",
"(",
"array",
"$",
"values",
")",
":",
"QueryBuilder",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"columns",
"=",
"[",
"]",
";",
"$",
"_values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"values",
"as... | Begins the VALUES part of the query
@param array $values Values to insert
@return QueryBuilder Chainability object | [
"Begins",
"the",
"VALUES",
"part",
"of",
"the",
"query"
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L273-L308 | train |
AlexyaFramework/Database | Alexya/Database/QueryBuilder.php | QueryBuilder.sanitize | public function sanitize(string $input) : string
{
$input = $this->_connection->getConnection()->quote($input);
return substr($input, 1, -1);
} | php | public function sanitize(string $input) : string
{
$input = $this->_connection->getConnection()->quote($input);
return substr($input, 1, -1);
} | [
"public",
"function",
"sanitize",
"(",
"string",
"$",
"input",
")",
":",
"string",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"_connection",
"->",
"getConnection",
"(",
")",
"->",
"quote",
"(",
"$",
"input",
")",
";",
"return",
"substr",
"(",
"$",
"i... | Sanitizes the input.
@param string $input Input to sanitize.
@return string SQL injection free `$input`. | [
"Sanitizes",
"the",
"input",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/QueryBuilder.php#L511-L516 | train |
rawphp/RawConsole | src/RawPHP/RawConsole/Writer/StandardHelpWriter.php | StandardHelpWriter.write | public function write( Command $command, Option $option = NULL )
{
$output = PHP_EOL;
$output .= '-----------------------------------------------------' . PHP_EOL;
$output .= $command->name . ' ' . $command->version . PHP_EOL;
$output .= '---------------------------------------------... | php | public function write( Command $command, Option $option = NULL )
{
$output = PHP_EOL;
$output .= '-----------------------------------------------------' . PHP_EOL;
$output .= $command->name . ' ' . $command->version . PHP_EOL;
$output .= '---------------------------------------------... | [
"public",
"function",
"write",
"(",
"Command",
"$",
"command",
",",
"Option",
"$",
"option",
"=",
"NULL",
")",
"{",
"$",
"output",
"=",
"PHP_EOL",
";",
"$",
"output",
".=",
"'-----------------------------------------------------'",
".",
"PHP_EOL",
";",
"$",
"o... | This method writes the help to the console.
@param Command $command the command instance
@param Option $option optional option | [
"This",
"method",
"writes",
"the",
"help",
"to",
"the",
"console",
"."
] | 602bedd10f24962305a7ac1979ed326852f4224a | https://github.com/rawphp/RawConsole/blob/602bedd10f24962305a7ac1979ed326852f4224a/src/RawPHP/RawConsole/Writer/StandardHelpWriter.php#L60-L93 | train |
rawphp/RawConsole | src/RawPHP/RawConsole/Writer/StandardHelpWriter.php | StandardHelpWriter._getUsageExample | private function _getUsageExample( Command $command )
{
$name = strtolower( str_replace( 'Command', '', get_class( $command ) ) );
if ( FALSE !== strstr( $name, "\\" ) )
{
$pts = explode( "\\", $name );
$name = $pts[ count( $pts ) - 1 ];
}
$usage = ... | php | private function _getUsageExample( Command $command )
{
$name = strtolower( str_replace( 'Command', '', get_class( $command ) ) );
if ( FALSE !== strstr( $name, "\\" ) )
{
$pts = explode( "\\", $name );
$name = $pts[ count( $pts ) - 1 ];
}
$usage = ... | [
"private",
"function",
"_getUsageExample",
"(",
"Command",
"$",
"command",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"str_replace",
"(",
"'Command'",
",",
"''",
",",
"get_class",
"(",
"$",
"command",
")",
")",
")",
";",
"if",
"(",
"FALSE",
"!==",
... | Prepares the command usage example.
@param Command $command the command
@return string the command usage example string | [
"Prepares",
"the",
"command",
"usage",
"example",
"."
] | 602bedd10f24962305a7ac1979ed326852f4224a | https://github.com/rawphp/RawConsole/blob/602bedd10f24962305a7ac1979ed326852f4224a/src/RawPHP/RawConsole/Writer/StandardHelpWriter.php#L102-L116 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.