id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
229,300 | slickframework/slick | src/Slick/Di/Resolver/ObjectResolver.php | ObjectResolver._getMethodParameters | protected function _getMethodParameters(
MethodInjection $method = null,
ReflectionMethod $methodReflection = null,
array $parameters = []
) {
$args = [];
if ($methodReflection) {
foreach ($methodReflection->getParameters() as $index => $parameter) {
... | php | protected function _getMethodParameters(
MethodInjection $method = null,
ReflectionMethod $methodReflection = null,
array $parameters = []
) {
$args = [];
if ($methodReflection) {
foreach ($methodReflection->getParameters() as $index => $parameter) {
... | [
"protected",
"function",
"_getMethodParameters",
"(",
"MethodInjection",
"$",
"method",
"=",
"null",
",",
"ReflectionMethod",
"$",
"methodReflection",
"=",
"null",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"... | Returns the parameters for the provided method
@param MethodInjection $method
@param ReflectionMethod $methodReflection
@param array $parameters
@throws DefinitionException Parameter has no value and cannot be guessed
@return array | [
"Returns",
"the",
"parameters",
"for",
"the",
"provided",
"method"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Resolver/ObjectResolver.php#L121-L161 |
229,301 | slickframework/slick | src/Slick/Di/Resolver/ObjectResolver.php | ObjectResolver._getParameterDefaultValue | protected function _getParameterDefaultValue(
ReflectionParameter $reflectionParameter,
ReflectionMethod $reflectionMethod
) {
try {
return $reflectionParameter->getDefaultValue();
} catch (ReflectionException $e) {
throw new DefinitionException(sprintf(
... | php | protected function _getParameterDefaultValue(
ReflectionParameter $reflectionParameter,
ReflectionMethod $reflectionMethod
) {
try {
return $reflectionParameter->getDefaultValue();
} catch (ReflectionException $e) {
throw new DefinitionException(sprintf(
... | [
"protected",
"function",
"_getParameterDefaultValue",
"(",
"ReflectionParameter",
"$",
"reflectionParameter",
",",
"ReflectionMethod",
"$",
"reflectionMethod",
")",
"{",
"try",
"{",
"return",
"$",
"reflectionParameter",
"->",
"getDefaultValue",
"(",
")",
";",
"}",
"ca... | Returns the default value of a function parameter.
@param ReflectionParameter $reflectionParameter
@param ReflectionMethod $reflectionMethod
@throws DefinitionException Can't get default values from PHP internal
classes and methods.
@return mixed
@codeCoverageIgnore | [
"Returns",
"the",
"default",
"value",
"of",
"a",
"function",
"parameter",
"."
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Resolver/ObjectResolver.php#L174-L191 |
229,302 | slickframework/slick | src/Slick/Di/Resolver/ObjectResolver.php | ObjectResolver._injectMethodsAndProperties | protected function _injectMethodsAndProperties(
DefinitionInterface $definition, $instance)
{
$classReflection = new ReflectionClass($instance);
/** @var ObjectDefinition $definition */
// Property injections
foreach ($definition->getProperties() as $property)
{
... | php | protected function _injectMethodsAndProperties(
DefinitionInterface $definition, $instance)
{
$classReflection = new ReflectionClass($instance);
/** @var ObjectDefinition $definition */
// Property injections
foreach ($definition->getProperties() as $property)
{
... | [
"protected",
"function",
"_injectMethodsAndProperties",
"(",
"DefinitionInterface",
"$",
"definition",
",",
"$",
"instance",
")",
"{",
"$",
"classReflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"instance",
")",
";",
"/** @var ObjectDefinition $definition */",
"// ... | Inject properties and methods on the provided instance
@param DefinitionInterface $definition
@param object $instance | [
"Inject",
"properties",
"and",
"methods",
"on",
"the",
"provided",
"instance"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Resolver/ObjectResolver.php#L199-L216 |
229,303 | slickframework/slick | src/Slick/Di/Resolver/ObjectResolver.php | ObjectResolver._propertyInjection | protected function _propertyInjection(
$instance, PropertyInjection $property, ReflectionClass $classReflection)
{
// lets try to confirm it not prefixed by convention
$public = trim($property->getPropertyName(), '_');
$notPublic = "_{$public}";
$propertyName = $classReflecti... | php | protected function _propertyInjection(
$instance, PropertyInjection $property, ReflectionClass $classReflection)
{
// lets try to confirm it not prefixed by convention
$public = trim($property->getPropertyName(), '_');
$notPublic = "_{$public}";
$propertyName = $classReflecti... | [
"protected",
"function",
"_propertyInjection",
"(",
"$",
"instance",
",",
"PropertyInjection",
"$",
"property",
",",
"ReflectionClass",
"$",
"classReflection",
")",
"{",
"// lets try to confirm it not prefixed by convention",
"$",
"public",
"=",
"trim",
"(",
"$",
"prope... | Injects property value
@param Object $instance
@param PropertyInjection $property
@param ReflectionClass $classReflection
@throws DependencyException When an error occurs retrieving the value
from dependency container | [
"Injects",
"property",
"value"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Resolver/ObjectResolver.php#L244-L265 |
229,304 | lekoala/silverstripe-form-extras | code/fields/AccountingField.php | AccountingField.format | public static function format($value, $precision = null, $locale = null)
{
if ($precision === null) {
$precision = self::$default_precision;
}
if ($locale) {
$currentLocale = self::$_locale;
self::$_locale = $locale;
}
if (is_array($value))... | php | public static function format($value, $precision = null, $locale = null)
{
if ($precision === null) {
$precision = self::$default_precision;
}
if ($locale) {
$currentLocale = self::$_locale;
self::$_locale = $locale;
}
if (is_array($value))... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
",",
"$",
"precision",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"precision",
"===",
"null",
")",
"{",
"$",
"precision",
"=",
"self",
"::",
"$",
"default_preci... | Format a value as a number
@param string $value
@param int $precision
@return string | [
"Format",
"a",
"value",
"as",
"a",
"number"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/fields/AccountingField.php#L78-L115 |
229,305 | lekoala/silverstripe-form-extras | code/fields/AccountingField.php | AccountingField.unformat | public static function unformat($value)
{
if (is_array($value)) {
foreach ($value as &$val) {
$val = self::unformat($val);
}
return $value;
}
if (!$value) {
$value = 0;
}
$neg = false;
if (strpos($value... | php | public static function unformat($value)
{
if (is_array($value)) {
foreach ($value as &$val) {
$val = self::unformat($val);
}
return $value;
}
if (!$value) {
$value = 0;
}
$neg = false;
if (strpos($value... | [
"public",
"static",
"function",
"unformat",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"&",
"$",
"val",
")",
"{",
"$",
"val",
"=",
"self",
"::",
"unformat",
"(",
"$",
... | Similar implementation than accounting.js unformat method
@param string $value | [
"Similar",
"implementation",
"than",
"accounting",
".",
"js",
"unformat",
"method"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/fields/AccountingField.php#L121-L162 |
229,306 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.getDbAttribute | public function getDbAttribute($attribute, $default = null)
{
return isset($this->_dbAttributes[$attribute]) ? $this->_dbAttributes[$attribute] : $default;
} | php | public function getDbAttribute($attribute, $default = null)
{
return isset($this->_dbAttributes[$attribute]) ? $this->_dbAttributes[$attribute] : $default;
} | [
"public",
"function",
"getDbAttribute",
"(",
"$",
"attribute",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_dbAttributes",
"[",
"$",
"attribute",
"]",
")",
"?",
"$",
"this",
"->",
"_dbAttributes",
"[",
"$",
"... | Gets an attribute, as it is in the database
@param $attribute
@param $default
@return mixed | [
"Gets",
"an",
"attribute",
"as",
"it",
"is",
"in",
"the",
"database"
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L83-L86 |
229,307 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.changed | public function changed($field = null)
{
if ($this->owner->isNewRecord)
return false;
if ($field)
return $this->getDbAttribute($field) != $this->owner->getAttribute($field);
foreach ($this->owner->getAttributes() as $k => $v)
if ($this->getDbAttribute($k) ... | php | public function changed($field = null)
{
if ($this->owner->isNewRecord)
return false;
if ($field)
return $this->getDbAttribute($field) != $this->owner->getAttribute($field);
foreach ($this->owner->getAttributes() as $k => $v)
if ($this->getDbAttribute($k) ... | [
"public",
"function",
"changed",
"(",
"$",
"field",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"isNewRecord",
")",
"return",
"false",
";",
"if",
"(",
"$",
"field",
")",
"return",
"$",
"this",
"->",
"getDbAttribute",
"(",
"$",... | Check if any fields have changed
@param string $field
@return bool|string|array | [
"Check",
"if",
"any",
"fields",
"have",
"changed"
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L94-L104 |
229,308 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.afterFind | public function afterFind($event)
{
$this->_dbAttributes = $this->owner->getAttributes();
parent::afterFind($event);
} | php | public function afterFind($event)
{
$this->_dbAttributes = $this->owner->getAttributes();
parent::afterFind($event);
} | [
"public",
"function",
"afterFind",
"(",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"_dbAttributes",
"=",
"$",
"this",
"->",
"owner",
"->",
"getAttributes",
"(",
")",
";",
"parent",
"::",
"afterFind",
"(",
"$",
"event",
")",
";",
"}"
] | Actions to be performed after the model is loaded | [
"Actions",
"to",
"be",
"performed",
"after",
"the",
"model",
"is",
"loaded"
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L109-L113 |
229,309 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.afterSave | public function afterSave($event)
{
if (!$this->enableAuditField) {
parent::afterSave($event);
return;
}
$date = time();
$newAttributes = $this->owner->attributes;
$oldAttributes = $this->_dbAttributes;
$auditModels = $this->getAuditModels();
... | php | public function afterSave($event)
{
if (!$this->enableAuditField) {
parent::afterSave($event);
return;
}
$date = time();
$newAttributes = $this->owner->attributes;
$oldAttributes = $this->_dbAttributes;
$auditModels = $this->getAuditModels();
... | [
"public",
"function",
"afterSave",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enableAuditField",
")",
"{",
"parent",
"::",
"afterSave",
"(",
"$",
"event",
")",
";",
"return",
";",
"}",
"$",
"date",
"=",
"time",
"(",
")",
";",
... | Find changes to the model and save them as AuditField records
Do not call this method directly, it will be called after the model is saved.
@param CModelEvent $event | [
"Find",
"changes",
"to",
"the",
"model",
"and",
"save",
"them",
"as",
"AuditField",
"records",
"Do",
"not",
"call",
"this",
"method",
"directly",
"it",
"will",
"be",
"called",
"after",
"the",
"model",
"is",
"saved",
"."
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L120-L200 |
229,310 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.afterDelete | public function afterDelete($event)
{
if (!$this->enableAuditField) {
parent::afterDelete($event);
return;
}
$date = time();
$auditModels = $this->getAuditModels();
$auditRequestId = $this->getAuditRequestId();
$userId = Yii::app()->user && Yi... | php | public function afterDelete($event)
{
if (!$this->enableAuditField) {
parent::afterDelete($event);
return;
}
$date = time();
$auditModels = $this->getAuditModels();
$auditRequestId = $this->getAuditRequestId();
$userId = Yii::app()->user && Yi... | [
"public",
"function",
"afterDelete",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enableAuditField",
")",
"{",
"parent",
"::",
"afterDelete",
"(",
"$",
"event",
")",
";",
"return",
";",
"}",
"$",
"date",
"=",
"time",
"(",
")",
"... | Find changes to the model and save them as AuditField records.
Do not call this method directly, it will be called after the model is deleted.
@param CModelEvent $event | [
"Find",
"changes",
"to",
"the",
"model",
"and",
"save",
"them",
"as",
"AuditField",
"records",
".",
"Do",
"not",
"call",
"this",
"method",
"directly",
"it",
"will",
"be",
"called",
"after",
"the",
"model",
"is",
"deleted",
"."
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L207-L241 |
229,311 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.getAuditModels | protected function getAuditModels()
{
$auditModels = array();
// get log models
if ($this->auditModel) {
$auditModels[] = array(
'model_name' => $this->auditModelName ? $this->auditModelName : get_class($this->auditModel),
'model_id' => $this->get... | php | protected function getAuditModels()
{
$auditModels = array();
// get log models
if ($this->auditModel) {
$auditModels[] = array(
'model_name' => $this->auditModelName ? $this->auditModelName : get_class($this->auditModel),
'model_id' => $this->get... | [
"protected",
"function",
"getAuditModels",
"(",
")",
"{",
"$",
"auditModels",
"=",
"array",
"(",
")",
";",
"// get log models",
"if",
"(",
"$",
"this",
"->",
"auditModel",
")",
"{",
"$",
"auditModels",
"[",
"]",
"=",
"array",
"(",
"'model_name'",
"=>",
"... | Gets additional models to be used in the model and model_id fields.
@return array
@see additionalAuditModels | [
"Gets",
"additional",
"models",
"to",
"be",
"used",
"in",
"the",
"model",
"and",
"model_id",
"fields",
"."
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L288-L312 |
229,312 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.getModelFieldPrefix | protected function getModelFieldPrefix($model)
{
return (get_class($this->owner) != get_class($model)) ? get_class($this->owner) . '.' : '';
} | php | protected function getModelFieldPrefix($model)
{
return (get_class($this->owner) != get_class($model)) ? get_class($this->owner) . '.' : '';
} | [
"protected",
"function",
"getModelFieldPrefix",
"(",
"$",
"model",
")",
"{",
"return",
"(",
"get_class",
"(",
"$",
"this",
"->",
"owner",
")",
"!=",
"get_class",
"(",
"$",
"model",
")",
")",
"?",
"get_class",
"(",
"$",
"this",
"->",
"owner",
")",
".",
... | If the model is not the same as the owner then prefix the field so we know the model.
@param $model CActiveRecord
@return string | [
"If",
"the",
"model",
"is",
"not",
"the",
"same",
"as",
"the",
"owner",
"then",
"prefix",
"the",
"field",
"so",
"we",
"know",
"the",
"model",
"."
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L319-L322 |
229,313 | cornernote/yii-audit-module | audit/components/AuditFieldBehavior.php | AuditFieldBehavior.getModelPrimaryKeyString | protected function getModelPrimaryKeyString($model)
{
return is_array($model->getPrimaryKey()) ? implode('-', $model->getPrimaryKey()) : $model->getPrimaryKey();
} | php | protected function getModelPrimaryKeyString($model)
{
return is_array($model->getPrimaryKey()) ? implode('-', $model->getPrimaryKey()) : $model->getPrimaryKey();
} | [
"protected",
"function",
"getModelPrimaryKeyString",
"(",
"$",
"model",
")",
"{",
"return",
"is_array",
"(",
"$",
"model",
"->",
"getPrimaryKey",
"(",
")",
")",
"?",
"implode",
"(",
"'-'",
",",
"$",
"model",
"->",
"getPrimaryKey",
"(",
")",
")",
":",
"$"... | Returns Primary Key as a string
@param $model CActiveRecord
@return string | [
"Returns",
"Primary",
"Key",
"as",
"a",
"string"
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/components/AuditFieldBehavior.php#L329-L332 |
229,314 | mbilbille/jpnforphp | src/JpnForPhp/Converter/Converter.php | Converter.toWesternYear | public static function toWesternYear($year)
{
if (Analyzer::hasKanji($year)) {
$key = 'kanji';
$eraName = Helper::extractKanji($year);
$eraName = $eraName[0];
$eraValue = (int)Helper::subString($year, Analyzer::length($eraName), Analyzer::length($year));
... | php | public static function toWesternYear($year)
{
if (Analyzer::hasKanji($year)) {
$key = 'kanji';
$eraName = Helper::extractKanji($year);
$eraName = $eraName[0];
$eraValue = (int)Helper::subString($year, Analyzer::length($eraName), Analyzer::length($year));
... | [
"public",
"static",
"function",
"toWesternYear",
"(",
"$",
"year",
")",
"{",
"if",
"(",
"Analyzer",
"::",
"hasKanji",
"(",
"$",
"year",
")",
")",
"{",
"$",
"key",
"=",
"'kanji'",
";",
"$",
"eraName",
"=",
"Helper",
"::",
"extractKanji",
"(",
"$",
"ye... | Converts a year in Japanese format into Western format.
@param $year : kanji or hiragana era name followed by digits, or era name in romaji, space and digit. I.e. : 明治33, めいじ33, Meiji 33
@return string|array : The year(s) in Western format.
@throws Exception | [
"Converts",
"a",
"year",
"in",
"Japanese",
"format",
"into",
"Western",
"format",
"."
] | 5623468503cc2941f4656b0ee1a58b939d263453 | https://github.com/mbilbille/jpnforphp/blob/5623468503cc2941f4656b0ee1a58b939d263453/src/JpnForPhp/Converter/Converter.php#L497-L551 |
229,315 | slickframework/slick | src/Slick/Configuration/Driver/Ini.php | Ini._load | protected function _load()
{
$file = new File($this->_file, "r");
$data = @parse_ini_string($file->read(), true);
if ($data === false) {
throw new Exception\ParserErrorException(
"Error parsing configuration file {$this->_file}"
);
}
$... | php | protected function _load()
{
$file = new File($this->_file, "r");
$data = @parse_ini_string($file->read(), true);
if ($data === false) {
throw new Exception\ParserErrorException(
"Error parsing configuration file {$this->_file}"
);
}
$... | [
"protected",
"function",
"_load",
"(",
")",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"this",
"->",
"_file",
",",
"\"r\"",
")",
";",
"$",
"data",
"=",
"@",
"parse_ini_string",
"(",
"$",
"file",
"->",
"read",
"(",
")",
",",
"true",
")",
";",... | Loads the data into this configuration driver | [
"Loads",
"the",
"data",
"into",
"this",
"configuration",
"driver"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Configuration/Driver/Ini.php#L29-L40 |
229,316 | tooleks/php-avg-color-picker | src/Gd/Image.php | Image.assertResource | protected function assertResource($resource)
{
if (!is_resource($resource) || get_resource_type($resource) !== 'gd') {
throw new InvalidArgumentException('Invalid resource type.');
}
$width = imagesx($resource);
$height = imagesy($resource);
if ($width < 1 || $he... | php | protected function assertResource($resource)
{
if (!is_resource($resource) || get_resource_type($resource) !== 'gd') {
throw new InvalidArgumentException('Invalid resource type.');
}
$width = imagesx($resource);
$height = imagesy($resource);
if ($width < 1 || $he... | [
"protected",
"function",
"assertResource",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"resource",
")",
"||",
"get_resource_type",
"(",
"$",
"resource",
")",
"!==",
"'gd'",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(... | Assert an image resource.
@param $resource | [
"Assert",
"an",
"image",
"resource",
"."
] | 64e2042def3f0450e04a812dd3dcd8e7236a7fd8 | https://github.com/tooleks/php-avg-color-picker/blob/64e2042def3f0450e04a812dd3dcd8e7236a7fd8/src/Gd/Image.php#L59-L72 |
229,317 | tooleks/php-avg-color-picker | src/Gd/Image.php | Image.createFromPath | public static function createFromPath(string $path)
{
$createFunctions = [
'image/png' => 'imagecreatefrompng',
'image/jpeg' => 'imagecreatefromjpeg',
'image/gif' => 'imagecreatefromgif',
];
$mimeType = mime_content_type($path);
if (!array_key_ex... | php | public static function createFromPath(string $path)
{
$createFunctions = [
'image/png' => 'imagecreatefrompng',
'image/jpeg' => 'imagecreatefromjpeg',
'image/gif' => 'imagecreatefromgif',
];
$mimeType = mime_content_type($path);
if (!array_key_ex... | [
"public",
"static",
"function",
"createFromPath",
"(",
"string",
"$",
"path",
")",
"{",
"$",
"createFunctions",
"=",
"[",
"'image/png'",
"=>",
"'imagecreatefrompng'",
",",
"'image/jpeg'",
"=>",
"'imagecreatefromjpeg'",
",",
"'image/gif'",
"=>",
"'imagecreatefromgif'",... | Create an image from the path.
@param string $path
@return $this | [
"Create",
"an",
"image",
"from",
"the",
"path",
"."
] | 64e2042def3f0450e04a812dd3dcd8e7236a7fd8 | https://github.com/tooleks/php-avg-color-picker/blob/64e2042def3f0450e04a812dd3dcd8e7236a7fd8/src/Gd/Image.php#L91-L108 |
229,318 | gbv/jskos-php | src/Resource.php | Resource.guessClassFromTypes | public static function guessClassFromTypes(array $types)
{
if (count($types)) {
foreach (Resource::CLASSES as $class) {
$class = "JSKOS\\$class";
foreach ($class::TYPES as $uri) {
if (in_array($uri, $types)) {
return $cl... | php | public static function guessClassFromTypes(array $types)
{
if (count($types)) {
foreach (Resource::CLASSES as $class) {
$class = "JSKOS\\$class";
foreach ($class::TYPES as $uri) {
if (in_array($uri, $types)) {
return $cl... | [
"public",
"static",
"function",
"guessClassFromTypes",
"(",
"array",
"$",
"types",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"types",
")",
")",
"{",
"foreach",
"(",
"Resource",
"::",
"CLASSES",
"as",
"$",
"class",
")",
"{",
"$",
"class",
"=",
"\"JSKOS\\\... | Guess subclass from list of type URIs. | [
"Guess",
"subclass",
"from",
"list",
"of",
"type",
"URIs",
"."
] | b558b3bdbced9c6c0671dbeeebcdfcee2c72e405 | https://github.com/gbv/jskos-php/blob/b558b3bdbced9c6c0671dbeeebcdfcee2c72e405/src/Resource.php#L85-L97 |
229,319 | slickframework/slick | src/Slick/Database/Sql/Dialect/Sqlite/CreateTableSqlTemplate.php | CreateTableSqlTemplate._getUniqueConstraint | protected function _getUniqueConstraint(Constraint\Unique $constraint)
{
$this->_afterCreate[] = sprintf(
'CREATE UNIQUE INDEX %s ON %s(%s)',
$constraint->getName(),
$this->_sql->getTable(),
$constraint->getColumn()
);
return null;
} | php | protected function _getUniqueConstraint(Constraint\Unique $constraint)
{
$this->_afterCreate[] = sprintf(
'CREATE UNIQUE INDEX %s ON %s(%s)',
$constraint->getName(),
$this->_sql->getTable(),
$constraint->getColumn()
);
return null;
} | [
"protected",
"function",
"_getUniqueConstraint",
"(",
"Constraint",
"\\",
"Unique",
"$",
"constraint",
")",
"{",
"$",
"this",
"->",
"_afterCreate",
"[",
"]",
"=",
"sprintf",
"(",
"'CREATE UNIQUE INDEX %s ON %s(%s)'",
",",
"$",
"constraint",
"->",
"getName",
"(",
... | Parse a Unique constraint to its SQL representation
@param Constraint\Unique $constraint
@return null|string | [
"Parse",
"a",
"Unique",
"constraint",
"to",
"its",
"SQL",
"representation"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Sql/Dialect/Sqlite/CreateTableSqlTemplate.php#L210-L219 |
229,320 | lekoala/silverstripe-form-extras | code/FormExtra.php | FormExtra.err | protected function err($msg, $url = null)
{
$this->saveDataInSession();
return $this->msg($msg, self::MSG_BAD, $url);
} | php | protected function err($msg, $url = null)
{
$this->saveDataInSession();
return $this->msg($msg, self::MSG_BAD, $url);
} | [
"protected",
"function",
"err",
"(",
"$",
"msg",
",",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"saveDataInSession",
"(",
")",
";",
"return",
"$",
"this",
"->",
"msg",
"(",
"$",
"msg",
",",
"self",
"::",
"MSG_BAD",
",",
"$",
"url",
")... | Shortcut for an error
@param string $msg
@param string $url
@return SS_HTTPResponse | [
"Shortcut",
"for",
"an",
"error"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/FormExtra.php#L153-L157 |
229,321 | lekoala/silverstripe-form-extras | code/FormExtra.php | FormExtra.success | protected function success($msg, $url = null)
{
return $this->msg($msg, self::MSG_GOOD, $url);
} | php | protected function success($msg, $url = null)
{
return $this->msg($msg, self::MSG_GOOD, $url);
} | [
"protected",
"function",
"success",
"(",
"$",
"msg",
",",
"$",
"url",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"msg",
"(",
"$",
"msg",
",",
"self",
"::",
"MSG_GOOD",
",",
"$",
"url",
")",
";",
"}"
] | Shortcut for a success
@param string $msg
@param string $url
@return SS_HTTPResponse | [
"Shortcut",
"for",
"a",
"success"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/FormExtra.php#L166-L169 |
229,322 | lekoala/silverstripe-form-extras | code/FormExtra.php | FormExtra.msg | protected function msg($msg, $type, $url = null)
{
$this->sessionMessage($msg, $type);
if ($url) {
return $this->Controller()->redirect($url);
}
return $this->Controller()->redirectBack();
} | php | protected function msg($msg, $type, $url = null)
{
$this->sessionMessage($msg, $type);
if ($url) {
return $this->Controller()->redirect($url);
}
return $this->Controller()->redirectBack();
} | [
"protected",
"function",
"msg",
"(",
"$",
"msg",
",",
"$",
"type",
",",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"sessionMessage",
"(",
"$",
"msg",
",",
"$",
"type",
")",
";",
"if",
"(",
"$",
"url",
")",
"{",
"return",
"$",
"this",... | Return a response with a message for your form
@param string $msg
@param string $type good,bad,notice,warning
@param string $url
@return SS_HTTPResponse | [
"Return",
"a",
"response",
"with",
"a",
"message",
"for",
"your",
"form"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/FormExtra.php#L179-L186 |
229,323 | inc2734/wp-breadcrumbs | src/Contract/Controller/Controller.php | Controller.set_ancestors | protected function set_ancestors( $object_id, $object_type ) {
$ancestors = get_ancestors( $object_id, $object_type );
krsort( $ancestors );
if ( 'page' === $object_type ) {
foreach ( $ancestors as $ancestor_id ) {
$this->set( get_the_title( $ancestor_id ), get_permalink( $ancestor_id ) );
}
} else {
... | php | protected function set_ancestors( $object_id, $object_type ) {
$ancestors = get_ancestors( $object_id, $object_type );
krsort( $ancestors );
if ( 'page' === $object_type ) {
foreach ( $ancestors as $ancestor_id ) {
$this->set( get_the_title( $ancestor_id ), get_permalink( $ancestor_id ) );
}
} else {
... | [
"protected",
"function",
"set_ancestors",
"(",
"$",
"object_id",
",",
"$",
"object_type",
")",
"{",
"$",
"ancestors",
"=",
"get_ancestors",
"(",
"$",
"object_id",
",",
"$",
"object_type",
")",
";",
"krsort",
"(",
"$",
"ancestors",
")",
";",
"if",
"(",
"'... | Set the ancestors of the specified page or taxonomy
@param int $object_id Post ID or Term ID
@param string $object_type | [
"Set",
"the",
"ancestors",
"of",
"the",
"specified",
"page",
"or",
"taxonomy"
] | fb904467f5ab3ec18c17c7420d1cbd98248367d8 | https://github.com/inc2734/wp-breadcrumbs/blob/fb904467f5ab3ec18c17c7420d1cbd98248367d8/src/Contract/Controller/Controller.php#L54-L67 |
229,324 | inc2734/wp-breadcrumbs | src/Contract/Controller/Controller.php | Controller.get_post_type | protected function get_post_type() {
global $wp_query;
$post_type = get_post_type();
if ( $post_type ) {
return $post_type;
}
if ( isset( $wp_query->query['post_type'] ) ) {
return $wp_query->query['post_type'];
}
return $post_type;
} | php | protected function get_post_type() {
global $wp_query;
$post_type = get_post_type();
if ( $post_type ) {
return $post_type;
}
if ( isset( $wp_query->query['post_type'] ) ) {
return $wp_query->query['post_type'];
}
return $post_type;
} | [
"protected",
"function",
"get_post_type",
"(",
")",
"{",
"global",
"$",
"wp_query",
";",
"$",
"post_type",
"=",
"get_post_type",
"(",
")",
";",
"if",
"(",
"$",
"post_type",
")",
"{",
"return",
"$",
"post_type",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
... | Return the current post type
@return string | [
"Return",
"the",
"current",
"post",
"type"
] | fb904467f5ab3ec18c17c7420d1cbd98248367d8 | https://github.com/inc2734/wp-breadcrumbs/blob/fb904467f5ab3ec18c17c7420d1cbd98248367d8/src/Contract/Controller/Controller.php#L96-L110 |
229,325 | slickframework/slick | src/Slick/Mvc/Router/RouteInfo.php | RouteInfo.setConfiguration | public function setConfiguration(DriverInterface $driver)
{
$this->_configuration = $driver;
$this->_namespace = null;
$this->_action = null;
$this->_controller = null;
return $this;
} | php | public function setConfiguration(DriverInterface $driver)
{
$this->_configuration = $driver;
$this->_namespace = null;
$this->_action = null;
$this->_controller = null;
return $this;
} | [
"public",
"function",
"setConfiguration",
"(",
"DriverInterface",
"$",
"driver",
")",
"{",
"$",
"this",
"->",
"_configuration",
"=",
"$",
"driver",
";",
"$",
"this",
"->",
"_namespace",
"=",
"null",
";",
"$",
"this",
"->",
"_action",
"=",
"null",
";",
"$... | Sets configuration driver
@param DriverInterface $driver
@return self | [
"Sets",
"configuration",
"driver"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Router/RouteInfo.php#L109-L116 |
229,326 | slickframework/slick | src/Slick/Mvc/Router/RouteInfo.php | RouteInfo.getController | public function getController()
{
if (is_null($this->_controller)) {
$controller = $this->getConfiguration()
->get('router.controller', 'pages');
if (isset($this->_params['controller'])) {
$controller = $this->_params['controller'];
}
... | php | public function getController()
{
if (is_null($this->_controller)) {
$controller = $this->getConfiguration()
->get('router.controller', 'pages');
if (isset($this->_params['controller'])) {
$controller = $this->_params['controller'];
}
... | [
"public",
"function",
"getController",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_controller",
")",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getConfiguration",
"(",
")",
"->",
"get",
"(",
"'router.controller'",
",",
"'pag... | Returns controller class name
@return string | [
"Returns",
"controller",
"class",
"name"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Router/RouteInfo.php#L123-L138 |
229,327 | slickframework/slick | src/Slick/Mvc/Router/RouteInfo.php | RouteInfo.getNamespace | public function getNamespace()
{
if (is_null($this->_namespace)) {
$namespace = $this->getConfiguration()
->get('router.namespace', 'Controllers');
if (isset($this->_params['namespace'])) {
$namespace = $this->_params['namespace'];
}
... | php | public function getNamespace()
{
if (is_null($this->_namespace)) {
$namespace = $this->getConfiguration()
->get('router.namespace', 'Controllers');
if (isset($this->_params['namespace'])) {
$namespace = $this->_params['namespace'];
}
... | [
"public",
"function",
"getNamespace",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_namespace",
")",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getConfiguration",
"(",
")",
"->",
"get",
"(",
"'router.namespace'",
",",
"'Control... | Returns the namespace for controller class
@return string | [
"Returns",
"the",
"namespace",
"for",
"controller",
"class"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Router/RouteInfo.php#L145-L156 |
229,328 | slickframework/slick | src/Slick/Mvc/Router/RouteInfo.php | RouteInfo.getArguments | public function getArguments()
{
if (empty($this->_arguments)) {
$base = [];
if (isset($this->_params['trailing'])) {
$base = explode('/', $this->_params['trailing']);
}
$names = ['controller', 'action', 'namespace', 'trailing'];
fo... | php | public function getArguments()
{
if (empty($this->_arguments)) {
$base = [];
if (isset($this->_params['trailing'])) {
$base = explode('/', $this->_params['trailing']);
}
$names = ['controller', 'action', 'namespace', 'trailing'];
fo... | [
"public",
"function",
"getArguments",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_arguments",
")",
")",
"{",
"$",
"base",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_params",
"[",
"'trailing'",
"]",
")",
")"... | Returns the list of arguments passed in the URL
@return array | [
"Returns",
"the",
"list",
"of",
"arguments",
"passed",
"in",
"the",
"URL"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Router/RouteInfo.php#L181-L199 |
229,329 | slickframework/slick | src/Slick/Mvc/Router/RouteInfo.php | RouteInfo.setTarget | public function setTarget($target)
{
if (is_array($target)) {
$this->_params = array_merge($this->_params, $target);
}
$this->_target = $target;
} | php | public function setTarget($target)
{
if (is_array($target)) {
$this->_params = array_merge($this->_params, $target);
}
$this->_target = $target;
} | [
"public",
"function",
"setTarget",
"(",
"$",
"target",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"target",
")",
")",
"{",
"$",
"this",
"->",
"_params",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"_params",
",",
"$",
"target",
")",
";",
"}",
"$",
... | Sets target data
@param $target | [
"Sets",
"target",
"data"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Router/RouteInfo.php#L221-L227 |
229,330 | cornernote/yii-audit-module | audit/models/AuditLog.php | AuditLog.formatProfileMessage | public function formatProfileMessage($message)
{
$sqlStart = strpos($message, '(') + 1;
$sqlEnd = strrpos($message, ')');
$sqlLength = $sqlEnd - $sqlStart;
$message = substr($message, $sqlStart, $sqlLength);
$message = strtr($message, array(
' FROM ' => "\nFROM ",... | php | public function formatProfileMessage($message)
{
$sqlStart = strpos($message, '(') + 1;
$sqlEnd = strrpos($message, ')');
$sqlLength = $sqlEnd - $sqlStart;
$message = substr($message, $sqlStart, $sqlLength);
$message = strtr($message, array(
' FROM ' => "\nFROM ",... | [
"public",
"function",
"formatProfileMessage",
"(",
"$",
"message",
")",
"{",
"$",
"sqlStart",
"=",
"strpos",
"(",
"$",
"message",
",",
"'('",
")",
"+",
"1",
";",
"$",
"sqlEnd",
"=",
"strrpos",
"(",
"$",
"message",
",",
"')'",
")",
";",
"$",
"sqlLengt... | Format profile message
@param string $message
@return string | [
"Format",
"profile",
"message"
] | 07362f79741b5343d22bb9bb516d840072a097d4 | https://github.com/cornernote/yii-audit-module/blob/07362f79741b5343d22bb9bb516d840072a097d4/audit/models/AuditLog.php#L132-L160 |
229,331 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.getTableName | public function getTableName()
{
if (is_null($this->_tableName)) {
$parts = explode('\\', $this->getClassName());
$name = end($parts);
$this->_tableName = Text::plural(strtolower($name));
}
return $this->_tableName;
} | php | public function getTableName()
{
if (is_null($this->_tableName)) {
$parts = explode('\\', $this->getClassName());
$name = end($parts);
$this->_tableName = Text::plural(strtolower($name));
}
return $this->_tableName;
} | [
"public",
"function",
"getTableName",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_tableName",
")",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"this",
"->",
"getClassName",
"(",
")",
")",
";",
"$",
"name",
"=... | Returns entity table name. If no name was give it returns the plural
of the entity class name
@return string | [
"Returns",
"entity",
"table",
"name",
".",
"If",
"no",
"name",
"was",
"give",
"it",
"returns",
"the",
"plural",
"of",
"the",
"entity",
"class",
"name"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L52-L60 |
229,332 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.get | public static function get($id)
{
/** @var Entity $entity */
$entity = new static();
Manager::getInstance()->get($entity)->refreshRelations();
$className = $entity->getClassName();
$sql = Sql::createSql($entity->getAdapter())
->select($entity->getTableName())
... | php | public static function get($id)
{
/** @var Entity $entity */
$entity = new static();
Manager::getInstance()->get($entity)->refreshRelations();
$className = $entity->getClassName();
$sql = Sql::createSql($entity->getAdapter())
->select($entity->getTableName())
... | [
"public",
"static",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"/** @var Entity $entity */",
"$",
"entity",
"=",
"new",
"static",
"(",
")",
";",
"Manager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"$",
"entity",
")",
"->",
"refreshRelations",
"... | Gets the record with the provided primary key
@param string|integer $id The primary key value
@return null|self | [
"Gets",
"the",
"record",
"with",
"the",
"provided",
"primary",
"key"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L69-L102 |
229,333 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.find | public static function find($fields = '*')
{
$entity = new static();
if ($fields == '*') {
$fields = $entity->getTableName() .'.*';
}
Entity\Manager::getInstance()->get($entity)->refreshRelations();
$select = new \Slick\Orm\Sql\Select($entity, $fields);
re... | php | public static function find($fields = '*')
{
$entity = new static();
if ($fields == '*') {
$fields = $entity->getTableName() .'.*';
}
Entity\Manager::getInstance()->get($entity)->refreshRelations();
$select = new \Slick\Orm\Sql\Select($entity, $fields);
re... | [
"public",
"static",
"function",
"find",
"(",
"$",
"fields",
"=",
"'*'",
")",
"{",
"$",
"entity",
"=",
"new",
"static",
"(",
")",
";",
"if",
"(",
"$",
"fields",
"==",
"'*'",
")",
"{",
"$",
"fields",
"=",
"$",
"entity",
"->",
"getTableName",
"(",
"... | Starts a select query on this model. Fields can be specified otherwise
all fields are selected
@param string|array $fields The list of fields to be selected.
@return \Slick\Orm\Sql\Select | [
"Starts",
"a",
"select",
"query",
"on",
"this",
"model",
".",
"Fields",
"can",
"be",
"specified",
"otherwise",
"all",
"fields",
"are",
"selected"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L112-L121 |
229,334 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.save | public function save(array $data = [])
{
Manager::getInstance()->get($this)->refreshRelations();
$action = Save::INSERT;
$pmk = $this->primaryKey;
if ($this->$pmk || isset($data[$pmk])) {
$action = Save::UPDATE;
}
if ($action == Save::UPDATE) {
... | php | public function save(array $data = [])
{
Manager::getInstance()->get($this)->refreshRelations();
$action = Save::INSERT;
$pmk = $this->primaryKey;
if ($this->$pmk || isset($data[$pmk])) {
$action = Save::UPDATE;
}
if ($action == Save::UPDATE) {
... | [
"public",
"function",
"save",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"Manager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"$",
"this",
")",
"->",
"refreshRelations",
"(",
")",
";",
"$",
"action",
"=",
"Save",
"::",
"INSERT",
";"... | Saves the entity data or the provided data
If no data is provided the save action will check all properties
marked with @column annotation and crates a key/value pair array
with those properties and its values. If the data is provided only
the values in that associative array will be used except that if
you don't set ... | [
"Saves",
"the",
"entity",
"data",
"or",
"the",
"provided",
"data"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L140-L154 |
229,335 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.delete | public function delete()
{
Manager::getInstance()->get($this)->refreshRelations();
$pmk = $this->getPrimaryKey();
$sql = Sql::createSql($this->getAdapter())
->delete($this->getTableName())
->where(["{$pmk} = :id" => [':id' => $this->$pmk]]);
$event = new Delet... | php | public function delete()
{
Manager::getInstance()->get($this)->refreshRelations();
$pmk = $this->getPrimaryKey();
$sql = Sql::createSql($this->getAdapter())
->delete($this->getTableName())
->where(["{$pmk} = :id" => [':id' => $this->$pmk]]);
$event = new Delet... | [
"public",
"function",
"delete",
"(",
")",
"{",
"Manager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"$",
"this",
")",
"->",
"refreshRelations",
"(",
")",
";",
"$",
"pmk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"$",
"sql",
"=... | Deletes current record from
@return bool | [
"Deletes",
"current",
"record",
"from"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L161-L180 |
229,336 | slickframework/slick | src/Slick/Orm/Entity.php | Entity._insert | protected function _insert(array $data)
{
$data = $this->_setData($data);
$sql = Sql::createSql($this->getAdapter())->insert($this->getTableName());
$event = new Save([
'action' => Save::INSERT,
'data' => $data,
'abort' => false
]);
$this->... | php | protected function _insert(array $data)
{
$data = $this->_setData($data);
$sql = Sql::createSql($this->getAdapter())->insert($this->getTableName());
$event = new Save([
'action' => Save::INSERT,
'data' => $data,
'abort' => false
]);
$this->... | [
"protected",
"function",
"_insert",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_setData",
"(",
"$",
"data",
")",
";",
"$",
"sql",
"=",
"Sql",
"::",
"createSql",
"(",
"$",
"this",
"->",
"getAdapter",
"(",
")",
")",
... | Inserts a new record in the database
@param array $data
@return bool | [
"Inserts",
"a",
"new",
"record",
"in",
"the",
"database"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L188-L209 |
229,337 | slickframework/slick | src/Slick/Orm/Entity.php | Entity._update | protected function _update(array $data)
{
$data = $this->_setData($data);
$pmk = $this->getPrimaryKey();
unset($data[$pmk]);
$sql = Sql::createSql($this->getAdapter())->update($this->getTableName());
$event = new Save([
'action' => Save::UPDATE,
'data'... | php | protected function _update(array $data)
{
$data = $this->_setData($data);
$pmk = $this->getPrimaryKey();
unset($data[$pmk]);
$sql = Sql::createSql($this->getAdapter())->update($this->getTableName());
$event = new Save([
'action' => Save::UPDATE,
'data'... | [
"protected",
"function",
"_update",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_setData",
"(",
"$",
"data",
")",
";",
"$",
"pmk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"unset",
"(",
"$",
"data",
"... | Updated current entity or data
@param array $data
@return bool | [
"Updated",
"current",
"entity",
"or",
"data"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L217-L237 |
229,338 | slickframework/slick | src/Slick/Orm/Entity.php | Entity._setData | protected function _setData(array $data)
{
$pmk = $this->getPrimaryKey();
if (!empty($data)) {
if (!isset($data[$pmk]) && !is_null($this->$pmk)) {
$data[$pmk] = $this->$pmk;
}
return $data;
}
$columns = Manager::getInstance()->get($... | php | protected function _setData(array $data)
{
$pmk = $this->getPrimaryKey();
if (!empty($data)) {
if (!isset($data[$pmk]) && !is_null($this->$pmk)) {
$data[$pmk] = $this->$pmk;
}
return $data;
}
$columns = Manager::getInstance()->get($... | [
"protected",
"function",
"_setData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"pmk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"... | Sets the data to be saved
@param array $data
@return array | [
"Sets",
"the",
"data",
"to",
"be",
"saved"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L245-L264 |
229,339 | slickframework/slick | src/Slick/Orm/Entity.php | Entity.asArray | public function asArray()
{
$data = [];
$columns = Manager::getInstance()->get($this)->getColumns();
foreach(array_keys($columns) as $field) {
$data[trim($field, '_')] = $this->$field;
}
$relations = Manager::getInstance()->get($this)->getRelations();
fore... | php | public function asArray()
{
$data = [];
$columns = Manager::getInstance()->get($this)->getColumns();
foreach(array_keys($columns) as $field) {
$data[trim($field, '_')] = $this->$field;
}
$relations = Manager::getInstance()->get($this)->getRelations();
fore... | [
"public",
"function",
"asArray",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"columns",
"=",
"Manager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"$",
"this",
")",
"->",
"getColumns",
"(",
")",
";",
"foreach",
"(",
"array_keys",
"("... | Recursively returns this entity as an array. Used in json and
serialization processes.
@return array | [
"Recursively",
"returns",
"this",
"entity",
"as",
"an",
"array",
".",
"Used",
"in",
"json",
"and",
"serialization",
"processes",
"."
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Entity.php#L272-L296 |
229,340 | jacobstr/matura | lib/Console/Output/Printer.php | Printer.renderEvent | public function renderEvent(Event $event)
{
$parts = array_map('ucfirst', array_filter(preg_split('/_|\./', $event->name)));
$name = 'on'.implode($parts);
if (is_callable(array($this, $name))) {
return call_user_func(array($this, $name), $event);
} else {
ret... | php | public function renderEvent(Event $event)
{
$parts = array_map('ucfirst', array_filter(preg_split('/_|\./', $event->name)));
$name = 'on'.implode($parts);
if (is_callable(array($this, $name))) {
return call_user_func(array($this, $name), $event);
} else {
ret... | [
"public",
"function",
"renderEvent",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"parts",
"=",
"array_map",
"(",
"'ucfirst'",
",",
"array_filter",
"(",
"preg_split",
"(",
"'/_|\\./'",
",",
"$",
"event",
"->",
"name",
")",
")",
")",
";",
"$",
"name",
"="... | Conducts our 'event_group.action' => 'onEventGroupAction delegation' | [
"Conducts",
"our",
"event_group",
".",
"action",
"=",
">",
"onEventGroupAction",
"delegation"
] | 393e0f3676f502454cc6823cac8ce9cef2ea7bff | https://github.com/jacobstr/matura/blob/393e0f3676f502454cc6823cac8ce9cef2ea7bff/lib/Console/Output/Printer.php#L199-L209 |
229,341 | mbilbille/jpnforphp | src/JpnForPhp/Transliterator/Transliterator.php | Transliterator.transliterate | public function transliterate($str, $system = null) {
if(is_null($system)) {
$system = $this->system;
}
if(is_null($system)) {
throw new RuntimeException("Transliteration system is not defined");
}
return $system->transliterate($str);
} | php | public function transliterate($str, $system = null) {
if(is_null($system)) {
$system = $this->system;
}
if(is_null($system)) {
throw new RuntimeException("Transliteration system is not defined");
}
return $system->transliterate($str);
} | [
"public",
"function",
"transliterate",
"(",
"$",
"str",
",",
"$",
"system",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"system",
")",
")",
"{",
"$",
"system",
"=",
"$",
"this",
"->",
"system",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",... | Transliterate a string from an alphabet into another alphabet.
@param string $str The string to be converted.
@param System $system (Optional) Override default transliteration system.
@return string Converted string. | [
"Transliterate",
"a",
"string",
"from",
"an",
"alphabet",
"into",
"another",
"alphabet",
"."
] | 5623468503cc2941f4656b0ee1a58b939d263453 | https://github.com/mbilbille/jpnforphp/blob/5623468503cc2941f4656b0ee1a58b939d263453/src/JpnForPhp/Transliterator/Transliterator.php#L41-L49 |
229,342 | slickframework/slick | src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php | ObjectDefinitionHelper.getDefinition | public function getDefinition($entryName)
{
$definition = new ObjectDefinition($entryName, $this->_className);
$definition
->setMethods($this->_methods)
->setProperties($this->_properties)
->setScope($this->_scope);
if ($this->_constructor) {
$... | php | public function getDefinition($entryName)
{
$definition = new ObjectDefinition($entryName, $this->_className);
$definition
->setMethods($this->_methods)
->setProperties($this->_properties)
->setScope($this->_scope);
if ($this->_constructor) {
$... | [
"public",
"function",
"getDefinition",
"(",
"$",
"entryName",
")",
"{",
"$",
"definition",
"=",
"new",
"ObjectDefinition",
"(",
"$",
"entryName",
",",
"$",
"this",
"->",
"_className",
")",
";",
"$",
"definition",
"->",
"setMethods",
"(",
"$",
"this",
"->",... | Returns an object definition
@param string $entryName Container entry name
@return \Slick\Di\DefinitionInterface | [
"Returns",
"an",
"object",
"definition"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php#L73-L84 |
229,343 | slickframework/slick | src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php | ObjectDefinitionHelper.method | public function method($name, array $parameters = [])
{
$this->_methods[$name] = new MethodInjection($name, $parameters);
return $this;
} | php | public function method($name, array $parameters = [])
{
$this->_methods[$name] = new MethodInjection($name, $parameters);
return $this;
} | [
"public",
"function",
"method",
"(",
"$",
"name",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_methods",
"[",
"$",
"name",
"]",
"=",
"new",
"MethodInjection",
"(",
"$",
"name",
",",
"$",
"parameters",
")",
";",
"re... | Defines a method injection
@param string $name
@param array $parameters
@return ObjectDefinitionHelper | [
"Defines",
"a",
"method",
"injection"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php#L107-L111 |
229,344 | slickframework/slick | src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php | ObjectDefinitionHelper.property | public function property($name, $value)
{
$this->_properties[$name] = new PropertyInjection($name, $value);
return $this;
} | php | public function property($name, $value)
{
$this->_properties[$name] = new PropertyInjection($name, $value);
return $this;
} | [
"public",
"function",
"property",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_properties",
"[",
"$",
"name",
"]",
"=",
"new",
"PropertyInjection",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}... | Defines a property injection
@param string $name
@param mixed $value
@return ObjectDefinitionHelper | [
"Defines",
"a",
"property",
"injection"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Di/Definition/Helper/ObjectDefinitionHelper.php#L121-L125 |
229,345 | jacobstr/matura | lib/Runners/SuiteRunner.php | SuiteRunner.run | public function run()
{
$this->emit(
'suite.start',
array(
'suite' => $this->suite,
'result_set' => $this->result_set
)
);
$result = $this->captureAround(array($this, 'runGroup'), $this->suite, $this->suite);
$this... | php | public function run()
{
$this->emit(
'suite.start',
array(
'suite' => $this->suite,
'result_set' => $this->result_set
)
);
$result = $this->captureAround(array($this, 'runGroup'), $this->suite, $this->suite);
$this... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"emit",
"(",
"'suite.start'",
",",
"array",
"(",
"'suite'",
"=>",
"$",
"this",
"->",
"suite",
",",
"'result_set'",
"=>",
"$",
"this",
"->",
"result_set",
")",
")",
";",
"$",
"result",
"="... | Runs the Suite from start to finish. | [
"Runs",
"the",
"Suite",
"from",
"start",
"to",
"finish",
"."
] | 393e0f3676f502454cc6823cac8ce9cef2ea7bff | https://github.com/jacobstr/matura/blob/393e0f3676f502454cc6823cac8ce9cef2ea7bff/lib/Runners/SuiteRunner.php#L51-L75 |
229,346 | jacobstr/matura | lib/Runners/SuiteRunner.php | SuiteRunner.isFiltered | protected function isFiltered(Block $block)
{
// Skip filtering on implicit Suite block.
if ($block instanceof Suite) {
return false;
}
$options = &$this->options;
$isFiltered = function ($block) use (&$options) {
$filtered = false;
if (... | php | protected function isFiltered(Block $block)
{
// Skip filtering on implicit Suite block.
if ($block instanceof Suite) {
return false;
}
$options = &$this->options;
$isFiltered = function ($block) use (&$options) {
$filtered = false;
if (... | [
"protected",
"function",
"isFiltered",
"(",
"Block",
"$",
"block",
")",
"{",
"// Skip filtering on implicit Suite block.",
"if",
"(",
"$",
"block",
"instanceof",
"Suite",
")",
"{",
"return",
"false",
";",
"}",
"$",
"options",
"=",
"&",
"$",
"this",
"->",
"op... | Checks if the block or any of it's descendants match our grep filter or
do not match our except filter.
Descendants are checked in order to retain a test even it's parent block
path does not match. | [
"Checks",
"if",
"the",
"block",
"or",
"any",
"of",
"it",
"s",
"descendants",
"match",
"our",
"grep",
"filter",
"or",
"do",
"not",
"match",
"our",
"except",
"filter",
"."
] | 393e0f3676f502454cc6823cac8ce9cef2ea7bff | https://github.com/jacobstr/matura/blob/393e0f3676f502454cc6823cac8ce9cef2ea7bff/lib/Runners/SuiteRunner.php#L207-L248 |
229,347 | Danzabar/phalcon-cli | src/Format/Colors.php | Colors.getForeground | public function getForeground($name)
{
if (array_key_exists($name, $this->foreground)) {
return $this->foreground[$name];
}
return false;
} | php | public function getForeground($name)
{
if (array_key_exists($name, $this->foreground)) {
return $this->foreground[$name];
}
return false;
} | [
"public",
"function",
"getForeground",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"foreground",
")",
")",
"{",
"return",
"$",
"this",
"->",
"foreground",
"[",
"$",
"name",
"]",
";",
"}",
"retu... | Gets a foreground color code by its name
@return void | [
"Gets",
"a",
"foreground",
"color",
"code",
"by",
"its",
"name"
] | 0d6293d5d899158705f8e3a31886d176e595ee38 | https://github.com/Danzabar/phalcon-cli/blob/0d6293d5d899158705f8e3a31886d176e595ee38/src/Format/Colors.php#L46-L53 |
229,348 | Danzabar/phalcon-cli | src/Format/Colors.php | Colors.getBackground | public function getBackground($name)
{
if (array_key_exists($name, $this->background)) {
return $this->background[$name];
}
return false;
} | php | public function getBackground($name)
{
if (array_key_exists($name, $this->background)) {
return $this->background[$name];
}
return false;
} | [
"public",
"function",
"getBackground",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"background",
")",
")",
"{",
"return",
"$",
"this",
"->",
"background",
"[",
"$",
"name",
"]",
";",
"}",
"retu... | Gets a background color code by its name
@return void | [
"Gets",
"a",
"background",
"color",
"code",
"by",
"its",
"name"
] | 0d6293d5d899158705f8e3a31886d176e595ee38 | https://github.com/Danzabar/phalcon-cli/blob/0d6293d5d899158705f8e3a31886d176e595ee38/src/Format/Colors.php#L60-L67 |
229,349 | PrestaShop/decimal | src/Operation/Division.php | Division.compute | public function compute(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
if (function_exists('bcdiv')) {
return $this->computeUsingBcMath($a, $b, $precision);
}
return $this->computeWithoutBcMath($a, $b, $precision);
} | php | public function compute(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
if (function_exists('bcdiv')) {
return $this->computeUsingBcMath($a, $b, $precision);
}
return $this->computeWithoutBcMath($a, $b, $precision);
} | [
"public",
"function",
"compute",
"(",
"DecimalNumber",
"$",
"a",
",",
"DecimalNumber",
"$",
"b",
",",
"$",
"precision",
"=",
"self",
"::",
"DEFAULT_PRECISION",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'bcdiv'",
")",
")",
"{",
"return",
"$",
"this",
... | Performs the division.
A target maximum precision is required in order to handle potential infinite number of decimals
(e.g. 1/3 = 0.3333333...).
If the division yields more decimal positions than the requested precision,
the remaining decimals are truncated, with **no rounding**.
@param DecimalNumber $a Dividend
@p... | [
"Performs",
"the",
"division",
"."
] | 42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f | https://github.com/PrestaShop/decimal/blob/42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f/src/Operation/Division.php#L37-L44 |
229,350 | PrestaShop/decimal | src/Operation/Division.php | Division.computeUsingBcMath | public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
if ((string) $b === '0') {
throw new DivisionByZeroException();
}
return new DecimalNumber((string) bcdiv($a, $b, $precision));
} | php | public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
if ((string) $b === '0') {
throw new DivisionByZeroException();
}
return new DecimalNumber((string) bcdiv($a, $b, $precision));
} | [
"public",
"function",
"computeUsingBcMath",
"(",
"DecimalNumber",
"$",
"a",
",",
"DecimalNumber",
"$",
"b",
",",
"$",
"precision",
"=",
"self",
"::",
"DEFAULT_PRECISION",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"b",
"===",
"'0'",
")",
"{",
"throw",... | Performs the division using BC Math
@param DecimalNumber $a Dividend
@param DecimalNumber $b Divisor
@param int $precision Maximum decimal precision
@return DecimalNumber Result of the division
@throws DivisionByZeroException | [
"Performs",
"the",
"division",
"using",
"BC",
"Math"
] | 42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f | https://github.com/PrestaShop/decimal/blob/42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f/src/Operation/Division.php#L56-L63 |
229,351 | PrestaShop/decimal | src/Operation/Division.php | Division.computeWithoutBcMath | public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
$bString = (string) $b;
if ('0' === $bString) {
throw new DivisionByZeroException();
}
$aString = (string) $a;
// 0 as dividend always yields 0
... | php | public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
{
$bString = (string) $b;
if ('0' === $bString) {
throw new DivisionByZeroException();
}
$aString = (string) $a;
// 0 as dividend always yields 0
... | [
"public",
"function",
"computeWithoutBcMath",
"(",
"DecimalNumber",
"$",
"a",
",",
"DecimalNumber",
"$",
"b",
",",
"$",
"precision",
"=",
"self",
"::",
"DEFAULT_PRECISION",
")",
"{",
"$",
"bString",
"=",
"(",
"string",
")",
"$",
"b",
";",
"if",
"(",
"'0'... | Performs the division without BC Math
@param DecimalNumber $a Dividend
@param DecimalNumber $b Divisor
@param int $precision Maximum decimal precision
@return DecimalNumber Result of the division
@throws DivisionByZeroException | [
"Performs",
"the",
"division",
"without",
"BC",
"Math"
] | 42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f | https://github.com/PrestaShop/decimal/blob/42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f/src/Operation/Division.php#L75-L118 |
229,352 | PrestaShop/decimal | src/Operation/Division.php | Division.integerDivision | private function integerDivision(DecimalNumber $a, DecimalNumber $b, $precision)
{
$dividend = $a->getCoefficient();
$divisor = new DecimalNumber($b->getCoefficient());
$dividendLength = strlen($dividend);
$result = '';
$exponent = 0;
$currentSequence = '';
f... | php | private function integerDivision(DecimalNumber $a, DecimalNumber $b, $precision)
{
$dividend = $a->getCoefficient();
$divisor = new DecimalNumber($b->getCoefficient());
$dividendLength = strlen($dividend);
$result = '';
$exponent = 0;
$currentSequence = '';
f... | [
"private",
"function",
"integerDivision",
"(",
"DecimalNumber",
"$",
"a",
",",
"DecimalNumber",
"$",
"b",
",",
"$",
"precision",
")",
"{",
"$",
"dividend",
"=",
"$",
"a",
"->",
"getCoefficient",
"(",
")",
";",
"$",
"divisor",
"=",
"new",
"DecimalNumber",
... | Computes the division between two integer DecimalNumbers
@param DecimalNumber $a Dividend
@param DecimalNumber $b Divisor
@param int $precision Maximum number of decimals to try
@return DecimalNumber | [
"Computes",
"the",
"division",
"between",
"two",
"integer",
"DecimalNumbers"
] | 42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f | https://github.com/PrestaShop/decimal/blob/42e9bc8c2ec533dc2a247f9321b8f3ed55c5341f/src/Operation/Division.php#L129-L174 |
229,353 | laravelcity/laravel-categories | src/Models/Categories.php | Categories.categoryExist | function categoryExist($title){
if(self::where('title',$title)->where('model_type',$this->modelType)->first())
return true;
return false;
} | php | function categoryExist($title){
if(self::where('title',$title)->where('model_type',$this->modelType)->first())
return true;
return false;
} | [
"function",
"categoryExist",
"(",
"$",
"title",
")",
"{",
"if",
"(",
"self",
"::",
"where",
"(",
"'title'",
",",
"$",
"title",
")",
"->",
"where",
"(",
"'model_type'",
",",
"$",
"this",
"->",
"modelType",
")",
"->",
"first",
"(",
")",
")",
"return",
... | check category exist
@param $title => string
@return bool | [
"check",
"category",
"exist"
] | b5c1baf8cbb51377fef090fc9ddaa0946bf42a68 | https://github.com/laravelcity/laravel-categories/blob/b5c1baf8cbb51377fef090fc9ddaa0946bf42a68/src/Models/Categories.php#L56-L61 |
229,354 | laravelcity/laravel-categories | src/Models/Categories.php | Categories.child | function child($depth=null){
if($depth==null)
return self::where('parent',$this->attributes['id'])->get();
else
return self::where('parent',$this->attributes['id'])->where('depth',$depth)->get();
} | php | function child($depth=null){
if($depth==null)
return self::where('parent',$this->attributes['id'])->get();
else
return self::where('parent',$this->attributes['id'])->where('depth',$depth)->get();
} | [
"function",
"child",
"(",
"$",
"depth",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"depth",
"==",
"null",
")",
"return",
"self",
"::",
"where",
"(",
"'parent'",
",",
"$",
"this",
"->",
"attributes",
"[",
"'id'",
"]",
")",
"->",
"get",
"(",
")",
";",
... | get category child with depth
@params $depth
@return Collection | [
"get",
"category",
"child",
"with",
"depth"
] | b5c1baf8cbb51377fef090fc9ddaa0946bf42a68 | https://github.com/laravelcity/laravel-categories/blob/b5c1baf8cbb51377fef090fc9ddaa0946bf42a68/src/Models/Categories.php#L68-L73 |
229,355 | laravelcity/laravel-categories | src/Models/Categories.php | Categories.getCategory | function getCategory($id){
if(is_numeric($id))
$model=self::where('id',$id)->select();
else
$model=self::where('slug',$id)->select();
$model->where('model_type',$this->modelType);
return $model->first();
} | php | function getCategory($id){
if(is_numeric($id))
$model=self::where('id',$id)->select();
else
$model=self::where('slug',$id)->select();
$model->where('model_type',$this->modelType);
return $model->first();
} | [
"function",
"getCategory",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"id",
")",
")",
"$",
"model",
"=",
"self",
"::",
"where",
"(",
"'id'",
",",
"$",
"id",
")",
"->",
"select",
"(",
")",
";",
"else",
"$",
"model",
"=",
"self"... | get category with id
@param $id
@param $type
@return Categories | [
"get",
"category",
"with",
"id"
] | b5c1baf8cbb51377fef090fc9ddaa0946bf42a68 | https://github.com/laravelcity/laravel-categories/blob/b5c1baf8cbb51377fef090fc9ddaa0946bf42a68/src/Models/Categories.php#L97-L106 |
229,356 | slickframework/slick | src/Slick/Database/Sql/Select.php | Select.join | public function join(
$table, $on, $fields = ['*'], $alias = null, $type = Join::JOIN_LEFT)
{
$join = new Join($table, $on, $fields, $type);
if (!is_null($alias)) {
$join->setAlias($alias);
}
$this->_joins[] = $join;
return $this;
} | php | public function join(
$table, $on, $fields = ['*'], $alias = null, $type = Join::JOIN_LEFT)
{
$join = new Join($table, $on, $fields, $type);
if (!is_null($alias)) {
$join->setAlias($alias);
}
$this->_joins[] = $join;
return $this;
} | [
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"on",
",",
"$",
"fields",
"=",
"[",
"'*'",
"]",
",",
"$",
"alias",
"=",
"null",
",",
"$",
"type",
"=",
"Join",
"::",
"JOIN_LEFT",
")",
"{",
"$",
"join",
"=",
"new",
"Join",
"(",
"$",
... | Adds a join table to the select query
If fields is null it will not set any field to the select field
list. if it is a string it will be passed to the select field list
as it is.
If you pass a list of field names they will be prefixed
with the alias if is set or the table name, to avoid the ambiguous
fields name
@pa... | [
"Adds",
"a",
"join",
"table",
"to",
"the",
"select",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Sql/Select.php#L194-L203 |
229,357 | slickframework/slick | src/Slick/Database/Sql/Select.php | Select.limit | public function limit($rows, $offset = 0)
{
$this->_limit = $rows;
$this->_offset = $offset;
return $this;
} | php | public function limit($rows, $offset = 0)
{
$this->_limit = $rows;
$this->_offset = $offset;
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"rows",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"_limit",
"=",
"$",
"rows",
";",
"$",
"this",
"->",
"_offset",
"=",
"$",
"offset",
";",
"return",
"$",
"this",
";",
"}"
] | Sets query limit and offset
@param int $rows
@param int $offset
@return Select | [
"Sets",
"query",
"limit",
"and",
"offset"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Sql/Select.php#L226-L231 |
229,358 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Statements/ConditionalStatement.php | ConditionalStatement.innerJoin | public function innerJoin($join, $on = null)
{
$this->getJoins()->innerJoin($join, $on);
return $this;
} | php | public function innerJoin($join, $on = null)
{
$this->getJoins()->innerJoin($join, $on);
return $this;
} | [
"public",
"function",
"innerJoin",
"(",
"$",
"join",
",",
"$",
"on",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getJoins",
"(",
")",
"->",
"innerJoin",
"(",
"$",
"join",
",",
"$",
"on",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Adds INNER JOIN to the query
@param string $join
@param string $on
@return self | [
"Adds",
"INNER",
"JOIN",
"to",
"the",
"query"
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Statements/ConditionalStatement.php#L106-L111 |
229,359 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Statements/ConditionalStatement.php | ConditionalStatement.leftJoin | public function leftJoin($join, $on = null)
{
$this->getJoins()->leftJoin($join, $on);
return $this;
} | php | public function leftJoin($join, $on = null)
{
$this->getJoins()->leftJoin($join, $on);
return $this;
} | [
"public",
"function",
"leftJoin",
"(",
"$",
"join",
",",
"$",
"on",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getJoins",
"(",
")",
"->",
"leftJoin",
"(",
"$",
"join",
",",
"$",
"on",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Adds LEFT JOIN to the query
@param string $join
@param string $on
@return self | [
"Adds",
"LEFT",
"JOIN",
"to",
"the",
"query"
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Statements/ConditionalStatement.php#L120-L125 |
229,360 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Statements/ConditionalStatement.php | ConditionalStatement.where | public function where($conditions, $value = null, $operator = '=')
{
if (is_array($conditions)) {
$this->getWhere()->addConditions($conditions);
} else {
$this->getWhere()->addCondition($conditions, $value, $operator);
}
return $this;
} | php | public function where($conditions, $value = null, $operator = '=')
{
if (is_array($conditions)) {
$this->getWhere()->addConditions($conditions);
} else {
$this->getWhere()->addCondition($conditions, $value, $operator);
}
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"conditions",
",",
"$",
"value",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"conditions",
")",
")",
"{",
"$",
"this",
"->",
"getWhere",
"(",
")",
"->",
"addCond... | Add conditions
I.E.
$this->where('a = 1')
->where('a', 'b')
->where('a', 'x', '!=')
->where(array(
'foo' => 'bar',
'foobar' => 'foo'
));
@param array|string $conditions
@param string $value
@param string $operator
@return PO\QueryBuilder | [
"Add",
"conditions",
"I",
".",
"E",
"."
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Statements/ConditionalStatement.php#L144-L153 |
229,361 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Statements/ConditionalStatement.php | ConditionalStatement.limit | public function limit($limit, $offset = null)
{
if ($offset) {
$this->getLimit()->setParams(array($limit, $offset));
} else {
$this->getLimit()->setParams(array($limit));
}
return $this;
} | php | public function limit($limit, $offset = null)
{
if ($offset) {
$this->getLimit()->setParams(array($limit, $offset));
} else {
$this->getLimit()->setParams(array($limit));
}
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"offset",
")",
"{",
"$",
"this",
"->",
"getLimit",
"(",
")",
"->",
"setParams",
"(",
"array",
"(",
"$",
"limit",
",",
"$",
"offset",
")",... | Add limit
I.E.
@param int $limit
@param int $offset
@return self | [
"Add",
"limit",
"I",
".",
"E",
"."
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Statements/ConditionalStatement.php#L179-L188 |
229,362 | slickframework/slick | src/Slick/Database/Sql/WhereMethods.php | WhereMethods.getWhereStatement | public function getWhereStatement()
{
if (empty($this->where)) {
return false;
}
$this->where[0]['operation'] = null;
$str = '';
foreach ($this->where as $clause) {
$str .= trim("{$clause['operation']} {$clause['condition']}");
$str .= " ";... | php | public function getWhereStatement()
{
if (empty($this->where)) {
return false;
}
$this->where[0]['operation'] = null;
$str = '';
foreach ($this->where as $clause) {
$str .= trim("{$clause['operation']} {$clause['condition']}");
$str .= " ";... | [
"public",
"function",
"getWhereStatement",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"where",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"where",
"[",
"0",
"]",
"[",
"'operation'",
"]",
"=",
"null",
";",
"$",
... | Returns the where statement for sql
@return bool|string | [
"Returns",
"the",
"where",
"statement",
"for",
"sql"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Sql/WhereMethods.php#L130-L143 |
229,363 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getStatement | public function getStatement()
{
return $this->_fixBlanks(
trim(
str_replace(
array(
'<fields>', '<joinFields>', '<tableName>',
'<joins>', '<where>', '<groupBy>',
'<orderBy>', '<limit>'
... | php | public function getStatement()
{
return $this->_fixBlanks(
trim(
str_replace(
array(
'<fields>', '<joinFields>', '<tableName>',
'<joins>', '<where>', '<groupBy>',
'<orderBy>', '<limit>'
... | [
"public",
"function",
"getStatement",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"_fixBlanks",
"(",
"trim",
"(",
"str_replace",
"(",
"array",
"(",
"'<fields>'",
",",
"'<joinFields>'",
",",
"'<tableName>'",
",",
"'<joins>'",
",",
"'<where>'",
",",
"'<groupBy>'... | Returns the SQL query string for current Select SQL Object
@return String The SQL query string | [
"Returns",
"the",
"SQL",
"query",
"string",
"for",
"current",
"Select",
"SQL",
"Object"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L48-L72 |
229,364 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getFields | public function getFields()
{
$joins = $this->_sql->getJoins();
$fields = $this->_sql->getFields();
if (!is_array($fields)) {
return $fields;
}
if (count($joins) > 0 && $this->_sql->prefixTableName) {
$table = $this->_sql->getTableName();
... | php | public function getFields()
{
$joins = $this->_sql->getJoins();
$fields = $this->_sql->getFields();
if (!is_array($fields)) {
return $fields;
}
if (count($joins) > 0 && $this->_sql->prefixTableName) {
$table = $this->_sql->getTableName();
... | [
"public",
"function",
"getFields",
"(",
")",
"{",
"$",
"joins",
"=",
"$",
"this",
"->",
"_sql",
"->",
"getJoins",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"_sql",
"->",
"getFields",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$"... | Returns the field list from Select object
@return string The field list | [
"Returns",
"the",
"field",
"list",
"from",
"Select",
"object"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L79-L96 |
229,365 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getJoinFields | public function getJoinFields()
{
$fields = null;
$tmpFields = array();
$joins = $this->_sql->getJoins();
if (count($joins) > 0) {
foreach ($joins as $join) {
$tmpJoin = array();
foreach ($join['fields'] as $field) {
$... | php | public function getJoinFields()
{
$fields = null;
$tmpFields = array();
$joins = $this->_sql->getJoins();
if (count($joins) > 0) {
foreach ($joins as $join) {
$tmpJoin = array();
foreach ($join['fields'] as $field) {
$... | [
"public",
"function",
"getJoinFields",
"(",
")",
"{",
"$",
"fields",
"=",
"null",
";",
"$",
"tmpFields",
"=",
"array",
"(",
")",
";",
"$",
"joins",
"=",
"$",
"this",
"->",
"_sql",
"->",
"getJoins",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"jo... | Returns the join fields for this query
@return string The comma seperated field names | [
"Returns",
"the",
"join",
"fields",
"for",
"this",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L103-L126 |
229,366 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getJoins | public function getJoins()
{
$template = "%s JOIN %s ON %s";
$joinsStr = null;
$joins = $this->_sql->getJoins();
$tmpJoin = array();
if (count($joins) > 0) {
foreach ($joins as $join) {
$tmpJoin[] = sprintf(
$template,
... | php | public function getJoins()
{
$template = "%s JOIN %s ON %s";
$joinsStr = null;
$joins = $this->_sql->getJoins();
$tmpJoin = array();
if (count($joins) > 0) {
foreach ($joins as $join) {
$tmpJoin[] = sprintf(
$template,
... | [
"public",
"function",
"getJoins",
"(",
")",
"{",
"$",
"template",
"=",
"\"%s JOIN %s ON %s\"",
";",
"$",
"joinsStr",
"=",
"null",
";",
"$",
"joins",
"=",
"$",
"this",
"->",
"_sql",
"->",
"getJoins",
"(",
")",
";",
"$",
"tmpJoin",
"=",
"array",
"(",
"... | Returns the JOIN clauses for this query
@return string The join clauses string | [
"Returns",
"the",
"JOIN",
"clauses",
"for",
"this",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L133-L153 |
229,367 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getWhere | public function getWhere()
{
$template = "WHERE %s";
$where = null;
if (count($this->_sql->conditions->predicates) > 0) {
$where = trim(
sprintf($template, $this->_sql->conditions->toString())
);
}
return $where;
} | php | public function getWhere()
{
$template = "WHERE %s";
$where = null;
if (count($this->_sql->conditions->predicates) > 0) {
$where = trim(
sprintf($template, $this->_sql->conditions->toString())
);
}
return $where;
} | [
"public",
"function",
"getWhere",
"(",
")",
"{",
"$",
"template",
"=",
"\"WHERE %s\"",
";",
"$",
"where",
"=",
"null",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_sql",
"->",
"conditions",
"->",
"predicates",
")",
">",
"0",
")",
"{",
"$",
"w... | Returns the WHERE clause for this query
@return string The where clause string | [
"Returns",
"the",
"WHERE",
"clause",
"for",
"this",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L160-L171 |
229,368 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getOrderBy | public function getOrderBy()
{
$template = "ORDER BY %s";
$orderBy = null;
if (!is_null($this->_sql->orderBy)) {
$orderBy = trim(sprintf($template, $this->_sql->getOrderBy()));
}
return $orderBy;
} | php | public function getOrderBy()
{
$template = "ORDER BY %s";
$orderBy = null;
if (!is_null($this->_sql->orderBy)) {
$orderBy = trim(sprintf($template, $this->_sql->getOrderBy()));
}
return $orderBy;
} | [
"public",
"function",
"getOrderBy",
"(",
")",
"{",
"$",
"template",
"=",
"\"ORDER BY %s\"",
";",
"$",
"orderBy",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_sql",
"->",
"orderBy",
")",
")",
"{",
"$",
"orderBy",
"=",
"trim",... | Returns the order by clause for this query
@return string The order by clause string | [
"Returns",
"the",
"order",
"by",
"clause",
"for",
"this",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L178-L186 |
229,369 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select.getGroupBy | public function getGroupBy()
{
$template = "GROUP BY %s";
$groupBy = null;
if (!is_null($this->_sql->groupBy)) {
$groupBy = trim(sprintf($template, $this->_sql->getGroupBy()));
}
return $groupBy;
} | php | public function getGroupBy()
{
$template = "GROUP BY %s";
$groupBy = null;
if (!is_null($this->_sql->groupBy)) {
$groupBy = trim(sprintf($template, $this->_sql->getGroupBy()));
}
return $groupBy;
} | [
"public",
"function",
"getGroupBy",
"(",
")",
"{",
"$",
"template",
"=",
"\"GROUP BY %s\"",
";",
"$",
"groupBy",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_sql",
"->",
"groupBy",
")",
")",
"{",
"$",
"groupBy",
"=",
"trim",... | Returns the group by clause for this query
@return string The group by clause string | [
"Returns",
"the",
"group",
"by",
"clause",
"for",
"this",
"query"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L193-L201 |
229,370 | slickframework/slick | src/Slick/Database/Query/Sql/Dialect/Standard/Select.php | Select._fixBlanks | protected function _fixBlanks($str)
{
$lines = explode(PHP_EOL, $str);
$clean = array();
foreach ($lines as $line) {
if (trim($line) != "") {
$clean[] = $line;
}
}
return implode(PHP_EOL, $clean);
} | php | protected function _fixBlanks($str)
{
$lines = explode(PHP_EOL, $str);
$clean = array();
foreach ($lines as $line) {
if (trim($line) != "") {
$clean[] = $line;
}
}
return implode(PHP_EOL, $clean);
} | [
"protected",
"function",
"_fixBlanks",
"(",
"$",
"str",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"$",
"str",
")",
";",
"$",
"clean",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",... | Removes the blank lines in the query string
@param string $str The query string to fix
@return string The fixed query string. | [
"Removes",
"the",
"blank",
"lines",
"in",
"the",
"query",
"string"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Database/Query/Sql/Dialect/Standard/Select.php#L227-L238 |
229,371 | lcobucci/content-negotiation-middleware | src/UnformattedResponse.php | UnformattedResponse.withAttribute | public function withAttribute(string $name, $value): self
{
return new self(
$this->decoratedResponse,
$this->unformattedContent,
[$name => $value] + $this->attributes
);
} | php | public function withAttribute(string $name, $value): self
{
return new self(
$this->decoratedResponse,
$this->unformattedContent,
[$name => $value] + $this->attributes
);
} | [
"public",
"function",
"withAttribute",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"$",
"this",
"->",
"decoratedResponse",
",",
"$",
"this",
"->",
"unformattedContent",
",",
"[",
"$",
"name",
"=>",
... | Returns an instance with the specified attribute
@param mixed $value | [
"Returns",
"an",
"instance",
"with",
"the",
"specified",
"attribute"
] | fdbe268786af4c59bbf82de92eab87a69855715b | https://github.com/lcobucci/content-negotiation-middleware/blob/fdbe268786af4c59bbf82de92eab87a69855715b/src/UnformattedResponse.php#L189-L196 |
229,372 | slickframework/slick | src/Slick/Form/InputFilter/Input.php | Input.isValid | public function isValid()
{
$filtered = $this->getValue();
$valid = $this->getValidatorChain()->isValid($filtered);
$this->_messages = $this->getValidatorChain()->getMessages();
return $valid;
} | php | public function isValid()
{
$filtered = $this->getValue();
$valid = $this->getValidatorChain()->isValid($filtered);
$this->_messages = $this->getValidatorChain()->getMessages();
return $valid;
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"filtered",
"=",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"$",
"valid",
"=",
"$",
"this",
"->",
"getValidatorChain",
"(",
")",
"->",
"isValid",
"(",
"$",
"filtered",
")",
";",
"$",
"this",
"... | Returns true if and only if the values passes all chain validation
@return boolean | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"values",
"passes",
"all",
"chain",
"validation"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/InputFilter/Input.php#L123-L129 |
229,373 | slickframework/slick | src/Slick/Form/InputFilter/Input.php | Input.getValue | public function getValue()
{
if (is_null($this->_filtered)) {
$this->_filtered = $this->getFilterChain()->filter($this->_value);
}
return $this->_filtered;
} | php | public function getValue()
{
if (is_null($this->_filtered)) {
$this->_filtered = $this->getFilterChain()->filter($this->_value);
}
return $this->_filtered;
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_filtered",
")",
")",
"{",
"$",
"this",
"->",
"_filtered",
"=",
"$",
"this",
"->",
"getFilterChain",
"(",
")",
"->",
"filter",
"(",
"$",
"this",
"->",
"... | Retrieves the input value
@return mixed | [
"Retrieves",
"the",
"input",
"value"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/InputFilter/Input.php#L150-L156 |
229,374 | slickframework/slick | src/Slick/Orm/Relation/HasMany.php | HasMany.onDelete | public function onDelete(Delete $event)
{
if ($this->isDependent()) {
$class = $this->getRelatedEntity();
/** @var Entity $entity */
$entity = new $class();
$fkField = $this->getForeignKey();
$pmk = $event->getTarget()->getPrimaryKey();
... | php | public function onDelete(Delete $event)
{
if ($this->isDependent()) {
$class = $this->getRelatedEntity();
/** @var Entity $entity */
$entity = new $class();
$fkField = $this->getForeignKey();
$pmk = $event->getTarget()->getPrimaryKey();
... | [
"public",
"function",
"onDelete",
"(",
"Delete",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDependent",
"(",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getRelatedEntity",
"(",
")",
";",
"/** @var Entity $entity */",
"$",
"entity"... | Runs before delete on entity event and deletes the children
records on related entity.
@param Delete $event | [
"Runs",
"before",
"delete",
"on",
"entity",
"event",
"and",
"deletes",
"the",
"children",
"records",
"on",
"related",
"entity",
"."
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Orm/Relation/HasMany.php#L102-L118 |
229,375 | letyii/yii2-rbac-mongodb | MongodbManager.php | MongodbManager.init | public function init() {
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db->getCollection($this->itemTable)->createIndex(['name' => 1], ['unique' => true]);
$this->db->getCollection($this->ruleTable)->createIndex(['name' => 1], ['unique' => t... | php | public function init() {
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db->getCollection($this->itemTable)->createIndex(['name' => 1], ['unique' => true]);
$this->db->getCollection($this->ruleTable)->createIndex(['name' => 1], ['unique' => t... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"db",
"=",
"Instance",
"::",
"ensure",
"(",
"$",
"this",
"->",
"db",
",",
"Connection",
"::",
"className",
"(",
")",
")",
";",
"$",
"this",
"->... | Initializes the application component.
This method overrides the parent implementation by establishing the database connection. | [
"Initializes",
"the",
"application",
"component",
".",
"This",
"method",
"overrides",
"the",
"parent",
"implementation",
"by",
"establishing",
"the",
"database",
"connection",
"."
] | a268f1018eae2a3ec473afd31a8f91f54cfacc08 | https://github.com/letyii/yii2-rbac-mongodb/blob/a268f1018eae2a3ec473afd31a8f91f54cfacc08/MongodbManager.php#L64-L69 |
229,376 | letyii/yii2-rbac-mongodb | MongodbManager.php | MongodbManager.getRoleAssigments | public function getRoleAssigments($roleName) {
$query = (new Query)->from($this->assignmentTable)
->where(['item_name' => $roleName]);
$assignments = [];
foreach ($query->all($this->db) as $row) {
$assignments[$row['user_id']] = new Assignment([
'u... | php | public function getRoleAssigments($roleName) {
$query = (new Query)->from($this->assignmentTable)
->where(['item_name' => $roleName]);
$assignments = [];
foreach ($query->all($this->db) as $row) {
$assignments[$row['user_id']] = new Assignment([
'u... | [
"public",
"function",
"getRoleAssigments",
"(",
"$",
"roleName",
")",
"{",
"$",
"query",
"=",
"(",
"new",
"Query",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"assignmentTable",
")",
"->",
"where",
"(",
"[",
"'item_name'",
"=>",
"$",
"roleName",
"]",
")... | Return all user assigment information for the specified role
@param string $roleName the role name
@return The assignment information. An empty array will be returned if there is no user assigned to the role. | [
"Return",
"all",
"user",
"assigment",
"information",
"for",
"the",
"specified",
"role"
] | a268f1018eae2a3ec473afd31a8f91f54cfacc08 | https://github.com/letyii/yii2-rbac-mongodb/blob/a268f1018eae2a3ec473afd31a8f91f54cfacc08/MongodbManager.php#L498-L512 |
229,377 | letyii/yii2-rbac-mongodb | MongodbManager.php | MongodbManager.buildTreeRole | public function buildTreeRole($item = NULL, $roleList = []) {
$tree = [];
$allParents = [];
if (empty($roleList))
$roleList = $this->getRoles();
if ($item == NULL) {
// Get all children
$childRoles = [];
$query = (new Query)->sele... | php | public function buildTreeRole($item = NULL, $roleList = []) {
$tree = [];
$allParents = [];
if (empty($roleList))
$roleList = $this->getRoles();
if ($item == NULL) {
// Get all children
$childRoles = [];
$query = (new Query)->sele... | [
"public",
"function",
"buildTreeRole",
"(",
"$",
"item",
"=",
"NULL",
",",
"$",
"roleList",
"=",
"[",
"]",
")",
"{",
"$",
"tree",
"=",
"[",
"]",
";",
"$",
"allParents",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"roleList",
")",
")",
"$"... | Build tree from item table
@param string $item
@param integer $level
@return array | [
"Build",
"tree",
"from",
"item",
"table"
] | a268f1018eae2a3ec473afd31a8f91f54cfacc08 | https://github.com/letyii/yii2-rbac-mongodb/blob/a268f1018eae2a3ec473afd31a8f91f54cfacc08/MongodbManager.php#L776-L832 |
229,378 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Clauses/WhereClause.php | WhereClause.addConditions | public function addConditions(array $conditions = array())
{
foreach ($conditions as $key => $condition) {
if (is_array($condition)) {
call_user_func_array(array($this, 'addCondition'), $condition);
} elseif (!$this->getBuilder()->getHelper()->isNumber($key)) {
... | php | public function addConditions(array $conditions = array())
{
foreach ($conditions as $key => $condition) {
if (is_array($condition)) {
call_user_func_array(array($this, 'addCondition'), $condition);
} elseif (!$this->getBuilder()->getHelper()->isNumber($key)) {
... | [
"public",
"function",
"addConditions",
"(",
"array",
"$",
"conditions",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"key",
"=>",
"$",
"condition",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"condition",
")",
")",
"... | Add contitions to the statement
I.E.
$this->o->addConditions(array(
'a = "b"',
array('x', 1),
array('x', '1', '!=')
));
@param array $conditions
@return PO\QueryBuilder\Clauses\WhereClause | [
"Add",
"contitions",
"to",
"the",
"statement",
"I",
".",
"E",
"."
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Clauses/WhereClause.php#L51-L64 |
229,379 | silverstripe/silverstripe-mobile | code/MobileSiteControllerExtension.php | MobileSiteControllerExtension.onAfterInit | public function onAfterInit() {
self::$is_mobile = false;
$config = SiteConfig::current_site_config();
$request = $this->owner->getRequest();
// If we've accessed the homepage as /home/, then we redirect to / and don't want to double redirect here
if ($this->owner->redirectedTo()) {
return;
}
// En... | php | public function onAfterInit() {
self::$is_mobile = false;
$config = SiteConfig::current_site_config();
$request = $this->owner->getRequest();
// If we've accessed the homepage as /home/, then we redirect to / and don't want to double redirect here
if ($this->owner->redirectedTo()) {
return;
}
// En... | [
"public",
"function",
"onAfterInit",
"(",
")",
"{",
"self",
"::",
"$",
"is_mobile",
"=",
"false",
";",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"owner",
"->",
"getRequest",
"(",... | Override the default behavior to ensure that if this is a mobile device
or if they are on the configured mobile domain then they receive the mobile site. | [
"Override",
"the",
"default",
"behavior",
"to",
"ensure",
"that",
"if",
"this",
"is",
"a",
"mobile",
"device",
"or",
"if",
"they",
"are",
"on",
"the",
"configured",
"mobile",
"domain",
"then",
"they",
"receive",
"the",
"mobile",
"site",
"."
] | 27822812aa7d178e4e9d1e7e1b63c2836b4deb21 | https://github.com/silverstripe/silverstripe-mobile/blob/27822812aa7d178e4e9d1e7e1b63c2836b4deb21/code/MobileSiteControllerExtension.php#L26-L93 |
229,380 | silverstripe/silverstripe-mobile | code/MobileSiteControllerExtension.php | MobileSiteControllerExtension.requestedMobileSite | public function requestedMobileSite() {
$config = SiteConfig::current_site_config();
if ($config->MobileSiteType == 'Disabled') return false;
$request = $this->owner->getRequest();
$fullSite = $request->getVar('fullSite');
if (is_numeric($fullSite)) {
return ($fullSite == 0);
}
$fullSiteCookie = Co... | php | public function requestedMobileSite() {
$config = SiteConfig::current_site_config();
if ($config->MobileSiteType == 'Disabled') return false;
$request = $this->owner->getRequest();
$fullSite = $request->getVar('fullSite');
if (is_numeric($fullSite)) {
return ($fullSite == 0);
}
$fullSiteCookie = Co... | [
"public",
"function",
"requestedMobileSite",
"(",
")",
"{",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"if",
"(",
"$",
"config",
"->",
"MobileSiteType",
"==",
"'Disabled'",
")",
"return",
"false",
";",
"$",
"request",
"=",
... | Return whether the user is requesting the mobile site - either by query string
or by saved cookie. Falls back to browser detection for first time visitors
@return boolean | [
"Return",
"whether",
"the",
"user",
"is",
"requesting",
"the",
"mobile",
"site",
"-",
"either",
"by",
"query",
"string",
"or",
"by",
"saved",
"cookie",
".",
"Falls",
"back",
"to",
"browser",
"detection",
"for",
"first",
"time",
"visitors"
] | 27822812aa7d178e4e9d1e7e1b63c2836b4deb21 | https://github.com/silverstripe/silverstripe-mobile/blob/27822812aa7d178e4e9d1e7e1b63c2836b4deb21/code/MobileSiteControllerExtension.php#L111-L127 |
229,381 | slickframework/slick | src/Slick/Version/Version.php | Version.compare | public static function compare($version)
{
$version = strtolower($version);
$version = preg_replace('/(\d)pr(\d?)/', '$1a$2', $version);
return version_compare($version, strtolower(static::VERSION));
} | php | public static function compare($version)
{
$version = strtolower($version);
$version = preg_replace('/(\d)pr(\d?)/', '$1a$2', $version);
return version_compare($version, strtolower(static::VERSION));
} | [
"public",
"static",
"function",
"compare",
"(",
"$",
"version",
")",
"{",
"$",
"version",
"=",
"strtolower",
"(",
"$",
"version",
")",
";",
"$",
"version",
"=",
"preg_replace",
"(",
"'/(\\d)pr(\\d?)/'",
",",
"'$1a$2'",
",",
"$",
"version",
")",
";",
"ret... | Compare the provided version with current Slick version
@param string $version
@return int -1 if the $version is older,
0 if they are the same,
and +1 if $version is newer. | [
"Compare",
"the",
"provided",
"version",
"with",
"current",
"Slick",
"version"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Version/Version.php#L43-L48 |
229,382 | emgag/flysystem-hash | src/HashPlugin.php | HashPlugin.handle | public function handle($path, $algo = 'sha256')
{
if (!in_array($algo, hash_algos())) {
throw new \InvalidArgumentException('Hash algorithm ' . $algo . ' is not supported');
}
$stream = $this->filesystem->readStream($path);
if ($stream === false) {
return fa... | php | public function handle($path, $algo = 'sha256')
{
if (!in_array($algo, hash_algos())) {
throw new \InvalidArgumentException('Hash algorithm ' . $algo . ' is not supported');
}
$stream = $this->filesystem->readStream($path);
if ($stream === false) {
return fa... | [
"public",
"function",
"handle",
"(",
"$",
"path",
",",
"$",
"algo",
"=",
"'sha256'",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"algo",
",",
"hash_algos",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Hash algor... | Returns hash value of given path using supplied hash algorithm
@param string $path
@param string $algo any algorithm supported by hash()
@return string|bool
@see http://php.net/hash | [
"Returns",
"hash",
"value",
"of",
"given",
"path",
"using",
"supplied",
"hash",
"algorithm"
] | 88763a3cb2605e2f9ad61debc34b41a1f41126d1 | https://github.com/emgag/flysystem-hash/blob/88763a3cb2605e2f9ad61debc34b41a1f41126d1/src/HashPlugin.php#L29-L45 |
229,383 | odan/database | src/Database/Schema.php | Schema.setDatabase | public function setDatabase(string $dbName): bool
{
$this->db->exec('USE ' . $this->quoter->quoteName($dbName) . ';');
return true;
} | php | public function setDatabase(string $dbName): bool
{
$this->db->exec('USE ' . $this->quoter->quoteName($dbName) . ';');
return true;
} | [
"public",
"function",
"setDatabase",
"(",
"string",
"$",
"dbName",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"db",
"->",
"exec",
"(",
"'USE '",
".",
"$",
"this",
"->",
"quoter",
"->",
"quoteName",
"(",
"$",
"dbName",
")",
".",
"';'",
")",
";",
"ret... | Switch database.
@param string $dbName
@return bool | [
"Switch",
"database",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L40-L45 |
229,384 | odan/database | src/Database/Schema.php | Schema.getDatabases | public function getDatabases(string $like = null): array
{
$sql = 'SHOW DATABASES;';
if ($like !== null) {
$sql = sprintf('SHOW DATABASES WHERE `database` LIKE %s;', $this->quoter->quoteValue($like));
}
return $this->db->queryValues($sql, 'Database');
} | php | public function getDatabases(string $like = null): array
{
$sql = 'SHOW DATABASES;';
if ($like !== null) {
$sql = sprintf('SHOW DATABASES WHERE `database` LIKE %s;', $this->quoter->quoteValue($like));
}
return $this->db->queryValues($sql, 'Database');
} | [
"public",
"function",
"getDatabases",
"(",
"string",
"$",
"like",
"=",
"null",
")",
":",
"array",
"{",
"$",
"sql",
"=",
"'SHOW DATABASES;'",
";",
"if",
"(",
"$",
"like",
"!==",
"null",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SHOW DATABASES WHERE `da... | Returns all databases.
@param string|null $like (optional) e.g. 'information%schema';
@return array | [
"Returns",
"all",
"databases",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L83-L91 |
229,385 | odan/database | src/Database/Schema.php | Schema.createDatabase | public function createDatabase(
string $dbName,
string $characterSet = 'utf8mb4',
string $collate = 'utf8mb4_unicode_ci'
): bool {
$sql = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s;';
$sql = vsprintf($sql, [
$this->quoter->quoteName($dbName),
$thi... | php | public function createDatabase(
string $dbName,
string $characterSet = 'utf8mb4',
string $collate = 'utf8mb4_unicode_ci'
): bool {
$sql = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s;';
$sql = vsprintf($sql, [
$this->quoter->quoteName($dbName),
$thi... | [
"public",
"function",
"createDatabase",
"(",
"string",
"$",
"dbName",
",",
"string",
"$",
"characterSet",
"=",
"'utf8mb4'",
",",
"string",
"$",
"collate",
"=",
"'utf8mb4_unicode_ci'",
")",
":",
"bool",
"{",
"$",
"sql",
"=",
"'CREATE DATABASE %s CHARACTER SET %s CO... | Create a database.
@param string $dbName The database name
@param string $characterSet
@param string $collate
@return bool Success | [
"Create",
"a",
"database",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L102-L115 |
229,386 | odan/database | src/Database/Schema.php | Schema.useDatabase | public function useDatabase(string $dbName): bool
{
$sql = sprintf('USE %s;', $this->quoter->quoteName($dbName));
$result = $this->db->exec($sql);
return (bool)$result;
} | php | public function useDatabase(string $dbName): bool
{
$sql = sprintf('USE %s;', $this->quoter->quoteName($dbName));
$result = $this->db->exec($sql);
return (bool)$result;
} | [
"public",
"function",
"useDatabase",
"(",
"string",
"$",
"dbName",
")",
":",
"bool",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'USE %s;'",
",",
"$",
"this",
"->",
"quoter",
"->",
"quoteName",
"(",
"$",
"dbName",
")",
")",
";",
"$",
"result",
"=",
"$",
... | Change the database.
@param string $dbName The database name
@return bool Success | [
"Change",
"the",
"database",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L124-L130 |
229,387 | odan/database | src/Database/Schema.php | Schema.getTables | public function getTables($like = null): array
{
if ($like === null) {
$sql = 'SELECT table_name
FROM information_schema.tables
WHERE table_schema = database()';
} else {
$sql = sprintf('SELECT table_name
FROM information_schema... | php | public function getTables($like = null): array
{
if ($like === null) {
$sql = 'SELECT table_name
FROM information_schema.tables
WHERE table_schema = database()';
} else {
$sql = sprintf('SELECT table_name
FROM information_schema... | [
"public",
"function",
"getTables",
"(",
"$",
"like",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"$",
"like",
"===",
"null",
")",
"{",
"$",
"sql",
"=",
"'SELECT table_name\n FROM information_schema.tables\n WHERE table_schema = database... | Return all Tables from Database.
@param string $like (optional) e.g. 'information%'
@return array | [
"Return",
"all",
"Tables",
"from",
"Database",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L139-L153 |
229,388 | odan/database | src/Database/Schema.php | Schema.existTable | public function existTable(string $tableName): bool
{
[$dbName, $tableName] = $this->parseTableName($tableName);
$sql = 'SELECT table_name
FROM information_schema.tables
WHERE table_schema = %s
AND table_name = %s;';
$sql = sprintf($sql, $dbName, $tableN... | php | public function existTable(string $tableName): bool
{
[$dbName, $tableName] = $this->parseTableName($tableName);
$sql = 'SELECT table_name
FROM information_schema.tables
WHERE table_schema = %s
AND table_name = %s;';
$sql = sprintf($sql, $dbName, $tableN... | [
"public",
"function",
"existTable",
"(",
"string",
"$",
"tableName",
")",
":",
"bool",
"{",
"[",
"$",
"dbName",
",",
"$",
"tableName",
"]",
"=",
"$",
"this",
"->",
"parseTableName",
"(",
"$",
"tableName",
")",
";",
"$",
"sql",
"=",
"'SELECT table_name\n ... | Check if table exist.
@param string $tableName
@return bool | [
"Check",
"if",
"table",
"exist",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L162-L175 |
229,389 | odan/database | src/Database/Schema.php | Schema.parseTableName | protected function parseTableName(string $tableName): array
{
$dbName = 'database()';
if (strpos($tableName, '.') !== false) {
$parts = explode('.', $tableName);
$dbName = $this->quoter->quoteValue($parts[0]);
$tableName = $this->quoter->quoteValue($parts[1]);
... | php | protected function parseTableName(string $tableName): array
{
$dbName = 'database()';
if (strpos($tableName, '.') !== false) {
$parts = explode('.', $tableName);
$dbName = $this->quoter->quoteValue($parts[0]);
$tableName = $this->quoter->quoteValue($parts[1]);
... | [
"protected",
"function",
"parseTableName",
"(",
"string",
"$",
"tableName",
")",
":",
"array",
"{",
"$",
"dbName",
"=",
"'database()'",
";",
"if",
"(",
"strpos",
"(",
"$",
"tableName",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"parts",
"=",
"expl... | Split table into dbname and table name.
@param string $tableName table
@return array | [
"Split",
"table",
"into",
"dbname",
"and",
"table",
"name",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L184-L196 |
229,390 | odan/database | src/Database/Schema.php | Schema.dropTable | public function dropTable(string $tableName): bool
{
$this->db->exec(sprintf('DROP TABLE IF EXISTS %s;', $this->quoter->quoteName($tableName)));
return true;
} | php | public function dropTable(string $tableName): bool
{
$this->db->exec(sprintf('DROP TABLE IF EXISTS %s;', $this->quoter->quoteName($tableName)));
return true;
} | [
"public",
"function",
"dropTable",
"(",
"string",
"$",
"tableName",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"db",
"->",
"exec",
"(",
"sprintf",
"(",
"'DROP TABLE IF EXISTS %s;'",
",",
"$",
"this",
"->",
"quoter",
"->",
"quoteName",
"(",
"$",
"tableName",... | Delete a table.
@param string $tableName
@return bool Success | [
"Delete",
"a",
"table",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L205-L210 |
229,391 | odan/database | src/Database/Schema.php | Schema.clearTable | public function clearTable(string $tableName): bool
{
$delete = new DeleteQuery($this->db);
return $delete->from($tableName)->execute();
} | php | public function clearTable(string $tableName): bool
{
$delete = new DeleteQuery($this->db);
return $delete->from($tableName)->execute();
} | [
"public",
"function",
"clearTable",
"(",
"string",
"$",
"tableName",
")",
":",
"bool",
"{",
"$",
"delete",
"=",
"new",
"DeleteQuery",
"(",
"$",
"this",
"->",
"db",
")",
";",
"return",
"$",
"delete",
"->",
"from",
"(",
"$",
"tableName",
")",
"->",
"ex... | Clear table content. Delete all rows.
@param string $tableName
@return bool Success
@deprecated Use DeleteQuery instead | [
"Clear",
"table",
"content",
".",
"Delete",
"all",
"rows",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L221-L226 |
229,392 | odan/database | src/Database/Schema.php | Schema.renameTable | public function renameTable(string $from, string $to): bool
{
$from = $this->quoter->quoteName($from);
$to = $this->quoter->quoteName($to);
$this->db->exec(sprintf('RENAME TABLE %s TO %s;', $from, $to));
return true;
} | php | public function renameTable(string $from, string $to): bool
{
$from = $this->quoter->quoteName($from);
$to = $this->quoter->quoteName($to);
$this->db->exec(sprintf('RENAME TABLE %s TO %s;', $from, $to));
return true;
} | [
"public",
"function",
"renameTable",
"(",
"string",
"$",
"from",
",",
"string",
"$",
"to",
")",
":",
"bool",
"{",
"$",
"from",
"=",
"$",
"this",
"->",
"quoter",
"->",
"quoteName",
"(",
"$",
"from",
")",
";",
"$",
"to",
"=",
"$",
"this",
"->",
"qu... | Rename table.
@param string $from Old table name
@param string $to New table name
@return bool Success | [
"Rename",
"table",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L251-L258 |
229,393 | odan/database | src/Database/Schema.php | Schema.copyTable | public function copyTable(string $tableNameSource, string $tableNameDestination): bool
{
$tableNameSource = $this->quoter->quoteName($tableNameSource);
$tableNameDestination = $this->quoter->quoteName($tableNameDestination);
$this->db->exec(sprintf('CREATE TABLE %s LIKE %s;', $tableNameDesti... | php | public function copyTable(string $tableNameSource, string $tableNameDestination): bool
{
$tableNameSource = $this->quoter->quoteName($tableNameSource);
$tableNameDestination = $this->quoter->quoteName($tableNameDestination);
$this->db->exec(sprintf('CREATE TABLE %s LIKE %s;', $tableNameDesti... | [
"public",
"function",
"copyTable",
"(",
"string",
"$",
"tableNameSource",
",",
"string",
"$",
"tableNameDestination",
")",
":",
"bool",
"{",
"$",
"tableNameSource",
"=",
"$",
"this",
"->",
"quoter",
"->",
"quoteName",
"(",
"$",
"tableNameSource",
")",
";",
"... | Copy an existing table to a new table.
@param string $tableNameSource source table name
@param string $tableNameDestination new table name
@return bool Success | [
"Copy",
"an",
"existing",
"table",
"to",
"a",
"new",
"table",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L268-L275 |
229,394 | odan/database | src/Database/Schema.php | Schema.getColumnNames | public function getColumnNames(string $tableName): array
{
$result = [];
foreach ($this->getColumns($tableName) as $value) {
$field = $value['column_name'];
$result[$field] = $field;
}
return $result;
} | php | public function getColumnNames(string $tableName): array
{
$result = [];
foreach ($this->getColumns($tableName) as $value) {
$field = $value['column_name'];
$result[$field] = $field;
}
return $result;
} | [
"public",
"function",
"getColumnNames",
"(",
"string",
"$",
"tableName",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getColumns",
"(",
"$",
"tableName",
")",
"as",
"$",
"value",
")",
"{",
"$",
"field... | Returns the column names of a table as an array.
@param string $tableName
@return array | [
"Returns",
"the",
"column",
"names",
"of",
"a",
"table",
"as",
"an",
"array",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L284-L293 |
229,395 | odan/database | src/Database/Schema.php | Schema.getColumns | public function getColumns(string $tableName): array
{
$sql = 'SELECT
column_name,
column_default,
is_nullable,
data_type,
character_maximum_length,
character_octet_length,
numeric_precision,
numeric_scale,
... | php | public function getColumns(string $tableName): array
{
$sql = 'SELECT
column_name,
column_default,
is_nullable,
data_type,
character_maximum_length,
character_octet_length,
numeric_precision,
numeric_scale,
... | [
"public",
"function",
"getColumns",
"(",
"string",
"$",
"tableName",
")",
":",
"array",
"{",
"$",
"sql",
"=",
"'SELECT\n column_name,\n column_default,\n is_nullable,\n data_type,\n character_maximum_length,\n character_oc... | Returns all columns in a table.
@param string $tableName
@return array | [
"Returns",
"all",
"columns",
"in",
"a",
"table",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L302-L330 |
229,396 | odan/database | src/Database/Schema.php | Schema.compareTableSchema | public function compareTableSchema(string $tableName1, string $tableName2): bool
{
$schema1 = $this->getTableSchemaId($tableName1);
$schema2 = $this->getTableSchemaId($tableName2);
return $schema1 === $schema2;
} | php | public function compareTableSchema(string $tableName1, string $tableName2): bool
{
$schema1 = $this->getTableSchemaId($tableName1);
$schema2 = $this->getTableSchemaId($tableName2);
return $schema1 === $schema2;
} | [
"public",
"function",
"compareTableSchema",
"(",
"string",
"$",
"tableName1",
",",
"string",
"$",
"tableName2",
")",
":",
"bool",
"{",
"$",
"schema1",
"=",
"$",
"this",
"->",
"getTableSchemaId",
"(",
"$",
"tableName1",
")",
";",
"$",
"schema2",
"=",
"$",
... | Compare two tables and returns true if the table schema match.
@param string $tableName1
@param string $tableName2
@return bool Status | [
"Compare",
"two",
"tables",
"and",
"returns",
"true",
"if",
"the",
"table",
"schema",
"match",
"."
] | e514fb45ab72718a77b34ed2c44906f5159e8278 | https://github.com/odan/database/blob/e514fb45ab72718a77b34ed2c44906f5159e8278/src/Database/Schema.php#L340-L346 |
229,397 | cgsmith/zf1-recaptcha-2 | src/Cgsmith/Validate/Recaptcha.php | Recaptcha.isValid | public function isValid($value, $context = null) {
$frontController = \Zend_Controller_Front::getInstance();
$request = $frontController->getRequest();
$value = $request->getParam('g-recaptcha-response');
if (empty($value)) {
$this->_error(self::CAPTCHA_EMPTY);
re... | php | public function isValid($value, $context = null) {
$frontController = \Zend_Controller_Front::getInstance();
$request = $frontController->getRequest();
$value = $request->getParam('g-recaptcha-response');
if (empty($value)) {
$this->_error(self::CAPTCHA_EMPTY);
re... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
",",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"frontController",
"=",
"\\",
"Zend_Controller_Front",
"::",
"getInstance",
"(",
")",
";",
"$",
"request",
"=",
"$",
"frontController",
"->",
"getRequest",
... | Validate our form's element
@param mixed $value
@param null $context
@return bool | [
"Validate",
"our",
"form",
"s",
"element"
] | fa2ab15df2dd27943e9ea61a7790c3566d78b19a | https://github.com/cgsmith/zf1-recaptcha-2/blob/fa2ab15df2dd27943e9ea61a7790c3566d78b19a/src/Cgsmith/Validate/Recaptcha.php#L54-L70 |
229,398 | cgsmith/zf1-recaptcha-2 | src/Cgsmith/Validate/Recaptcha.php | Recaptcha._verify | protected function _verify($value) {
$queryString = http_build_query([
'secret' => $this->_secretKey,
'response' => $value,
'remoteIp' => $_SERVER['REMOTE_ADDR']
]);
/**
* PHP 5.6.0 changed the way you specify the peer name for SSL context options.... | php | protected function _verify($value) {
$queryString = http_build_query([
'secret' => $this->_secretKey,
'response' => $value,
'remoteIp' => $_SERVER['REMOTE_ADDR']
]);
/**
* PHP 5.6.0 changed the way you specify the peer name for SSL context options.... | [
"protected",
"function",
"_verify",
"(",
"$",
"value",
")",
"{",
"$",
"queryString",
"=",
"http_build_query",
"(",
"[",
"'secret'",
"=>",
"$",
"this",
"->",
"_secretKey",
",",
"'response'",
"=>",
"$",
"value",
",",
"'remoteIp'",
"=>",
"$",
"_SERVER",
"[",
... | Calls the reCAPTCHA siteverify API to verify whether the user passes the captcha test.
@param mixed $value
@return boolean
@link https://github.com/google/recaptcha | [
"Calls",
"the",
"reCAPTCHA",
"siteverify",
"API",
"to",
"verify",
"whether",
"the",
"user",
"passes",
"the",
"captcha",
"test",
"."
] | fa2ab15df2dd27943e9ea61a7790c3566d78b19a | https://github.com/cgsmith/zf1-recaptcha-2/blob/fa2ab15df2dd27943e9ea61a7790c3566d78b19a/src/Cgsmith/Validate/Recaptcha.php#L80-L104 |
229,399 | chadicus/marvel-api-client | src/Entities/Comic.php | Comic.findAll | final public static function findAll(Api\Client $client, array $criteria = []) : Api\Collection
{
$filters = [
'format' => [
[
'in',
[
'comic', 'hardcover', 'trade paperback', 'magazine', 'digest',
... | php | final public static function findAll(Api\Client $client, array $criteria = []) : Api\Collection
{
$filters = [
'format' => [
[
'in',
[
'comic', 'hardcover', 'trade paperback', 'magazine', 'digest',
... | [
"final",
"public",
"static",
"function",
"findAll",
"(",
"Api",
"\\",
"Client",
"$",
"client",
",",
"array",
"$",
"criteria",
"=",
"[",
"]",
")",
":",
"Api",
"\\",
"Collection",
"{",
"$",
"filters",
"=",
"[",
"'format'",
"=>",
"[",
"[",
"'in'",
",",
... | Returns a collection containing all Comics which match the given criteria.
@param Api\Client $client The API Client.
@param array $criteria The criteria for searching.
@return Api\Collection | [
"Returns",
"a",
"collection",
"containing",
"all",
"Comics",
"which",
"match",
"the",
"given",
"criteria",
"."
] | a27729f070c0a3f14b2d2df3a3961590e2d59cb2 | https://github.com/chadicus/marvel-api-client/blob/a27729f070c0a3f14b2d2df3a3961590e2d59cb2/src/Entities/Comic.php#L103-L151 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.