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
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
6,900 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doSetStartPositionId | protected function doSetStartPositionId(Skill $model, $relatedId) {
if ($model->getStartPositionId() !== $relatedId) {
$model->setStartPositionId($relatedId);
return true;
}
return false;
} | php | protected function doSetStartPositionId(Skill $model, $relatedId) {
if ($model->getStartPositionId() !== $relatedId) {
$model->setStartPositionId($relatedId);
return true;
}
return false;
} | [
"protected",
"function",
"doSetStartPositionId",
"(",
"Skill",
"$",
"model",
",",
"$",
"relatedId",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"getStartPositionId",
"(",
")",
"!==",
"$",
"relatedId",
")",
"{",
"$",
"model",
"->",
"setStartPositionId",
"(",
"$",
"relatedId",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Internal mechanism to set the StartPosition id
@param Skill $model
@param mixed $relatedId | [
"Internal",
"mechanism",
"to",
"set",
"the",
"StartPosition",
"id"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2719-L2727 |
6,901 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doSetVariationOfId | protected function doSetVariationOfId(Skill $model, $relatedId) {
if ($model->getVariationOfId() !== $relatedId) {
$model->setVariationOfId($relatedId);
return true;
}
return false;
} | php | protected function doSetVariationOfId(Skill $model, $relatedId) {
if ($model->getVariationOfId() !== $relatedId) {
$model->setVariationOfId($relatedId);
return true;
}
return false;
} | [
"protected",
"function",
"doSetVariationOfId",
"(",
"Skill",
"$",
"model",
",",
"$",
"relatedId",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"getVariationOfId",
"(",
")",
"!==",
"$",
"relatedId",
")",
"{",
"$",
"model",
"->",
"setVariationOfId",
"(",
"$",
"relatedId",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Internal mechanism to set the VariationOf id
@param Skill $model
@param mixed $relatedId | [
"Internal",
"mechanism",
"to",
"set",
"the",
"VariationOf",
"id"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2735-L2743 |
6,902 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateChildren | protected function doUpdateChildren(Skill $model, $data) {
// remove all relationships before
SkillDependencyQuery::create()->filterBySkillRelatedByParentId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByDependencyId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateChildren(Skill $model, $data) {
// remove all relationships before
SkillDependencyQuery::create()->filterBySkillRelatedByParentId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByDependencyId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateChildren",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillDependencyQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkillRelatedByParentId",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addSkillRelatedByDependencyId",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Children on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Children",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2751-L2769 |
6,903 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateComposites | protected function doUpdateComposites(Skill $model, $data) {
// remove all relationships before
SkillPartQuery::create()->filterBySkillRelatedByPartId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByCompositeId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateComposites(Skill $model, $data) {
// remove all relationships before
SkillPartQuery::create()->filterBySkillRelatedByPartId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByCompositeId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateComposites",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillPartQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkillRelatedByPartId",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addSkillRelatedByCompositeId",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Composites on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Composites",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2777-L2795 |
6,904 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateFunctionPhases | protected function doUpdateFunctionPhases(Skill $model, $data) {
// remove all relationships before
FunctionPhaseQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for FunctionPhase';
} else {
$related = FunctionPhaseQuery::create()->findOneById($entry['id']);
$model->addFunctionPhase($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateFunctionPhases(Skill $model, $data) {
// remove all relationships before
FunctionPhaseQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for FunctionPhase';
} else {
$related = FunctionPhaseQuery::create()->findOneById($entry['id']);
$model->addFunctionPhase($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateFunctionPhases",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"FunctionPhaseQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for FunctionPhase'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"FunctionPhaseQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addFunctionPhase",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of FunctionPhases on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"FunctionPhases",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2803-L2821 |
6,905 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateGroups | protected function doUpdateGroups(Skill $model, $data) {
// remove all relationships before
SkillGroupQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Group';
} else {
$related = GroupQuery::create()->findOneById($entry['id']);
$model->addGroup($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateGroups(Skill $model, $data) {
// remove all relationships before
SkillGroupQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Group';
} else {
$related = GroupQuery::create()->findOneById($entry['id']);
$model->addGroup($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateGroups",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillGroupQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Group'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"GroupQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addGroup",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Groups on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Groups",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2829-L2847 |
6,906 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateKstrukturs | protected function doUpdateKstrukturs(Skill $model, $data) {
// remove all relationships before
KstrukturQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Kstruktur';
} else {
$related = KstrukturQuery::create()->findOneById($entry['id']);
$model->addKstruktur($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateKstrukturs(Skill $model, $data) {
// remove all relationships before
KstrukturQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Kstruktur';
} else {
$related = KstrukturQuery::create()->findOneById($entry['id']);
$model->addKstruktur($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateKstrukturs",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"KstrukturQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Kstruktur'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"KstrukturQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addKstruktur",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Kstrukturs on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Kstrukturs",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2855-L2873 |
6,907 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateLineages | protected function doUpdateLineages(Skill $model, $data) {
// remove all relationships before
LineageQuery::create()->filterByAncestor($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Lineage';
} else {
$related = LineageQuery::create()->findOneById($entry['id']);
$model->addLineage($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateLineages(Skill $model, $data) {
// remove all relationships before
LineageQuery::create()->filterByAncestor($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Lineage';
} else {
$related = LineageQuery::create()->findOneById($entry['id']);
$model->addLineage($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateLineages",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"LineageQuery",
"::",
"create",
"(",
")",
"->",
"filterByAncestor",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Lineage'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"LineageQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addLineage",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Lineages on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Lineages",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2881-L2899 |
6,908 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateMultiples | protected function doUpdateMultiples(Skill $model, $data) {
// remove all relationships before
SkillQuery::create()->filterByMultipleOf($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addMultiple($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateMultiples(Skill $model, $data) {
// remove all relationships before
SkillQuery::create()->filterByMultipleOf($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addMultiple($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateMultiples",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"filterByMultipleOf",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addMultiple",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Multiples on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Multiples",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2907-L2925 |
6,909 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateParents | protected function doUpdateParents(Skill $model, $data) {
// remove all relationships before
SkillDependencyQuery::create()->filterBySkillRelatedByDependencyId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByParentId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateParents(Skill $model, $data) {
// remove all relationships before
SkillDependencyQuery::create()->filterBySkillRelatedByDependencyId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByParentId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateParents",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillDependencyQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkillRelatedByDependencyId",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addSkillRelatedByParentId",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Parents on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Parents",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2933-L2951 |
6,910 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateParts | protected function doUpdateParts(Skill $model, $data) {
// remove all relationships before
SkillPartQuery::create()->filterBySkillRelatedByCompositeId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByPartId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateParts(Skill $model, $data) {
// remove all relationships before
SkillPartQuery::create()->filterBySkillRelatedByCompositeId($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkillRelatedByPartId($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateParts",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillPartQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkillRelatedByCompositeId",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addSkillRelatedByPartId",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Parts on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Parts",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2959-L2977 |
6,911 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdatePictures | protected function doUpdatePictures(Skill $model, $data) {
// remove all relationships before
PictureQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Picture';
} else {
$related = PictureQuery::create()->findOneById($entry['id']);
$model->addPicture($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdatePictures(Skill $model, $data) {
// remove all relationships before
PictureQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Picture';
} else {
$related = PictureQuery::create()->findOneById($entry['id']);
$model->addPicture($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdatePictures",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"PictureQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Picture'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"PictureQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addPicture",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Pictures on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Pictures",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L2985-L3003 |
6,912 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateReferences | protected function doUpdateReferences(Skill $model, $data) {
// remove all relationships before
SkillReferenceQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Reference';
} else {
$related = ReferenceQuery::create()->findOneById($entry['id']);
$model->addReference($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateReferences(Skill $model, $data) {
// remove all relationships before
SkillReferenceQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Reference';
} else {
$related = ReferenceQuery::create()->findOneById($entry['id']);
$model->addReference($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateReferences",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillReferenceQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Reference'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"ReferenceQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addReference",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of References on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"References",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L3011-L3029 |
6,913 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateVariations | protected function doUpdateVariations(Skill $model, $data) {
// remove all relationships before
SkillQuery::create()->filterByVariationOf($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addVariation($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateVariations(Skill $model, $data) {
// remove all relationships before
SkillQuery::create()->filterByVariationOf($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addVariation($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateVariations",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"filterByVariationOf",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Skill'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"SkillQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addVariation",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Variations on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Variations",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L3037-L3055 |
6,914 | gossi/trixionary | src/domain/base/SkillDomainTrait.php | SkillDomainTrait.doUpdateVideos | protected function doUpdateVideos(Skill $model, $data) {
// remove all relationships before
VideoQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Video';
} else {
$related = VideoQuery::create()->findOneById($entry['id']);
$model->addVideo($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | php | protected function doUpdateVideos(Skill $model, $data) {
// remove all relationships before
VideoQuery::create()->filterBySkill($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Video';
} else {
$related = VideoQuery::create()->findOneById($entry['id']);
$model->addVideo($related);
}
}
if (count($errors) > 0) {
throw new ErrorsException($errors);
}
} | [
"protected",
"function",
"doUpdateVideos",
"(",
"Skill",
"$",
"model",
",",
"$",
"data",
")",
"{",
"// remove all relationships before",
"VideoQuery",
"::",
"create",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"model",
")",
"->",
"delete",
"(",
")",
";",
"// add them",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"errors",
"[",
"]",
"=",
"'Missing id for Video'",
";",
"}",
"else",
"{",
"$",
"related",
"=",
"VideoQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"entry",
"[",
"'id'",
"]",
")",
";",
"$",
"model",
"->",
"addVideo",
"(",
"$",
"related",
")",
";",
"}",
"}",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"throw",
"new",
"ErrorsException",
"(",
"$",
"errors",
")",
";",
"}",
"}"
] | Internal update mechanism of Videos on Skill
@param Skill $model
@param mixed $data | [
"Internal",
"update",
"mechanism",
"of",
"Videos",
"on",
"Skill"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/domain/base/SkillDomainTrait.php#L3063-L3081 |
6,915 | inc2734/wp-pure-css-gallery | src/Pure_CSS_Gallery.php | Pure_CSS_Gallery._post_gallery | public function _post_gallery( $output, $attr, $instance ) {
$post = get_post();
if ( ! empty( $attr['ids'] ) ) {
if ( empty( $attr['orderby'] ) ) {
$attr['orderby'] = 'post__in';
}
$attr['include'] = $attr['ids'];
}
$atts = shortcode_atts( [
'id' => $post ? $post->ID : 0,
'link' => '',
'size' => 'thumbnail',
'columns' => 3,
'order' => 'ASC',
'orderby' => 'menu_order ID',
'include' => '',
], $attr );
$pot_id = intval( $atts['id'] );
if ( ! empty( $atts['include'] ) ) {
$attachments = get_posts( array(
'include' => $atts['include'],
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
) );
} else {
$attachments = get_children( array(
'post_parent' => $pot_id,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
) );
}
if ( empty( $attachments ) ) {
return '';
}
if ( is_feed() ) {
return $this->_render( 'feed', array(
'attachments' => $attachments,
) );
}
return $this->_render( 'pure-css-gallery', array(
'attachments' => array_values( $attachments ),
'atts' => $atts,
) );
} | php | public function _post_gallery( $output, $attr, $instance ) {
$post = get_post();
if ( ! empty( $attr['ids'] ) ) {
if ( empty( $attr['orderby'] ) ) {
$attr['orderby'] = 'post__in';
}
$attr['include'] = $attr['ids'];
}
$atts = shortcode_atts( [
'id' => $post ? $post->ID : 0,
'link' => '',
'size' => 'thumbnail',
'columns' => 3,
'order' => 'ASC',
'orderby' => 'menu_order ID',
'include' => '',
], $attr );
$pot_id = intval( $atts['id'] );
if ( ! empty( $atts['include'] ) ) {
$attachments = get_posts( array(
'include' => $atts['include'],
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
) );
} else {
$attachments = get_children( array(
'post_parent' => $pot_id,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
) );
}
if ( empty( $attachments ) ) {
return '';
}
if ( is_feed() ) {
return $this->_render( 'feed', array(
'attachments' => $attachments,
) );
}
return $this->_render( 'pure-css-gallery', array(
'attachments' => array_values( $attachments ),
'atts' => $atts,
) );
} | [
"public",
"function",
"_post_gallery",
"(",
"$",
"output",
",",
"$",
"attr",
",",
"$",
"instance",
")",
"{",
"$",
"post",
"=",
"get_post",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"attr",
"[",
"'ids'",
"]",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"attr",
"[",
"'orderby'",
"]",
")",
")",
"{",
"$",
"attr",
"[",
"'orderby'",
"]",
"=",
"'post__in'",
";",
"}",
"$",
"attr",
"[",
"'include'",
"]",
"=",
"$",
"attr",
"[",
"'ids'",
"]",
";",
"}",
"$",
"atts",
"=",
"shortcode_atts",
"(",
"[",
"'id'",
"=>",
"$",
"post",
"?",
"$",
"post",
"->",
"ID",
":",
"0",
",",
"'link'",
"=>",
"''",
",",
"'size'",
"=>",
"'thumbnail'",
",",
"'columns'",
"=>",
"3",
",",
"'order'",
"=>",
"'ASC'",
",",
"'orderby'",
"=>",
"'menu_order ID'",
",",
"'include'",
"=>",
"''",
",",
"]",
",",
"$",
"attr",
")",
";",
"$",
"pot_id",
"=",
"intval",
"(",
"$",
"atts",
"[",
"'id'",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"atts",
"[",
"'include'",
"]",
")",
")",
"{",
"$",
"attachments",
"=",
"get_posts",
"(",
"array",
"(",
"'include'",
"=>",
"$",
"atts",
"[",
"'include'",
"]",
",",
"'post_status'",
"=>",
"'inherit'",
",",
"'post_type'",
"=>",
"'attachment'",
",",
"'post_mime_type'",
"=>",
"'image'",
",",
"'order'",
"=>",
"$",
"atts",
"[",
"'order'",
"]",
",",
"'orderby'",
"=>",
"$",
"atts",
"[",
"'orderby'",
"]",
",",
")",
")",
";",
"}",
"else",
"{",
"$",
"attachments",
"=",
"get_children",
"(",
"array",
"(",
"'post_parent'",
"=>",
"$",
"pot_id",
",",
"'post_status'",
"=>",
"'inherit'",
",",
"'post_type'",
"=>",
"'attachment'",
",",
"'post_mime_type'",
"=>",
"'image'",
",",
"'order'",
"=>",
"$",
"atts",
"[",
"'order'",
"]",
",",
"'orderby'",
"=>",
"$",
"atts",
"[",
"'orderby'",
"]",
",",
")",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"attachments",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"is_feed",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_render",
"(",
"'feed'",
",",
"array",
"(",
"'attachments'",
"=>",
"$",
"attachments",
",",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_render",
"(",
"'pure-css-gallery'",
",",
"array",
"(",
"'attachments'",
"=>",
"array_values",
"(",
"$",
"attachments",
")",
",",
"'atts'",
"=>",
"$",
"atts",
",",
")",
")",
";",
"}"
] | Filters the default gallery shortcode output
@param string $output The gallery output. Default empty.
@param array $attr Attributes of the gallery shortcode.
@var link string null|file|none
@var size string null|thumbnail|medium|large|full
@var columns int
@var ids string
@var orderby string rand|null
@param int $instance Unique numeric ID of this gallery shortcode instance. | [
"Filters",
"the",
"default",
"gallery",
"shortcode",
"output"
] | 31010deb9224ed57b6f03d35b52ee42133f1aac5 | https://github.com/inc2734/wp-pure-css-gallery/blob/31010deb9224ed57b6f03d35b52ee42133f1aac5/src/Pure_CSS_Gallery.php#L33-L89 |
6,916 | inc2734/wp-pure-css-gallery | src/Pure_CSS_Gallery.php | Pure_CSS_Gallery._tiny_mce_before_init | public function _tiny_mce_before_init( $mce_init ) {
$styles = '#tinymce .wpview .gallery { margin: 0; display: block; border: 2px solid #666; text-align: center; height: 80px; }';
$styles .= '#tinymce .wpview .gallery > * { display: none; }';
$styles .= '#tinymce .wpview .gallery::before { margin-top: 20px; display: inline-block; content: \'\\\\f161\'; font-family: dashicons; font-size: 18px; color: #666 }';
if ( isset( $mce_init['content_style'] ) ) {
$mce_init['content_style'] .= $styles;
} else {
$mce_init['content_style'] = $styles;
}
return $mce_init;
} | php | public function _tiny_mce_before_init( $mce_init ) {
$styles = '#tinymce .wpview .gallery { margin: 0; display: block; border: 2px solid #666; text-align: center; height: 80px; }';
$styles .= '#tinymce .wpview .gallery > * { display: none; }';
$styles .= '#tinymce .wpview .gallery::before { margin-top: 20px; display: inline-block; content: \'\\\\f161\'; font-family: dashicons; font-size: 18px; color: #666 }';
if ( isset( $mce_init['content_style'] ) ) {
$mce_init['content_style'] .= $styles;
} else {
$mce_init['content_style'] = $styles;
}
return $mce_init;
} | [
"public",
"function",
"_tiny_mce_before_init",
"(",
"$",
"mce_init",
")",
"{",
"$",
"styles",
"=",
"'#tinymce .wpview .gallery { margin: 0; display: block; border: 2px solid #666; text-align: center; height: 80px; }'",
";",
"$",
"styles",
".=",
"'#tinymce .wpview .gallery > * { display: none; }'",
";",
"$",
"styles",
".=",
"'#tinymce .wpview .gallery::before { margin-top: 20px; display: inline-block; content: \\'\\\\\\\\f161\\'; font-family: dashicons; font-size: 18px; color: #666 }'",
";",
"if",
"(",
"isset",
"(",
"$",
"mce_init",
"[",
"'content_style'",
"]",
")",
")",
"{",
"$",
"mce_init",
"[",
"'content_style'",
"]",
".=",
"$",
"styles",
";",
"}",
"else",
"{",
"$",
"mce_init",
"[",
"'content_style'",
"]",
"=",
"$",
"styles",
";",
"}",
"return",
"$",
"mce_init",
";",
"}"
] | Change style of gallery in wysiwyg
@param array $mce_init | [
"Change",
"style",
"of",
"gallery",
"in",
"wysiwyg"
] | 31010deb9224ed57b6f03d35b52ee42133f1aac5 | https://github.com/inc2734/wp-pure-css-gallery/blob/31010deb9224ed57b6f03d35b52ee42133f1aac5/src/Pure_CSS_Gallery.php#L96-L106 |
6,917 | ferguson-mr/yii2-base | widgets/emailCaptcha/EmailCaptchaAction.php | EmailCaptchaAction.init | public function init()
{
if (!isset(Yii::$app->params['user.emailCaptchaExpire'])) {
Yii::$app->params['user.emailCaptchaExpire'] = $this->expire;
}
$this->expire = Yii::$app->params['user.emailCaptchaExpire'];
$data = Yii::$app->request->post(Yii::$app->request->get('formName', ''), []);
$this->email = ArrayHelper::getValue($data, 'email');
} | php | public function init()
{
if (!isset(Yii::$app->params['user.emailCaptchaExpire'])) {
Yii::$app->params['user.emailCaptchaExpire'] = $this->expire;
}
$this->expire = Yii::$app->params['user.emailCaptchaExpire'];
$data = Yii::$app->request->post(Yii::$app->request->get('formName', ''), []);
$this->email = ArrayHelper::getValue($data, 'email');
} | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"Yii",
"::",
"$",
"app",
"->",
"params",
"[",
"'user.emailCaptchaExpire'",
"]",
")",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"params",
"[",
"'user.emailCaptchaExpire'",
"]",
"=",
"$",
"this",
"->",
"expire",
";",
"}",
"$",
"this",
"->",
"expire",
"=",
"Yii",
"::",
"$",
"app",
"->",
"params",
"[",
"'user.emailCaptchaExpire'",
"]",
";",
"$",
"data",
"=",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"get",
"(",
"'formName'",
",",
"''",
")",
",",
"[",
"]",
")",
";",
"$",
"this",
"->",
"email",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"data",
",",
"'email'",
")",
";",
"}"
] | Initializes the action. | [
"Initializes",
"the",
"action",
"."
] | 627a6907003421d6db48f400d878bce33db79c50 | https://github.com/ferguson-mr/yii2-base/blob/627a6907003421d6db48f400d878bce33db79c50/widgets/emailCaptcha/EmailCaptchaAction.php#L43-L54 |
6,918 | marando/phpSOFA | src/Marando/IAU/iauFal03.php | iauFal03.Fal03 | public static function Fal03($t) {
$a;
/* Mean anomaly of the Moon (IERS Conventions 2003). */
$a = fmod(485868.249036 +
$t * ( 1717915923.2178 +
$t * ( 31.8792 +
$t * ( 0.051635 +
$t * ( - 0.00024470 ) ) ) ), TURNAS) * DAS2R;
return $a;
} | php | public static function Fal03($t) {
$a;
/* Mean anomaly of the Moon (IERS Conventions 2003). */
$a = fmod(485868.249036 +
$t * ( 1717915923.2178 +
$t * ( 31.8792 +
$t * ( 0.051635 +
$t * ( - 0.00024470 ) ) ) ), TURNAS) * DAS2R;
return $a;
} | [
"public",
"static",
"function",
"Fal03",
"(",
"$",
"t",
")",
"{",
"$",
"a",
";",
"/* Mean anomaly of the Moon (IERS Conventions 2003). */",
"$",
"a",
"=",
"fmod",
"(",
"485868.249036",
"+",
"$",
"t",
"*",
"(",
"1717915923.2178",
"+",
"$",
"t",
"*",
"(",
"31.8792",
"+",
"$",
"t",
"*",
"(",
"0.051635",
"+",
"$",
"t",
"*",
"(",
"-",
"0.00024470",
")",
")",
")",
")",
",",
"TURNAS",
")",
"*",
"DAS2R",
";",
"return",
"$",
"a",
";",
"}"
] | - - - - - - - - -
i a u F a l 0 3
- - - - - - - - -
Fundamental argument, IERS Conventions (2003):
mean anomaly of the Moon.
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: canonical model.
Given:
t double TDB, Julian centuries since J2000.0 (Note 1)
Returned (function value):
double l, radians (Note 2)
Notes:
1) Though t is strictly TDB, it is usually more convenient to use
TT, which makes no significant difference.
2) The expression used is as adopted in IERS Conventions (2003) and
is from Simon et al. (1994).
References:
McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
IERS Technical Note No. 32, BKG (2004)
Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
This revision: 2013 June 18
SOFA release 2015-02-09
Copyright (C) 2015 IAU SOFA Board. See notes at end. | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"F",
"a",
"l",
"0",
"3",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauFal03.php#L48-L59 |
6,919 | marando/phpSOFA | src/Marando/IAU/iauEe00.php | iauEe00.Ee00 | public static function Ee00($date1, $date2, $epsa, $dpsi) {
$ee;
/* Equation of the equinoxes. */
$ee = $dpsi * cos($epsa) + IAU::Eect00($date1, $date2);
return $ee;
} | php | public static function Ee00($date1, $date2, $epsa, $dpsi) {
$ee;
/* Equation of the equinoxes. */
$ee = $dpsi * cos($epsa) + IAU::Eect00($date1, $date2);
return $ee;
} | [
"public",
"static",
"function",
"Ee00",
"(",
"$",
"date1",
",",
"$",
"date2",
",",
"$",
"epsa",
",",
"$",
"dpsi",
")",
"{",
"$",
"ee",
";",
"/* Equation of the equinoxes. */",
"$",
"ee",
"=",
"$",
"dpsi",
"*",
"cos",
"(",
"$",
"epsa",
")",
"+",
"IAU",
"::",
"Eect00",
"(",
"$",
"date1",
",",
"$",
"date2",
")",
";",
"return",
"$",
"ee",
";",
"}"
] | - - - - - - - -
i a u E e 0 0
- - - - - - - -
The equation of the equinoxes, compatible with IAU 2000 resolutions,
given the nutation in longitude and the mean obliquity.
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: canonical model.
Given:
date1,date2 double TT as a 2-part Julian Date (Note 1)
epsa double mean obliquity (Note 2)
dpsi double nutation in longitude (Note 3)
Returned (function value):
double equation of the equinoxes (Note 4)
Notes:
1) The TT date date1+date2 is a Julian Date, apportioned in any
convenient way between the two arguments. For example,
JD(TT)=2450123.7 could be expressed in any of these ways,
among others:
date1 date2
2450123.7 0.0 (JD method)
2451545.0 -1421.3 (J2000 method)
2400000.5 50123.2 (MJD method)
2450123.5 0.2 (date & time method)
The JD method is the most natural and convenient to use in
cases where the loss of several decimal digits of resolution
is acceptable. The J2000 method is best matched to the way
the argument is handled internally and will deliver the
optimum resolution. The MJD method and the date & time methods
are both good compromises between resolution and convenience.
2) The obliquity, in radians, is mean of date.
3) The result, which is in radians, operates in the following sense:
Greenwich apparent ST = GMST + equation of the equinoxes
4) The result is compatible with the IAU 2000 resolutions. For
further details, see IERS Conventions 2003 and Capitaine et al.
(2002).
Called:
iauEect00 equation of the equinoxes complementary terms
References:
Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
implement the IAU 2000 definition of UT1", Astronomy &
Astrophysics, 406, 1135-1149 (2003)
McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
IERS Technical Note No. 32, BKG (2004)
This revision: 2008 May 16
SOFA release 2015-02-09
Copyright (C) 2015 IAU SOFA Board. See notes at end. | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"E",
"e",
"0",
"0",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauEe00.php#L77-L84 |
6,920 | ciims/cii | widgets/input/CiiInputVertical.php | CiiInputVertical.datepickerField | protected function datepickerField()
{
if (isset($this->htmlOptions['options']))
{
$options = $this->htmlOptions['options'];
unset($this->htmlOptions['options']);
}
if (isset($this->htmlOptions['events']))
{
$events = $this->htmlOptions['events'];
unset($this->htmlOptions['events']);
}
echo $this->getLabel();
echo $this->getPrepend();
$this->widget('bootstrap.widgets.CiiDatePicker', array(
'model' => $this->model,
'attribute' => $this->attribute,
'options' => isset($options) ? $options : array(),
'events' => isset($events) ? $events : array(),
'htmlOptions' => $this->htmlOptions,
));
echo $this->getAppend();
echo $this->getError() . $this->getHint();
} | php | protected function datepickerField()
{
if (isset($this->htmlOptions['options']))
{
$options = $this->htmlOptions['options'];
unset($this->htmlOptions['options']);
}
if (isset($this->htmlOptions['events']))
{
$events = $this->htmlOptions['events'];
unset($this->htmlOptions['events']);
}
echo $this->getLabel();
echo $this->getPrepend();
$this->widget('bootstrap.widgets.CiiDatePicker', array(
'model' => $this->model,
'attribute' => $this->attribute,
'options' => isset($options) ? $options : array(),
'events' => isset($events) ? $events : array(),
'htmlOptions' => $this->htmlOptions,
));
echo $this->getAppend();
echo $this->getError() . $this->getHint();
} | [
"protected",
"function",
"datepickerField",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
")",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'events'",
"]",
")",
")",
"{",
"$",
"events",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'events'",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'events'",
"]",
")",
";",
"}",
"echo",
"$",
"this",
"->",
"getLabel",
"(",
")",
";",
"echo",
"$",
"this",
"->",
"getPrepend",
"(",
")",
";",
"$",
"this",
"->",
"widget",
"(",
"'bootstrap.widgets.CiiDatePicker'",
",",
"array",
"(",
"'model'",
"=>",
"$",
"this",
"->",
"model",
",",
"'attribute'",
"=>",
"$",
"this",
"->",
"attribute",
",",
"'options'",
"=>",
"isset",
"(",
"$",
"options",
")",
"?",
"$",
"options",
":",
"array",
"(",
")",
",",
"'events'",
"=>",
"isset",
"(",
"$",
"events",
")",
"?",
"$",
"events",
":",
"array",
"(",
")",
",",
"'htmlOptions'",
"=>",
"$",
"this",
"->",
"htmlOptions",
",",
")",
")",
";",
"echo",
"$",
"this",
"->",
"getAppend",
"(",
")",
";",
"echo",
"$",
"this",
"->",
"getError",
"(",
")",
".",
"$",
"this",
"->",
"getHint",
"(",
")",
";",
"}"
] | Renders a datepicker field.
@return string the rendered content
@author antonio ramirez <[email protected]> | [
"Renders",
"a",
"datepicker",
"field",
"."
] | cc8550b9a3a6a0bf0214554679de8743d50dc9ef | https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/input/CiiInputVertical.php#L222-L247 |
6,921 | ciims/cii | widgets/input/CiiInputVertical.php | CiiInputVertical.redactorJs | protected function redactorJs()
{
if (isset($this->htmlOptions['options']))
{
$options = $this->htmlOptions['options'];
unset($this->htmlOptions['options']);
}
if (isset($this->htmlOptions['width']))
{
$width = $this->htmlOptions['width'];
unset($this->htmlOptions['width']);
}
if (isset($this->htmlOptions['height']))
{
$height = $this->htmlOptions['height'];
unset($this->htmlOptions['height']);
}
echo $this->getLabel();
$this->widget('bootstrap.widgets.CiiRedactorJs', array(
'model' => $this->model,
'attribute' => $this->attribute,
'editorOptions' => isset($options) ? $options : array(),
'width' => isset($width) ? $width : '100%',
'height' => isset($height) ? $height : '400px',
'htmlOptions' => $this->htmlOptions
));
echo $this->getError() . $this->getHint();
} | php | protected function redactorJs()
{
if (isset($this->htmlOptions['options']))
{
$options = $this->htmlOptions['options'];
unset($this->htmlOptions['options']);
}
if (isset($this->htmlOptions['width']))
{
$width = $this->htmlOptions['width'];
unset($this->htmlOptions['width']);
}
if (isset($this->htmlOptions['height']))
{
$height = $this->htmlOptions['height'];
unset($this->htmlOptions['height']);
}
echo $this->getLabel();
$this->widget('bootstrap.widgets.CiiRedactorJs', array(
'model' => $this->model,
'attribute' => $this->attribute,
'editorOptions' => isset($options) ? $options : array(),
'width' => isset($width) ? $width : '100%',
'height' => isset($height) ? $height : '400px',
'htmlOptions' => $this->htmlOptions
));
echo $this->getError() . $this->getHint();
} | [
"protected",
"function",
"redactorJs",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
")",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'options'",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'width'",
"]",
")",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'width'",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'width'",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'height'",
"]",
")",
")",
"{",
"$",
"height",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'height'",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'height'",
"]",
")",
";",
"}",
"echo",
"$",
"this",
"->",
"getLabel",
"(",
")",
";",
"$",
"this",
"->",
"widget",
"(",
"'bootstrap.widgets.CiiRedactorJs'",
",",
"array",
"(",
"'model'",
"=>",
"$",
"this",
"->",
"model",
",",
"'attribute'",
"=>",
"$",
"this",
"->",
"attribute",
",",
"'editorOptions'",
"=>",
"isset",
"(",
"$",
"options",
")",
"?",
"$",
"options",
":",
"array",
"(",
")",
",",
"'width'",
"=>",
"isset",
"(",
"$",
"width",
")",
"?",
"$",
"width",
":",
"'100%'",
",",
"'height'",
"=>",
"isset",
"(",
"$",
"height",
")",
"?",
"$",
"height",
":",
"'400px'",
",",
"'htmlOptions'",
"=>",
"$",
"this",
"->",
"htmlOptions",
")",
")",
";",
"echo",
"$",
"this",
"->",
"getError",
"(",
")",
".",
"$",
"this",
"->",
"getHint",
"(",
")",
";",
"}"
] | Renders a redactorJs.
@return string the rendered content | [
"Renders",
"a",
"redactorJs",
"."
] | cc8550b9a3a6a0bf0214554679de8743d50dc9ef | https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/input/CiiInputVertical.php#L286-L313 |
6,922 | Puzzlout/FrameworkMvcLegacy | src/Helpers/NetworkInfoHelper.php | NetworkInfoHelper.GetClientIpEnvironnement | public static function GetClientIpEnvironnement() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if (getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if (getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if (getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if (getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if (getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
} | php | public static function GetClientIpEnvironnement() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if (getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if (getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if (getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if (getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if (getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
} | [
"public",
"static",
"function",
"GetClientIpEnvironnement",
"(",
")",
"{",
"$",
"ipaddress",
"=",
"''",
";",
"if",
"(",
"getenv",
"(",
"'HTTP_CLIENT_IP'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'HTTP_CLIENT_IP'",
")",
";",
"else",
"if",
"(",
"getenv",
"(",
"'HTTP_X_FORWARDED_FOR'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'HTTP_X_FORWARDED_FOR'",
")",
";",
"else",
"if",
"(",
"getenv",
"(",
"'HTTP_X_FORWARDED'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'HTTP_X_FORWARDED'",
")",
";",
"else",
"if",
"(",
"getenv",
"(",
"'HTTP_FORWARDED_FOR'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'HTTP_FORWARDED_FOR'",
")",
";",
"else",
"if",
"(",
"getenv",
"(",
"'HTTP_FORWARDED'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'HTTP_FORWARDED'",
")",
";",
"else",
"if",
"(",
"getenv",
"(",
"'REMOTE_ADDR'",
")",
")",
"$",
"ipaddress",
"=",
"getenv",
"(",
"'REMOTE_ADDR'",
")",
";",
"else",
"$",
"ipaddress",
"=",
"'UNKNOWN'",
";",
"return",
"$",
"ipaddress",
";",
"}"
] | Get the client ip from the environnement.
@return string
The IP address of client. | [
"Get",
"the",
"client",
"ip",
"from",
"the",
"environnement",
"."
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Helpers/NetworkInfoHelper.php#L23-L41 |
6,923 | Puzzlout/FrameworkMvcLegacy | src/Helpers/NetworkInfoHelper.php | NetworkInfoHelper.GetClientIpServer | public static function GetClientIpServer() {
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP'])
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if ($_SERVER['HTTP_X_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if ($_SERVER['HTTP_X_FORWARDED'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if ($_SERVER['HTTP_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if ($_SERVER['HTTP_FORWARDED'])
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if ($_SERVER['REMOTE_ADDR'])
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
} | php | public static function GetClientIpServer() {
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP'])
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if ($_SERVER['HTTP_X_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if ($_SERVER['HTTP_X_FORWARDED'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if ($_SERVER['HTTP_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if ($_SERVER['HTTP_FORWARDED'])
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if ($_SERVER['REMOTE_ADDR'])
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
} | [
"public",
"static",
"function",
"GetClientIpServer",
"(",
")",
"{",
"$",
"ipaddress",
"=",
"''",
";",
"if",
"(",
"$",
"_SERVER",
"[",
"'HTTP_CLIENT_IP'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'HTTP_CLIENT_IP'",
"]",
";",
"else",
"if",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
";",
"else",
"if",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED'",
"]",
";",
"else",
"if",
"(",
"$",
"_SERVER",
"[",
"'HTTP_FORWARDED_FOR'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'HTTP_FORWARDED_FOR'",
"]",
";",
"else",
"if",
"(",
"$",
"_SERVER",
"[",
"'HTTP_FORWARDED'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'HTTP_FORWARDED'",
"]",
";",
"else",
"if",
"(",
"$",
"_SERVER",
"[",
"'REMOTE_ADDR'",
"]",
")",
"$",
"ipaddress",
"=",
"$",
"_SERVER",
"[",
"'REMOTE_ADDR'",
"]",
";",
"else",
"$",
"ipaddress",
"=",
"'UNKNOWN'",
";",
"return",
"$",
"ipaddress",
";",
"}"
] | Get the client ip from the server global variable.
@return string
The IP address of client. | [
"Get",
"the",
"client",
"ip",
"from",
"the",
"server",
"global",
"variable",
"."
] | 14e0fc5b16978cbd209f552ee9c649f66a0dfc6e | https://github.com/Puzzlout/FrameworkMvcLegacy/blob/14e0fc5b16978cbd209f552ee9c649f66a0dfc6e/src/Helpers/NetworkInfoHelper.php#L49-L67 |
6,924 | gourmet/common | Model/Behavior/DetailableBehavior.php | DetailableBehavior.details | public function details(Model $Model, $queryData = null, $schema = false, $format = true) {
$DetailModel = ClassRegistry::init($this->settings[$Model->alias]['alias']);
if (is_string($queryData)) {
$queryData = array('section' => $queryData);
}
$conditions = array($DetailModel->alias . '.foreign_key' => $Model->getID());
if (!empty($queryData['section'])) {
$section = $queryData['section'];
$conditions[$DetailModel->alias . '.field LIKE'] = $section . '.%';
unset($queryData['section']);
}
if (!empty($queryData['conditions'])) {
$queryData['conditions'] = Hash::merge($conditions, $queryData['conditions']);
}
$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.value', $DetailModel->alias . '.label', 'foreign_key', 'foreign_model');
if ($schema) {
$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.input', $DetailModel->alias . '.data_type', $DetailModel->alias . '.label');
}
$order = array('position' => 'ASC');
$recursive = -1;
$results = $DetailModel->find('all', array_merge(compact('conditions', 'fields', 'order', 'recursive'), $queryData));
return $this->detailsExtractSections($Model, $results, $section, $schema, $format);
} | php | public function details(Model $Model, $queryData = null, $schema = false, $format = true) {
$DetailModel = ClassRegistry::init($this->settings[$Model->alias]['alias']);
if (is_string($queryData)) {
$queryData = array('section' => $queryData);
}
$conditions = array($DetailModel->alias . '.foreign_key' => $Model->getID());
if (!empty($queryData['section'])) {
$section = $queryData['section'];
$conditions[$DetailModel->alias . '.field LIKE'] = $section . '.%';
unset($queryData['section']);
}
if (!empty($queryData['conditions'])) {
$queryData['conditions'] = Hash::merge($conditions, $queryData['conditions']);
}
$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.value', $DetailModel->alias . '.label', 'foreign_key', 'foreign_model');
if ($schema) {
$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.input', $DetailModel->alias . '.data_type', $DetailModel->alias . '.label');
}
$order = array('position' => 'ASC');
$recursive = -1;
$results = $DetailModel->find('all', array_merge(compact('conditions', 'fields', 'order', 'recursive'), $queryData));
return $this->detailsExtractSections($Model, $results, $section, $schema, $format);
} | [
"public",
"function",
"details",
"(",
"Model",
"$",
"Model",
",",
"$",
"queryData",
"=",
"null",
",",
"$",
"schema",
"=",
"false",
",",
"$",
"format",
"=",
"true",
")",
"{",
"$",
"DetailModel",
"=",
"ClassRegistry",
"::",
"init",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"Model",
"->",
"alias",
"]",
"[",
"'alias'",
"]",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"queryData",
")",
")",
"{",
"$",
"queryData",
"=",
"array",
"(",
"'section'",
"=>",
"$",
"queryData",
")",
";",
"}",
"$",
"conditions",
"=",
"array",
"(",
"$",
"DetailModel",
"->",
"alias",
".",
"'.foreign_key'",
"=>",
"$",
"Model",
"->",
"getID",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"queryData",
"[",
"'section'",
"]",
")",
")",
"{",
"$",
"section",
"=",
"$",
"queryData",
"[",
"'section'",
"]",
";",
"$",
"conditions",
"[",
"$",
"DetailModel",
"->",
"alias",
".",
"'.field LIKE'",
"]",
"=",
"$",
"section",
".",
"'.%'",
";",
"unset",
"(",
"$",
"queryData",
"[",
"'section'",
"]",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"queryData",
"[",
"'conditions'",
"]",
")",
")",
"{",
"$",
"queryData",
"[",
"'conditions'",
"]",
"=",
"Hash",
"::",
"merge",
"(",
"$",
"conditions",
",",
"$",
"queryData",
"[",
"'conditions'",
"]",
")",
";",
"}",
"$",
"fields",
"=",
"array",
"(",
"$",
"DetailModel",
"->",
"alias",
".",
"'.field'",
",",
"$",
"DetailModel",
"->",
"alias",
".",
"'.value'",
",",
"$",
"DetailModel",
"->",
"alias",
".",
"'.label'",
",",
"'foreign_key'",
",",
"'foreign_model'",
")",
";",
"if",
"(",
"$",
"schema",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"DetailModel",
"->",
"alias",
".",
"'.field'",
",",
"$",
"DetailModel",
"->",
"alias",
".",
"'.input'",
",",
"$",
"DetailModel",
"->",
"alias",
".",
"'.data_type'",
",",
"$",
"DetailModel",
"->",
"alias",
".",
"'.label'",
")",
";",
"}",
"$",
"order",
"=",
"array",
"(",
"'position'",
"=>",
"'ASC'",
")",
";",
"$",
"recursive",
"=",
"-",
"1",
";",
"$",
"results",
"=",
"$",
"DetailModel",
"->",
"find",
"(",
"'all'",
",",
"array_merge",
"(",
"compact",
"(",
"'conditions'",
",",
"'fields'",
",",
"'order'",
",",
"'recursive'",
")",
",",
"$",
"queryData",
")",
")",
";",
"return",
"$",
"this",
"->",
"detailsExtractSections",
"(",
"$",
"Model",
",",
"$",
"results",
",",
"$",
"section",
",",
"$",
"schema",
",",
"$",
"format",
")",
";",
"}"
] | Custom method to find all attached details or by section.
@param Model $model Model to query.
@param string $func
@param string $state Either "before" or "after"
@param array $query
@param array $result
@return array | [
"Custom",
"method",
"to",
"find",
"all",
"attached",
"details",
"or",
"by",
"section",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/Model/Behavior/DetailableBehavior.php#L186-L214 |
6,925 | znframework/package-generator | Databases.php | Databases.setActiveDatabaseEncoding | protected function setActiveDatabaseEncoding(&$encoding)
{
if( stristr('pdo:mysql|mysqli', Config::get('Database', 'database')['driver']) )
{
$encoding = $this->db->encoding();
}
else
{
$encoding = NULL;
}
} | php | protected function setActiveDatabaseEncoding(&$encoding)
{
if( stristr('pdo:mysql|mysqli', Config::get('Database', 'database')['driver']) )
{
$encoding = $this->db->encoding();
}
else
{
$encoding = NULL;
}
} | [
"protected",
"function",
"setActiveDatabaseEncoding",
"(",
"&",
"$",
"encoding",
")",
"{",
"if",
"(",
"stristr",
"(",
"'pdo:mysql|mysqli'",
",",
"Config",
"::",
"get",
"(",
"'Database'",
",",
"'database'",
")",
"[",
"'driver'",
"]",
")",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"db",
"->",
"encoding",
"(",
")",
";",
"}",
"else",
"{",
"$",
"encoding",
"=",
"NULL",
";",
"}",
"}"
] | Protected set active database encoding | [
"Protected",
"set",
"active",
"database",
"encoding"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L60-L70 |
6,926 | znframework/package-generator | Databases.php | Databases.addIdColumnToActiveTableIfNotExists | protected function addIdColumnToActiveTableIfNotExists(&$activeTable)
{
if( ! array_key_exists('id', $activeTable) )
{
$activeTable = array_merge
([
'id' => [$this->db->int(11), $this->db->notNull(), $this->db->autoIncrement(), $this->db->primaryKey()]
], $activeTable);
}
} | php | protected function addIdColumnToActiveTableIfNotExists(&$activeTable)
{
if( ! array_key_exists('id', $activeTable) )
{
$activeTable = array_merge
([
'id' => [$this->db->int(11), $this->db->notNull(), $this->db->autoIncrement(), $this->db->primaryKey()]
], $activeTable);
}
} | [
"protected",
"function",
"addIdColumnToActiveTableIfNotExists",
"(",
"&",
"$",
"activeTable",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'id'",
",",
"$",
"activeTable",
")",
")",
"{",
"$",
"activeTable",
"=",
"array_merge",
"(",
"[",
"'id'",
"=>",
"[",
"$",
"this",
"->",
"db",
"->",
"int",
"(",
"11",
")",
",",
"$",
"this",
"->",
"db",
"->",
"notNull",
"(",
")",
",",
"$",
"this",
"->",
"db",
"->",
"autoIncrement",
"(",
")",
",",
"$",
"this",
"->",
"db",
"->",
"primaryKey",
"(",
")",
"]",
"]",
",",
"$",
"activeTable",
")",
";",
"}",
"}"
] | Protected add id column to active table if not exists | [
"Protected",
"add",
"id",
"column",
"to",
"active",
"table",
"if",
"not",
"exists"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L139-L148 |
6,927 | znframework/package-generator | Databases.php | Databases.getActiveTableKeyAndColumns | protected function getActiveTableKeyAndColumns($columns, &$tableKey, &$tableColumns)
{
$pregGrepArray = preg_grep('/_000/', $columns);
$tableKey = strtolower(current($pregGrepArray));
$tableColumns = Arrays\RemoveElement::element($columns, $pregGrepArray);
} | php | protected function getActiveTableKeyAndColumns($columns, &$tableKey, &$tableColumns)
{
$pregGrepArray = preg_grep('/_000/', $columns);
$tableKey = strtolower(current($pregGrepArray));
$tableColumns = Arrays\RemoveElement::element($columns, $pregGrepArray);
} | [
"protected",
"function",
"getActiveTableKeyAndColumns",
"(",
"$",
"columns",
",",
"&",
"$",
"tableKey",
",",
"&",
"$",
"tableColumns",
")",
"{",
"$",
"pregGrepArray",
"=",
"preg_grep",
"(",
"'/_000/'",
",",
"$",
"columns",
")",
";",
"$",
"tableKey",
"=",
"strtolower",
"(",
"current",
"(",
"$",
"pregGrepArray",
")",
")",
";",
"$",
"tableColumns",
"=",
"Arrays",
"\\",
"RemoveElement",
"::",
"element",
"(",
"$",
"columns",
",",
"$",
"pregGrepArray",
")",
";",
"}"
] | Protected active table key and columns | [
"Protected",
"active",
"table",
"key",
"and",
"columns"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L161-L166 |
6,928 | znframework/package-generator | Databases.php | Databases.dropColumnFromActiveTable | protected function dropColumnFromActiveTable($table, $key, $dbForge, &$status)
{
$dbForge->dropColumn($table, $key);
$status = true;
} | php | protected function dropColumnFromActiveTable($table, $key, $dbForge, &$status)
{
$dbForge->dropColumn($table, $key);
$status = true;
} | [
"protected",
"function",
"dropColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"dbForge",
",",
"&",
"$",
"status",
")",
"{",
"$",
"dbForge",
"->",
"dropColumn",
"(",
"$",
"table",
",",
"$",
"key",
")",
";",
"$",
"status",
"=",
"true",
";",
"}"
] | Protected drop column from active table | [
"Protected",
"drop",
"column",
"from",
"active",
"table"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L179-L183 |
6,929 | znframework/package-generator | Databases.php | Databases.modifyColumnFromActiveTable | protected function modifyColumnFromActiveTable($table, $key, $val, $dbForge, &$status, $active, $current)
{
if( $active !== $current )
{
$dbForge->modifyColumn($table, [$key => $val]);
$status = true;
}
else
{
$status = false;
}
} | php | protected function modifyColumnFromActiveTable($table, $key, $val, $dbForge, &$status, $active, $current)
{
if( $active !== $current )
{
$dbForge->modifyColumn($table, [$key => $val]);
$status = true;
}
else
{
$status = false;
}
} | [
"protected",
"function",
"modifyColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"val",
",",
"$",
"dbForge",
",",
"&",
"$",
"status",
",",
"$",
"active",
",",
"$",
"current",
")",
"{",
"if",
"(",
"$",
"active",
"!==",
"$",
"current",
")",
"{",
"$",
"dbForge",
"->",
"modifyColumn",
"(",
"$",
"table",
",",
"[",
"$",
"key",
"=>",
"$",
"val",
"]",
")",
";",
"$",
"status",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"status",
"=",
"false",
";",
"}",
"}"
] | Protected modify column from active table | [
"Protected",
"modify",
"column",
"from",
"active",
"table"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L188-L199 |
6,930 | znframework/package-generator | Databases.php | Databases.addColumnFromActiveTable | protected function addColumnFromActiveTable($table, $key, $val, $dbForge, &$status)
{
$dbForge->addColumn($table, [$key => $val]);
$status = true;
} | php | protected function addColumnFromActiveTable($table, $key, $val, $dbForge, &$status)
{
$dbForge->addColumn($table, [$key => $val]);
$status = true;
} | [
"protected",
"function",
"addColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"val",
",",
"$",
"dbForge",
",",
"&",
"$",
"status",
")",
"{",
"$",
"dbForge",
"->",
"addColumn",
"(",
"$",
"table",
",",
"[",
"$",
"key",
"=>",
"$",
"val",
"]",
")",
";",
"$",
"status",
"=",
"true",
";",
"}"
] | Protected add column from active table | [
"Protected",
"add",
"column",
"from",
"active",
"table"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L204-L208 |
6,931 | znframework/package-generator | Databases.php | Databases.active | protected function active()
{
if( empty($activeDatabaseList = $this->getActiveDatabaseList()) )
{
return false;
}
$this->setActiveDatabaseEncoding($encoding);
$status = false;
$tableKeyColumnDesignData = $this->getTableKeyColumnDesignData();
foreach( $activeDatabaseList as $database )
{
$this->forge->createDatabase($database, $encoding);
if( ! empty($activeTableList = $this->getTableListByActiveDatabase($database)) )
{
$dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
$db = $this->getDBDifferentConnectionByDatabaseName($database);
foreach( $activeTableList as $table )
{
$activeTableColumnSchema = $this->getActiveTableColumnSchema($database, $table);
$this->addIdColumnToActiveTableIfNotExists($activeTableColumnSchema);
$activeTableColumns = $this->getActiveTableColumns($table = $this->getTableNameWithoutExtension($table), $db);
$this->getActiveTableKeyAndColumns($activeTableColumns, $activeTableKey, $activeTableColumns);
$currentTableKey = $this->getCurrentTableKey($table, $activeTableColumnSchema);
if( ! empty($activeTableColumns) )
{
$columnsMerge = array_merge(array_flip($activeTableColumns), $activeTableColumnSchema);
foreach( $columnsMerge as $key => $val )
{
if( is_numeric($val) )
{
$this->dropColumnFromActiveTable($table, $key, $dbForge, $status);
}
elseif( in_array($key, $activeTableColumns) )
{
$this->modifyColumnFromActiveTable($table, $key, $val, $dbForge, $status, $activeTableKey, $currentTableKey);
}
else
{
$this->addColumnFromActiveTable($table, $key, $val, $dbForge, $status);
}
}
if( $status === true )
{
$this->addTableToArchive($database, $table);
}
}
else
{
$activeTableColumnSchema[$currentTableKey] = $tableKeyColumnDesignData;
$dbForge->createTable($table, $activeTableColumnSchema);
}
}
}
}
} | php | protected function active()
{
if( empty($activeDatabaseList = $this->getActiveDatabaseList()) )
{
return false;
}
$this->setActiveDatabaseEncoding($encoding);
$status = false;
$tableKeyColumnDesignData = $this->getTableKeyColumnDesignData();
foreach( $activeDatabaseList as $database )
{
$this->forge->createDatabase($database, $encoding);
if( ! empty($activeTableList = $this->getTableListByActiveDatabase($database)) )
{
$dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
$db = $this->getDBDifferentConnectionByDatabaseName($database);
foreach( $activeTableList as $table )
{
$activeTableColumnSchema = $this->getActiveTableColumnSchema($database, $table);
$this->addIdColumnToActiveTableIfNotExists($activeTableColumnSchema);
$activeTableColumns = $this->getActiveTableColumns($table = $this->getTableNameWithoutExtension($table), $db);
$this->getActiveTableKeyAndColumns($activeTableColumns, $activeTableKey, $activeTableColumns);
$currentTableKey = $this->getCurrentTableKey($table, $activeTableColumnSchema);
if( ! empty($activeTableColumns) )
{
$columnsMerge = array_merge(array_flip($activeTableColumns), $activeTableColumnSchema);
foreach( $columnsMerge as $key => $val )
{
if( is_numeric($val) )
{
$this->dropColumnFromActiveTable($table, $key, $dbForge, $status);
}
elseif( in_array($key, $activeTableColumns) )
{
$this->modifyColumnFromActiveTable($table, $key, $val, $dbForge, $status, $activeTableKey, $currentTableKey);
}
else
{
$this->addColumnFromActiveTable($table, $key, $val, $dbForge, $status);
}
}
if( $status === true )
{
$this->addTableToArchive($database, $table);
}
}
else
{
$activeTableColumnSchema[$currentTableKey] = $tableKeyColumnDesignData;
$dbForge->createTable($table, $activeTableColumnSchema);
}
}
}
}
} | [
"protected",
"function",
"active",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"activeDatabaseList",
"=",
"$",
"this",
"->",
"getActiveDatabaseList",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"setActiveDatabaseEncoding",
"(",
"$",
"encoding",
")",
";",
"$",
"status",
"=",
"false",
";",
"$",
"tableKeyColumnDesignData",
"=",
"$",
"this",
"->",
"getTableKeyColumnDesignData",
"(",
")",
";",
"foreach",
"(",
"$",
"activeDatabaseList",
"as",
"$",
"database",
")",
"{",
"$",
"this",
"->",
"forge",
"->",
"createDatabase",
"(",
"$",
"database",
",",
"$",
"encoding",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"activeTableList",
"=",
"$",
"this",
"->",
"getTableListByActiveDatabase",
"(",
"$",
"database",
")",
")",
")",
"{",
"$",
"dbForge",
"=",
"$",
"this",
"->",
"getDBForgeDifferentConnectionByDatabaseName",
"(",
"$",
"database",
")",
";",
"$",
"db",
"=",
"$",
"this",
"->",
"getDBDifferentConnectionByDatabaseName",
"(",
"$",
"database",
")",
";",
"foreach",
"(",
"$",
"activeTableList",
"as",
"$",
"table",
")",
"{",
"$",
"activeTableColumnSchema",
"=",
"$",
"this",
"->",
"getActiveTableColumnSchema",
"(",
"$",
"database",
",",
"$",
"table",
")",
";",
"$",
"this",
"->",
"addIdColumnToActiveTableIfNotExists",
"(",
"$",
"activeTableColumnSchema",
")",
";",
"$",
"activeTableColumns",
"=",
"$",
"this",
"->",
"getActiveTableColumns",
"(",
"$",
"table",
"=",
"$",
"this",
"->",
"getTableNameWithoutExtension",
"(",
"$",
"table",
")",
",",
"$",
"db",
")",
";",
"$",
"this",
"->",
"getActiveTableKeyAndColumns",
"(",
"$",
"activeTableColumns",
",",
"$",
"activeTableKey",
",",
"$",
"activeTableColumns",
")",
";",
"$",
"currentTableKey",
"=",
"$",
"this",
"->",
"getCurrentTableKey",
"(",
"$",
"table",
",",
"$",
"activeTableColumnSchema",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"activeTableColumns",
")",
")",
"{",
"$",
"columnsMerge",
"=",
"array_merge",
"(",
"array_flip",
"(",
"$",
"activeTableColumns",
")",
",",
"$",
"activeTableColumnSchema",
")",
";",
"foreach",
"(",
"$",
"columnsMerge",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"val",
")",
")",
"{",
"$",
"this",
"->",
"dropColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"dbForge",
",",
"$",
"status",
")",
";",
"}",
"elseif",
"(",
"in_array",
"(",
"$",
"key",
",",
"$",
"activeTableColumns",
")",
")",
"{",
"$",
"this",
"->",
"modifyColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"val",
",",
"$",
"dbForge",
",",
"$",
"status",
",",
"$",
"activeTableKey",
",",
"$",
"currentTableKey",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"addColumnFromActiveTable",
"(",
"$",
"table",
",",
"$",
"key",
",",
"$",
"val",
",",
"$",
"dbForge",
",",
"$",
"status",
")",
";",
"}",
"}",
"if",
"(",
"$",
"status",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"addTableToArchive",
"(",
"$",
"database",
",",
"$",
"table",
")",
";",
"}",
"}",
"else",
"{",
"$",
"activeTableColumnSchema",
"[",
"$",
"currentTableKey",
"]",
"=",
"$",
"tableKeyColumnDesignData",
";",
"$",
"dbForge",
"->",
"createTable",
"(",
"$",
"table",
",",
"$",
"activeTableColumnSchema",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Protected Actives Databases | [
"Protected",
"Actives",
"Databases"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L213-L281 |
6,932 | znframework/package-generator | Databases.php | Databases.addTableToArchive | protected function addTableToArchive($database, $table)
{
$this->createArchiveDatabaseDirectoryIfNotExists($database);
file_put_contents
(
$this->getArchiveTableFilePath($path = $database . '/' . $table),
$this->getActiveTableFileContent($path)
);
} | php | protected function addTableToArchive($database, $table)
{
$this->createArchiveDatabaseDirectoryIfNotExists($database);
file_put_contents
(
$this->getArchiveTableFilePath($path = $database . '/' . $table),
$this->getActiveTableFileContent($path)
);
} | [
"protected",
"function",
"addTableToArchive",
"(",
"$",
"database",
",",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"createArchiveDatabaseDirectoryIfNotExists",
"(",
"$",
"database",
")",
";",
"file_put_contents",
"(",
"$",
"this",
"->",
"getArchiveTableFilePath",
"(",
"$",
"path",
"=",
"$",
"database",
".",
"'/'",
".",
"$",
"table",
")",
",",
"$",
"this",
"->",
"getActiveTableFileContent",
"(",
"$",
"path",
")",
")",
";",
"}"
] | Protected add table to archive | [
"Protected",
"add",
"table",
"to",
"archive"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L286-L295 |
6,933 | znframework/package-generator | Databases.php | Databases.createArchiveDatabaseDirectoryIfNotExists | protected function createArchiveDatabaseDirectoryIfNotExists($database)
{
$path = $this->archivesPath . $database . '/';
if( ! is_dir($path) )
{
Filesystem::createFolder($path);
}
} | php | protected function createArchiveDatabaseDirectoryIfNotExists($database)
{
$path = $this->archivesPath . $database . '/';
if( ! is_dir($path) )
{
Filesystem::createFolder($path);
}
} | [
"protected",
"function",
"createArchiveDatabaseDirectoryIfNotExists",
"(",
"$",
"database",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"archivesPath",
".",
"$",
"database",
".",
"'/'",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"Filesystem",
"::",
"createFolder",
"(",
"$",
"path",
")",
";",
"}",
"}"
] | Protected create archive database directory if not exists | [
"Protected",
"create",
"archive",
"database",
"directory",
"if",
"not",
"exists"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L316-L324 |
6,934 | znframework/package-generator | Databases.php | Databases.getArchiveDatabaseTableList | protected function getArchiveDatabaseTableList($database)
{
$databasePath = $this->archivesPath . $database . '/';
$tables = Filesystem::getFiles($databasePath, 'php');
$pregGrep = preg_grep("/\_[0-9]*\.php/", $tables);
return Arrays\RemoveElement::element($tables, $pregGrep);
} | php | protected function getArchiveDatabaseTableList($database)
{
$databasePath = $this->archivesPath . $database . '/';
$tables = Filesystem::getFiles($databasePath, 'php');
$pregGrep = preg_grep("/\_[0-9]*\.php/", $tables);
return Arrays\RemoveElement::element($tables, $pregGrep);
} | [
"protected",
"function",
"getArchiveDatabaseTableList",
"(",
"$",
"database",
")",
"{",
"$",
"databasePath",
"=",
"$",
"this",
"->",
"archivesPath",
".",
"$",
"database",
".",
"'/'",
";",
"$",
"tables",
"=",
"Filesystem",
"::",
"getFiles",
"(",
"$",
"databasePath",
",",
"'php'",
")",
";",
"$",
"pregGrep",
"=",
"preg_grep",
"(",
"\"/\\_[0-9]*\\.php/\"",
",",
"$",
"tables",
")",
";",
"return",
"Arrays",
"\\",
"RemoveElement",
"::",
"element",
"(",
"$",
"tables",
",",
"$",
"pregGrep",
")",
";",
"}"
] | Protected get archive database table list | [
"Protected",
"get",
"archive",
"database",
"table",
"list"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L329-L337 |
6,935 | znframework/package-generator | Databases.php | Databases.archive | protected function archive()
{
if( $archiveDatabaseList = $this->getArchiveDatabaseList() )
{
foreach( $archiveDatabaseList as $database )
{
if( ! empty($tables = $this->getArchiveDatabaseTableList($database)) )
{
$dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
foreach( $tables as $table )
{
$dbForge->dropTable($this->getTableNameWithoutExtension($table));
}
}
$tool = $this->getDBToolDifferentConnectionByDatabaseName($database);
if( empty($tool->listTables()) )
{
$this->forge->dropDatabase($database);
}
}
return true;
}
return false;
} | php | protected function archive()
{
if( $archiveDatabaseList = $this->getArchiveDatabaseList() )
{
foreach( $archiveDatabaseList as $database )
{
if( ! empty($tables = $this->getArchiveDatabaseTableList($database)) )
{
$dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
foreach( $tables as $table )
{
$dbForge->dropTable($this->getTableNameWithoutExtension($table));
}
}
$tool = $this->getDBToolDifferentConnectionByDatabaseName($database);
if( empty($tool->listTables()) )
{
$this->forge->dropDatabase($database);
}
}
return true;
}
return false;
} | [
"protected",
"function",
"archive",
"(",
")",
"{",
"if",
"(",
"$",
"archiveDatabaseList",
"=",
"$",
"this",
"->",
"getArchiveDatabaseList",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"archiveDatabaseList",
"as",
"$",
"database",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"tables",
"=",
"$",
"this",
"->",
"getArchiveDatabaseTableList",
"(",
"$",
"database",
")",
")",
")",
"{",
"$",
"dbForge",
"=",
"$",
"this",
"->",
"getDBForgeDifferentConnectionByDatabaseName",
"(",
"$",
"database",
")",
";",
"foreach",
"(",
"$",
"tables",
"as",
"$",
"table",
")",
"{",
"$",
"dbForge",
"->",
"dropTable",
"(",
"$",
"this",
"->",
"getTableNameWithoutExtension",
"(",
"$",
"table",
")",
")",
";",
"}",
"}",
"$",
"tool",
"=",
"$",
"this",
"->",
"getDBToolDifferentConnectionByDatabaseName",
"(",
"$",
"database",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"tool",
"->",
"listTables",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"forge",
"->",
"dropDatabase",
"(",
"$",
"database",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Protected Archives Database | [
"Protected",
"Archives",
"Database"
] | 4524c28c607d8a5799b60bd39bee8be4fd1e7fba | https://github.com/znframework/package-generator/blob/4524c28c607d8a5799b60bd39bee8be4fd1e7fba/Databases.php#L342-L370 |
6,936 | n0m4dz/laracasa | Zend/Gdata/YouTube/PlaylistListEntry.php | Zend_Gdata_YouTube_PlaylistListEntry.setDescription | public function setDescription($description = null)
{
if ($this->getMajorProtocolVersion() >= 2) {
$this->setSummary($description);
} else {
$this->_description = $description;
}
return $this;
} | php | public function setDescription($description = null)
{
if ($this->getMajorProtocolVersion() >= 2) {
$this->setSummary($description);
} else {
$this->_description = $description;
}
return $this;
} | [
"public",
"function",
"setDescription",
"(",
"$",
"description",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMajorProtocolVersion",
"(",
")",
">=",
"2",
")",
"{",
"$",
"this",
"->",
"setSummary",
"(",
"$",
"description",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_description",
"=",
"$",
"description",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Sets the description relating to the playlist.
@deprecated Deprecated as of version 2 of the YouTube API.
@param Zend_Gdata_YouTube_Extension_Description $description The description relating to the video
@return Zend_Gdata_YouTube_PlaylistListEntry Provides a fluent interface | [
"Sets",
"the",
"description",
"relating",
"to",
"the",
"playlist",
"."
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/YouTube/PlaylistListEntry.php#L183-L191 |
6,937 | n0m4dz/laracasa | Zend/Gdata/YouTube/PlaylistListEntry.php | Zend_Gdata_YouTube_PlaylistListEntry.getPlaylistVideoFeedUrl | public function getPlaylistVideoFeedUrl()
{
if ($this->getMajorProtocolVersion() >= 2) {
return $this->getContent()->getSrc();
} else {
return $this->getFeedLink(Zend_Gdata_YouTube::PLAYLIST_REL)->href;
}
} | php | public function getPlaylistVideoFeedUrl()
{
if ($this->getMajorProtocolVersion() >= 2) {
return $this->getContent()->getSrc();
} else {
return $this->getFeedLink(Zend_Gdata_YouTube::PLAYLIST_REL)->href;
}
} | [
"public",
"function",
"getPlaylistVideoFeedUrl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMajorProtocolVersion",
"(",
")",
">=",
"2",
")",
"{",
"return",
"$",
"this",
"->",
"getContent",
"(",
")",
"->",
"getSrc",
"(",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"getFeedLink",
"(",
"Zend_Gdata_YouTube",
"::",
"PLAYLIST_REL",
")",
"->",
"href",
";",
"}",
"}"
] | Returns the URL of the playlist video feed
@return string The URL of the playlist video feed | [
"Returns",
"the",
"URL",
"of",
"the",
"playlist",
"video",
"feed"
] | 6141f0c16c7d4453275e3b74be5041f336085c91 | https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/YouTube/PlaylistListEntry.php#L291-L298 |
6,938 | faithmade/rock | inc/customizer.php | Rock_Customizer.selective_refresh | public function selective_refresh( WP_Customize_Manager $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( ! isset( $wp_customize->selective_refresh ) ) {
return;
}
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => array( $this, 'blogname' ),
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => array( $this, 'blogdescription' ),
)
);
} | php | public function selective_refresh( WP_Customize_Manager $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( ! isset( $wp_customize->selective_refresh ) ) {
return;
}
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => array( $this, 'blogname' ),
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => array( $this, 'blogdescription' ),
)
);
} | [
"public",
"function",
"selective_refresh",
"(",
"WP_Customize_Manager",
"$",
"wp_customize",
")",
"{",
"$",
"wp_customize",
"->",
"get_setting",
"(",
"'blogname'",
")",
"->",
"transport",
"=",
"'postMessage'",
";",
"$",
"wp_customize",
"->",
"get_setting",
"(",
"'blogdescription'",
")",
"->",
"transport",
"=",
"'postMessage'",
";",
"$",
"wp_customize",
"->",
"get_setting",
"(",
"'header_textcolor'",
")",
"->",
"transport",
"=",
"'postMessage'",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"wp_customize",
"->",
"selective_refresh",
")",
")",
"{",
"return",
";",
"}",
"$",
"wp_customize",
"->",
"selective_refresh",
"->",
"add_partial",
"(",
"'blogname'",
",",
"array",
"(",
"'selector'",
"=>",
"'.site-title a'",
",",
"'container_inclusive'",
"=>",
"false",
",",
"'render_callback'",
"=>",
"array",
"(",
"$",
"this",
",",
"'blogname'",
")",
",",
")",
")",
";",
"$",
"wp_customize",
"->",
"selective_refresh",
"->",
"add_partial",
"(",
"'blogdescription'",
",",
"array",
"(",
"'selector'",
"=>",
"'.site-description'",
",",
"'container_inclusive'",
"=>",
"false",
",",
"'render_callback'",
"=>",
"array",
"(",
"$",
"this",
",",
"'blogdescription'",
")",
",",
")",
")",
";",
"}"
] | Adds postMessage support for site title and description for the Customizer.
@action customize_register
@since 1.0.0
@uses $this->blogname()
@uses $this->blogdescription()
@param WP_Customize_Manager $wp_customize | [
"Adds",
"postMessage",
"support",
"for",
"site",
"title",
"and",
"description",
"for",
"the",
"Customizer",
"."
] | 2a95ae1ed38cff3d0c20e21530bac30734e434ce | https://github.com/faithmade/rock/blob/2a95ae1ed38cff3d0c20e21530bac30734e434ce/inc/customizer.php#L92-L122 |
6,939 | faithmade/rock | inc/customizer.php | Rock_Customizer.parse_css_rules | public static function parse_css_rules( array $rules ) {
ob_start();
foreach ( $rules as $rule => $properties ) {
printf(
"%s {\n",
implode( ",\n", array_map( 'trim', explode( ',', $rule ) ) )
);
foreach ( $properties as $property => $value ) {
printf( "\t%s: %s;\n", $property, $value );
}
echo "}\n";
}
return ob_get_clean();
} | php | public static function parse_css_rules( array $rules ) {
ob_start();
foreach ( $rules as $rule => $properties ) {
printf(
"%s {\n",
implode( ",\n", array_map( 'trim', explode( ',', $rule ) ) )
);
foreach ( $properties as $property => $value ) {
printf( "\t%s: %s;\n", $property, $value );
}
echo "}\n";
}
return ob_get_clean();
} | [
"public",
"static",
"function",
"parse_css_rules",
"(",
"array",
"$",
"rules",
")",
"{",
"ob_start",
"(",
")",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"rule",
"=>",
"$",
"properties",
")",
"{",
"printf",
"(",
"\"%s {\\n\"",
",",
"implode",
"(",
"\",\\n\"",
",",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
",",
"$",
"rule",
")",
")",
")",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"printf",
"(",
"\"\\t%s: %s;\\n\"",
",",
"$",
"property",
",",
"$",
"value",
")",
";",
"}",
"echo",
"\"}\\n\"",
";",
"}",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Return an array of CSS rules as plain CSS.
@since 1.0.0
@param array $rules
@return string | [
"Return",
"an",
"array",
"of",
"CSS",
"rules",
"as",
"plain",
"CSS",
"."
] | 2a95ae1ed38cff3d0c20e21530bac30734e434ce | https://github.com/faithmade/rock/blob/2a95ae1ed38cff3d0c20e21530bac30734e434ce/inc/customizer.php#L204-L227 |
6,940 | SolidWorx/Util | src/ArrayUtil.php | ArrayUtil.column | public static function column($array, string $column, bool $filter = true): array
{
if (!is_array($array) && !$array instanceof \Traversable) {
throw new \Exception(sprintf('Array or instance of Traversable expected, "%s" given', gettype($array)));
}
$filterFunc = function (array $result) use ($filter) {
return $filter ? array_filter($result, function ($item): bool {
return null !== $item;
}) : $result;
};
if (is_array($array) && 0 < count($array)) {
reset($array);
if (is_array($array[key($array)])) {
return $filterFunc(array_column($array, $column));
}
}
$accessor = PropertyAccess::createPropertyAccessor();
$result = [];
foreach ($array as $item) {
$check = $column;
if ((is_array($item) || $item instanceof \ArrayAccess) && '[' !== $column[0]) {
$check = '['.$column.']';
}
$result[] = $accessor->getValue($item, $check);
}
return $filterFunc($result);
} | php | public static function column($array, string $column, bool $filter = true): array
{
if (!is_array($array) && !$array instanceof \Traversable) {
throw new \Exception(sprintf('Array or instance of Traversable expected, "%s" given', gettype($array)));
}
$filterFunc = function (array $result) use ($filter) {
return $filter ? array_filter($result, function ($item): bool {
return null !== $item;
}) : $result;
};
if (is_array($array) && 0 < count($array)) {
reset($array);
if (is_array($array[key($array)])) {
return $filterFunc(array_column($array, $column));
}
}
$accessor = PropertyAccess::createPropertyAccessor();
$result = [];
foreach ($array as $item) {
$check = $column;
if ((is_array($item) || $item instanceof \ArrayAccess) && '[' !== $column[0]) {
$check = '['.$column.']';
}
$result[] = $accessor->getValue($item, $check);
}
return $filterFunc($result);
} | [
"public",
"static",
"function",
"column",
"(",
"$",
"array",
",",
"string",
"$",
"column",
",",
"bool",
"$",
"filter",
"=",
"true",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
"&&",
"!",
"$",
"array",
"instanceof",
"\\",
"Traversable",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Array or instance of Traversable expected, \"%s\" given'",
",",
"gettype",
"(",
"$",
"array",
")",
")",
")",
";",
"}",
"$",
"filterFunc",
"=",
"function",
"(",
"array",
"$",
"result",
")",
"use",
"(",
"$",
"filter",
")",
"{",
"return",
"$",
"filter",
"?",
"array_filter",
"(",
"$",
"result",
",",
"function",
"(",
"$",
"item",
")",
":",
"bool",
"{",
"return",
"null",
"!==",
"$",
"item",
";",
"}",
")",
":",
"$",
"result",
";",
"}",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
"&&",
"0",
"<",
"count",
"(",
"$",
"array",
")",
")",
"{",
"reset",
"(",
"$",
"array",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
"[",
"key",
"(",
"$",
"array",
")",
"]",
")",
")",
"{",
"return",
"$",
"filterFunc",
"(",
"array_column",
"(",
"$",
"array",
",",
"$",
"column",
")",
")",
";",
"}",
"}",
"$",
"accessor",
"=",
"PropertyAccess",
"::",
"createPropertyAccessor",
"(",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"item",
")",
"{",
"$",
"check",
"=",
"$",
"column",
";",
"if",
"(",
"(",
"is_array",
"(",
"$",
"item",
")",
"||",
"$",
"item",
"instanceof",
"\\",
"ArrayAccess",
")",
"&&",
"'['",
"!==",
"$",
"column",
"[",
"0",
"]",
")",
"{",
"$",
"check",
"=",
"'['",
".",
"$",
"column",
".",
"']'",
";",
"}",
"$",
"result",
"[",
"]",
"=",
"$",
"accessor",
"->",
"getValue",
"(",
"$",
"item",
",",
"$",
"check",
")",
";",
"}",
"return",
"$",
"filterFunc",
"(",
"$",
"result",
")",
";",
"}"
] | Returns a specific column from an array.
@param array|\Traversable $array
@param string $column
@param bool $filter To filter out empty values
@return array
@throws \Exception | [
"Returns",
"a",
"specific",
"column",
"from",
"an",
"array",
"."
] | e7f4d1d3b701a2b8364d6a5c5a5ef35ed18b1592 | https://github.com/SolidWorx/Util/blob/e7f4d1d3b701a2b8364d6a5c5a5ef35ed18b1592/src/ArrayUtil.php#L31-L65 |
6,941 | weavephp/middleware-relay | src/Relay.php | Relay.executePipeline | public function executePipeline($pipeline, Request $request, Response $response = null)
{
$relayBuilder = new \Relay\RelayBuilder($this->resolver);
$relay = $relayBuilder->newInstance($pipeline);
return $relay($request, $response);
} | php | public function executePipeline($pipeline, Request $request, Response $response = null)
{
$relayBuilder = new \Relay\RelayBuilder($this->resolver);
$relay = $relayBuilder->newInstance($pipeline);
return $relay($request, $response);
} | [
"public",
"function",
"executePipeline",
"(",
"$",
"pipeline",
",",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"relayBuilder",
"=",
"new",
"\\",
"Relay",
"\\",
"RelayBuilder",
"(",
"$",
"this",
"->",
"resolver",
")",
";",
"$",
"relay",
"=",
"$",
"relayBuilder",
"->",
"newInstance",
"(",
"$",
"pipeline",
")",
";",
"return",
"$",
"relay",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"}"
] | Trigger execution of the supplied pipeline through Relay.
@param mixed $pipeline The stack of middleware definitions.
@param Request $request The PSR7 request.
@param Response $response The PSR7 response (for double-pass stacks).
@return Response | [
"Trigger",
"execution",
"of",
"the",
"supplied",
"pipeline",
"through",
"Relay",
"."
] | 09e12a05875f428dc7ada5b179e47775da2d12b3 | https://github.com/weavephp/middleware-relay/blob/09e12a05875f428dc7ada5b179e47775da2d12b3/src/Relay.php#L53-L58 |
6,942 | vitodtagliente/pure-routing | Router.php | Router.rule | public function rule($key, $regex){
if(!array_key_exists($key, $this->rules))
$this->rules[$key] = $regex;
} | php | public function rule($key, $regex){
if(!array_key_exists($key, $this->rules))
$this->rules[$key] = $regex;
} | [
"public",
"function",
"rule",
"(",
"$",
"key",
",",
"$",
"regex",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"rules",
")",
")",
"$",
"this",
"->",
"rules",
"[",
"$",
"key",
"]",
"=",
"$",
"regex",
";",
"}"
] | aggiungi una nuova regola | [
"aggiungi",
"una",
"nuova",
"regola"
] | f36396e20838464bf7ccd4b34ef5660cdb255ae1 | https://github.com/vitodtagliente/pure-routing/blob/f36396e20838464bf7ccd4b34ef5660cdb255ae1/Router.php#L33-L36 |
6,943 | vitodtagliente/pure-routing | Router.php | Router.namespace | public function namespace($key, $value){
if(!array_key_exists($key, $this->namespaces))
$this->namespaces[$key] = $value;
} | php | public function namespace($key, $value){
if(!array_key_exists($key, $this->namespaces))
$this->namespaces[$key] = $value;
} | [
"public",
"function",
"namespace",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"namespaces",
")",
")",
"$",
"this",
"->",
"namespaces",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] | aggiungi un nuovo namespace | [
"aggiungi",
"un",
"nuovo",
"namespace"
] | f36396e20838464bf7ccd4b34ef5660cdb255ae1 | https://github.com/vitodtagliente/pure-routing/blob/f36396e20838464bf7ccd4b34ef5660cdb255ae1/Router.php#L39-L42 |
6,944 | vitodtagliente/pure-routing | Router.php | Router.map | public function map($method, $action, $callback){
$route = new Route($method, $action, $callback);
array_push($this->routes, $route);
return $route;
} | php | public function map($method, $action, $callback){
$route = new Route($method, $action, $callback);
array_push($this->routes, $route);
return $route;
} | [
"public",
"function",
"map",
"(",
"$",
"method",
",",
"$",
"action",
",",
"$",
"callback",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
"$",
"method",
",",
"$",
"action",
",",
"$",
"callback",
")",
";",
"array_push",
"(",
"$",
"this",
"->",
"routes",
",",
"$",
"route",
")",
";",
"return",
"$",
"route",
";",
"}"
] | mappature delle richieste | [
"mappature",
"delle",
"richieste"
] | f36396e20838464bf7ccd4b34ef5660cdb255ae1 | https://github.com/vitodtagliente/pure-routing/blob/f36396e20838464bf7ccd4b34ef5660cdb255ae1/Router.php#L45-L49 |
6,945 | vitodtagliente/pure-routing | Router.php | Router.uri | public function uri(){
$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
$uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
$uri = '/' . trim($uri, '/');
return $uri;
} | php | public function uri(){
$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
$uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
$uri = '/' . trim($uri, '/');
return $uri;
} | [
"public",
"function",
"uri",
"(",
")",
"{",
"$",
"basepath",
"=",
"implode",
"(",
"'/'",
",",
"array_slice",
"(",
"explode",
"(",
"'/'",
",",
"$",
"_SERVER",
"[",
"'SCRIPT_NAME'",
"]",
")",
",",
"0",
",",
"-",
"1",
")",
")",
".",
"'/'",
";",
"$",
"uri",
"=",
"substr",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
",",
"strlen",
"(",
"$",
"basepath",
")",
")",
";",
"if",
"(",
"strstr",
"(",
"$",
"uri",
",",
"'?'",
")",
")",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"0",
",",
"strpos",
"(",
"$",
"uri",
",",
"'?'",
")",
")",
";",
"$",
"uri",
"=",
"'/'",
".",
"trim",
"(",
"$",
"uri",
",",
"'/'",
")",
";",
"return",
"$",
"uri",
";",
"}"
] | ritorna l'uri corrente | [
"ritorna",
"l",
"uri",
"corrente"
] | f36396e20838464bf7ccd4b34ef5660cdb255ae1 | https://github.com/vitodtagliente/pure-routing/blob/f36396e20838464bf7ccd4b34ef5660cdb255ae1/Router.php#L57-L63 |
6,946 | vitodtagliente/pure-routing | Router.php | Router.dispatch | public function dispatch()
{
// prendi l'uri corrente priva di argomenti get
$current_uri = $this->base_uri();
// memorizza il metodo corrente
$current_method = $this->method();
foreach($this->routes as $route)
{
// confronta l'uri corrente con
// la rotta, se corrispondono
// eseguila
if($route->match($current_uri, $current_method, $this->rules))
{
return $route->call($this->namespaces);
}
}
return false;
} | php | public function dispatch()
{
// prendi l'uri corrente priva di argomenti get
$current_uri = $this->base_uri();
// memorizza il metodo corrente
$current_method = $this->method();
foreach($this->routes as $route)
{
// confronta l'uri corrente con
// la rotta, se corrispondono
// eseguila
if($route->match($current_uri, $current_method, $this->rules))
{
return $route->call($this->namespaces);
}
}
return false;
} | [
"public",
"function",
"dispatch",
"(",
")",
"{",
"// prendi l'uri corrente priva di argomenti get",
"$",
"current_uri",
"=",
"$",
"this",
"->",
"base_uri",
"(",
")",
";",
"// memorizza il metodo corrente",
"$",
"current_method",
"=",
"$",
"this",
"->",
"method",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"// confronta l'uri corrente con",
"// la rotta, se corrispondono ",
"// eseguila",
"if",
"(",
"$",
"route",
"->",
"match",
"(",
"$",
"current_uri",
",",
"$",
"current_method",
",",
"$",
"this",
"->",
"rules",
")",
")",
"{",
"return",
"$",
"route",
"->",
"call",
"(",
"$",
"this",
"->",
"namespaces",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | elaborazione della richiesta dell'utente | [
"elaborazione",
"della",
"richiesta",
"dell",
"utente"
] | f36396e20838464bf7ccd4b34ef5660cdb255ae1 | https://github.com/vitodtagliente/pure-routing/blob/f36396e20838464bf7ccd4b34ef5660cdb255ae1/Router.php#L80-L98 |
6,947 | allebb/clip | src/Utilities/ClassMethodHandler.php | ClassMethodHandler.call | public function call($params = null)
{
$method = $this->method;
if (!empty($this->constructor_arguments)) {
$instance = new $this->class($this->constructor_arguments);
} else {
$instance = new $this->class();
}
if (!is_null($params)) {
return $instance->$method($params);
}
return $instance->$method();
} | php | public function call($params = null)
{
$method = $this->method;
if (!empty($this->constructor_arguments)) {
$instance = new $this->class($this->constructor_arguments);
} else {
$instance = new $this->class();
}
if (!is_null($params)) {
return $instance->$method($params);
}
return $instance->$method();
} | [
"public",
"function",
"call",
"(",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"method",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"constructor_arguments",
")",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"this",
"->",
"class",
"(",
"$",
"this",
"->",
"constructor_arguments",
")",
";",
"}",
"else",
"{",
"$",
"instance",
"=",
"new",
"$",
"this",
"->",
"class",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"params",
")",
")",
"{",
"return",
"$",
"instance",
"->",
"$",
"method",
"(",
"$",
"params",
")",
";",
"}",
"return",
"$",
"instance",
"->",
"$",
"method",
"(",
")",
";",
"}"
] | Calls the requested class and method name passing in the optional arguments.
@param mixed $params Optional parameters to pass to the class method.
@return void | [
"Calls",
"the",
"requested",
"class",
"and",
"method",
"name",
"passing",
"in",
"the",
"optional",
"arguments",
"."
] | a7963801a58406f49a1d441ac53ee4decca6db30 | https://github.com/allebb/clip/blob/a7963801a58406f49a1d441ac53ee4decca6db30/src/Utilities/ClassMethodHandler.php#L66-L79 |
6,948 | allebb/clip | src/Utilities/ClassMethodHandler.php | ClassMethodHandler.extract | private function extract($handler)
{
if (is_array($handler)) {
return $this->fromClassMethodArray($handler);
}
if (strpos($handler, self::CHAR_AT) !== false) {
return $this->fromAtNotation($handler);
}
if (strpos($handler, self::CHAR_DOT) !== false) {
return $this->fromDotNotation($handler);
}
return $this->fromClassName($handler);
} | php | private function extract($handler)
{
if (is_array($handler)) {
return $this->fromClassMethodArray($handler);
}
if (strpos($handler, self::CHAR_AT) !== false) {
return $this->fromAtNotation($handler);
}
if (strpos($handler, self::CHAR_DOT) !== false) {
return $this->fromDotNotation($handler);
}
return $this->fromClassName($handler);
} | [
"private",
"function",
"extract",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"handler",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fromClassMethodArray",
"(",
"$",
"handler",
")",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"handler",
",",
"self",
"::",
"CHAR_AT",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"fromAtNotation",
"(",
"$",
"handler",
")",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"handler",
",",
"self",
"::",
"CHAR_DOT",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"fromDotNotation",
"(",
"$",
"handler",
")",
";",
"}",
"return",
"$",
"this",
"->",
"fromClassName",
"(",
"$",
"handler",
")",
";",
"}"
] | Extracts the class and method name.
@param string|array $handler The handler parameter
@return void | [
"Extracts",
"the",
"class",
"and",
"method",
"name",
"."
] | a7963801a58406f49a1d441ac53ee4decca6db30 | https://github.com/allebb/clip/blob/a7963801a58406f49a1d441ac53ee4decca6db30/src/Utilities/ClassMethodHandler.php#L86-L98 |
6,949 | allebb/clip | src/Utilities/ClassMethodHandler.php | ClassMethodHandler.validate | private function validate()
{
if (!class_exists($this->class)) {
throw new \RuntimeException(sprintf('Class %s does not exist, is this the correct namespace?', $this->class));
}
if (!in_array($this->method, get_class_methods($this->class))) {
throw new \RuntimeException(sprintf('The method "%s" does not exist in "%s" class.', $this->method, $this->class));
}
} | php | private function validate()
{
if (!class_exists($this->class)) {
throw new \RuntimeException(sprintf('Class %s does not exist, is this the correct namespace?', $this->class));
}
if (!in_array($this->method, get_class_methods($this->class))) {
throw new \RuntimeException(sprintf('The method "%s" does not exist in "%s" class.', $this->method, $this->class));
}
} | [
"private",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"this",
"->",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Class %s does not exist, is this the correct namespace?'",
",",
"$",
"this",
"->",
"class",
")",
")",
";",
"}",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"method",
",",
"get_class_methods",
"(",
"$",
"this",
"->",
"class",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'The method \"%s\" does not exist in \"%s\" class.'",
",",
"$",
"this",
"->",
"method",
",",
"$",
"this",
"->",
"class",
")",
")",
";",
"}",
"}"
] | Validates that the current class and methods exist and are callable.
@return void
@throws \RuntimeException | [
"Validates",
"that",
"the",
"current",
"class",
"and",
"methods",
"exist",
"and",
"are",
"callable",
"."
] | a7963801a58406f49a1d441ac53ee4decca6db30 | https://github.com/allebb/clip/blob/a7963801a58406f49a1d441ac53ee4decca6db30/src/Utilities/ClassMethodHandler.php#L105-L113 |
6,950 | allebb/clip | src/Utilities/ClassMethodHandler.php | ClassMethodHandler.fromAtNotation | private function fromAtNotation($handler)
{
$parts = explode(self::CHAR_AT, $handler);
if (count($parts) != 2) {
throw new \InvalidArgumentException('Invalid Class Method format from "at" notation.');
}
$this->class = $parts[0];
$this->method = $parts[1];
} | php | private function fromAtNotation($handler)
{
$parts = explode(self::CHAR_AT, $handler);
if (count($parts) != 2) {
throw new \InvalidArgumentException('Invalid Class Method format from "at" notation.');
}
$this->class = $parts[0];
$this->method = $parts[1];
} | [
"private",
"function",
"fromAtNotation",
"(",
"$",
"handler",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"self",
"::",
"CHAR_AT",
",",
"$",
"handler",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid Class Method format from \"at\" notation.'",
")",
";",
"}",
"$",
"this",
"->",
"class",
"=",
"$",
"parts",
"[",
"0",
"]",
";",
"$",
"this",
"->",
"method",
"=",
"$",
"parts",
"[",
"1",
"]",
";",
"}"
] | Extracts the class name and method from the Class Method string in "@" notation (eg. Class@Method).
@param string|array $handler The handler parameter
@return void
@throws \InvalidArgumentException | [
"Extracts",
"the",
"class",
"name",
"and",
"method",
"from",
"the",
"Class",
"Method",
"string",
"in"
] | a7963801a58406f49a1d441ac53ee4decca6db30 | https://github.com/allebb/clip/blob/a7963801a58406f49a1d441ac53ee4decca6db30/src/Utilities/ClassMethodHandler.php#L121-L129 |
6,951 | FuturaSoft/Pabana | src/Type/ArrayType.php | ArrayType.remove | public function remove($indexOrName)
{
if (isset($this->arrayVar[$indexOrName])) {
unset($this->arrayVar[$indexOrName]);
return true;
}
return false;
} | php | public function remove($indexOrName)
{
if (isset($this->arrayVar[$indexOrName])) {
unset($this->arrayVar[$indexOrName]);
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"indexOrName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"arrayVar",
"[",
"$",
"indexOrName",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"arrayVar",
"[",
"$",
"indexOrName",
"]",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Remove an item
@since 1.1
@param int|string $indexOrName Index or name of key
@return bool True if success or false if not exist | [
"Remove",
"an",
"item"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Type/ArrayType.php#L240-L247 |
6,952 | FuturaSoft/Pabana | src/Type/ArrayType.php | ArrayType.set | public function set($indexOrName, $value, $force = true)
{
if (isset($this->arrayVar[$indexOrName]) && $force === false) {
return false;
}
$this->arrayVar[$indexOrName] = $value;
return true;
} | php | public function set($indexOrName, $value, $force = true)
{
if (isset($this->arrayVar[$indexOrName]) && $force === false) {
return false;
}
$this->arrayVar[$indexOrName] = $value;
return true;
} | [
"public",
"function",
"set",
"(",
"$",
"indexOrName",
",",
"$",
"value",
",",
"$",
"force",
"=",
"true",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"arrayVar",
"[",
"$",
"indexOrName",
"]",
")",
"&&",
"$",
"force",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"arrayVar",
"[",
"$",
"indexOrName",
"]",
"=",
"$",
"value",
";",
"return",
"true",
";",
"}"
] | Define an item in Array
@since 1.1
@param int|string $indexOrName Index or name of key
@param mixed $value Value of item
@param bool $force Force change of value if key already exist
@return bool True if success or false if not exist | [
"Define",
"an",
"item",
"in",
"Array"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Type/ArrayType.php#L258-L265 |
6,953 | FuturaSoft/Pabana | src/Type/ArrayType.php | ArrayType.sort | public function sort($order = self::SORT_ASC, $type = self::SORT_REGULAR, $caseSensitive = true)
{
if ($caseSensitive === false) {
$type = $type + SORT_FLAG_CASE;
}
if ($this->isAssociative() === true) {
if ($order == self::SORT_ASC) {
asort($this->arrayVar, $type);
} else {
var_dump($type);
arsort($this->arrayVar, $type);
}
} else {
if ($order == self::SORT_ASC) {
sort($this->arrayVar, $type);
} else {
rsort($this->arrayVar, $type);
}
}
return $this;
} | php | public function sort($order = self::SORT_ASC, $type = self::SORT_REGULAR, $caseSensitive = true)
{
if ($caseSensitive === false) {
$type = $type + SORT_FLAG_CASE;
}
if ($this->isAssociative() === true) {
if ($order == self::SORT_ASC) {
asort($this->arrayVar, $type);
} else {
var_dump($type);
arsort($this->arrayVar, $type);
}
} else {
if ($order == self::SORT_ASC) {
sort($this->arrayVar, $type);
} else {
rsort($this->arrayVar, $type);
}
}
return $this;
} | [
"public",
"function",
"sort",
"(",
"$",
"order",
"=",
"self",
"::",
"SORT_ASC",
",",
"$",
"type",
"=",
"self",
"::",
"SORT_REGULAR",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"caseSensitive",
"===",
"false",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"+",
"SORT_FLAG_CASE",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isAssociative",
"(",
")",
"===",
"true",
")",
"{",
"if",
"(",
"$",
"order",
"==",
"self",
"::",
"SORT_ASC",
")",
"{",
"asort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"else",
"{",
"var_dump",
"(",
"$",
"type",
")",
";",
"arsort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"$",
"order",
"==",
"self",
"::",
"SORT_ASC",
")",
"{",
"sort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"else",
"{",
"rsort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] | Sort an array by value
@since 1.1
@param int $order Sort order (SORT_ASC or SORT_DESC)
@param int $type Sort type (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRING or SORT_NATURAL)
@param bool $caseSensitive Define if sort is case sensitive
@return $this Return current object | [
"Sort",
"an",
"array",
"by",
"value"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Type/ArrayType.php#L276-L296 |
6,954 | FuturaSoft/Pabana | src/Type/ArrayType.php | ArrayType.sortByKey | public function sortByKey($order = self::SORT_ASC, $type = self::SORT_REGULAR, $caseSensitive = true)
{
if ($caseSensitive === false) {
$type = $type + SORT_FLAG_CASE;
}
if ($this->isAssociative() === true) {
array_multisort(array_keys($this->arrayVar), $order, $type, $this->arrayVar);
} else {
if ($order == self::SORT_ASC) {
ksort($this->arrayVar, $type);
} else {
krsort($this->arrayVar, $type);
}
}
return $this;
} | php | public function sortByKey($order = self::SORT_ASC, $type = self::SORT_REGULAR, $caseSensitive = true)
{
if ($caseSensitive === false) {
$type = $type + SORT_FLAG_CASE;
}
if ($this->isAssociative() === true) {
array_multisort(array_keys($this->arrayVar), $order, $type, $this->arrayVar);
} else {
if ($order == self::SORT_ASC) {
ksort($this->arrayVar, $type);
} else {
krsort($this->arrayVar, $type);
}
}
return $this;
} | [
"public",
"function",
"sortByKey",
"(",
"$",
"order",
"=",
"self",
"::",
"SORT_ASC",
",",
"$",
"type",
"=",
"self",
"::",
"SORT_REGULAR",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"caseSensitive",
"===",
"false",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"+",
"SORT_FLAG_CASE",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isAssociative",
"(",
")",
"===",
"true",
")",
"{",
"array_multisort",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"arrayVar",
")",
",",
"$",
"order",
",",
"$",
"type",
",",
"$",
"this",
"->",
"arrayVar",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"order",
"==",
"self",
"::",
"SORT_ASC",
")",
"{",
"ksort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"else",
"{",
"krsort",
"(",
"$",
"this",
"->",
"arrayVar",
",",
"$",
"type",
")",
";",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] | Sort an array by key
@since 1.1
@param int $order Sort order (SORT_ASC or SORT_DESC)
@param int $type Sort type (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRING or SORT_NATURAL)
@param bool $caseSensitive Define if sort is case sensitive
@return $this Return current object | [
"Sort",
"an",
"array",
"by",
"key"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Type/ArrayType.php#L307-L322 |
6,955 | tweedegolf/generator | src/TweedeGolf/Generator/Console/Questioner.php | Questioner.update | public function update(Arguments $arguments, $property, $type, array $options = [])
{
if (!isset($arguments[$property]) || (isset($options['force']) && $options['force'])) {
$this->set($arguments, $property, $type, $options);
}
} | php | public function update(Arguments $arguments, $property, $type, array $options = [])
{
if (!isset($arguments[$property]) || (isset($options['force']) && $options['force'])) {
$this->set($arguments, $property, $type, $options);
}
} | [
"public",
"function",
"update",
"(",
"Arguments",
"$",
"arguments",
",",
"$",
"property",
",",
"$",
"type",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"$",
"property",
"]",
")",
"||",
"(",
"isset",
"(",
"$",
"options",
"[",
"'force'",
"]",
")",
"&&",
"$",
"options",
"[",
"'force'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"arguments",
",",
"$",
"property",
",",
"$",
"type",
",",
"$",
"options",
")",
";",
"}",
"}"
] | Set the value of a property in arguments to the value interactively retrieved if it wasn't set previously.
Will also forcefully request an update for the property if the option 'force' is set.
@param Arguments $arguments
@param string $property
@param string|InputTypeInterface $type
@param array $options | [
"Set",
"the",
"value",
"of",
"a",
"property",
"in",
"arguments",
"to",
"the",
"value",
"interactively",
"retrieved",
"if",
"it",
"wasn",
"t",
"set",
"previously",
".",
"Will",
"also",
"forcefully",
"request",
"an",
"update",
"for",
"the",
"property",
"if",
"the",
"option",
"force",
"is",
"set",
"."
] | f931d659ddf6a531ebf00bbfc11d417c527cd21b | https://github.com/tweedegolf/generator/blob/f931d659ddf6a531ebf00bbfc11d417c527cd21b/src/TweedeGolf/Generator/Console/Questioner.php#L115-L120 |
6,956 | tweedegolf/generator | src/TweedeGolf/Generator/Console/Questioner.php | Questioner.set | public function set(Arguments $arguments, $property, $type, array $options = [])
{
$options = $this->validateAndUpdateOptions($options, $type);
$constraints = [];
if (is_array($this->constraints) && isset($this->constraints[$property])) {
$constraints = $this->constraints[$property];
}
$options['constraints'] = $constraints;
$options['property'] = $property;
if ($options['default'] === null && $arguments->get($property, null) !== null) {
$options['default'] = $arguments[$property];
}
$result = $this->ask($type, $options);
$arguments[$property] = $result;
} | php | public function set(Arguments $arguments, $property, $type, array $options = [])
{
$options = $this->validateAndUpdateOptions($options, $type);
$constraints = [];
if (is_array($this->constraints) && isset($this->constraints[$property])) {
$constraints = $this->constraints[$property];
}
$options['constraints'] = $constraints;
$options['property'] = $property;
if ($options['default'] === null && $arguments->get($property, null) !== null) {
$options['default'] = $arguments[$property];
}
$result = $this->ask($type, $options);
$arguments[$property] = $result;
} | [
"public",
"function",
"set",
"(",
"Arguments",
"$",
"arguments",
",",
"$",
"property",
",",
"$",
"type",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"validateAndUpdateOptions",
"(",
"$",
"options",
",",
"$",
"type",
")",
";",
"$",
"constraints",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"constraints",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"constraints",
"[",
"$",
"property",
"]",
")",
")",
"{",
"$",
"constraints",
"=",
"$",
"this",
"->",
"constraints",
"[",
"$",
"property",
"]",
";",
"}",
"$",
"options",
"[",
"'constraints'",
"]",
"=",
"$",
"constraints",
";",
"$",
"options",
"[",
"'property'",
"]",
"=",
"$",
"property",
";",
"if",
"(",
"$",
"options",
"[",
"'default'",
"]",
"===",
"null",
"&&",
"$",
"arguments",
"->",
"get",
"(",
"$",
"property",
",",
"null",
")",
"!==",
"null",
")",
"{",
"$",
"options",
"[",
"'default'",
"]",
"=",
"$",
"arguments",
"[",
"$",
"property",
"]",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"ask",
"(",
"$",
"type",
",",
"$",
"options",
")",
";",
"$",
"arguments",
"[",
"$",
"property",
"]",
"=",
"$",
"result",
";",
"}"
] | Set the value of a property in arguments to the value interactively retrieved.
@param Arguments $arguments
@param string $property
@param string|InputTypeInterface $type
@param array $options | [
"Set",
"the",
"value",
"of",
"a",
"property",
"in",
"arguments",
"to",
"the",
"value",
"interactively",
"retrieved",
"."
] | f931d659ddf6a531ebf00bbfc11d417c527cd21b | https://github.com/tweedegolf/generator/blob/f931d659ddf6a531ebf00bbfc11d417c527cd21b/src/TweedeGolf/Generator/Console/Questioner.php#L129-L146 |
6,957 | tweedegolf/generator | src/TweedeGolf/Generator/Console/Questioner.php | Questioner.validateAndUpdateOptions | private function validateAndUpdateOptions(array $options, $type)
{
if (is_string($type)) {
$type = $this->types->getType($type);
}
if (!($type instanceof InputTypeInterface)) {
throw new InputTypeNotFoundException("Type should be an instance of InputTypeInterface or a string");
}
$defaults = $this->getDefaultOptions($type);
foreach ($options as $key => $value) {
if (!array_key_exists($key, $defaults)) {
$allowed = implode(', ', array_keys($defaults));
throw new InvalidInputException(
"Found non-default option '{$key}', only allowed to use one of {$allowed}."
);
}
}
return array_merge($defaults, $options);
} | php | private function validateAndUpdateOptions(array $options, $type)
{
if (is_string($type)) {
$type = $this->types->getType($type);
}
if (!($type instanceof InputTypeInterface)) {
throw new InputTypeNotFoundException("Type should be an instance of InputTypeInterface or a string");
}
$defaults = $this->getDefaultOptions($type);
foreach ($options as $key => $value) {
if (!array_key_exists($key, $defaults)) {
$allowed = implode(', ', array_keys($defaults));
throw new InvalidInputException(
"Found non-default option '{$key}', only allowed to use one of {$allowed}."
);
}
}
return array_merge($defaults, $options);
} | [
"private",
"function",
"validateAndUpdateOptions",
"(",
"array",
"$",
"options",
",",
"$",
"type",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"types",
"->",
"getType",
"(",
"$",
"type",
")",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"type",
"instanceof",
"InputTypeInterface",
")",
")",
"{",
"throw",
"new",
"InputTypeNotFoundException",
"(",
"\"Type should be an instance of InputTypeInterface or a string\"",
")",
";",
"}",
"$",
"defaults",
"=",
"$",
"this",
"->",
"getDefaultOptions",
"(",
"$",
"type",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"defaults",
")",
")",
"{",
"$",
"allowed",
"=",
"implode",
"(",
"', '",
",",
"array_keys",
"(",
"$",
"defaults",
")",
")",
";",
"throw",
"new",
"InvalidInputException",
"(",
"\"Found non-default option '{$key}', only allowed to use one of {$allowed}.\"",
")",
";",
"}",
"}",
"return",
"array_merge",
"(",
"$",
"defaults",
",",
"$",
"options",
")",
";",
"}"
] | Validate options does not contain non-existant options and update with defaults where not defined.
@param array $options
@param string|InputTypeInterface $type
@return array
@throws InvalidInputException
@throws InputTypeNotFoundException | [
"Validate",
"options",
"does",
"not",
"contain",
"non",
"-",
"existant",
"options",
"and",
"update",
"with",
"defaults",
"where",
"not",
"defined",
"."
] | f931d659ddf6a531ebf00bbfc11d417c527cd21b | https://github.com/tweedegolf/generator/blob/f931d659ddf6a531ebf00bbfc11d417c527cd21b/src/TweedeGolf/Generator/Console/Questioner.php#L156-L176 |
6,958 | tweedegolf/generator | src/TweedeGolf/Generator/Console/Questioner.php | Questioner.getDefaultOptions | private function getDefaultOptions(InputTypeInterface $type)
{
return array_merge([
'force' => false,
'property' => '',
'constraints' => null,
'required' => false,
'default' => null,
'modify' => null,
], $type->getDefaultOptions());
} | php | private function getDefaultOptions(InputTypeInterface $type)
{
return array_merge([
'force' => false,
'property' => '',
'constraints' => null,
'required' => false,
'default' => null,
'modify' => null,
], $type->getDefaultOptions());
} | [
"private",
"function",
"getDefaultOptions",
"(",
"InputTypeInterface",
"$",
"type",
")",
"{",
"return",
"array_merge",
"(",
"[",
"'force'",
"=>",
"false",
",",
"'property'",
"=>",
"''",
",",
"'constraints'",
"=>",
"null",
",",
"'required'",
"=>",
"false",
",",
"'default'",
"=>",
"null",
",",
"'modify'",
"=>",
"null",
",",
"]",
",",
"$",
"type",
"->",
"getDefaultOptions",
"(",
")",
")",
";",
"}"
] | Return the default options for the InputTypeInterface combined with the default options
required by the questioner.
@param InputTypeInterface $type
@return array | [
"Return",
"the",
"default",
"options",
"for",
"the",
"InputTypeInterface",
"combined",
"with",
"the",
"default",
"options",
"required",
"by",
"the",
"questioner",
"."
] | f931d659ddf6a531ebf00bbfc11d417c527cd21b | https://github.com/tweedegolf/generator/blob/f931d659ddf6a531ebf00bbfc11d417c527cd21b/src/TweedeGolf/Generator/Console/Questioner.php#L184-L194 |
6,959 | tweedegolf/generator | src/TweedeGolf/Generator/Console/Questioner.php | Questioner.message | public function message($message, $lineWidth = 80, $style = 'info')
{
if (null === $lineWidth) {
$lineWidth = 80;
}
if (is_string($message)) {
$message = explode("\n", wordwrap($message, $lineWidth, "\n", true));
}
foreach ($message as $line) {
$line = str_pad(OutputFormatter::escape($line), $lineWidth);
$this->getOutput()->writeln("<{$style}>{$line}</{$style}>");
}
} | php | public function message($message, $lineWidth = 80, $style = 'info')
{
if (null === $lineWidth) {
$lineWidth = 80;
}
if (is_string($message)) {
$message = explode("\n", wordwrap($message, $lineWidth, "\n", true));
}
foreach ($message as $line) {
$line = str_pad(OutputFormatter::escape($line), $lineWidth);
$this->getOutput()->writeln("<{$style}>{$line}</{$style}>");
}
} | [
"public",
"function",
"message",
"(",
"$",
"message",
",",
"$",
"lineWidth",
"=",
"80",
",",
"$",
"style",
"=",
"'info'",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"lineWidth",
")",
"{",
"$",
"lineWidth",
"=",
"80",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"message",
")",
")",
"{",
"$",
"message",
"=",
"explode",
"(",
"\"\\n\"",
",",
"wordwrap",
"(",
"$",
"message",
",",
"$",
"lineWidth",
",",
"\"\\n\"",
",",
"true",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"message",
"as",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"str_pad",
"(",
"OutputFormatter",
"::",
"escape",
"(",
"$",
"line",
")",
",",
"$",
"lineWidth",
")",
";",
"$",
"this",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
"\"<{$style}>{$line}</{$style}>\"",
")",
";",
"}",
"}"
] | Write a message in the given style, with line breaks at the given length.
@param string|array $message Message to be formatted.
@param int $lineWidth Maximum line width of the message.
@param string $style Style to be used for formatting the message. | [
"Write",
"a",
"message",
"in",
"the",
"given",
"style",
"with",
"line",
"breaks",
"at",
"the",
"given",
"length",
"."
] | f931d659ddf6a531ebf00bbfc11d417c527cd21b | https://github.com/tweedegolf/generator/blob/f931d659ddf6a531ebf00bbfc11d417c527cd21b/src/TweedeGolf/Generator/Console/Questioner.php#L227-L241 |
6,960 | setrun/setrun-component-sys | src/services/LanguageService.php | LanguageService.create | public function create(LanguageForm $form): Language
{
$model = Language::create(
$form->name,
$form->slug,
$form->locale,
$form->alias,
$form->icon
);
$this->assertIsUniqueSlug($model);
$this->repository->save($model);
return $model;
} | php | public function create(LanguageForm $form): Language
{
$model = Language::create(
$form->name,
$form->slug,
$form->locale,
$form->alias,
$form->icon
);
$this->assertIsUniqueSlug($model);
$this->repository->save($model);
return $model;
} | [
"public",
"function",
"create",
"(",
"LanguageForm",
"$",
"form",
")",
":",
"Language",
"{",
"$",
"model",
"=",
"Language",
"::",
"create",
"(",
"$",
"form",
"->",
"name",
",",
"$",
"form",
"->",
"slug",
",",
"$",
"form",
"->",
"locale",
",",
"$",
"form",
"->",
"alias",
",",
"$",
"form",
"->",
"icon",
")",
";",
"$",
"this",
"->",
"assertIsUniqueSlug",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"repository",
"->",
"save",
"(",
"$",
"model",
")",
";",
"return",
"$",
"model",
";",
"}"
] | Language item create.
@param LanguageForm $form
@return Language | [
"Language",
"item",
"create",
"."
] | ad9a6442a2921e0f061ed4e455b050c56029d565 | https://github.com/setrun/setrun-component-sys/blob/ad9a6442a2921e0f061ed4e455b050c56029d565/src/services/LanguageService.php#L38-L50 |
6,961 | setrun/setrun-component-sys | src/services/LanguageService.php | LanguageService.edit | public function edit($id, LanguageForm $form): void
{
$model = $this->repository->get($id);
$model->edit(
$form->name,
$form->slug,
$form->locale,
$form->alias,
$form->icon
);
$this->assertIsUniqueSlug($model);
$this->repository->save($model);
} | php | public function edit($id, LanguageForm $form): void
{
$model = $this->repository->get($id);
$model->edit(
$form->name,
$form->slug,
$form->locale,
$form->alias,
$form->icon
);
$this->assertIsUniqueSlug($model);
$this->repository->save($model);
} | [
"public",
"function",
"edit",
"(",
"$",
"id",
",",
"LanguageForm",
"$",
"form",
")",
":",
"void",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"repository",
"->",
"get",
"(",
"$",
"id",
")",
";",
"$",
"model",
"->",
"edit",
"(",
"$",
"form",
"->",
"name",
",",
"$",
"form",
"->",
"slug",
",",
"$",
"form",
"->",
"locale",
",",
"$",
"form",
"->",
"alias",
",",
"$",
"form",
"->",
"icon",
")",
";",
"$",
"this",
"->",
"assertIsUniqueSlug",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"repository",
"->",
"save",
"(",
"$",
"model",
")",
";",
"}"
] | Language item edit.
@param $id
@param LanguageForm $form
@return void | [
"Language",
"item",
"edit",
"."
] | ad9a6442a2921e0f061ed4e455b050c56029d565 | https://github.com/setrun/setrun-component-sys/blob/ad9a6442a2921e0f061ed4e455b050c56029d565/src/services/LanguageService.php#L58-L70 |
6,962 | infinity-se/infinity-base | src/InfinityBase/Mvc/View/Http/XhrListener.php | XhrListener.check | public function check(EventInterface $event)
{
// Check result
$result = $event->getResult();
if (!$result instanceof ViewModel) {
return;
}
// Check for xhr request
$request = $event->getRequest();
if ($request->isXmlHttpRequest()) {
// Set terminal
$result->setTerminal(true);
$event->setViewModel($result);
}
} | php | public function check(EventInterface $event)
{
// Check result
$result = $event->getResult();
if (!$result instanceof ViewModel) {
return;
}
// Check for xhr request
$request = $event->getRequest();
if ($request->isXmlHttpRequest()) {
// Set terminal
$result->setTerminal(true);
$event->setViewModel($result);
}
} | [
"public",
"function",
"check",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"// Check result",
"$",
"result",
"=",
"$",
"event",
"->",
"getResult",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"instanceof",
"ViewModel",
")",
"{",
"return",
";",
"}",
"// Check for xhr request",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"// Set terminal",
"$",
"result",
"->",
"setTerminal",
"(",
"true",
")",
";",
"$",
"event",
"->",
"setViewModel",
"(",
"$",
"result",
")",
";",
"}",
"}"
] | Check for XmlHttpRequest
@param EventInterface $event | [
"Check",
"for",
"XmlHttpRequest"
] | 4f869ae4b549e779560a83528d2ed2664f6deb5b | https://github.com/infinity-se/infinity-base/blob/4f869ae4b549e779560a83528d2ed2664f6deb5b/src/InfinityBase/Mvc/View/Http/XhrListener.php#L45-L61 |
6,963 | helthe/Mandrill | Mailer/Mailer.php | Mailer.sendMessage | public function sendMessage($recipients, $sender, $subject, $content)
{
$this->client->sendMessage($this->createMessage($recipients, $sender, $subject, $content));
} | php | public function sendMessage($recipients, $sender, $subject, $content)
{
$this->client->sendMessage($this->createMessage($recipients, $sender, $subject, $content));
} | [
"public",
"function",
"sendMessage",
"(",
"$",
"recipients",
",",
"$",
"sender",
",",
"$",
"subject",
",",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"sendMessage",
"(",
"$",
"this",
"->",
"createMessage",
"(",
"$",
"recipients",
",",
"$",
"sender",
",",
"$",
"subject",
",",
"$",
"content",
")",
")",
";",
"}"
] | Send a transactional message.
@param mixed $recipients
@param mixed $sender
@param string $subject
@param string $content | [
"Send",
"a",
"transactional",
"message",
"."
] | 5d4ddd71079d9308e6d117311e96be1b9eb95637 | https://github.com/helthe/Mandrill/blob/5d4ddd71079d9308e6d117311e96be1b9eb95637/Mailer/Mailer.php#L29-L32 |
6,964 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-filter/src/Compress/Rar.php | Rar.setCallback | public function setCallback($callback)
{
if (!is_callable($callback)) {
throw new Exception\InvalidArgumentException('Invalid callback provided');
}
$this->options['callback'] = $callback;
return $this;
} | php | public function setCallback($callback)
{
if (!is_callable($callback)) {
throw new Exception\InvalidArgumentException('Invalid callback provided');
}
$this->options['callback'] = $callback;
return $this;
} | [
"public",
"function",
"setCallback",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"'Invalid callback provided'",
")",
";",
"}",
"$",
"this",
"->",
"options",
"[",
"'callback'",
"]",
"=",
"$",
"callback",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the callback to use
@param string $callback
@return self
@throws Exception\InvalidArgumentException if invalid callback provided | [
"Sets",
"the",
"callback",
"to",
"use"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/Compress/Rar.php#L68-L76 |
6,965 | popy-dev/popy-calendar | src/Converter/UnixTimeConverter/Time.php | Time.convertMicrosecondsToTime | public function convertMicrosecondsToTime($time)
{
// Calculating day-ratio;
// Dividing microseconds per seconds results in the intended value
$ratio = intval($time / $this->dayLengthInSeconds);
// If using a different time format, apply ratio
$timeScale = array_product($this->ranges);
if ($this->dayLengthInMicroSeconds !== $timeScale) {
$time = intval(
($time * $timeScale) / $this->dayLengthInMicroSeconds
);
}
$len = count($this->ranges);
$res = array_fill(0, $len, 0);
for ($i=$len - 1; $i > -1; $i--) {
$res[$i] = $time % $this->ranges[$i];
$time = intval($time / $this->ranges[$i]);
}
return new TimeObject($res, $this->ranges, $ratio);
} | php | public function convertMicrosecondsToTime($time)
{
// Calculating day-ratio;
// Dividing microseconds per seconds results in the intended value
$ratio = intval($time / $this->dayLengthInSeconds);
// If using a different time format, apply ratio
$timeScale = array_product($this->ranges);
if ($this->dayLengthInMicroSeconds !== $timeScale) {
$time = intval(
($time * $timeScale) / $this->dayLengthInMicroSeconds
);
}
$len = count($this->ranges);
$res = array_fill(0, $len, 0);
for ($i=$len - 1; $i > -1; $i--) {
$res[$i] = $time % $this->ranges[$i];
$time = intval($time / $this->ranges[$i]);
}
return new TimeObject($res, $this->ranges, $ratio);
} | [
"public",
"function",
"convertMicrosecondsToTime",
"(",
"$",
"time",
")",
"{",
"// Calculating day-ratio;",
"// Dividing microseconds per seconds results in the intended value",
"$",
"ratio",
"=",
"intval",
"(",
"$",
"time",
"/",
"$",
"this",
"->",
"dayLengthInSeconds",
")",
";",
"// If using a different time format, apply ratio",
"$",
"timeScale",
"=",
"array_product",
"(",
"$",
"this",
"->",
"ranges",
")",
";",
"if",
"(",
"$",
"this",
"->",
"dayLengthInMicroSeconds",
"!==",
"$",
"timeScale",
")",
"{",
"$",
"time",
"=",
"intval",
"(",
"(",
"$",
"time",
"*",
"$",
"timeScale",
")",
"/",
"$",
"this",
"->",
"dayLengthInMicroSeconds",
")",
";",
"}",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"ranges",
")",
";",
"$",
"res",
"=",
"array_fill",
"(",
"0",
",",
"$",
"len",
",",
"0",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"len",
"-",
"1",
";",
"$",
"i",
">",
"-",
"1",
";",
"$",
"i",
"--",
")",
"{",
"$",
"res",
"[",
"$",
"i",
"]",
"=",
"$",
"time",
"%",
"$",
"this",
"->",
"ranges",
"[",
"$",
"i",
"]",
";",
"$",
"time",
"=",
"intval",
"(",
"$",
"time",
"/",
"$",
"this",
"->",
"ranges",
"[",
"$",
"i",
"]",
")",
";",
"}",
"return",
"new",
"TimeObject",
"(",
"$",
"res",
",",
"$",
"this",
"->",
"ranges",
",",
"$",
"ratio",
")",
";",
"}"
] | Convert a time expressed in microseconds, into a Time object.
@param integer $time
@return TimeObject | [
"Convert",
"a",
"time",
"expressed",
"in",
"microseconds",
"into",
"a",
"Time",
"object",
"."
] | 989048be18451c813cfce926229c6aaddd1b0639 | https://github.com/popy-dev/popy-calendar/blob/989048be18451c813cfce926229c6aaddd1b0639/src/Converter/UnixTimeConverter/Time.php#L131-L155 |
6,966 | popy-dev/popy-calendar | src/Converter/UnixTimeConverter/Time.php | Time.convertTimeToMicroseconds | public function convertTimeToMicroseconds(TimeObject $time)
{
$meaningfull = $time->countMeaningfull() > 0;
// IF time had no meaningfull informations, fallback to a day ratio.
if (!$meaningfull && null !== $ratio = $time->getRatio()) {
return $ratio * $this->dayLengthInSeconds;
}
// IF time had no meaningfull informations, use internel swatch time.
// May not work properly on non-earth systems. Whatever, who uses this
// anyway ? ANd who will use this on other planets ?
if (!$meaningfull && null !== $swatch = $time->getTransversal(0)) {
return $swatch * 1000 * 86400
- 3600 * 1000000 // minus fixed time offset
;
}
$len = count($this->ranges);
$res = 0;
for ($i=0; $i < $len; $i++) {
$res = $res * $this->ranges[$i] + (int)$time->get($i);
}
// If using a different time format, apply ratio
$timeScale = array_product($this->ranges);
if ($this->dayLengthInMicroSeconds !== $timeScale) {
return intval(($res * $this->dayLengthInMicroSeconds) / $timeScale);
}
return $res;
} | php | public function convertTimeToMicroseconds(TimeObject $time)
{
$meaningfull = $time->countMeaningfull() > 0;
// IF time had no meaningfull informations, fallback to a day ratio.
if (!$meaningfull && null !== $ratio = $time->getRatio()) {
return $ratio * $this->dayLengthInSeconds;
}
// IF time had no meaningfull informations, use internel swatch time.
// May not work properly on non-earth systems. Whatever, who uses this
// anyway ? ANd who will use this on other planets ?
if (!$meaningfull && null !== $swatch = $time->getTransversal(0)) {
return $swatch * 1000 * 86400
- 3600 * 1000000 // minus fixed time offset
;
}
$len = count($this->ranges);
$res = 0;
for ($i=0; $i < $len; $i++) {
$res = $res * $this->ranges[$i] + (int)$time->get($i);
}
// If using a different time format, apply ratio
$timeScale = array_product($this->ranges);
if ($this->dayLengthInMicroSeconds !== $timeScale) {
return intval(($res * $this->dayLengthInMicroSeconds) / $timeScale);
}
return $res;
} | [
"public",
"function",
"convertTimeToMicroseconds",
"(",
"TimeObject",
"$",
"time",
")",
"{",
"$",
"meaningfull",
"=",
"$",
"time",
"->",
"countMeaningfull",
"(",
")",
">",
"0",
";",
"// IF time had no meaningfull informations, fallback to a day ratio.",
"if",
"(",
"!",
"$",
"meaningfull",
"&&",
"null",
"!==",
"$",
"ratio",
"=",
"$",
"time",
"->",
"getRatio",
"(",
")",
")",
"{",
"return",
"$",
"ratio",
"*",
"$",
"this",
"->",
"dayLengthInSeconds",
";",
"}",
"// IF time had no meaningfull informations, use internel swatch time.",
"// May not work properly on non-earth systems. Whatever, who uses this",
"// anyway ? ANd who will use this on other planets ?",
"if",
"(",
"!",
"$",
"meaningfull",
"&&",
"null",
"!==",
"$",
"swatch",
"=",
"$",
"time",
"->",
"getTransversal",
"(",
"0",
")",
")",
"{",
"return",
"$",
"swatch",
"*",
"1000",
"*",
"86400",
"-",
"3600",
"*",
"1000000",
"// minus fixed time offset",
";",
"}",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"ranges",
")",
";",
"$",
"res",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"$",
"i",
"++",
")",
"{",
"$",
"res",
"=",
"$",
"res",
"*",
"$",
"this",
"->",
"ranges",
"[",
"$",
"i",
"]",
"+",
"(",
"int",
")",
"$",
"time",
"->",
"get",
"(",
"$",
"i",
")",
";",
"}",
"// If using a different time format, apply ratio",
"$",
"timeScale",
"=",
"array_product",
"(",
"$",
"this",
"->",
"ranges",
")",
";",
"if",
"(",
"$",
"this",
"->",
"dayLengthInMicroSeconds",
"!==",
"$",
"timeScale",
")",
"{",
"return",
"intval",
"(",
"(",
"$",
"res",
"*",
"$",
"this",
"->",
"dayLengthInMicroSeconds",
")",
"/",
"$",
"timeScale",
")",
";",
"}",
"return",
"$",
"res",
";",
"}"
] | Converts a "Time" into its value in its lower unit.
@param TimeObject $time
@return integer | [
"Converts",
"a",
"Time",
"into",
"its",
"value",
"in",
"its",
"lower",
"unit",
"."
] | 989048be18451c813cfce926229c6aaddd1b0639 | https://github.com/popy-dev/popy-calendar/blob/989048be18451c813cfce926229c6aaddd1b0639/src/Converter/UnixTimeConverter/Time.php#L164-L196 |
6,967 | easy-system/es-http | src/Factory/UriPathFactory.php | UriPathFactory.make | public static function make(array $server = null)
{
if (empty($server)) {
$server = $_SERVER;
}
if (isset($server['REQUEST_URI'])) {
return parse_url($server['REQUEST_URI'], PHP_URL_PATH);
}
} | php | public static function make(array $server = null)
{
if (empty($server)) {
$server = $_SERVER;
}
if (isset($server['REQUEST_URI'])) {
return parse_url($server['REQUEST_URI'], PHP_URL_PATH);
}
} | [
"public",
"static",
"function",
"make",
"(",
"array",
"$",
"server",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"server",
")",
")",
"{",
"$",
"server",
"=",
"$",
"_SERVER",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"server",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"return",
"parse_url",
"(",
"$",
"server",
"[",
"'REQUEST_URI'",
"]",
",",
"PHP_URL_PATH",
")",
";",
"}",
"}"
] | Makes a string with Uri path.
@param array $server Optional; null by default or empty array means
global $_SERVER. The source data
@return string|null Returns the Uri path if any, null otherwise | [
"Makes",
"a",
"string",
"with",
"Uri",
"path",
"."
] | dd5852e94901e147a7546a8715133408ece767a1 | https://github.com/easy-system/es-http/blob/dd5852e94901e147a7546a8715133408ece767a1/src/Factory/UriPathFactory.php#L25-L34 |
6,968 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.robots | public function robots($entity)
{
$robots = [];
$index = (bool)Configure::read('Settings.Cms.SEO.meta-robots-index');
if ($entity->meta_robots_index !== null) {
$index = $entity->meta_robots_index;
}
$robots[] = ($index) ? 'index' : 'noindex';
$follow = (bool)Configure::read('Settings.Cms.SEO.meta-robots-follow');
if ($entity->meta_robots_follow !== null) {
$follow = $entity->meta_robots_follow;
}
$robots[] = ($follow) ? 'follow' : 'nofollow';
$noodp = (bool)Configure::read('Settings.Cms.SEO.meta-robots-noodp') || !empty($entity->meta_description);
if ($noodp) {
$robots[] = 'noodp';
}
return $this->_render(self::ATTR_NAME, __FUNCTION__, join(',', $robots));
} | php | public function robots($entity)
{
$robots = [];
$index = (bool)Configure::read('Settings.Cms.SEO.meta-robots-index');
if ($entity->meta_robots_index !== null) {
$index = $entity->meta_robots_index;
}
$robots[] = ($index) ? 'index' : 'noindex';
$follow = (bool)Configure::read('Settings.Cms.SEO.meta-robots-follow');
if ($entity->meta_robots_follow !== null) {
$follow = $entity->meta_robots_follow;
}
$robots[] = ($follow) ? 'follow' : 'nofollow';
$noodp = (bool)Configure::read('Settings.Cms.SEO.meta-robots-noodp') || !empty($entity->meta_description);
if ($noodp) {
$robots[] = 'noodp';
}
return $this->_render(self::ATTR_NAME, __FUNCTION__, join(',', $robots));
} | [
"public",
"function",
"robots",
"(",
"$",
"entity",
")",
"{",
"$",
"robots",
"=",
"[",
"]",
";",
"$",
"index",
"=",
"(",
"bool",
")",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.meta-robots-index'",
")",
";",
"if",
"(",
"$",
"entity",
"->",
"meta_robots_index",
"!==",
"null",
")",
"{",
"$",
"index",
"=",
"$",
"entity",
"->",
"meta_robots_index",
";",
"}",
"$",
"robots",
"[",
"]",
"=",
"(",
"$",
"index",
")",
"?",
"'index'",
":",
"'noindex'",
";",
"$",
"follow",
"=",
"(",
"bool",
")",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.meta-robots-follow'",
")",
";",
"if",
"(",
"$",
"entity",
"->",
"meta_robots_follow",
"!==",
"null",
")",
"{",
"$",
"follow",
"=",
"$",
"entity",
"->",
"meta_robots_follow",
";",
"}",
"$",
"robots",
"[",
"]",
"=",
"(",
"$",
"follow",
")",
"?",
"'follow'",
":",
"'nofollow'",
";",
"$",
"noodp",
"=",
"(",
"bool",
")",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.meta-robots-noodp'",
")",
"||",
"!",
"empty",
"(",
"$",
"entity",
"->",
"meta_description",
")",
";",
"if",
"(",
"$",
"noodp",
")",
"{",
"$",
"robots",
"[",
"]",
"=",
"'noodp'",
";",
"}",
"return",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_NAME",
",",
"__FUNCTION__",
",",
"join",
"(",
"','",
",",
"$",
"robots",
")",
")",
";",
"}"
] | Render the robots meta tag.
@param PublishableEntity $entity The entity, e.g. Page or Post.
@return string | [
"Render",
"the",
"robots",
"meta",
"tag",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L92-L114 |
6,969 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.opengraph | public function opengraph($entity)
{
$attributes = [
'og:locale' => Wasabi::contentLanguage()->lang,
'og:type' => $entity->attributes['og:type'] ?? 'article',
'og:title' => $this->_getTitle($entity),
'og:description' => $entity->attributes['og:description'] ?? $entity->meta_description,
'og:url' => Router::url(null, true),
'og:site_name' => Configure::read('Settings.Cms.SEO.application-name')
];
if ($entity->displayMetaDates) {
$attributes['og:updated_time'] = $entity->modified->format('c');
}
$fbPageId = Configure::read('Settings.Cms.SEO.Social.facebook_page_id');
if ($fbPageId !== null) {
$attributes['fb:admins'] = $fbPageId;
}
$out = '';
foreach ($attributes as $property => $content) {
if ($property === 'og:title') {
$out .= $this->_render(self::ATTR_PROP, $property, $content, self::ATTR_NAME, 'dcterms.title');
} else {
$out .= $this->_render(self::ATTR_PROP, $property, $content);
}
}
return $out;
} | php | public function opengraph($entity)
{
$attributes = [
'og:locale' => Wasabi::contentLanguage()->lang,
'og:type' => $entity->attributes['og:type'] ?? 'article',
'og:title' => $this->_getTitle($entity),
'og:description' => $entity->attributes['og:description'] ?? $entity->meta_description,
'og:url' => Router::url(null, true),
'og:site_name' => Configure::read('Settings.Cms.SEO.application-name')
];
if ($entity->displayMetaDates) {
$attributes['og:updated_time'] = $entity->modified->format('c');
}
$fbPageId = Configure::read('Settings.Cms.SEO.Social.facebook_page_id');
if ($fbPageId !== null) {
$attributes['fb:admins'] = $fbPageId;
}
$out = '';
foreach ($attributes as $property => $content) {
if ($property === 'og:title') {
$out .= $this->_render(self::ATTR_PROP, $property, $content, self::ATTR_NAME, 'dcterms.title');
} else {
$out .= $this->_render(self::ATTR_PROP, $property, $content);
}
}
return $out;
} | [
"public",
"function",
"opengraph",
"(",
"$",
"entity",
")",
"{",
"$",
"attributes",
"=",
"[",
"'og:locale'",
"=>",
"Wasabi",
"::",
"contentLanguage",
"(",
")",
"->",
"lang",
",",
"'og:type'",
"=>",
"$",
"entity",
"->",
"attributes",
"[",
"'og:type'",
"]",
"??",
"'article'",
",",
"'og:title'",
"=>",
"$",
"this",
"->",
"_getTitle",
"(",
"$",
"entity",
")",
",",
"'og:description'",
"=>",
"$",
"entity",
"->",
"attributes",
"[",
"'og:description'",
"]",
"??",
"$",
"entity",
"->",
"meta_description",
",",
"'og:url'",
"=>",
"Router",
"::",
"url",
"(",
"null",
",",
"true",
")",
",",
"'og:site_name'",
"=>",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.application-name'",
")",
"]",
";",
"if",
"(",
"$",
"entity",
"->",
"displayMetaDates",
")",
"{",
"$",
"attributes",
"[",
"'og:updated_time'",
"]",
"=",
"$",
"entity",
"->",
"modified",
"->",
"format",
"(",
"'c'",
")",
";",
"}",
"$",
"fbPageId",
"=",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.Social.facebook_page_id'",
")",
";",
"if",
"(",
"$",
"fbPageId",
"!==",
"null",
")",
"{",
"$",
"attributes",
"[",
"'fb:admins'",
"]",
"=",
"$",
"fbPageId",
";",
"}",
"$",
"out",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"property",
"=>",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"property",
"===",
"'og:title'",
")",
"{",
"$",
"out",
".=",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_PROP",
",",
"$",
"property",
",",
"$",
"content",
",",
"self",
"::",
"ATTR_NAME",
",",
"'dcterms.title'",
")",
";",
"}",
"else",
"{",
"$",
"out",
".=",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_PROP",
",",
"$",
"property",
",",
"$",
"content",
")",
";",
"}",
"}",
"return",
"$",
"out",
";",
"}"
] | Render all og meta tags.
@param PublishableEntity $entity The entity, e.g. Page or Post.
@return string | [
"Render",
"all",
"og",
"meta",
"tags",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L122-L152 |
6,970 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.twitter | public function twitter($entity)
{
$twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
if ($twitterName !== null) {
$twitterName = '@' . $twitterName;
}
$attributes = [
'twitter:card' => 'summary',
'twitter:title' => $this->_getTitle($entity),
'twitter:description' => $entity->attributes['og:description'] ?? $entity->meta_description,
'twitter:image' => $this->_getSocialImage($entity),
'twitter:site' => $twitterName,
'twitter:creator' => $twitterName,
];
$out = '';
foreach ($attributes as $property => $content) {
$out .= $this->_render(self::ATTR_NAME, $property, $content);
}
return $out;
} | php | public function twitter($entity)
{
$twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
if ($twitterName !== null) {
$twitterName = '@' . $twitterName;
}
$attributes = [
'twitter:card' => 'summary',
'twitter:title' => $this->_getTitle($entity),
'twitter:description' => $entity->attributes['og:description'] ?? $entity->meta_description,
'twitter:image' => $this->_getSocialImage($entity),
'twitter:site' => $twitterName,
'twitter:creator' => $twitterName,
];
$out = '';
foreach ($attributes as $property => $content) {
$out .= $this->_render(self::ATTR_NAME, $property, $content);
}
return $out;
} | [
"public",
"function",
"twitter",
"(",
"$",
"entity",
")",
"{",
"$",
"twitterName",
"=",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.Social.twitter_username'",
")",
";",
"if",
"(",
"$",
"twitterName",
"!==",
"null",
")",
"{",
"$",
"twitterName",
"=",
"'@'",
".",
"$",
"twitterName",
";",
"}",
"$",
"attributes",
"=",
"[",
"'twitter:card'",
"=>",
"'summary'",
",",
"'twitter:title'",
"=>",
"$",
"this",
"->",
"_getTitle",
"(",
"$",
"entity",
")",
",",
"'twitter:description'",
"=>",
"$",
"entity",
"->",
"attributes",
"[",
"'og:description'",
"]",
"??",
"$",
"entity",
"->",
"meta_description",
",",
"'twitter:image'",
"=>",
"$",
"this",
"->",
"_getSocialImage",
"(",
"$",
"entity",
")",
",",
"'twitter:site'",
"=>",
"$",
"twitterName",
",",
"'twitter:creator'",
"=>",
"$",
"twitterName",
",",
"]",
";",
"$",
"out",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"property",
"=>",
"$",
"content",
")",
"{",
"$",
"out",
".=",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_NAME",
",",
"$",
"property",
",",
"$",
"content",
")",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Render all twitter tags.
@param PublishableEntity $entity The entity, e.g. Page or Post.
@return string | [
"Render",
"all",
"twitter",
"tags",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L160-L182 |
6,971 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.article | public function article($entity)
{
if (!$entity->displayArticleMetaTags) {
return '';
}
$attributes = [
'article:publisher' => Configure::read('Settings.Cms.SEO.Social.facebook_url'),
'article:tag' => '',
'article:section' => ''
];
if ($entity->displayMetaDates) {
$attributes['article:published_time'] = ($entity->published !== null) ? $entity->published->format('c') : null;
$attributes['article:modified_time'] = $entity->modified->format('c');
}
$out = '';
foreach ($attributes as $property => $content) {
$out .= $this->_render(self::ATTR_PROP, $property, $content);
}
return $out;
} | php | public function article($entity)
{
if (!$entity->displayArticleMetaTags) {
return '';
}
$attributes = [
'article:publisher' => Configure::read('Settings.Cms.SEO.Social.facebook_url'),
'article:tag' => '',
'article:section' => ''
];
if ($entity->displayMetaDates) {
$attributes['article:published_time'] = ($entity->published !== null) ? $entity->published->format('c') : null;
$attributes['article:modified_time'] = $entity->modified->format('c');
}
$out = '';
foreach ($attributes as $property => $content) {
$out .= $this->_render(self::ATTR_PROP, $property, $content);
}
return $out;
} | [
"public",
"function",
"article",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"displayArticleMetaTags",
")",
"{",
"return",
"''",
";",
"}",
"$",
"attributes",
"=",
"[",
"'article:publisher'",
"=>",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.Social.facebook_url'",
")",
",",
"'article:tag'",
"=>",
"''",
",",
"'article:section'",
"=>",
"''",
"]",
";",
"if",
"(",
"$",
"entity",
"->",
"displayMetaDates",
")",
"{",
"$",
"attributes",
"[",
"'article:published_time'",
"]",
"=",
"(",
"$",
"entity",
"->",
"published",
"!==",
"null",
")",
"?",
"$",
"entity",
"->",
"published",
"->",
"format",
"(",
"'c'",
")",
":",
"null",
";",
"$",
"attributes",
"[",
"'article:modified_time'",
"]",
"=",
"$",
"entity",
"->",
"modified",
"->",
"format",
"(",
"'c'",
")",
";",
"}",
"$",
"out",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"property",
"=>",
"$",
"content",
")",
"{",
"$",
"out",
".=",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_PROP",
",",
"$",
"property",
",",
"$",
"content",
")",
";",
"}",
"return",
"$",
"out",
";",
"}"
] | Render all article meta tags.
@param PublishableEntity $entity The entity, e.g. Page or Post.
@return string | [
"Render",
"all",
"article",
"meta",
"tags",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L190-L213 |
6,972 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.dcDateIssued | public function dcDateIssued($entity)
{
if (!$entity->displayMetaDates) {
return '';
}
$published = ($entity->published !== null) ? $entity->published->format('c') : null;
return $this->_render(self::ATTR_PROP, 'DC.date.issued', $published);
} | php | public function dcDateIssued($entity)
{
if (!$entity->displayMetaDates) {
return '';
}
$published = ($entity->published !== null) ? $entity->published->format('c') : null;
return $this->_render(self::ATTR_PROP, 'DC.date.issued', $published);
} | [
"public",
"function",
"dcDateIssued",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"displayMetaDates",
")",
"{",
"return",
"''",
";",
"}",
"$",
"published",
"=",
"(",
"$",
"entity",
"->",
"published",
"!==",
"null",
")",
"?",
"$",
"entity",
"->",
"published",
"->",
"format",
"(",
"'c'",
")",
":",
"null",
";",
"return",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_PROP",
",",
"'DC.date.issued'",
",",
"$",
"published",
")",
";",
"}"
] | Render the DC.date.issued meta tag.
@param PublishableEntity $entity The entity, e.g. Page or Post.
@return string | [
"Render",
"the",
"DC",
".",
"date",
".",
"issued",
"meta",
"tag",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L221-L228 |
6,973 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.googleSiteVerification | public function googleSiteVerification()
{
$token = Configure::read('Settings.Cms.SEO.google-site-verification');
if (empty($token)) {
return '';
}
return $this->_render(self::ATTR_NAME, 'google-site-verification', $token);
} | php | public function googleSiteVerification()
{
$token = Configure::read('Settings.Cms.SEO.google-site-verification');
if (empty($token)) {
return '';
}
return $this->_render(self::ATTR_NAME, 'google-site-verification', $token);
} | [
"public",
"function",
"googleSiteVerification",
"(",
")",
"{",
"$",
"token",
"=",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.google-site-verification'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"token",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_NAME",
",",
"'google-site-verification'",
",",
"$",
"token",
")",
";",
"}"
] | Render the google site verification meta tag.
@return string | [
"Render",
"the",
"google",
"site",
"verification",
"meta",
"tag",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L235-L242 |
6,974 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.displaySearchBox | public function displaySearchBox()
{
$displaySearchBox = (bool)Configure::read('Settings.Cms.SEO.display-search-box');
if ($displaySearchBox) {
return '';
}
return $this->_render(self::ATTR_NAME, 'google', 'nositelinkssearchbox');
} | php | public function displaySearchBox()
{
$displaySearchBox = (bool)Configure::read('Settings.Cms.SEO.display-search-box');
if ($displaySearchBox) {
return '';
}
return $this->_render(self::ATTR_NAME, 'google', 'nositelinkssearchbox');
} | [
"public",
"function",
"displaySearchBox",
"(",
")",
"{",
"$",
"displaySearchBox",
"=",
"(",
"bool",
")",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.display-search-box'",
")",
";",
"if",
"(",
"$",
"displaySearchBox",
")",
"{",
"return",
"''",
";",
"}",
"return",
"$",
"this",
"->",
"_render",
"(",
"self",
"::",
"ATTR_NAME",
",",
"'google'",
",",
"'nositelinkssearchbox'",
")",
";",
"}"
] | Render the google nositelinkssearchbox meta tag to not display a search box beneath the
search engine result for your site.
@return string | [
"Render",
"the",
"google",
"nositelinkssearchbox",
"meta",
"tag",
"to",
"not",
"display",
"a",
"search",
"box",
"beneath",
"the",
"search",
"engine",
"result",
"for",
"your",
"site",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L250-L257 |
6,975 | wasabi-cms/cms | src/View/Helper/MetaHelper.php | MetaHelper.ldJson | public function ldJson()
{
$attributes = [
'@context' => 'http://schema.org',
'@type' => 'WebSite',
'url' => $this->Url->build('/', true),
'potentialAction' => [
'@type' => 'SearchAction',
'query-input' => 'required name=search_term_string',
'target' => $this->Url->build([
'plugin' => 'Wasabi/Cms',
'controller' => 'Frontend/Search',
'action' => 'search',
'language_id' => Wasabi::contentLanguage()->id
], true) . '?q={search_term_string}'
]
];
if (!empty(WasabiCms::$instanceName)) {
$attributes['name'] = WasabiCms::$instanceName;
}
$sameAsKeys = [
'Settings.Cms.SEO.Social.facebook_url',
'Settings.Cms.SEO.Social.instagram_url',
'Settings.Cms.SEO.Social.linkedin_url',
'Settings.Cms.SEO.Social.myspace_url',
'Settings.Cms.SEO.Social.pinterest_url',
'Settings.Cms.SEO.Social.youtube_url',
'Settings.Cms.SEO.Social.googleplus_url'
];
$sameAs = [];
foreach ($sameAsKeys as $key) {
$setting = Configure::read($key);
if (!empty($setting)) {
$sameAs[] = $setting;
}
}
$twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
if (!empty($twitterName)) {
$sameAs[] = 'https://twitter.com/' . $twitterName;
}
if (!empty($sameAs)) {
$attributes['sameAs'] = $sameAs;
}
return '<script type="application/ld+json">' . json_encode($attributes) . '</script>';
} | php | public function ldJson()
{
$attributes = [
'@context' => 'http://schema.org',
'@type' => 'WebSite',
'url' => $this->Url->build('/', true),
'potentialAction' => [
'@type' => 'SearchAction',
'query-input' => 'required name=search_term_string',
'target' => $this->Url->build([
'plugin' => 'Wasabi/Cms',
'controller' => 'Frontend/Search',
'action' => 'search',
'language_id' => Wasabi::contentLanguage()->id
], true) . '?q={search_term_string}'
]
];
if (!empty(WasabiCms::$instanceName)) {
$attributes['name'] = WasabiCms::$instanceName;
}
$sameAsKeys = [
'Settings.Cms.SEO.Social.facebook_url',
'Settings.Cms.SEO.Social.instagram_url',
'Settings.Cms.SEO.Social.linkedin_url',
'Settings.Cms.SEO.Social.myspace_url',
'Settings.Cms.SEO.Social.pinterest_url',
'Settings.Cms.SEO.Social.youtube_url',
'Settings.Cms.SEO.Social.googleplus_url'
];
$sameAs = [];
foreach ($sameAsKeys as $key) {
$setting = Configure::read($key);
if (!empty($setting)) {
$sameAs[] = $setting;
}
}
$twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
if (!empty($twitterName)) {
$sameAs[] = 'https://twitter.com/' . $twitterName;
}
if (!empty($sameAs)) {
$attributes['sameAs'] = $sameAs;
}
return '<script type="application/ld+json">' . json_encode($attributes) . '</script>';
} | [
"public",
"function",
"ldJson",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"'@context'",
"=>",
"'http://schema.org'",
",",
"'@type'",
"=>",
"'WebSite'",
",",
"'url'",
"=>",
"$",
"this",
"->",
"Url",
"->",
"build",
"(",
"'/'",
",",
"true",
")",
",",
"'potentialAction'",
"=>",
"[",
"'@type'",
"=>",
"'SearchAction'",
",",
"'query-input'",
"=>",
"'required name=search_term_string'",
",",
"'target'",
"=>",
"$",
"this",
"->",
"Url",
"->",
"build",
"(",
"[",
"'plugin'",
"=>",
"'Wasabi/Cms'",
",",
"'controller'",
"=>",
"'Frontend/Search'",
",",
"'action'",
"=>",
"'search'",
",",
"'language_id'",
"=>",
"Wasabi",
"::",
"contentLanguage",
"(",
")",
"->",
"id",
"]",
",",
"true",
")",
".",
"'?q={search_term_string}'",
"]",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"WasabiCms",
"::",
"$",
"instanceName",
")",
")",
"{",
"$",
"attributes",
"[",
"'name'",
"]",
"=",
"WasabiCms",
"::",
"$",
"instanceName",
";",
"}",
"$",
"sameAsKeys",
"=",
"[",
"'Settings.Cms.SEO.Social.facebook_url'",
",",
"'Settings.Cms.SEO.Social.instagram_url'",
",",
"'Settings.Cms.SEO.Social.linkedin_url'",
",",
"'Settings.Cms.SEO.Social.myspace_url'",
",",
"'Settings.Cms.SEO.Social.pinterest_url'",
",",
"'Settings.Cms.SEO.Social.youtube_url'",
",",
"'Settings.Cms.SEO.Social.googleplus_url'",
"]",
";",
"$",
"sameAs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sameAsKeys",
"as",
"$",
"key",
")",
"{",
"$",
"setting",
"=",
"Configure",
"::",
"read",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"setting",
")",
")",
"{",
"$",
"sameAs",
"[",
"]",
"=",
"$",
"setting",
";",
"}",
"}",
"$",
"twitterName",
"=",
"Configure",
"::",
"read",
"(",
"'Settings.Cms.SEO.Social.twitter_username'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"twitterName",
")",
")",
"{",
"$",
"sameAs",
"[",
"]",
"=",
"'https://twitter.com/'",
".",
"$",
"twitterName",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"sameAs",
")",
")",
"{",
"$",
"attributes",
"[",
"'sameAs'",
"]",
"=",
"$",
"sameAs",
";",
"}",
"return",
"'<script type=\"application/ld+json\">'",
".",
"json_encode",
"(",
"$",
"attributes",
")",
".",
"'</script>'",
";",
"}"
] | Render the ld+json script tag to set the schema.org context for a page.
@return string | [
"Render",
"the",
"ld",
"+",
"json",
"script",
"tag",
"to",
"set",
"the",
"schema",
".",
"org",
"context",
"for",
"a",
"page",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/View/Helper/MetaHelper.php#L264-L314 |
6,976 | morrelinko/simple-photo | src/Storage/RemoteHostStorage.php | RemoteHostStorage.createDirectory | public function createDirectory($directory)
{
// create parent directory if needed
$parent = dirname($directory);
if (!$this->directoryExists($parent)) {
$this->createDirectory($parent);
}
if (ftp_mkdir($this->connection(), $directory) === false) {
throw new \RuntimeException(sprintf(
'Could not create directory \'%s\'.',
$directory
));
}
return true;
} | php | public function createDirectory($directory)
{
// create parent directory if needed
$parent = dirname($directory);
if (!$this->directoryExists($parent)) {
$this->createDirectory($parent);
}
if (ftp_mkdir($this->connection(), $directory) === false) {
throw new \RuntimeException(sprintf(
'Could not create directory \'%s\'.',
$directory
));
}
return true;
} | [
"public",
"function",
"createDirectory",
"(",
"$",
"directory",
")",
"{",
"// create parent directory if needed",
"$",
"parent",
"=",
"dirname",
"(",
"$",
"directory",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"directoryExists",
"(",
"$",
"parent",
")",
")",
"{",
"$",
"this",
"->",
"createDirectory",
"(",
"$",
"parent",
")",
";",
"}",
"if",
"(",
"ftp_mkdir",
"(",
"$",
"this",
"->",
"connection",
"(",
")",
",",
"$",
"directory",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Could not create directory \\'%s\\'.'",
",",
"$",
"directory",
")",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Creates the specified directory recursively
@param string $directory Directory to create
@return bool
@throws \RuntimeException if the directory could not be created | [
"Creates",
"the",
"specified",
"directory",
"recursively"
] | be1fbe3139d32eb39e88cff93f847154bb6a8cb2 | https://github.com/morrelinko/simple-photo/blob/be1fbe3139d32eb39e88cff93f847154bb6a8cb2/src/Storage/RemoteHostStorage.php#L365-L381 |
6,977 | noordawod/php-util | src/Http.php | Http.getDocumentRoot | public static function getDocumentRoot() {
if(null === self::$docRoot) {
self::$docRoot = System::realPath($_SERVER['DOCUMENT_ROOT']);
if(!self::$docRoot) {
self::$docRoot = System::realPath(getcwd());
}
}
return self::$docRoot;
} | php | public static function getDocumentRoot() {
if(null === self::$docRoot) {
self::$docRoot = System::realPath($_SERVER['DOCUMENT_ROOT']);
if(!self::$docRoot) {
self::$docRoot = System::realPath(getcwd());
}
}
return self::$docRoot;
} | [
"public",
"static",
"function",
"getDocumentRoot",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"docRoot",
")",
"{",
"self",
"::",
"$",
"docRoot",
"=",
"System",
"::",
"realPath",
"(",
"$",
"_SERVER",
"[",
"'DOCUMENT_ROOT'",
"]",
")",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"docRoot",
")",
"{",
"self",
"::",
"$",
"docRoot",
"=",
"System",
"::",
"realPath",
"(",
"getcwd",
"(",
")",
")",
";",
"}",
"}",
"return",
"self",
"::",
"$",
"docRoot",
";",
"}"
] | Returns the website's document root, if found, or current directory.
The path is always absolute.
@return string|NULL document root on success, FALSE otherwise | [
"Returns",
"the",
"website",
"s",
"document",
"root",
"if",
"found",
"or",
"current",
"directory",
".",
"The",
"path",
"is",
"always",
"absolute",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Http.php#L129-L137 |
6,978 | noordawod/php-util | src/Http.php | Http.getMethod | public static function getMethod() {
if(null === self::$method) {
// Make the method upper case.
self::$method = @strtoupper($_SERVER['REQUEST_METHOD']);
// A quick-and-dirty test to drop invalid methods.
if(!self::$method || !ctype_upper(self::$method)) {
self::$method = '';
}
}
return self::$method;
} | php | public static function getMethod() {
if(null === self::$method) {
// Make the method upper case.
self::$method = @strtoupper($_SERVER['REQUEST_METHOD']);
// A quick-and-dirty test to drop invalid methods.
if(!self::$method || !ctype_upper(self::$method)) {
self::$method = '';
}
}
return self::$method;
} | [
"public",
"static",
"function",
"getMethod",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"method",
")",
"{",
"// Make the method upper case.",
"self",
"::",
"$",
"method",
"=",
"@",
"strtoupper",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
";",
"// A quick-and-dirty test to drop invalid methods.",
"if",
"(",
"!",
"self",
"::",
"$",
"method",
"||",
"!",
"ctype_upper",
"(",
"self",
"::",
"$",
"method",
")",
")",
"{",
"self",
"::",
"$",
"method",
"=",
"''",
";",
"}",
"}",
"return",
"self",
"::",
"$",
"method",
";",
"}"
] | Returns the method of this request. In the case of HTTP, this might be GET,
POST, HEAD, etc.
@return string | [
"Returns",
"the",
"method",
"of",
"this",
"request",
".",
"In",
"the",
"case",
"of",
"HTTP",
"this",
"might",
"be",
"GET",
"POST",
"HEAD",
"etc",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Http.php#L191-L202 |
6,979 | noordawod/php-util | src/Http.php | Http.getLanguages | public static function getLanguages() {
if(null === self::$languages) {
// The pattern to match languages.
$pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';
// Get a list of languages.
$languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));
// Any matches?
$matches = array();
if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
self::$languages = array_combine($matches[1], $matches[4]);
} else {
self::$languages = [];
}
}
return self::$languages;
} | php | public static function getLanguages() {
if(null === self::$languages) {
// The pattern to match languages.
$pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';
// Get a list of languages.
$languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));
// Any matches?
$matches = array();
if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
self::$languages = array_combine($matches[1], $matches[4]);
} else {
self::$languages = [];
}
}
return self::$languages;
} | [
"public",
"static",
"function",
"getLanguages",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"languages",
")",
"{",
"// The pattern to match languages.",
"$",
"pattern",
"=",
"'/([a-z]{1,8}(-[a-z]{1,8})?)\\s*(;\\s*q\\s*=\\s*(1|0\\.[0-9]+))?/i'",
";",
"// Get a list of languages.",
"$",
"languages",
"=",
"explode",
"(",
"','",
",",
"@",
"trim",
"(",
"$",
"_SERVER",
"[",
"'HTTP_USER_AGENT'",
"]",
")",
")",
";",
"// Any matches?",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"languages",
",",
"$",
"matches",
")",
"&&",
"0",
"<",
"count",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
")",
"{",
"self",
"::",
"$",
"languages",
"=",
"array_combine",
"(",
"$",
"matches",
"[",
"1",
"]",
",",
"$",
"matches",
"[",
"4",
"]",
")",
";",
"}",
"else",
"{",
"self",
"::",
"$",
"languages",
"=",
"[",
"]",
";",
"}",
"}",
"return",
"self",
"::",
"$",
"languages",
";",
"}"
] | Returns a list of detected languages that the user-agent currently
supports. The accuracy of this list is on par with that of the relevant
header sent by the remote browser.
@return array | [
"Returns",
"a",
"list",
"of",
"detected",
"languages",
"that",
"the",
"user",
"-",
"agent",
"currently",
"supports",
".",
"The",
"accuracy",
"of",
"this",
"list",
"is",
"on",
"par",
"with",
"that",
"of",
"the",
"relevant",
"header",
"sent",
"by",
"the",
"remote",
"browser",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Http.php#L237-L254 |
6,980 | noordawod/php-util | src/Http.php | Http.getParams | public static function getParams(array $methods = null) {
if(null === $methods) {
$methods = [self::getMethod()];
}
$params = [];
if($methods) {
// This will uniquefy the methods.
$methods = array_flip(array_flip($methods));
// Run over the methods.
foreach($methods as $method) {
switch(strtoupper($method)) {
case 'GET':
$params = array_merge($params, $_GET);
break;
case 'POST':
$params = array_merge($params, $_POST);
break;
}
}
}
return $params;
} | php | public static function getParams(array $methods = null) {
if(null === $methods) {
$methods = [self::getMethod()];
}
$params = [];
if($methods) {
// This will uniquefy the methods.
$methods = array_flip(array_flip($methods));
// Run over the methods.
foreach($methods as $method) {
switch(strtoupper($method)) {
case 'GET':
$params = array_merge($params, $_GET);
break;
case 'POST':
$params = array_merge($params, $_POST);
break;
}
}
}
return $params;
} | [
"public",
"static",
"function",
"getParams",
"(",
"array",
"$",
"methods",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"methods",
")",
"{",
"$",
"methods",
"=",
"[",
"self",
"::",
"getMethod",
"(",
")",
"]",
";",
"}",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"methods",
")",
"{",
"// This will uniquefy the methods.",
"$",
"methods",
"=",
"array_flip",
"(",
"array_flip",
"(",
"$",
"methods",
")",
")",
";",
"// Run over the methods.",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"switch",
"(",
"strtoupper",
"(",
"$",
"method",
")",
")",
"{",
"case",
"'GET'",
":",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"$",
"_GET",
")",
";",
"break",
";",
"case",
"'POST'",
":",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"$",
"_POST",
")",
";",
"break",
";",
"}",
"}",
"}",
"return",
"$",
"params",
";",
"}"
] | Returns a list of parameters associated with the last request.
If the specified parameter is NULL, then the list depends on the method
used. So a GET request will get return query parameters, while a POST
request will return those.
To change this behavior, send in a list of the types to consider, as an
array of method types.
@param array $methods list to consider
@return array list of parameters (might be an empty array) | [
"Returns",
"a",
"list",
"of",
"parameters",
"associated",
"with",
"the",
"last",
"request",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Http.php#L269-L291 |
6,981 | noordawod/php-util | src/Http.php | Http.getContentType | public static function getContentType() {
if(null === self::$contentType) {
self::$contentType = @trim($_SERVER['HTTP_CONTENT_TYPE']);
if(!self::$contentType) {
self::$contentType = @trim($_SERVER['CONTENT_TYPE']);
if(!self::$contentType) {
self::$contentType = false;
}
}
}
return self::$contentType;
} | php | public static function getContentType() {
if(null === self::$contentType) {
self::$contentType = @trim($_SERVER['HTTP_CONTENT_TYPE']);
if(!self::$contentType) {
self::$contentType = @trim($_SERVER['CONTENT_TYPE']);
if(!self::$contentType) {
self::$contentType = false;
}
}
}
return self::$contentType;
} | [
"public",
"static",
"function",
"getContentType",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"contentType",
")",
"{",
"self",
"::",
"$",
"contentType",
"=",
"@",
"trim",
"(",
"$",
"_SERVER",
"[",
"'HTTP_CONTENT_TYPE'",
"]",
")",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"contentType",
")",
"{",
"self",
"::",
"$",
"contentType",
"=",
"@",
"trim",
"(",
"$",
"_SERVER",
"[",
"'CONTENT_TYPE'",
"]",
")",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"contentType",
")",
"{",
"self",
"::",
"$",
"contentType",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"self",
"::",
"$",
"contentType",
";",
"}"
] | Returns the request's content type as supplied by remote user agent. If
none was detected, FALSE is returned.
@return string|FALSE detected content type, FALSE otherwise | [
"Returns",
"the",
"request",
"s",
"content",
"type",
"as",
"supplied",
"by",
"remote",
"user",
"agent",
".",
"If",
"none",
"was",
"detected",
"FALSE",
"is",
"returned",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Http.php#L299-L310 |
6,982 | emaphp/eMapper | lib/eMapper/Query/Field.php | Field.range | public function range($from, $to, $condition = true) {
$range = new Range($this, !$condition);
$range->setFrom($from);
$range->setTo($to);
return $range;
} | php | public function range($from, $to, $condition = true) {
$range = new Range($this, !$condition);
$range->setFrom($from);
$range->setTo($to);
return $range;
} | [
"public",
"function",
"range",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"condition",
"=",
"true",
")",
"{",
"$",
"range",
"=",
"new",
"Range",
"(",
"$",
"this",
",",
"!",
"$",
"condition",
")",
";",
"$",
"range",
"->",
"setFrom",
"(",
"$",
"from",
")",
";",
"$",
"range",
"->",
"setTo",
"(",
"$",
"to",
")",
";",
"return",
"$",
"range",
";",
"}"
] | Returns a Range predicate for the current field
@param mixed $from
@param mixed $to
@param boolean $condition
@return \eMapper\SQL\Predicate\Range | [
"Returns",
"a",
"Range",
"predicate",
"for",
"the",
"current",
"field"
] | df7100e601d2a1363d07028a786b6ceb22271829 | https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Query/Field.php#L271-L276 |
6,983 | matical/nana | src/Fetch.php | Fetch.post | public function post(string $url, array $params = [])
{
return $this->send('POST', $url, [
$this->bodyFormat => $params,
]);
} | php | public function post(string $url, array $params = [])
{
return $this->send('POST', $url, [
$this->bodyFormat => $params,
]);
} | [
"public",
"function",
"post",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"'POST'",
",",
"$",
"url",
",",
"[",
"$",
"this",
"->",
"bodyFormat",
"=>",
"$",
"params",
",",
"]",
")",
";",
"}"
] | Executes a POST.
@param string $url
@param array $params
@return \ksmz\nana\Consume
@throws \GuzzleHttp\Exception\GuzzleException | [
"Executes",
"a",
"POST",
"."
] | 4d1cf7e6a8a62faa0accc7cef3b481c22440c12e | https://github.com/matical/nana/blob/4d1cf7e6a8a62faa0accc7cef3b481c22440c12e/src/Fetch.php#L188-L193 |
6,984 | matical/nana | src/Fetch.php | Fetch.patch | public function patch(string $url, array $params = [])
{
return $this->send('PATCH', $url, [
$this->bodyFormat => $params,
]);
} | php | public function patch(string $url, array $params = [])
{
return $this->send('PATCH', $url, [
$this->bodyFormat => $params,
]);
} | [
"public",
"function",
"patch",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"'PATCH'",
",",
"$",
"url",
",",
"[",
"$",
"this",
"->",
"bodyFormat",
"=>",
"$",
"params",
",",
"]",
")",
";",
"}"
] | Executes a PATCH.
@param string $url
@param array $params
@return \ksmz\nana\Consume
@throws \GuzzleHttp\Exception\GuzzleException | [
"Executes",
"a",
"PATCH",
"."
] | 4d1cf7e6a8a62faa0accc7cef3b481c22440c12e | https://github.com/matical/nana/blob/4d1cf7e6a8a62faa0accc7cef3b481c22440c12e/src/Fetch.php#L204-L209 |
6,985 | matical/nana | src/Fetch.php | Fetch.put | public function put(string $url, array $params = [])
{
return $this->send('PUT', $url, [
$this->bodyFormat => $params,
]);
} | php | public function put(string $url, array $params = [])
{
return $this->send('PUT', $url, [
$this->bodyFormat => $params,
]);
} | [
"public",
"function",
"put",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"'PUT'",
",",
"$",
"url",
",",
"[",
"$",
"this",
"->",
"bodyFormat",
"=>",
"$",
"params",
",",
"]",
")",
";",
"}"
] | Executes a PUT.
@param string $url
@param array $params
@return \ksmz\nana\Consume
@throws \GuzzleHttp\Exception\GuzzleException | [
"Executes",
"a",
"PUT",
"."
] | 4d1cf7e6a8a62faa0accc7cef3b481c22440c12e | https://github.com/matical/nana/blob/4d1cf7e6a8a62faa0accc7cef3b481c22440c12e/src/Fetch.php#L220-L225 |
6,986 | matical/nana | src/Fetch.php | Fetch.send | public function send(string $method, string $url, array $options)
{
try {
// Guzzle overwrites all query string values in the URI if queries are specified
// in the 'query' option, so they need to be extracted first.
$optionsPayload = $this->mergeOptions(
['query' => $this->parseQueryParams($url)],
$options
);
$response = $this->buildClient()->request($method, $url, $optionsPayload);
return $this->buildResponse($response);
} catch (GuzzleException $exception) {
// No "custom" exceptions, just rethrow whatever guzzle spits out.
throw $exception;
}
} | php | public function send(string $method, string $url, array $options)
{
try {
// Guzzle overwrites all query string values in the URI if queries are specified
// in the 'query' option, so they need to be extracted first.
$optionsPayload = $this->mergeOptions(
['query' => $this->parseQueryParams($url)],
$options
);
$response = $this->buildClient()->request($method, $url, $optionsPayload);
return $this->buildResponse($response);
} catch (GuzzleException $exception) {
// No "custom" exceptions, just rethrow whatever guzzle spits out.
throw $exception;
}
} | [
"public",
"function",
"send",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"url",
",",
"array",
"$",
"options",
")",
"{",
"try",
"{",
"// Guzzle overwrites all query string values in the URI if queries are specified",
"// in the 'query' option, so they need to be extracted first.",
"$",
"optionsPayload",
"=",
"$",
"this",
"->",
"mergeOptions",
"(",
"[",
"'query'",
"=>",
"$",
"this",
"->",
"parseQueryParams",
"(",
"$",
"url",
")",
"]",
",",
"$",
"options",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"buildClient",
"(",
")",
"->",
"request",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"optionsPayload",
")",
";",
"return",
"$",
"this",
"->",
"buildResponse",
"(",
"$",
"response",
")",
";",
"}",
"catch",
"(",
"GuzzleException",
"$",
"exception",
")",
"{",
"// No \"custom\" exceptions, just rethrow whatever guzzle spits out.",
"throw",
"$",
"exception",
";",
"}",
"}"
] | Build the client and send the request.
@param string $method
@param string $url
@param array $options
@return \ksmz\nana\Consume
@throws \GuzzleHttp\Exception\GuzzleException | [
"Build",
"the",
"client",
"and",
"send",
"the",
"request",
"."
] | 4d1cf7e6a8a62faa0accc7cef3b481c22440c12e | https://github.com/matical/nana/blob/4d1cf7e6a8a62faa0accc7cef3b481c22440c12e/src/Fetch.php#L253-L270 |
6,987 | matical/nana | src/Fetch.php | Fetch.parseQueryParams | protected function parseQueryParams($url)
{
$queries = [];
$querySegment = \parse_url($url, PHP_URL_QUERY);
\parse_str($querySegment, $queries);
return $queries;
} | php | protected function parseQueryParams($url)
{
$queries = [];
$querySegment = \parse_url($url, PHP_URL_QUERY);
\parse_str($querySegment, $queries);
return $queries;
} | [
"protected",
"function",
"parseQueryParams",
"(",
"$",
"url",
")",
"{",
"$",
"queries",
"=",
"[",
"]",
";",
"$",
"querySegment",
"=",
"\\",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_QUERY",
")",
";",
"\\",
"parse_str",
"(",
"$",
"querySegment",
",",
"$",
"queries",
")",
";",
"return",
"$",
"queries",
";",
"}"
] | Extracts query params into an array.
@param string $url
@return array
@see http://docs.guzzlephp.org/en/stable/request-options.html#query | [
"Extracts",
"query",
"params",
"into",
"an",
"array",
"."
] | 4d1cf7e6a8a62faa0accc7cef3b481c22440c12e | https://github.com/matical/nana/blob/4d1cf7e6a8a62faa0accc7cef3b481c22440c12e/src/Fetch.php#L345-L353 |
6,988 | sebardo/core_extra | CoreExtraBundle/Controller/MenuItemController.php | MenuItemController.showAction | public function showAction(MenuItem $menuItem)
{
$em = $this->getDoctrine()->getManager();
$deleteForm = $this->createDeleteForm($menuItem);
// $menuItem = $em->getRepository('CoreExtraBundle:MenuItem')->getItemsWithTranslations($menuItem);
return array(
'entity' => $menuItem,
'delete_form' => $deleteForm->createView(),
);
} | php | public function showAction(MenuItem $menuItem)
{
$em = $this->getDoctrine()->getManager();
$deleteForm = $this->createDeleteForm($menuItem);
// $menuItem = $em->getRepository('CoreExtraBundle:MenuItem')->getItemsWithTranslations($menuItem);
return array(
'entity' => $menuItem,
'delete_form' => $deleteForm->createView(),
);
} | [
"public",
"function",
"showAction",
"(",
"MenuItem",
"$",
"menuItem",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"deleteForm",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"menuItem",
")",
";",
"// $menuItem = $em->getRepository('CoreExtraBundle:MenuItem')->getItemsWithTranslations($menuItem);",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"menuItem",
",",
"'delete_form'",
"=>",
"$",
"deleteForm",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Finds and displays a MenuItem entity.
@Route("/admin/menuitems/{id}")
@Method("GET")
@Template() | [
"Finds",
"and",
"displays",
"a",
"MenuItem",
"entity",
"."
] | b18f2eb40c5396eb4520a566971c6c0f27603f5f | https://github.com/sebardo/core_extra/blob/b18f2eb40c5396eb4520a566971c6c0f27603f5f/CoreExtraBundle/Controller/MenuItemController.php#L132-L142 |
6,989 | ncuesta/pinocchio | src/Pinocchio/Worker.php | Worker.process | public function process()
{
$logger = $this->getLogger();
$logger->log("Starting...\n");
$formatter = $this->createFormatter();
$parser = $this->createParser();
$outputDir = $this->configuration->get('output');
$sources = $this->configuration->getSources();
$count = count($sources);
$logger->log("Using {$outputDir} as output directory.\n\n");
foreach ($sources as $pinocchio) {
$outputFile = $outputDir . '/' . $pinocchio->getOutputFilename($this->configuration->get('source'));
$logger->log("Processing {$pinocchio->getTitle()} into {$outputFile}...");
$formatter->format($parser->parse($pinocchio), $outputFile);
$logger->log(" Done\n");
}
if (!$this->configuration->get('skipIndex')) {
$logger->log("\nCreating index page at {$outputDir}/index.html.\n");
$this->createIndexFile($sources, $outputDir);
}
$logger->log("\nFinished processing {$count} source files.\n");
} | php | public function process()
{
$logger = $this->getLogger();
$logger->log("Starting...\n");
$formatter = $this->createFormatter();
$parser = $this->createParser();
$outputDir = $this->configuration->get('output');
$sources = $this->configuration->getSources();
$count = count($sources);
$logger->log("Using {$outputDir} as output directory.\n\n");
foreach ($sources as $pinocchio) {
$outputFile = $outputDir . '/' . $pinocchio->getOutputFilename($this->configuration->get('source'));
$logger->log("Processing {$pinocchio->getTitle()} into {$outputFile}...");
$formatter->format($parser->parse($pinocchio), $outputFile);
$logger->log(" Done\n");
}
if (!$this->configuration->get('skipIndex')) {
$logger->log("\nCreating index page at {$outputDir}/index.html.\n");
$this->createIndexFile($sources, $outputDir);
}
$logger->log("\nFinished processing {$count} source files.\n");
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"logger",
"->",
"log",
"(",
"\"Starting...\\n\"",
")",
";",
"$",
"formatter",
"=",
"$",
"this",
"->",
"createFormatter",
"(",
")",
";",
"$",
"parser",
"=",
"$",
"this",
"->",
"createParser",
"(",
")",
";",
"$",
"outputDir",
"=",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'output'",
")",
";",
"$",
"sources",
"=",
"$",
"this",
"->",
"configuration",
"->",
"getSources",
"(",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"sources",
")",
";",
"$",
"logger",
"->",
"log",
"(",
"\"Using {$outputDir} as output directory.\\n\\n\"",
")",
";",
"foreach",
"(",
"$",
"sources",
"as",
"$",
"pinocchio",
")",
"{",
"$",
"outputFile",
"=",
"$",
"outputDir",
".",
"'/'",
".",
"$",
"pinocchio",
"->",
"getOutputFilename",
"(",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'source'",
")",
")",
";",
"$",
"logger",
"->",
"log",
"(",
"\"Processing {$pinocchio->getTitle()} into {$outputFile}...\"",
")",
";",
"$",
"formatter",
"->",
"format",
"(",
"$",
"parser",
"->",
"parse",
"(",
"$",
"pinocchio",
")",
",",
"$",
"outputFile",
")",
";",
"$",
"logger",
"->",
"log",
"(",
"\" Done\\n\"",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'skipIndex'",
")",
")",
"{",
"$",
"logger",
"->",
"log",
"(",
"\"\\nCreating index page at {$outputDir}/index.html.\\n\"",
")",
";",
"$",
"this",
"->",
"createIndexFile",
"(",
"$",
"sources",
",",
"$",
"outputDir",
")",
";",
"}",
"$",
"logger",
"->",
"log",
"(",
"\"\\nFinished processing {$count} source files.\\n\"",
")",
";",
"}"
] | Process the source files and generate their corresponding output files. | [
"Process",
"the",
"source",
"files",
"and",
"generate",
"their",
"corresponding",
"output",
"files",
"."
] | 01b119a003362fd3a50e843341c62c95374d87cf | https://github.com/ncuesta/pinocchio/blob/01b119a003362fd3a50e843341c62c95374d87cf/src/Pinocchio/Worker.php#L63-L93 |
6,990 | ncuesta/pinocchio | src/Pinocchio/Worker.php | Worker.createOutputDir | public function createOutputDir()
{
$outputDir = $this->configuration->get('output');
if (!is_writable($outputDir)) {
@mkdir($outputDir, 0777, true);
if (!is_writable($outputDir)) {
throw new \RuntimeException("Output directory {$outputDir} is not writable.");
}
}
} | php | public function createOutputDir()
{
$outputDir = $this->configuration->get('output');
if (!is_writable($outputDir)) {
@mkdir($outputDir, 0777, true);
if (!is_writable($outputDir)) {
throw new \RuntimeException("Output directory {$outputDir} is not writable.");
}
}
} | [
"public",
"function",
"createOutputDir",
"(",
")",
"{",
"$",
"outputDir",
"=",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'output'",
")",
";",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"outputDir",
")",
")",
"{",
"@",
"mkdir",
"(",
"$",
"outputDir",
",",
"0777",
",",
"true",
")",
";",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"outputDir",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Output directory {$outputDir} is not writable.\"",
")",
";",
"}",
"}",
"}"
] | Create - if needed - the output directory provided by the configuration.
@throws \RuntimeException If the directory cannot be created. | [
"Create",
"-",
"if",
"needed",
"-",
"the",
"output",
"directory",
"provided",
"by",
"the",
"configuration",
"."
] | 01b119a003362fd3a50e843341c62c95374d87cf | https://github.com/ncuesta/pinocchio/blob/01b119a003362fd3a50e843341c62c95374d87cf/src/Pinocchio/Worker.php#L121-L132 |
6,991 | ncuesta/pinocchio | src/Pinocchio/Worker.php | Worker.getLogger | public function getLogger()
{
if ($this->logger === null) {
if ($this->configuration->get('silent')) {
$this->logger = new Logger\NullLogger();
} else {
$loggerClass = $this->configuration->get('logger') ?: '\\Pinocchio\\Logger\\StandardLogger';
$loggerOpts = $this->configuration->get('logger_opts') ?: array();
$this->logger = new $loggerClass($loggerOpts);
}
}
return $this->logger;
} | php | public function getLogger()
{
if ($this->logger === null) {
if ($this->configuration->get('silent')) {
$this->logger = new Logger\NullLogger();
} else {
$loggerClass = $this->configuration->get('logger') ?: '\\Pinocchio\\Logger\\StandardLogger';
$loggerOpts = $this->configuration->get('logger_opts') ?: array();
$this->logger = new $loggerClass($loggerOpts);
}
}
return $this->logger;
} | [
"public",
"function",
"getLogger",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'silent'",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"new",
"Logger",
"\\",
"NullLogger",
"(",
")",
";",
"}",
"else",
"{",
"$",
"loggerClass",
"=",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'logger'",
")",
"?",
":",
"'\\\\Pinocchio\\\\Logger\\\\StandardLogger'",
";",
"$",
"loggerOpts",
"=",
"$",
"this",
"->",
"configuration",
"->",
"get",
"(",
"'logger_opts'",
")",
"?",
":",
"array",
"(",
")",
";",
"$",
"this",
"->",
"logger",
"=",
"new",
"$",
"loggerClass",
"(",
"$",
"loggerOpts",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"logger",
";",
"}"
] | Get the Logger instance.
@return \Pinocchio\Logger\LoggerInterface | [
"Get",
"the",
"Logger",
"instance",
"."
] | 01b119a003362fd3a50e843341c62c95374d87cf | https://github.com/ncuesta/pinocchio/blob/01b119a003362fd3a50e843341c62c95374d87cf/src/Pinocchio/Worker.php#L159-L173 |
6,992 | standardlibrary/collection | src/Helpers/ArrayFunctionsHelperMethods.php | ArrayFunctionsHelperMethods.keys | public function keys($search = null, bool $strict = true): array
{
return array_keys($this->getData(), $search, $strict);
} | php | public function keys($search = null, bool $strict = true): array
{
return array_keys($this->getData(), $search, $strict);
} | [
"public",
"function",
"keys",
"(",
"$",
"search",
"=",
"null",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
":",
"array",
"{",
"return",
"array_keys",
"(",
"$",
"this",
"->",
"getData",
"(",
")",
",",
"$",
"search",
",",
"$",
"strict",
")",
";",
"}"
] | Returns all the keys in an array
@param mixed $search - OPTIONAL search parameter
@param bool $strict - OPTIONAL strict search comparison
@return array | [
"Returns",
"all",
"the",
"keys",
"in",
"an",
"array"
] | cbe284e77ed6816dccacc857c65bd3f956f59230 | https://github.com/standardlibrary/collection/blob/cbe284e77ed6816dccacc857c65bd3f956f59230/src/Helpers/ArrayFunctionsHelperMethods.php#L54-L57 |
6,993 | standardlibrary/collection | src/Helpers/ArrayFunctionsHelperMethods.php | ArrayFunctionsHelperMethods.pad | public function pad(int $length, $value = null)
{
$this->setData(
array_pad($this->getData(), $length, $value)
);
return $this;
} | php | public function pad(int $length, $value = null)
{
$this->setData(
array_pad($this->getData(), $length, $value)
);
return $this;
} | [
"public",
"function",
"pad",
"(",
"int",
"$",
"length",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setData",
"(",
"array_pad",
"(",
"$",
"this",
"->",
"getData",
"(",
")",
",",
"$",
"length",
",",
"$",
"value",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Pads out an array to a specified length
Note that PHP has an upper limit of 1048576 elements that can be added to
an array {@see http://php.net/manual/en/function.array-pad.php}
@param int $length - The length add to the array
@param mixed $value - The default value to add to the array
@return self | [
"Pads",
"out",
"an",
"array",
"to",
"a",
"specified",
"length"
] | cbe284e77ed6816dccacc857c65bd3f956f59230 | https://github.com/standardlibrary/collection/blob/cbe284e77ed6816dccacc857c65bd3f956f59230/src/Helpers/ArrayFunctionsHelperMethods.php#L69-L76 |
6,994 | standardlibrary/collection | src/Helpers/ArrayFunctionsHelperMethods.php | ArrayFunctionsHelperMethods.unshift | public function unshift(...$values)
{
array_unshift(
$this->getData(),
extract($values,
EXTR_PREFIX_IF_EXISTS | EXTR_PREFIX_INVALID,
'_collection_unshift'
)
);
return $this;
} | php | public function unshift(...$values)
{
array_unshift(
$this->getData(),
extract($values,
EXTR_PREFIX_IF_EXISTS | EXTR_PREFIX_INVALID,
'_collection_unshift'
)
);
return $this;
} | [
"public",
"function",
"unshift",
"(",
"...",
"$",
"values",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"getData",
"(",
")",
",",
"extract",
"(",
"$",
"values",
",",
"EXTR_PREFIX_IF_EXISTS",
"|",
"EXTR_PREFIX_INVALID",
",",
"'_collection_unshift'",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add one or more elements to the front of the array
@param mixed ...$values
@return self | [
"Add",
"one",
"or",
"more",
"elements",
"to",
"the",
"front",
"of",
"the",
"array"
] | cbe284e77ed6816dccacc857c65bd3f956f59230 | https://github.com/standardlibrary/collection/blob/cbe284e77ed6816dccacc857c65bd3f956f59230/src/Helpers/ArrayFunctionsHelperMethods.php#L124-L135 |
6,995 | sebardo/core_extra | CoreExtraBundle/Controller/SliderController.php | SliderController.newAction | public function newAction(Request $request)
{
$slider = new Slider();
$form = $this->createForm('CoreExtraBundle\Form\SliderType', $slider, array('uploadDir'=> 'uploads/images/slider' ));
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
//clean image form
$this->get('core_manager')->cleanImageForm($request->files->get('slider'), $slider);
$em->persist($slider);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'slider.created');
return $this->redirectToRoute('coreextra_slider_index');
}
return array(
'entity' => $slider,
'form' => $form->createView(),
);
} | php | public function newAction(Request $request)
{
$slider = new Slider();
$form = $this->createForm('CoreExtraBundle\Form\SliderType', $slider, array('uploadDir'=> 'uploads/images/slider' ));
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
//clean image form
$this->get('core_manager')->cleanImageForm($request->files->get('slider'), $slider);
$em->persist($slider);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'slider.created');
return $this->redirectToRoute('coreextra_slider_index');
}
return array(
'entity' => $slider,
'form' => $form->createView(),
);
} | [
"public",
"function",
"newAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"slider",
"=",
"new",
"Slider",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"'CoreExtraBundle\\Form\\SliderType'",
",",
"$",
"slider",
",",
"array",
"(",
"'uploadDir'",
"=>",
"'uploads/images/slider'",
")",
")",
";",
"$",
"form",
"->",
"handleRequest",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"form",
"->",
"isSubmitted",
"(",
")",
"&&",
"$",
"form",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"//clean image form",
"$",
"this",
"->",
"get",
"(",
"'core_manager'",
")",
"->",
"cleanImageForm",
"(",
"$",
"request",
"->",
"files",
"->",
"get",
"(",
"'slider'",
")",
",",
"$",
"slider",
")",
";",
"$",
"em",
"->",
"persist",
"(",
"$",
"slider",
")",
";",
"$",
"em",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
"->",
"getFlashBag",
"(",
")",
"->",
"add",
"(",
"'success'",
",",
"'slider.created'",
")",
";",
"return",
"$",
"this",
"->",
"redirectToRoute",
"(",
"'coreextra_slider_index'",
")",
";",
"}",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"slider",
",",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Creates a new Slider entity.
@Route("/new")
@Method({"GET", "POST"})
@Template() | [
"Creates",
"a",
"new",
"Slider",
"entity",
"."
] | b18f2eb40c5396eb4520a566971c6c0f27603f5f | https://github.com/sebardo/core_extra/blob/b18f2eb40c5396eb4520a566971c6c0f27603f5f/CoreExtraBundle/Controller/SliderController.php#L67-L91 |
6,996 | sebardo/core_extra | CoreExtraBundle/Controller/SliderController.php | SliderController.showAction | public function showAction(Slider $slider)
{
$deleteForm = $this->createDeleteForm($slider);
return array(
'entity' => $slider,
'delete_form' => $deleteForm->createView(),
);
} | php | public function showAction(Slider $slider)
{
$deleteForm = $this->createDeleteForm($slider);
return array(
'entity' => $slider,
'delete_form' => $deleteForm->createView(),
);
} | [
"public",
"function",
"showAction",
"(",
"Slider",
"$",
"slider",
")",
"{",
"$",
"deleteForm",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"slider",
")",
";",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"slider",
",",
"'delete_form'",
"=>",
"$",
"deleteForm",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Finds and displays a Slider entity.
@Route("/{id}")
@Method("GET")
@Template() | [
"Finds",
"and",
"displays",
"a",
"Slider",
"entity",
"."
] | b18f2eb40c5396eb4520a566971c6c0f27603f5f | https://github.com/sebardo/core_extra/blob/b18f2eb40c5396eb4520a566971c6c0f27603f5f/CoreExtraBundle/Controller/SliderController.php#L100-L108 |
6,997 | sebardo/core_extra | CoreExtraBundle/Controller/SliderController.php | SliderController.editAction | public function editAction(Request $request, Slider $slider)
{
$deleteForm = $this->createDeleteForm($slider);
$editForm = $this->createForm('CoreExtraBundle\Form\SliderType', $slider);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em = $this->getDoctrine()->getManager();
if($slider->getRemoveImage()){
$slider->setImage(null);
}
$em->persist($slider);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'slider.edited');
return $this->redirectToRoute('coreextra_slider_index');
}
return array(
'entity' => $slider,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
);
} | php | public function editAction(Request $request, Slider $slider)
{
$deleteForm = $this->createDeleteForm($slider);
$editForm = $this->createForm('CoreExtraBundle\Form\SliderType', $slider);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em = $this->getDoctrine()->getManager();
if($slider->getRemoveImage()){
$slider->setImage(null);
}
$em->persist($slider);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'slider.edited');
return $this->redirectToRoute('coreextra_slider_index');
}
return array(
'entity' => $slider,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
);
} | [
"public",
"function",
"editAction",
"(",
"Request",
"$",
"request",
",",
"Slider",
"$",
"slider",
")",
"{",
"$",
"deleteForm",
"=",
"$",
"this",
"->",
"createDeleteForm",
"(",
"$",
"slider",
")",
";",
"$",
"editForm",
"=",
"$",
"this",
"->",
"createForm",
"(",
"'CoreExtraBundle\\Form\\SliderType'",
",",
"$",
"slider",
")",
";",
"$",
"editForm",
"->",
"handleRequest",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"editForm",
"->",
"isSubmitted",
"(",
")",
"&&",
"$",
"editForm",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"if",
"(",
"$",
"slider",
"->",
"getRemoveImage",
"(",
")",
")",
"{",
"$",
"slider",
"->",
"setImage",
"(",
"null",
")",
";",
"}",
"$",
"em",
"->",
"persist",
"(",
"$",
"slider",
")",
";",
"$",
"em",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
"->",
"getFlashBag",
"(",
")",
"->",
"add",
"(",
"'success'",
",",
"'slider.edited'",
")",
";",
"return",
"$",
"this",
"->",
"redirectToRoute",
"(",
"'coreextra_slider_index'",
")",
";",
"}",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"slider",
",",
"'edit_form'",
"=>",
"$",
"editForm",
"->",
"createView",
"(",
")",
",",
"'delete_form'",
"=>",
"$",
"deleteForm",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Displays a form to edit an existing Slider entity.
@Route("/{id}/edit")
@Method({"GET", "POST"})
@Template()
@I18nDoctrine | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"Slider",
"entity",
"."
] | b18f2eb40c5396eb4520a566971c6c0f27603f5f | https://github.com/sebardo/core_extra/blob/b18f2eb40c5396eb4520a566971c6c0f27603f5f/CoreExtraBundle/Controller/SliderController.php#L118-L145 |
6,998 | sebardo/core_extra | CoreExtraBundle/Controller/SliderController.php | SliderController.createDeleteForm | private function createDeleteForm(Slider $slider)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('coreextra_slider_delete', array('id' => $slider->getId())))
->setMethod('DELETE')
->getForm()
;
} | php | private function createDeleteForm(Slider $slider)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('coreextra_slider_delete', array('id' => $slider->getId())))
->setMethod('DELETE')
->getForm()
;
} | [
"private",
"function",
"createDeleteForm",
"(",
"Slider",
"$",
"slider",
")",
"{",
"return",
"$",
"this",
"->",
"createFormBuilder",
"(",
")",
"->",
"setAction",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'coreextra_slider_delete'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"slider",
"->",
"getId",
"(",
")",
")",
")",
")",
"->",
"setMethod",
"(",
"'DELETE'",
")",
"->",
"getForm",
"(",
")",
";",
"}"
] | Creates a form to delete a Slider entity.
@param Slider $slider The Slider entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"delete",
"a",
"Slider",
"entity",
"."
] | b18f2eb40c5396eb4520a566971c6c0f27603f5f | https://github.com/sebardo/core_extra/blob/b18f2eb40c5396eb4520a566971c6c0f27603f5f/CoreExtraBundle/Controller/SliderController.php#L176-L183 |
6,999 | noordawod/php-util | src/Shutdown.php | Shutdown.register | public function register(
/*string*/ $id,
callable $callback,
/*int*/ $priority = self::PRIO_EARLY
) {
// Normalize priority.
$priority = intval($priority);
// The priority must be valid.
if(self::PRIO_START <= $priority && self::PRIO_END >= $priority) {
// Register new callback.
$this->registerImpl($id, $callback, $priority);
}
} | php | public function register(
/*string*/ $id,
callable $callback,
/*int*/ $priority = self::PRIO_EARLY
) {
// Normalize priority.
$priority = intval($priority);
// The priority must be valid.
if(self::PRIO_START <= $priority && self::PRIO_END >= $priority) {
// Register new callback.
$this->registerImpl($id, $callback, $priority);
}
} | [
"public",
"function",
"register",
"(",
"/*string*/",
"$",
"id",
",",
"callable",
"$",
"callback",
",",
"/*int*/",
"$",
"priority",
"=",
"self",
"::",
"PRIO_EARLY",
")",
"{",
"// Normalize priority.",
"$",
"priority",
"=",
"intval",
"(",
"$",
"priority",
")",
";",
"// The priority must be valid.",
"if",
"(",
"self",
"::",
"PRIO_START",
"<=",
"$",
"priority",
"&&",
"self",
"::",
"PRIO_END",
">=",
"$",
"priority",
")",
"{",
"// Register new callback.",
"$",
"this",
"->",
"registerImpl",
"(",
"$",
"id",
",",
"$",
"callback",
",",
"$",
"priority",
")",
";",
"}",
"}"
] | Registers a new shutdown callback with the specified priority.
@param string $id unique identifier of this callback
@param callable $callback to register
@param int $priority of the callback | [
"Registers",
"a",
"new",
"shutdown",
"callback",
"with",
"the",
"specified",
"priority",
"."
] | 6458690cc2c8457914a2aa74b131451d4a8e5797 | https://github.com/noordawod/php-util/blob/6458690cc2c8457914a2aa74b131451d4a8e5797/src/Shutdown.php#L100-L113 |
Subsets and Splits