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
|
---|---|---|---|---|---|---|---|---|---|---|---|
5,200 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByLastchecked | public function filterByLastchecked($lastchecked = null, $comparison = null)
{
if (is_array($lastchecked)) {
$useMinMax = false;
if (isset($lastchecked['min'])) {
$this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lastchecked['max'])) {
$this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked, $comparison);
} | php | public function filterByLastchecked($lastchecked = null, $comparison = null)
{
if (is_array($lastchecked)) {
$useMinMax = false;
if (isset($lastchecked['min'])) {
$this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lastchecked['max'])) {
$this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_LASTCHECKED, $lastchecked, $comparison);
} | [
"public",
"function",
"filterByLastchecked",
"(",
"$",
"lastchecked",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"lastchecked",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"lastchecked",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_LASTCHECKED",
",",
"$",
"lastchecked",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"lastchecked",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_LASTCHECKED",
",",
"$",
"lastchecked",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_LASTCHECKED",
",",
"$",
"lastchecked",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the lastchecked column
Example usage:
<code>
$query->filterByLastchecked('2011-03-14'); // WHERE lastchecked = '2011-03-14'
$query->filterByLastchecked('now'); // WHERE lastchecked = '2011-03-14'
$query->filterByLastchecked(array('max' => 'yesterday')); // WHERE lastchecked > '2011-03-13'
</code>
@param mixed $lastchecked The value to use as filter.
Values can be integers (unix timestamps), DateTime objects, or strings.
Empty strings are treated as NULL.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"lastchecked",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L896-L917 |
5,201 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByManaged | public function filterByManaged($managed = null, $comparison = null)
{
if (is_string($managed)) {
$managed = in_array(strtolower($managed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ReferenceTableMap::COL_MANAGED, $managed, $comparison);
} | php | public function filterByManaged($managed = null, $comparison = null)
{
if (is_string($managed)) {
$managed = in_array(strtolower($managed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ReferenceTableMap::COL_MANAGED, $managed, $comparison);
} | [
"public",
"function",
"filterByManaged",
"(",
"$",
"managed",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"managed",
")",
")",
"{",
"$",
"managed",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"managed",
")",
",",
"array",
"(",
"'false'",
",",
"'off'",
",",
"'-'",
",",
"'no'",
",",
"'n'",
",",
"'0'",
",",
"''",
")",
")",
"?",
"false",
":",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_MANAGED",
",",
"$",
"managed",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the managed column
Example usage:
<code>
$query->filterByManaged(true); // WHERE managed = true
$query->filterByManaged('yes'); // WHERE managed = true
</code>
@param boolean|string $managed The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"managed",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L937-L944 |
5,202 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.useSkillReferenceQuery | public function useSkillReferenceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSkillReference($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SkillReference', '\gossi\trixionary\model\SkillReferenceQuery');
} | php | public function useSkillReferenceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinSkillReference($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SkillReference', '\gossi\trixionary\model\SkillReferenceQuery');
} | [
"public",
"function",
"useSkillReferenceQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinSkillReference",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuery",
"(",
"$",
"relationAlias",
"?",
"$",
"relationAlias",
":",
"'SkillReference'",
",",
"'\\gossi\\trixionary\\model\\SkillReferenceQuery'",
")",
";",
"}"
] | Use the SkillReference relation SkillReference object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \gossi\trixionary\model\SkillReferenceQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"SkillReference",
"relation",
"SkillReference",
"object"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L1085-L1090 |
5,203 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterBySkill | public function filterBySkill($skill, $comparison = Criteria::EQUAL)
{
return $this
->useSkillReferenceQuery()
->filterBySkill($skill, $comparison)
->endUse();
} | php | public function filterBySkill($skill, $comparison = Criteria::EQUAL)
{
return $this
->useSkillReferenceQuery()
->filterBySkill($skill, $comparison)
->endUse();
} | [
"public",
"function",
"filterBySkill",
"(",
"$",
"skill",
",",
"$",
"comparison",
"=",
"Criteria",
"::",
"EQUAL",
")",
"{",
"return",
"$",
"this",
"->",
"useSkillReferenceQuery",
"(",
")",
"->",
"filterBySkill",
"(",
"$",
"skill",
",",
"$",
"comparison",
")",
"->",
"endUse",
"(",
")",
";",
"}"
] | Filter the query by a related Skill object
using the kk_trixionary_skill_reference table as cross reference
@param Skill $skill the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Skill",
"object",
"using",
"the",
"kk_trixionary_skill_reference",
"table",
"as",
"cross",
"reference"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L1101-L1107 |
5,204 | mpaleo/scaffolder-support | src/Scaffolder/Support/Composer.php | Composer.createProject | public function createProject($packageName, $packageVersion, $outputFolder)
{
$this->runCommand('create-project --prefer-dist ' . $packageName . ' ' . $outputFolder . ' "' . $packageVersion . '"');
return $this;
} | php | public function createProject($packageName, $packageVersion, $outputFolder)
{
$this->runCommand('create-project --prefer-dist ' . $packageName . ' ' . $outputFolder . ' "' . $packageVersion . '"');
return $this;
} | [
"public",
"function",
"createProject",
"(",
"$",
"packageName",
",",
"$",
"packageVersion",
",",
"$",
"outputFolder",
")",
"{",
"$",
"this",
"->",
"runCommand",
"(",
"'create-project --prefer-dist '",
".",
"$",
"packageName",
".",
"' '",
".",
"$",
"outputFolder",
".",
"' \"'",
".",
"$",
"packageVersion",
".",
"'\"'",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Composer create-project.
@param $packageName
@param $packageVersion
@param $outputFolder
@return $this | [
"Composer",
"create",
"-",
"project",
"."
] | d599c88596c65302a984078cd0519221a2d2ceac | https://github.com/mpaleo/scaffolder-support/blob/d599c88596c65302a984078cd0519221a2d2ceac/src/Scaffolder/Support/Composer.php#L37-L42 |
5,205 | mpaleo/scaffolder-support | src/Scaffolder/Support/Composer.php | Composer.find | protected function find()
{
if (!File::exists($this->workingPath . '/composer.phar'))
{
return 'composer';
}
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
if (defined('HHVM_VERSION'))
{
$binary .= ' --php';
}
return "{$binary} composer.phar";
} | php | protected function find()
{
if (!File::exists($this->workingPath . '/composer.phar'))
{
return 'composer';
}
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
if (defined('HHVM_VERSION'))
{
$binary .= ' --php';
}
return "{$binary} composer.phar";
} | [
"protected",
"function",
"find",
"(",
")",
"{",
"if",
"(",
"!",
"File",
"::",
"exists",
"(",
"$",
"this",
"->",
"workingPath",
".",
"'/composer.phar'",
")",
")",
"{",
"return",
"'composer'",
";",
"}",
"$",
"binary",
"=",
"ProcessUtils",
"::",
"escapeArgument",
"(",
"(",
"new",
"PhpExecutableFinder",
")",
"->",
"find",
"(",
"false",
")",
")",
";",
"if",
"(",
"defined",
"(",
"'HHVM_VERSION'",
")",
")",
"{",
"$",
"binary",
".=",
"' --php'",
";",
"}",
"return",
"\"{$binary} composer.phar\"",
";",
"}"
] | Find composer.
@return string | [
"Find",
"composer",
"."
] | d599c88596c65302a984078cd0519221a2d2ceac | https://github.com/mpaleo/scaffolder-support/blob/d599c88596c65302a984078cd0519221a2d2ceac/src/Scaffolder/Support/Composer.php#L73-L88 |
5,206 | mpaleo/scaffolder-support | src/Scaffolder/Support/Composer.php | Composer.runCommand | protected function runCommand($command)
{
$process = $this->getProcess();
$process->setCommandLine(trim($this->find() . ' ' . $command));
$process->run();
return $this;
} | php | protected function runCommand($command)
{
$process = $this->getProcess();
$process->setCommandLine(trim($this->find() . ' ' . $command));
$process->run();
return $this;
} | [
"protected",
"function",
"runCommand",
"(",
"$",
"command",
")",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"getProcess",
"(",
")",
";",
"$",
"process",
"->",
"setCommandLine",
"(",
"trim",
"(",
"$",
"this",
"->",
"find",
"(",
")",
".",
"' '",
".",
"$",
"command",
")",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Run composer command.
@param $command
@return $this | [
"Run",
"composer",
"command",
"."
] | d599c88596c65302a984078cd0519221a2d2ceac | https://github.com/mpaleo/scaffolder-support/blob/d599c88596c65302a984078cd0519221a2d2ceac/src/Scaffolder/Support/Composer.php#L106-L115 |
5,207 | novuso/novusopress | core/Theme.php | Theme.getThemeInfo | public function getThemeInfo($key)
{
if (null === $this->theme) {
$this->theme = wp_get_theme();
}
$headers = [
'name' => 'Name',
'description' => 'Description',
'author' => 'Author',
'authoruri' => 'AuthorURI',
'themeuri' => 'ThemeURI',
'version' => 'Version',
'status' => 'Status',
'tags' => 'Tags',
'textdomain' => 'TextDomain'
];
$key = strtolower($key);
if (isset($headers[$key])) {
return $this->theme->get($headers[$key]);
}
return false;
} | php | public function getThemeInfo($key)
{
if (null === $this->theme) {
$this->theme = wp_get_theme();
}
$headers = [
'name' => 'Name',
'description' => 'Description',
'author' => 'Author',
'authoruri' => 'AuthorURI',
'themeuri' => 'ThemeURI',
'version' => 'Version',
'status' => 'Status',
'tags' => 'Tags',
'textdomain' => 'TextDomain'
];
$key = strtolower($key);
if (isset($headers[$key])) {
return $this->theme->get($headers[$key]);
}
return false;
} | [
"public",
"function",
"getThemeInfo",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"theme",
")",
"{",
"$",
"this",
"->",
"theme",
"=",
"wp_get_theme",
"(",
")",
";",
"}",
"$",
"headers",
"=",
"[",
"'name'",
"=>",
"'Name'",
",",
"'description'",
"=>",
"'Description'",
",",
"'author'",
"=>",
"'Author'",
",",
"'authoruri'",
"=>",
"'AuthorURI'",
",",
"'themeuri'",
"=>",
"'ThemeURI'",
",",
"'version'",
"=>",
"'Version'",
",",
"'status'",
"=>",
"'Status'",
",",
"'tags'",
"=>",
"'Tags'",
",",
"'textdomain'",
"=>",
"'TextDomain'",
"]",
";",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"key",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"headers",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"theme",
"->",
"get",
"(",
"$",
"headers",
"[",
"$",
"key",
"]",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Retrieves theme information
Returns the field value or false on failure.
@param string $key The theme info key
@return string|false | [
"Retrieves",
"theme",
"information"
] | e31a46b0afa4126788f5754f928552ce13f8531f | https://github.com/novuso/novusopress/blob/e31a46b0afa4126788f5754f928552ce13f8531f/core/Theme.php#L50-L75 |
5,208 | novuso/novusopress | core/Theme.php | Theme.getThemeOption | public function getThemeOption($key, $default = null)
{
$options = get_option('novusopress_theme_options') ?: [];
if (array_key_exists($key, $options)) {
return apply_filters(sprintf('novusopress_theme_options_%s', $key), $options[$key]);
}
$defaults = $this->getThemeDefaultOptions();
if (array_key_exists($key, $defaults)) {
return apply_filters(sprintf('novusopress_theme_options_%s', $key), $defaults[$key]);
}
return $default;
} | php | public function getThemeOption($key, $default = null)
{
$options = get_option('novusopress_theme_options') ?: [];
if (array_key_exists($key, $options)) {
return apply_filters(sprintf('novusopress_theme_options_%s', $key), $options[$key]);
}
$defaults = $this->getThemeDefaultOptions();
if (array_key_exists($key, $defaults)) {
return apply_filters(sprintf('novusopress_theme_options_%s', $key), $defaults[$key]);
}
return $default;
} | [
"public",
"function",
"getThemeOption",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"get_option",
"(",
"'novusopress_theme_options'",
")",
"?",
":",
"[",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"options",
")",
")",
"{",
"return",
"apply_filters",
"(",
"sprintf",
"(",
"'novusopress_theme_options_%s'",
",",
"$",
"key",
")",
",",
"$",
"options",
"[",
"$",
"key",
"]",
")",
";",
"}",
"$",
"defaults",
"=",
"$",
"this",
"->",
"getThemeDefaultOptions",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"defaults",
")",
")",
"{",
"return",
"apply_filters",
"(",
"sprintf",
"(",
"'novusopress_theme_options_%s'",
",",
"$",
"key",
")",
",",
"$",
"defaults",
"[",
"$",
"key",
"]",
")",
";",
"}",
"return",
"$",
"default",
";",
"}"
] | Retrieves theme option
@param string $key The theme option key
@param mixed $default A default value to return if the option is undefined
@return mixed | [
"Retrieves",
"theme",
"option"
] | e31a46b0afa4126788f5754f928552ce13f8531f | https://github.com/novuso/novusopress/blob/e31a46b0afa4126788f5754f928552ce13f8531f/core/Theme.php#L85-L100 |
5,209 | novuso/novusopress | core/Theme.php | Theme.addThemeSupports | public function addThemeSupports()
{
load_theme_textdomain('novusopress', $this->paths->getBaseLanguageDir());
add_theme_support('title-tag');
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');
add_theme_support('html5', ['search-form', 'comment-form', 'comment-list', 'gallery', 'caption']);
register_nav_menus(['main-menu' => __('Main Menu', 'novusopress')]);
if ($this->getThemeOption('clean_document_head')) {
$this->cleanDocumentHead();
}
if (file_exists(sprintf('%s/css/editor-style.css', $this->paths->getThemeAssetsDir()))) {
add_editor_style('assets/css/editor-style.css');
}
} | php | public function addThemeSupports()
{
load_theme_textdomain('novusopress', $this->paths->getBaseLanguageDir());
add_theme_support('title-tag');
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');
add_theme_support('html5', ['search-form', 'comment-form', 'comment-list', 'gallery', 'caption']);
register_nav_menus(['main-menu' => __('Main Menu', 'novusopress')]);
if ($this->getThemeOption('clean_document_head')) {
$this->cleanDocumentHead();
}
if (file_exists(sprintf('%s/css/editor-style.css', $this->paths->getThemeAssetsDir()))) {
add_editor_style('assets/css/editor-style.css');
}
} | [
"public",
"function",
"addThemeSupports",
"(",
")",
"{",
"load_theme_textdomain",
"(",
"'novusopress'",
",",
"$",
"this",
"->",
"paths",
"->",
"getBaseLanguageDir",
"(",
")",
")",
";",
"add_theme_support",
"(",
"'title-tag'",
")",
";",
"add_theme_support",
"(",
"'automatic-feed-links'",
")",
";",
"add_theme_support",
"(",
"'post-thumbnails'",
")",
";",
"add_theme_support",
"(",
"'html5'",
",",
"[",
"'search-form'",
",",
"'comment-form'",
",",
"'comment-list'",
",",
"'gallery'",
",",
"'caption'",
"]",
")",
";",
"register_nav_menus",
"(",
"[",
"'main-menu'",
"=>",
"__",
"(",
"'Main Menu'",
",",
"'novusopress'",
")",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getThemeOption",
"(",
"'clean_document_head'",
")",
")",
"{",
"$",
"this",
"->",
"cleanDocumentHead",
"(",
")",
";",
"}",
"if",
"(",
"file_exists",
"(",
"sprintf",
"(",
"'%s/css/editor-style.css'",
",",
"$",
"this",
"->",
"paths",
"->",
"getThemeAssetsDir",
"(",
")",
")",
")",
")",
"{",
"add_editor_style",
"(",
"'assets/css/editor-style.css'",
")",
";",
"}",
"}"
] | Enables theme supports | [
"Enables",
"theme",
"supports"
] | e31a46b0afa4126788f5754f928552ce13f8531f | https://github.com/novuso/novusopress/blob/e31a46b0afa4126788f5754f928552ce13f8531f/core/Theme.php#L105-L123 |
5,210 | novuso/novusopress | core/Theme.php | Theme.registerWidgets | public function registerWidgets()
{
$this->registerWidget(__('Header Widget Area', 'novusopress'), 'header', 'widgets');
$this->registerWidget(__('Blog Index Sidebar', 'novusopress'), 'sidebar', 'index');
$this->registerWidget(__('Blog Post Sidebar', 'novusopress'), 'sidebar', 'single');
$this->registerWidget(__('Front Page Sidebar', 'novusopress'), 'sidebar', 'front-page');
$this->registerWidget(__('Standard Page Sidebar', 'novusopress'), 'sidebar', 'page');
$this->registerWidget(__('Archive List Sidebar', 'novusopress'), 'sidebar', 'archive');
$this->registerWidget(__('Search Results Sidebar', 'novusopress'), 'sidebar', 'search');
$this->registerWidget(__('Attachment View Sidebar', 'novusopress'), 'sidebar', 'attachment');
$this->registerWidget(__('404 Error Sidebar', 'novusopress'), 'sidebar', 'not-found');
$this->registerWidget(__('Footer Area One', 'novusopress'), 'footer', 'one');
$this->registerWidget(__('Footer Area Two', 'novusopress'), 'footer', 'two');
$this->registerWidget(__('Footer Area Three', 'novusopress'), 'footer', 'three');
$this->registerWidget(__('Footer Area Four', 'novusopress'), 'footer', 'four');
} | php | public function registerWidgets()
{
$this->registerWidget(__('Header Widget Area', 'novusopress'), 'header', 'widgets');
$this->registerWidget(__('Blog Index Sidebar', 'novusopress'), 'sidebar', 'index');
$this->registerWidget(__('Blog Post Sidebar', 'novusopress'), 'sidebar', 'single');
$this->registerWidget(__('Front Page Sidebar', 'novusopress'), 'sidebar', 'front-page');
$this->registerWidget(__('Standard Page Sidebar', 'novusopress'), 'sidebar', 'page');
$this->registerWidget(__('Archive List Sidebar', 'novusopress'), 'sidebar', 'archive');
$this->registerWidget(__('Search Results Sidebar', 'novusopress'), 'sidebar', 'search');
$this->registerWidget(__('Attachment View Sidebar', 'novusopress'), 'sidebar', 'attachment');
$this->registerWidget(__('404 Error Sidebar', 'novusopress'), 'sidebar', 'not-found');
$this->registerWidget(__('Footer Area One', 'novusopress'), 'footer', 'one');
$this->registerWidget(__('Footer Area Two', 'novusopress'), 'footer', 'two');
$this->registerWidget(__('Footer Area Three', 'novusopress'), 'footer', 'three');
$this->registerWidget(__('Footer Area Four', 'novusopress'), 'footer', 'four');
} | [
"public",
"function",
"registerWidgets",
"(",
")",
"{",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Header Widget Area'",
",",
"'novusopress'",
")",
",",
"'header'",
",",
"'widgets'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Blog Index Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'index'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Blog Post Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'single'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Front Page Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'front-page'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Standard Page Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'page'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Archive List Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'archive'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Search Results Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'search'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Attachment View Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'attachment'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'404 Error Sidebar'",
",",
"'novusopress'",
")",
",",
"'sidebar'",
",",
"'not-found'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Footer Area One'",
",",
"'novusopress'",
")",
",",
"'footer'",
",",
"'one'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Footer Area Two'",
",",
"'novusopress'",
")",
",",
"'footer'",
",",
"'two'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Footer Area Three'",
",",
"'novusopress'",
")",
",",
"'footer'",
",",
"'three'",
")",
";",
"$",
"this",
"->",
"registerWidget",
"(",
"__",
"(",
"'Footer Area Four'",
",",
"'novusopress'",
")",
",",
"'footer'",
",",
"'four'",
")",
";",
"}"
] | Enables default widget support | [
"Enables",
"default",
"widget",
"support"
] | e31a46b0afa4126788f5754f928552ce13f8531f | https://github.com/novuso/novusopress/blob/e31a46b0afa4126788f5754f928552ce13f8531f/core/Theme.php#L128-L143 |
5,211 | novuso/novusopress | core/Theme.php | Theme.cleanDocumentHead | public function cleanDocumentHead()
{
remove_action('wp_head', 'feed_links_extra');
remove_action('wp_head', 'feed_links');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10);
remove_action('wp_head', 'start_post_rel_link', 10);
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
remove_action('wp_head', 'wp_generator');
} | php | public function cleanDocumentHead()
{
remove_action('wp_head', 'feed_links_extra');
remove_action('wp_head', 'feed_links');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10);
remove_action('wp_head', 'start_post_rel_link', 10);
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
remove_action('wp_head', 'wp_generator');
} | [
"public",
"function",
"cleanDocumentHead",
"(",
")",
"{",
"remove_action",
"(",
"'wp_head'",
",",
"'feed_links_extra'",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'feed_links'",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'rsd_link'",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'wlwmanifest_link'",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'index_rel_link'",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'parent_post_rel_link'",
",",
"10",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'start_post_rel_link'",
",",
"10",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'adjacent_posts_rel_link_wp_head'",
",",
"10",
")",
";",
"remove_action",
"(",
"'wp_head'",
",",
"'wp_generator'",
")",
";",
"}"
] | Removes extra markup from the document head | [
"Removes",
"extra",
"markup",
"from",
"the",
"document",
"head"
] | e31a46b0afa4126788f5754f928552ce13f8531f | https://github.com/novuso/novusopress/blob/e31a46b0afa4126788f5754f928552ce13f8531f/core/Theme.php#L171-L182 |
5,212 | sios13/simox | src/View.php | View.setViewLevel | public function setViewLevel( $view_level_name, $view_level_file_name )
{
if ( isset($this->_view_levels[$view_level_name]) )
{
$this->_view_levels[$view_level_name]["file_name"] = $view_level_file_name;
$this->_view_levels[$view_level_name]["is_disabled"] = false;
}
} | php | public function setViewLevel( $view_level_name, $view_level_file_name )
{
if ( isset($this->_view_levels[$view_level_name]) )
{
$this->_view_levels[$view_level_name]["file_name"] = $view_level_file_name;
$this->_view_levels[$view_level_name]["is_disabled"] = false;
}
} | [
"public",
"function",
"setViewLevel",
"(",
"$",
"view_level_name",
",",
"$",
"view_level_file_name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level_name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level_name",
"]",
"[",
"\"file_name\"",
"]",
"=",
"$",
"view_level_file_name",
";",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level_name",
"]",
"[",
"\"is_disabled\"",
"]",
"=",
"false",
";",
"}",
"}"
] | Attach a file name to a view level, enables the view level | [
"Attach",
"a",
"file",
"name",
"to",
"a",
"view",
"level",
"enables",
"the",
"view",
"level"
] | 8be964949ef179aba7eceb3fc6439815a1af2ad2 | https://github.com/sios13/simox/blob/8be964949ef179aba7eceb3fc6439815a1af2ad2/src/View.php#L130-L137 |
5,213 | sios13/simox | src/View.php | View.disableViewLevel | public function disableViewLevel( $view_level_name )
{
if ( isset($this->_view_levels[$view_level_name]) )
{
$this->_view_levels[$level_name]["is_disabled"] = true;
}
} | php | public function disableViewLevel( $view_level_name )
{
if ( isset($this->_view_levels[$view_level_name]) )
{
$this->_view_levels[$level_name]["is_disabled"] = true;
}
} | [
"public",
"function",
"disableViewLevel",
"(",
"$",
"view_level_name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level_name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"level_name",
"]",
"[",
"\"is_disabled\"",
"]",
"=",
"true",
";",
"}",
"}"
] | Disables a view level | [
"Disables",
"a",
"view",
"level"
] | 8be964949ef179aba7eceb3fc6439815a1af2ad2 | https://github.com/sios13/simox/blob/8be964949ef179aba7eceb3fc6439815a1af2ad2/src/View.php#L158-L164 |
5,214 | sios13/simox | src/View.php | View.enableCache | public function enableCache ( $options = null )
{
$key = isset($options["key"]) ? $options["key"] : "";
$lifetime = isset($options["lifetime"]) ? $options["lifetime"] : 3600;
$level = isset($options["level"]) ? $options["level"] : 1;
$this->_cache_service_name = isset($options["service"]) ? $options["service"] : "cache";
$view_level_name = $this->_getViewLevelNameFromLevel( $level );
$this->_view_levels[$view_level_name]["cache_enabled"] = array(
"key" => $key,
"lifetime" => $lifetime
);
} | php | public function enableCache ( $options = null )
{
$key = isset($options["key"]) ? $options["key"] : "";
$lifetime = isset($options["lifetime"]) ? $options["lifetime"] : 3600;
$level = isset($options["level"]) ? $options["level"] : 1;
$this->_cache_service_name = isset($options["service"]) ? $options["service"] : "cache";
$view_level_name = $this->_getViewLevelNameFromLevel( $level );
$this->_view_levels[$view_level_name]["cache_enabled"] = array(
"key" => $key,
"lifetime" => $lifetime
);
} | [
"public",
"function",
"enableCache",
"(",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"isset",
"(",
"$",
"options",
"[",
"\"key\"",
"]",
")",
"?",
"$",
"options",
"[",
"\"key\"",
"]",
":",
"\"\"",
";",
"$",
"lifetime",
"=",
"isset",
"(",
"$",
"options",
"[",
"\"lifetime\"",
"]",
")",
"?",
"$",
"options",
"[",
"\"lifetime\"",
"]",
":",
"3600",
";",
"$",
"level",
"=",
"isset",
"(",
"$",
"options",
"[",
"\"level\"",
"]",
")",
"?",
"$",
"options",
"[",
"\"level\"",
"]",
":",
"1",
";",
"$",
"this",
"->",
"_cache_service_name",
"=",
"isset",
"(",
"$",
"options",
"[",
"\"service\"",
"]",
")",
"?",
"$",
"options",
"[",
"\"service\"",
"]",
":",
"\"cache\"",
";",
"$",
"view_level_name",
"=",
"$",
"this",
"->",
"_getViewLevelNameFromLevel",
"(",
"$",
"level",
")",
";",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level_name",
"]",
"[",
"\"cache_enabled\"",
"]",
"=",
"array",
"(",
"\"key\"",
"=>",
"$",
"key",
",",
"\"lifetime\"",
"=>",
"$",
"lifetime",
")",
";",
"}"
] | Enables caching. | [
"Enables",
"caching",
"."
] | 8be964949ef179aba7eceb3fc6439815a1af2ad2 | https://github.com/sios13/simox/blob/8be964949ef179aba7eceb3fc6439815a1af2ad2/src/View.php#L169-L182 |
5,215 | sios13/simox | src/View.php | View._checkViewsExist | private function _checkViewsExist()
{
foreach ( $this->_view_levels as $view_level )
{
if ( !$view_level["is_disabled"] )
{
if ( !file_exists($this->_views_dir . $view_level["file_name"] . ".phtml") )
{
throw new \Exception( "View '". $view_level["file_name"] .".phtml' does not exist." );
}
}
}
} | php | private function _checkViewsExist()
{
foreach ( $this->_view_levels as $view_level )
{
if ( !$view_level["is_disabled"] )
{
if ( !file_exists($this->_views_dir . $view_level["file_name"] . ".phtml") )
{
throw new \Exception( "View '". $view_level["file_name"] .".phtml' does not exist." );
}
}
}
} | [
"private",
"function",
"_checkViewsExist",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_view_levels",
"as",
"$",
"view_level",
")",
"{",
"if",
"(",
"!",
"$",
"view_level",
"[",
"\"is_disabled\"",
"]",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"_views_dir",
".",
"$",
"view_level",
"[",
"\"file_name\"",
"]",
".",
"\".phtml\"",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"View '\"",
".",
"$",
"view_level",
"[",
"\"file_name\"",
"]",
".",
"\".phtml' does not exist.\"",
")",
";",
"}",
"}",
"}",
"}"
] | Private function. Checks the enabled view levels and makes sure the attached view exists. | [
"Private",
"function",
".",
"Checks",
"the",
"enabled",
"view",
"levels",
"and",
"makes",
"sure",
"the",
"attached",
"view",
"exists",
"."
] | 8be964949ef179aba7eceb3fc6439815a1af2ad2 | https://github.com/sios13/simox/blob/8be964949ef179aba7eceb3fc6439815a1af2ad2/src/View.php#L228-L240 |
5,216 | sios13/simox | src/View.php | View.getContent | public function getContent()
{
if ( $this->_render_completed )
{
return $this->_content;
}
foreach ( $this->_view_levels as $view_level )
{
if ( $view_level["is_disabled"] )
{
continue;
}
$this->_view_levels[$view_level["name"]]["is_disabled"] = true;
if ( $view_level["cache_enabled"] != false )
{
$this->getCacheContent( $view_level );
return;
}
include( $this->_views_dir . $view_level["file_name"] . ".phtml" );
return;
}
} | php | public function getContent()
{
if ( $this->_render_completed )
{
return $this->_content;
}
foreach ( $this->_view_levels as $view_level )
{
if ( $view_level["is_disabled"] )
{
continue;
}
$this->_view_levels[$view_level["name"]]["is_disabled"] = true;
if ( $view_level["cache_enabled"] != false )
{
$this->getCacheContent( $view_level );
return;
}
include( $this->_views_dir . $view_level["file_name"] . ".phtml" );
return;
}
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_render_completed",
")",
"{",
"return",
"$",
"this",
"->",
"_content",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_view_levels",
"as",
"$",
"view_level",
")",
"{",
"if",
"(",
"$",
"view_level",
"[",
"\"is_disabled\"",
"]",
")",
"{",
"continue",
";",
"}",
"$",
"this",
"->",
"_view_levels",
"[",
"$",
"view_level",
"[",
"\"name\"",
"]",
"]",
"[",
"\"is_disabled\"",
"]",
"=",
"true",
";",
"if",
"(",
"$",
"view_level",
"[",
"\"cache_enabled\"",
"]",
"!=",
"false",
")",
"{",
"$",
"this",
"->",
"getCacheContent",
"(",
"$",
"view_level",
")",
";",
"return",
";",
"}",
"include",
"(",
"$",
"this",
"->",
"_views_dir",
".",
"$",
"view_level",
"[",
"\"file_name\"",
"]",
".",
"\".phtml\"",
")",
";",
"return",
";",
"}",
"}"
] | Includes the files attached to the view levels.
Disabled view levels do not get included.
MAIN_VIEW -> BEFORE_CONTROLLER_VIEW -> CONTROLLER_VIEW -> AFTER_CONTROLLER_VIEW -> ACTION_VIEW
If a view level has cache enabled, stop rendering | [
"Includes",
"the",
"files",
"attached",
"to",
"the",
"view",
"levels",
".",
"Disabled",
"view",
"levels",
"do",
"not",
"get",
"included",
".",
"MAIN_VIEW",
"-",
">",
"BEFORE_CONTROLLER_VIEW",
"-",
">",
"CONTROLLER_VIEW",
"-",
">",
"AFTER_CONTROLLER_VIEW",
"-",
">",
"ACTION_VIEW",
"If",
"a",
"view",
"level",
"has",
"cache",
"enabled",
"stop",
"rendering"
] | 8be964949ef179aba7eceb3fc6439815a1af2ad2 | https://github.com/sios13/simox/blob/8be964949ef179aba7eceb3fc6439815a1af2ad2/src/View.php#L253-L278 |
5,217 | tekkla/core-logger | Core/Logger/Streams/InterpolateTrait.php | InterpolateTrait.interpolate | function interpolate($message, array $context = [])
{
// build a replacement array with braces around the context keys
$replace = array();
foreach ($context as $key => $val) {
if (($key == 'exception' || $key == 'throwable') && $val instanceof \Throwable) {
$val = $val->getTraceAsString();
}
if (is_object($val)) {
$val = 'Objects can not be interpolated.';
}
$replace['{' . $key . '}'] = $val;
}
// interpolate replacement values into the message and return
return strtr($message, $replace);
} | php | function interpolate($message, array $context = [])
{
// build a replacement array with braces around the context keys
$replace = array();
foreach ($context as $key => $val) {
if (($key == 'exception' || $key == 'throwable') && $val instanceof \Throwable) {
$val = $val->getTraceAsString();
}
if (is_object($val)) {
$val = 'Objects can not be interpolated.';
}
$replace['{' . $key . '}'] = $val;
}
// interpolate replacement values into the message and return
return strtr($message, $replace);
} | [
"function",
"interpolate",
"(",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"// build a replacement array with braces around the context keys",
"$",
"replace",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"context",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"==",
"'exception'",
"||",
"$",
"key",
"==",
"'throwable'",
")",
"&&",
"$",
"val",
"instanceof",
"\\",
"Throwable",
")",
"{",
"$",
"val",
"=",
"$",
"val",
"->",
"getTraceAsString",
"(",
")",
";",
"}",
"if",
"(",
"is_object",
"(",
"$",
"val",
")",
")",
"{",
"$",
"val",
"=",
"'Objects can not be interpolated.'",
";",
"}",
"$",
"replace",
"[",
"'{'",
".",
"$",
"key",
".",
"'}'",
"]",
"=",
"$",
"val",
";",
"}",
"// interpolate replacement values into the message and return",
"return",
"strtr",
"(",
"$",
"message",
",",
"$",
"replace",
")",
";",
"}"
] | Interpolates context values into the message placeholders | [
"Interpolates",
"context",
"values",
"into",
"the",
"message",
"placeholders"
] | e44678166a1534a8bc4a2e19782190475baacf37 | https://github.com/tekkla/core-logger/blob/e44678166a1534a8bc4a2e19782190475baacf37/Core/Logger/Streams/InterpolateTrait.php#L16-L36 |
5,218 | kael-shipman/php-executables | src/SelectSocketLoop.php | SelectSocketLoop.watchForRead | public function watchForRead($socketObject) : void
{
$rawSocket = $this->getRawSocket($socketObject);
\array_push($this->watchedSockets, $rawSocket);
$this->watchedSocketObjects[$this->getRawSocketKey($rawSocket)] = $socketObject;
} | php | public function watchForRead($socketObject) : void
{
$rawSocket = $this->getRawSocket($socketObject);
\array_push($this->watchedSockets, $rawSocket);
$this->watchedSocketObjects[$this->getRawSocketKey($rawSocket)] = $socketObject;
} | [
"public",
"function",
"watchForRead",
"(",
"$",
"socketObject",
")",
":",
"void",
"{",
"$",
"rawSocket",
"=",
"$",
"this",
"->",
"getRawSocket",
"(",
"$",
"socketObject",
")",
";",
"\\",
"array_push",
"(",
"$",
"this",
"->",
"watchedSockets",
",",
"$",
"rawSocket",
")",
";",
"$",
"this",
"->",
"watchedSocketObjects",
"[",
"$",
"this",
"->",
"getRawSocketKey",
"(",
"$",
"rawSocket",
")",
"]",
"=",
"$",
"socketObject",
";",
"}"
] | Currently only supports watching read events | [
"Currently",
"only",
"supports",
"watching",
"read",
"events"
] | f9b3f2222ced3ce7772673c5f5e84813e7651351 | https://github.com/kael-shipman/php-executables/blob/f9b3f2222ced3ce7772673c5f5e84813e7651351/src/SelectSocketLoop.php#L11-L16 |
5,219 | Innmind/RestBundle | EventListener/RoutingListener.php | RoutingListener.addPrefix | public function addPrefix(RouteEvent $event)
{
$route = $event->getRoute();
$route->setPath($this->prefix . $route->getPath());
} | php | public function addPrefix(RouteEvent $event)
{
$route = $event->getRoute();
$route->setPath($this->prefix . $route->getPath());
} | [
"public",
"function",
"addPrefix",
"(",
"RouteEvent",
"$",
"event",
")",
"{",
"$",
"route",
"=",
"$",
"event",
"->",
"getRoute",
"(",
")",
";",
"$",
"route",
"->",
"setPath",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"route",
"->",
"getPath",
"(",
")",
")",
";",
"}"
] | Add a prefix on each route
@param RouteEvent $event
@return void | [
"Add",
"a",
"prefix",
"on",
"each",
"route"
] | 46de57d9b45dfbfcf98867be3c601fba57f2edc2 | https://github.com/Innmind/RestBundle/blob/46de57d9b45dfbfcf98867be3c601fba57f2edc2/EventListener/RoutingListener.php#L38-L43 |
5,220 | wwtg99/StructureFiles | structure_files/SectionFile/SectionFile.php | SectionFile.getIndexByName | public function getIndexByName($name)
{
foreach ($this->sections as $i => $sec) {
if ($sec instanceof Section) {
if ($sec->getName() == $name) {
return $i;
}
}
}
return -1;
} | php | public function getIndexByName($name)
{
foreach ($this->sections as $i => $sec) {
if ($sec instanceof Section) {
if ($sec->getName() == $name) {
return $i;
}
}
}
return -1;
} | [
"public",
"function",
"getIndexByName",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sections",
"as",
"$",
"i",
"=>",
"$",
"sec",
")",
"{",
"if",
"(",
"$",
"sec",
"instanceof",
"Section",
")",
"{",
"if",
"(",
"$",
"sec",
"->",
"getName",
"(",
")",
"==",
"$",
"name",
")",
"{",
"return",
"$",
"i",
";",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Get section index by section name, -1 for not exists.
@param string $name
@return int | [
"Get",
"section",
"index",
"by",
"section",
"name",
"-",
"1",
"for",
"not",
"exists",
"."
] | 92e83116f9e7161c2d95b531ad03f4e3f1593f33 | https://github.com/wwtg99/StructureFiles/blob/92e83116f9e7161c2d95b531ad03f4e3f1593f33/structure_files/SectionFile/SectionFile.php#L98-L108 |
5,221 | wwtg99/StructureFiles | structure_files/SectionFile/SectionFile.php | SectionFile.getSectionByName | public function getSectionByName($name)
{
foreach ($this->sections as $i => $sec) {
if ($sec instanceof Section) {
if ($sec->getName() == $name) {
return $sec;
}
}
}
return null;
} | php | public function getSectionByName($name)
{
foreach ($this->sections as $i => $sec) {
if ($sec instanceof Section) {
if ($sec->getName() == $name) {
return $sec;
}
}
}
return null;
} | [
"public",
"function",
"getSectionByName",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sections",
"as",
"$",
"i",
"=>",
"$",
"sec",
")",
"{",
"if",
"(",
"$",
"sec",
"instanceof",
"Section",
")",
"{",
"if",
"(",
"$",
"sec",
"->",
"getName",
"(",
")",
"==",
"$",
"name",
")",
"{",
"return",
"$",
"sec",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Get section by section name, null for not exists.
@param string $name
@return Section|null | [
"Get",
"section",
"by",
"section",
"name",
"null",
"for",
"not",
"exists",
"."
] | 92e83116f9e7161c2d95b531ad03f4e3f1593f33 | https://github.com/wwtg99/StructureFiles/blob/92e83116f9e7161c2d95b531ad03f4e3f1593f33/structure_files/SectionFile/SectionFile.php#L116-L126 |
5,222 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/cookie.php | Cookie.set | public static function set($name, $value, $expiration = null, $path = null, $domain = null, $secure = null, $http_only = null)
{
// you can't set cookies in CLi mode
if (\Fuel::$is_cli)
{
return false;
}
$value = \Fuel::value($value);
// use the class defaults for the other parameters if not provided
is_null($expiration) and $expiration = static::$config['expiration'];
is_null($path) and $path = static::$config['path'];
is_null($domain) and $domain = static::$config['domain'];
is_null($secure) and $secure = static::$config['secure'];
is_null($http_only) and $http_only = static::$config['http_only'];
// add the current time so we have an offset
$expiration = $expiration > 0 ? $expiration + time() : 0;
return setcookie($name, $value, $expiration, $path, $domain, $secure, $http_only);
} | php | public static function set($name, $value, $expiration = null, $path = null, $domain = null, $secure = null, $http_only = null)
{
// you can't set cookies in CLi mode
if (\Fuel::$is_cli)
{
return false;
}
$value = \Fuel::value($value);
// use the class defaults for the other parameters if not provided
is_null($expiration) and $expiration = static::$config['expiration'];
is_null($path) and $path = static::$config['path'];
is_null($domain) and $domain = static::$config['domain'];
is_null($secure) and $secure = static::$config['secure'];
is_null($http_only) and $http_only = static::$config['http_only'];
// add the current time so we have an offset
$expiration = $expiration > 0 ? $expiration + time() : 0;
return setcookie($name, $value, $expiration, $path, $domain, $secure, $http_only);
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"expiration",
"=",
"null",
",",
"$",
"path",
"=",
"null",
",",
"$",
"domain",
"=",
"null",
",",
"$",
"secure",
"=",
"null",
",",
"$",
"http_only",
"=",
"null",
")",
"{",
"// you can't set cookies in CLi mode",
"if",
"(",
"\\",
"Fuel",
"::",
"$",
"is_cli",
")",
"{",
"return",
"false",
";",
"}",
"$",
"value",
"=",
"\\",
"Fuel",
"::",
"value",
"(",
"$",
"value",
")",
";",
"// use the class defaults for the other parameters if not provided",
"is_null",
"(",
"$",
"expiration",
")",
"and",
"$",
"expiration",
"=",
"static",
"::",
"$",
"config",
"[",
"'expiration'",
"]",
";",
"is_null",
"(",
"$",
"path",
")",
"and",
"$",
"path",
"=",
"static",
"::",
"$",
"config",
"[",
"'path'",
"]",
";",
"is_null",
"(",
"$",
"domain",
")",
"and",
"$",
"domain",
"=",
"static",
"::",
"$",
"config",
"[",
"'domain'",
"]",
";",
"is_null",
"(",
"$",
"secure",
")",
"and",
"$",
"secure",
"=",
"static",
"::",
"$",
"config",
"[",
"'secure'",
"]",
";",
"is_null",
"(",
"$",
"http_only",
")",
"and",
"$",
"http_only",
"=",
"static",
"::",
"$",
"config",
"[",
"'http_only'",
"]",
";",
"// add the current time so we have an offset",
"$",
"expiration",
"=",
"$",
"expiration",
">",
"0",
"?",
"$",
"expiration",
"+",
"time",
"(",
")",
":",
"0",
";",
"return",
"setcookie",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"expiration",
",",
"$",
"path",
",",
"$",
"domain",
",",
"$",
"secure",
",",
"$",
"http_only",
")",
";",
"}"
] | Sets a signed cookie. Note that all cookie values must be strings and no
automatic serialization will be performed!
// Set the "theme" cookie
Cookie::set('theme', 'red');
@param string name of cookie
@param string value of cookie
@param integer lifetime in seconds
@param string path of the cookie
@param string domain of the cookie
@param boolean if true, the cookie should only be transmitted over a secure HTTPS connection
@param boolean if true, the cookie will be made accessible only through the HTTP protocol
@return boolean | [
"Sets",
"a",
"signed",
"cookie",
".",
"Note",
"that",
"all",
"cookie",
"values",
"must",
"be",
"strings",
"and",
"no",
"automatic",
"serialization",
"will",
"be",
"performed!"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/cookie.php#L81-L102 |
5,223 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/cookie.php | Cookie.delete | public static function delete($name, $path = null, $domain = null, $secure = null, $http_only = null)
{
// Remove the cookie
unset($_COOKIE[$name]);
// Nullify the cookie and make it expire
return static::set($name, null, -86400, $path, $domain, $secure, $http_only);
} | php | public static function delete($name, $path = null, $domain = null, $secure = null, $http_only = null)
{
// Remove the cookie
unset($_COOKIE[$name]);
// Nullify the cookie and make it expire
return static::set($name, null, -86400, $path, $domain, $secure, $http_only);
} | [
"public",
"static",
"function",
"delete",
"(",
"$",
"name",
",",
"$",
"path",
"=",
"null",
",",
"$",
"domain",
"=",
"null",
",",
"$",
"secure",
"=",
"null",
",",
"$",
"http_only",
"=",
"null",
")",
"{",
"// Remove the cookie",
"unset",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
";",
"// Nullify the cookie and make it expire",
"return",
"static",
"::",
"set",
"(",
"$",
"name",
",",
"null",
",",
"-",
"86400",
",",
"$",
"path",
",",
"$",
"domain",
",",
"$",
"secure",
",",
"$",
"http_only",
")",
";",
"}"
] | Deletes a cookie by making the value null and expiring it.
Cookie::delete('theme');
@param string cookie name
@param string path of the cookie
@param string domain of the cookie
@param boolean if true, the cookie should only be transmitted over a secure HTTPS connection
@param boolean if true, the cookie will be made accessible only through the HTTP protocol
@return boolean
@uses static::set | [
"Deletes",
"a",
"cookie",
"by",
"making",
"the",
"value",
"null",
"and",
"expiring",
"it",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/cookie.php#L117-L124 |
5,224 | Arilas/whoops | src/Module.php | Module.prepareException | public function prepareException(MvcEvent $e)
{
if ($e->getRequest() instanceof Request) {
$error = $e->getError();
if (!empty($error) && !$e->getResult() instanceof Response) {
switch ($error) {
case Application::ERROR_CONTROLLER_NOT_FOUND:
case Application::ERROR_CONTROLLER_INVALID:
case Application::ERROR_ROUTER_NO_MATCH:
// Specifically not handling these
return;
case Application::ERROR_EXCEPTION:
default:
/** @var Exception $exception */
$exception = $e->getParam('exception');
// Filter exceptions that we must except
foreach ($this->whoopsConfig['blacklist'] as $except) {
if ($exception instanceof $except) {
return;
}
}
if ($this->whoopsConfig['handler']['options_type'] === 'prettyPage') {
$response = $e->getResponse();
if (!$response || $response->getStatusCode() === 200) {
header('HTTP/1.0 500 Internal Server Error', true, 500);
}
ob_clean();
}
$this->run->handleException($e->getParam('exception'));
break;
}
}
}
} | php | public function prepareException(MvcEvent $e)
{
if ($e->getRequest() instanceof Request) {
$error = $e->getError();
if (!empty($error) && !$e->getResult() instanceof Response) {
switch ($error) {
case Application::ERROR_CONTROLLER_NOT_FOUND:
case Application::ERROR_CONTROLLER_INVALID:
case Application::ERROR_ROUTER_NO_MATCH:
// Specifically not handling these
return;
case Application::ERROR_EXCEPTION:
default:
/** @var Exception $exception */
$exception = $e->getParam('exception');
// Filter exceptions that we must except
foreach ($this->whoopsConfig['blacklist'] as $except) {
if ($exception instanceof $except) {
return;
}
}
if ($this->whoopsConfig['handler']['options_type'] === 'prettyPage') {
$response = $e->getResponse();
if (!$response || $response->getStatusCode() === 200) {
header('HTTP/1.0 500 Internal Server Error', true, 500);
}
ob_clean();
}
$this->run->handleException($e->getParam('exception'));
break;
}
}
}
} | [
"public",
"function",
"prepareException",
"(",
"MvcEvent",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"->",
"getRequest",
"(",
")",
"instanceof",
"Request",
")",
"{",
"$",
"error",
"=",
"$",
"e",
"->",
"getError",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"error",
")",
"&&",
"!",
"$",
"e",
"->",
"getResult",
"(",
")",
"instanceof",
"Response",
")",
"{",
"switch",
"(",
"$",
"error",
")",
"{",
"case",
"Application",
"::",
"ERROR_CONTROLLER_NOT_FOUND",
":",
"case",
"Application",
"::",
"ERROR_CONTROLLER_INVALID",
":",
"case",
"Application",
"::",
"ERROR_ROUTER_NO_MATCH",
":",
"// Specifically not handling these",
"return",
";",
"case",
"Application",
"::",
"ERROR_EXCEPTION",
":",
"default",
":",
"/** @var Exception $exception */",
"$",
"exception",
"=",
"$",
"e",
"->",
"getParam",
"(",
"'exception'",
")",
";",
"// Filter exceptions that we must except",
"foreach",
"(",
"$",
"this",
"->",
"whoopsConfig",
"[",
"'blacklist'",
"]",
"as",
"$",
"except",
")",
"{",
"if",
"(",
"$",
"exception",
"instanceof",
"$",
"except",
")",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"whoopsConfig",
"[",
"'handler'",
"]",
"[",
"'options_type'",
"]",
"===",
"'prettyPage'",
")",
"{",
"$",
"response",
"=",
"$",
"e",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"!",
"$",
"response",
"||",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
"===",
"200",
")",
"{",
"header",
"(",
"'HTTP/1.0 500 Internal Server Error'",
",",
"true",
",",
"500",
")",
";",
"}",
"ob_clean",
"(",
")",
";",
"}",
"$",
"this",
"->",
"run",
"->",
"handleException",
"(",
"$",
"e",
"->",
"getParam",
"(",
"'exception'",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"}"
] | Whoops handle exceptions
@param MvcEvent $e | [
"Whoops",
"handle",
"exceptions"
] | 932f30ba1f345601c4e0045ff82999539fedf77f | https://github.com/Arilas/whoops/blob/932f30ba1f345601c4e0045ff82999539fedf77f/src/Module.php#L89-L125 |
5,225 | bashilbers/domain | src/Aggregates/EventSourced.php | EventSourced.recordThat | public function recordThat(DomainEvent $event)
{
$this->bumpVersion();
if (is_null($this->uncommittedEvents)) {
$this->uncommittedEvents = new UncommittedEvents($this->getIdentity());
}
$this->uncommittedEvents->append($event);
$this->when($event);
return $this;
} | php | public function recordThat(DomainEvent $event)
{
$this->bumpVersion();
if (is_null($this->uncommittedEvents)) {
$this->uncommittedEvents = new UncommittedEvents($this->getIdentity());
}
$this->uncommittedEvents->append($event);
$this->when($event);
return $this;
} | [
"public",
"function",
"recordThat",
"(",
"DomainEvent",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"bumpVersion",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"uncommittedEvents",
")",
")",
"{",
"$",
"this",
"->",
"uncommittedEvents",
"=",
"new",
"UncommittedEvents",
"(",
"$",
"this",
"->",
"getIdentity",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"uncommittedEvents",
"->",
"append",
"(",
"$",
"event",
")",
";",
"$",
"this",
"->",
"when",
"(",
"$",
"event",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Register a event happening on the aggregate
@param DomainEvent $event
@return static | [
"Register",
"a",
"event",
"happening",
"on",
"the",
"aggregate"
] | 864736b8c409077706554b6ac4c574832678d316 | https://github.com/bashilbers/domain/blob/864736b8c409077706554b6ac4c574832678d316/src/Aggregates/EventSourced.php#L59-L71 |
5,226 | phlexible/phlexible | src/Phlexible/Bundle/SearchBundle/Search/SearchResult.php | SearchResult.toArray | public function toArray()
{
return [
'id' => $this->id,
'author' => $this->author,
'title' => $this->title,
'date' => $this->date->format('U'),
'component' => $this->component,
'image' => $this->image,
'handler' => $this->handler,
];
} | php | public function toArray()
{
return [
'id' => $this->id,
'author' => $this->author,
'title' => $this->title,
'date' => $this->date->format('U'),
'component' => $this->component,
'image' => $this->image,
'handler' => $this->handler,
];
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'author'",
"=>",
"$",
"this",
"->",
"author",
",",
"'title'",
"=>",
"$",
"this",
"->",
"title",
",",
"'date'",
"=>",
"$",
"this",
"->",
"date",
"->",
"format",
"(",
"'U'",
")",
",",
"'component'",
"=>",
"$",
"this",
"->",
"component",
",",
"'image'",
"=>",
"$",
"this",
"->",
"image",
",",
"'handler'",
"=>",
"$",
"this",
"->",
"handler",
",",
"]",
";",
"}"
] | Return array repesentation of this search result.
@return array | [
"Return",
"array",
"repesentation",
"of",
"this",
"search",
"result",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/SearchBundle/Search/SearchResult.php#L81-L92 |
5,227 | jlaso/translations-apibundle | Service/ClientSocketService.php | ClientSocketService.send | protected function send($msg)
{
$msg .= PHP_EOL;
return socket_write($this->socket, $msg, strlen($msg));
} | php | protected function send($msg)
{
$msg .= PHP_EOL;
return socket_write($this->socket, $msg, strlen($msg));
} | [
"protected",
"function",
"send",
"(",
"$",
"msg",
")",
"{",
"$",
"msg",
".=",
"PHP_EOL",
";",
"return",
"socket_write",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"msg",
",",
"strlen",
"(",
"$",
"msg",
")",
")",
";",
"}"
] | Atomic send of a string trough the socket
@param $msg
@return int | [
"Atomic",
"send",
"of",
"a",
"string",
"trough",
"the",
"socket"
] | 991a994e2dfeb60c4e8cc78dc119eaf1dca255b5 | https://github.com/jlaso/translations-apibundle/blob/991a994e2dfeb60c4e8cc78dc119eaf1dca255b5/Service/ClientSocketService.php#L150-L155 |
5,228 | jlaso/translations-apibundle | Service/ClientSocketService.php | ClientSocketService.getCatalogIndex | public function getCatalogIndex($projectId = null)
{
return $this->callService($this->url_plan['get_catalog_index'], array(
'project_id' => $projectId ?: $this->project_id,
)
);
} | php | public function getCatalogIndex($projectId = null)
{
return $this->callService($this->url_plan['get_catalog_index'], array(
'project_id' => $projectId ?: $this->project_id,
)
);
} | [
"public",
"function",
"getCatalogIndex",
"(",
"$",
"projectId",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"callService",
"(",
"$",
"this",
"->",
"url_plan",
"[",
"'get_catalog_index'",
"]",
",",
"array",
"(",
"'project_id'",
"=>",
"$",
"projectId",
"?",
":",
"$",
"this",
"->",
"project_id",
",",
")",
")",
";",
"}"
] | Get catalog index
@param $projectId
@return array | [
"Get",
"catalog",
"index"
] | 991a994e2dfeb60c4e8cc78dc119eaf1dca255b5 | https://github.com/jlaso/translations-apibundle/blob/991a994e2dfeb60c4e8cc78dc119eaf1dca255b5/Service/ClientSocketService.php#L312-L318 |
5,229 | extendsframework/extends-command | src/Dispatcher/CommandDispatcher.php | CommandDispatcher.addCommandHandler | public function addCommandHandler(CommandHandlerInterface $commandHandler, string $payloadName): CommandDispatcher
{
$this->commandHandlers[$payloadName] = $commandHandler;
return $this;
} | php | public function addCommandHandler(CommandHandlerInterface $commandHandler, string $payloadName): CommandDispatcher
{
$this->commandHandlers[$payloadName] = $commandHandler;
return $this;
} | [
"public",
"function",
"addCommandHandler",
"(",
"CommandHandlerInterface",
"$",
"commandHandler",
",",
"string",
"$",
"payloadName",
")",
":",
"CommandDispatcher",
"{",
"$",
"this",
"->",
"commandHandlers",
"[",
"$",
"payloadName",
"]",
"=",
"$",
"commandHandler",
";",
"return",
"$",
"this",
";",
"}"
] | Add command handler for payload name.
@param CommandHandlerInterface $commandHandler
@param string $payloadName
@return CommandDispatcher | [
"Add",
"command",
"handler",
"for",
"payload",
"name",
"."
] | 288f8efdd6c6b06466f109878ec82da1d6bda453 | https://github.com/extendsframework/extends-command/blob/288f8efdd6c6b06466f109878ec82da1d6bda453/src/Dispatcher/CommandDispatcher.php#L36-L41 |
5,230 | extendsframework/extends-command | src/Dispatcher/CommandDispatcher.php | CommandDispatcher.getCommandHandler | protected function getCommandHandler(CommandMessageInterface $commandMessage): CommandHandlerInterface
{
$name = $commandMessage->getPayloadType()->getName();
$commandHandlers = $this->getCommandHandlers();
if (array_key_exists($name, $commandHandlers) === false) {
throw new CommandHandlerNotFound($commandMessage);
}
return $commandHandlers[$name];
} | php | protected function getCommandHandler(CommandMessageInterface $commandMessage): CommandHandlerInterface
{
$name = $commandMessage->getPayloadType()->getName();
$commandHandlers = $this->getCommandHandlers();
if (array_key_exists($name, $commandHandlers) === false) {
throw new CommandHandlerNotFound($commandMessage);
}
return $commandHandlers[$name];
} | [
"protected",
"function",
"getCommandHandler",
"(",
"CommandMessageInterface",
"$",
"commandMessage",
")",
":",
"CommandHandlerInterface",
"{",
"$",
"name",
"=",
"$",
"commandMessage",
"->",
"getPayloadType",
"(",
")",
"->",
"getName",
"(",
")",
";",
"$",
"commandHandlers",
"=",
"$",
"this",
"->",
"getCommandHandlers",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"commandHandlers",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"CommandHandlerNotFound",
"(",
"$",
"commandMessage",
")",
";",
"}",
"return",
"$",
"commandHandlers",
"[",
"$",
"name",
"]",
";",
"}"
] | Get command handler for command message.
An exception will be thrown when command handler for command message payload name can not be found.
@param CommandMessageInterface $commandMessage
@return CommandHandlerInterface
@throws CommandDispatcherException | [
"Get",
"command",
"handler",
"for",
"command",
"message",
"."
] | 288f8efdd6c6b06466f109878ec82da1d6bda453 | https://github.com/extendsframework/extends-command/blob/288f8efdd6c6b06466f109878ec82da1d6bda453/src/Dispatcher/CommandDispatcher.php#L52-L61 |
5,231 | yusukezzz/consolet | src/Consolet/Generators/AbstractStubGenerator.php | AbstractStubGenerator.formatStub | protected function formatStub($stub, array $replacement)
{
foreach ($replacement as $src => $dest) {
$stub = str_replace($src, $dest, $stub);
}
return $stub;
} | php | protected function formatStub($stub, array $replacement)
{
foreach ($replacement as $src => $dest) {
$stub = str_replace($src, $dest, $stub);
}
return $stub;
} | [
"protected",
"function",
"formatStub",
"(",
"$",
"stub",
",",
"array",
"$",
"replacement",
")",
"{",
"foreach",
"(",
"$",
"replacement",
"as",
"$",
"src",
"=>",
"$",
"dest",
")",
"{",
"$",
"stub",
"=",
"str_replace",
"(",
"$",
"src",
",",
"$",
"dest",
",",
"$",
"stub",
")",
";",
"}",
"return",
"$",
"stub",
";",
"}"
] | replace stub text
@param string $stub
@param array $replacement
@return string | [
"replace",
"stub",
"text"
] | eceddd0ace37f14c1cf12d793eef265c530924e1 | https://github.com/yusukezzz/consolet/blob/eceddd0ace37f14c1cf12d793eef265c530924e1/src/Consolet/Generators/AbstractStubGenerator.php#L46-L52 |
5,232 | yusukezzz/consolet | src/Consolet/Generators/AbstractStubGenerator.php | AbstractStubGenerator.store | protected function store($stub)
{
$output = $this->getOutputPath();
if ($this->files->exists($output)) {
return false;
}
$this->files->put($output, $stub);
return true;
} | php | protected function store($stub)
{
$output = $this->getOutputPath();
if ($this->files->exists($output)) {
return false;
}
$this->files->put($output, $stub);
return true;
} | [
"protected",
"function",
"store",
"(",
"$",
"stub",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"getOutputPath",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"output",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"files",
"->",
"put",
"(",
"$",
"output",
",",
"$",
"stub",
")",
";",
"return",
"true",
";",
"}"
] | save formatted stub text
@param string $stub
@return bool | [
"save",
"formatted",
"stub",
"text"
] | eceddd0ace37f14c1cf12d793eef265c530924e1 | https://github.com/yusukezzz/consolet/blob/eceddd0ace37f14c1cf12d793eef265c530924e1/src/Consolet/Generators/AbstractStubGenerator.php#L60-L68 |
5,233 | SocietyCMS/Core | Repositories/Eloquent/EloquentSlugRepository.php | EloquentSlugRepository.getSlugForTitle | public function getSlugForTitle($title)
{
$slug = Str::slug($title);
$latestSlug = $this->model->whereRaw("slug RLIKE '^{$slug}(-[0-9]*)?$'")->latest()->value('slug');
if ($latestSlug) {
$pieces = explode('-', $latestSlug);
$number = end($pieces);
return $slug.'-'.($number + 1);
}
return $slug;
} | php | public function getSlugForTitle($title)
{
$slug = Str::slug($title);
$latestSlug = $this->model->whereRaw("slug RLIKE '^{$slug}(-[0-9]*)?$'")->latest()->value('slug');
if ($latestSlug) {
$pieces = explode('-', $latestSlug);
$number = end($pieces);
return $slug.'-'.($number + 1);
}
return $slug;
} | [
"public",
"function",
"getSlugForTitle",
"(",
"$",
"title",
")",
"{",
"$",
"slug",
"=",
"Str",
"::",
"slug",
"(",
"$",
"title",
")",
";",
"$",
"latestSlug",
"=",
"$",
"this",
"->",
"model",
"->",
"whereRaw",
"(",
"\"slug RLIKE '^{$slug}(-[0-9]*)?$'\"",
")",
"->",
"latest",
"(",
")",
"->",
"value",
"(",
"'slug'",
")",
";",
"if",
"(",
"$",
"latestSlug",
")",
"{",
"$",
"pieces",
"=",
"explode",
"(",
"'-'",
",",
"$",
"latestSlug",
")",
";",
"$",
"number",
"=",
"end",
"(",
"$",
"pieces",
")",
";",
"return",
"$",
"slug",
".",
"'-'",
".",
"(",
"$",
"number",
"+",
"1",
")",
";",
"}",
"return",
"$",
"slug",
";",
"}"
] | Generate a unique Slug for a given Title.
@param string $title
@return object | [
"Generate",
"a",
"unique",
"Slug",
"for",
"a",
"given",
"Title",
"."
] | fb6be1b1dd46c89a976c02feb998e9af01ddca54 | https://github.com/SocietyCMS/Core/blob/fb6be1b1dd46c89a976c02feb998e9af01ddca54/Repositories/Eloquent/EloquentSlugRepository.php#L66-L79 |
5,234 | webriq/core | module/Customize/src/Grid/Customize/Model/Extra/Model.php | Model.findByRoot | public function findByRoot( $rootParagraphId )
{
$root = ( (int) $rootParagraphId ) ?: null;
$extra = $this->getMapper()
->findByRoot( $root );
if ( empty( $extra ) )
{
$extra = $this->getMapper()
->create( array(
'rootParagraphId' => $root,
) );
}
return $extra;
} | php | public function findByRoot( $rootParagraphId )
{
$root = ( (int) $rootParagraphId ) ?: null;
$extra = $this->getMapper()
->findByRoot( $root );
if ( empty( $extra ) )
{
$extra = $this->getMapper()
->create( array(
'rootParagraphId' => $root,
) );
}
return $extra;
} | [
"public",
"function",
"findByRoot",
"(",
"$",
"rootParagraphId",
")",
"{",
"$",
"root",
"=",
"(",
"(",
"int",
")",
"$",
"rootParagraphId",
")",
"?",
":",
"null",
";",
"$",
"extra",
"=",
"$",
"this",
"->",
"getMapper",
"(",
")",
"->",
"findByRoot",
"(",
"$",
"root",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"extra",
")",
")",
"{",
"$",
"extra",
"=",
"$",
"this",
"->",
"getMapper",
"(",
")",
"->",
"create",
"(",
"array",
"(",
"'rootParagraphId'",
"=>",
"$",
"root",
",",
")",
")",
";",
"}",
"return",
"$",
"extra",
";",
"}"
] | Get customize extra by selector & media
@param int|null $rootParagraphId
@return \Customize\Model\Extra\Structure | [
"Get",
"customize",
"extra",
"by",
"selector",
"&",
"media"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Customize/src/Grid/Customize/Model/Extra/Model.php#L58-L73 |
5,235 | loevgaard/dandomain-foundation-bundle | Synchronizer/Synchronizer.php | Synchronizer.getMemoryLimit | protected function getMemoryLimit(): ?int
{
$short = [
'k' => 1024,
'm' => 1048576,
'g' => 1073741824,
];
$setting = (string) ini_get('memory_limit');
if (!($len = strlen($setting))) {
return null;
}
$last = strtolower($setting[$len - 1]);
$numeric = (int) $setting;
$numeric *= isset($short[$last]) ? $short[$last] : 1;
return $numeric;
} | php | protected function getMemoryLimit(): ?int
{
$short = [
'k' => 1024,
'm' => 1048576,
'g' => 1073741824,
];
$setting = (string) ini_get('memory_limit');
if (!($len = strlen($setting))) {
return null;
}
$last = strtolower($setting[$len - 1]);
$numeric = (int) $setting;
$numeric *= isset($short[$last]) ? $short[$last] : 1;
return $numeric;
} | [
"protected",
"function",
"getMemoryLimit",
"(",
")",
":",
"?",
"int",
"{",
"$",
"short",
"=",
"[",
"'k'",
"=>",
"1024",
",",
"'m'",
"=>",
"1048576",
",",
"'g'",
"=>",
"1073741824",
",",
"]",
";",
"$",
"setting",
"=",
"(",
"string",
")",
"ini_get",
"(",
"'memory_limit'",
")",
";",
"if",
"(",
"!",
"(",
"$",
"len",
"=",
"strlen",
"(",
"$",
"setting",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"last",
"=",
"strtolower",
"(",
"$",
"setting",
"[",
"$",
"len",
"-",
"1",
"]",
")",
";",
"$",
"numeric",
"=",
"(",
"int",
")",
"$",
"setting",
";",
"$",
"numeric",
"*=",
"isset",
"(",
"$",
"short",
"[",
"$",
"last",
"]",
")",
"?",
"$",
"short",
"[",
"$",
"last",
"]",
":",
"1",
";",
"return",
"$",
"numeric",
";",
"}"
] | Returns the memory limit in bytes.
@return int | [
"Returns",
"the",
"memory",
"limit",
"in",
"bytes",
"."
] | f3658aadf499d03f88465aa0b144626866c57b84 | https://github.com/loevgaard/dandomain-foundation-bundle/blob/f3658aadf499d03f88465aa0b144626866c57b84/Synchronizer/Synchronizer.php#L153-L172 |
5,236 | ilya-dev/exo | source/Exo/Commands/BuildCommand.php | BuildCommand.build | protected function build($in, $out)
{
$workDir = getenv('WORK_DIR').'/';
$content = $this->filesystem->read($workDir.$in);
$document = $this->builder->build($content);
$this->filesystem->overwrite($workDir.$out, $document);
} | php | protected function build($in, $out)
{
$workDir = getenv('WORK_DIR').'/';
$content = $this->filesystem->read($workDir.$in);
$document = $this->builder->build($content);
$this->filesystem->overwrite($workDir.$out, $document);
} | [
"protected",
"function",
"build",
"(",
"$",
"in",
",",
"$",
"out",
")",
"{",
"$",
"workDir",
"=",
"getenv",
"(",
"'WORK_DIR'",
")",
".",
"'/'",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"read",
"(",
"$",
"workDir",
".",
"$",
"in",
")",
";",
"$",
"document",
"=",
"$",
"this",
"->",
"builder",
"->",
"build",
"(",
"$",
"content",
")",
";",
"$",
"this",
"->",
"filesystem",
"->",
"overwrite",
"(",
"$",
"workDir",
".",
"$",
"out",
",",
"$",
"document",
")",
";",
"}"
] | Build a Markdown document.
@param string $in
@param string $out
@return void | [
"Build",
"a",
"Markdown",
"document",
"."
] | 89960a0116513c3172f107041bc9b9fa80ba8e54 | https://github.com/ilya-dev/exo/blob/89960a0116513c3172f107041bc9b9fa80ba8e54/source/Exo/Commands/BuildCommand.php#L65-L74 |
5,237 | interactivesolutions/honeycomb-acl | src/app/http/middleware/HCACLAdminMenu.php | HCACLAdminMenu.buildMenuWithoutExistingParent | private function buildMenuWithoutExistingParent($menuAccessible)
{
$withoutParent = collect($this->itemsWithoutParent)->unique('route')->all();
foreach ( $withoutParent as &$item ) {
$children = $this->buildMenuTree($menuAccessible, $item['route']);
if( $children ) {
$item['children'] = $children;
}
}
return $withoutParent;
} | php | private function buildMenuWithoutExistingParent($menuAccessible)
{
$withoutParent = collect($this->itemsWithoutParent)->unique('route')->all();
foreach ( $withoutParent as &$item ) {
$children = $this->buildMenuTree($menuAccessible, $item['route']);
if( $children ) {
$item['children'] = $children;
}
}
return $withoutParent;
} | [
"private",
"function",
"buildMenuWithoutExistingParent",
"(",
"$",
"menuAccessible",
")",
"{",
"$",
"withoutParent",
"=",
"collect",
"(",
"$",
"this",
"->",
"itemsWithoutParent",
")",
"->",
"unique",
"(",
"'route'",
")",
"->",
"all",
"(",
")",
";",
"foreach",
"(",
"$",
"withoutParent",
"as",
"&",
"$",
"item",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"buildMenuTree",
"(",
"$",
"menuAccessible",
",",
"$",
"item",
"[",
"'route'",
"]",
")",
";",
"if",
"(",
"$",
"children",
")",
"{",
"$",
"item",
"[",
"'children'",
"]",
"=",
"$",
"children",
";",
"}",
"}",
"return",
"$",
"withoutParent",
";",
"}"
] | Add child menu items to their parents. Only two levels
@param $menuAccessible
@return array | [
"Add",
"child",
"menu",
"items",
"to",
"their",
"parents",
".",
"Only",
"two",
"levels"
] | 6c73d7d1c5d17ef730593e03386236a746bab12c | https://github.com/interactivesolutions/honeycomb-acl/blob/6c73d7d1c5d17ef730593e03386236a746bab12c/src/app/http/middleware/HCACLAdminMenu.php#L168-L181 |
5,238 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.init | protected function init(){
//Carga las dependencias en base a la lista de archivos definidos en configuracion global
$this->dependencies= array();
foreach ($this->context->getDependenciesFile() as $nameFile) {
$this->dependencies= array_merge($this->dependencies, $this->context->readConfigurationFile($nameFile));
}
//Define las dependencias que se cargan segun Type
$this->loadDependencies= array();
foreach ($this->dependencies as $key => $value) {
if(isset($value['load_in'])){
$this->loadDependencies[$key]= $value;
}
}
} | php | protected function init(){
//Carga las dependencias en base a la lista de archivos definidos en configuracion global
$this->dependencies= array();
foreach ($this->context->getDependenciesFile() as $nameFile) {
$this->dependencies= array_merge($this->dependencies, $this->context->readConfigurationFile($nameFile));
}
//Define las dependencias que se cargan segun Type
$this->loadDependencies= array();
foreach ($this->dependencies as $key => $value) {
if(isset($value['load_in'])){
$this->loadDependencies[$key]= $value;
}
}
} | [
"protected",
"function",
"init",
"(",
")",
"{",
"//Carga las dependencias en base a la lista de archivos definidos en configuracion global",
"$",
"this",
"->",
"dependencies",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"context",
"->",
"getDependenciesFile",
"(",
")",
"as",
"$",
"nameFile",
")",
"{",
"$",
"this",
"->",
"dependencies",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"dependencies",
",",
"$",
"this",
"->",
"context",
"->",
"readConfigurationFile",
"(",
"$",
"nameFile",
")",
")",
";",
"}",
"//Define las dependencias que se cargan segun Type",
"$",
"this",
"->",
"loadDependencies",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"dependencies",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'load_in'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"loadDependencies",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"}"
] | Realiza lar carga inicial | [
"Realiza",
"lar",
"carga",
"inicial"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L29-L42 |
5,239 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.injectDependenciesOfType | public function injectDependenciesOfType($object, $type){
//Analiza las dependencies que tienen seteado "load_in"
foreach ($this->loadDependencies as $name => $dependency) {
$types= explode(",", $dependency['load_in']);
//Si la libreria contiene el tipo se carga
if(in_array($type, $types)){
$this->loadDependencyInObject($object, $name, $name, $dependency);
}
}
} | php | public function injectDependenciesOfType($object, $type){
//Analiza las dependencies que tienen seteado "load_in"
foreach ($this->loadDependencies as $name => $dependency) {
$types= explode(",", $dependency['load_in']);
//Si la libreria contiene el tipo se carga
if(in_array($type, $types)){
$this->loadDependencyInObject($object, $name, $name, $dependency);
}
}
} | [
"public",
"function",
"injectDependenciesOfType",
"(",
"$",
"object",
",",
"$",
"type",
")",
"{",
"//Analiza las dependencies que tienen seteado \"load_in\"",
"foreach",
"(",
"$",
"this",
"->",
"loadDependencies",
"as",
"$",
"name",
"=>",
"$",
"dependency",
")",
"{",
"$",
"types",
"=",
"explode",
"(",
"\",\"",
",",
"$",
"dependency",
"[",
"'load_in'",
"]",
")",
";",
"//Si la libreria contiene el tipo se carga",
"if",
"(",
"in_array",
"(",
"$",
"type",
",",
"$",
"types",
")",
")",
"{",
"$",
"this",
"->",
"loadDependencyInObject",
"(",
"$",
"object",
",",
"$",
"name",
",",
"$",
"name",
",",
"$",
"dependency",
")",
";",
"}",
"}",
"}"
] | Recorre las dependencias con load_in y analiza si carga o no una instancia de la dependencia en el objeto.
Las nombres de las propiedades son las claves en la definicion de cada dependencia
Es llamado por GenericLoader en su construccion para inyectar las clases correspondientes.
Esta funcion supone que las Clases de la dependencia ya se encuentran importadas.
@param type $object
@param string $type | [
"Recorre",
"las",
"dependencias",
"con",
"load_in",
"y",
"analiza",
"si",
"carga",
"o",
"no",
"una",
"instancia",
"de",
"la",
"dependencia",
"en",
"el",
"objeto",
".",
"Las",
"nombres",
"de",
"las",
"propiedades",
"son",
"las",
"claves",
"en",
"la",
"definicion",
"de",
"cada",
"dependencia",
"Es",
"llamado",
"por",
"GenericLoader",
"en",
"su",
"construccion",
"para",
"inyectar",
"las",
"clases",
"correspondientes",
".",
"Esta",
"funcion",
"supone",
"que",
"las",
"Clases",
"de",
"la",
"dependencia",
"ya",
"se",
"encuentran",
"importadas",
"."
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L51-L60 |
5,240 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.injectDependencies | public function injectDependencies($object, array $dependencies){
$dependenciesDefinition= $this->dependencies;
//Recorre las dependencias indicadas y las que existe las carga
foreach ($dependencies as $property => $dependencyName) {
if(isset($dependenciesDefinition[$dependencyName])){
$dependency= $dependenciesDefinition[$dependencyName];
$this->loadDependencyInObject($object, $property, $dependencyName, $dependency);
}
}
} | php | public function injectDependencies($object, array $dependencies){
$dependenciesDefinition= $this->dependencies;
//Recorre las dependencias indicadas y las que existe las carga
foreach ($dependencies as $property => $dependencyName) {
if(isset($dependenciesDefinition[$dependencyName])){
$dependency= $dependenciesDefinition[$dependencyName];
$this->loadDependencyInObject($object, $property, $dependencyName, $dependency);
}
}
} | [
"public",
"function",
"injectDependencies",
"(",
"$",
"object",
",",
"array",
"$",
"dependencies",
")",
"{",
"$",
"dependenciesDefinition",
"=",
"$",
"this",
"->",
"dependencies",
";",
"//Recorre las dependencias indicadas y las que existe las carga",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"property",
"=>",
"$",
"dependencyName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"dependenciesDefinition",
"[",
"$",
"dependencyName",
"]",
")",
")",
"{",
"$",
"dependency",
"=",
"$",
"dependenciesDefinition",
"[",
"$",
"dependencyName",
"]",
";",
"$",
"this",
"->",
"loadDependencyInObject",
"(",
"$",
"object",
",",
"$",
"property",
",",
"$",
"dependencyName",
",",
"$",
"dependency",
")",
";",
"}",
"}",
"}"
] | Carga cada una de las dependencias indicadas en su correspondiente propiedad del objeto
Esta funcion supone que las Clases de las dependencias ya se encuentran importadas.
@param type $object
@param array $dependencies | [
"Carga",
"cada",
"una",
"de",
"las",
"dependencias",
"indicadas",
"en",
"su",
"correspondiente",
"propiedad",
"del",
"objeto",
"Esta",
"funcion",
"supone",
"que",
"las",
"Clases",
"de",
"las",
"dependencias",
"ya",
"se",
"encuentran",
"importadas",
"."
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L67-L76 |
5,241 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.getDependencyInstance | public function getDependencyInstance($dependencyName){
if(isset($this->dependencies[$dependencyName])){
return $this->loadDependency($dependencyName, $this->dependencies[$dependencyName]);
}
return null;
} | php | public function getDependencyInstance($dependencyName){
if(isset($this->dependencies[$dependencyName])){
return $this->loadDependency($dependencyName, $this->dependencies[$dependencyName]);
}
return null;
} | [
"public",
"function",
"getDependencyInstance",
"(",
"$",
"dependencyName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"dependencies",
"[",
"$",
"dependencyName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"loadDependency",
"(",
"$",
"dependencyName",
",",
"$",
"this",
"->",
"dependencies",
"[",
"$",
"dependencyName",
"]",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Retorna una dependencia instanciada
En este caso la dependencia no se injecta a ningun objeto
@param string $dependencyName
@return mixed | [
"Retorna",
"una",
"dependencia",
"instanciada",
"En",
"este",
"caso",
"la",
"dependencia",
"no",
"se",
"injecta",
"a",
"ningun",
"objeto"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L93-L98 |
5,242 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.injectProperties | public function injectProperties($object, $propertiesDefinition){
$properties= $this->parseProperties($propertiesDefinition);
$reflection= new Reflection($object);
$reflection->setProperties($properties, TRUE);
} | php | public function injectProperties($object, $propertiesDefinition){
$properties= $this->parseProperties($propertiesDefinition);
$reflection= new Reflection($object);
$reflection->setProperties($properties, TRUE);
} | [
"public",
"function",
"injectProperties",
"(",
"$",
"object",
",",
"$",
"propertiesDefinition",
")",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"parseProperties",
"(",
"$",
"propertiesDefinition",
")",
";",
"$",
"reflection",
"=",
"new",
"Reflection",
"(",
"$",
"object",
")",
";",
"$",
"reflection",
"->",
"setProperties",
"(",
"$",
"properties",
",",
"TRUE",
")",
";",
"}"
] | Injecta definicion de propiedades a una instancia
@param type $object
@param array $propertiesDefinition | [
"Injecta",
"definicion",
"de",
"propiedades",
"a",
"una",
"instancia"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L104-L108 |
5,243 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.loadDependencyInObject | protected function loadDependencyInObject($object, $property, $dependencyName, $dependencyDefinition){
$dependency= $this->loadDependency($dependencyName, $dependencyDefinition);
$reflection= new Reflection($object);
$reflection->setProperty($property, $dependency, TRUE);
} | php | protected function loadDependencyInObject($object, $property, $dependencyName, $dependencyDefinition){
$dependency= $this->loadDependency($dependencyName, $dependencyDefinition);
$reflection= new Reflection($object);
$reflection->setProperty($property, $dependency, TRUE);
} | [
"protected",
"function",
"loadDependencyInObject",
"(",
"$",
"object",
",",
"$",
"property",
",",
"$",
"dependencyName",
",",
"$",
"dependencyDefinition",
")",
"{",
"$",
"dependency",
"=",
"$",
"this",
"->",
"loadDependency",
"(",
"$",
"dependencyName",
",",
"$",
"dependencyDefinition",
")",
";",
"$",
"reflection",
"=",
"new",
"Reflection",
"(",
"$",
"object",
")",
";",
"$",
"reflection",
"->",
"setProperty",
"(",
"$",
"property",
",",
"$",
"dependency",
",",
"TRUE",
")",
";",
"}"
] | Carga la dependencia y la setea en la propiedad del objeto a inyectar
@param type $object
@param string $property
@param string $dependencyName
@param array $dependencyDefinition | [
"Carga",
"la",
"dependencia",
"y",
"la",
"setea",
"en",
"la",
"propiedad",
"del",
"objeto",
"a",
"inyectar"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L116-L120 |
5,244 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.loadDependency | protected function loadDependency($name, $dependencyDefinition, &$loadedDependencies = array()){
$newInstance= NULL;
//Si es singleton analiza si existe y si puede devuelve la msima
if(isset($this->singletons[$name])){
$newInstance= $this->singletons[$name];
}else{
//Veo si tiene namespace y si tiene le agrego el mismo
$namespace= (isset($dependencyDefinition['namespace']) ? $dependencyDefinition['namespace'] : '');
$dir= explode("/", $dependencyDefinition['class']);
$class= $dir[count($dir) - 1];
if($namespace != ''){ $class= "\\" . $namespace . "\\" . $class;}
$newInstance= NULL;
if(isset($dependencyDefinition['factory-method'])){
$factoryMethod= $dependencyDefinition['factory-method'];
if(isset($dependencyDefinition['factory-bean'])){
$factoryBean= $this->getDependency($dependencyDefinition['factory-bean'], $loadedDependencies);
$newInstance= $factoryBean->$factoryMethod();
}else{
$newInstance= $class::$factoryMethod();
}
}else{
//Consigo los parametros del constructor
$params= array();
if(isset($dependencyDefinition['construct'])){
//Parseo los parametros correctamente
$params= $this->parseProperties($dependencyDefinition['construct']);
}
//Creo una instancia con el constructor correspondiente en base a los parametros
$reflection= new \ReflectionClass($class);
$newInstance= $reflection->newInstanceArgs($params);
//La agrego a loadedDependencies para dependencias circulares
$loadedDependencies[$name]= $newInstance;
}
//Si es un singleton la guardo como tal
if(isset($dependencyDefinition['singleton']) && ($dependencyDefinition['singleton'] == "TRUE" || $dependencyDefinition['singleton'] == "true")){
$this->singletons[$name]= $newInstance;
}
//Injecto las dependencias a las propiedades
//Primero veo si hay Referencia a otras dependencias y cargo las mismas y luego guardo las propiedades
if(isset($dependencyDefinition['properties'])){
$properties= $this->parseProperties($dependencyDefinition['properties'], $loadedDependencies);
$reflection= new Reflection($newInstance);
$reflection->setProperties($properties, TRUE);
}
}
return $newInstance;
} | php | protected function loadDependency($name, $dependencyDefinition, &$loadedDependencies = array()){
$newInstance= NULL;
//Si es singleton analiza si existe y si puede devuelve la msima
if(isset($this->singletons[$name])){
$newInstance= $this->singletons[$name];
}else{
//Veo si tiene namespace y si tiene le agrego el mismo
$namespace= (isset($dependencyDefinition['namespace']) ? $dependencyDefinition['namespace'] : '');
$dir= explode("/", $dependencyDefinition['class']);
$class= $dir[count($dir) - 1];
if($namespace != ''){ $class= "\\" . $namespace . "\\" . $class;}
$newInstance= NULL;
if(isset($dependencyDefinition['factory-method'])){
$factoryMethod= $dependencyDefinition['factory-method'];
if(isset($dependencyDefinition['factory-bean'])){
$factoryBean= $this->getDependency($dependencyDefinition['factory-bean'], $loadedDependencies);
$newInstance= $factoryBean->$factoryMethod();
}else{
$newInstance= $class::$factoryMethod();
}
}else{
//Consigo los parametros del constructor
$params= array();
if(isset($dependencyDefinition['construct'])){
//Parseo los parametros correctamente
$params= $this->parseProperties($dependencyDefinition['construct']);
}
//Creo una instancia con el constructor correspondiente en base a los parametros
$reflection= new \ReflectionClass($class);
$newInstance= $reflection->newInstanceArgs($params);
//La agrego a loadedDependencies para dependencias circulares
$loadedDependencies[$name]= $newInstance;
}
//Si es un singleton la guardo como tal
if(isset($dependencyDefinition['singleton']) && ($dependencyDefinition['singleton'] == "TRUE" || $dependencyDefinition['singleton'] == "true")){
$this->singletons[$name]= $newInstance;
}
//Injecto las dependencias a las propiedades
//Primero veo si hay Referencia a otras dependencias y cargo las mismas y luego guardo las propiedades
if(isset($dependencyDefinition['properties'])){
$properties= $this->parseProperties($dependencyDefinition['properties'], $loadedDependencies);
$reflection= new Reflection($newInstance);
$reflection->setProperties($properties, TRUE);
}
}
return $newInstance;
} | [
"protected",
"function",
"loadDependency",
"(",
"$",
"name",
",",
"$",
"dependencyDefinition",
",",
"&",
"$",
"loadedDependencies",
"=",
"array",
"(",
")",
")",
"{",
"$",
"newInstance",
"=",
"NULL",
";",
"//Si es singleton analiza si existe y si puede devuelve la msima",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"singletons",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"newInstance",
"=",
"$",
"this",
"->",
"singletons",
"[",
"$",
"name",
"]",
";",
"}",
"else",
"{",
"//Veo si tiene namespace y si tiene le agrego el mismo",
"$",
"namespace",
"=",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'namespace'",
"]",
")",
"?",
"$",
"dependencyDefinition",
"[",
"'namespace'",
"]",
":",
"''",
")",
";",
"$",
"dir",
"=",
"explode",
"(",
"\"/\"",
",",
"$",
"dependencyDefinition",
"[",
"'class'",
"]",
")",
";",
"$",
"class",
"=",
"$",
"dir",
"[",
"count",
"(",
"$",
"dir",
")",
"-",
"1",
"]",
";",
"if",
"(",
"$",
"namespace",
"!=",
"''",
")",
"{",
"$",
"class",
"=",
"\"\\\\\"",
".",
"$",
"namespace",
".",
"\"\\\\\"",
".",
"$",
"class",
";",
"}",
"$",
"newInstance",
"=",
"NULL",
";",
"if",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'factory-method'",
"]",
")",
")",
"{",
"$",
"factoryMethod",
"=",
"$",
"dependencyDefinition",
"[",
"'factory-method'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'factory-bean'",
"]",
")",
")",
"{",
"$",
"factoryBean",
"=",
"$",
"this",
"->",
"getDependency",
"(",
"$",
"dependencyDefinition",
"[",
"'factory-bean'",
"]",
",",
"$",
"loadedDependencies",
")",
";",
"$",
"newInstance",
"=",
"$",
"factoryBean",
"->",
"$",
"factoryMethod",
"(",
")",
";",
"}",
"else",
"{",
"$",
"newInstance",
"=",
"$",
"class",
"::",
"$",
"factoryMethod",
"(",
")",
";",
"}",
"}",
"else",
"{",
"//Consigo los parametros del constructor",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'construct'",
"]",
")",
")",
"{",
"//Parseo los parametros correctamente",
"$",
"params",
"=",
"$",
"this",
"->",
"parseProperties",
"(",
"$",
"dependencyDefinition",
"[",
"'construct'",
"]",
")",
";",
"}",
"//Creo una instancia con el constructor correspondiente en base a los parametros",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"newInstance",
"=",
"$",
"reflection",
"->",
"newInstanceArgs",
"(",
"$",
"params",
")",
";",
"//La agrego a loadedDependencies para dependencias circulares",
"$",
"loadedDependencies",
"[",
"$",
"name",
"]",
"=",
"$",
"newInstance",
";",
"}",
"//Si es un singleton la guardo como tal",
"if",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'singleton'",
"]",
")",
"&&",
"(",
"$",
"dependencyDefinition",
"[",
"'singleton'",
"]",
"==",
"\"TRUE\"",
"||",
"$",
"dependencyDefinition",
"[",
"'singleton'",
"]",
"==",
"\"true\"",
")",
")",
"{",
"$",
"this",
"->",
"singletons",
"[",
"$",
"name",
"]",
"=",
"$",
"newInstance",
";",
"}",
"//Injecto las dependencias a las propiedades",
"//Primero veo si hay Referencia a otras dependencias y cargo las mismas y luego guardo las propiedades",
"if",
"(",
"isset",
"(",
"$",
"dependencyDefinition",
"[",
"'properties'",
"]",
")",
")",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"parseProperties",
"(",
"$",
"dependencyDefinition",
"[",
"'properties'",
"]",
",",
"$",
"loadedDependencies",
")",
";",
"$",
"reflection",
"=",
"new",
"Reflection",
"(",
"$",
"newInstance",
")",
";",
"$",
"reflection",
"->",
"setProperties",
"(",
"$",
"properties",
",",
"TRUE",
")",
";",
"}",
"}",
"return",
"$",
"newInstance",
";",
"}"
] | Realiza la carga de una dependencia que luego va a ser inyectada
@param string $name
@param array $dependencyDefinition
@param array &$loadedDependencies
@return type | [
"Realiza",
"la",
"carga",
"de",
"una",
"dependencia",
"que",
"luego",
"va",
"a",
"ser",
"inyectada"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L128-L177 |
5,245 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.parseProperties | protected function parseProperties($propertiesDefinition, &$loadedDependencies = array()){
$parseProperties= array();
foreach ($propertiesDefinition as $key => $definition) {
$property= NULL;
if(isset($definition['ref'])){
//Conseguimos la dependencia
$property= $this->getDependency($definition['ref'], $loadedDependencies);
}else{
//Casteo el valor al tipo indicado
$property= $definition['value'];
if($definition['value'] != 'array'){
settype($property, $definition['type']);
}
}
$parseProperties[$key]= $property;
}
return $parseProperties;
} | php | protected function parseProperties($propertiesDefinition, &$loadedDependencies = array()){
$parseProperties= array();
foreach ($propertiesDefinition as $key => $definition) {
$property= NULL;
if(isset($definition['ref'])){
//Conseguimos la dependencia
$property= $this->getDependency($definition['ref'], $loadedDependencies);
}else{
//Casteo el valor al tipo indicado
$property= $definition['value'];
if($definition['value'] != 'array'){
settype($property, $definition['type']);
}
}
$parseProperties[$key]= $property;
}
return $parseProperties;
} | [
"protected",
"function",
"parseProperties",
"(",
"$",
"propertiesDefinition",
",",
"&",
"$",
"loadedDependencies",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parseProperties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"propertiesDefinition",
"as",
"$",
"key",
"=>",
"$",
"definition",
")",
"{",
"$",
"property",
"=",
"NULL",
";",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'ref'",
"]",
")",
")",
"{",
"//Conseguimos la dependencia",
"$",
"property",
"=",
"$",
"this",
"->",
"getDependency",
"(",
"$",
"definition",
"[",
"'ref'",
"]",
",",
"$",
"loadedDependencies",
")",
";",
"}",
"else",
"{",
"//Casteo el valor al tipo indicado",
"$",
"property",
"=",
"$",
"definition",
"[",
"'value'",
"]",
";",
"if",
"(",
"$",
"definition",
"[",
"'value'",
"]",
"!=",
"'array'",
")",
"{",
"settype",
"(",
"$",
"property",
",",
"$",
"definition",
"[",
"'type'",
"]",
")",
";",
"}",
"}",
"$",
"parseProperties",
"[",
"$",
"key",
"]",
"=",
"$",
"property",
";",
"}",
"return",
"$",
"parseProperties",
";",
"}"
] | Parsea los valores en string al tipo que corresponda segun el valor y el tipo definido.
@param array $propertiesDefinition
@param array &$loadedDependencies
@return array | [
"Parsea",
"los",
"valores",
"en",
"string",
"al",
"tipo",
"que",
"corresponda",
"segun",
"el",
"valor",
"y",
"el",
"tipo",
"definido",
"."
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L184-L201 |
5,246 | edunola13/core-modules | src/DependencyEngine/DependenciesEngine.php | DependenciesEngine.getDependency | protected function getDependency($name, &$loadedDependencies = array()){
$dependency= NULL;
$dependencies= $this->dependencies;
if(isset($dependencies[$name])){
//Si la dependencia ya fue cargada anteriormente de forma circular se usa la misma, si no se carga y se
//guarda en la lista de dependencias cargadas en la iteracion
if(isset($loadedDependencies[$name])){
$dependency= $loadedDependencies[$name];
}else{
$dependency= $this->loadDependency($name, $dependencies[$name], $loadedDependencies);
}
}
return $dependency;
} | php | protected function getDependency($name, &$loadedDependencies = array()){
$dependency= NULL;
$dependencies= $this->dependencies;
if(isset($dependencies[$name])){
//Si la dependencia ya fue cargada anteriormente de forma circular se usa la misma, si no se carga y se
//guarda en la lista de dependencias cargadas en la iteracion
if(isset($loadedDependencies[$name])){
$dependency= $loadedDependencies[$name];
}else{
$dependency= $this->loadDependency($name, $dependencies[$name], $loadedDependencies);
}
}
return $dependency;
} | [
"protected",
"function",
"getDependency",
"(",
"$",
"name",
",",
"&",
"$",
"loadedDependencies",
"=",
"array",
"(",
")",
")",
"{",
"$",
"dependency",
"=",
"NULL",
";",
"$",
"dependencies",
"=",
"$",
"this",
"->",
"dependencies",
";",
"if",
"(",
"isset",
"(",
"$",
"dependencies",
"[",
"$",
"name",
"]",
")",
")",
"{",
"//Si la dependencia ya fue cargada anteriormente de forma circular se usa la misma, si no se carga y se ",
"//guarda en la lista de dependencias cargadas en la iteracion",
"if",
"(",
"isset",
"(",
"$",
"loadedDependencies",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"dependency",
"=",
"$",
"loadedDependencies",
"[",
"$",
"name",
"]",
";",
"}",
"else",
"{",
"$",
"dependency",
"=",
"$",
"this",
"->",
"loadDependency",
"(",
"$",
"name",
",",
"$",
"dependencies",
"[",
"$",
"name",
"]",
",",
"$",
"loadedDependencies",
")",
";",
"}",
"}",
"return",
"$",
"dependency",
";",
"}"
] | Devuelve la dependencia en base a un nombre y una lista de dependencias.
Si no existe devuelve NULL
@param type $name
@param array &$loadedDependencies
@return Object o NULL | [
"Devuelve",
"la",
"dependencia",
"en",
"base",
"a",
"un",
"nombre",
"y",
"una",
"lista",
"de",
"dependencias",
".",
"Si",
"no",
"existe",
"devuelve",
"NULL"
] | 2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364 | https://github.com/edunola13/core-modules/blob/2a2e9b89bb61cc28e548412e1d6c9bbb44bc5364/src/DependencyEngine/DependenciesEngine.php#L209-L222 |
5,247 | SergioMadness/framework | framework/basic/View.php | View.render | public function render($viewPath, array $params = [])
{
ob_start();
ob_implicit_flush(false);
$this->params = $params;
extract(array_merge($params, $this->getBlocks()), EXTR_OVERWRITE);
require(file_exists($viewPath) ? $viewPath : '../'.$viewPath);
return ob_get_clean();
} | php | public function render($viewPath, array $params = [])
{
ob_start();
ob_implicit_flush(false);
$this->params = $params;
extract(array_merge($params, $this->getBlocks()), EXTR_OVERWRITE);
require(file_exists($viewPath) ? $viewPath : '../'.$viewPath);
return ob_get_clean();
} | [
"public",
"function",
"render",
"(",
"$",
"viewPath",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"ob_start",
"(",
")",
";",
"ob_implicit_flush",
"(",
"false",
")",
";",
"$",
"this",
"->",
"params",
"=",
"$",
"params",
";",
"extract",
"(",
"array_merge",
"(",
"$",
"params",
",",
"$",
"this",
"->",
"getBlocks",
"(",
")",
")",
",",
"EXTR_OVERWRITE",
")",
";",
"require",
"(",
"file_exists",
"(",
"$",
"viewPath",
")",
"?",
"$",
"viewPath",
":",
"'../'",
".",
"$",
"viewPath",
")",
";",
"return",
"ob_get_clean",
"(",
")",
";",
"}"
] | Render view file
@param string $viewPath
@param array $params
@return mixed | [
"Render",
"view",
"file"
] | a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e | https://github.com/SergioMadness/framework/blob/a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e/framework/basic/View.php#L59-L68 |
5,248 | SergioMadness/framework | framework/basic/View.php | View.content | public function content($parentView = null)
{
if ($parentView === null) {
$content = ob_get_clean();
ob_clean();
$this->params['scripts'] = $this->generateScripts();
$this->params['css'] = $this->generateCSS();
echo $this->render($this->parentLayout,
array_merge($this->getBlocks(), $this->params,
['content' => $content])
);
} else {
$this->parentLayout = $parentView;
ob_start();
}
} | php | public function content($parentView = null)
{
if ($parentView === null) {
$content = ob_get_clean();
ob_clean();
$this->params['scripts'] = $this->generateScripts();
$this->params['css'] = $this->generateCSS();
echo $this->render($this->parentLayout,
array_merge($this->getBlocks(), $this->params,
['content' => $content])
);
} else {
$this->parentLayout = $parentView;
ob_start();
}
} | [
"public",
"function",
"content",
"(",
"$",
"parentView",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parentView",
"===",
"null",
")",
"{",
"$",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"ob_clean",
"(",
")",
";",
"$",
"this",
"->",
"params",
"[",
"'scripts'",
"]",
"=",
"$",
"this",
"->",
"generateScripts",
"(",
")",
";",
"$",
"this",
"->",
"params",
"[",
"'css'",
"]",
"=",
"$",
"this",
"->",
"generateCSS",
"(",
")",
";",
"echo",
"$",
"this",
"->",
"render",
"(",
"$",
"this",
"->",
"parentLayout",
",",
"array_merge",
"(",
"$",
"this",
"->",
"getBlocks",
"(",
")",
",",
"$",
"this",
"->",
"params",
",",
"[",
"'content'",
"=>",
"$",
"content",
"]",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"parentLayout",
"=",
"$",
"parentView",
";",
"ob_start",
"(",
")",
";",
"}",
"}"
] | Content for parent layout
@param string $parentView | [
"Content",
"for",
"parent",
"layout"
] | a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e | https://github.com/SergioMadness/framework/blob/a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e/framework/basic/View.php#L75-L90 |
5,249 | SergioMadness/framework | framework/basic/View.php | View.block | public function block($name = null)
{
if ($name === null) {
$this->addBlock($this->currentBlock, ob_get_clean());
$this->currentBlock = '';
ob_clean();
} else {
$this->currentBlock = $name;
ob_start();
}
} | php | public function block($name = null)
{
if ($name === null) {
$this->addBlock($this->currentBlock, ob_get_clean());
$this->currentBlock = '';
ob_clean();
} else {
$this->currentBlock = $name;
ob_start();
}
} | [
"public",
"function",
"block",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"addBlock",
"(",
"$",
"this",
"->",
"currentBlock",
",",
"ob_get_clean",
"(",
")",
")",
";",
"$",
"this",
"->",
"currentBlock",
"=",
"''",
";",
"ob_clean",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"currentBlock",
"=",
"$",
"name",
";",
"ob_start",
"(",
")",
";",
"}",
"}"
] | Start or stop content block
@param string $name | [
"Start",
"or",
"stop",
"content",
"block"
] | a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e | https://github.com/SergioMadness/framework/blob/a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e/framework/basic/View.php#L97-L107 |
5,250 | SergioMadness/framework | framework/basic/View.php | View.generateScripts | public function generateScripts()
{
$result = '';
$rawScript = [];
$this->scripts = array_unique($this->scripts, SORT_REGULAR);
foreach ($this->scripts as $scriptInfo) {
if (!$scriptInfo[2]) {
$result.= '<script src="'.$scriptInfo[0].'" type="'.$scriptInfo[1].'"></script>';
} else {
$rawScript[$scriptInfo[1]] = isset($rawScript[$scriptInfo[1]]) ? $rawScript[$scriptInfo[1]] .= $scriptInfo[0]
: $scriptInfo[0];
}
}
foreach ($rawScript as $type => $script) {
$result.= '<script type="'.$type.'">'.$script.'</script>';
}
return $result;
} | php | public function generateScripts()
{
$result = '';
$rawScript = [];
$this->scripts = array_unique($this->scripts, SORT_REGULAR);
foreach ($this->scripts as $scriptInfo) {
if (!$scriptInfo[2]) {
$result.= '<script src="'.$scriptInfo[0].'" type="'.$scriptInfo[1].'"></script>';
} else {
$rawScript[$scriptInfo[1]] = isset($rawScript[$scriptInfo[1]]) ? $rawScript[$scriptInfo[1]] .= $scriptInfo[0]
: $scriptInfo[0];
}
}
foreach ($rawScript as $type => $script) {
$result.= '<script type="'.$type.'">'.$script.'</script>';
}
return $result;
} | [
"public",
"function",
"generateScripts",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"rawScript",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"scripts",
"=",
"array_unique",
"(",
"$",
"this",
"->",
"scripts",
",",
"SORT_REGULAR",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"scripts",
"as",
"$",
"scriptInfo",
")",
"{",
"if",
"(",
"!",
"$",
"scriptInfo",
"[",
"2",
"]",
")",
"{",
"$",
"result",
".=",
"'<script src=\"'",
".",
"$",
"scriptInfo",
"[",
"0",
"]",
".",
"'\" type=\"'",
".",
"$",
"scriptInfo",
"[",
"1",
"]",
".",
"'\"></script>'",
";",
"}",
"else",
"{",
"$",
"rawScript",
"[",
"$",
"scriptInfo",
"[",
"1",
"]",
"]",
"=",
"isset",
"(",
"$",
"rawScript",
"[",
"$",
"scriptInfo",
"[",
"1",
"]",
"]",
")",
"?",
"$",
"rawScript",
"[",
"$",
"scriptInfo",
"[",
"1",
"]",
"]",
".=",
"$",
"scriptInfo",
"[",
"0",
"]",
":",
"$",
"scriptInfo",
"[",
"0",
"]",
";",
"}",
"}",
"foreach",
"(",
"$",
"rawScript",
"as",
"$",
"type",
"=>",
"$",
"script",
")",
"{",
"$",
"result",
".=",
"'<script type=\"'",
".",
"$",
"type",
".",
"'\">'",
".",
"$",
"script",
".",
"'</script>'",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Generate script tags
@return string | [
"Generate",
"script",
"tags"
] | a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e | https://github.com/SergioMadness/framework/blob/a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e/framework/basic/View.php#L176-L195 |
5,251 | SergioMadness/framework | framework/basic/View.php | View.generateCSS | public function generateCSS()
{
$result = '';
$cssRaw = '';
$this->styles = array_unique($this->styles, SORT_REGULAR);
foreach ($this->styles as $style) {
if ($style[1]) {
$cssRaw.=$style[0];
} else {
$result.='<link href="'.$style[0].'" rel="stylesheet" type="text/css" />';
}
}
$result.=$cssRaw != '' ? '<style>'.$cssRaw.'</style>' : '';
return $result;
} | php | public function generateCSS()
{
$result = '';
$cssRaw = '';
$this->styles = array_unique($this->styles, SORT_REGULAR);
foreach ($this->styles as $style) {
if ($style[1]) {
$cssRaw.=$style[0];
} else {
$result.='<link href="'.$style[0].'" rel="stylesheet" type="text/css" />';
}
}
$result.=$cssRaw != '' ? '<style>'.$cssRaw.'</style>' : '';
return $result;
} | [
"public",
"function",
"generateCSS",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"cssRaw",
"=",
"''",
";",
"$",
"this",
"->",
"styles",
"=",
"array_unique",
"(",
"$",
"this",
"->",
"styles",
",",
"SORT_REGULAR",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"styles",
"as",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"style",
"[",
"1",
"]",
")",
"{",
"$",
"cssRaw",
".=",
"$",
"style",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"$",
"result",
".=",
"'<link href=\"'",
".",
"$",
"style",
"[",
"0",
"]",
".",
"'\" rel=\"stylesheet\" type=\"text/css\" />'",
";",
"}",
"}",
"$",
"result",
".=",
"$",
"cssRaw",
"!=",
"''",
"?",
"'<style>'",
".",
"$",
"cssRaw",
".",
"'</style>'",
":",
"''",
";",
"return",
"$",
"result",
";",
"}"
] | Generate CSS tags
@return string | [
"Generate",
"CSS",
"tags"
] | a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e | https://github.com/SergioMadness/framework/blob/a5038eb926a5038b9a331d0cb6a68d7fc3cf1f1e/framework/basic/View.php#L202-L218 |
5,252 | pablodip/PablodipModuleBundle | Routing/ModuleFileLoader.php | ModuleFileLoader.load | public function load($file, $type = null)
{
$path = $this->locator->locate($file);
$collection = new RouteCollection();
if ($class = $this->findClass($path)) {
// module file resource
$collection->addResource(new FileResource($path));
// module instance
$module = $this->moduleManager->get($class);
// routes prefixes
$routeNamePrefix = $module->getRouteNamePrefix();
$routePatternPrefix = $module->getRoutePatternPrefix();
// route actions
foreach ($module->getRouteActions() as $action) {
// action file resource
$reflection = new \ReflectionObject($action);
$collection->addResource(new FileResource($reflection->getFileName()));
// name (module prefix + action suffix)
$name = $routeNamePrefix.$action->getRouteName();
// pattern (module prefix + action suffix)
if ('/' === $action->getRoutePattern() && '' !== $routePatternPrefix) {
$pattern = $routePatternPrefix;
} else {
$pattern = $routePatternPrefix.$action->getRoutePattern();
}
// defaults (action defaults + defaults needed to execute)
$defaults = array_merge($action->getRouteDefaults(), array(
'_controller' => 'PablodipModuleBundle:Module:execute',
'_module.module' => $class,
'_module.action' => $action->getName(),
));
// requirements (just from the action)
$requirements = $action->getRouteRequirements();
// options (from the action)
$options = $action->getRouteOptions();
$collection->add($name, new Route($pattern, $defaults, $requirements, $options));
}
}
return $collection;
} | php | public function load($file, $type = null)
{
$path = $this->locator->locate($file);
$collection = new RouteCollection();
if ($class = $this->findClass($path)) {
// module file resource
$collection->addResource(new FileResource($path));
// module instance
$module = $this->moduleManager->get($class);
// routes prefixes
$routeNamePrefix = $module->getRouteNamePrefix();
$routePatternPrefix = $module->getRoutePatternPrefix();
// route actions
foreach ($module->getRouteActions() as $action) {
// action file resource
$reflection = new \ReflectionObject($action);
$collection->addResource(new FileResource($reflection->getFileName()));
// name (module prefix + action suffix)
$name = $routeNamePrefix.$action->getRouteName();
// pattern (module prefix + action suffix)
if ('/' === $action->getRoutePattern() && '' !== $routePatternPrefix) {
$pattern = $routePatternPrefix;
} else {
$pattern = $routePatternPrefix.$action->getRoutePattern();
}
// defaults (action defaults + defaults needed to execute)
$defaults = array_merge($action->getRouteDefaults(), array(
'_controller' => 'PablodipModuleBundle:Module:execute',
'_module.module' => $class,
'_module.action' => $action->getName(),
));
// requirements (just from the action)
$requirements = $action->getRouteRequirements();
// options (from the action)
$options = $action->getRouteOptions();
$collection->add($name, new Route($pattern, $defaults, $requirements, $options));
}
}
return $collection;
} | [
"public",
"function",
"load",
"(",
"$",
"file",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"locator",
"->",
"locate",
"(",
"$",
"file",
")",
";",
"$",
"collection",
"=",
"new",
"RouteCollection",
"(",
")",
";",
"if",
"(",
"$",
"class",
"=",
"$",
"this",
"->",
"findClass",
"(",
"$",
"path",
")",
")",
"{",
"// module file resource",
"$",
"collection",
"->",
"addResource",
"(",
"new",
"FileResource",
"(",
"$",
"path",
")",
")",
";",
"// module instance",
"$",
"module",
"=",
"$",
"this",
"->",
"moduleManager",
"->",
"get",
"(",
"$",
"class",
")",
";",
"// routes prefixes",
"$",
"routeNamePrefix",
"=",
"$",
"module",
"->",
"getRouteNamePrefix",
"(",
")",
";",
"$",
"routePatternPrefix",
"=",
"$",
"module",
"->",
"getRoutePatternPrefix",
"(",
")",
";",
"// route actions",
"foreach",
"(",
"$",
"module",
"->",
"getRouteActions",
"(",
")",
"as",
"$",
"action",
")",
"{",
"// action file resource",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"action",
")",
";",
"$",
"collection",
"->",
"addResource",
"(",
"new",
"FileResource",
"(",
"$",
"reflection",
"->",
"getFileName",
"(",
")",
")",
")",
";",
"// name (module prefix + action suffix)",
"$",
"name",
"=",
"$",
"routeNamePrefix",
".",
"$",
"action",
"->",
"getRouteName",
"(",
")",
";",
"// pattern (module prefix + action suffix)",
"if",
"(",
"'/'",
"===",
"$",
"action",
"->",
"getRoutePattern",
"(",
")",
"&&",
"''",
"!==",
"$",
"routePatternPrefix",
")",
"{",
"$",
"pattern",
"=",
"$",
"routePatternPrefix",
";",
"}",
"else",
"{",
"$",
"pattern",
"=",
"$",
"routePatternPrefix",
".",
"$",
"action",
"->",
"getRoutePattern",
"(",
")",
";",
"}",
"// defaults (action defaults + defaults needed to execute)",
"$",
"defaults",
"=",
"array_merge",
"(",
"$",
"action",
"->",
"getRouteDefaults",
"(",
")",
",",
"array",
"(",
"'_controller'",
"=>",
"'PablodipModuleBundle:Module:execute'",
",",
"'_module.module'",
"=>",
"$",
"class",
",",
"'_module.action'",
"=>",
"$",
"action",
"->",
"getName",
"(",
")",
",",
")",
")",
";",
"// requirements (just from the action)",
"$",
"requirements",
"=",
"$",
"action",
"->",
"getRouteRequirements",
"(",
")",
";",
"// options (from the action)",
"$",
"options",
"=",
"$",
"action",
"->",
"getRouteOptions",
"(",
")",
";",
"$",
"collection",
"->",
"add",
"(",
"$",
"name",
",",
"new",
"Route",
"(",
"$",
"pattern",
",",
"$",
"defaults",
",",
"$",
"requirements",
",",
"$",
"options",
")",
")",
";",
"}",
"}",
"return",
"$",
"collection",
";",
"}"
] | Loads from modules in a file
@param string $file A PHP file path
@param string $type The resource type
@return RouteCollection A RouteCollection instance | [
"Loads",
"from",
"modules",
"in",
"a",
"file"
] | 6d26df909fa4c57b8b3337d58f8cbecd7781c6ef | https://github.com/pablodip/PablodipModuleBundle/blob/6d26df909fa4c57b8b3337d58f8cbecd7781c6ef/Routing/ModuleFileLoader.php#L57-L103 |
5,253 | tlumx/tlumx-view | src/View.php | View.appendHeadScript | public function appendHeadScript($src, $isFile = true)
{
$this->headScripts[] = $this->createScript($src, $isFile);
} | php | public function appendHeadScript($src, $isFile = true)
{
$this->headScripts[] = $this->createScript($src, $isFile);
} | [
"public",
"function",
"appendHeadScript",
"(",
"$",
"src",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"headScripts",
"[",
"]",
"=",
"$",
"this",
"->",
"createScript",
"(",
"$",
"src",
",",
"$",
"isFile",
")",
";",
"}"
] | Append script to header
@param string $src
@param bool $isFile | [
"Append",
"script",
"to",
"header"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L384-L387 |
5,254 | tlumx/tlumx-view | src/View.php | View.prependHeadScript | public function prependHeadScript($src, $isFile = true)
{
$script = $this->createScript($src, $isFile);
$scripts = $this->headScripts;
array_unshift($scripts, $script);
$this->headScripts = $scripts;
} | php | public function prependHeadScript($src, $isFile = true)
{
$script = $this->createScript($src, $isFile);
$scripts = $this->headScripts;
array_unshift($scripts, $script);
$this->headScripts = $scripts;
} | [
"public",
"function",
"prependHeadScript",
"(",
"$",
"src",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"createScript",
"(",
"$",
"src",
",",
"$",
"isFile",
")",
";",
"$",
"scripts",
"=",
"$",
"this",
"->",
"headScripts",
";",
"array_unshift",
"(",
"$",
"scripts",
",",
"$",
"script",
")",
";",
"$",
"this",
"->",
"headScripts",
"=",
"$",
"scripts",
";",
"}"
] | Prepend script to header
@param string $src
@param bool $isFile | [
"Prepend",
"script",
"to",
"header"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L395-L401 |
5,255 | tlumx/tlumx-view | src/View.php | View.getHeadScripts | public function getHeadScripts()
{
$output = '';
foreach ($this->headScripts as $script) {
$output .= $script . "\n";
}
$output = rtrim($output, "\n");
return $output;
} | php | public function getHeadScripts()
{
$output = '';
foreach ($this->headScripts as $script) {
$output .= $script . "\n";
}
$output = rtrim($output, "\n");
return $output;
} | [
"public",
"function",
"getHeadScripts",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"headScripts",
"as",
"$",
"script",
")",
"{",
"$",
"output",
".=",
"$",
"script",
".",
"\"\\n\"",
";",
"}",
"$",
"output",
"=",
"rtrim",
"(",
"$",
"output",
",",
"\"\\n\"",
")",
";",
"return",
"$",
"output",
";",
"}"
] | Get header script
@return string | [
"Get",
"header",
"script"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L408-L416 |
5,256 | tlumx/tlumx-view | src/View.php | View.appendAfterBodyScript | public function appendAfterBodyScript($src, $isFile = true)
{
$this->afterBodyScripts[] = $this->createScript($src, $isFile);
} | php | public function appendAfterBodyScript($src, $isFile = true)
{
$this->afterBodyScripts[] = $this->createScript($src, $isFile);
} | [
"public",
"function",
"appendAfterBodyScript",
"(",
"$",
"src",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"afterBodyScripts",
"[",
"]",
"=",
"$",
"this",
"->",
"createScript",
"(",
"$",
"src",
",",
"$",
"isFile",
")",
";",
"}"
] | Append after body script
@param string $src
@param bool $isFile | [
"Append",
"after",
"body",
"script"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L424-L427 |
5,257 | tlumx/tlumx-view | src/View.php | View.prependAfterBodyScript | public function prependAfterBodyScript($src, $isFile = true)
{
$script = $this->createScript($src, $isFile);
$scripts = $this->afterBodyScripts;
array_unshift($scripts, $script);
$this->afterBodyScripts = $scripts;
} | php | public function prependAfterBodyScript($src, $isFile = true)
{
$script = $this->createScript($src, $isFile);
$scripts = $this->afterBodyScripts;
array_unshift($scripts, $script);
$this->afterBodyScripts = $scripts;
} | [
"public",
"function",
"prependAfterBodyScript",
"(",
"$",
"src",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"createScript",
"(",
"$",
"src",
",",
"$",
"isFile",
")",
";",
"$",
"scripts",
"=",
"$",
"this",
"->",
"afterBodyScripts",
";",
"array_unshift",
"(",
"$",
"scripts",
",",
"$",
"script",
")",
";",
"$",
"this",
"->",
"afterBodyScripts",
"=",
"$",
"scripts",
";",
"}"
] | Prepend after body script
@param string $src
@param bool $isFile | [
"Prepend",
"after",
"body",
"script"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L435-L441 |
5,258 | tlumx/tlumx-view | src/View.php | View.getAfterBodyScripts | public function getAfterBodyScripts()
{
$output = '';
foreach ($this->afterBodyScripts as $script) {
$output .= $script . "\n";
}
$output = rtrim($output, "\n");
return $output;
} | php | public function getAfterBodyScripts()
{
$output = '';
foreach ($this->afterBodyScripts as $script) {
$output .= $script . "\n";
}
$output = rtrim($output, "\n");
return $output;
} | [
"public",
"function",
"getAfterBodyScripts",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"afterBodyScripts",
"as",
"$",
"script",
")",
"{",
"$",
"output",
".=",
"$",
"script",
".",
"\"\\n\"",
";",
"}",
"$",
"output",
"=",
"rtrim",
"(",
"$",
"output",
",",
"\"\\n\"",
")",
";",
"return",
"$",
"output",
";",
"}"
] | Get after body script
@return string | [
"Get",
"after",
"body",
"script"
] | 9f784eb8092ac2971e05cb478849ade6d485bbfa | https://github.com/tlumx/tlumx-view/blob/9f784eb8092ac2971e05cb478849ade6d485bbfa/src/View.php#L448-L456 |
5,259 | unclecheese/silverstripe-green | code/Controller.php | Controller.findModule | protected function findModule()
{
if($this->isGreenPage()) {
$moduleName = $this->DesignModule;
if($moduleName) {
return Green::inst()->getDesignModule($moduleName);
}
}
$url = $this->request->getURL();
foreach(Green::inst()->getDesignModules() as $module) {
if((string) $module->getConfiguration()->public_url == $url) {
return $module;
}
}
return false;
} | php | protected function findModule()
{
if($this->isGreenPage()) {
$moduleName = $this->DesignModule;
if($moduleName) {
return Green::inst()->getDesignModule($moduleName);
}
}
$url = $this->request->getURL();
foreach(Green::inst()->getDesignModules() as $module) {
if((string) $module->getConfiguration()->public_url == $url) {
return $module;
}
}
return false;
} | [
"protected",
"function",
"findModule",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isGreenPage",
"(",
")",
")",
"{",
"$",
"moduleName",
"=",
"$",
"this",
"->",
"DesignModule",
";",
"if",
"(",
"$",
"moduleName",
")",
"{",
"return",
"Green",
"::",
"inst",
"(",
")",
"->",
"getDesignModule",
"(",
"$",
"moduleName",
")",
";",
"}",
"}",
"$",
"url",
"=",
"$",
"this",
"->",
"request",
"->",
"getURL",
"(",
")",
";",
"foreach",
"(",
"Green",
"::",
"inst",
"(",
")",
"->",
"getDesignModules",
"(",
")",
"as",
"$",
"module",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"module",
"->",
"getConfiguration",
"(",
")",
"->",
"public_url",
"==",
"$",
"url",
")",
"{",
"return",
"$",
"module",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Finds the DesignModule object, whether through the attached
data record or through the public_url match
@return DesignModule|bool | [
"Finds",
"the",
"DesignModule",
"object",
"whether",
"through",
"the",
"attached",
"data",
"record",
"or",
"through",
"the",
"public_url",
"match"
] | 4395dcef5f4efd5a2c67e0bba3ab5cc583e3fdd4 | https://github.com/unclecheese/silverstripe-green/blob/4395dcef5f4efd5a2c67e0bba3ab5cc583e3fdd4/code/Controller.php#L22-L39 |
5,260 | unclecheese/silverstripe-green | code/Controller.php | Controller.handleAction | protected function handleAction($request, $action)
{
$module = $this->findModule();
if(!$module) {
return parent::handleAction($request, $action);
}
$data = [];
if($this->isGreenPage()) {
$data = $this->data()->toViewableData();
}
elseif($module->getDataSource()) {
$data = $module->getDataSource()->toDBObject();
}
$module->loadRequirements();
$viewer = $this->getViewer($action);
$viewer->setTemplateFile('Layout', $module->getLayoutTemplateFile());
$main = $module->getMainTemplateFile();
if($main) {
$viewer->setTemplateFile('main', $main);
}
return $viewer->process($this->customise($data));
} | php | protected function handleAction($request, $action)
{
$module = $this->findModule();
if(!$module) {
return parent::handleAction($request, $action);
}
$data = [];
if($this->isGreenPage()) {
$data = $this->data()->toViewableData();
}
elseif($module->getDataSource()) {
$data = $module->getDataSource()->toDBObject();
}
$module->loadRequirements();
$viewer = $this->getViewer($action);
$viewer->setTemplateFile('Layout', $module->getLayoutTemplateFile());
$main = $module->getMainTemplateFile();
if($main) {
$viewer->setTemplateFile('main', $main);
}
return $viewer->process($this->customise($data));
} | [
"protected",
"function",
"handleAction",
"(",
"$",
"request",
",",
"$",
"action",
")",
"{",
"$",
"module",
"=",
"$",
"this",
"->",
"findModule",
"(",
")",
";",
"if",
"(",
"!",
"$",
"module",
")",
"{",
"return",
"parent",
"::",
"handleAction",
"(",
"$",
"request",
",",
"$",
"action",
")",
";",
"}",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"isGreenPage",
"(",
")",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"toViewableData",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"module",
"->",
"getDataSource",
"(",
")",
")",
"{",
"$",
"data",
"=",
"$",
"module",
"->",
"getDataSource",
"(",
")",
"->",
"toDBObject",
"(",
")",
";",
"}",
"$",
"module",
"->",
"loadRequirements",
"(",
")",
";",
"$",
"viewer",
"=",
"$",
"this",
"->",
"getViewer",
"(",
"$",
"action",
")",
";",
"$",
"viewer",
"->",
"setTemplateFile",
"(",
"'Layout'",
",",
"$",
"module",
"->",
"getLayoutTemplateFile",
"(",
")",
")",
";",
"$",
"main",
"=",
"$",
"module",
"->",
"getMainTemplateFile",
"(",
")",
";",
"if",
"(",
"$",
"main",
")",
"{",
"$",
"viewer",
"->",
"setTemplateFile",
"(",
"'main'",
",",
"$",
"main",
")",
";",
"}",
"return",
"$",
"viewer",
"->",
"process",
"(",
"$",
"this",
"->",
"customise",
"(",
"$",
"data",
")",
")",
";",
"}"
] | Intercepts the handleAction method to force a customised viewer
@param SS_HTTPRequest $request
@param string $action
@return string | [
"Intercepts",
"the",
"handleAction",
"method",
"to",
"force",
"a",
"customised",
"viewer"
] | 4395dcef5f4efd5a2c67e0bba3ab5cc583e3fdd4 | https://github.com/unclecheese/silverstripe-green/blob/4395dcef5f4efd5a2c67e0bba3ab5cc583e3fdd4/code/Controller.php#L49-L76 |
5,261 | nano7/Database | src/Query/Runner.php | Runner.insert | public function insert(array $values)
{
// Since every insert gets treated like a batch insert, we will have to detect
// if the user is inserting a single document or an array of documents.
$batch = true;
foreach ($values as $value) {
// As soon as we find a value that is not an array we assume the user is
// inserting a single document.
if (!is_array($value)) {
$batch = false;
break;
}
}
if (!$batch) {
$values = [$values];
}
// Batch insert
$result = $this->collection->insertMany($values);
return (1 == (int) $result->isAcknowledged());
} | php | public function insert(array $values)
{
// Since every insert gets treated like a batch insert, we will have to detect
// if the user is inserting a single document or an array of documents.
$batch = true;
foreach ($values as $value) {
// As soon as we find a value that is not an array we assume the user is
// inserting a single document.
if (!is_array($value)) {
$batch = false;
break;
}
}
if (!$batch) {
$values = [$values];
}
// Batch insert
$result = $this->collection->insertMany($values);
return (1 == (int) $result->isAcknowledged());
} | [
"public",
"function",
"insert",
"(",
"array",
"$",
"values",
")",
"{",
"// Since every insert gets treated like a batch insert, we will have to detect",
"// if the user is inserting a single document or an array of documents.",
"$",
"batch",
"=",
"true",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"// As soon as we find a value that is not an array we assume the user is",
"// inserting a single document.",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"batch",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"$",
"batch",
")",
"{",
"$",
"values",
"=",
"[",
"$",
"values",
"]",
";",
"}",
"// Batch insert",
"$",
"result",
"=",
"$",
"this",
"->",
"collection",
"->",
"insertMany",
"(",
"$",
"values",
")",
";",
"return",
"(",
"1",
"==",
"(",
"int",
")",
"$",
"result",
"->",
"isAcknowledged",
"(",
")",
")",
";",
"}"
] | Insert documents.
@param array $values
@return bool | [
"Insert",
"documents",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Query/Runner.php#L73-L96 |
5,262 | nano7/Database | src/Query/Runner.php | Runner.insertGetId | public function insertGetId(array $values, $sequence = null)
{
$result = $this->collection->insertOne($values);
if (1 == (int) $result->isAcknowledged()) {
if (is_null($sequence)) {
$sequence = '_id';
}
// Return id
return $sequence == '_id' ? trim($result->getInsertedId()) : $values[$sequence];
}
return null;
} | php | public function insertGetId(array $values, $sequence = null)
{
$result = $this->collection->insertOne($values);
if (1 == (int) $result->isAcknowledged()) {
if (is_null($sequence)) {
$sequence = '_id';
}
// Return id
return $sequence == '_id' ? trim($result->getInsertedId()) : $values[$sequence];
}
return null;
} | [
"public",
"function",
"insertGetId",
"(",
"array",
"$",
"values",
",",
"$",
"sequence",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"collection",
"->",
"insertOne",
"(",
"$",
"values",
")",
";",
"if",
"(",
"1",
"==",
"(",
"int",
")",
"$",
"result",
"->",
"isAcknowledged",
"(",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sequence",
")",
")",
"{",
"$",
"sequence",
"=",
"'_id'",
";",
"}",
"// Return id",
"return",
"$",
"sequence",
"==",
"'_id'",
"?",
"trim",
"(",
"$",
"result",
"->",
"getInsertedId",
"(",
")",
")",
":",
"$",
"values",
"[",
"$",
"sequence",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Insert documet and return ID.
@param array $values
@param null $sequence
@return mixed|null | [
"Insert",
"documet",
"and",
"return",
"ID",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Query/Runner.php#L105-L119 |
5,263 | nano7/Database | src/Query/Runner.php | Runner.delete | public function delete($id = null)
{
// If an ID is passed to the method, we will set the where clause to check
// the ID to allow developers to simply and quickly remove a single row
// from their database without manually specifying the where clauses.
if (!is_null($id)) {
$this->where('_id', '=', $id);
}
$wheres = $this->compileWheres();
$result = $this->collection->deleteMany($wheres);
if (1 == (int) $result->isAcknowledged()) {
return $result->getDeletedCount();
}
return 0;
} | php | public function delete($id = null)
{
// If an ID is passed to the method, we will set the where clause to check
// the ID to allow developers to simply and quickly remove a single row
// from their database without manually specifying the where clauses.
if (!is_null($id)) {
$this->where('_id', '=', $id);
}
$wheres = $this->compileWheres();
$result = $this->collection->deleteMany($wheres);
if (1 == (int) $result->isAcknowledged()) {
return $result->getDeletedCount();
}
return 0;
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"// If an ID is passed to the method, we will set the where clause to check",
"// the ID to allow developers to simply and quickly remove a single row",
"// from their database without manually specifying the where clauses.",
"if",
"(",
"!",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"where",
"(",
"'_id'",
",",
"'='",
",",
"$",
"id",
")",
";",
"}",
"$",
"wheres",
"=",
"$",
"this",
"->",
"compileWheres",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"collection",
"->",
"deleteMany",
"(",
"$",
"wheres",
")",
";",
"if",
"(",
"1",
"==",
"(",
"int",
")",
"$",
"result",
"->",
"isAcknowledged",
"(",
")",
")",
"{",
"return",
"$",
"result",
"->",
"getDeletedCount",
"(",
")",
";",
"}",
"return",
"0",
";",
"}"
] | Delete documents.
@param null $id
@return int | [
"Delete",
"documents",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Query/Runner.php#L157-L174 |
5,264 | nano7/Database | src/Query/Runner.php | Runner.getFreshNormal | protected function getFreshNormal($wheres)
{
$columns = [];
// Convert select columns to simple projections.
foreach ($this->columns as $column) {
$columns[$column] = true;
}
// Add custom projections.
if ($this->projections) {
$columns = array_merge($columns, $this->projections);
}
$options = [];
// Apply order, offset, limit and projection
//if ($this->timeout) {
// $options['maxTimeMS'] = $this->timeout;
//}
if ($this->orders) {
$options['sort'] = $this->compileOrders($this->orders);
}
if ($this->offset) {
$options['skip'] = $this->offset;
}
if ($this->limit) {
$options['limit'] = $this->limit;
}
if ($columns) {
$options['projection'] = $columns;
}
// if ($this->hint) $cursor->hint($this->hint);
// Fix for legacy support, converts the results to arrays instead of objects.
$options['typeMap'] = ['root' => 'array', 'document' => 'array'];
// Add custom query options
if (count($this->options)) {
$options = array_merge($options, $this->options);
}
// Execute query and get MongoCursor
$cursor = $this->collection->find($wheres, $options);
// Return results as an array with numeric keys
$results = iterator_to_array($cursor, false);
return $results;
} | php | protected function getFreshNormal($wheres)
{
$columns = [];
// Convert select columns to simple projections.
foreach ($this->columns as $column) {
$columns[$column] = true;
}
// Add custom projections.
if ($this->projections) {
$columns = array_merge($columns, $this->projections);
}
$options = [];
// Apply order, offset, limit and projection
//if ($this->timeout) {
// $options['maxTimeMS'] = $this->timeout;
//}
if ($this->orders) {
$options['sort'] = $this->compileOrders($this->orders);
}
if ($this->offset) {
$options['skip'] = $this->offset;
}
if ($this->limit) {
$options['limit'] = $this->limit;
}
if ($columns) {
$options['projection'] = $columns;
}
// if ($this->hint) $cursor->hint($this->hint);
// Fix for legacy support, converts the results to arrays instead of objects.
$options['typeMap'] = ['root' => 'array', 'document' => 'array'];
// Add custom query options
if (count($this->options)) {
$options = array_merge($options, $this->options);
}
// Execute query and get MongoCursor
$cursor = $this->collection->find($wheres, $options);
// Return results as an array with numeric keys
$results = iterator_to_array($cursor, false);
return $results;
} | [
"protected",
"function",
"getFreshNormal",
"(",
"$",
"wheres",
")",
"{",
"$",
"columns",
"=",
"[",
"]",
";",
"// Convert select columns to simple projections.",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"$",
"columns",
"[",
"$",
"column",
"]",
"=",
"true",
";",
"}",
"// Add custom projections.",
"if",
"(",
"$",
"this",
"->",
"projections",
")",
"{",
"$",
"columns",
"=",
"array_merge",
"(",
"$",
"columns",
",",
"$",
"this",
"->",
"projections",
")",
";",
"}",
"$",
"options",
"=",
"[",
"]",
";",
"// Apply order, offset, limit and projection",
"//if ($this->timeout) {",
"// $options['maxTimeMS'] = $this->timeout;",
"//}",
"if",
"(",
"$",
"this",
"->",
"orders",
")",
"{",
"$",
"options",
"[",
"'sort'",
"]",
"=",
"$",
"this",
"->",
"compileOrders",
"(",
"$",
"this",
"->",
"orders",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"offset",
")",
"{",
"$",
"options",
"[",
"'skip'",
"]",
"=",
"$",
"this",
"->",
"offset",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"limit",
")",
"{",
"$",
"options",
"[",
"'limit'",
"]",
"=",
"$",
"this",
"->",
"limit",
";",
"}",
"if",
"(",
"$",
"columns",
")",
"{",
"$",
"options",
"[",
"'projection'",
"]",
"=",
"$",
"columns",
";",
"}",
"// if ($this->hint) $cursor->hint($this->hint);",
"// Fix for legacy support, converts the results to arrays instead of objects.",
"$",
"options",
"[",
"'typeMap'",
"]",
"=",
"[",
"'root'",
"=>",
"'array'",
",",
"'document'",
"=>",
"'array'",
"]",
";",
"// Add custom query options",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"options",
")",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"$",
"options",
",",
"$",
"this",
"->",
"options",
")",
";",
"}",
"// Execute query and get MongoCursor",
"$",
"cursor",
"=",
"$",
"this",
"->",
"collection",
"->",
"find",
"(",
"$",
"wheres",
",",
"$",
"options",
")",
";",
"// Return results as an array with numeric keys",
"$",
"results",
"=",
"iterator_to_array",
"(",
"$",
"cursor",
",",
"false",
")",
";",
"return",
"$",
"results",
";",
"}"
] | Fetch Normal.
@param $wheres
@return \mixed[] | [
"Fetch",
"Normal",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Query/Runner.php#L340-L388 |
5,265 | nano7/Database | src/Query/Runner.php | Runner.convertKey | public static function convertKey($id)
{
if (is_string($id) && strlen($id) === 24 && ctype_xdigit($id)) {
return new ObjectID($id);
}
return $id;
} | php | public static function convertKey($id)
{
if (is_string($id) && strlen($id) === 24 && ctype_xdigit($id)) {
return new ObjectID($id);
}
return $id;
} | [
"public",
"static",
"function",
"convertKey",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
"&&",
"strlen",
"(",
"$",
"id",
")",
"===",
"24",
"&&",
"ctype_xdigit",
"(",
"$",
"id",
")",
")",
"{",
"return",
"new",
"ObjectID",
"(",
"$",
"id",
")",
";",
"}",
"return",
"$",
"id",
";",
"}"
] | Convert a key to ObjectID if needed.
@param mixed $id
@return mixed | [
"Convert",
"a",
"key",
"to",
"ObjectID",
"if",
"needed",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Query/Runner.php#L412-L419 |
5,266 | OpenResourceManager/client-php | src/Client/MobileCarrier.php | MobileCarrier.store | public function store($code, $label, $country_id = null, $country_code = null)
{
$fields = [];
//@todo validate params, throw exception when they are missing
$fields['code'] = $code;
$fields['label'] = $label;
if (!is_null($country_id)) $fields['country_id'] = $country_id;
if (!is_null($country_code)) $fields['country_code'] = $country_code;
return $this->_post($fields);
} | php | public function store($code, $label, $country_id = null, $country_code = null)
{
$fields = [];
//@todo validate params, throw exception when they are missing
$fields['code'] = $code;
$fields['label'] = $label;
if (!is_null($country_id)) $fields['country_id'] = $country_id;
if (!is_null($country_code)) $fields['country_code'] = $country_code;
return $this->_post($fields);
} | [
"public",
"function",
"store",
"(",
"$",
"code",
",",
"$",
"label",
",",
"$",
"country_id",
"=",
"null",
",",
"$",
"country_code",
"=",
"null",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"//@todo validate params, throw exception when they are missing",
"$",
"fields",
"[",
"'code'",
"]",
"=",
"$",
"code",
";",
"$",
"fields",
"[",
"'label'",
"]",
"=",
"$",
"label",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"country_id",
")",
")",
"$",
"fields",
"[",
"'country_id'",
"]",
"=",
"$",
"country_id",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"country_code",
")",
")",
"$",
"fields",
"[",
"'country_code'",
"]",
"=",
"$",
"country_code",
";",
"return",
"$",
"this",
"->",
"_post",
"(",
"$",
"fields",
")",
";",
"}"
] | Store Mobile Carrier
Create or update a mobile carrier, by it's code.
@param string $code
@param string $label
@param int $country_id
@param string $country_code
@return \Unirest\Response | [
"Store",
"Mobile",
"Carrier"
] | fa468e3425d32f97294fefed77a7f096f3f8cc86 | https://github.com/OpenResourceManager/client-php/blob/fa468e3425d32f97294fefed77a7f096f3f8cc86/src/Client/MobileCarrier.php#L82-L92 |
5,267 | nano7/Database | src/Model/HasEvents.php | HasEvents.registerModelEvent | protected static function registerModelEvent($event, $callback)
{
$event = self::makeModelEventName($event);
event()->listen($event, $callback);
} | php | protected static function registerModelEvent($event, $callback)
{
$event = self::makeModelEventName($event);
event()->listen($event, $callback);
} | [
"protected",
"static",
"function",
"registerModelEvent",
"(",
"$",
"event",
",",
"$",
"callback",
")",
"{",
"$",
"event",
"=",
"self",
"::",
"makeModelEventName",
"(",
"$",
"event",
")",
";",
"event",
"(",
")",
"->",
"listen",
"(",
"$",
"event",
",",
"$",
"callback",
")",
";",
"}"
] | Register evento model.
@param $event
@param $callback | [
"Register",
"evento",
"model",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Model/HasEvents.php#L35-L40 |
5,268 | comodojo/rpcserver | src/Comodojo/RpcServer/Reserved/Multicall.php | Multicall.singleCall | private static function singleCall(array $request, Parameters $parameters_object) {
if ( !isset($request[0]) || !isset($request[1]) ) {
return self::packError(-32600, $parameters_object->errors()->get(-32600));
}
if ( $request[0] == 'system.multicall' ) {
return self::packError(-31001, $parameters_object->errors()->get(-31001));
}
$payload = array($request[0], $request[1]);
try {
return XmlProcessor::process($payload, $parameters_object, $parameters_object->logger());
} catch (RpcException $re) {
return self::packError($re->getCode(), $re->getMessage());
} catch (Exception $e) {
return self::packError(-32500, $re->getMessage());
}
} | php | private static function singleCall(array $request, Parameters $parameters_object) {
if ( !isset($request[0]) || !isset($request[1]) ) {
return self::packError(-32600, $parameters_object->errors()->get(-32600));
}
if ( $request[0] == 'system.multicall' ) {
return self::packError(-31001, $parameters_object->errors()->get(-31001));
}
$payload = array($request[0], $request[1]);
try {
return XmlProcessor::process($payload, $parameters_object, $parameters_object->logger());
} catch (RpcException $re) {
return self::packError($re->getCode(), $re->getMessage());
} catch (Exception $e) {
return self::packError(-32500, $re->getMessage());
}
} | [
"private",
"static",
"function",
"singleCall",
"(",
"array",
"$",
"request",
",",
"Parameters",
"$",
"parameters_object",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"request",
"[",
"0",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"request",
"[",
"1",
"]",
")",
")",
"{",
"return",
"self",
"::",
"packError",
"(",
"-",
"32600",
",",
"$",
"parameters_object",
"->",
"errors",
"(",
")",
"->",
"get",
"(",
"-",
"32600",
")",
")",
";",
"}",
"if",
"(",
"$",
"request",
"[",
"0",
"]",
"==",
"'system.multicall'",
")",
"{",
"return",
"self",
"::",
"packError",
"(",
"-",
"31001",
",",
"$",
"parameters_object",
"->",
"errors",
"(",
")",
"->",
"get",
"(",
"-",
"31001",
")",
")",
";",
"}",
"$",
"payload",
"=",
"array",
"(",
"$",
"request",
"[",
"0",
"]",
",",
"$",
"request",
"[",
"1",
"]",
")",
";",
"try",
"{",
"return",
"XmlProcessor",
"::",
"process",
"(",
"$",
"payload",
",",
"$",
"parameters_object",
",",
"$",
"parameters_object",
"->",
"logger",
"(",
")",
")",
";",
"}",
"catch",
"(",
"RpcException",
"$",
"re",
")",
"{",
"return",
"self",
"::",
"packError",
"(",
"$",
"re",
"->",
"getCode",
"(",
")",
",",
"$",
"re",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"return",
"self",
"::",
"packError",
"(",
"-",
"32500",
",",
"$",
"re",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Perform a single call
@param array $request
@param Parameters $parameters_object
@return mixed | [
"Perform",
"a",
"single",
"call"
] | 6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c | https://github.com/comodojo/rpcserver/blob/6b4766f1554f6fe6b06199c0c1fb97e1b5a8bb1c/src/Comodojo/RpcServer/Reserved/Multicall.php#L77-L107 |
5,269 | synapsestudios/synapse-base | src/Synapse/User/UserController.php | UserController.get | public function get(Request $request)
{
$userEntity = $request->attributes->get('user');
if ($userEntity === null) {
$userEntity = $this->getUser();
} elseif ($userEntity === false) {
return $this->createNotFoundResponse();
}
return $this->userArrayWithoutPassword($userEntity);
} | php | public function get(Request $request)
{
$userEntity = $request->attributes->get('user');
if ($userEntity === null) {
$userEntity = $this->getUser();
} elseif ($userEntity === false) {
return $this->createNotFoundResponse();
}
return $this->userArrayWithoutPassword($userEntity);
} | [
"public",
"function",
"get",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"userEntity",
"=",
"$",
"request",
"->",
"attributes",
"->",
"get",
"(",
"'user'",
")",
";",
"if",
"(",
"$",
"userEntity",
"===",
"null",
")",
"{",
"$",
"userEntity",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"userEntity",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"createNotFoundResponse",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"userArrayWithoutPassword",
"(",
"$",
"userEntity",
")",
";",
"}"
] | Return a user entity
@param Request $request
@return array | [
"Return",
"a",
"user",
"entity"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/User/UserController.php#L39-L50 |
5,270 | synapsestudios/synapse-base | src/Synapse/User/UserController.php | UserController.put | public function put(Request $request)
{
$user = $this->getUser();
$userValidationCopy = clone $user;
// Validate the modified fields
$content = $this->getContentAsArray($request);
$errors = $this->userValidator->validate($content, $user);
if (count($errors) > 0) {
return $this->createConstraintViolationResponse($errors);
}
$userValidationCopy->exchangeArray($content ?: [])->getArrayCopy();
try {
$user = $this->userService->update($user, $this->getContentAsArray($request));
} catch (OutOfBoundsException $e) {
return $this->createEmailNotUniqueResponse();
}
return $this->userArrayWithoutPassword($user);
} | php | public function put(Request $request)
{
$user = $this->getUser();
$userValidationCopy = clone $user;
// Validate the modified fields
$content = $this->getContentAsArray($request);
$errors = $this->userValidator->validate($content, $user);
if (count($errors) > 0) {
return $this->createConstraintViolationResponse($errors);
}
$userValidationCopy->exchangeArray($content ?: [])->getArrayCopy();
try {
$user = $this->userService->update($user, $this->getContentAsArray($request));
} catch (OutOfBoundsException $e) {
return $this->createEmailNotUniqueResponse();
}
return $this->userArrayWithoutPassword($user);
} | [
"public",
"function",
"put",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"$",
"userValidationCopy",
"=",
"clone",
"$",
"user",
";",
"// Validate the modified fields",
"$",
"content",
"=",
"$",
"this",
"->",
"getContentAsArray",
"(",
"$",
"request",
")",
";",
"$",
"errors",
"=",
"$",
"this",
"->",
"userValidator",
"->",
"validate",
"(",
"$",
"content",
",",
"$",
"user",
")",
";",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"createConstraintViolationResponse",
"(",
"$",
"errors",
")",
";",
"}",
"$",
"userValidationCopy",
"->",
"exchangeArray",
"(",
"$",
"content",
"?",
":",
"[",
"]",
")",
"->",
"getArrayCopy",
"(",
")",
";",
"try",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"update",
"(",
"$",
"user",
",",
"$",
"this",
"->",
"getContentAsArray",
"(",
"$",
"request",
")",
")",
";",
"}",
"catch",
"(",
"OutOfBoundsException",
"$",
"e",
")",
"{",
"return",
"$",
"this",
"->",
"createEmailNotUniqueResponse",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"userArrayWithoutPassword",
"(",
"$",
"user",
")",
";",
"}"
] | Edit a user; requires the user to be logged in and the current password provided
@param Request $request
@return array | [
"Edit",
"a",
"user",
";",
"requires",
"the",
"user",
"to",
"be",
"logged",
"in",
"and",
"the",
"current",
"password",
"provided"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/User/UserController.php#L87-L111 |
5,271 | Apatis/Handler-Response | src/ResponseErrorAbstract.php | ResponseErrorAbstract.getOutputHandler | protected function getOutputHandler(
ServerRequestInterface $request,
ResponseInterface $response,
\Throwable $e
) : Run {
$whoops = new Run();
// disable write to output
$whoops->writeToOutput(false);
// push handler by Type
switch ($this->determineOutputType()) {
case self::TYPE_JSON:
$whoops->pushHandler([$this, 'renderJson']);
break;
case self::TYPE_XML:
$whoops->pushHandler([$this, 'renderXML']);
break;
case self::TYPE_PLAIN:
$whoops->pushHandler([$this, 'renderPlainText']);
break;
default:
$whoops->pushHandler([$this, 'renderHtml']);
}
return $whoops;
} | php | protected function getOutputHandler(
ServerRequestInterface $request,
ResponseInterface $response,
\Throwable $e
) : Run {
$whoops = new Run();
// disable write to output
$whoops->writeToOutput(false);
// push handler by Type
switch ($this->determineOutputType()) {
case self::TYPE_JSON:
$whoops->pushHandler([$this, 'renderJson']);
break;
case self::TYPE_XML:
$whoops->pushHandler([$this, 'renderXML']);
break;
case self::TYPE_PLAIN:
$whoops->pushHandler([$this, 'renderPlainText']);
break;
default:
$whoops->pushHandler([$this, 'renderHtml']);
}
return $whoops;
} | [
"protected",
"function",
"getOutputHandler",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
",",
"\\",
"Throwable",
"$",
"e",
")",
":",
"Run",
"{",
"$",
"whoops",
"=",
"new",
"Run",
"(",
")",
";",
"// disable write to output",
"$",
"whoops",
"->",
"writeToOutput",
"(",
"false",
")",
";",
"// push handler by Type",
"switch",
"(",
"$",
"this",
"->",
"determineOutputType",
"(",
")",
")",
"{",
"case",
"self",
"::",
"TYPE_JSON",
":",
"$",
"whoops",
"->",
"pushHandler",
"(",
"[",
"$",
"this",
",",
"'renderJson'",
"]",
")",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_XML",
":",
"$",
"whoops",
"->",
"pushHandler",
"(",
"[",
"$",
"this",
",",
"'renderXML'",
"]",
")",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_PLAIN",
":",
"$",
"whoops",
"->",
"pushHandler",
"(",
"[",
"$",
"this",
",",
"'renderPlainText'",
"]",
")",
";",
"break",
";",
"default",
":",
"$",
"whoops",
"->",
"pushHandler",
"(",
"[",
"$",
"this",
",",
"'renderHtml'",
"]",
")",
";",
"}",
"return",
"$",
"whoops",
";",
"}"
] | Parameter just for reference
@param ServerRequestInterface $request
@param ResponseInterface $response
@param \Throwable $e
@return Run | [
"Parameter",
"just",
"for",
"reference"
] | 289941fdeb82dd8d89b20857accd96b017cd6053 | https://github.com/Apatis/Handler-Response/blob/289941fdeb82dd8d89b20857accd96b017cd6053/src/ResponseErrorAbstract.php#L64-L88 |
5,272 | Apatis/Handler-Response | src/ResponseErrorAbstract.php | ResponseErrorAbstract.generateOutputHandler | protected function generateOutputHandler(
ServerRequestInterface $request,
ResponseInterface $response,
\Throwable $e
) : ResponseInterface {
$contentType = $this->getContentType();
// if content type has not been set
// get it from Request / Response
if (!$contentType) {
$contentType = $response->getHeaderLine('Content-Type')?: (
$request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE
);
$this->setContentType($contentType);
}
$this->cleanOutputBuffer();
$body = new RequestBody();
$handler = $this->getOutputHandler($request, $response, $e);
// disable quit
$handler->allowQuit(false);
// log
$this->logThrowable($e);
// write handler
$body->write($handler->handleException($e));
return $response->withBody($body)->withHeader('Content-Type', $contentType);
} | php | protected function generateOutputHandler(
ServerRequestInterface $request,
ResponseInterface $response,
\Throwable $e
) : ResponseInterface {
$contentType = $this->getContentType();
// if content type has not been set
// get it from Request / Response
if (!$contentType) {
$contentType = $response->getHeaderLine('Content-Type')?: (
$request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE
);
$this->setContentType($contentType);
}
$this->cleanOutputBuffer();
$body = new RequestBody();
$handler = $this->getOutputHandler($request, $response, $e);
// disable quit
$handler->allowQuit(false);
// log
$this->logThrowable($e);
// write handler
$body->write($handler->handleException($e));
return $response->withBody($body)->withHeader('Content-Type', $contentType);
} | [
"protected",
"function",
"generateOutputHandler",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
",",
"\\",
"Throwable",
"$",
"e",
")",
":",
"ResponseInterface",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"getContentType",
"(",
")",
";",
"// if content type has not been set",
"// get it from Request / Response",
"if",
"(",
"!",
"$",
"contentType",
")",
"{",
"$",
"contentType",
"=",
"$",
"response",
"->",
"getHeaderLine",
"(",
"'Content-Type'",
")",
"?",
":",
"(",
"$",
"request",
"->",
"getHeaderLine",
"(",
"'Content-Type'",
")",
"?",
":",
"static",
"::",
"DEFAULT_CONTENT_TYPE",
")",
";",
"$",
"this",
"->",
"setContentType",
"(",
"$",
"contentType",
")",
";",
"}",
"$",
"this",
"->",
"cleanOutputBuffer",
"(",
")",
";",
"$",
"body",
"=",
"new",
"RequestBody",
"(",
")",
";",
"$",
"handler",
"=",
"$",
"this",
"->",
"getOutputHandler",
"(",
"$",
"request",
",",
"$",
"response",
",",
"$",
"e",
")",
";",
"// disable quit",
"$",
"handler",
"->",
"allowQuit",
"(",
"false",
")",
";",
"// log",
"$",
"this",
"->",
"logThrowable",
"(",
"$",
"e",
")",
";",
"// write handler",
"$",
"body",
"->",
"write",
"(",
"$",
"handler",
"->",
"handleException",
"(",
"$",
"e",
")",
")",
";",
"return",
"$",
"response",
"->",
"withBody",
"(",
"$",
"body",
")",
"->",
"withHeader",
"(",
"'Content-Type'",
",",
"$",
"contentType",
")",
";",
"}"
] | Generate Output Handler For Response
@param ServerRequestInterface $request
@param ResponseInterface $response
@param \Throwable $e
@return ResponseInterface | [
"Generate",
"Output",
"Handler",
"For",
"Response"
] | 289941fdeb82dd8d89b20857accd96b017cd6053 | https://github.com/Apatis/Handler-Response/blob/289941fdeb82dd8d89b20857accd96b017cd6053/src/ResponseErrorAbstract.php#L256-L284 |
5,273 | avoo/QcmPublicBundle | Controller/QuestionnaireController.php | QuestionnaireController.replyAction | public function replyAction()
{
$questionInteract = $this->get('qcm_core.question.interact');
if (!$questionInteract->isStarted()) {
$this->get('session')->getFlashBag()->add('danger', 'qcm_public.questionnaire.not_started');
return $this->redirect($this->generateUrl('qcm_public_homepage'));
}
$question = $questionInteract->getQuestion();
$formType = $this->get('qcm_core.form.type.reply');
$form = $this->createForm($formType, $questionInteract->getUserConfiguration());
return $this->render('QcmPublicBundle:Question:reply.html.twig', array(
'question' => $question,
'form' => $form->createView()
));
} | php | public function replyAction()
{
$questionInteract = $this->get('qcm_core.question.interact');
if (!$questionInteract->isStarted()) {
$this->get('session')->getFlashBag()->add('danger', 'qcm_public.questionnaire.not_started');
return $this->redirect($this->generateUrl('qcm_public_homepage'));
}
$question = $questionInteract->getQuestion();
$formType = $this->get('qcm_core.form.type.reply');
$form = $this->createForm($formType, $questionInteract->getUserConfiguration());
return $this->render('QcmPublicBundle:Question:reply.html.twig', array(
'question' => $question,
'form' => $form->createView()
));
} | [
"public",
"function",
"replyAction",
"(",
")",
"{",
"$",
"questionInteract",
"=",
"$",
"this",
"->",
"get",
"(",
"'qcm_core.question.interact'",
")",
";",
"if",
"(",
"!",
"$",
"questionInteract",
"->",
"isStarted",
"(",
")",
")",
"{",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
"->",
"getFlashBag",
"(",
")",
"->",
"add",
"(",
"'danger'",
",",
"'qcm_public.questionnaire.not_started'",
")",
";",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'qcm_public_homepage'",
")",
")",
";",
"}",
"$",
"question",
"=",
"$",
"questionInteract",
"->",
"getQuestion",
"(",
")",
";",
"$",
"formType",
"=",
"$",
"this",
"->",
"get",
"(",
"'qcm_core.form.type.reply'",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"$",
"formType",
",",
"$",
"questionInteract",
"->",
"getUserConfiguration",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'QcmPublicBundle:Question:reply.html.twig'",
",",
"array",
"(",
"'question'",
"=>",
"$",
"question",
",",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
")",
")",
";",
"}"
] | Question reply action
@return Response | [
"Question",
"reply",
"action"
] | c527627020685707b037f112729bc980ebd8a8bd | https://github.com/avoo/QcmPublicBundle/blob/c527627020685707b037f112729bc980ebd8a8bd/Controller/QuestionnaireController.php#L48-L66 |
5,274 | avoo/QcmPublicBundle | Controller/QuestionnaireController.php | QuestionnaireController.prevQuexstionAction | public function prevQuexstionAction()
{
$questionInteract = $this->get('qcm_core.question.interact');
$questionInteract->getPrevQuestion();
return $this->redirect($this->generateUrl('qcm_public_question_reply'));
} | php | public function prevQuexstionAction()
{
$questionInteract = $this->get('qcm_core.question.interact');
$questionInteract->getPrevQuestion();
return $this->redirect($this->generateUrl('qcm_public_question_reply'));
} | [
"public",
"function",
"prevQuexstionAction",
"(",
")",
"{",
"$",
"questionInteract",
"=",
"$",
"this",
"->",
"get",
"(",
"'qcm_core.question.interact'",
")",
";",
"$",
"questionInteract",
"->",
"getPrevQuestion",
"(",
")",
";",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'qcm_public_question_reply'",
")",
")",
";",
"}"
] | Get previous question
@return RedirectResponse | [
"Get",
"previous",
"question"
] | c527627020685707b037f112729bc980ebd8a8bd | https://github.com/avoo/QcmPublicBundle/blob/c527627020685707b037f112729bc980ebd8a8bd/Controller/QuestionnaireController.php#L107-L113 |
5,275 | elastification/php-client | src/LoggerClient.php | LoggerClient.generateLogRequestData | private function generateLogRequestData(RequestInterface $request)
{
return array(
'class' => get_class($request),
'method' => $request->getMethod(),
'index' => $request->getIndex(),
'type' => $request->getType(),
'action' => $request->getAction(),
'response_class' => $request->getSupportedClass(),
'body' => $request->getBody()
);
} | php | private function generateLogRequestData(RequestInterface $request)
{
return array(
'class' => get_class($request),
'method' => $request->getMethod(),
'index' => $request->getIndex(),
'type' => $request->getType(),
'action' => $request->getAction(),
'response_class' => $request->getSupportedClass(),
'body' => $request->getBody()
);
} | [
"private",
"function",
"generateLogRequestData",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"return",
"array",
"(",
"'class'",
"=>",
"get_class",
"(",
"$",
"request",
")",
",",
"'method'",
"=>",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"'index'",
"=>",
"$",
"request",
"->",
"getIndex",
"(",
")",
",",
"'type'",
"=>",
"$",
"request",
"->",
"getType",
"(",
")",
",",
"'action'",
"=>",
"$",
"request",
"->",
"getAction",
"(",
")",
",",
"'response_class'",
"=>",
"$",
"request",
"->",
"getSupportedClass",
"(",
")",
",",
"'body'",
"=>",
"$",
"request",
"->",
"getBody",
"(",
")",
")",
";",
"}"
] | generates an array with all request information in it.
@param RequestInterface $request
@return array
@author Daniel Wendlandt | [
"generates",
"an",
"array",
"with",
"all",
"request",
"information",
"in",
"it",
"."
] | eb01be0905dd1eba7baa62f84492d82e4b3cae61 | https://github.com/elastification/php-client/blob/eb01be0905dd1eba7baa62f84492d82e4b3cae61/src/LoggerClient.php#L118-L129 |
5,276 | anklimsk/cakephp-basic-functions | Vendor/langcode-conv/zendframework/zend-filter/src/ToNull.php | ToNull.setType | public function setType($type = null)
{
if (is_array($type)) {
$detected = 0;
foreach ($type as $value) {
if (is_int($value)) {
$detected += $value;
} elseif (in_array($value, $this->constants)) {
$detected += array_search($value, $this->constants);
}
}
$type = $detected;
} elseif (is_string($type) && in_array($type, $this->constants)) {
$type = array_search($type, $this->constants);
}
if (!is_int($type) || ($type < 0) || ($type > self::TYPE_ALL)) {
throw new Exception\InvalidArgumentException(sprintf(
'Unknown type value "%s" (%s)',
$type,
gettype($type)
));
}
$this->options['type'] = $type;
return $this;
} | php | public function setType($type = null)
{
if (is_array($type)) {
$detected = 0;
foreach ($type as $value) {
if (is_int($value)) {
$detected += $value;
} elseif (in_array($value, $this->constants)) {
$detected += array_search($value, $this->constants);
}
}
$type = $detected;
} elseif (is_string($type) && in_array($type, $this->constants)) {
$type = array_search($type, $this->constants);
}
if (!is_int($type) || ($type < 0) || ($type > self::TYPE_ALL)) {
throw new Exception\InvalidArgumentException(sprintf(
'Unknown type value "%s" (%s)',
$type,
gettype($type)
));
}
$this->options['type'] = $type;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"type",
")",
")",
"{",
"$",
"detected",
"=",
"0",
";",
"foreach",
"(",
"$",
"type",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"$",
"detected",
"+=",
"$",
"value",
";",
"}",
"elseif",
"(",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"constants",
")",
")",
"{",
"$",
"detected",
"+=",
"array_search",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"constants",
")",
";",
"}",
"}",
"$",
"type",
"=",
"$",
"detected",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"type",
")",
"&&",
"in_array",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"constants",
")",
")",
"{",
"$",
"type",
"=",
"array_search",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"constants",
")",
";",
"}",
"if",
"(",
"!",
"is_int",
"(",
"$",
"type",
")",
"||",
"(",
"$",
"type",
"<",
"0",
")",
"||",
"(",
"$",
"type",
">",
"self",
"::",
"TYPE_ALL",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Unknown type value \"%s\" (%s)'",
",",
"$",
"type",
",",
"gettype",
"(",
"$",
"type",
")",
")",
")",
";",
"}",
"$",
"this",
"->",
"options",
"[",
"'type'",
"]",
"=",
"$",
"type",
";",
"return",
"$",
"this",
";",
"}"
] | Set boolean types
@param int|array $type
@throws Exception\InvalidArgumentException
@return self | [
"Set",
"boolean",
"types"
] | 7554e8b0b420fd3155593af7bf76b7ccbdc8701e | https://github.com/anklimsk/cakephp-basic-functions/blob/7554e8b0b420fd3155593af7bf76b7ccbdc8701e/Vendor/langcode-conv/zendframework/zend-filter/src/ToNull.php#L75-L102 |
5,277 | railsphp/framework | src/Rails/ActiveRecord/Adapter/Schema/Sqlite/Exporter.php | Exporter.export | public function export($schemaName = null)
{
$dump = [];
$sql =
"SELECT type, name, sql
FROM sqlite_master
WHERE type != 'index' AND name != 'sqlite_sequence'
ORDER BY type";
$rows = $this->connection->selectAll($sql);
foreach ($rows as $row) {
$dump[] = preg_replace('/\v/', ' ', $row['sql']);
}
return implode(";\n\n", $dump) . ";\n";
} | php | public function export($schemaName = null)
{
$dump = [];
$sql =
"SELECT type, name, sql
FROM sqlite_master
WHERE type != 'index' AND name != 'sqlite_sequence'
ORDER BY type";
$rows = $this->connection->selectAll($sql);
foreach ($rows as $row) {
$dump[] = preg_replace('/\v/', ' ', $row['sql']);
}
return implode(";\n\n", $dump) . ";\n";
} | [
"public",
"function",
"export",
"(",
"$",
"schemaName",
"=",
"null",
")",
"{",
"$",
"dump",
"=",
"[",
"]",
";",
"$",
"sql",
"=",
"\"SELECT type, name, sql\n FROM sqlite_master\n WHERE type != 'index' AND name != 'sqlite_sequence'\n ORDER BY type\"",
";",
"$",
"rows",
"=",
"$",
"this",
"->",
"connection",
"->",
"selectAll",
"(",
"$",
"sql",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"dump",
"[",
"]",
"=",
"preg_replace",
"(",
"'/\\v/'",
",",
"' '",
",",
"$",
"row",
"[",
"'sql'",
"]",
")",
";",
"}",
"return",
"implode",
"(",
"\";\\n\\n\"",
",",
"$",
"dump",
")",
".",
"\";\\n\"",
";",
"}"
] | Very basic exporter. It takes the "sql" column from
sqlite_master, and since there's not a standarized syntax by
taking SQL that way, it tries to turn queries into single-line
queries by removing all line breaks so it'll be easier to import
the queries. | [
"Very",
"basic",
"exporter",
".",
"It",
"takes",
"the",
"sql",
"column",
"from",
"sqlite_master",
"and",
"since",
"there",
"s",
"not",
"a",
"standarized",
"syntax",
"by",
"taking",
"SQL",
"that",
"way",
"it",
"tries",
"to",
"turn",
"queries",
"into",
"single",
"-",
"line",
"queries",
"by",
"removing",
"all",
"line",
"breaks",
"so",
"it",
"ll",
"be",
"easier",
"to",
"import",
"the",
"queries",
"."
] | 2ac9d3e493035dcc68f3c3812423327127327cd5 | https://github.com/railsphp/framework/blob/2ac9d3e493035dcc68f3c3812423327127327cd5/src/Rails/ActiveRecord/Adapter/Schema/Sqlite/Exporter.php#L15-L30 |
5,278 | jooorooo/embed | src/UrlRedirect.php | UrlRedirect.resolve | public static function resolve($oldUrl)
{
$url = new Url($oldUrl);
foreach (static::$urls as $method => $matches) {
if ($url->match($matches)) {
return static::$method($url);
}
}
return $oldUrl;
} | php | public static function resolve($oldUrl)
{
$url = new Url($oldUrl);
foreach (static::$urls as $method => $matches) {
if ($url->match($matches)) {
return static::$method($url);
}
}
return $oldUrl;
} | [
"public",
"static",
"function",
"resolve",
"(",
"$",
"oldUrl",
")",
"{",
"$",
"url",
"=",
"new",
"Url",
"(",
"$",
"oldUrl",
")",
";",
"foreach",
"(",
"static",
"::",
"$",
"urls",
"as",
"$",
"method",
"=>",
"$",
"matches",
")",
"{",
"if",
"(",
"$",
"url",
"->",
"match",
"(",
"$",
"matches",
")",
")",
"{",
"return",
"static",
"::",
"$",
"method",
"(",
"$",
"url",
")",
";",
"}",
"}",
"return",
"$",
"oldUrl",
";",
"}"
] | Resolve the url redirection
@param string $oldUrl Url to resolve
@return string | [
"Resolve",
"the",
"url",
"redirection"
] | 078e70a093f246dc8e10b92f909f9166932c4106 | https://github.com/jooorooo/embed/blob/078e70a093f246dc8e10b92f909f9166932c4106/src/UrlRedirect.php#L22-L33 |
5,279 | jooorooo/embed | src/UrlRedirect.php | UrlRedirect.hashBang | protected static function hashBang(Url $url)
{
if (($path = preg_replace('|^(/?!)|', '', $url->getFragment()))) {
return $url->withPath($url->getPath().$path)->getUrl();
}
return $url->getUrl();
} | php | protected static function hashBang(Url $url)
{
if (($path = preg_replace('|^(/?!)|', '', $url->getFragment()))) {
return $url->withPath($url->getPath().$path)->getUrl();
}
return $url->getUrl();
} | [
"protected",
"static",
"function",
"hashBang",
"(",
"Url",
"$",
"url",
")",
"{",
"if",
"(",
"(",
"$",
"path",
"=",
"preg_replace",
"(",
"'|^(/?!)|'",
",",
"''",
",",
"$",
"url",
"->",
"getFragment",
"(",
")",
")",
")",
")",
"{",
"return",
"$",
"url",
"->",
"withPath",
"(",
"$",
"url",
"->",
"getPath",
"(",
")",
".",
"$",
"path",
")",
"->",
"getUrl",
"(",
")",
";",
"}",
"return",
"$",
"url",
"->",
"getUrl",
"(",
")",
";",
"}"
] | Resolve an url with hashbang
@param Url $url
@return string | [
"Resolve",
"an",
"url",
"with",
"hashbang"
] | 078e70a093f246dc8e10b92f909f9166932c4106 | https://github.com/jooorooo/embed/blob/078e70a093f246dc8e10b92f909f9166932c4106/src/UrlRedirect.php#L74-L81 |
5,280 | FuturaSoft/Pabana | src/Html/Head/Link.php | Link.append | public function append($href, $rel = null, $type = null, $media = null)
{
self::$linkList->append(array($sHref, $sRel, $sType, $sMedia));
return $this;
} | php | public function append($href, $rel = null, $type = null, $media = null)
{
self::$linkList->append(array($sHref, $sRel, $sType, $sMedia));
return $this;
} | [
"public",
"function",
"append",
"(",
"$",
"href",
",",
"$",
"rel",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"$",
"media",
"=",
"null",
")",
"{",
"self",
"::",
"$",
"linkList",
"->",
"append",
"(",
"array",
"(",
"$",
"sHref",
",",
"$",
"sRel",
",",
"$",
"sType",
",",
"$",
"sMedia",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Append a link
@since 1.0
@param string $href Link path.
@param string $rel Rel attribute.
@param string $type Type attribute.
@param string $media Media attribute.
@return $this | [
"Append",
"a",
"link"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Html/Head/Link.php#L63-L67 |
5,281 | FuturaSoft/Pabana | src/Html/Head/Link.php | Link.prepend | public function prepend($href, $rel = null, $type = null, $media = null)
{
self::$linkList->prepend(array($href, $rel, $type, $media));
return $this;
} | php | public function prepend($href, $rel = null, $type = null, $media = null)
{
self::$linkList->prepend(array($href, $rel, $type, $media));
return $this;
} | [
"public",
"function",
"prepend",
"(",
"$",
"href",
",",
"$",
"rel",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"$",
"media",
"=",
"null",
")",
"{",
"self",
"::",
"$",
"linkList",
"->",
"prepend",
"(",
"array",
"(",
"$",
"href",
",",
"$",
"rel",
",",
"$",
"type",
",",
"$",
"media",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Prepend a link
@since 1.0
@param string $href Link path.
@param string $rel Rel attribute.
@param string $type Type attribute.
@param string $media Media attribute.
@return $this | [
"Prepend",
"a",
"link"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Html/Head/Link.php#L119-L123 |
5,282 | FuturaSoft/Pabana | src/Html/Head/Link.php | Link.render | public function render()
{
$htmlContent = '';
foreach (self::$linkList->toArray() as $link) {
$htmlContent .= '<link href="' . $link[0] . '"';
if (!empty($link[1])) {
$htmlContent .= ' rel="' . $link[1] . '"';
}
if (!empty($link[2])) {
$htmlContent .= ' type="' . $link[2] . '"';
}
if (!empty($link[3])) {
$htmlContent .= ' media="' . $link[3] . '"';
}
$htmlContent .= '>' . PHP_EOL;
}
return $htmlContent;
} | php | public function render()
{
$htmlContent = '';
foreach (self::$linkList->toArray() as $link) {
$htmlContent .= '<link href="' . $link[0] . '"';
if (!empty($link[1])) {
$htmlContent .= ' rel="' . $link[1] . '"';
}
if (!empty($link[2])) {
$htmlContent .= ' type="' . $link[2] . '"';
}
if (!empty($link[3])) {
$htmlContent .= ' media="' . $link[3] . '"';
}
$htmlContent .= '>' . PHP_EOL;
}
return $htmlContent;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"htmlContent",
"=",
"''",
";",
"foreach",
"(",
"self",
"::",
"$",
"linkList",
"->",
"toArray",
"(",
")",
"as",
"$",
"link",
")",
"{",
"$",
"htmlContent",
".=",
"'<link href=\"'",
".",
"$",
"link",
"[",
"0",
"]",
".",
"'\"'",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"link",
"[",
"1",
"]",
")",
")",
"{",
"$",
"htmlContent",
".=",
"' rel=\"'",
".",
"$",
"link",
"[",
"1",
"]",
".",
"'\"'",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"link",
"[",
"2",
"]",
")",
")",
"{",
"$",
"htmlContent",
".=",
"' type=\"'",
".",
"$",
"link",
"[",
"2",
"]",
".",
"'\"'",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"link",
"[",
"3",
"]",
")",
")",
"{",
"$",
"htmlContent",
".=",
"' media=\"'",
".",
"$",
"link",
"[",
"3",
"]",
".",
"'\"'",
";",
"}",
"$",
"htmlContent",
".=",
"'>'",
".",
"PHP_EOL",
";",
"}",
"return",
"$",
"htmlContent",
";",
"}"
] | Return HTML code for initialize all link in link list
@since 1.0
@return string Html code to initialize link | [
"Return",
"HTML",
"code",
"for",
"initialize",
"all",
"link",
"in",
"link",
"list"
] | b3a95eeb976042ac2a393cc10755a7adbc164c24 | https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Html/Head/Link.php#L143-L160 |
5,283 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByAthleteLabel | public function filterByAthleteLabel($athleteLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($athleteLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $athleteLabel)) {
$athleteLabel = str_replace('*', '%', $athleteLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_ATHLETE_LABEL, $athleteLabel, $comparison);
} | php | public function filterByAthleteLabel($athleteLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($athleteLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $athleteLabel)) {
$athleteLabel = str_replace('*', '%', $athleteLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_ATHLETE_LABEL, $athleteLabel, $comparison);
} | [
"public",
"function",
"filterByAthleteLabel",
"(",
"$",
"athleteLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"athleteLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"athleteLabel",
")",
")",
"{",
"$",
"athleteLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"athleteLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_ATHLETE_LABEL",
",",
"$",
"athleteLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the athlete_label column
Example usage:
<code>
$query->filterByAthleteLabel('fooValue'); // WHERE athlete_label = 'fooValue'
$query->filterByAthleteLabel('%fooValue%'); // WHERE athlete_label LIKE '%fooValue%'
</code>
@param string $athleteLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"athlete_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L462-L474 |
5,284 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByObjectSlug | public function filterByObjectSlug($objectSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectSlug)) {
$objectSlug = str_replace('*', '%', $objectSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_SLUG, $objectSlug, $comparison);
} | php | public function filterByObjectSlug($objectSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectSlug)) {
$objectSlug = str_replace('*', '%', $objectSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_SLUG, $objectSlug, $comparison);
} | [
"public",
"function",
"filterByObjectSlug",
"(",
"$",
"objectSlug",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"objectSlug",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"objectSlug",
")",
")",
"{",
"$",
"objectSlug",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"objectSlug",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_OBJECT_SLUG",
",",
"$",
"objectSlug",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the object_slug column
Example usage:
<code>
$query->filterByObjectSlug('fooValue'); // WHERE object_slug = 'fooValue'
$query->filterByObjectSlug('%fooValue%'); // WHERE object_slug LIKE '%fooValue%'
</code>
@param string $objectSlug The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"object_slug",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L491-L503 |
5,285 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByObjectLabel | public function filterByObjectLabel($objectLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectLabel)) {
$objectLabel = str_replace('*', '%', $objectLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_LABEL, $objectLabel, $comparison);
} | php | public function filterByObjectLabel($objectLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectLabel)) {
$objectLabel = str_replace('*', '%', $objectLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_LABEL, $objectLabel, $comparison);
} | [
"public",
"function",
"filterByObjectLabel",
"(",
"$",
"objectLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"objectLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"objectLabel",
")",
")",
"{",
"$",
"objectLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"objectLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_OBJECT_LABEL",
",",
"$",
"objectLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the object_label column
Example usage:
<code>
$query->filterByObjectLabel('fooValue'); // WHERE object_label = 'fooValue'
$query->filterByObjectLabel('%fooValue%'); // WHERE object_label LIKE '%fooValue%'
</code>
@param string $objectLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"object_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L520-L532 |
5,286 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByObjectPluralLabel | public function filterByObjectPluralLabel($objectPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectPluralLabel)) {
$objectPluralLabel = str_replace('*', '%', $objectPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_PLURAL_LABEL, $objectPluralLabel, $comparison);
} | php | public function filterByObjectPluralLabel($objectPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($objectPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $objectPluralLabel)) {
$objectPluralLabel = str_replace('*', '%', $objectPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_OBJECT_PLURAL_LABEL, $objectPluralLabel, $comparison);
} | [
"public",
"function",
"filterByObjectPluralLabel",
"(",
"$",
"objectPluralLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"objectPluralLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"objectPluralLabel",
")",
")",
"{",
"$",
"objectPluralLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"objectPluralLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_OBJECT_PLURAL_LABEL",
",",
"$",
"objectPluralLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the object_plural_label column
Example usage:
<code>
$query->filterByObjectPluralLabel('fooValue'); // WHERE object_plural_label = 'fooValue'
$query->filterByObjectPluralLabel('%fooValue%'); // WHERE object_plural_label LIKE '%fooValue%'
</code>
@param string $objectPluralLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"object_plural_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L549-L561 |
5,287 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterBySkillSlug | public function filterBySkillSlug($skillSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillSlug)) {
$skillSlug = str_replace('*', '%', $skillSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_SLUG, $skillSlug, $comparison);
} | php | public function filterBySkillSlug($skillSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillSlug)) {
$skillSlug = str_replace('*', '%', $skillSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_SLUG, $skillSlug, $comparison);
} | [
"public",
"function",
"filterBySkillSlug",
"(",
"$",
"skillSlug",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"skillSlug",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"skillSlug",
")",
")",
"{",
"$",
"skillSlug",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"skillSlug",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_SKILL_SLUG",
",",
"$",
"skillSlug",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the skill_slug column
Example usage:
<code>
$query->filterBySkillSlug('fooValue'); // WHERE skill_slug = 'fooValue'
$query->filterBySkillSlug('%fooValue%'); // WHERE skill_slug LIKE '%fooValue%'
</code>
@param string $skillSlug The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"skill_slug",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L578-L590 |
5,288 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterBySkillLabel | public function filterBySkillLabel($skillLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillLabel)) {
$skillLabel = str_replace('*', '%', $skillLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_LABEL, $skillLabel, $comparison);
} | php | public function filterBySkillLabel($skillLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillLabel)) {
$skillLabel = str_replace('*', '%', $skillLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_LABEL, $skillLabel, $comparison);
} | [
"public",
"function",
"filterBySkillLabel",
"(",
"$",
"skillLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"skillLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"skillLabel",
")",
")",
"{",
"$",
"skillLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"skillLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_SKILL_LABEL",
",",
"$",
"skillLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the skill_label column
Example usage:
<code>
$query->filterBySkillLabel('fooValue'); // WHERE skill_label = 'fooValue'
$query->filterBySkillLabel('%fooValue%'); // WHERE skill_label LIKE '%fooValue%'
</code>
@param string $skillLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"skill_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L607-L619 |
5,289 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterBySkillPluralLabel | public function filterBySkillPluralLabel($skillPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillPluralLabel)) {
$skillPluralLabel = str_replace('*', '%', $skillPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_PLURAL_LABEL, $skillPluralLabel, $comparison);
} | php | public function filterBySkillPluralLabel($skillPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillPluralLabel)) {
$skillPluralLabel = str_replace('*', '%', $skillPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_PLURAL_LABEL, $skillPluralLabel, $comparison);
} | [
"public",
"function",
"filterBySkillPluralLabel",
"(",
"$",
"skillPluralLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"skillPluralLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"skillPluralLabel",
")",
")",
"{",
"$",
"skillPluralLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"skillPluralLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_SKILL_PLURAL_LABEL",
",",
"$",
"skillPluralLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the skill_plural_label column
Example usage:
<code>
$query->filterBySkillPluralLabel('fooValue'); // WHERE skill_plural_label = 'fooValue'
$query->filterBySkillPluralLabel('%fooValue%'); // WHERE skill_plural_label LIKE '%fooValue%'
</code>
@param string $skillPluralLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"skill_plural_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L636-L648 |
5,290 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterBySkillPictureUrl | public function filterBySkillPictureUrl($skillPictureUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillPictureUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillPictureUrl)) {
$skillPictureUrl = str_replace('*', '%', $skillPictureUrl);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_PICTURE_URL, $skillPictureUrl, $comparison);
} | php | public function filterBySkillPictureUrl($skillPictureUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($skillPictureUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $skillPictureUrl)) {
$skillPictureUrl = str_replace('*', '%', $skillPictureUrl);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_SKILL_PICTURE_URL, $skillPictureUrl, $comparison);
} | [
"public",
"function",
"filterBySkillPictureUrl",
"(",
"$",
"skillPictureUrl",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"skillPictureUrl",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"skillPictureUrl",
")",
")",
"{",
"$",
"skillPictureUrl",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"skillPictureUrl",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_SKILL_PICTURE_URL",
",",
"$",
"skillPictureUrl",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the skill_picture_url column
Example usage:
<code>
$query->filterBySkillPictureUrl('fooValue'); // WHERE skill_picture_url = 'fooValue'
$query->filterBySkillPictureUrl('%fooValue%'); // WHERE skill_picture_url LIKE '%fooValue%'
</code>
@param string $skillPictureUrl The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"skill_picture_url",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L665-L677 |
5,291 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByGroupSlug | public function filterByGroupSlug($groupSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupSlug)) {
$groupSlug = str_replace('*', '%', $groupSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_SLUG, $groupSlug, $comparison);
} | php | public function filterByGroupSlug($groupSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupSlug)) {
$groupSlug = str_replace('*', '%', $groupSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_SLUG, $groupSlug, $comparison);
} | [
"public",
"function",
"filterByGroupSlug",
"(",
"$",
"groupSlug",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"groupSlug",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"groupSlug",
")",
")",
"{",
"$",
"groupSlug",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"groupSlug",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_GROUP_SLUG",
",",
"$",
"groupSlug",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the group_slug column
Example usage:
<code>
$query->filterByGroupSlug('fooValue'); // WHERE group_slug = 'fooValue'
$query->filterByGroupSlug('%fooValue%'); // WHERE group_slug LIKE '%fooValue%'
</code>
@param string $groupSlug The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"group_slug",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L694-L706 |
5,292 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByGroupLabel | public function filterByGroupLabel($groupLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupLabel)) {
$groupLabel = str_replace('*', '%', $groupLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_LABEL, $groupLabel, $comparison);
} | php | public function filterByGroupLabel($groupLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupLabel)) {
$groupLabel = str_replace('*', '%', $groupLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_LABEL, $groupLabel, $comparison);
} | [
"public",
"function",
"filterByGroupLabel",
"(",
"$",
"groupLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"groupLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"groupLabel",
")",
")",
"{",
"$",
"groupLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"groupLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_GROUP_LABEL",
",",
"$",
"groupLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the group_label column
Example usage:
<code>
$query->filterByGroupLabel('fooValue'); // WHERE group_label = 'fooValue'
$query->filterByGroupLabel('%fooValue%'); // WHERE group_label LIKE '%fooValue%'
</code>
@param string $groupLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"group_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L723-L735 |
5,293 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByGroupPluralLabel | public function filterByGroupPluralLabel($groupPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupPluralLabel)) {
$groupPluralLabel = str_replace('*', '%', $groupPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_PLURAL_LABEL, $groupPluralLabel, $comparison);
} | php | public function filterByGroupPluralLabel($groupPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($groupPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $groupPluralLabel)) {
$groupPluralLabel = str_replace('*', '%', $groupPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_GROUP_PLURAL_LABEL, $groupPluralLabel, $comparison);
} | [
"public",
"function",
"filterByGroupPluralLabel",
"(",
"$",
"groupPluralLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"groupPluralLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"groupPluralLabel",
")",
")",
"{",
"$",
"groupPluralLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"groupPluralLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_GROUP_PLURAL_LABEL",
",",
"$",
"groupPluralLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the group_plural_label column
Example usage:
<code>
$query->filterByGroupPluralLabel('fooValue'); // WHERE group_plural_label = 'fooValue'
$query->filterByGroupPluralLabel('%fooValue%'); // WHERE group_plural_label LIKE '%fooValue%'
</code>
@param string $groupPluralLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"group_plural_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L752-L764 |
5,294 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByTransitionLabel | public function filterByTransitionLabel($transitionLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionLabel)) {
$transitionLabel = str_replace('*', '%', $transitionLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITION_LABEL, $transitionLabel, $comparison);
} | php | public function filterByTransitionLabel($transitionLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionLabel)) {
$transitionLabel = str_replace('*', '%', $transitionLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITION_LABEL, $transitionLabel, $comparison);
} | [
"public",
"function",
"filterByTransitionLabel",
"(",
"$",
"transitionLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"transitionLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"transitionLabel",
")",
")",
"{",
"$",
"transitionLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"transitionLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_TRANSITION_LABEL",
",",
"$",
"transitionLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the transition_label column
Example usage:
<code>
$query->filterByTransitionLabel('fooValue'); // WHERE transition_label = 'fooValue'
$query->filterByTransitionLabel('%fooValue%'); // WHERE transition_label LIKE '%fooValue%'
</code>
@param string $transitionLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"transition_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L781-L793 |
5,295 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByTransitionPluralLabel | public function filterByTransitionPluralLabel($transitionPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionPluralLabel)) {
$transitionPluralLabel = str_replace('*', '%', $transitionPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITION_PLURAL_LABEL, $transitionPluralLabel, $comparison);
} | php | public function filterByTransitionPluralLabel($transitionPluralLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionPluralLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionPluralLabel)) {
$transitionPluralLabel = str_replace('*', '%', $transitionPluralLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITION_PLURAL_LABEL, $transitionPluralLabel, $comparison);
} | [
"public",
"function",
"filterByTransitionPluralLabel",
"(",
"$",
"transitionPluralLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"transitionPluralLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"transitionPluralLabel",
")",
")",
"{",
"$",
"transitionPluralLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"transitionPluralLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_TRANSITION_PLURAL_LABEL",
",",
"$",
"transitionPluralLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the transition_plural_label column
Example usage:
<code>
$query->filterByTransitionPluralLabel('fooValue'); // WHERE transition_plural_label = 'fooValue'
$query->filterByTransitionPluralLabel('%fooValue%'); // WHERE transition_plural_label LIKE '%fooValue%'
</code>
@param string $transitionPluralLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"transition_plural_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L810-L822 |
5,296 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByTransitionsSlug | public function filterByTransitionsSlug($transitionsSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionsSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionsSlug)) {
$transitionsSlug = str_replace('*', '%', $transitionsSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITIONS_SLUG, $transitionsSlug, $comparison);
} | php | public function filterByTransitionsSlug($transitionsSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($transitionsSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $transitionsSlug)) {
$transitionsSlug = str_replace('*', '%', $transitionsSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_TRANSITIONS_SLUG, $transitionsSlug, $comparison);
} | [
"public",
"function",
"filterByTransitionsSlug",
"(",
"$",
"transitionsSlug",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"transitionsSlug",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"transitionsSlug",
")",
")",
"{",
"$",
"transitionsSlug",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"transitionsSlug",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_TRANSITIONS_SLUG",
",",
"$",
"transitionsSlug",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the transitions_slug column
Example usage:
<code>
$query->filterByTransitionsSlug('fooValue'); // WHERE transitions_slug = 'fooValue'
$query->filterByTransitionsSlug('%fooValue%'); // WHERE transitions_slug LIKE '%fooValue%'
</code>
@param string $transitionsSlug The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"transitions_slug",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L839-L851 |
5,297 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByPositionSlug | public function filterByPositionSlug($positionSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($positionSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $positionSlug)) {
$positionSlug = str_replace('*', '%', $positionSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_POSITION_SLUG, $positionSlug, $comparison);
} | php | public function filterByPositionSlug($positionSlug = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($positionSlug)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $positionSlug)) {
$positionSlug = str_replace('*', '%', $positionSlug);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_POSITION_SLUG, $positionSlug, $comparison);
} | [
"public",
"function",
"filterByPositionSlug",
"(",
"$",
"positionSlug",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"positionSlug",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"positionSlug",
")",
")",
"{",
"$",
"positionSlug",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"positionSlug",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_POSITION_SLUG",
",",
"$",
"positionSlug",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the position_slug column
Example usage:
<code>
$query->filterByPositionSlug('fooValue'); // WHERE position_slug = 'fooValue'
$query->filterByPositionSlug('%fooValue%'); // WHERE position_slug LIKE '%fooValue%'
</code>
@param string $positionSlug The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"position_slug",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L868-L880 |
5,298 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByPositionLabel | public function filterByPositionLabel($positionLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($positionLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $positionLabel)) {
$positionLabel = str_replace('*', '%', $positionLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_POSITION_LABEL, $positionLabel, $comparison);
} | php | public function filterByPositionLabel($positionLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($positionLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $positionLabel)) {
$positionLabel = str_replace('*', '%', $positionLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(SportTableMap::COL_POSITION_LABEL, $positionLabel, $comparison);
} | [
"public",
"function",
"filterByPositionLabel",
"(",
"$",
"positionLabel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"positionLabel",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"positionLabel",
")",
")",
"{",
"$",
"positionLabel",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"positionLabel",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_POSITION_LABEL",
",",
"$",
"positionLabel",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the position_label column
Example usage:
<code>
$query->filterByPositionLabel('fooValue'); // WHERE position_label = 'fooValue'
$query->filterByPositionLabel('%fooValue%'); // WHERE position_label LIKE '%fooValue%'
</code>
@param string $positionLabel The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"position_label",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L897-L909 |
5,299 | gossi/trixionary | src/model/Base/SportQuery.php | SportQuery.filterByFeatureComposition | public function filterByFeatureComposition($featureComposition = null, $comparison = null)
{
if (is_string($featureComposition)) {
$featureComposition = in_array(strtolower($featureComposition), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(SportTableMap::COL_FEATURE_COMPOSITION, $featureComposition, $comparison);
} | php | public function filterByFeatureComposition($featureComposition = null, $comparison = null)
{
if (is_string($featureComposition)) {
$featureComposition = in_array(strtolower($featureComposition), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(SportTableMap::COL_FEATURE_COMPOSITION, $featureComposition, $comparison);
} | [
"public",
"function",
"filterByFeatureComposition",
"(",
"$",
"featureComposition",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"featureComposition",
")",
")",
"{",
"$",
"featureComposition",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"featureComposition",
")",
",",
"array",
"(",
"'false'",
",",
"'off'",
",",
"'-'",
",",
"'no'",
",",
"'n'",
",",
"'0'",
",",
"''",
")",
")",
"?",
"false",
":",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"SportTableMap",
"::",
"COL_FEATURE_COMPOSITION",
",",
"$",
"featureComposition",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the feature_composition column
Example usage:
<code>
$query->filterByFeatureComposition(true); // WHERE feature_composition = true
$query->filterByFeatureComposition('yes'); // WHERE feature_composition = true
</code>
@param boolean|string $featureComposition The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return $this|ChildSportQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"feature_composition",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/SportQuery.php#L929-L936 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.