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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,500 | titon/model | src/Titon/Model/Model.php | Model.fill | public function fill(array $data) {
if ($this->isFullyGuarded()) {
throw new MassAssignmentException(sprintf('Cannot assign attributes as %s is locked', get_class($this)));
}
foreach ($data as $key => $value) {
if ($this->isFillable($key) && !$this->isGuarded($key)) {
... | php | public function fill(array $data) {
if ($this->isFullyGuarded()) {
throw new MassAssignmentException(sprintf('Cannot assign attributes as %s is locked', get_class($this)));
}
foreach ($data as $key => $value) {
if ($this->isFillable($key) && !$this->isGuarded($key)) {
... | [
"public",
"function",
"fill",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFullyGuarded",
"(",
")",
")",
"{",
"throw",
"new",
"MassAssignmentException",
"(",
"sprintf",
"(",
"'Cannot assign attributes as %s is locked'",
",",
"get_class",... | Fill the model with data to be sent to the database layer.
@param array $data
@return \Titon\Model\Model
@throws \Titon\Model\Exception\MassAssignmentException | [
"Fill",
"the",
"model",
"with",
"data",
"to",
"be",
"sent",
"to",
"the",
"database",
"layer",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L419-L431 |
5,501 | titon/model | src/Titon/Model/Model.php | Model.flush | public function flush() {
$this->_attributes = [];
$this->_original = [];
$this->_changed = false;
$this->_exists = false;
$this->_errors = [];
$this->_validator = null;
return $this;
} | php | public function flush() {
$this->_attributes = [];
$this->_original = [];
$this->_changed = false;
$this->_exists = false;
$this->_errors = [];
$this->_validator = null;
return $this;
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"$",
"this",
"->",
"_attributes",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"_original",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"_changed",
"=",
"false",
";",
"$",
"this",
"->",
"_exists",
"=",
"false",
... | Empty all data in the model.
@return \Titon\Model\Model | [
"Empty",
"all",
"data",
"in",
"the",
"model",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L438-L447 |
5,502 | titon/model | src/Titon/Model/Model.php | Model.get | public function get($key) {
$value = null;
// If the key already exists in the attribute list, return it immediately
if ($this->has($key)) {
$value = $this->_attributes[$key];
}
// If the key being accessed points to a relation, either lazy load the data or return t... | php | public function get($key) {
$value = null;
// If the key already exists in the attribute list, return it immediately
if ($this->has($key)) {
$value = $this->_attributes[$key];
}
// If the key being accessed points to a relation, either lazy load the data or return t... | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"null",
";",
"// If the key already exists in the attribute list, return it immediately",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"value",
"=",
"$",
... | Get an attribute on the model. If the attribute points to a relation,
fetch the related records through the relation object.
If an accessor is defined, pass the non-relation attribute through it.
@param string $key
@return mixed | [
"Get",
"an",
"attribute",
"on",
"the",
"model",
".",
"If",
"the",
"attribute",
"points",
"to",
"a",
"relation",
"fetch",
"the",
"related",
"records",
"through",
"the",
"relation",
"object",
".",
"If",
"an",
"accessor",
"is",
"defined",
"pass",
"the",
"non"... | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L457-L477 |
5,503 | titon/model | src/Titon/Model/Model.php | Model.getChanged | public function getChanged() {
$attributes = [];
if ($this->changed()) {
$attributes = array_diff_assoc($this->_attributes, $this->_original);
// Remove reserved attributes
$attributes = Hash::exclude($attributes, $this->reserved);
}
return $attribu... | php | public function getChanged() {
$attributes = [];
if ($this->changed()) {
$attributes = array_diff_assoc($this->_attributes, $this->_original);
// Remove reserved attributes
$attributes = Hash::exclude($attributes, $this->reserved);
}
return $attribu... | [
"public",
"function",
"getChanged",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"changed",
"(",
")",
")",
"{",
"$",
"attributes",
"=",
"array_diff_assoc",
"(",
"$",
"this",
"->",
"_attributes",
",",
"$",
"this"... | Return an array of data that only includes attributes that have changed.
@return array | [
"Return",
"an",
"array",
"of",
"data",
"that",
"only",
"includes",
"attributes",
"that",
"have",
"changed",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L499-L510 |
5,504 | titon/model | src/Titon/Model/Model.php | Model.getRelation | public function getRelation($alias) {
if ($this->hasRelation($alias)) {
return $this->_relations[$alias];
}
throw new MissingRelationException(sprintf('Repository relation %s does not exist', $alias));
} | php | public function getRelation($alias) {
if ($this->hasRelation($alias)) {
return $this->_relations[$alias];
}
throw new MissingRelationException(sprintf('Repository relation %s does not exist', $alias));
} | [
"public",
"function",
"getRelation",
"(",
"$",
"alias",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasRelation",
"(",
"$",
"alias",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_relations",
"[",
"$",
"alias",
"]",
";",
"}",
"throw",
"new",
"MissingRela... | Return a relation by alias.
@param string $alias
@return \Titon\Model\Relation
@throws \Titon\Model\Exception\MissingRelationException | [
"Return",
"a",
"relation",
"by",
"alias",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L585-L591 |
5,505 | titon/model | src/Titon/Model/Model.php | Model.getRelations | public function getRelations($type = null) {
if (!$type) {
return $this->_relations;
}
$relations = [];
foreach ($this->_relations as $relation) {
if ($relation->getType() === $type) {
$relations[$relation->getAlias()] = $relation;
}
... | php | public function getRelations($type = null) {
if (!$type) {
return $this->_relations;
}
$relations = [];
foreach ($this->_relations as $relation) {
if ($relation->getType() === $type) {
$relations[$relation->getAlias()] = $relation;
}
... | [
"public",
"function",
"getRelations",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"type",
")",
"{",
"return",
"$",
"this",
"->",
"_relations",
";",
"}",
"$",
"relations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_... | Return all relations, or all relations by type.
@param string $type
@return \Titon\Model\Relation[] | [
"Return",
"all",
"relations",
"or",
"all",
"relations",
"by",
"type",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L599-L613 |
5,506 | titon/model | src/Titon/Model/Model.php | Model.getValidator | public function getValidator() {
if (!$this->_validator) {
$this->setValidator(Validator::makeFromShorthand([], $this->validate));
}
return $this->_validator;
} | php | public function getValidator() {
if (!$this->_validator) {
$this->setValidator(Validator::makeFromShorthand([], $this->validate));
}
return $this->_validator;
} | [
"public",
"function",
"getValidator",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_validator",
")",
"{",
"$",
"this",
"->",
"setValidator",
"(",
"Validator",
"::",
"makeFromShorthand",
"(",
"[",
"]",
",",
"$",
"this",
"->",
"validate",
")",
")",... | Return the validator instance.
@return \Titon\Utility\Validator | [
"Return",
"the",
"validator",
"instance",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L638-L644 |
5,507 | titon/model | src/Titon/Model/Model.php | Model.hasMutator | public function hasMutator($field) {
$method = sprintf('set%sAttribute', Inflector::camelCase($field));
if (method_exists($this, $method)) {
return $method;
}
return null;
} | php | public function hasMutator($field) {
$method = sprintf('set%sAttribute', Inflector::camelCase($field));
if (method_exists($this, $method)) {
return $method;
}
return null;
} | [
"public",
"function",
"hasMutator",
"(",
"$",
"field",
")",
"{",
"$",
"method",
"=",
"sprintf",
"(",
"'set%sAttribute'",
",",
"Inflector",
"::",
"camelCase",
"(",
"$",
"field",
")",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"met... | Check to see if a mutator method exists on the current model.
If so, return the method name, else return null.
@param string $field
@return string | [
"Check",
"to",
"see",
"if",
"a",
"mutator",
"method",
"exists",
"on",
"the",
"current",
"model",
".",
"If",
"so",
"return",
"the",
"method",
"name",
"else",
"return",
"null",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L687-L695 |
5,508 | titon/model | src/Titon/Model/Model.php | Model.hasOne | public function hasOne($alias, $class, $relatedKey = null, Closure $conditions = null) {
$relation = (new OneToOne($alias, $class))
->setRelatedForeignKey($relatedKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($relati... | php | public function hasOne($alias, $class, $relatedKey = null, Closure $conditions = null) {
$relation = (new OneToOne($alias, $class))
->setRelatedForeignKey($relatedKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($relati... | [
"public",
"function",
"hasOne",
"(",
"$",
"alias",
",",
"$",
"class",
",",
"$",
"relatedKey",
"=",
"null",
",",
"Closure",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"relation",
"=",
"(",
"new",
"OneToOne",
"(",
"$",
"alias",
",",
"$",
"class",
... | Add a one-to-one relationship.
@param string $alias
@param string $class
@param string $relatedKey
@param \Closure $conditions
@return $this | [
"Add",
"a",
"one",
"-",
"to",
"-",
"one",
"relationship",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L706-L715 |
5,509 | titon/model | src/Titon/Model/Model.php | Model.hasMany | public function hasMany($alias, $class, $relatedKey = null, Closure $conditions = null) {
$relation = (new OneToMany($alias, $class))
->setRelatedForeignKey($relatedKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($rela... | php | public function hasMany($alias, $class, $relatedKey = null, Closure $conditions = null) {
$relation = (new OneToMany($alias, $class))
->setRelatedForeignKey($relatedKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($rela... | [
"public",
"function",
"hasMany",
"(",
"$",
"alias",
",",
"$",
"class",
",",
"$",
"relatedKey",
"=",
"null",
",",
"Closure",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"relation",
"=",
"(",
"new",
"OneToMany",
"(",
"$",
"alias",
",",
"$",
"class",... | Add a one-to-many relationship.
@param string $alias
@param string $class
@param string $relatedKey
@param \Closure $conditions
@return $this | [
"Add",
"a",
"one",
"-",
"to",
"-",
"many",
"relationship",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L726-L735 |
5,510 | titon/model | src/Titon/Model/Model.php | Model.link | public function link(Model $model) {
$this->getRelation($this->getAlias(get_class($model)))->link($model);
return $this;
} | php | public function link(Model $model) {
$this->getRelation($this->getAlias(get_class($model)))->link($model);
return $this;
} | [
"public",
"function",
"link",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"getRelation",
"(",
"$",
"this",
"->",
"getAlias",
"(",
"get_class",
"(",
"$",
"model",
")",
")",
")",
"->",
"link",
"(",
"$",
"model",
")",
";",
"return",
"$",
... | Link an external model to the primary model. Once the primary is saved, the links will be saved as well.
@param \Titon\Model\Model $model
@return $this
@throws \Titon\Model\Exception\MissingRelationException | [
"Link",
"an",
"external",
"model",
"to",
"the",
"primary",
"model",
".",
"Once",
"the",
"primary",
"is",
"saved",
"the",
"links",
"will",
"be",
"saved",
"as",
"well",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L837-L841 |
5,511 | titon/model | src/Titon/Model/Model.php | Model.linkMany | public function linkMany() {
$models = func_get_args();
if (is_array($models[0])) {
$models = $models[0];
}
foreach ($models as $model) {
$this->link($model);
}
return $this;
} | php | public function linkMany() {
$models = func_get_args();
if (is_array($models[0])) {
$models = $models[0];
}
foreach ($models as $model) {
$this->link($model);
}
return $this;
} | [
"public",
"function",
"linkMany",
"(",
")",
"{",
"$",
"models",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"models",
"[",
"0",
"]",
")",
")",
"{",
"$",
"models",
"=",
"$",
"models",
"[",
"0",
"]",
";",
"}",
"foreach",
... | Link multiple models at once.
@return $this | [
"Link",
"multiple",
"models",
"at",
"once",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L848-L860 |
5,512 | titon/model | src/Titon/Model/Model.php | Model.loadRelations | public function loadRelations() {
foreach ([
Relation::MANY_TO_ONE => $this->belongsTo,
Relation::MANY_TO_MANY => $this->belongsToMany,
Relation::ONE_TO_ONE => $this->hasOne,
Relation::ONE_TO_MANY => $this->hasMany
] as $type => $relations) {
f... | php | public function loadRelations() {
foreach ([
Relation::MANY_TO_ONE => $this->belongsTo,
Relation::MANY_TO_MANY => $this->belongsToMany,
Relation::ONE_TO_ONE => $this->hasOne,
Relation::ONE_TO_MANY => $this->hasMany
] as $type => $relations) {
f... | [
"public",
"function",
"loadRelations",
"(",
")",
"{",
"foreach",
"(",
"[",
"Relation",
"::",
"MANY_TO_ONE",
"=>",
"$",
"this",
"->",
"belongsTo",
",",
"Relation",
"::",
"MANY_TO_MANY",
"=>",
"$",
"this",
"->",
"belongsToMany",
",",
"Relation",
"::",
"ONE_TO_... | Load relationships by reflecting current model properties.
@return \Titon\Model\Model | [
"Load",
"relationships",
"by",
"reflecting",
"current",
"model",
"properties",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L867-L905 |
5,513 | titon/model | src/Titon/Model/Model.php | Model.mapData | public function mapData(array $data) {
$this->flush();
if (!empty($data[$this->primaryKey])) {
$this->_exists = true;
}
$this->_original = Hash::exclude($data, $this->reserved);
$this->_attributes = $data;
return $this;
} | php | public function mapData(array $data) {
$this->flush();
if (!empty($data[$this->primaryKey])) {
$this->_exists = true;
}
$this->_original = Hash::exclude($data, $this->reserved);
$this->_attributes = $data;
return $this;
} | [
"public",
"function",
"mapData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"flush",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
"[",
"$",
"this",
"->",
"primaryKey",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_exists",
... | When data is mapped through the constructor, set the exists flag if necessary,
and save the original data state to monitor for changes.
@param array $data
@return $this | [
"When",
"data",
"is",
"mapped",
"through",
"the",
"constructor",
"set",
"the",
"exists",
"flag",
"if",
"necessary",
"and",
"save",
"the",
"original",
"data",
"state",
"to",
"monitor",
"for",
"changes",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L914-L925 |
5,514 | titon/model | src/Titon/Model/Model.php | Model.save | public function save(array $options = []) {
$options = $options + ['validate' => true, 'atomic' => true, 'force' => false];
$passed = $options['validate'] ? $this->validate() : true;
// Validation failed, exit early
if (!$passed) {
return 0;
}
// Save fields... | php | public function save(array $options = []) {
$options = $options + ['validate' => true, 'atomic' => true, 'force' => false];
$passed = $options['validate'] ? $this->validate() : true;
// Validation failed, exit early
if (!$passed) {
return 0;
}
// Save fields... | [
"public",
"function",
"save",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'validate'",
"=>",
"true",
",",
"'atomic'",
"=>",
"true",
",",
"'force'",
"=>",
"false",
"]",
";",
"$",
"passed",
"... | Save a record to the database table using the data that has been set to the model.
Will return the record ID or 0 on failure.
@see \Titon\Db\Repository::upsert()
@param array $options {
@type bool $validate Will validate the current record of data before saving
@type bool $atomic Will wrap the save query and ... | [
"Save",
"a",
"record",
"to",
"the",
"database",
"table",
"using",
"the",
"data",
"that",
"has",
"been",
"set",
"to",
"the",
"model",
".",
"Will",
"return",
"the",
"record",
"ID",
"or",
"0",
"on",
"failure",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1119-L1169 |
5,515 | titon/model | src/Titon/Model/Model.php | Model.set | public function set($key, $value = null) {
// Do not trigger state changes for relations
if (!$this->hasRelation($key)) {
// Only flag changed if the value is different
if ($value != $this->get($key) && !in_array($key, $this->reserved)) {
$this->_changed = true;... | php | public function set($key, $value = null) {
// Do not trigger state changes for relations
if (!$this->hasRelation($key)) {
// Only flag changed if the value is different
if ($value != $this->get($key) && !in_array($key, $this->reserved)) {
$this->_changed = true;... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"// Do not trigger state changes for relations",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRelation",
"(",
"$",
"key",
")",
")",
"{",
"// Only flag changed if the value is diffe... | Set an attribute defined by key. If the key does not point to a relation,
pass the value through a mutator and set a changed flag.
@param string $key
@param mixed $value
@return $this | [
"Set",
"an",
"attribute",
"defined",
"by",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"point",
"to",
"a",
"relation",
"pass",
"the",
"value",
"through",
"a",
"mutator",
"and",
"set",
"a",
"changed",
"flag",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1179-L1200 |
5,516 | titon/model | src/Titon/Model/Model.php | Model.setValidator | public function setValidator(Validator $validator) {
$this->_validator = $validator;
// Only set model events if we plan on validating
$this->on('model', $this);
return $this;
} | php | public function setValidator(Validator $validator) {
$this->_validator = $validator;
// Only set model events if we plan on validating
$this->on('model', $this);
return $this;
} | [
"public",
"function",
"setValidator",
"(",
"Validator",
"$",
"validator",
")",
"{",
"$",
"this",
"->",
"_validator",
"=",
"$",
"validator",
";",
"// Only set model events if we plan on validating",
"$",
"this",
"->",
"on",
"(",
"'model'",
",",
"$",
"this",
")",
... | Set the validator instance.
@param \Titon\Utility\Validator $validator
@return \Titon\Model\Model | [
"Set",
"the",
"validator",
"instance",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1223-L1230 |
5,517 | titon/model | src/Titon/Model/Model.php | Model.toArray | public function toArray() {
return array_map(function($value) {
return ($value instanceof Arrayable) ? $value->toArray() : $value;
}, $this->_attributes);
} | php | public function toArray() {
return array_map(function($value) {
return ($value instanceof Arrayable) ? $value->toArray() : $value;
}, $this->_attributes);
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"(",
"$",
"value",
"instanceof",
"Arrayable",
")",
"?",
"$",
"value",
"->",
"toArray",
"(",
")",
":",
"$",
"value",
";",
"}... | Return the model attributes as an array.
@return array | [
"Return",
"the",
"model",
"attributes",
"as",
"an",
"array",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1246-L1250 |
5,518 | titon/model | src/Titon/Model/Model.php | Model.unlink | public function unlink(Model $model) {
$this->getRelation($this->getAlias(get_class($model)))->unlink($model);
return $this;
} | php | public function unlink(Model $model) {
$this->getRelation($this->getAlias(get_class($model)))->unlink($model);
return $this;
} | [
"public",
"function",
"unlink",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"getRelation",
"(",
"$",
"this",
"->",
"getAlias",
"(",
"get_class",
"(",
"$",
"model",
")",
")",
")",
"->",
"unlink",
"(",
"$",
"model",
")",
";",
"return",
"... | Unlink an external model that has been tied to this model.
@param \Titon\Model\Model $model
@return $this
@throws \Titon\Model\Exception\MissingRelationException | [
"Unlink",
"an",
"external",
"model",
"that",
"has",
"been",
"tied",
"to",
"this",
"model",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1269-L1273 |
5,519 | titon/model | src/Titon/Model/Model.php | Model.unlinkMany | public function unlinkMany() {
$models = func_get_args();
if (is_array($models[0])) {
$models = $models[0];
}
foreach ($models as $model) {
$this->unlink($model);
}
return $this;
} | php | public function unlinkMany() {
$models = func_get_args();
if (is_array($models[0])) {
$models = $models[0];
}
foreach ($models as $model) {
$this->unlink($model);
}
return $this;
} | [
"public",
"function",
"unlinkMany",
"(",
")",
"{",
"$",
"models",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"models",
"[",
"0",
"]",
")",
")",
"{",
"$",
"models",
"=",
"$",
"models",
"[",
"0",
"]",
";",
"}",
"foreach",... | Unlink multiple models at once.
@return $this | [
"Unlink",
"multiple",
"models",
"at",
"once",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1280-L1292 |
5,520 | titon/model | src/Titon/Model/Model.php | Model.validate | public function validate() {
$this->_errors = [];
// No rules
if (!$this->validate) {
return true;
}
// Build the validator
$validator = $this->getValidator();
$validator->reset();
$validator->addMessages($this->messages);
$validator-... | php | public function validate() {
$this->_errors = [];
// No rules
if (!$this->validate) {
return true;
}
// Build the validator
$validator = $this->getValidator();
$validator->reset();
$validator->addMessages($this->messages);
$validator-... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"this",
"->",
"_errors",
"=",
"[",
"]",
";",
"// No rules",
"if",
"(",
"!",
"$",
"this",
"->",
"validate",
")",
"{",
"return",
"true",
";",
"}",
"// Build the validator",
"$",
"validator",
"=",
"$",... | Validate the current set of data against the models validation rules.
@return bool | [
"Validate",
"the",
"current",
"set",
"of",
"data",
"against",
"the",
"models",
"validation",
"rules",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1308-L1337 |
5,521 | titon/model | src/Titon/Model/Model.php | Model.create | public static function create(array $data, array $options = []) {
/** @type \Titon\Model\Model $model */
$model = new static();
$model->fill($data);
if ($model->save($options)) {
return $model;
}
return null;
} | php | public static function create(array $data, array $options = []) {
/** @type \Titon\Model\Model $model */
$model = new static();
$model->fill($data);
if ($model->save($options)) {
return $model;
}
return null;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"/** @type \\Titon\\Model\\Model $model */",
"$",
"model",
"=",
"new",
"static",
"(",
")",
";",
"$",
"model",
"->",
"fill",
"(",
"... | Create a new model instance, fill with data, and attempt to save.
Return the model instance on success, or a null on failure.
@see \Titon\Db\Repository::create()
@param array $data
@param array $options
@return \Titon\Model\Model | [
"Create",
"a",
"new",
"model",
"instance",
"fill",
"with",
"data",
"and",
"attempt",
"to",
"save",
".",
"Return",
"the",
"model",
"instance",
"on",
"success",
"or",
"a",
"null",
"on",
"failure",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1361-L1371 |
5,522 | titon/model | src/Titon/Model/Model.php | Model.findBy | public static function findBy($field, $value, array $options = []) {
if ($record = static::select()->where($field, $value)->first($options)) {
return $record;
}
return new static();
} | php | public static function findBy($field, $value, array $options = []) {
if ($record = static::select()->where($field, $value)->first($options)) {
return $record;
}
return new static();
} | [
"public",
"static",
"function",
"findBy",
"(",
"$",
"field",
",",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"record",
"=",
"static",
"::",
"select",
"(",
")",
"->",
"where",
"(",
"$",
"field",
",",
"$",
... | Will attempt to find a record by a field's value and return a model instance with data pre-filled.
If no record can be found, an empty model instance will be returned.
@param string $field
@param mixed $value
@param array $options
@return \Titon\Model\Model | [
"Will",
"attempt",
"to",
"find",
"a",
"record",
"by",
"a",
"field",
"s",
"value",
"and",
"return",
"a",
"model",
"instance",
"with",
"data",
"pre",
"-",
"filled",
".",
"If",
"no",
"record",
"can",
"be",
"found",
"an",
"empty",
"model",
"instance",
"wil... | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1406-L1412 |
5,523 | titon/model | src/Titon/Model/Model.php | Model.update | public static function update($id, array $data, array $options = []) {
$model = static::find($id);
if ($model->exists()) {
$model->fill($data);
if ($model->save($options)) {
return $model;
}
}
return null;
} | php | public static function update($id, array $data, array $options = []) {
$model = static::find($id);
if ($model->exists()) {
$model->fill($data);
if ($model->save($options)) {
return $model;
}
}
return null;
} | [
"public",
"static",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"model",
"=",
"static",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"model",
"->",
"exi... | Update a model by ID by finding the record in the database, filling the data, and attempting to save.
Return the model instance on success, or a null on failure.
@see \Titon\Db\Repository::update()
@param int $id
@param array $data
@param array $options
@return \Titon\Model\Model | [
"Update",
"a",
"model",
"by",
"ID",
"by",
"finding",
"the",
"record",
"in",
"the",
"database",
"filling",
"the",
"data",
"and",
"attempting",
"to",
"save",
".",
"Return",
"the",
"model",
"instance",
"on",
"success",
"or",
"a",
"null",
"on",
"failure",
".... | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L1516-L1528 |
5,524 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.filter | public function filter(?callable $callback = null): Sequence
{
if (is_null($callback)) {
return $this->duplicate($this->items->filter());
}
return $this->duplicate($this->items->filter($callback));
} | php | public function filter(?callable $callback = null): Sequence
{
if (is_null($callback)) {
return $this->duplicate($this->items->filter());
}
return $this->duplicate($this->items->filter($callback));
} | [
"public",
"function",
"filter",
"(",
"?",
"callable",
"$",
"callback",
"=",
"null",
")",
":",
"Sequence",
"{",
"if",
"(",
"is_null",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"$",
"this",
"->",
"duplicate",
"(",
"$",
"this",
"->",
"items",
"->",... | Returns a new sequence containing only the values for which a callback
returns true. A boolean test will be used if a callback is not provided.
@param callable|null $callback Accepts a value, returns a boolean result:
true : include the value,
false: skip the value.
@return \PlanB\DS\Sequence | [
"Returns",
"a",
"new",
"sequence",
"containing",
"only",
"the",
"values",
"for",
"which",
"a",
"callback",
"returns",
"true",
".",
"A",
"boolean",
"test",
"will",
"be",
"used",
"if",
"a",
"callback",
"is",
"not",
"provided",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L67-L74 |
5,525 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.find | public function find($value): ?int
{
$founded = $this->items->find($value);
if (false === $founded) {
return null;
}
return (int) $founded;
} | php | public function find($value): ?int
{
$founded = $this->items->find($value);
if (false === $founded) {
return null;
}
return (int) $founded;
} | [
"public",
"function",
"find",
"(",
"$",
"value",
")",
":",
"?",
"int",
"{",
"$",
"founded",
"=",
"$",
"this",
"->",
"items",
"->",
"find",
"(",
"$",
"value",
")",
";",
"if",
"(",
"false",
"===",
"$",
"founded",
")",
"{",
"return",
"null",
";",
... | Returns the index of a given value, or null if it could not be found.
@param mixed $value
@return int|null | [
"Returns",
"the",
"index",
"of",
"a",
"given",
"value",
"or",
"null",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L83-L92 |
5,526 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.findAll | public function findAll($value): ?array
{
$founded = array_keys($this->items->toArray(), $value, true);
if (0 === count($founded)) {
return null;
}
return $founded;
} | php | public function findAll($value): ?array
{
$founded = array_keys($this->items->toArray(), $value, true);
if (0 === count($founded)) {
return null;
}
return $founded;
} | [
"public",
"function",
"findAll",
"(",
"$",
"value",
")",
":",
"?",
"array",
"{",
"$",
"founded",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"items",
"->",
"toArray",
"(",
")",
",",
"$",
"value",
",",
"true",
")",
";",
"if",
"(",
"0",
"===",
"coun... | Returns the all the index of a given value, or null if it could not be found.
@param mixed $value
@return mixed[]|null | [
"Returns",
"the",
"all",
"the",
"index",
"of",
"a",
"given",
"value",
"or",
"null",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L101-L110 |
5,527 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.insert | public function insert(int $index, ...$values): Sequence
{
$this->resolver->values(function (\DS\Map $map) use ($index): void {
$values = $map->values();
$this->items->insert($index, ...$values);
}, $values);
return $this;
} | php | public function insert(int $index, ...$values): Sequence
{
$this->resolver->values(function (\DS\Map $map) use ($index): void {
$values = $map->values();
$this->items->insert($index, ...$values);
}, $values);
return $this;
} | [
"public",
"function",
"insert",
"(",
"int",
"$",
"index",
",",
"...",
"$",
"values",
")",
":",
"Sequence",
"{",
"$",
"this",
"->",
"resolver",
"->",
"values",
"(",
"function",
"(",
"\\",
"DS",
"\\",
"Map",
"$",
"map",
")",
"use",
"(",
"$",
"index",... | Inserts zero or more values at a given index.
Each value after the index will be moved one position to the right.
Values may be inserted at an index equal to the size of the sequence.
@param int $index
@param mixed ...$values
@return \PlanB\DS\Sequence
@throws \OutOfRangeException if the index is not in the range... | [
"Inserts",
"zero",
"or",
"more",
"values",
"at",
"a",
"given",
"index",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L151-L161 |
5,528 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.map | public function map(callable $callback): Sequence
{
$items = $this->items->map($callback);
return $this->duplicate($items);
} | php | public function map(callable $callback): Sequence
{
$items = $this->items->map($callback);
return $this->duplicate($items);
} | [
"public",
"function",
"map",
"(",
"callable",
"$",
"callback",
")",
":",
"Sequence",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"items",
"->",
"map",
"(",
"$",
"callback",
")",
";",
"return",
"$",
"this",
"->",
"duplicate",
"(",
"$",
"items",
")",
... | Returns a new sequence using the results of applying a callback to each
value.
@param callable $callback
@return \PlanB\DS\Sequence | [
"Returns",
"a",
"new",
"sequence",
"using",
"the",
"results",
"of",
"applying",
"a",
"callback",
"to",
"each",
"value",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L184-L189 |
5,529 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.merge | public function merge(iterable $values): Sequence
{
$items = $this->items->merge($values);
return $this->duplicate($items);
} | php | public function merge(iterable $values): Sequence
{
$items = $this->items->merge($values);
return $this->duplicate($items);
} | [
"public",
"function",
"merge",
"(",
"iterable",
"$",
"values",
")",
":",
"Sequence",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"items",
"->",
"merge",
"(",
"$",
"values",
")",
";",
"return",
"$",
"this",
"->",
"duplicate",
"(",
"$",
"items",
")",
... | Returns the result of adding all given values to the sequence.
@param mixed[]|\Traversable $values
@return \PlanB\DS\Sequence | [
"Returns",
"the",
"result",
"of",
"adding",
"all",
"given",
"values",
"to",
"the",
"sequence",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L198-L203 |
5,530 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.pushAll | public function pushAll(iterable $values): Sequence
{
foreach ($values as $value) {
$this[] = $value;
}
return $this;
} | php | public function pushAll(iterable $values): Sequence
{
foreach ($values as $value) {
$this[] = $value;
}
return $this;
} | [
"public",
"function",
"pushAll",
"(",
"iterable",
"$",
"values",
")",
":",
"Sequence",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"$",
"this",
"[",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Pushes all values of either an array or traversable object.
@param mixed[] $values
@return \PlanB\DS\Sequence | [
"Pushes",
"all",
"values",
"of",
"either",
"an",
"array",
"or",
"traversable",
"object",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L224-L231 |
5,531 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.set | public function set(int $index, $value): Sequence
{
$this->offsetSet($index, $value);
return $this;
} | php | public function set(int $index, $value): Sequence
{
$this->offsetSet($index, $value);
return $this;
} | [
"public",
"function",
"set",
"(",
"int",
"$",
"index",
",",
"$",
"value",
")",
":",
"Sequence",
"{",
"$",
"this",
"->",
"offsetSet",
"(",
"$",
"index",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Replaces the value at a given index in the sequence with a new value.
@param int $index
@param mixed $value
@return \PlanB\DS\Sequence
@throws \OutOfRangeException if the index is not in the range [0, size-1] | [
"Replaces",
"the",
"value",
"at",
"a",
"given",
"index",
"in",
"the",
"sequence",
"with",
"a",
"new",
"value",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L325-L330 |
5,532 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.slice | public function slice(int $index, ?int $length = null): Sequence
{
$items = $length ?
$this->items->slice($index, $length) :
$this->items->slice($index);
return $this->duplicate($items);
} | php | public function slice(int $index, ?int $length = null): Sequence
{
$items = $length ?
$this->items->slice($index, $length) :
$this->items->slice($index);
return $this->duplicate($items);
} | [
"public",
"function",
"slice",
"(",
"int",
"$",
"index",
",",
"?",
"int",
"$",
"length",
"=",
"null",
")",
":",
"Sequence",
"{",
"$",
"items",
"=",
"$",
"length",
"?",
"$",
"this",
"->",
"items",
"->",
"slice",
"(",
"$",
"index",
",",
"$",
"lengt... | Returns a sub-sequence of a given length starting at a specified index.
@param int $index If the index is positive, the sequence will start
at that index in the sequence. If index is
negative, the sequence will start that far from
the end.
@param int $length If a length is given and is positive, the resulting
sequen... | [
"Returns",
"a",
"sub",
"-",
"sequence",
"of",
"a",
"given",
"length",
"starting",
"at",
"a",
"specified",
"index",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L366-L373 |
5,533 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.sort | public function sort(?callable $comparator = null): Sequence
{
$comparator ?
$this->items->sort($comparator) :
$this->items->sort();
return $this;
} | php | public function sort(?callable $comparator = null): Sequence
{
$comparator ?
$this->items->sort($comparator) :
$this->items->sort();
return $this;
} | [
"public",
"function",
"sort",
"(",
"?",
"callable",
"$",
"comparator",
"=",
"null",
")",
":",
"Sequence",
"{",
"$",
"comparator",
"?",
"$",
"this",
"->",
"items",
"->",
"sort",
"(",
"$",
"comparator",
")",
":",
"$",
"this",
"->",
"items",
"->",
"sort... | Sorts the sequence in-place, based on an optional callable comparator.
@param callable|null $comparator Accepts two values to be compared.
Should return the result of a <=> b.
@return \PlanB\DS\Sequence | [
"Sorts",
"the",
"sequence",
"in",
"-",
"place",
"based",
"on",
"an",
"optional",
"callable",
"comparator",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L383-L390 |
5,534 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.sorted | public function sorted(?callable $comparator = null): Sequence
{
$items = $comparator ?
$this->items->sorted($comparator) :
$this->items->sorted();
return $this->duplicate($items);
} | php | public function sorted(?callable $comparator = null): Sequence
{
$items = $comparator ?
$this->items->sorted($comparator) :
$this->items->sorted();
return $this->duplicate($items);
} | [
"public",
"function",
"sorted",
"(",
"?",
"callable",
"$",
"comparator",
"=",
"null",
")",
":",
"Sequence",
"{",
"$",
"items",
"=",
"$",
"comparator",
"?",
"$",
"this",
"->",
"items",
"->",
"sorted",
"(",
"$",
"comparator",
")",
":",
"$",
"this",
"->... | Returns a sorted copy of the sequence, based on an optional callable
comparator. Natural ordering will be used if a comparator is not given.
@param callable|null $comparator Accepts two values to be compared.
Should return the result of a <=> b.
@return \PlanB\DS\Sequence | [
"Returns",
"a",
"sorted",
"copy",
"of",
"the",
"sequence",
"based",
"on",
"an",
"optional",
"callable",
"comparator",
".",
"Natural",
"ordering",
"will",
"be",
"used",
"if",
"a",
"comparator",
"is",
"not",
"given",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L401-L409 |
5,535 | jmpantoja/planb-utils | src/DS/Traits/TraitSequence.php | TraitSequence.unshift | public function unshift(...$values): Sequence
{
$this->resolver->values(function (\DS\Map $values): void {
$this->items->unshift(...$values->values());
}, $values);
return $this;
} | php | public function unshift(...$values): Sequence
{
$this->resolver->values(function (\DS\Map $values): void {
$this->items->unshift(...$values->values());
}, $values);
return $this;
} | [
"public",
"function",
"unshift",
"(",
"...",
"$",
"values",
")",
":",
"Sequence",
"{",
"$",
"this",
"->",
"resolver",
"->",
"values",
"(",
"function",
"(",
"\\",
"DS",
"\\",
"Map",
"$",
"values",
")",
":",
"void",
"{",
"$",
"this",
"->",
"items",
"... | Adds zero or more values to the front of the sequence.
@param mixed ...$values
@return \PlanB\DS\Sequence | [
"Adds",
"zero",
"or",
"more",
"values",
"to",
"the",
"front",
"of",
"the",
"sequence",
"."
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/DS/Traits/TraitSequence.php#L418-L425 |
5,536 | YARSphp/yars | src/middlewares/Jsonp.php | Jsonp.buildJsonpResponse | protected function buildJsonpResponse(Response $response) {
$content = (string)$response->getBody();
$contentType = $response->getHeaderLine('Content-Type');
if (strpos($contentType, 'application/json') === false) {
$content = '"' . $content . '"';
}
$callback = "{$this->callbackName}({$content});";
... | php | protected function buildJsonpResponse(Response $response) {
$content = (string)$response->getBody();
$contentType = $response->getHeaderLine('Content-Type');
if (strpos($contentType, 'application/json') === false) {
$content = '"' . $content . '"';
}
$callback = "{$this->callbackName}({$content});";
... | [
"protected",
"function",
"buildJsonpResponse",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"content",
"=",
"(",
"string",
")",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"$",
"contentType",
"=",
"$",
"response",
"->",
"getHeaderLine",
"(",
"'Con... | Build Response with the callback.
@param Response $response
@return Response | [
"Build",
"Response",
"with",
"the",
"callback",
"."
] | 0f281fbbbb3442866d503d1a25964d7bfc73646b | https://github.com/YARSphp/yars/blob/0f281fbbbb3442866d503d1a25964d7bfc73646b/src/middlewares/Jsonp.php#L35-L49 |
5,537 | vivait/symfony-console-promptable-options | src/Transformer/ValueTransformer.php | ValueTransformer.isBlank | public function isBlank($value)
{
// Be very sure!
if ($value === null || strlen($value) === 0 || trim($value) === '') {
return true;
}
return false;
} | php | public function isBlank($value)
{
// Be very sure!
if ($value === null || strlen($value) === 0 || trim($value) === '') {
return true;
}
return false;
} | [
"public",
"function",
"isBlank",
"(",
"$",
"value",
")",
"{",
"// Be very sure!",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"strlen",
"(",
"$",
"value",
")",
"===",
"0",
"||",
"trim",
"(",
"$",
"value",
")",
"===",
"''",
")",
"{",
"return",
"tr... | Check if the value is blank or not.
@param mixed $value
@return bool | [
"Check",
"if",
"the",
"value",
"is",
"blank",
"or",
"not",
"."
] | 79fbaa835efcc5a0d28f3ede1e92d9f9ac7a2ba4 | https://github.com/vivait/symfony-console-promptable-options/blob/79fbaa835efcc5a0d28f3ede1e92d9f9ac7a2ba4/src/Transformer/ValueTransformer.php#L22-L30 |
5,538 | twister-php/twister | src/Date.php | Date.days | public function days($date = null)
{
return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
} | php | public function days($date = null)
{
return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
} | [
"public",
"function",
"days",
"(",
"$",
"date",
"=",
"null",
")",
"{",
"return",
"is_string",
"(",
"$",
"date",
")",
"?",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"date",
",",
"self",
"::",
"$",
"utc",
")",
")",
"->",
"diff",
"(",
"$",
"this",
"... | Returns the difference between two dates in days | [
"Returns",
"the",
"difference",
"between",
"two",
"dates",
"in",
"days"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/Date.php#L124-L127 |
5,539 | twister-php/twister | src/Date.php | Date.diff | public function diff($date = 'now')
{
if ($date instanceof static)
return $this->date->diff($date->date);
else if ($date instanceof \DateTime)
return $this->date->diff($date);
else if (is_string($date))
return $this->date->diff(new \DateTime($date, self::$utc));
// return is_string($date) ? (ne... | php | public function diff($date = 'now')
{
if ($date instanceof static)
return $this->date->diff($date->date);
else if ($date instanceof \DateTime)
return $this->date->diff($date);
else if (is_string($date))
return $this->date->diff(new \DateTime($date, self::$utc));
// return is_string($date) ? (ne... | [
"public",
"function",
"diff",
"(",
"$",
"date",
"=",
"'now'",
")",
"{",
"if",
"(",
"$",
"date",
"instanceof",
"static",
")",
"return",
"$",
"this",
"->",
"date",
"->",
"diff",
"(",
"$",
"date",
"->",
"date",
")",
";",
"else",
"if",
"(",
"$",
"dat... | Returns the difference between two dates
@link http://php.net/manual/en/datetime.diff.php | [
"Returns",
"the",
"difference",
"between",
"two",
"dates"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/Date.php#L136-L145 |
5,540 | twister-php/twister | src/Date.php | Date.create | public static function create($time = 'now', $timezone = null)
{
return new static(new \DateTime($time, $timezone === null ? self::$utc : (is_string($timezone) ? new \DateTimeZone($timezone) : $timezone)));
} | php | public static function create($time = 'now', $timezone = null)
{
return new static(new \DateTime($time, $timezone === null ? self::$utc : (is_string($timezone) ? new \DateTimeZone($timezone) : $timezone)));
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"time",
"=",
"'now'",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"return",
"new",
"static",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"time",
",",
"$",
"timezone",
"===",
"null",
"?",
"self",
"::",
... | Create a Twister\Date object or returns null
@link http://php.net/manual/en/datetime.construct.php
@param mixed $str Value to modify, after being cast to string
@param string $encoding The character encoding
@return new Twister\Date instance or false on failure
@throws \InvalidArgumentException if an array o... | [
"Create",
"a",
"Twister",
"\\",
"Date",
"object",
"or",
"returns",
"null"
] | c06ea2650331faf11590c017c850dc5f0bbc5c13 | https://github.com/twister-php/twister/blob/c06ea2650331faf11590c017c850dc5f0bbc5c13/src/Date.php#L374-L377 |
5,541 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-filter/src/StripTags.php | StripTags.setTagsAllowed | public function setTagsAllowed($tagsAllowed)
{
if (!is_array($tagsAllowed)) {
$tagsAllowed = [$tagsAllowed];
}
foreach ($tagsAllowed as $index => $element) {
// If the tag was provided without attributes
if (is_int($index) && is_string($element)) {
... | php | public function setTagsAllowed($tagsAllowed)
{
if (!is_array($tagsAllowed)) {
$tagsAllowed = [$tagsAllowed];
}
foreach ($tagsAllowed as $index => $element) {
// If the tag was provided without attributes
if (is_int($index) && is_string($element)) {
... | [
"public",
"function",
"setTagsAllowed",
"(",
"$",
"tagsAllowed",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"tagsAllowed",
")",
")",
"{",
"$",
"tagsAllowed",
"=",
"[",
"$",
"tagsAllowed",
"]",
";",
"}",
"foreach",
"(",
"$",
"tagsAllowed",
"as",
"$... | Sets the tagsAllowed option
@param array|string $tagsAllowed
@return self Provides a fluent interface | [
"Sets",
"the",
"tagsAllowed",
"option"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/StripTags.php#L95-L129 |
5,542 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-filter/src/StripTags.php | StripTags.setAttributesAllowed | public function setAttributesAllowed($attributesAllowed)
{
if (!is_array($attributesAllowed)) {
$attributesAllowed = [$attributesAllowed];
}
// Store each attribute as allowed
foreach ($attributesAllowed as $attribute) {
if (is_string($attribute)) {
... | php | public function setAttributesAllowed($attributesAllowed)
{
if (!is_array($attributesAllowed)) {
$attributesAllowed = [$attributesAllowed];
}
// Store each attribute as allowed
foreach ($attributesAllowed as $attribute) {
if (is_string($attribute)) {
... | [
"public",
"function",
"setAttributesAllowed",
"(",
"$",
"attributesAllowed",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attributesAllowed",
")",
")",
"{",
"$",
"attributesAllowed",
"=",
"[",
"$",
"attributesAllowed",
"]",
";",
"}",
"// Store each attribute... | Sets the attributesAllowed option
@param array|string $attributesAllowed
@return self Provides a fluent interface | [
"Sets",
"the",
"attributesAllowed",
"option"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/StripTags.php#L147-L163 |
5,543 | marando/phpSOFA | src/Marando/IAU/iauPom00.php | iauPom00.Pom00 | public static function Pom00($xp, $yp, $sp, array &$rpom) {
/* Construct the matrix. */
IAU::Ir($rpom);
IAU::Rz($sp, $rpom);
IAU::Ry(-$xp, $rpom);
IAU::Rx(-$yp, $rpom);
return;
} | php | public static function Pom00($xp, $yp, $sp, array &$rpom) {
/* Construct the matrix. */
IAU::Ir($rpom);
IAU::Rz($sp, $rpom);
IAU::Ry(-$xp, $rpom);
IAU::Rx(-$yp, $rpom);
return;
} | [
"public",
"static",
"function",
"Pom00",
"(",
"$",
"xp",
",",
"$",
"yp",
",",
"$",
"sp",
",",
"array",
"&",
"$",
"rpom",
")",
"{",
"/* Construct the matrix. */",
"IAU",
"::",
"Ir",
"(",
"$",
"rpom",
")",
";",
"IAU",
"::",
"Rz",
"(",
"$",
"sp",
",... | - - - - - - - - - -
i a u P o m 0 0
- - - - - - - - - -
Form the matrix of polar motion for a given date, IAU 2000.
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: support function.
Given:
xp,yp double coordinates of the p... | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"P",
"o",
"m",
"0",
"0",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauPom00.php#L63-L71 |
5,544 | JamesRezo/webhelper-parser | src/Directive/BlockDirective.php | BlockDirective.hasDirective | public function hasDirective($name)
{
$inSubDirective = false;
foreach ($this->directives as $directive) {
if ($directive->getName() == $name) {
return true;
}
$inSubDirective = $this->hasInnerDirective($name, $inSubDirective, $directive);
... | php | public function hasDirective($name)
{
$inSubDirective = false;
foreach ($this->directives as $directive) {
if ($directive->getName() == $name) {
return true;
}
$inSubDirective = $this->hasInnerDirective($name, $inSubDirective, $directive);
... | [
"public",
"function",
"hasDirective",
"(",
"$",
"name",
")",
"{",
"$",
"inSubDirective",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"directives",
"as",
"$",
"directive",
")",
"{",
"if",
"(",
"$",
"directive",
"->",
"getName",
"(",
")",
"==",... | Confirms if the directive contains a specified directive.
@param string $name the directive for which to check existence
@return bool true if the sub-directive exists, false otherwise | [
"Confirms",
"if",
"the",
"directive",
"contains",
"a",
"specified",
"directive",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Directive/BlockDirective.php#L47-L60 |
5,545 | JamesRezo/webhelper-parser | src/Directive/BlockDirective.php | BlockDirective.hasInnerDirective | private function hasInnerDirective($name, $inSubDirective, DirectiveInterface $directive)
{
if (!$directive->isSimple()) {
$inSubDirective = $inSubDirective || $directive->hasDirective($name);
}
return $inSubDirective;
} | php | private function hasInnerDirective($name, $inSubDirective, DirectiveInterface $directive)
{
if (!$directive->isSimple()) {
$inSubDirective = $inSubDirective || $directive->hasDirective($name);
}
return $inSubDirective;
} | [
"private",
"function",
"hasInnerDirective",
"(",
"$",
"name",
",",
"$",
"inSubDirective",
",",
"DirectiveInterface",
"$",
"directive",
")",
"{",
"if",
"(",
"!",
"$",
"directive",
"->",
"isSimple",
"(",
")",
")",
"{",
"$",
"inSubDirective",
"=",
"$",
"inSub... | Looks into sub directives to confirm if the actual contains a specified directive.
@param string $name the directive for which to check existence
@param bool $inSubDirective the actual state
@param DirectiveInterface $directive the sub directive to look into
@return bool true ... | [
"Looks",
"into",
"sub",
"directives",
"to",
"confirm",
"if",
"the",
"actual",
"contains",
"a",
"specified",
"directive",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Directive/BlockDirective.php#L71-L78 |
5,546 | JamesRezo/webhelper-parser | src/Directive/BlockDirective.php | BlockDirective.dump | public function dump(ServerInterface $server, $spaces = 0)
{
$config = '';
foreach ($this->directives as $directive) {
$config .= $directive->dump($server, $spaces + ($this->isMainContext() ? 0 : 4));
}
return $this->dumpBlock($server->getDumperStartDirective(), $spaces... | php | public function dump(ServerInterface $server, $spaces = 0)
{
$config = '';
foreach ($this->directives as $directive) {
$config .= $directive->dump($server, $spaces + ($this->isMainContext() ? 0 : 4));
}
return $this->dumpBlock($server->getDumperStartDirective(), $spaces... | [
"public",
"function",
"dump",
"(",
"ServerInterface",
"$",
"server",
",",
"$",
"spaces",
"=",
"0",
")",
"{",
"$",
"config",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"directives",
"as",
"$",
"directive",
")",
"{",
"$",
"config",
".=",
"$",
... | Dumps the directive respecting a server syntax.
@param ServerInterface $server a server instance
@param int $spaces the indentation spaces
@return string the dumped directive | [
"Dumps",
"the",
"directive",
"respecting",
"a",
"server",
"syntax",
"."
] | 0b39e7abe8f35afbeacdd6681fa9d0767888c646 | https://github.com/JamesRezo/webhelper-parser/blob/0b39e7abe8f35afbeacdd6681fa9d0767888c646/src/Directive/BlockDirective.php#L100-L111 |
5,547 | mtoolkit/mtoolkit-controller | src/routing/MRouting.php | MRoutingInstace.add | public function add( MRoute $route )
{
$this->validateRoute( $route );
$this->routeList->insert( $route->getRole(), $route );
} | php | public function add( MRoute $route )
{
$this->validateRoute( $route );
$this->routeList->insert( $route->getRole(), $route );
} | [
"public",
"function",
"add",
"(",
"MRoute",
"$",
"route",
")",
"{",
"$",
"this",
"->",
"validateRoute",
"(",
"$",
"route",
")",
";",
"$",
"this",
"->",
"routeList",
"->",
"insert",
"(",
"$",
"route",
"->",
"getRole",
"(",
")",
",",
"$",
"route",
")... | Adds a new definition of Route.
@param MRoute $route
@throws MInvalidClassNameException
@throws MInvalidMethodNameException
@throws MInvalidRoleException
@throws MInvalidRouteTypeException | [
"Adds",
"a",
"new",
"definition",
"of",
"Route",
"."
] | 519a40ad12d0835e45aefa5668936f15167ce07c | https://github.com/mtoolkit/mtoolkit-controller/blob/519a40ad12d0835e45aefa5668936f15167ce07c/src/routing/MRouting.php#L158-L163 |
5,548 | vitordm/html-helpr | src/HtmlHelper.php | HtmlHelper.parseAttrs | protected static function parseAttrs($attrs = array())
{
/**
* Verifica se está passando um array correto
*/
if(!is_array($attrs))
throw new HtmlException('Sem itens para parsear' . __CLASS__ . '::' . __FUNCTION__, 1);
/**
* Monta o retorno
... | php | protected static function parseAttrs($attrs = array())
{
/**
* Verifica se está passando um array correto
*/
if(!is_array($attrs))
throw new HtmlException('Sem itens para parsear' . __CLASS__ . '::' . __FUNCTION__, 1);
/**
* Monta o retorno
... | [
"protected",
"static",
"function",
"parseAttrs",
"(",
"$",
"attrs",
"=",
"array",
"(",
")",
")",
"{",
"/**\n * Verifica se está passando um array correto\n */",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attrs",
")",
")",
"throw",
"new",
"HtmlException",... | Realiza o parse dos atributos em uma tag
@param array $attrs array('atributo' => 'valor')
@throws HtmlException
@return string | [
"Realiza",
"o",
"parse",
"dos",
"atributos",
"em",
"uma",
"tag"
] | 894dffebfd3b0317d0359b4217686d1b51234081 | https://github.com/vitordm/html-helpr/blob/894dffebfd3b0317d0359b4217686d1b51234081/src/HtmlHelper.php#L195-L217 |
5,549 | vitordm/html-helpr | src/HtmlHelper.php | HtmlHelper.js | public static function js($fileName, $base_path = true)
{
if (!is_array($fileName))
$fileName = array($fileName);
$data = null;
foreach ($fileName as $file)
{
$data .= '<script src="';
$data .= ($base_path) ? self::getJSLink() : '';
$da... | php | public static function js($fileName, $base_path = true)
{
if (!is_array($fileName))
$fileName = array($fileName);
$data = null;
foreach ($fileName as $file)
{
$data .= '<script src="';
$data .= ($base_path) ? self::getJSLink() : '';
$da... | [
"public",
"static",
"function",
"js",
"(",
"$",
"fileName",
",",
"$",
"base_path",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fileName",
")",
")",
"$",
"fileName",
"=",
"array",
"(",
"$",
"fileName",
")",
";",
"$",
"data",
"=",
... | Gera a tag de script
@param array|string $fileName
@param bool $base_path
@return string | [
"Gera",
"a",
"tag",
"de",
"script"
] | 894dffebfd3b0317d0359b4217686d1b51234081 | https://github.com/vitordm/html-helpr/blob/894dffebfd3b0317d0359b4217686d1b51234081/src/HtmlHelper.php#L235-L247 |
5,550 | vitordm/html-helpr | src/HtmlHelper.php | HtmlHelper.css | public static function css($fileName, $base_path = true)
{
if (!is_array($fileName))
$fileName = array($fileName);
$data = null;
foreach ($fileName as $file)
{
$url = "";
$url .= ($base_path) ? self::getCSSLink() : '';
$url .= $file;
... | php | public static function css($fileName, $base_path = true)
{
if (!is_array($fileName))
$fileName = array($fileName);
$data = null;
foreach ($fileName as $file)
{
$url = "";
$url .= ($base_path) ? self::getCSSLink() : '';
$url .= $file;
... | [
"public",
"static",
"function",
"css",
"(",
"$",
"fileName",
",",
"$",
"base_path",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fileName",
")",
")",
"$",
"fileName",
"=",
"array",
"(",
"$",
"fileName",
")",
";",
"$",
"data",
"=",
... | Gera a tag de link
@param array|string $fileName
@param bool $base_path
@return string | [
"Gera",
"a",
"tag",
"de",
"link"
] | 894dffebfd3b0317d0359b4217686d1b51234081 | https://github.com/vitordm/html-helpr/blob/894dffebfd3b0317d0359b4217686d1b51234081/src/HtmlHelper.php#L255-L269 |
5,551 | iuravic/duktig-core | src/Core/Controller/BaseController.php | BaseController.parseQueryParams | protected function parseQueryParams() : void
{
$queryParams = [];
$queryString = $this->request->getUri()->getQuery();
parse_str($queryString, $queryParams);
$this->queryParams = $queryParams;
} | php | protected function parseQueryParams() : void
{
$queryParams = [];
$queryString = $this->request->getUri()->getQuery();
parse_str($queryString, $queryParams);
$this->queryParams = $queryParams;
} | [
"protected",
"function",
"parseQueryParams",
"(",
")",
":",
"void",
"{",
"$",
"queryParams",
"=",
"[",
"]",
";",
"$",
"queryString",
"=",
"$",
"this",
"->",
"request",
"->",
"getUri",
"(",
")",
"->",
"getQuery",
"(",
")",
";",
"parse_str",
"(",
"$",
... | Parse the query params.
@return void | [
"Parse",
"the",
"query",
"params",
"."
] | 0e04495324516c2b151163fb42882ab0a319a3a8 | https://github.com/iuravic/duktig-core/blob/0e04495324516c2b151163fb42882ab0a319a3a8/src/Core/Controller/BaseController.php#L47-L53 |
5,552 | iuravic/duktig-core | src/Core/Controller/BaseController.php | BaseController.getQueryParam | protected function getQueryParam(string $param) : ?string
{
if ($this->queryParams === null) {
$this->parseQueryParams();
}
return $this->queryParams[$param] ?? null;
} | php | protected function getQueryParam(string $param) : ?string
{
if ($this->queryParams === null) {
$this->parseQueryParams();
}
return $this->queryParams[$param] ?? null;
} | [
"protected",
"function",
"getQueryParam",
"(",
"string",
"$",
"param",
")",
":",
"?",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"queryParams",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"parseQueryParams",
"(",
")",
";",
"}",
"return",
"$",
"this",... | Gets a query param.
@param string $param
@return string|NULL | [
"Gets",
"a",
"query",
"param",
"."
] | 0e04495324516c2b151163fb42882ab0a319a3a8 | https://github.com/iuravic/duktig-core/blob/0e04495324516c2b151163fb42882ab0a319a3a8/src/Core/Controller/BaseController.php#L61-L67 |
5,553 | iuravic/duktig-core | src/Core/Controller/BaseController.php | BaseController.setResponseStatus | protected function setResponseStatus(int $code, string $reasonPhrase = '') : void
{
$this->response = $this->response->withStatus($code, $reasonPhrase);
} | php | protected function setResponseStatus(int $code, string $reasonPhrase = '') : void
{
$this->response = $this->response->withStatus($code, $reasonPhrase);
} | [
"protected",
"function",
"setResponseStatus",
"(",
"int",
"$",
"code",
",",
"string",
"$",
"reasonPhrase",
"=",
"''",
")",
":",
"void",
"{",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"response",
"->",
"withStatus",
"(",
"$",
"code",
",",
"... | Sets the response status.
@param int $code
@param string $reasonPhrase [optional] | [
"Sets",
"the",
"response",
"status",
"."
] | 0e04495324516c2b151163fb42882ab0a319a3a8 | https://github.com/iuravic/duktig-core/blob/0e04495324516c2b151163fb42882ab0a319a3a8/src/Core/Controller/BaseController.php#L88-L91 |
5,554 | joomlatools/joomlatools-platform-categories | administrator/components/com_categories/views/categories/view.html.php | CategoriesViewCategories.getSortFields | protected function getSortFields()
{
return array(
'a.lft' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.title' => JText::_('JGLOBAL_TITLE'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID... | php | protected function getSortFields()
{
return array(
'a.lft' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.title' => JText::_('JGLOBAL_TITLE'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID... | [
"protected",
"function",
"getSortFields",
"(",
")",
"{",
"return",
"array",
"(",
"'a.lft'",
"=>",
"JText",
"::",
"_",
"(",
"'JGRID_HEADING_ORDERING'",
")",
",",
"'a.published'",
"=>",
"JText",
"::",
"_",
"(",
"'JSTATUS'",
")",
",",
"'a.title'",
"=>",
"JText"... | Returns an array of fields the table can be sorted by
@return array Array containing the field name to sort by as the key and display text as value
@since 3.0 | [
"Returns",
"an",
"array",
"of",
"fields",
"the",
"table",
"can",
"be",
"sorted",
"by"
] | 9fe50b6c4ebe6ebfcf98e50067922fcf4a76d350 | https://github.com/joomlatools/joomlatools-platform-categories/blob/9fe50b6c4ebe6ebfcf98e50067922fcf4a76d350/administrator/components/com_categories/views/categories/view.html.php#L278-L288 |
5,555 | borjaeu/kizilare-framework | src/Error.php | Error.error | static function error( $type, $message, $file, $line )
{
$error = <<<ERROR
<pre>
<a href="corebrowser:$file:$line">$file:$line</a>
#$type $message
</pre>
ERROR;
if ( $type !== E_NOTICE )
{
die( $error );
}
} | php | static function error( $type, $message, $file, $line )
{
$error = <<<ERROR
<pre>
<a href="corebrowser:$file:$line">$file:$line</a>
#$type $message
</pre>
ERROR;
if ( $type !== E_NOTICE )
{
die( $error );
}
} | [
"static",
"function",
"error",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
")",
"{",
"$",
"error",
"=",
" <<<ERROR\n<pre>\n<a href=\"corebrowser:$file:$line\">$file:$line</a>\n#$type $message\n</pre>\nERROR",
";",
"if",
"(",
"$",
"type... | Handlers errors in the app.
@static
@param string $type Contains the message of the error.
@param string $message Contains the message of the error.
@param string $file The filename that the error was raised in.
@param integer $line The line number the error was raised at. | [
"Handlers",
"errors",
"in",
"the",
"app",
"."
] | f4a27d4094466d358c51020cb632ad40b450e9e6 | https://github.com/borjaeu/kizilare-framework/blob/f4a27d4094466d358c51020cb632ad40b450e9e6/src/Error.php#L15-L27 |
5,556 | magdev/php-assimp | src/Command/Verbs/AbstractVerb.php | AbstractVerb.getArguments | public function getArguments($asString = false)
{
if ($asString) {
$str = (string) $this->arguments;
return $str;
}
return $this->arguments->all();
} | php | public function getArguments($asString = false)
{
if ($asString) {
$str = (string) $this->arguments;
return $str;
}
return $this->arguments->all();
} | [
"public",
"function",
"getArguments",
"(",
"$",
"asString",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"asString",
")",
"{",
"$",
"str",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"arguments",
";",
"return",
"$",
"str",
";",
"}",
"return",
"$",
"this... | Get the argument string
@param boolean $asString
@return string|array
@deprecated Use ParameterContainer methods | [
"Get",
"the",
"argument",
"string"
] | 206e9c341f8be271a80fbeea7c32ec33b0f2fc90 | https://github.com/magdev/php-assimp/blob/206e9c341f8be271a80fbeea7c32ec33b0f2fc90/src/Command/Verbs/AbstractVerb.php#L136-L143 |
5,557 | magdev/php-assimp | src/Command/Verbs/AbstractVerb.php | AbstractVerb.removeArgument | public function removeArgument($arg)
{
if ($this->hasArgument($arg)) {
$this->arguments->remove($arg);
}
return $this;
} | php | public function removeArgument($arg)
{
if ($this->hasArgument($arg)) {
$this->arguments->remove($arg);
}
return $this;
} | [
"public",
"function",
"removeArgument",
"(",
"$",
"arg",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasArgument",
"(",
"$",
"arg",
")",
")",
"{",
"$",
"this",
"->",
"arguments",
"->",
"remove",
"(",
"$",
"arg",
")",
";",
"}",
"return",
"$",
"this",
... | Remove an argument
@param string $arg
@return \Assimp\Command\Verbs\AbstractVerb
@deprecated Use ParameterContainer methods | [
"Remove",
"an",
"argument"
] | 206e9c341f8be271a80fbeea7c32ec33b0f2fc90 | https://github.com/magdev/php-assimp/blob/206e9c341f8be271a80fbeea7c32ec33b0f2fc90/src/Command/Verbs/AbstractVerb.php#L208-L214 |
5,558 | magicphp/framework | src/magicphp/storage.class.php | Storage.Set | public static function Set($sKey, $mValue){
$oThis = self::CreateInstanceIfNotExists();
$oThis->aList[$sKey] = $mValue;
} | php | public static function Set($sKey, $mValue){
$oThis = self::CreateInstanceIfNotExists();
$oThis->aList[$sKey] = $mValue;
} | [
"public",
"static",
"function",
"Set",
"(",
"$",
"sKey",
",",
"$",
"mValue",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"$",
"oThis",
"->",
"aList",
"[",
"$",
"sKey",
"]",
"=",
"$",
"mValue",
";",
"}"
] | Function to store data
@static
@access public
@param string $sKey Search key
@param mixed $mValue Value Data to be stored
@return void | [
"Function",
"to",
"store",
"data"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L58-L61 |
5,559 | magicphp/framework | src/magicphp/storage.class.php | Storage.SetArray | public static function SetArray($sKey, $sKeyInArray, $mValue){
$oThis = self::CreateInstanceIfNotExists();
if(!array_key_exists($sKey, $oThis->aList))
$oThis->aList[$sKey] = array();
$oThis->aList[$sKey][$sKeyInArray] = $mValue;
} | php | public static function SetArray($sKey, $sKeyInArray, $mValue){
$oThis = self::CreateInstanceIfNotExists();
if(!array_key_exists($sKey, $oThis->aList))
$oThis->aList[$sKey] = array();
$oThis->aList[$sKey][$sKeyInArray] = $mValue;
} | [
"public",
"static",
"function",
"SetArray",
"(",
"$",
"sKey",
",",
"$",
"sKeyInArray",
",",
"$",
"mValue",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"sKey",
",",
... | Function to store data in list
@static
@access public
@param string $sKey Search key
@param string $sKeyInArray Search key in the list
@param mixed $mValue Data to be stored
@return void | [
"Function",
"to",
"store",
"data",
"in",
"list"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L73-L80 |
5,560 | magicphp/framework | src/magicphp/storage.class.php | Storage.Get | public static function Get($sKey, $mDefault = false){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? $oThis->aList[$sKey] : $mDefault;
} | php | public static function Get($sKey, $mDefault = false){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? $oThis->aList[$sKey] : $mDefault;
} | [
"public",
"static",
"function",
"Get",
"(",
"$",
"sKey",
",",
"$",
"mDefault",
"=",
"false",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"return",
"(",
"array_key_exists",
"(",
"$",
"sKey",
",",
"$",
"oThis",
... | Function to return data stored
@static
@access public
@param string $sKey Search key
@param mixed $mDefault Default value (returns if no storage)
@return mixed | [
"Function",
"to",
"return",
"data",
"stored"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L91-L94 |
5,561 | magicphp/framework | src/magicphp/storage.class.php | Storage.GetArray | public static function GetArray($sKey, $sKeyInArray, $mDefault = false){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? ((array_key_exists($sKeyInArray, $oThis->aList[$sKey]) ? $oThis->aList[$sKey][$sKeyInArray] : $mDefault)) : $mDefault;
} | php | public static function GetArray($sKey, $sKeyInArray, $mDefault = false){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? ((array_key_exists($sKeyInArray, $oThis->aList[$sKey]) ? $oThis->aList[$sKey][$sKeyInArray] : $mDefault)) : $mDefault;
} | [
"public",
"static",
"function",
"GetArray",
"(",
"$",
"sKey",
",",
"$",
"sKeyInArray",
",",
"$",
"mDefault",
"=",
"false",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"return",
"(",
"array_key_exists",
"(",
"$",
... | Function to return data stored in list
@static
@access public
@param string $sKey Search key
@param string $sKeyInArray Search key in the list
@param mixed $mDefault Default value (returns if no storage)
@return mixed | [
"Function",
"to",
"return",
"data",
"stored",
"in",
"list"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L106-L109 |
5,562 | magicphp/framework | src/magicphp/storage.class.php | Storage.Join | public static function Join($sKey, $sAppend){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? ((is_string($oThis->aList[$sKey])) ? $oThis->aList[$sKey].$sAppend : false) : false;
} | php | public static function Join($sKey, $sAppend){
$oThis = self::CreateInstanceIfNotExists();
return (array_key_exists($sKey, $oThis->aList)) ? ((is_string($oThis->aList[$sKey])) ? $oThis->aList[$sKey].$sAppend : false) : false;
} | [
"public",
"static",
"function",
"Join",
"(",
"$",
"sKey",
",",
"$",
"sAppend",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"return",
"(",
"array_key_exists",
"(",
"$",
"sKey",
",",
"$",
"oThis",
"->",
"aList",
... | Function to concatenate data stored
@static
@access public
@param string $sKey Search key
@param string $sAppend Text to be concatenated
@return string|boolean | [
"Function",
"to",
"concatenate",
"data",
"stored"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L120-L123 |
5,563 | magicphp/framework | src/magicphp/storage.class.php | Storage.AssignSmarty | public static function AssignSmarty(&$oSmarty){
$oThis = self::CreateInstanceIfNotExists();
$aStorage = Storage::GetList();
$oSmartyVars = array();
function ReturnSubKeys($sKeyRoot, $mValue){
$aKey = explode(".", $sKeyRoot);
... | php | public static function AssignSmarty(&$oSmarty){
$oThis = self::CreateInstanceIfNotExists();
$aStorage = Storage::GetList();
$oSmartyVars = array();
function ReturnSubKeys($sKeyRoot, $mValue){
$aKey = explode(".", $sKeyRoot);
... | [
"public",
"static",
"function",
"AssignSmarty",
"(",
"&",
"$",
"oSmarty",
")",
"{",
"$",
"oThis",
"=",
"self",
"::",
"CreateInstanceIfNotExists",
"(",
")",
";",
"$",
"aStorage",
"=",
"Storage",
"::",
"GetList",
"(",
")",
";",
"$",
"oSmartyVars",
"=",
"ar... | Function to transform the variables Storage variables in Smarty Template Engine
@static
@access public
@param Smarty $oSmarty
@return void | [
"Function",
"to",
"transform",
"the",
"variables",
"Storage",
"variables",
"in",
"Smarty",
"Template",
"Engine"
] | 199934b61c46ec596c27d4fb0355b216dde51d58 | https://github.com/magicphp/framework/blob/199934b61c46ec596c27d4fb0355b216dde51d58/src/magicphp/storage.class.php#L145-L170 |
5,564 | cyberspectrum/i18n-xliff | src/XliffDictionaryProvider.php | XliffDictionaryProvider.getFileNameFor | private function getFileNameFor(string $name, string $sourceLanguage, string $targetLanguage): string
{
if ('' !== $this->subDirectoryMask) {
return $this->rootDir . DIRECTORY_SEPARATOR
. strtr($this->subDirectoryMask, ['{source}' => $sourceLanguage, '{target}' => $targetLanguage... | php | private function getFileNameFor(string $name, string $sourceLanguage, string $targetLanguage): string
{
if ('' !== $this->subDirectoryMask) {
return $this->rootDir . DIRECTORY_SEPARATOR
. strtr($this->subDirectoryMask, ['{source}' => $sourceLanguage, '{target}' => $targetLanguage... | [
"private",
"function",
"getFileNameFor",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"sourceLanguage",
",",
"string",
"$",
"targetLanguage",
")",
":",
"string",
"{",
"if",
"(",
"''",
"!==",
"$",
"this",
"->",
"subDirectoryMask",
")",
"{",
"return",
"$"... | Generate the file name for a dictionary.
@param string $name The name of the dictionary.
@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.
@return string | [
"Generate",
"the",
"file",
"name",
"for",
"a",
"dictionary",
"."
] | 9d03f85a33c8f6fc9acd99770f23800679f130b3 | https://github.com/cyberspectrum/i18n-xliff/blob/9d03f85a33c8f6fc9acd99770f23800679f130b3/src/XliffDictionaryProvider.php#L111-L120 |
5,565 | cyberspectrum/i18n-xliff | src/XliffDictionaryProvider.php | XliffDictionaryProvider.getFinder | private function getFinder(): \Iterator
{
return Finder::create()
->in($this->rootDir)
->ignoreUnreadableDirs()
->files()
->name('*.xlf')
->getIterator();
} | php | private function getFinder(): \Iterator
{
return Finder::create()
->in($this->rootDir)
->ignoreUnreadableDirs()
->files()
->name('*.xlf')
->getIterator();
} | [
"private",
"function",
"getFinder",
"(",
")",
":",
"\\",
"Iterator",
"{",
"return",
"Finder",
"::",
"create",
"(",
")",
"->",
"in",
"(",
"$",
"this",
"->",
"rootDir",
")",
"->",
"ignoreUnreadableDirs",
"(",
")",
"->",
"files",
"(",
")",
"->",
"name",
... | Create a finder instance.
@return \Iterator | [
"Create",
"a",
"finder",
"instance",
"."
] | 9d03f85a33c8f6fc9acd99770f23800679f130b3 | https://github.com/cyberspectrum/i18n-xliff/blob/9d03f85a33c8f6fc9acd99770f23800679f130b3/src/XliffDictionaryProvider.php#L229-L237 |
5,566 | cyberspectrum/i18n-xliff | src/XliffDictionaryProvider.php | XliffDictionaryProvider.guardLanguages | private function guardLanguages(
string $sourceLanguage,
string $targetLanguage,
DictionaryInterface $dictionary
): void {
if ($dictionary->getSourceLanguage() !== $sourceLanguage
|| $dictionary->getTargetLanguage() !== $targetLanguage) {
throw new LanguageMis... | php | private function guardLanguages(
string $sourceLanguage,
string $targetLanguage,
DictionaryInterface $dictionary
): void {
if ($dictionary->getSourceLanguage() !== $sourceLanguage
|| $dictionary->getTargetLanguage() !== $targetLanguage) {
throw new LanguageMis... | [
"private",
"function",
"guardLanguages",
"(",
"string",
"$",
"sourceLanguage",
",",
"string",
"$",
"targetLanguage",
",",
"DictionaryInterface",
"$",
"dictionary",
")",
":",
"void",
"{",
"if",
"(",
"$",
"dictionary",
"->",
"getSourceLanguage",
"(",
")",
"!==",
... | Guard the language.
@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.
@param DictionaryInterface $dictionary The dictionary.
@return void
@throws LanguageMismatchException When the languages do not match the required language. | [
"Guard",
"the",
"language",
"."
] | 9d03f85a33c8f6fc9acd99770f23800679f130b3 | https://github.com/cyberspectrum/i18n-xliff/blob/9d03f85a33c8f6fc9acd99770f23800679f130b3/src/XliffDictionaryProvider.php#L250-L264 |
5,567 | afonzeca/arun-core | src/ArunCore/Core/CodeBuilders/DomainManipulator.php | DomainManipulator.getLastCurlBracketPositionFromClass | public function getLastCurlBracketPositionFromClass($domainClass)
{
$matches = [];
$lastClassCurlBracketPattern = "/\}[ \r\n]*[^{}]\$/";
preg_match($lastClassCurlBracketPattern, $domainClass . " ", $matches, PREG_OFFSET_CAPTURE);
$lastClassBracketIdx = $matches[0][1];
if ($... | php | public function getLastCurlBracketPositionFromClass($domainClass)
{
$matches = [];
$lastClassCurlBracketPattern = "/\}[ \r\n]*[^{}]\$/";
preg_match($lastClassCurlBracketPattern, $domainClass . " ", $matches, PREG_OFFSET_CAPTURE);
$lastClassBracketIdx = $matches[0][1];
if ($... | [
"public",
"function",
"getLastCurlBracketPositionFromClass",
"(",
"$",
"domainClass",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"lastClassCurlBracketPattern",
"=",
"\"/\\}[ \\r\\n]*[^{}]\\$/\"",
";",
"preg_match",
"(",
"$",
"lastClassCurlBracketPattern",
",",
... | Get the Last Curl Bracket of a class
@param $domainClass
@param $matches
@return mixed
@throws | [
"Get",
"the",
"Last",
"Curl",
"Bracket",
"of",
"a",
"class"
] | 7a8af37e326187ff9ed7e2ff7bde6a489a9803a2 | https://github.com/afonzeca/arun-core/blob/7a8af37e326187ff9ed7e2ff7bde6a489a9803a2/src/ArunCore/Core/CodeBuilders/DomainManipulator.php#L72-L85 |
5,568 | afonzeca/arun-core | src/ArunCore/Core/CodeBuilders/DomainManipulator.php | DomainManipulator.addSchemaToClassBottom | public function addSchemaToClassBottom($domainClass, $actionSchema)
{
$lastClassBracketIdx = $this->getLastCurlBracketPositionFromClass($domainClass);
$domainClass = substr_replace($domainClass, $actionSchema, $lastClassBracketIdx);
$domainClass .= "\n}";
return $domainClass;
} | php | public function addSchemaToClassBottom($domainClass, $actionSchema)
{
$lastClassBracketIdx = $this->getLastCurlBracketPositionFromClass($domainClass);
$domainClass = substr_replace($domainClass, $actionSchema, $lastClassBracketIdx);
$domainClass .= "\n}";
return $domainClass;
} | [
"public",
"function",
"addSchemaToClassBottom",
"(",
"$",
"domainClass",
",",
"$",
"actionSchema",
")",
"{",
"$",
"lastClassBracketIdx",
"=",
"$",
"this",
"->",
"getLastCurlBracketPositionFromClass",
"(",
"$",
"domainClass",
")",
";",
"$",
"domainClass",
"=",
"sub... | Append an action schema to an existing class
@param $domainClass
@param $actionSchema
@return mixed|string
@throws | [
"Append",
"an",
"action",
"schema",
"to",
"an",
"existing",
"class"
] | 7a8af37e326187ff9ed7e2ff7bde6a489a9803a2 | https://github.com/afonzeca/arun-core/blob/7a8af37e326187ff9ed7e2ff7bde6a489a9803a2/src/ArunCore/Core/CodeBuilders/DomainManipulator.php#L96-L104 |
5,569 | afonzeca/arun-core | src/ArunCore/Core/CodeBuilders/DomainManipulator.php | DomainManipulator.createDomain | public function createDomain(string $domainName, string $synopsis, string $enabledString, bool $force = false): bool
{
$domainClassName = DomainActionNameGenerator::getDomainClassName($domainName);
$domainSchemaCode = $this->fileMan->loadSchemaCode("Domain");
$this->generatingDomainMsg($do... | php | public function createDomain(string $domainName, string $synopsis, string $enabledString, bool $force = false): bool
{
$domainClassName = DomainActionNameGenerator::getDomainClassName($domainName);
$domainSchemaCode = $this->fileMan->loadSchemaCode("Domain");
$this->generatingDomainMsg($do... | [
"public",
"function",
"createDomain",
"(",
"string",
"$",
"domainName",
",",
"string",
"$",
"synopsis",
",",
"string",
"$",
"enabledString",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"domainClassName",
"=",
"DomainActionNameGenerator... | Create a domain class
@param string $domainName
@param string $synopsis
@param string $enabledString
@param bool $force
@return bool | [
"Create",
"a",
"domain",
"class"
] | 7a8af37e326187ff9ed7e2ff7bde6a489a9803a2 | https://github.com/afonzeca/arun-core/blob/7a8af37e326187ff9ed7e2ff7bde6a489a9803a2/src/ArunCore/Core/CodeBuilders/DomainManipulator.php#L116-L149 |
5,570 | afonzeca/arun-core | src/ArunCore/Core/CodeBuilders/DomainManipulator.php | DomainManipulator.disableDomain | public function disableDomain(string $domainName)
{
$domainClassCode = $this->fileMan->loadDomainCode($domainName);
$domainClassCode = str_replace(
"@SET\DomainEnabled(true)",
"@SET\DomainEnabled(false)",
$domainClassCode
);
return $this->fileMan... | php | public function disableDomain(string $domainName)
{
$domainClassCode = $this->fileMan->loadDomainCode($domainName);
$domainClassCode = str_replace(
"@SET\DomainEnabled(true)",
"@SET\DomainEnabled(false)",
$domainClassCode
);
return $this->fileMan... | [
"public",
"function",
"disableDomain",
"(",
"string",
"$",
"domainName",
")",
"{",
"$",
"domainClassCode",
"=",
"$",
"this",
"->",
"fileMan",
"->",
"loadDomainCode",
"(",
"$",
"domainName",
")",
";",
"$",
"domainClassCode",
"=",
"str_replace",
"(",
"\"@SET\\Do... | Disable an existing domain
@param string $domainName
@return bool|int | [
"Disable",
"an",
"existing",
"domain"
] | 7a8af37e326187ff9ed7e2ff7bde6a489a9803a2 | https://github.com/afonzeca/arun-core/blob/7a8af37e326187ff9ed7e2ff7bde6a489a9803a2/src/ArunCore/Core/CodeBuilders/DomainManipulator.php#L207-L218 |
5,571 | afonzeca/arun-core | src/ArunCore/Core/CodeBuilders/DomainManipulator.php | DomainManipulator.isActionMethodAlreadyPresent | private function isActionMethodAlreadyPresent(string $actionName, string $domainClassCode): bool
{
$functionPattern = '/public function[ \t\n\r]+' . $actionName . '[ \t\n\r]*\([ \t\r\n]*.*[ \t\r\n]*\)/';
return preg_match($functionPattern, $domainClassCode) > 0 ? true : false;
} | php | private function isActionMethodAlreadyPresent(string $actionName, string $domainClassCode): bool
{
$functionPattern = '/public function[ \t\n\r]+' . $actionName . '[ \t\n\r]*\([ \t\r\n]*.*[ \t\r\n]*\)/';
return preg_match($functionPattern, $domainClassCode) > 0 ? true : false;
} | [
"private",
"function",
"isActionMethodAlreadyPresent",
"(",
"string",
"$",
"actionName",
",",
"string",
"$",
"domainClassCode",
")",
":",
"bool",
"{",
"$",
"functionPattern",
"=",
"'/public function[ \\t\\n\\r]+'",
".",
"$",
"actionName",
".",
"'[ \\t\\n\\r]*\\([ \\t\\r... | Check if the Action method is already present in the domain class code
@param string $actionName
@param string $domainClassCode
@return bool | [
"Check",
"if",
"the",
"Action",
"method",
"is",
"already",
"present",
"in",
"the",
"domain",
"class",
"code"
] | 7a8af37e326187ff9ed7e2ff7bde6a489a9803a2 | https://github.com/afonzeca/arun-core/blob/7a8af37e326187ff9ed7e2ff7bde6a489a9803a2/src/ArunCore/Core/CodeBuilders/DomainManipulator.php#L247-L252 |
5,572 | ElMijo/php-cliente-addr | src/PHPClientAddr/PHPClientAddr.php | PHPClientAddr.getRemoteHostname | private function getRemoteHostname()
{
$hostname = NULL;
if(!is_null($this->ip)) {
$hostname = gethostbyaddr($this->ip);
}
return $hostname;
} | php | private function getRemoteHostname()
{
$hostname = NULL;
if(!is_null($this->ip)) {
$hostname = gethostbyaddr($this->ip);
}
return $hostname;
} | [
"private",
"function",
"getRemoteHostname",
"(",
")",
"{",
"$",
"hostname",
"=",
"NULL",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"ip",
")",
")",
"{",
"$",
"hostname",
"=",
"gethostbyaddr",
"(",
"$",
"this",
"->",
"ip",
")",
";",
"}"... | Permite obtener el hostname de la IP
@return string | [
"Permite",
"obtener",
"el",
"hostname",
"de",
"la",
"IP"
] | 0542bde07ba851eec37940a11e96044765141219 | https://github.com/ElMijo/php-cliente-addr/blob/0542bde07ba851eec37940a11e96044765141219/src/PHPClientAddr/PHPClientAddr.php#L59-L67 |
5,573 | ElMijo/php-cliente-addr | src/PHPClientAddr/PHPClientAddr.php | PHPClientAddr.getIpForwarded | private function getIpForwarded()
{
if(!!$this->isHttpXForwardedFor()) {
$entries = $this->getHttpXForwardedForEntities();
$this->ip = $this->getXForwardedIp($entries);
}
} | php | private function getIpForwarded()
{
if(!!$this->isHttpXForwardedFor()) {
$entries = $this->getHttpXForwardedForEntities();
$this->ip = $this->getXForwardedIp($entries);
}
} | [
"private",
"function",
"getIpForwarded",
"(",
")",
"{",
"if",
"(",
"!",
"!",
"$",
"this",
"->",
"isHttpXForwardedFor",
"(",
")",
")",
"{",
"$",
"entries",
"=",
"$",
"this",
"->",
"getHttpXForwardedForEntities",
"(",
")",
";",
"$",
"this",
"->",
"ip",
"... | Permite obtener la IP proveniente de un servidor proxy
@return void | [
"Permite",
"obtener",
"la",
"IP",
"proveniente",
"de",
"un",
"servidor",
"proxy"
] | 0542bde07ba851eec37940a11e96044765141219 | https://github.com/ElMijo/php-cliente-addr/blob/0542bde07ba851eec37940a11e96044765141219/src/PHPClientAddr/PHPClientAddr.php#L73-L79 |
5,574 | ElMijo/php-cliente-addr | src/PHPClientAddr/PHPClientAddr.php | PHPClientAddr.getXForwardedIp | private function getXForwardedIp($entries)
{
$ip = $this->ip;
while (list(, $entry) = each($entries)) {
$entry = trim($entry);
if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list)) {
$found_ip = preg_replace( $this->privateIp, $ip, $ip_list... | php | private function getXForwardedIp($entries)
{
$ip = $this->ip;
while (list(, $entry) = each($entries)) {
$entry = trim($entry);
if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list)) {
$found_ip = preg_replace( $this->privateIp, $ip, $ip_list... | [
"private",
"function",
"getXForwardedIp",
"(",
"$",
"entries",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"ip",
";",
"while",
"(",
"list",
"(",
",",
"$",
"entry",
")",
"=",
"each",
"(",
"$",
"entries",
")",
")",
"{",
"$",
"entry",
"=",
"trim",
... | Permite obtener la IP real proveniente de un servidor proxy.
@param array $entries Arreglo de entidades enviadas por un servidor proxy
@return string | [
"Permite",
"obtener",
"la",
"IP",
"real",
"proveniente",
"de",
"un",
"servidor",
"proxy",
"."
] | 0542bde07ba851eec37940a11e96044765141219 | https://github.com/ElMijo/php-cliente-addr/blob/0542bde07ba851eec37940a11e96044765141219/src/PHPClientAddr/PHPClientAddr.php#L106-L121 |
5,575 | ElMijo/php-cliente-addr | src/PHPClientAddr/PHPClientAddr.php | PHPClientAddr.getRemodeAddr | private function getRemodeAddr()
{
$ip = NULL;
if(PHP_SAPI=='cli') {
$ip = gethostbyname(gethostname());
} elseif($this->hasServerRemoteAddr()) {
$ip = $this->server['REMOTE_ADDR'];
} elseif($this->hasEnvRemoteAddr()) {
$ip = $this->env['REMOTE_ADD... | php | private function getRemodeAddr()
{
$ip = NULL;
if(PHP_SAPI=='cli') {
$ip = gethostbyname(gethostname());
} elseif($this->hasServerRemoteAddr()) {
$ip = $this->server['REMOTE_ADDR'];
} elseif($this->hasEnvRemoteAddr()) {
$ip = $this->env['REMOTE_ADD... | [
"private",
"function",
"getRemodeAddr",
"(",
")",
"{",
"$",
"ip",
"=",
"NULL",
";",
"if",
"(",
"PHP_SAPI",
"==",
"'cli'",
")",
"{",
"$",
"ip",
"=",
"gethostbyname",
"(",
"gethostname",
"(",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"has... | Permite obtener la IP real del cliente.
@return string | [
"Permite",
"obtener",
"la",
"IP",
"real",
"del",
"cliente",
"."
] | 0542bde07ba851eec37940a11e96044765141219 | https://github.com/ElMijo/php-cliente-addr/blob/0542bde07ba851eec37940a11e96044765141219/src/PHPClientAddr/PHPClientAddr.php#L127-L138 |
5,576 | AlcyZ/Alcys-ORM | src/Core/Db/References/MySql/SqlFunction.php | SqlFunction._parseArgs | private function _parseArgs(array $args)
{
$arg = '';
if(count($args) > 0)
{
foreach($args as $number => $argument)
{
if($number === 0)
{
$arg .= $argument;
}
else
{
$arg .= ', ' . $argument;
}
}
}
return $arg;
} | php | private function _parseArgs(array $args)
{
$arg = '';
if(count($args) > 0)
{
foreach($args as $number => $argument)
{
if($number === 0)
{
$arg .= $argument;
}
else
{
$arg .= ', ' . $argument;
}
}
}
return $arg;
} | [
"private",
"function",
"_parseArgs",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"arg",
"=",
"''",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"number",
"=>",
"$",
"argument",
")",
"... | This method parse the argument that should
passed to the MySql Function.
@param array $args The argument that should passe to the sql function, in an array.
@return string | [
"This",
"method",
"parse",
"the",
"argument",
"that",
"should",
"passed",
"to",
"the",
"MySql",
"Function",
"."
] | dd30946ad35ab06cba2167cf6dfa02b733614720 | https://github.com/AlcyZ/Alcys-ORM/blob/dd30946ad35ab06cba2167cf6dfa02b733614720/src/Core/Db/References/MySql/SqlFunction.php#L118-L137 |
5,577 | erickmerchant/wright | src/Settings/YamlSettings.php | YamlSettings.write | public function write($file, $settings)
{
$file = '/settings/' . $file;
/**
* @todo validate that $file is a string
* @todo validate that $settings is a string
*/
$settings = json_decode(json_encode($settings), true);
$settings = $this->yaml->dump($setti... | php | public function write($file, $settings)
{
$file = '/settings/' . $file;
/**
* @todo validate that $file is a string
* @todo validate that $settings is a string
*/
$settings = json_decode(json_encode($settings), true);
$settings = $this->yaml->dump($setti... | [
"public",
"function",
"write",
"(",
"$",
"file",
",",
"$",
"settings",
")",
"{",
"$",
"file",
"=",
"'/settings/'",
".",
"$",
"file",
";",
"/**\n * @todo validate that $file is a string\n * @todo validate that $settings is a string\n */",
"$",
"settin... | Writes a settings file.
@param string $file The file name
@param array $settings Settings to write to the file.
@return void | [
"Writes",
"a",
"settings",
"file",
"."
] | 3b2d46b9b4df4d47a5197c1efca7cd309d5e6cfd | https://github.com/erickmerchant/wright/blob/3b2d46b9b4df4d47a5197c1efca7cd309d5e6cfd/src/Settings/YamlSettings.php#L34-L48 |
5,578 | erickmerchant/wright | src/Settings/YamlSettings.php | YamlSettings.read | public function read($file)
{
$file = '/settings/' . $file;
/**
* @todo validate that $file is a string
*/
$result = [];
if ($this->source_filesystem->has($file . '.yml')) {
$result = $this->yaml->parse($this->source_filesystem->read($file . '.yml'))... | php | public function read($file)
{
$file = '/settings/' . $file;
/**
* @todo validate that $file is a string
*/
$result = [];
if ($this->source_filesystem->has($file . '.yml')) {
$result = $this->yaml->parse($this->source_filesystem->read($file . '.yml'))... | [
"public",
"function",
"read",
"(",
"$",
"file",
")",
"{",
"$",
"file",
"=",
"'/settings/'",
".",
"$",
"file",
";",
"/**\n * @todo validate that $file is a string\n */",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"source_fi... | Reads a settings file.
@param string $file A file to read.
@return array The settings read. | [
"Reads",
"a",
"settings",
"file",
"."
] | 3b2d46b9b4df4d47a5197c1efca7cd309d5e6cfd | https://github.com/erickmerchant/wright/blob/3b2d46b9b4df4d47a5197c1efca7cd309d5e6cfd/src/Settings/YamlSettings.php#L56-L72 |
5,579 | lucifurious/kisma | src/Kisma.php | Kisma.conceive | public static function conceive( $options = array() )
{
// Set any passed in options...
if ( is_callable( $options ) )
{
$options = call_user_func( $options );
}
static::_initializeCache();
// Set any application-level options passed in
static::$... | php | public static function conceive( $options = array() )
{
// Set any passed in options...
if ( is_callable( $options ) )
{
$options = call_user_func( $options );
}
static::_initializeCache();
// Set any application-level options passed in
static::$... | [
"public",
"static",
"function",
"conceive",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"//\tSet any passed in options...",
"if",
"(",
"is_callable",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"call_user_func",
"(",
"$",
"options",
... | Plant the seed of life into Kisma!
@param array $options
@return bool | [
"Plant",
"the",
"seed",
"of",
"life",
"into",
"Kisma!"
] | 4cc9954249da4e535b52f154e728935f07e648ae | https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma.php#L87-L131 |
5,580 | lucifurious/kisma | src/Kisma.php | Kisma._initializeCache | protected static function _initializeCache()
{
if ( !static::$_options[CoreSettings::ENABLE_CACHE] )
{
return false;
}
// Try memcached
try
{
return static::$_cache = Flexistore::createMemcachedStore( array('host' => 'localhost') );
}... | php | protected static function _initializeCache()
{
if ( !static::$_options[CoreSettings::ENABLE_CACHE] )
{
return false;
}
// Try memcached
try
{
return static::$_cache = Flexistore::createMemcachedStore( array('host' => 'localhost') );
}... | [
"protected",
"static",
"function",
"_initializeCache",
"(",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"_options",
"[",
"CoreSettings",
"::",
"ENABLE_CACHE",
"]",
")",
"{",
"return",
"false",
";",
"}",
"// Try memcached",
"try",
"{",
"return",
"static",... | Initialize my settings cache... | [
"Initialize",
"my",
"settings",
"cache",
"..."
] | 4cc9954249da4e535b52f154e728935f07e648ae | https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma.php#L290-L323 |
5,581 | praxigento/mobi_mod_bonus_base | Repo/Dao/Compress.php | Compress.getTreeByCalcId | public function getTreeByCalcId($calcId)
{
$where = Entity::A_CALC_ID . '=' . (int)$calcId;
$entities = $this->get($where);
$result = [];
foreach ($entities as $entity) {
$result[] = $entity->get();
}
return $result;
} | php | public function getTreeByCalcId($calcId)
{
$where = Entity::A_CALC_ID . '=' . (int)$calcId;
$entities = $this->get($where);
$result = [];
foreach ($entities as $entity) {
$result[] = $entity->get();
}
return $result;
} | [
"public",
"function",
"getTreeByCalcId",
"(",
"$",
"calcId",
")",
"{",
"$",
"where",
"=",
"Entity",
"::",
"A_CALC_ID",
".",
"'='",
".",
"(",
"int",
")",
"$",
"calcId",
";",
"$",
"entities",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"where",
")",
";"... | Get compressed tree for given calculation.
@TODO: remove usage of this method or change call in callers to expect return result collection of Entities.
@deprecated since MOBI-803
@param integer $calcId
@return array raw data from DB | [
"Get",
"compressed",
"tree",
"for",
"given",
"calculation",
"."
] | fef1171075f3c9c31da8dcf46acd5e4279d40949 | https://github.com/praxigento/mobi_mod_bonus_base/blob/fef1171075f3c9c31da8dcf46acd5e4279d40949/Repo/Dao/Compress.php#L29-L38 |
5,582 | jnjxp/html | src/Factory.php | Factory.getFactories | protected function getFactories()
{
$escaper = $this->escaper;
$input = (new AuraFactory())->newInputInstance();
$factories = [
'escape' => function () use ($escaper) {
return $escaper;
},
'input' => function () use ($input) {
... | php | protected function getFactories()
{
$escaper = $this->escaper;
$input = (new AuraFactory())->newInputInstance();
$factories = [
'escape' => function () use ($escaper) {
return $escaper;
},
'input' => function () use ($input) {
... | [
"protected",
"function",
"getFactories",
"(",
")",
"{",
"$",
"escaper",
"=",
"$",
"this",
"->",
"escaper",
";",
"$",
"input",
"=",
"(",
"new",
"AuraFactory",
"(",
")",
")",
"->",
"newInputInstance",
"(",
")",
";",
"$",
"factories",
"=",
"[",
"'escape'"... | create array of factories
@return array<*,\Closure>
@access protected | [
"create",
"array",
"of",
"factories"
] | a38f130c19ab0a60ea52bc1d2560a68d2048d292 | https://github.com/jnjxp/html/blob/a38f130c19ab0a60ea52bc1d2560a68d2048d292/src/Factory.php#L124-L145 |
5,583 | gliverphp/registry | src/Registry.php | Registry.get | public static function get()
{
//check if there were arguments passed
if ( sizeof(func_num_args()) == 0 ){echo 'No arguments passed for this resource'; exit();} //throw an exceptionk
//get the arguments passed
$args = func_get_args();
//get the resource key
$key = array_shift($args);
//check if this o... | php | public static function get()
{
//check if there were arguments passed
if ( sizeof(func_num_args()) == 0 ){echo 'No arguments passed for this resource'; exit();} //throw an exceptionk
//get the arguments passed
$args = func_get_args();
//get the resource key
$key = array_shift($args);
//check if this o... | [
"public",
"static",
"function",
"get",
"(",
")",
"{",
"//check if there were arguments passed",
"if",
"(",
"sizeof",
"(",
"func_num_args",
"(",
")",
")",
"==",
"0",
")",
"{",
"echo",
"'No arguments passed for this resource'",
";",
"exit",
"(",
")",
";",
"}",
"... | This method gets the occurance of an object instances and returns the object instance
@param string $key Then index/name for the object to return
@param object $default The default object to return if the specified object instance is not found
@return object Object instance or teh default object if nor found
@throws t... | [
"This",
"method",
"gets",
"the",
"occurance",
"of",
"an",
"object",
"instances",
"and",
"returns",
"the",
"object",
"instance"
] | a656edc0912a6a096b522ad3c49cf80ed7f9e8eb | https://github.com/gliverphp/registry/blob/a656edc0912a6a096b522ad3c49cf80ed7f9e8eb/src/Registry.php#L93-L137 |
5,584 | gliverphp/registry | src/Registry.php | Registry.setConfig | public static function setConfig($config)
{
//set the error file path
self::$errorFilePath = dirname(dirname(__FILE__)) . '/Exceptions/';
//set the config array
self::$config = $config;
} | php | public static function setConfig($config)
{
//set the error file path
self::$errorFilePath = dirname(dirname(__FILE__)) . '/Exceptions/';
//set the config array
self::$config = $config;
} | [
"public",
"static",
"function",
"setConfig",
"(",
"$",
"config",
")",
"{",
"//set the error file path",
"self",
"::",
"$",
"errorFilePath",
"=",
"dirname",
"(",
"dirname",
"(",
"__FILE__",
")",
")",
".",
"'/Exceptions/'",
";",
"//set the config array",
"self",
"... | This method sets the configuration settings of this application
@param array The array containing the configuration parameters
@return void
@throws This method does not throw an error | [
"This",
"method",
"sets",
"the",
"configuration",
"settings",
"of",
"this",
"application"
] | a656edc0912a6a096b522ad3c49cf80ed7f9e8eb | https://github.com/gliverphp/registry/blob/a656edc0912a6a096b522ad3c49cf80ed7f9e8eb/src/Registry.php#L178-L186 |
5,585 | gliverphp/registry | src/Registry.php | Registry.getInstance | private static function getInstance($key, $args)
{
//get the name of the method
$key = 'get' . ucfirst($key);
//get an instance of this resource
$instance = self::{"{$key}"}($args);
//return this object instance
return $instance;
} | php | private static function getInstance($key, $args)
{
//get the name of the method
$key = 'get' . ucfirst($key);
//get an instance of this resource
$instance = self::{"{$key}"}($args);
//return this object instance
return $instance;
} | [
"private",
"static",
"function",
"getInstance",
"(",
"$",
"key",
",",
"$",
"args",
")",
"{",
"//get the name of the method",
"$",
"key",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"key",
")",
";",
"//get an instance of this resource",
"$",
"instance",
"=",
"self"... | This method gets and returns the object instance of a resource
@param string $key The key to use for setting and accessing this instance from array
@param object $instance The object instance to be stored in Registry
@return viod
@throws This method does not throw an error | [
"This",
"method",
"gets",
"and",
"returns",
"the",
"object",
"instance",
"of",
"a",
"resource"
] | a656edc0912a6a096b522ad3c49cf80ed7f9e8eb | https://github.com/gliverphp/registry/blob/a656edc0912a6a096b522ad3c49cf80ed7f9e8eb/src/Registry.php#L224-L235 |
5,586 | gliverphp/registry | src/Registry.php | Registry.getDatabase | public static function getDatabase()
{
//get the database settings from global space
global $database;
//create instance of database class
$instance = new BaseDb($database['default'], $database[$database['default']]);
//get connection instance and make attempt to connect to the data... | php | public static function getDatabase()
{
//get the database settings from global space
global $database;
//create instance of database class
$instance = new BaseDb($database['default'], $database[$database['default']]);
//get connection instance and make attempt to connect to the data... | [
"public",
"static",
"function",
"getDatabase",
"(",
")",
"{",
"//get the database settings from global space",
"global",
"$",
"database",
";",
"//create instance of database class",
"$",
"instance",
"=",
"new",
"BaseDb",
"(",
"$",
"database",
"[",
"'default'",
"]",
",... | This method returns an instance of the database class
@return object The instance of this database class.
@throws This method does not throw an error | [
"This",
"method",
"returns",
"an",
"instance",
"of",
"the",
"database",
"class"
] | a656edc0912a6a096b522ad3c49cf80ed7f9e8eb | https://github.com/gliverphp/registry/blob/a656edc0912a6a096b522ad3c49cf80ed7f9e8eb/src/Registry.php#L257-L270 |
5,587 | kirkbowers/sphec | src/Reporter.php | Reporter.combine | public function combine($reporter) {
$this->passed += $reporter->passed;
$this->failed += $reporter->failed;
} | php | public function combine($reporter) {
$this->passed += $reporter->passed;
$this->failed += $reporter->failed;
} | [
"public",
"function",
"combine",
"(",
"$",
"reporter",
")",
"{",
"$",
"this",
"->",
"passed",
"+=",
"$",
"reporter",
"->",
"passed",
";",
"$",
"this",
"->",
"failed",
"+=",
"$",
"reporter",
"->",
"failed",
";",
"}"
] | Takes the reported values in the incoming Reporter and adds them to this one's
values.
@param $reporter Another Reporter to combine into this one. | [
"Takes",
"the",
"reported",
"values",
"in",
"the",
"incoming",
"Reporter",
"and",
"adds",
"them",
"to",
"this",
"one",
"s",
"values",
"."
] | e1b849aac683fd07eae2e344faad0a00f559e1eb | https://github.com/kirkbowers/sphec/blob/e1b849aac683fd07eae2e344faad0a00f559e1eb/src/Reporter.php#L39-L42 |
5,588 | kirkbowers/sphec | src/Reporter.php | Reporter.pass | public function pass() {
if ($this->output && !$this->output->isQuiet()) {
$this->output->write(".");
}
$this->passed += 1;
} | php | public function pass() {
if ($this->output && !$this->output->isQuiet()) {
$this->output->write(".");
}
$this->passed += 1;
} | [
"public",
"function",
"pass",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"output",
"&&",
"!",
"$",
"this",
"->",
"output",
"->",
"isQuiet",
"(",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"\".\"",
")",
";",
"}",
"$",
"thi... | Increments the number of passed tests. | [
"Increments",
"the",
"number",
"of",
"passed",
"tests",
"."
] | e1b849aac683fd07eae2e344faad0a00f559e1eb | https://github.com/kirkbowers/sphec/blob/e1b849aac683fd07eae2e344faad0a00f559e1eb/src/Reporter.php#L47-L52 |
5,589 | kirkbowers/sphec | src/Reporter.php | Reporter.fail | public function fail($label, $computed, $test, $expected) {
if ($this->output && !$this->output->isQuiet()) {
$this->output->write("<fg=red>F</fg=red>");
}
$this->failed += 1;
$this->failures[] = array(
'label' => $label,
'computed' => $computed,
'test' => $test,
... | php | public function fail($label, $computed, $test, $expected) {
if ($this->output && !$this->output->isQuiet()) {
$this->output->write("<fg=red>F</fg=red>");
}
$this->failed += 1;
$this->failures[] = array(
'label' => $label,
'computed' => $computed,
'test' => $test,
... | [
"public",
"function",
"fail",
"(",
"$",
"label",
",",
"$",
"computed",
",",
"$",
"test",
",",
"$",
"expected",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"output",
"&&",
"!",
"$",
"this",
"->",
"output",
"->",
"isQuiet",
"(",
")",
")",
"{",
"$",
"... | Increments the number of failed tests. | [
"Increments",
"the",
"number",
"of",
"failed",
"tests",
"."
] | e1b849aac683fd07eae2e344faad0a00f559e1eb | https://github.com/kirkbowers/sphec/blob/e1b849aac683fd07eae2e344faad0a00f559e1eb/src/Reporter.php#L57-L69 |
5,590 | asbsoft/yii2module-modmgr_1_161205 | models/ModulesManager.php | ModulesManager.fixDynModulesCache | protected static function fixDynModulesCache($cache)
{
$result = [];
foreach ($cache as $numMid => $info) {
$expParentUid = $parentNumber = $info['parent_uid'];
while (!empty($parentNumber)) {
//if (preg_match('/\{\d+\}/', $parentNumber, $matches) == 0) break;... | php | protected static function fixDynModulesCache($cache)
{
$result = [];
foreach ($cache as $numMid => $info) {
$expParentUid = $parentNumber = $info['parent_uid'];
while (!empty($parentNumber)) {
//if (preg_match('/\{\d+\}/', $parentNumber, $matches) == 0) break;... | [
"protected",
"static",
"function",
"fixDynModulesCache",
"(",
"$",
"cache",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"cache",
"as",
"$",
"numMid",
"=>",
"$",
"info",
")",
"{",
"$",
"expParentUid",
"=",
"$",
"parentNumber",
"=",... | Expand one-number module's uniqueId into chain | [
"Expand",
"one",
"-",
"number",
"module",
"s",
"uniqueId",
"into",
"chain"
] | febe4c5a66430ea762ee425947c42c957812bff1 | https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/ModulesManager.php#L132-L154 |
5,591 | asbsoft/yii2module-modmgr_1_161205 | models/ModulesManager.php | ModulesManager.registeredModuleName | public static function registeredModuleName($moduleUid)
{
if (!empty(static::$_dynModulesCache[$moduleUid]['name'])) {
$name = static::$_dynModulesCache[$moduleUid]['name'];
return $name;
}
return false;
} | php | public static function registeredModuleName($moduleUid)
{
if (!empty(static::$_dynModulesCache[$moduleUid]['name'])) {
$name = static::$_dynModulesCache[$moduleUid]['name'];
return $name;
}
return false;
} | [
"public",
"static",
"function",
"registeredModuleName",
"(",
"$",
"moduleUid",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"static",
"::",
"$",
"_dynModulesCache",
"[",
"$",
"moduleUid",
"]",
"[",
"'name'",
"]",
")",
")",
"{",
"$",
"name",
"=",
"static",
"... | Get name of registered module or false if not refistered | [
"Get",
"name",
"of",
"registered",
"module",
"or",
"false",
"if",
"not",
"refistered"
] | febe4c5a66430ea762ee425947c42c957812bff1 | https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/ModulesManager.php#L157-L164 |
5,592 | asbsoft/yii2module-modmgr_1_161205 | models/ModulesManager.php | ModulesManager.fixUrlPrefixes | protected function fixUrlPrefixes($moduleUid, $routesConfig)
{
$result = [];
$module = Yii::$app->getModule($moduleUid);
foreach ($routesConfig as $type => $config) {
$urlPrefix = RoutesBuilder::correctUrlPrefix('', $module, $type);
if (!empty($urlPrefix)) {
... | php | protected function fixUrlPrefixes($moduleUid, $routesConfig)
{
$result = [];
$module = Yii::$app->getModule($moduleUid);
foreach ($routesConfig as $type => $config) {
$urlPrefix = RoutesBuilder::correctUrlPrefix('', $module, $type);
if (!empty($urlPrefix)) {
... | [
"protected",
"function",
"fixUrlPrefixes",
"(",
"$",
"moduleUid",
",",
"$",
"routesConfig",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"module",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getModule",
"(",
"$",
"moduleUid",
")",
";",
"foreach",
"(",
... | Correct URL prefixes | [
"Correct",
"URL",
"prefixes"
] | febe4c5a66430ea762ee425947c42c957812bff1 | https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/ModulesManager.php#L209-L227 |
5,593 | whackashoe/bstall | src/Whackashoe/Bstall/Controllers/BstallController.php | BstallController.draw | public function draw($name)
{
$this->bstall->load($name);
$pixels = Input::get('pixels');
foreach($pixels as $p) {
if(isset($p['x'])
&& isset($p['y'])
&& isset($p['c'])) {
$this->bstall->write($p['x'], $p['y'], $p['c']);
... | php | public function draw($name)
{
$this->bstall->load($name);
$pixels = Input::get('pixels');
foreach($pixels as $p) {
if(isset($p['x'])
&& isset($p['y'])
&& isset($p['c'])) {
$this->bstall->write($p['x'], $p['y'], $p['c']);
... | [
"public",
"function",
"draw",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"bstall",
"->",
"load",
"(",
"$",
"name",
")",
";",
"$",
"pixels",
"=",
"Input",
"::",
"get",
"(",
"'pixels'",
")",
";",
"foreach",
"(",
"$",
"pixels",
"as",
"$",
"p",
... | Scratch onto the stall
@param string $name
@return Illuminate\Http\Response; | [
"Scratch",
"onto",
"the",
"stall"
] | f8b04d0fb5cb6b7b55396fe8749a1cf9c8b846fe | https://github.com/whackashoe/bstall/blob/f8b04d0fb5cb6b7b55396fe8749a1cf9c8b846fe/src/Whackashoe/Bstall/Controllers/BstallController.php#L23-L39 |
5,594 | calgamo/collection | src/Collection.php | Collection.map | public function map($callback)
{
$values = $this->_map($callback);
$this->setValues($values);
return new Collection($values);
} | php | public function map($callback)
{
$values = $this->_map($callback);
$this->setValues($values);
return new Collection($values);
} | [
"public",
"function",
"map",
"(",
"$",
"callback",
")",
"{",
"$",
"values",
"=",
"$",
"this",
"->",
"_map",
"(",
"$",
"callback",
")",
";",
"$",
"this",
"->",
"setValues",
"(",
"$",
"values",
")",
";",
"return",
"new",
"Collection",
"(",
"$",
"valu... | Applies a callback to all elements
@param callable $callback
@return Collection | [
"Applies",
"a",
"callback",
"to",
"all",
"elements"
] | 65b2efa612bc8250cbe0e1749c7d77176bd0c3c5 | https://github.com/calgamo/collection/blob/65b2efa612bc8250cbe0e1749c7d77176bd0c3c5/src/Collection.php#L160-L165 |
5,595 | ekowabaka/anyen | src/Runner.php | Runner.run | public static function run($wizardDescription, $params = [])
{
$runner = self::getRunner($params);
$runner->setWizardDescription($wizardDescription);
$runner->go($params);
} | php | public static function run($wizardDescription, $params = [])
{
$runner = self::getRunner($params);
$runner->setWizardDescription($wizardDescription);
$runner->go($params);
} | [
"public",
"static",
"function",
"run",
"(",
"$",
"wizardDescription",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"runner",
"=",
"self",
"::",
"getRunner",
"(",
"$",
"params",
")",
";",
"$",
"runner",
"->",
"setWizardDescription",
"(",
"$",
"wiza... | The main entry point for the anyen framework's wizards. Users of the
framework call this method to execute their wizards.
@param array $wizardDescription A link to the php script which describes the wizard.
@param array $params An array of parameters for the wizard.
@throws \Exception | [
"The",
"main",
"entry",
"point",
"for",
"the",
"anyen",
"framework",
"s",
"wizards",
".",
"Users",
"of",
"the",
"framework",
"call",
"this",
"method",
"to",
"execute",
"their",
"wizards",
"."
] | 308343298e9df635cf5cec98ed7f3c11c843763f | https://github.com/ekowabaka/anyen/blob/308343298e9df635cf5cec98ed7f3c11c843763f/src/Runner.php#L75-L80 |
5,596 | mtils/formobject | src/FormObject/Support/LegacyFormObject/Validation/AutoValidatorBroker.php | AutoValidatorBroker.getValidator | public function getValidator()
{
if (!$this->validator) {
$this->setValidator(
$this->validatorFactory->createValidator($this->form)
);
}
return $this->validator;
} | php | public function getValidator()
{
if (!$this->validator) {
$this->setValidator(
$this->validatorFactory->createValidator($this->form)
);
}
return $this->validator;
} | [
"public",
"function",
"getValidator",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validator",
")",
"{",
"$",
"this",
"->",
"setValidator",
"(",
"$",
"this",
"->",
"validatorFactory",
"->",
"createValidator",
"(",
"$",
"this",
"->",
"form",
")",
... | Return the setted validator, whatever validator it is
@return mixed | [
"Return",
"the",
"setted",
"validator",
"whatever",
"validator",
"it",
"is"
] | 04ecf0fcc2e30c6141c9b85e1d34df035ba0f37d | https://github.com/mtils/formobject/blob/04ecf0fcc2e30c6141c9b85e1d34df035ba0f37d/src/FormObject/Support/LegacyFormObject/Validation/AutoValidatorBroker.php#L141-L150 |
5,597 | mtils/formobject | src/FormObject/Support/LegacyFormObject/Validation/AutoValidatorBroker.php | AutoValidatorBroker.setValidator | public function setValidator($validator)
{
$this->callBeforeListeners('setValidator', [$validator]);
$this->validator = $validator;
$this->callAfterListeners('setValidator', [$validator]);
} | php | public function setValidator($validator)
{
$this->callBeforeListeners('setValidator', [$validator]);
$this->validator = $validator;
$this->callAfterListeners('setValidator', [$validator]);
} | [
"public",
"function",
"setValidator",
"(",
"$",
"validator",
")",
"{",
"$",
"this",
"->",
"callBeforeListeners",
"(",
"'setValidator'",
",",
"[",
"$",
"validator",
"]",
")",
";",
"$",
"this",
"->",
"validator",
"=",
"$",
"validator",
";",
"$",
"this",
"-... | Set a validator of any type, the broker has to care about it
@param mixed $validator
@return void | [
"Set",
"a",
"validator",
"of",
"any",
"type",
"the",
"broker",
"has",
"to",
"care",
"about",
"it"
] | 04ecf0fcc2e30c6141c9b85e1d34df035ba0f37d | https://github.com/mtils/formobject/blob/04ecf0fcc2e30c6141c9b85e1d34df035ba0f37d/src/FormObject/Support/LegacyFormObject/Validation/AutoValidatorBroker.php#L158-L163 |
5,598 | Beth3346/wp-custom-posts | src/CustomTaxonomyBuilder.php | CustomTaxonomyBuilder.taxonomyAddDefaultTerms | private function taxonomyAddDefaultTerms($parent, $terms)
{
foreach ($terms as $term) {
return $this->addDefaultTaxTerm($parent, $terms);
}
} | php | private function taxonomyAddDefaultTerms($parent, $terms)
{
foreach ($terms as $term) {
return $this->addDefaultTaxTerm($parent, $terms);
}
} | [
"private",
"function",
"taxonomyAddDefaultTerms",
"(",
"$",
"parent",
",",
"$",
"terms",
")",
"{",
"foreach",
"(",
"$",
"terms",
"as",
"$",
"term",
")",
"{",
"return",
"$",
"this",
"->",
"addDefaultTaxTerm",
"(",
"$",
"parent",
",",
"$",
"terms",
")",
... | Adds default terms to taxonomy | [
"Adds",
"default",
"terms",
"to",
"taxonomy"
] | 7a7440b1a08685db32c4eb4bed0941dad182bd22 | https://github.com/Beth3346/wp-custom-posts/blob/7a7440b1a08685db32c4eb4bed0941dad182bd22/src/CustomTaxonomyBuilder.php#L10-L15 |
5,599 | Beth3346/wp-custom-posts | src/CustomTaxonomyBuilder.php | CustomTaxonomyBuilder.registerTaxonomy | private function registerTaxonomy($tax, $cpt_singular, $cpt_plural)
{
$singular_name = $this->getSingularTaxName($tax);
$plural_name = $this->getPluralTaxName($tax);
$hierarchical = isset($tax['hierarchical']) ? $tax['hierarchical'] : true;
$default_terms = isset($tax['default_terms'... | php | private function registerTaxonomy($tax, $cpt_singular, $cpt_plural)
{
$singular_name = $this->getSingularTaxName($tax);
$plural_name = $this->getPluralTaxName($tax);
$hierarchical = isset($tax['hierarchical']) ? $tax['hierarchical'] : true;
$default_terms = isset($tax['default_terms'... | [
"private",
"function",
"registerTaxonomy",
"(",
"$",
"tax",
",",
"$",
"cpt_singular",
",",
"$",
"cpt_plural",
")",
"{",
"$",
"singular_name",
"=",
"$",
"this",
"->",
"getSingularTaxName",
"(",
"$",
"tax",
")",
";",
"$",
"plural_name",
"=",
"$",
"this",
"... | Register taxonomies for the plugin.\ | [
"Register",
"taxonomies",
"for",
"the",
"plugin",
".",
"\\"
] | 7a7440b1a08685db32c4eb4bed0941dad182bd22 | https://github.com/Beth3346/wp-custom-posts/blob/7a7440b1a08685db32c4eb4bed0941dad182bd22/src/CustomTaxonomyBuilder.php#L96-L121 |
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.