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,100 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.getFormErrors | public function getFormErrors ()
{
return array_map(function (FormValidator $formValidator) {
return $formValidator->getErrorMsg();
}, array_filter($this->validators, function (FormValidator $validator) {
return !$validator->isValid();
}));
} | php | public function getFormErrors ()
{
return array_map(function (FormValidator $formValidator) {
return $formValidator->getErrorMsg();
}, array_filter($this->validators, function (FormValidator $validator) {
return !$validator->isValid();
}));
} | [
"public",
"function",
"getFormErrors",
"(",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"FormValidator",
"$",
"formValidator",
")",
"{",
"return",
"$",
"formValidator",
"->",
"getErrorMsg",
"(",
")",
";",
"}",
",",
"array_filter",
"(",
"$",
"this",
"->",
"validators",
",",
"function",
"(",
"FormValidator",
"$",
"validator",
")",
"{",
"return",
"!",
"$",
"validator",
"->",
"isValid",
"(",
")",
";",
"}",
")",
")",
";",
"}"
] | Get all the error messages for form-wide validators that returned invalid
@return string[] | [
"Get",
"all",
"the",
"error",
"messages",
"for",
"form",
"-",
"wide",
"validators",
"that",
"returned",
"invalid"
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L264-L271 |
5,101 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.getWrapBefore | public function getWrapBefore ()
{
$dataFields = $this->getDataFieldsHTML();
$errors = join(array_map(function ($errorMsg) {
return Form::renderFormError($errorMsg);
}, $this->getFormErrors()));
return "<form " . $this->getAttributesString() . ">" . $errors . $dataFields;
} | php | public function getWrapBefore ()
{
$dataFields = $this->getDataFieldsHTML();
$errors = join(array_map(function ($errorMsg) {
return Form::renderFormError($errorMsg);
}, $this->getFormErrors()));
return "<form " . $this->getAttributesString() . ">" . $errors . $dataFields;
} | [
"public",
"function",
"getWrapBefore",
"(",
")",
"{",
"$",
"dataFields",
"=",
"$",
"this",
"->",
"getDataFieldsHTML",
"(",
")",
";",
"$",
"errors",
"=",
"join",
"(",
"array_map",
"(",
"function",
"(",
"$",
"errorMsg",
")",
"{",
"return",
"Form",
"::",
"renderFormError",
"(",
"$",
"errorMsg",
")",
";",
"}",
",",
"$",
"this",
"->",
"getFormErrors",
"(",
")",
")",
")",
";",
"return",
"\"<form \"",
".",
"$",
"this",
"->",
"getAttributesString",
"(",
")",
".",
"\">\"",
".",
"$",
"errors",
".",
"$",
"dataFields",
";",
"}"
] | Gets the markup that is to be outputted before the actual contents of the form. This method could be used for
even more manual control over outputting with a custom markup.
@return string | [
"Gets",
"the",
"markup",
"that",
"is",
"to",
"be",
"outputted",
"before",
"the",
"actual",
"contents",
"of",
"the",
"form",
".",
"This",
"method",
"could",
"be",
"used",
"for",
"even",
"more",
"manual",
"control",
"over",
"outputting",
"with",
"a",
"custom",
"markup",
"."
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L278-L285 |
5,102 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.getFields | public function getFields ($includeInactiveFields = false)
{
$fields = array();
foreach ($this->getChildren(true, $includeInactiveFields) as $component)
if ($component instanceof Field)
array_push($fields, $component);
return $fields;
} | php | public function getFields ($includeInactiveFields = false)
{
$fields = array();
foreach ($this->getChildren(true, $includeInactiveFields) as $component)
if ($component instanceof Field)
array_push($fields, $component);
return $fields;
} | [
"public",
"function",
"getFields",
"(",
"$",
"includeInactiveFields",
"=",
"false",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getChildren",
"(",
"true",
",",
"$",
"includeInactiveFields",
")",
"as",
"$",
"component",
")",
"if",
"(",
"$",
"component",
"instanceof",
"Field",
")",
"array_push",
"(",
"$",
"fields",
",",
"$",
"component",
")",
";",
"return",
"$",
"fields",
";",
"}"
] | Retrieves an array of this form's fields
@param boolean $includeInactiveFields whether to include inactive fields as well
@return Field[] | [
"Retrieves",
"an",
"array",
"of",
"this",
"form",
"s",
"fields"
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L335-L342 |
5,103 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.submit | private function submit ()
{
foreach ($this->getFields() as $field)
/* @var $field Field */
$field->submit();
$this->isCallbacksubmitted = true;
foreach ($this->callback as $callback)
if (is_callable($callback))
call_user_func($callback, $this);
} | php | private function submit ()
{
foreach ($this->getFields() as $field)
/* @var $field Field */
$field->submit();
$this->isCallbacksubmitted = true;
foreach ($this->callback as $callback)
if (is_callable($callback))
call_user_func($callback, $this);
} | [
"private",
"function",
"submit",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"/* @var $field Field */",
"$",
"field",
"->",
"submit",
"(",
")",
";",
"$",
"this",
"->",
"isCallbacksubmitted",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"callback",
"as",
"$",
"callback",
")",
"if",
"(",
"is_callable",
"(",
"$",
"callback",
")",
")",
"call_user_func",
"(",
"$",
"callback",
",",
"$",
"this",
")",
";",
"}"
] | Submits the form internally. You're not usually supposed to call this function directly. | [
"Submits",
"the",
"form",
"internally",
".",
"You",
"re",
"not",
"usually",
"supposed",
"to",
"call",
"this",
"function",
"directly",
"."
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L385-L394 |
5,104 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.process | public function process ()
{
if ($this->isProcessed)
return;
$this->isProcessed = true;
foreach ($this->getFields() as $field)
/* @var $field Field */
$field->preprocess();
$this->isUserSubmitted = $this->getValue($this->getSubmitConfirmFieldName(), 'false') == 'true' || $this->forceSubmit;
if ($this->isUserSubmitted) {
foreach ($this->getFields() as $field)
$field->restoreValue($this->method);
$this->activateHandlers();
if ($this->isValid()) {
$this->submit();
}
}
} | php | public function process ()
{
if ($this->isProcessed)
return;
$this->isProcessed = true;
foreach ($this->getFields() as $field)
/* @var $field Field */
$field->preprocess();
$this->isUserSubmitted = $this->getValue($this->getSubmitConfirmFieldName(), 'false') == 'true' || $this->forceSubmit;
if ($this->isUserSubmitted) {
foreach ($this->getFields() as $field)
$field->restoreValue($this->method);
$this->activateHandlers();
if ($this->isValid()) {
$this->submit();
}
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isProcessed",
")",
"return",
";",
"$",
"this",
"->",
"isProcessed",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"/* @var $field Field */",
"$",
"field",
"->",
"preprocess",
"(",
")",
";",
"$",
"this",
"->",
"isUserSubmitted",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"this",
"->",
"getSubmitConfirmFieldName",
"(",
")",
",",
"'false'",
")",
"==",
"'true'",
"||",
"$",
"this",
"->",
"forceSubmit",
";",
"if",
"(",
"$",
"this",
"->",
"isUserSubmitted",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"$",
"field",
"->",
"restoreValue",
"(",
"$",
"this",
"->",
"method",
")",
";",
"$",
"this",
"->",
"activateHandlers",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"this",
"->",
"submit",
"(",
")",
";",
"}",
"}",
"}"
] | Check if form was activated, then validates, calls handlers, then submits. Call this function before displaying
the form. | [
"Check",
"if",
"form",
"was",
"activated",
"then",
"validates",
"calls",
"handlers",
"then",
"submits",
".",
"Call",
"this",
"function",
"before",
"displaying",
"the",
"form",
"."
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L421-L440 |
5,105 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.getValues | function getValues ($useName = true, $includeDataFields = true)
{
$values = array();
foreach ($this->getFields() as $field)
/* @var $field Field */
if ($field->getCollectData()) {
$key = $useName ? $field->getName() : $field->getLocalSlug();
$values[$key] = $field->getValue();
}
if ($includeDataFields)
$values = array_merge($values, $this->dataFields);
return $values;
} | php | function getValues ($useName = true, $includeDataFields = true)
{
$values = array();
foreach ($this->getFields() as $field)
/* @var $field Field */
if ($field->getCollectData()) {
$key = $useName ? $field->getName() : $field->getLocalSlug();
$values[$key] = $field->getValue();
}
if ($includeDataFields)
$values = array_merge($values, $this->dataFields);
return $values;
} | [
"function",
"getValues",
"(",
"$",
"useName",
"=",
"true",
",",
"$",
"includeDataFields",
"=",
"true",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"/* @var $field Field */",
"if",
"(",
"$",
"field",
"->",
"getCollectData",
"(",
")",
")",
"{",
"$",
"key",
"=",
"$",
"useName",
"?",
"$",
"field",
"->",
"getName",
"(",
")",
":",
"$",
"field",
"->",
"getLocalSlug",
"(",
")",
";",
"$",
"values",
"[",
"$",
"key",
"]",
"=",
"$",
"field",
"->",
"getValue",
"(",
")",
";",
"}",
"if",
"(",
"$",
"includeDataFields",
")",
"$",
"values",
"=",
"array_merge",
"(",
"$",
"values",
",",
"$",
"this",
"->",
"dataFields",
")",
";",
"return",
"$",
"values",
";",
"}"
] | Gets a complete associated array containing all the data that needs to be stored
@param bool $useName Whether to use the field name (if not, the fields shorter local slug is used)
@param bool $includeDataFields Whether to include the data fields
@return array | [
"Gets",
"a",
"complete",
"associated",
"array",
"containing",
"all",
"the",
"data",
"that",
"needs",
"to",
"be",
"stored"
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L486-L498 |
5,106 | sgtlambda/fieldwork | src/fieldwork/Form.php | Form.setValues | function setValues (array $values = array())
{
foreach ($this->getFields() as $field)
if (array_key_exists($field->getName(), $values))
$field->setValue($values[$field->getName()]);
foreach ($this->dataFields as $dataKey => $dataVal)
if (array_key_exists($dataKey, $values))
$this->dataFields[$dataKey] = $values[$dataKey];
} | php | function setValues (array $values = array())
{
foreach ($this->getFields() as $field)
if (array_key_exists($field->getName(), $values))
$field->setValue($values[$field->getName()]);
foreach ($this->dataFields as $dataKey => $dataVal)
if (array_key_exists($dataKey, $values))
$this->dataFields[$dataKey] = $values[$dataKey];
} | [
"function",
"setValues",
"(",
"array",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
"as",
"$",
"field",
")",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
"->",
"getName",
"(",
")",
",",
"$",
"values",
")",
")",
"$",
"field",
"->",
"setValue",
"(",
"$",
"values",
"[",
"$",
"field",
"->",
"getName",
"(",
")",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"dataFields",
"as",
"$",
"dataKey",
"=>",
"$",
"dataVal",
")",
"if",
"(",
"array_key_exists",
"(",
"$",
"dataKey",
",",
"$",
"values",
")",
")",
"$",
"this",
"->",
"dataFields",
"[",
"$",
"dataKey",
"]",
"=",
"$",
"values",
"[",
"$",
"dataKey",
"]",
";",
"}"
] | Restores the values from an associated array. Only defined properties will be overwritten
@param array $values | [
"Restores",
"the",
"values",
"from",
"an",
"associated",
"array",
".",
"Only",
"defined",
"properties",
"will",
"be",
"overwritten"
] | ba18939c9822db4dc84947d90979cfb0da072cb0 | https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/Form.php#L505-L513 |
5,107 | Sowapps/orpheus-rendering | src/Rendering/HTMLRendering.php | HTMLRendering.display | public function display($layout=null, $env=array()) {
if( $layout === NULL ) {
throw new \Exception("Invalid Rendering Model");
}
$rendering = $this->getCurrentRendering();
if( $rendering ) {
$env += $rendering[1];
}
// TODO Merge layoutStack and rendering stack
$prevLayouts = count(static::$layoutStack);
$this->pushToStack($layout, $env);
extract($env, EXTR_SKIP);
// Store this to end layouts, static because ob_* functions are globals
// static::$current = $this;
include $this->getLayoutPath($layout);
$this->pullFromStack();
$currentLayouts = count(static::$layoutStack);
while( $currentLayouts > $prevLayouts && static::endCurrentLayout($env) ) {
$currentLayouts--;
}
} | php | public function display($layout=null, $env=array()) {
if( $layout === NULL ) {
throw new \Exception("Invalid Rendering Model");
}
$rendering = $this->getCurrentRendering();
if( $rendering ) {
$env += $rendering[1];
}
// TODO Merge layoutStack and rendering stack
$prevLayouts = count(static::$layoutStack);
$this->pushToStack($layout, $env);
extract($env, EXTR_SKIP);
// Store this to end layouts, static because ob_* functions are globals
// static::$current = $this;
include $this->getLayoutPath($layout);
$this->pullFromStack();
$currentLayouts = count(static::$layoutStack);
while( $currentLayouts > $prevLayouts && static::endCurrentLayout($env) ) {
$currentLayouts--;
}
} | [
"public",
"function",
"display",
"(",
"$",
"layout",
"=",
"null",
",",
"$",
"env",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"layout",
"===",
"NULL",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Invalid Rendering Model\"",
")",
";",
"}",
"$",
"rendering",
"=",
"$",
"this",
"->",
"getCurrentRendering",
"(",
")",
";",
"if",
"(",
"$",
"rendering",
")",
"{",
"$",
"env",
"+=",
"$",
"rendering",
"[",
"1",
"]",
";",
"}",
"// TODO Merge layoutStack and rendering stack",
"$",
"prevLayouts",
"=",
"count",
"(",
"static",
"::",
"$",
"layoutStack",
")",
";",
"$",
"this",
"->",
"pushToStack",
"(",
"$",
"layout",
",",
"$",
"env",
")",
";",
"extract",
"(",
"$",
"env",
",",
"EXTR_SKIP",
")",
";",
"// Store this to end layouts, static because ob_* functions are globals",
"//\t\tstatic::$current = $this;",
"include",
"$",
"this",
"->",
"getLayoutPath",
"(",
"$",
"layout",
")",
";",
"$",
"this",
"->",
"pullFromStack",
"(",
")",
";",
"$",
"currentLayouts",
"=",
"count",
"(",
"static",
"::",
"$",
"layoutStack",
")",
";",
"while",
"(",
"$",
"currentLayouts",
">",
"$",
"prevLayouts",
"&&",
"static",
"::",
"endCurrentLayout",
"(",
"$",
"env",
")",
")",
"{",
"$",
"currentLayouts",
"--",
";",
"}",
"}"
] | Display the model, allow an absolute path to the template file.
{@inheritDoc}
@see \Orpheus\Rendering\Rendering::display()
@param string $layout The model to use
@param array $env An environment variable | [
"Display",
"the",
"model",
"allow",
"an",
"absolute",
"path",
"to",
"the",
"template",
"file",
"."
] | 415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156 | https://github.com/Sowapps/orpheus-rendering/blob/415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156/src/Rendering/HTMLRendering.php#L124-L147 |
5,108 | Sowapps/orpheus-rendering | src/Rendering/HTMLRendering.php | HTMLRendering.renderReport | public static function renderReport($report, $domain, $type, $stream) {
$report = nl2br($report);
$rendering = new static();
if( $rendering->existsLayoutPath('report-'.$type) ) {
return $rendering->render('report-'.$type, array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
}
if( $rendering->existsLayoutPath('report') ) {
return $rendering->render('report', array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
}
// if( file_exists(static::getLayoutPath('report-'.$type)) ) {
// return static::doRender('report-'.$type, array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
// }
// if( file_exists(static::getLayoutPath('report')) ) {
// return static::doRender('report', array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
// }
return '
<div class="report report_'.$stream.' '.$type.' '.$domain.'">'.nl2br($report).'</div>';
} | php | public static function renderReport($report, $domain, $type, $stream) {
$report = nl2br($report);
$rendering = new static();
if( $rendering->existsLayoutPath('report-'.$type) ) {
return $rendering->render('report-'.$type, array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
}
if( $rendering->existsLayoutPath('report') ) {
return $rendering->render('report', array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
}
// if( file_exists(static::getLayoutPath('report-'.$type)) ) {
// return static::doRender('report-'.$type, array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
// }
// if( file_exists(static::getLayoutPath('report')) ) {
// return static::doRender('report', array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));
// }
return '
<div class="report report_'.$stream.' '.$type.' '.$domain.'">'.nl2br($report).'</div>';
} | [
"public",
"static",
"function",
"renderReport",
"(",
"$",
"report",
",",
"$",
"domain",
",",
"$",
"type",
",",
"$",
"stream",
")",
"{",
"$",
"report",
"=",
"nl2br",
"(",
"$",
"report",
")",
";",
"$",
"rendering",
"=",
"new",
"static",
"(",
")",
";",
"if",
"(",
"$",
"rendering",
"->",
"existsLayoutPath",
"(",
"'report-'",
".",
"$",
"type",
")",
")",
"{",
"return",
"$",
"rendering",
"->",
"render",
"(",
"'report-'",
".",
"$",
"type",
",",
"array",
"(",
"'Report'",
"=>",
"$",
"report",
",",
"'Domain'",
"=>",
"$",
"domain",
",",
"'Type'",
"=>",
"$",
"type",
",",
"'Stream'",
"=>",
"$",
"stream",
")",
")",
";",
"}",
"if",
"(",
"$",
"rendering",
"->",
"existsLayoutPath",
"(",
"'report'",
")",
")",
"{",
"return",
"$",
"rendering",
"->",
"render",
"(",
"'report'",
",",
"array",
"(",
"'Report'",
"=>",
"$",
"report",
",",
"'Domain'",
"=>",
"$",
"domain",
",",
"'Type'",
"=>",
"$",
"type",
",",
"'Stream'",
"=>",
"$",
"stream",
")",
")",
";",
"}",
"// \t\tif( file_exists(static::getLayoutPath('report-'.$type)) ) {",
"// \t\t\treturn static::doRender('report-'.$type, array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));",
"// \t\t}",
"// \t\tif( file_exists(static::getLayoutPath('report')) ) {",
"// \t\t\treturn static::doRender('report', array('Report'=>$report, 'Domain'=>$domain, 'Type'=>$type, 'Stream'=>$stream));",
"// \t\t}",
"return",
"'\n\t\t<div class=\"report report_'",
".",
"$",
"stream",
".",
"' '",
".",
"$",
"type",
".",
"' '",
".",
"$",
"domain",
".",
"'\">'",
".",
"nl2br",
"(",
"$",
"report",
")",
".",
"'</div>'",
";",
"}"
] | Render the given report as HTML
@param string $report
@param string $domain
@param string $type
@param string $stream
@return string | [
"Render",
"the",
"given",
"report",
"as",
"HTML"
] | 415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156 | https://github.com/Sowapps/orpheus-rendering/blob/415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156/src/Rendering/HTMLRendering.php#L196-L213 |
5,109 | Sowapps/orpheus-rendering | src/Rendering/HTMLRendering.php | HTMLRendering.addThemeCSSFile | public function addThemeCSSFile($filename, $type=null) {
$this->addCSSURL($this->getCSSURL().$filename, $type);
} | php | public function addThemeCSSFile($filename, $type=null) {
$this->addCSSURL($this->getCSSURL().$filename, $type);
} | [
"public",
"function",
"addThemeCSSFile",
"(",
"$",
"filename",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addCSSURL",
"(",
"$",
"this",
"->",
"getCSSURL",
"(",
")",
".",
"$",
"filename",
",",
"$",
"type",
")",
";",
"}"
] | Add a theme css file to the list
@param string $filename
@param string $type | [
"Add",
"a",
"theme",
"css",
"file",
"to",
"the",
"list"
] | 415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156 | https://github.com/Sowapps/orpheus-rendering/blob/415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156/src/Rendering/HTMLRendering.php#L221-L223 |
5,110 | Sowapps/orpheus-rendering | src/Rendering/HTMLRendering.php | HTMLRendering.addThemeJSFile | public function addThemeJSFile($filename, $type=null) {
$this->addJSURL($this->getJSURL().$filename, $type);
} | php | public function addThemeJSFile($filename, $type=null) {
$this->addJSURL($this->getJSURL().$filename, $type);
} | [
"public",
"function",
"addThemeJSFile",
"(",
"$",
"filename",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addJSURL",
"(",
"$",
"this",
"->",
"getJSURL",
"(",
")",
".",
"$",
"filename",
",",
"$",
"type",
")",
";",
"}"
] | Add a theme js file to the list
@param string $filename
@param string $type | [
"Add",
"a",
"theme",
"js",
"file",
"to",
"the",
"list"
] | 415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156 | https://github.com/Sowapps/orpheus-rendering/blob/415ae6d4f0c2256a67dc76c6fa104d6c3ccb4156/src/Rendering/HTMLRendering.php#L251-L253 |
5,111 | sgoendoer/sonic | src/Sonic.php | Sonic.& | public static function &initInstance(EntityAuthData $platform)
{
if(NULL === self::$_instance)
{
self::$_instance = new Sonic();
}
self::$_instance->platformAuthData = $platform;
self::$logger = new Logger('sonic');
self::$logger->pushHandler(new StreamHandler(Configuration::getLogfile()));
self::$_instance->setContext(Sonic::CONTEXT_PLATFORM); // needs to be explicitly set to "user"
return self::$_instance;
} | php | public static function &initInstance(EntityAuthData $platform)
{
if(NULL === self::$_instance)
{
self::$_instance = new Sonic();
}
self::$_instance->platformAuthData = $platform;
self::$logger = new Logger('sonic');
self::$logger->pushHandler(new StreamHandler(Configuration::getLogfile()));
self::$_instance->setContext(Sonic::CONTEXT_PLATFORM); // needs to be explicitly set to "user"
return self::$_instance;
} | [
"public",
"static",
"function",
"&",
"initInstance",
"(",
"EntityAuthData",
"$",
"platform",
")",
"{",
"if",
"(",
"NULL",
"===",
"self",
"::",
"$",
"_instance",
")",
"{",
"self",
"::",
"$",
"_instance",
"=",
"new",
"Sonic",
"(",
")",
";",
"}",
"self",
"::",
"$",
"_instance",
"->",
"platformAuthData",
"=",
"$",
"platform",
";",
"self",
"::",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'sonic'",
")",
";",
"self",
"::",
"$",
"logger",
"->",
"pushHandler",
"(",
"new",
"StreamHandler",
"(",
"Configuration",
"::",
"getLogfile",
"(",
")",
")",
")",
";",
"self",
"::",
"$",
"_instance",
"->",
"setContext",
"(",
"Sonic",
"::",
"CONTEXT_PLATFORM",
")",
";",
"// needs to be explicitly set to \"user\"\r",
"return",
"self",
"::",
"$",
"_instance",
";",
"}"
] | initializes the Sonic SDK using EntityAuthData of the platform
@param $config Configuration object
@param $platform EntityAuthData object of the platform
@return The Sonic instance | [
"initializes",
"the",
"Sonic",
"SDK",
"using",
"EntityAuthData",
"of",
"the",
"platform"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L76-L91 |
5,112 | sgoendoer/sonic | src/Sonic.php | Sonic.setSocialRecordCaching | public function setSocialRecordCaching(ISocialRecordCaching $srCachingObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\Identity\ISocialRecordCaching', class_implements($srCachingObject)))
{
throw new SonicRuntimeException('SocialRecordCaching must implement goendoer\Sonic\Identity\ISocialRecordCaching');
}
else
$this->socialRecordCache = $srCachingObject;
return $this; // TODO make static?
} | php | public function setSocialRecordCaching(ISocialRecordCaching $srCachingObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\Identity\ISocialRecordCaching', class_implements($srCachingObject)))
{
throw new SonicRuntimeException('SocialRecordCaching must implement goendoer\Sonic\Identity\ISocialRecordCaching');
}
else
$this->socialRecordCache = $srCachingObject;
return $this; // TODO make static?
} | [
"public",
"function",
"setSocialRecordCaching",
"(",
"ISocialRecordCaching",
"$",
"srCachingObject",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'sgoendoer\\Sonic\\Identity\\ISocialRecordCaching'",
",",
"class_implements",
"(",
"$",
"srCachingObject",
")",
")",
")",
"{",
"throw",
"new",
"SonicRuntimeException",
"(",
"'SocialRecordCaching must implement goendoer\\Sonic\\Identity\\ISocialRecordCaching'",
")",
";",
"}",
"else",
"$",
"this",
"->",
"socialRecordCache",
"=",
"$",
"srCachingObject",
";",
"return",
"$",
"this",
";",
"// TODO make static?\r",
"}"
] | sets the SocialRecordCaching instance
@param $srCachingObject The ISocialRecordCaching instance
@return Sonic instance | [
"sets",
"the",
"SocialRecordCaching",
"instance"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L129-L141 |
5,113 | sgoendoer/sonic | src/Sonic.php | Sonic.socialRecordCachingEnabled | public static function socialRecordCachingEnabled()
{
if(self::$_instance === NULL)
return false;
if(self::$_instance->socialRecordCache === NULL)
return false;
else
return true;
} | php | public static function socialRecordCachingEnabled()
{
if(self::$_instance === NULL)
return false;
if(self::$_instance->socialRecordCache === NULL)
return false;
else
return true;
} | [
"public",
"static",
"function",
"socialRecordCachingEnabled",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"return",
"false",
";",
"if",
"(",
"self",
"::",
"$",
"_instance",
"->",
"socialRecordCache",
"===",
"NULL",
")",
"return",
"false",
";",
"else",
"return",
"true",
";",
"}"
] | determines, if SocialRecordCaching is enabled
@return true, if SocialRecordCaching is enabled, else false | [
"determines",
"if",
"SocialRecordCaching",
"is",
"enabled"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L148-L156 |
5,114 | sgoendoer/sonic | src/Sonic.php | Sonic.getSocialRecordCaching | public static function getSocialRecordCaching()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->socialRecordCache != NULL)
return self::$_instance->socialRecordCache;
else
return NULL;
} | php | public static function getSocialRecordCaching()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->socialRecordCache != NULL)
return self::$_instance->socialRecordCache;
else
return NULL;
} | [
"public",
"static",
"function",
"getSocialRecordCaching",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"self",
"::",
"$",
"_instance",
"->",
"socialRecordCache",
"!=",
"NULL",
")",
"return",
"self",
"::",
"$",
"_instance",
"->",
"socialRecordCache",
";",
"else",
"return",
"NULL",
";",
"}"
] | returns the SocialRecordCaching instance
@return if set, the SocialRecordCaching instance | [
"returns",
"the",
"SocialRecordCaching",
"instance"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L163-L172 |
5,115 | sgoendoer/sonic | src/Sonic.php | Sonic.setUniqueIDManager | public function setUniqueIDManager(IUniqueIDManager $uniqueIDManagerObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\Crypt\IUniqueIDManager', class_implements($uniqueIDManagerObject)))
{
throw new SonicRuntimeException('UniqueIDManager must implement sgoendoer\Sonic\Crypt\IUniqueIDManager');
}
else
$this->uniqueIDManager = $uniqueIDManagerObject;
return self::$_instance;
} | php | public function setUniqueIDManager(IUniqueIDManager $uniqueIDManagerObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\Crypt\IUniqueIDManager', class_implements($uniqueIDManagerObject)))
{
throw new SonicRuntimeException('UniqueIDManager must implement sgoendoer\Sonic\Crypt\IUniqueIDManager');
}
else
$this->uniqueIDManager = $uniqueIDManagerObject;
return self::$_instance;
} | [
"public",
"function",
"setUniqueIDManager",
"(",
"IUniqueIDManager",
"$",
"uniqueIDManagerObject",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'sgoendoer\\Sonic\\Crypt\\IUniqueIDManager'",
",",
"class_implements",
"(",
"$",
"uniqueIDManagerObject",
")",
")",
")",
"{",
"throw",
"new",
"SonicRuntimeException",
"(",
"'UniqueIDManager must implement sgoendoer\\Sonic\\Crypt\\IUniqueIDManager'",
")",
";",
"}",
"else",
"$",
"this",
"->",
"uniqueIDManager",
"=",
"$",
"uniqueIDManagerObject",
";",
"return",
"self",
"::",
"$",
"_instance",
";",
"}"
] | sets the UniqueIDManager
@param $uniqueIDManagerObject The IUniqueIDManager instance
@return Sonic instance | [
"sets",
"the",
"UniqueIDManager"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L180-L193 |
5,116 | sgoendoer/sonic | src/Sonic.php | Sonic.getUniqueIDManager | public static function getUniqueIDManager()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->uniqueIDManager != NULL)
return self::$_instance->uniqueIDManager;
else
return NULL;
} | php | public static function getUniqueIDManager()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->uniqueIDManager != NULL)
return self::$_instance->uniqueIDManager;
else
return NULL;
} | [
"public",
"static",
"function",
"getUniqueIDManager",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"self",
"::",
"$",
"_instance",
"->",
"uniqueIDManager",
"!=",
"NULL",
")",
"return",
"self",
"::",
"$",
"_instance",
"->",
"uniqueIDManager",
";",
"else",
"return",
"NULL",
";",
"}"
] | returns the UniqueIDManager instance, if set
@return UniqueIDManager instance if set, else NULL | [
"returns",
"the",
"UniqueIDManager",
"instance",
"if",
"set"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L200-L209 |
5,117 | sgoendoer/sonic | src/Sonic.php | Sonic.setAccessControlManager | public function setAccessControlManager(AccessControlManager $accessControlManagerObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\AccessControl\AccessControlManager', class_parents($accessControlManagerObject)))
{
throw new SonicRuntimeException('AccessControlManager must implement sgoendoer\Sonic\AccessControl\AccessControlManager');
}
else
$this->accessControlManager = $accessControlManagerObject;
return self::$_instance;
} | php | public function setAccessControlManager(AccessControlManager $accessControlManagerObject)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(!array_key_exists('sgoendoer\Sonic\AccessControl\AccessControlManager', class_parents($accessControlManagerObject)))
{
throw new SonicRuntimeException('AccessControlManager must implement sgoendoer\Sonic\AccessControl\AccessControlManager');
}
else
$this->accessControlManager = $accessControlManagerObject;
return self::$_instance;
} | [
"public",
"function",
"setAccessControlManager",
"(",
"AccessControlManager",
"$",
"accessControlManagerObject",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'sgoendoer\\Sonic\\AccessControl\\AccessControlManager'",
",",
"class_parents",
"(",
"$",
"accessControlManagerObject",
")",
")",
")",
"{",
"throw",
"new",
"SonicRuntimeException",
"(",
"'AccessControlManager must implement sgoendoer\\Sonic\\AccessControl\\AccessControlManager'",
")",
";",
"}",
"else",
"$",
"this",
"->",
"accessControlManager",
"=",
"$",
"accessControlManagerObject",
";",
"return",
"self",
"::",
"$",
"_instance",
";",
"}"
] | sets the AccessControlManager
@param $accessControlManagerObject The AccessControlManager instance
@return Sonic instance | [
"sets",
"the",
"AccessControlManager"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L217-L230 |
5,118 | sgoendoer/sonic | src/Sonic.php | Sonic.getAccessControlManager | public static function getAccessControlManager()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->accessControlManager != NULL)
return self::$_instance->accessControlManager;
else
throw new AccessControlManagerException('AccessControlManager instance not found');
} | php | public static function getAccessControlManager()
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
if(self::$_instance->accessControlManager != NULL)
return self::$_instance->accessControlManager;
else
throw new AccessControlManagerException('AccessControlManager instance not found');
} | [
"public",
"static",
"function",
"getAccessControlManager",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"if",
"(",
"self",
"::",
"$",
"_instance",
"->",
"accessControlManager",
"!=",
"NULL",
")",
"return",
"self",
"::",
"$",
"_instance",
"->",
"accessControlManager",
";",
"else",
"throw",
"new",
"AccessControlManagerException",
"(",
"'AccessControlManager instance not found'",
")",
";",
"}"
] | returns the AccessControlManager instance
@return the AccessControlManager instance | [
"returns",
"the",
"AccessControlManager",
"instance"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L237-L246 |
5,119 | sgoendoer/sonic | src/Sonic.php | Sonic.setPlatformAuthData | public static function setPlatformAuthData(EntityAuthData $entityAuthData)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
self::$_instance->platformAuthData = $entityAuthData;
return self::$_instance;
} | php | public static function setPlatformAuthData(EntityAuthData $entityAuthData)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
self::$_instance->platformAuthData = $entityAuthData;
return self::$_instance;
} | [
"public",
"static",
"function",
"setPlatformAuthData",
"(",
"EntityAuthData",
"$",
"entityAuthData",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"self",
"::",
"$",
"_instance",
"->",
"platformAuthData",
"=",
"$",
"entityAuthData",
";",
"return",
"self",
"::",
"$",
"_instance",
";",
"}"
] | set the platform's AuthData
@param EntityAuthData object of the platform | [
"set",
"the",
"platform",
"s",
"AuthData"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L253-L261 |
5,120 | sgoendoer/sonic | src/Sonic.php | Sonic.setUserAuthData | public static function setUserAuthData(EntityAuthData $entityAuthData)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
self::$_instance->userAuthData = $entityAuthData;
self::$_instance->setContext(Sonic::CONTEXT_USER);
return self::$_instance;
} | php | public static function setUserAuthData(EntityAuthData $entityAuthData)
{
if(self::$_instance === NULL)
throw new SonicRuntimeException('Sonic instance not initialized');
self::$_instance->userAuthData = $entityAuthData;
self::$_instance->setContext(Sonic::CONTEXT_USER);
return self::$_instance;
} | [
"public",
"static",
"function",
"setUserAuthData",
"(",
"EntityAuthData",
"$",
"entityAuthData",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_instance",
"===",
"NULL",
")",
"throw",
"new",
"SonicRuntimeException",
"(",
"'Sonic instance not initialized'",
")",
";",
"self",
"::",
"$",
"_instance",
"->",
"userAuthData",
"=",
"$",
"entityAuthData",
";",
"self",
"::",
"$",
"_instance",
"->",
"setContext",
"(",
"Sonic",
"::",
"CONTEXT_USER",
")",
";",
"return",
"self",
"::",
"$",
"_instance",
";",
"}"
] | set the user's AuthData
@param EntityAuthData object of the user | [
"set",
"the",
"user",
"s",
"AuthData"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L333-L343 |
5,121 | sgoendoer/sonic | src/Sonic.php | Sonic.getLogger | public static function getLogger()
{
if(self::$logger === NULL)
{
self::$logger = new Logger('sonic');
self::$logger->pushHandler(new StreamHandler(Configuration::getLogfile()));
}
return self::$logger;
} | php | public static function getLogger()
{
if(self::$logger === NULL)
{
self::$logger = new Logger('sonic');
self::$logger->pushHandler(new StreamHandler(Configuration::getLogfile()));
}
return self::$logger;
} | [
"public",
"static",
"function",
"getLogger",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"logger",
"===",
"NULL",
")",
"{",
"self",
"::",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'sonic'",
")",
";",
"self",
"::",
"$",
"logger",
"->",
"pushHandler",
"(",
"new",
"StreamHandler",
"(",
"Configuration",
"::",
"getLogfile",
"(",
")",
")",
")",
";",
"}",
"return",
"self",
"::",
"$",
"logger",
";",
"}"
] | return the monolog logger instance
@return the logger instance | [
"return",
"the",
"monolog",
"logger",
"instance"
] | 2c32ebd78607dc3e8558f10a0b7bf881d37fc168 | https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Sonic.php#L480-L489 |
5,122 | budkit/budkit-framework | src/Budkit/Protocol/Http/Response.php | Response.setCookies | public function setCookies($cookies = [])
{
$this->cookies = ($cookies instanceof Parameters) ? $cookies : new Parameters("cookies", (array)$cookies);
return $this;
} | php | public function setCookies($cookies = [])
{
$this->cookies = ($cookies instanceof Parameters) ? $cookies : new Parameters("cookies", (array)$cookies);
return $this;
} | [
"public",
"function",
"setCookies",
"(",
"$",
"cookies",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"cookies",
"=",
"(",
"$",
"cookies",
"instanceof",
"Parameters",
")",
"?",
"$",
"cookies",
":",
"new",
"Parameters",
"(",
"\"cookies\"",
",",
"(",
"array",
")",
"$",
"cookies",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the response cookies. Be warned that this replaces all cookies;
@param string $cookies
@return void
@author Livingstone Fultang | [
"Sets",
"the",
"response",
"cookies",
".",
"Be",
"warned",
"that",
"this",
"replaces",
"all",
"cookies",
";"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Protocol/Http/Response.php#L136-L142 |
5,123 | budkit/budkit-framework | src/Budkit/Protocol/Http/Response.php | Response.setHeaders | public function setHeaders(array $headers = [])
{
$this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);
return $this;
} | php | public function setHeaders(array $headers = [])
{
$this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);
return $this;
} | [
"public",
"function",
"setHeaders",
"(",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"headers",
"=",
"(",
"$",
"headers",
"instanceof",
"Headers",
")",
"?",
"$",
"headers",
":",
"new",
"Headers",
"(",
"(",
"array",
")",
"$",
"headers",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets a HeaderBag containing all headers;
@param string $headers
@return Response
@author Livingstone Fultang | [
"Sets",
"a",
"HeaderBag",
"containing",
"all",
"headers",
";"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Protocol/Http/Response.php#L210-L217 |
5,124 | budkit/budkit-framework | src/Budkit/Protocol/Http/Response.php | Response.addHeader | public function addHeader($key, $value = null)
{
//if loation change code to 320;
$headers = $this->getHeaders();
$headers->set($key, $value);
return $this;
} | php | public function addHeader($key, $value = null)
{
//if loation change code to 320;
$headers = $this->getHeaders();
$headers->set($key, $value);
return $this;
} | [
"public",
"function",
"addHeader",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"//if loation change code to 320;",
"$",
"headers",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
")",
";",
"$",
"headers",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a header to the Header bag;
@param string $key
@param string $value
@return void
@author Livingstone Fultang | [
"Add",
"a",
"header",
"to",
"the",
"Header",
"bag",
";"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Protocol/Http/Response.php#L243-L250 |
5,125 | budkit/budkit-framework | src/Budkit/Protocol/Http/Response.php | Response.getContent | public function getContent($packetId = null)
{
if (!isset($this->packetId)) {
return $content = implode("/n", $this->content);
}
//Return the content with PacketId;
return isset($this->content[$packetId]) ? $this->content[$packetId] : "";
} | php | public function getContent($packetId = null)
{
if (!isset($this->packetId)) {
return $content = implode("/n", $this->content);
}
//Return the content with PacketId;
return isset($this->content[$packetId]) ? $this->content[$packetId] : "";
} | [
"public",
"function",
"getContent",
"(",
"$",
"packetId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"packetId",
")",
")",
"{",
"return",
"$",
"content",
"=",
"implode",
"(",
"\"/n\"",
",",
"$",
"this",
"->",
"content",
")",
";",
"}",
"//Return the content with PacketId;",
"return",
"isset",
"(",
"$",
"this",
"->",
"content",
"[",
"$",
"packetId",
"]",
")",
"?",
"$",
"this",
"->",
"content",
"[",
"$",
"packetId",
"]",
":",
"\"\"",
";",
"}"
] | Gets content with specified Id, or all the content for buffering;
@param string $packetId
@return void
@author Livingstone Fultang | [
"Gets",
"content",
"with",
"specified",
"Id",
"or",
"all",
"the",
"content",
"for",
"buffering",
";"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Protocol/Http/Response.php#L313-L322 |
5,126 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/format.php | Format.forge | public static function forge($data = null, $from_type = null, $param = null)
{
return new static($data, $from_type, $param);
} | php | public static function forge($data = null, $from_type = null, $param = null)
{
return new static($data, $from_type, $param);
} | [
"public",
"static",
"function",
"forge",
"(",
"$",
"data",
"=",
"null",
",",
"$",
"from_type",
"=",
"null",
",",
"$",
"param",
"=",
"null",
")",
"{",
"return",
"new",
"static",
"(",
"$",
"data",
",",
"$",
"from_type",
",",
"$",
"param",
")",
";",
"}"
] | Returns an instance of the Format object.
echo Format::forge(array('foo' => 'bar'))->to_xml();
@param mixed general date to be converted
@param string data format the file was provided in
@param mixed additional parameter that can be passed on to a 'from' method
@return Format | [
"Returns",
"an",
"instance",
"of",
"the",
"Format",
"object",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/format.php#L39-L42 |
5,127 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/request/soap.php | Request_Soap.set_cookie | public function set_cookie($name, $value = null)
{
is_null($value)
? $this->connection()->__setCookie($name)
: $this->connection()->__setCookie($name, $value);
} | php | public function set_cookie($name, $value = null)
{
is_null($value)
? $this->connection()->__setCookie($name)
: $this->connection()->__setCookie($name, $value);
} | [
"public",
"function",
"set_cookie",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"is_null",
"(",
"$",
"value",
")",
"?",
"$",
"this",
"->",
"connection",
"(",
")",
"->",
"__setCookie",
"(",
"$",
"name",
")",
":",
"$",
"this",
"->",
"connection",
"(",
")",
"->",
"__setCookie",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}"
] | Set cookie for subsequent requests
@param string $name
@param string $value
@return void
@throws \RequestException | [
"Set",
"cookie",
"for",
"subsequent",
"requests"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/request/soap.php#L258-L263 |
5,128 | gliverphp/database | src/MySQL/MySQLTable.php | MySQLTable.createTable | public function createTable()
{
//get the instance of the FileInfo class
$file_info = FileInfo::Create($this->table_file_path);
//this file already exists
if($file_info->isFile())
{
//load the clas into momeory
include $file_info->getPathname();
$class_name = substr($file_info->getFilename(), 0,-4);
//get the database table class
$table_object = new $class_name();
//get the table columns, create SQL and execute
return $this->getColumns($table_object)->createSQL()->executeCreate();
}
//this file has not been created yet
else
{
}
} | php | public function createTable()
{
//get the instance of the FileInfo class
$file_info = FileInfo::Create($this->table_file_path);
//this file already exists
if($file_info->isFile())
{
//load the clas into momeory
include $file_info->getPathname();
$class_name = substr($file_info->getFilename(), 0,-4);
//get the database table class
$table_object = new $class_name();
//get the table columns, create SQL and execute
return $this->getColumns($table_object)->createSQL()->executeCreate();
}
//this file has not been created yet
else
{
}
} | [
"public",
"function",
"createTable",
"(",
")",
"{",
"//get the instance of the FileInfo class",
"$",
"file_info",
"=",
"FileInfo",
"::",
"Create",
"(",
"$",
"this",
"->",
"table_file_path",
")",
";",
"//this file already exists",
"if",
"(",
"$",
"file_info",
"->",
"isFile",
"(",
")",
")",
"{",
"//load the clas into momeory",
"include",
"$",
"file_info",
"->",
"getPathname",
"(",
")",
";",
"$",
"class_name",
"=",
"substr",
"(",
"$",
"file_info",
"->",
"getFilename",
"(",
")",
",",
"0",
",",
"-",
"4",
")",
";",
"//get the database table class",
"$",
"table_object",
"=",
"new",
"$",
"class_name",
"(",
")",
";",
"//get the table columns, create SQL and execute",
"return",
"$",
"this",
"->",
"getColumns",
"(",
"$",
"table_object",
")",
"->",
"createSQL",
"(",
")",
"->",
"executeCreate",
"(",
")",
";",
"}",
"//this file has not been created yet",
"else",
"{",
"}",
"}"
] | This method creates a new table associated with this model.
@param string $table_name The name of the table associated with this class
@param string $model_name The name of the model class associated with this table
@return bool true if table create success | [
"This",
"method",
"creates",
"a",
"new",
"table",
"associated",
"with",
"this",
"model",
"."
] | b998bd3d24cb2f269b9bd54438c7df8751377ba9 | https://github.com/gliverphp/database/blob/b998bd3d24cb2f269b9bd54438c7df8751377ba9/src/MySQL/MySQLTable.php#L115-L144 |
5,129 | gliverphp/database | src/MySQL/MySQLTable.php | MySQLTable.updateTable | public function updateTable()
{
//get the instance of the FileInfo class
$file_info = FileInfo::Create($this->table_file_path);
//this file already exists
if($file_info->isFile())
{
//load the clas into momeory
include $file_info->getPathname();
$class_name = substr($file_info->getFilename(), 0,-4);
//get the database table class
$table_object = new $class_name();
//get the table columns, create SQL and execute
$this->getColumns($table_object)->updateSQL()->executeUpdate();
//echo "{$this->query_string}";exit(0);
}
//this file has not been created yet
else
{
}
} | php | public function updateTable()
{
//get the instance of the FileInfo class
$file_info = FileInfo::Create($this->table_file_path);
//this file already exists
if($file_info->isFile())
{
//load the clas into momeory
include $file_info->getPathname();
$class_name = substr($file_info->getFilename(), 0,-4);
//get the database table class
$table_object = new $class_name();
//get the table columns, create SQL and execute
$this->getColumns($table_object)->updateSQL()->executeUpdate();
//echo "{$this->query_string}";exit(0);
}
//this file has not been created yet
else
{
}
} | [
"public",
"function",
"updateTable",
"(",
")",
"{",
"//get the instance of the FileInfo class",
"$",
"file_info",
"=",
"FileInfo",
"::",
"Create",
"(",
"$",
"this",
"->",
"table_file_path",
")",
";",
"//this file already exists",
"if",
"(",
"$",
"file_info",
"->",
"isFile",
"(",
")",
")",
"{",
"//load the clas into momeory",
"include",
"$",
"file_info",
"->",
"getPathname",
"(",
")",
";",
"$",
"class_name",
"=",
"substr",
"(",
"$",
"file_info",
"->",
"getFilename",
"(",
")",
",",
"0",
",",
"-",
"4",
")",
";",
"//get the database table class",
"$",
"table_object",
"=",
"new",
"$",
"class_name",
"(",
")",
";",
"//get the table columns, create SQL and execute",
"$",
"this",
"->",
"getColumns",
"(",
"$",
"table_object",
")",
"->",
"updateSQL",
"(",
")",
"->",
"executeUpdate",
"(",
")",
";",
"//echo \"{$this->query_string}\";exit(0);",
"}",
"//this file has not been created yet",
"else",
"{",
"}",
"}"
] | This model updates a table structure in the database.
@param null
@return bool true if update structure success | [
"This",
"model",
"updates",
"a",
"table",
"structure",
"in",
"the",
"database",
"."
] | b998bd3d24cb2f269b9bd54438c7df8751377ba9 | https://github.com/gliverphp/database/blob/b998bd3d24cb2f269b9bd54438c7df8751377ba9/src/MySQL/MySQLTable.php#L151-L181 |
5,130 | gliverphp/database | src/MySQL/MySQLTable.php | MySQLTable.createSQL | public function createSQL()
{
try {
$lines = array();
$indices = array();
$columns = $this->columns;
$template = "CREATE TABLE %s (\n%s,\n%s\n) ENGINE=%s DEFAULT CHARSET=%s;";
foreach ($this->columns as $column_name => $column)
{
//$column_name = $column["name"];//set the column name
$data_type = $column["type"];//set the column data type
$length = $column["length"];//set the lenght of the data type
if ($column["primary"]) $indices[] = "PRIMARY KEY ({$column_name})"; //add primary key field
if ($column["index"]) $indices[] = "KEY {$column_name} ({$column_name})"; //add index field
switch ($data_type)
{
case "autonumber":
$lines[] = "{$column_name} INT(11) NOT NULL AUTO_INCREMENT";
break;
case "text":
if ($length !== null && $length <= 255) $lines[] = "{$column_name} VARCHAR({$length}) DEFAULT NULL";
else $lines[] = "{$column_name} text";
break;
case "integer":
$lines[] = "{$column_name} INT(11) DEFAULT NULL";
break;
case "decimal":
$lines[] = "{$column_name} FLOAT DEFAULT NULL";
break;
case "boolean":
$lines[] = "{$column_name} TINYINT(4) DEFAULT NULL";
break;
case "datetime":
$lines[] = "{$column_name} DATETIME DEFAULT NULL";
break;
}
}
$this->query_string = sprintf($template, $this->table, join(",\n", $lines), join(",\n", $indices), 'InnoDB', 'utf8');//$this->connection->character_set_name()
return $this;
} catch (MySQLException $e) {
$e->errorShow();
}
} | php | public function createSQL()
{
try {
$lines = array();
$indices = array();
$columns = $this->columns;
$template = "CREATE TABLE %s (\n%s,\n%s\n) ENGINE=%s DEFAULT CHARSET=%s;";
foreach ($this->columns as $column_name => $column)
{
//$column_name = $column["name"];//set the column name
$data_type = $column["type"];//set the column data type
$length = $column["length"];//set the lenght of the data type
if ($column["primary"]) $indices[] = "PRIMARY KEY ({$column_name})"; //add primary key field
if ($column["index"]) $indices[] = "KEY {$column_name} ({$column_name})"; //add index field
switch ($data_type)
{
case "autonumber":
$lines[] = "{$column_name} INT(11) NOT NULL AUTO_INCREMENT";
break;
case "text":
if ($length !== null && $length <= 255) $lines[] = "{$column_name} VARCHAR({$length}) DEFAULT NULL";
else $lines[] = "{$column_name} text";
break;
case "integer":
$lines[] = "{$column_name} INT(11) DEFAULT NULL";
break;
case "decimal":
$lines[] = "{$column_name} FLOAT DEFAULT NULL";
break;
case "boolean":
$lines[] = "{$column_name} TINYINT(4) DEFAULT NULL";
break;
case "datetime":
$lines[] = "{$column_name} DATETIME DEFAULT NULL";
break;
}
}
$this->query_string = sprintf($template, $this->table, join(",\n", $lines), join(",\n", $indices), 'InnoDB', 'utf8');//$this->connection->character_set_name()
return $this;
} catch (MySQLException $e) {
$e->errorShow();
}
} | [
"public",
"function",
"createSQL",
"(",
")",
"{",
"try",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"$",
"indices",
"=",
"array",
"(",
")",
";",
"$",
"columns",
"=",
"$",
"this",
"->",
"columns",
";",
"$",
"template",
"=",
"\"CREATE TABLE %s (\\n%s,\\n%s\\n) ENGINE=%s DEFAULT CHARSET=%s;\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column_name",
"=>",
"$",
"column",
")",
"{",
"//$column_name = $column[\"name\"];//set the column name",
"$",
"data_type",
"=",
"$",
"column",
"[",
"\"type\"",
"]",
";",
"//set the column data type",
"$",
"length",
"=",
"$",
"column",
"[",
"\"length\"",
"]",
";",
"//set the lenght of the data type",
"if",
"(",
"$",
"column",
"[",
"\"primary\"",
"]",
")",
"$",
"indices",
"[",
"]",
"=",
"\"PRIMARY KEY ({$column_name})\"",
";",
"//add primary key field",
"if",
"(",
"$",
"column",
"[",
"\"index\"",
"]",
")",
"$",
"indices",
"[",
"]",
"=",
"\"KEY {$column_name} ({$column_name})\"",
";",
"//add index field",
"switch",
"(",
"$",
"data_type",
")",
"{",
"case",
"\"autonumber\"",
":",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} INT(11) NOT NULL AUTO_INCREMENT\"",
";",
"break",
";",
"case",
"\"text\"",
":",
"if",
"(",
"$",
"length",
"!==",
"null",
"&&",
"$",
"length",
"<=",
"255",
")",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} VARCHAR({$length}) DEFAULT NULL\"",
";",
"else",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} text\"",
";",
"break",
";",
"case",
"\"integer\"",
":",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} INT(11) DEFAULT NULL\"",
";",
"break",
";",
"case",
"\"decimal\"",
":",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} FLOAT DEFAULT NULL\"",
";",
"break",
";",
"case",
"\"boolean\"",
":",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} TINYINT(4) DEFAULT NULL\"",
";",
"break",
";",
"case",
"\"datetime\"",
":",
"$",
"lines",
"[",
"]",
"=",
"\"{$column_name} DATETIME DEFAULT NULL\"",
";",
"break",
";",
"}",
"}",
"$",
"this",
"->",
"query_string",
"=",
"sprintf",
"(",
"$",
"template",
",",
"$",
"this",
"->",
"table",
",",
"join",
"(",
"\",\\n\"",
",",
"$",
"lines",
")",
",",
"join",
"(",
"\",\\n\"",
",",
"$",
"indices",
")",
",",
"'InnoDB'",
",",
"'utf8'",
")",
";",
"//$this->connection->character_set_name()",
"return",
"$",
"this",
";",
"}",
"catch",
"(",
"MySQLException",
"$",
"e",
")",
"{",
"$",
"e",
"->",
"errorShow",
"(",
")",
";",
"}",
"}"
] | This method generates query string for creating the database table.
@param null
@return $this | [
"This",
"method",
"generates",
"query",
"string",
"for",
"creating",
"the",
"database",
"table",
"."
] | b998bd3d24cb2f269b9bd54438c7df8751377ba9 | https://github.com/gliverphp/database/blob/b998bd3d24cb2f269b9bd54438c7df8751377ba9/src/MySQL/MySQLTable.php#L313-L392 |
5,131 | wearenolte/wp-widgets | src/Register.php | Register.register_widgets | public static function register_widgets() {
foreach ( self::$_widgets['lean'] as $widget ) {
self::register_widget( __NAMESPACE__ . '\\Collection\\' . $widget );
}
foreach ( self::$_widgets['custom'] as $widget ) {
self::register_widget( $widget );
}
} | php | public static function register_widgets() {
foreach ( self::$_widgets['lean'] as $widget ) {
self::register_widget( __NAMESPACE__ . '\\Collection\\' . $widget );
}
foreach ( self::$_widgets['custom'] as $widget ) {
self::register_widget( $widget );
}
} | [
"public",
"static",
"function",
"register_widgets",
"(",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"_widgets",
"[",
"'lean'",
"]",
"as",
"$",
"widget",
")",
"{",
"self",
"::",
"register_widget",
"(",
"__NAMESPACE__",
".",
"'\\\\Collection\\\\'",
".",
"$",
"widget",
")",
";",
"}",
"foreach",
"(",
"self",
"::",
"$",
"_widgets",
"[",
"'custom'",
"]",
"as",
"$",
"widget",
")",
"{",
"self",
"::",
"register_widget",
"(",
"$",
"widget",
")",
";",
"}",
"}"
] | Register required widgets. | [
"Register",
"required",
"widgets",
"."
] | 7b008dc3182f8b9da44657bd2fe714e7e48cf002 | https://github.com/wearenolte/wp-widgets/blob/7b008dc3182f8b9da44657bd2fe714e7e48cf002/src/Register.php#L52-L60 |
5,132 | wearenolte/wp-widgets | src/Register.php | Register.register_widget | private static function register_widget( $widget_class ) {
register_widget( $widget_class );
$callback = [ $widget_class, 'post_registration' ];
if ( is_callable( $callback, true ) ) {
call_user_func( $callback );
}
} | php | private static function register_widget( $widget_class ) {
register_widget( $widget_class );
$callback = [ $widget_class, 'post_registration' ];
if ( is_callable( $callback, true ) ) {
call_user_func( $callback );
}
} | [
"private",
"static",
"function",
"register_widget",
"(",
"$",
"widget_class",
")",
"{",
"register_widget",
"(",
"$",
"widget_class",
")",
";",
"$",
"callback",
"=",
"[",
"$",
"widget_class",
",",
"'post_registration'",
"]",
";",
"if",
"(",
"is_callable",
"(",
"$",
"callback",
",",
"true",
")",
")",
"{",
"call_user_func",
"(",
"$",
"callback",
")",
";",
"}",
"}"
] | Register a widget and run its post_registration function.
@param string $widget_class Full class name (including namespace) of the widget. | [
"Register",
"a",
"widget",
"and",
"run",
"its",
"post_registration",
"function",
"."
] | 7b008dc3182f8b9da44657bd2fe714e7e48cf002 | https://github.com/wearenolte/wp-widgets/blob/7b008dc3182f8b9da44657bd2fe714e7e48cf002/src/Register.php#L67-L74 |
5,133 | wearenolte/wp-widgets | src/Register.php | Register.get_widget_instance | public static function get_widget_instance( $widget_id ) {
global $wp_registered_widgets;
if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) {
return false;
}
$model = $wp_registered_widgets[ $widget_id ]['callback'][0];
if ( ! is_a( $model, 'Lean\Widgets\Models\AbstractWidget' ) ) {
return false;
}
$key = $wp_registered_widgets[ $widget_id ]['params'][0]['number'];
$model->_set( $key );
return $model;
} | php | public static function get_widget_instance( $widget_id ) {
global $wp_registered_widgets;
if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) {
return false;
}
$model = $wp_registered_widgets[ $widget_id ]['callback'][0];
if ( ! is_a( $model, 'Lean\Widgets\Models\AbstractWidget' ) ) {
return false;
}
$key = $wp_registered_widgets[ $widget_id ]['params'][0]['number'];
$model->_set( $key );
return $model;
} | [
"public",
"static",
"function",
"get_widget_instance",
"(",
"$",
"widget_id",
")",
"{",
"global",
"$",
"wp_registered_widgets",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"wp_registered_widgets",
"[",
"$",
"widget_id",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"model",
"=",
"$",
"wp_registered_widgets",
"[",
"$",
"widget_id",
"]",
"[",
"'callback'",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"is_a",
"(",
"$",
"model",
",",
"'Lean\\Widgets\\Models\\AbstractWidget'",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"key",
"=",
"$",
"wp_registered_widgets",
"[",
"$",
"widget_id",
"]",
"[",
"'params'",
"]",
"[",
"0",
"]",
"[",
"'number'",
"]",
";",
"$",
"model",
"->",
"_set",
"(",
"$",
"key",
")",
";",
"return",
"$",
"model",
";",
"}"
] | Gets a specific instance of a widget
@param string $widget_id The widget id
@return AbstractWidget|bool | [
"Gets",
"a",
"specific",
"instance",
"of",
"a",
"widget"
] | 7b008dc3182f8b9da44657bd2fe714e7e48cf002 | https://github.com/wearenolte/wp-widgets/blob/7b008dc3182f8b9da44657bd2fe714e7e48cf002/src/Register.php#L82-L100 |
5,134 | crysalead/collection | src/Collection.php | Collection.formats | public static function formats($format = null, $handler = null)
{
if ($format === null) {
return static::$_formats;
}
if ($format === false) {
return static::$_formats = ['array' => 'Lead\Collection\Collection::toArray'];
}
if ($handler === false) {
unset(static::$_formats[$format]);
return;
}
return static::$_formats[$format] = $handler;
} | php | public static function formats($format = null, $handler = null)
{
if ($format === null) {
return static::$_formats;
}
if ($format === false) {
return static::$_formats = ['array' => 'Lead\Collection\Collection::toArray'];
}
if ($handler === false) {
unset(static::$_formats[$format]);
return;
}
return static::$_formats[$format] = $handler;
} | [
"public",
"static",
"function",
"formats",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"format",
"===",
"null",
")",
"{",
"return",
"static",
"::",
"$",
"_formats",
";",
"}",
"if",
"(",
"$",
"format",
"===",
"false",
")",
"{",
"return",
"static",
"::",
"$",
"_formats",
"=",
"[",
"'array'",
"=>",
"'Lead\\Collection\\Collection::toArray'",
"]",
";",
"}",
"if",
"(",
"$",
"handler",
"===",
"false",
")",
"{",
"unset",
"(",
"static",
"::",
"$",
"_formats",
"[",
"$",
"format",
"]",
")",
";",
"return",
";",
"}",
"return",
"static",
"::",
"$",
"_formats",
"[",
"$",
"format",
"]",
"=",
"$",
"handler",
";",
"}"
] | Accessor method for adding format handlers to `Collection` instances.
The values assigned are used by `Collection::to()` to convert `Collection` instances into
different formats, i.e. JSON.
This can be accomplished in two ways. First, format handlers may be registered on a
case-by-case basis, as in the following:
```php
Collection::formats('json', function($collection, $options) {
return json_encode($collection->to('array'));
});
// You can also implement the above as a static class method, and register it as follows:
Collection::formats('json', 'my\custom\Formatter::toJson');
```
@see Lead\Collection\Collection::to()
@param string $format A string representing the name of the format that a `Collection`
can be converted to. If `false`, reset the `$_formats` attribute.
If `null` return the content of the `$_formats` attribute.
@param mixed $handler The function that handles the conversion, either an anonymous function,
a fully namespaced class method or `false` to remove the `$format` handler.
@return mixed | [
"Accessor",
"method",
"for",
"adding",
"format",
"handlers",
"to",
"Collection",
"instances",
"."
] | f36854210a8e8545de82f6760c0d80f5cb027c35 | https://github.com/crysalead/collection/blob/f36854210a8e8545de82f6760c0d80f5cb027c35/src/Collection.php#L131-L144 |
5,135 | crysalead/collection | src/Collection.php | Collection.each | public function each($callback)
{
foreach ($this->_data as $key => $val) {
$this->_data[$key] = $callback($val, $key, $this);
}
return $this;
} | php | public function each($callback)
{
foreach ($this->_data as $key => $val) {
$this->_data[$key] = $callback($val, $key, $this);
}
return $this;
} | [
"public",
"function",
"each",
"(",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
"=",
"$",
"callback",
"(",
"$",
"val",
",",
"$",
"key",
",",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Applies a callback to all items in the collection.
@param callback $callback The callback to apply.
@return object This collection instance. | [
"Applies",
"a",
"callback",
"to",
"all",
"items",
"in",
"the",
"collection",
"."
] | f36854210a8e8545de82f6760c0d80f5cb027c35 | https://github.com/crysalead/collection/blob/f36854210a8e8545de82f6760c0d80f5cb027c35/src/Collection.php#L395-L401 |
5,136 | crysalead/collection | src/Collection.php | Collection.toArray | public static function toArray($data, $options = [])
{
$defaults = ['key' => true, 'handlers' => []];
$options += $defaults;
$result = [];
foreach ($data as $key => $item) {
switch (true) {
case is_array($item):
$result[$key] = static::toArray($item, $options);
break;
case (!is_object($item)):
$result[$key] = $item;
break;
case (isset($options['handlers'][$class = get_class($item)])):
$result[$key] = $options['handlers'][$class]($item);
break;
case ($item instanceof static):
$result[$key] = static::toArray($item, $options);
break;
case (method_exists($item, '__toString')):
$result[$key] = (string) $item;
break;
default:
$result[$key] = $item;
break;
}
}
return $options['key'] ? $result : array_values($result);
} | php | public static function toArray($data, $options = [])
{
$defaults = ['key' => true, 'handlers' => []];
$options += $defaults;
$result = [];
foreach ($data as $key => $item) {
switch (true) {
case is_array($item):
$result[$key] = static::toArray($item, $options);
break;
case (!is_object($item)):
$result[$key] = $item;
break;
case (isset($options['handlers'][$class = get_class($item)])):
$result[$key] = $options['handlers'][$class]($item);
break;
case ($item instanceof static):
$result[$key] = static::toArray($item, $options);
break;
case (method_exists($item, '__toString')):
$result[$key] = (string) $item;
break;
default:
$result[$key] = $item;
break;
}
}
return $options['key'] ? $result : array_values($result);
} | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"data",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'key'",
"=>",
"true",
",",
"'handlers'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_array",
"(",
"$",
"item",
")",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"static",
"::",
"toArray",
"(",
"$",
"item",
",",
"$",
"options",
")",
";",
"break",
";",
"case",
"(",
"!",
"is_object",
"(",
"$",
"item",
")",
")",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"$",
"item",
";",
"break",
";",
"case",
"(",
"isset",
"(",
"$",
"options",
"[",
"'handlers'",
"]",
"[",
"$",
"class",
"=",
"get_class",
"(",
"$",
"item",
")",
"]",
")",
")",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"$",
"options",
"[",
"'handlers'",
"]",
"[",
"$",
"class",
"]",
"(",
"$",
"item",
")",
";",
"break",
";",
"case",
"(",
"$",
"item",
"instanceof",
"static",
")",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"static",
"::",
"toArray",
"(",
"$",
"item",
",",
"$",
"options",
")",
";",
"break",
";",
"case",
"(",
"method_exists",
"(",
"$",
"item",
",",
"'__toString'",
")",
")",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"(",
"string",
")",
"$",
"item",
";",
"break",
";",
"default",
":",
"$",
"result",
"[",
"$",
"key",
"]",
"=",
"$",
"item",
";",
"break",
";",
"}",
"}",
"return",
"$",
"options",
"[",
"'key'",
"]",
"?",
"$",
"result",
":",
"array_values",
"(",
"$",
"result",
")",
";",
"}"
] | Exports a `Collection` instance to an array.
@param mixed $data Either a `Collection` instance, or an array representing a
`Collection`'s internal state.
@param array $options Options used when converting `$data` to an array:
- `'key'` _boolean_: A boolean indicating if keys must be conserved or not.
- `'handlers'` _array_ : An array where the keys are fully-namespaced class
names, and the values are closures that take an instance of the class as a
parameter, and return an array or scalar value that the instance represents.
@return array The value of `$data` as a pure PHP array, recursively converting all
sub-objects and other values to their closest array or scalar equivalents. | [
"Exports",
"a",
"Collection",
"instance",
"to",
"an",
"array",
"."
] | f36854210a8e8545de82f6760c0d80f5cb027c35 | https://github.com/crysalead/collection/blob/f36854210a8e8545de82f6760c0d80f5cb027c35/src/Collection.php#L520-L549 |
5,137 | unyx/console | input/parameter/values/Arguments.php | Arguments.push | public function push(string $value) : core\collections\interfaces\Map
{
// Grab an Argument for the next index. If we get null here, it means there are no further Arguments
// that accept values present.
if (!$argument = $this->definitions->getNextDefinition($this)) {
throw new exceptions\ArgumentsTooMany($this);
}
// Now that we know how to map the Argument via its name, we can safely set its value. Set() will also
// resolve the case of parameters accepting multiple values.
return $this->set($argument->getName(), $value);
} | php | public function push(string $value) : core\collections\interfaces\Map
{
// Grab an Argument for the next index. If we get null here, it means there are no further Arguments
// that accept values present.
if (!$argument = $this->definitions->getNextDefinition($this)) {
throw new exceptions\ArgumentsTooMany($this);
}
// Now that we know how to map the Argument via its name, we can safely set its value. Set() will also
// resolve the case of parameters accepting multiple values.
return $this->set($argument->getName(), $value);
} | [
"public",
"function",
"push",
"(",
"string",
"$",
"value",
")",
":",
"core",
"\\",
"collections",
"\\",
"interfaces",
"\\",
"Map",
"{",
"// Grab an Argument for the next index. If we get null here, it means there are no further Arguments",
"// that accept values present.",
"if",
"(",
"!",
"$",
"argument",
"=",
"$",
"this",
"->",
"definitions",
"->",
"getNextDefinition",
"(",
"$",
"this",
")",
")",
"{",
"throw",
"new",
"exceptions",
"\\",
"ArgumentsTooMany",
"(",
"$",
"this",
")",
";",
"}",
"// Now that we know how to map the Argument via its name, we can safely set its value. Set() will also",
"// resolve the case of parameters accepting multiple values.",
"return",
"$",
"this",
"->",
"set",
"(",
"$",
"argument",
"->",
"getName",
"(",
")",
",",
"$",
"value",
")",
";",
"}"
] | Adds an argument's value to the collection.
Automatically decides on the name of the argument based on the present definition.
@param string $value The argument's value to set.
@param $this
@throws exceptions\ArgumentsTooMany When the definition does not permit any further arguments. | [
"Adds",
"an",
"argument",
"s",
"value",
"to",
"the",
"collection",
"."
] | b4a76e08bbb5428b0349c0ec4259a914f81a2957 | https://github.com/unyx/console/blob/b4a76e08bbb5428b0349c0ec4259a914f81a2957/input/parameter/values/Arguments.php#L44-L55 |
5,138 | snapwp/snap-debug | src/Dumper/Handle.php | Handle.dump | public static function dump($var)
{
$flags = 0;
if (Config::get('debug.dump_show_string_length')) {
$flags = $flags | AbstractDumper::DUMP_STRING_LENGTH;
}
$cloner = new VarCloner();
if (! \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
$dumper = new HtmlDumper(null, null, $flags);
$dumper->setStyles(self::get_styles());
if (Config::get('debug.dump_include_trace')) {
$dumper->setDumpBoundaries(
'<pre class=sf-dump id=%s data-indent-pad="%s">' . self::additional_output(),
'</pre><script>Sfdump(%s)</script>'
);
}
} else {
$dumper = new CliDumper(null, null, $flags);
}
$dumper->dump($cloner->cloneVar($var));
} | php | public static function dump($var)
{
$flags = 0;
if (Config::get('debug.dump_show_string_length')) {
$flags = $flags | AbstractDumper::DUMP_STRING_LENGTH;
}
$cloner = new VarCloner();
if (! \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
$dumper = new HtmlDumper(null, null, $flags);
$dumper->setStyles(self::get_styles());
if (Config::get('debug.dump_include_trace')) {
$dumper->setDumpBoundaries(
'<pre class=sf-dump id=%s data-indent-pad="%s">' . self::additional_output(),
'</pre><script>Sfdump(%s)</script>'
);
}
} else {
$dumper = new CliDumper(null, null, $flags);
}
$dumper->dump($cloner->cloneVar($var));
} | [
"public",
"static",
"function",
"dump",
"(",
"$",
"var",
")",
"{",
"$",
"flags",
"=",
"0",
";",
"if",
"(",
"Config",
"::",
"get",
"(",
"'debug.dump_show_string_length'",
")",
")",
"{",
"$",
"flags",
"=",
"$",
"flags",
"|",
"AbstractDumper",
"::",
"DUMP_STRING_LENGTH",
";",
"}",
"$",
"cloner",
"=",
"new",
"VarCloner",
"(",
")",
";",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"\\",
"PHP_SAPI",
",",
"array",
"(",
"'cli'",
",",
"'phpdbg'",
")",
",",
"true",
")",
")",
"{",
"$",
"dumper",
"=",
"new",
"HtmlDumper",
"(",
"null",
",",
"null",
",",
"$",
"flags",
")",
";",
"$",
"dumper",
"->",
"setStyles",
"(",
"self",
"::",
"get_styles",
"(",
")",
")",
";",
"if",
"(",
"Config",
"::",
"get",
"(",
"'debug.dump_include_trace'",
")",
")",
"{",
"$",
"dumper",
"->",
"setDumpBoundaries",
"(",
"'<pre class=sf-dump id=%s data-indent-pad=\"%s\">'",
".",
"self",
"::",
"additional_output",
"(",
")",
",",
"'</pre><script>Sfdump(%s)</script>'",
")",
";",
"}",
"}",
"else",
"{",
"$",
"dumper",
"=",
"new",
"CliDumper",
"(",
"null",
",",
"null",
",",
"$",
"flags",
")",
";",
"}",
"$",
"dumper",
"->",
"dump",
"(",
"$",
"cloner",
"->",
"cloneVar",
"(",
"$",
"var",
")",
")",
";",
"}"
] | The dump replacement.
@since 1.0.0
@param mixed $var The var to dump. | [
"The",
"dump",
"replacement",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Dumper/Handle.php#L80-L106 |
5,139 | snapwp/snap-debug | src/Dumper/Handle.php | Handle.get_styles | private static function get_styles()
{
$style = Config::get('debug.dump_set_style', 'snap');
if (\is_array($style)) {
return $style;
}
if (\array_key_exists($style, self::$schemes)) {
return self::$schemes[ $style ];
}
return self::$schemes['snap'];
} | php | private static function get_styles()
{
$style = Config::get('debug.dump_set_style', 'snap');
if (\is_array($style)) {
return $style;
}
if (\array_key_exists($style, self::$schemes)) {
return self::$schemes[ $style ];
}
return self::$schemes['snap'];
} | [
"private",
"static",
"function",
"get_styles",
"(",
")",
"{",
"$",
"style",
"=",
"Config",
"::",
"get",
"(",
"'debug.dump_set_style'",
",",
"'snap'",
")",
";",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"style",
")",
")",
"{",
"return",
"$",
"style",
";",
"}",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"style",
",",
"self",
"::",
"$",
"schemes",
")",
")",
"{",
"return",
"self",
"::",
"$",
"schemes",
"[",
"$",
"style",
"]",
";",
"}",
"return",
"self",
"::",
"$",
"schemes",
"[",
"'snap'",
"]",
";",
"}"
] | Ensures the dump output uses the correct styles for Snap.
Can be overwritten by setting the config key.
@since 1.0.0
@return array | [
"Ensures",
"the",
"dump",
"output",
"uses",
"the",
"correct",
"styles",
"for",
"Snap",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Dumper/Handle.php#L117-L130 |
5,140 | snapwp/snap-debug | src/Dumper/Handle.php | Handle.additional_output | private static function additional_output()
{
$backtrace = \debug_backtrace()[3];
$root = \realpath(__DIR__ . '/../../../../../../');
return '<span class="sf-dump-lineinfo">' . \ltrim(\str_replace($root, '', $backtrace['file']), '/\\') . ':' . $backtrace['line'] . '</span>';
} | php | private static function additional_output()
{
$backtrace = \debug_backtrace()[3];
$root = \realpath(__DIR__ . '/../../../../../../');
return '<span class="sf-dump-lineinfo">' . \ltrim(\str_replace($root, '', $backtrace['file']), '/\\') . ':' . $backtrace['line'] . '</span>';
} | [
"private",
"static",
"function",
"additional_output",
"(",
")",
"{",
"$",
"backtrace",
"=",
"\\",
"debug_backtrace",
"(",
")",
"[",
"3",
"]",
";",
"$",
"root",
"=",
"\\",
"realpath",
"(",
"__DIR__",
".",
"'/../../../../../../'",
")",
";",
"return",
"'<span class=\"sf-dump-lineinfo\">'",
".",
"\\",
"ltrim",
"(",
"\\",
"str_replace",
"(",
"$",
"root",
",",
"''",
",",
"$",
"backtrace",
"[",
"'file'",
"]",
")",
",",
"'/\\\\'",
")",
".",
"':'",
".",
"$",
"backtrace",
"[",
"'line'",
"]",
".",
"'</span>'",
";",
"}"
] | Gets the line and file of where the dump was called.
@since 1.0.0
@return string The HTML for showing the line info. | [
"Gets",
"the",
"line",
"and",
"file",
"of",
"where",
"the",
"dump",
"was",
"called",
"."
] | 49c0c258ce50098a3fca076ce122adf57571f2e2 | https://github.com/snapwp/snap-debug/blob/49c0c258ce50098a3fca076ce122adf57571f2e2/src/Dumper/Handle.php#L139-L146 |
5,141 | marando/phpSOFA | src/Marando/IAU/iauApcg13.php | iauApcg13.Apcg13 | public static function Apcg13($date1, $date2, iauASTROM &$astrom) {
$ehpv = [];
$ebpv = [];
/* Earth barycentric & heliocentric position/velocity (au, au/d). */
IAU::Epv00($date1, $date2, $ehpv, $ebpv);
/* Compute the star-independent astrometry parameters. */
IAU::Apcg($date1, $date2, $ebpv, $ehpv[0], $astrom);
/* Finished. */
} | php | public static function Apcg13($date1, $date2, iauASTROM &$astrom) {
$ehpv = [];
$ebpv = [];
/* Earth barycentric & heliocentric position/velocity (au, au/d). */
IAU::Epv00($date1, $date2, $ehpv, $ebpv);
/* Compute the star-independent astrometry parameters. */
IAU::Apcg($date1, $date2, $ebpv, $ehpv[0], $astrom);
/* Finished. */
} | [
"public",
"static",
"function",
"Apcg13",
"(",
"$",
"date1",
",",
"$",
"date2",
",",
"iauASTROM",
"&",
"$",
"astrom",
")",
"{",
"$",
"ehpv",
"=",
"[",
"]",
";",
"$",
"ebpv",
"=",
"[",
"]",
";",
"/* Earth barycentric & heliocentric position/velocity (au, au/d). */",
"IAU",
"::",
"Epv00",
"(",
"$",
"date1",
",",
"$",
"date2",
",",
"$",
"ehpv",
",",
"$",
"ebpv",
")",
";",
"/* Compute the star-independent astrometry parameters. */",
"IAU",
"::",
"Apcg",
"(",
"$",
"date1",
",",
"$",
"date2",
",",
"$",
"ebpv",
",",
"$",
"ehpv",
"[",
"0",
"]",
",",
"$",
"astrom",
")",
";",
"/* Finished. */",
"}"
] | - - - - - - - - - -
i a u A p c g 1 3
- - - - - - - - - -
For a geocentric observer, prepare star-independent astrometry
parameters for transformations between ICRS and GCRS coordinates.
The caller supplies the date, and SOFA models are used to predict
the Earth ephemeris.
The parameters produced by this function are required in the
parallax, light deflection and aberration parts of the astrometric
transformation chain.
This function is part of the International Astronomical Union's
SOFA (Standards of Fundamental Astronomy) software collection.
Status: support function.
Given:
date1 double TDB as a 2-part...
date2 double ...Julian Date (Note 1)
Returned:
astrom iauASTROM* star-independent astrometry parameters:
pmt double PM time interval (SSB, Julian years)
eb double[3] SSB to observer (vector, au)
eh double[3] Sun to observer (unit vector)
em double distance from Sun to observer (au)
v double[3] barycentric observer velocity (vector, c)
bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
bpn double[3][3] bias-precession-nutation matrix
along double unchanged
xpl double unchanged
ypl double unchanged
sphi double unchanged
cphi double unchanged
diurab double unchanged
eral double unchanged
refa double unchanged
refb double unchanged
Notes:
1) The TDB date date1+date2 is a Julian Date, apportioned in any
convenient way between the two arguments. For example,
JD(TDB)=2450123.7 could be expressed in any of these ways, among
others:
date1 date2
2450123.7 0.0 (JD method)
2451545.0 -1421.3 (J2000 method)
2400000.5 50123.2 (MJD method)
2450123.5 0.2 (date & time method)
The JD method is the most natural and convenient to use in cases
where the loss of several decimal digits of resolution is
acceptable. The J2000 method is best matched to the way the
argument is handled internally and will deliver the optimum
resolution. The MJD method and the date & time methods are both
good compromises between resolution and convenience. For most
applications of this function the choice will not be at all
critical.
TT can be used instead of TDB without any significant impact on
accuracy.
2) All the vectors are with respect to BCRS axes.
3) In cases where the caller wishes to supply his own Earth
ephemeris, the function iauApcg can be used instead of the present
function.
4) This is one of several functions that inserts into the astrom
structure star-independent parameters needed for the chain of
astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
The various functions support different classes of observer and
portions of the transformation chain:
functions observer transformation
iauApcg iauApcg13 geocentric ICRS <-> GCRS
iauApci iauApci13 terrestrial ICRS <-> CIRS
iauApco iauApco13 terrestrial ICRS <-> observed
iauApcs iauApcs13 space ICRS <-> GCRS
iauAper iauAper13 terrestrial update Earth rotation
iauApio iauApio13 terrestrial CIRS <-> observed
Those with names ending in "13" use contemporary SOFA models to
compute the various ephemerides. The others accept ephemerides
supplied by the caller.
The transformation from ICRS to GCRS covers space motion,
parallax, light deflection, and aberration. From GCRS to CIRS
comprises frame bias and precession-nutation. From CIRS to
observed takes account of Earth rotation, polar motion, diurnal
aberration and parallax (unless subsumed into the ICRS <-> GCRS
transformation), and atmospheric refraction.
5) The context structure astrom produced by this function is used by
iauAtciq* and iauAticq*.
Called:
iauEpv00 Earth position and velocity
iauApcg astrometry parameters, ICRS-GCRS, geocenter
This revision: 2013 October 9
SOFA release 2015-02-09
Copyright (C) 2015 IAU SOFA Board. See notes at end. | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"A",
"p",
"c",
"g",
"1",
"3",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauApcg13.php#L121-L132 |
5,142 | gossi/trixionary | src/model/Map/StructureNodeParentTableMap.php | StructureNodeParentTableMap.doDelete | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(StructureNodeParentTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \gossi\trixionary\model\StructureNodeParent) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(StructureNodeParentTableMap::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
foreach ($values as $value) {
$criterion = $criteria->getNewCriterion(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(StructureNodeParentTableMap::COL_PARENT_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = StructureNodeParentQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) {
StructureNodeParentTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) {
StructureNodeParentTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
} | php | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(StructureNodeParentTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \gossi\trixionary\model\StructureNodeParent) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(StructureNodeParentTableMap::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
foreach ($values as $value) {
$criterion = $criteria->getNewCriterion(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(StructureNodeParentTableMap::COL_PARENT_ID, $value[1]));
$criteria->addOr($criterion);
}
}
$query = StructureNodeParentQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) {
StructureNodeParentTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) {
StructureNodeParentTableMap::removeInstanceFromPool($singleval);
}
}
return $query->delete($con);
} | [
"public",
"static",
"function",
"doDelete",
"(",
"$",
"values",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getWriteConnection",
"(",
"StructureNodeParentTableMap",
"::",
"DATABASE_NAME",
")",
";",
"}",
"if",
"(",
"$",
"values",
"instanceof",
"Criteria",
")",
"{",
"// rename for clarity",
"$",
"criteria",
"=",
"$",
"values",
";",
"}",
"elseif",
"(",
"$",
"values",
"instanceof",
"\\",
"gossi",
"\\",
"trixionary",
"\\",
"model",
"\\",
"StructureNodeParent",
")",
"{",
"// it's a model object",
"// create criteria based on pk values",
"$",
"criteria",
"=",
"$",
"values",
"->",
"buildPkeyCriteria",
"(",
")",
";",
"}",
"else",
"{",
"// it's a primary key, or an array of pks",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"StructureNodeParentTableMap",
"::",
"DATABASE_NAME",
")",
";",
"// primary key is composite; we therefore, expect",
"// the primary key passed to be an array of pkey values",
"if",
"(",
"count",
"(",
"$",
"values",
")",
"==",
"count",
"(",
"$",
"values",
",",
"COUNT_RECURSIVE",
")",
")",
"{",
"// array is not multi-dimensional",
"$",
"values",
"=",
"array",
"(",
"$",
"values",
")",
";",
"}",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"$",
"criterion",
"=",
"$",
"criteria",
"->",
"getNewCriterion",
"(",
"StructureNodeParentTableMap",
"::",
"COL_STRUCTURE_NODE_ID",
",",
"$",
"value",
"[",
"0",
"]",
")",
";",
"$",
"criterion",
"->",
"addAnd",
"(",
"$",
"criteria",
"->",
"getNewCriterion",
"(",
"StructureNodeParentTableMap",
"::",
"COL_PARENT_ID",
",",
"$",
"value",
"[",
"1",
"]",
")",
")",
";",
"$",
"criteria",
"->",
"addOr",
"(",
"$",
"criterion",
")",
";",
"}",
"}",
"$",
"query",
"=",
"StructureNodeParentQuery",
"::",
"create",
"(",
")",
"->",
"mergeWith",
"(",
"$",
"criteria",
")",
";",
"if",
"(",
"$",
"values",
"instanceof",
"Criteria",
")",
"{",
"StructureNodeParentTableMap",
"::",
"clearInstancePool",
"(",
")",
";",
"}",
"elseif",
"(",
"!",
"is_object",
"(",
"$",
"values",
")",
")",
"{",
"// it's a primary key, or an array of pks",
"foreach",
"(",
"(",
"array",
")",
"$",
"values",
"as",
"$",
"singleval",
")",
"{",
"StructureNodeParentTableMap",
"::",
"removeInstanceFromPool",
"(",
"$",
"singleval",
")",
";",
"}",
"}",
"return",
"$",
"query",
"->",
"delete",
"(",
"$",
"con",
")",
";",
"}"
] | Performs a DELETE on the database, given a StructureNodeParent or Criteria object OR a primary key value.
@param mixed $values Criteria or StructureNodeParent object or primary key or array of primary keys
which is used to create the DELETE statement
@param ConnectionInterface $con the connection to use
@return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
if supported by native driver or if emulated using Propel.
@throws PropelException Any exceptions caught during processing will be
rethrown wrapped into a PropelException. | [
"Performs",
"a",
"DELETE",
"on",
"the",
"database",
"given",
"a",
"StructureNodeParent",
"or",
"Criteria",
"object",
"OR",
"a",
"primary",
"key",
"value",
"."
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Map/StructureNodeParentTableMap.php#L405-L443 |
5,143 | gossi/trixionary | src/model/Map/StructureNodeParentTableMap.php | StructureNodeParentTableMap.doInsert | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(StructureNodeParentTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from StructureNodeParent object
}
// Set the correct dbName
$query = StructureNodeParentQuery::create()->mergeWith($criteria);
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
return $con->transaction(function () use ($con, $query) {
return $query->doInsert($con);
});
} | php | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(StructureNodeParentTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from StructureNodeParent object
}
// Set the correct dbName
$query = StructureNodeParentQuery::create()->mergeWith($criteria);
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
return $con->transaction(function () use ($con, $query) {
return $query->doInsert($con);
});
} | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"criteria",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getWriteConnection",
"(",
"StructureNodeParentTableMap",
"::",
"DATABASE_NAME",
")",
";",
"}",
"if",
"(",
"$",
"criteria",
"instanceof",
"Criteria",
")",
"{",
"$",
"criteria",
"=",
"clone",
"$",
"criteria",
";",
"// rename for clarity",
"}",
"else",
"{",
"$",
"criteria",
"=",
"$",
"criteria",
"->",
"buildCriteria",
"(",
")",
";",
"// build Criteria from StructureNodeParent object",
"}",
"// Set the correct dbName",
"$",
"query",
"=",
"StructureNodeParentQuery",
"::",
"create",
"(",
")",
"->",
"mergeWith",
"(",
"$",
"criteria",
")",
";",
"// use transaction because $criteria could contain info",
"// for more than one table (I guess, conceivably)",
"return",
"$",
"con",
"->",
"transaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"con",
",",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",
"doInsert",
"(",
"$",
"con",
")",
";",
"}",
")",
";",
"}"
] | Performs an INSERT on the database, given a StructureNodeParent or Criteria object.
@param mixed $criteria Criteria or StructureNodeParent object containing data that is used to create the INSERT statement.
@param ConnectionInterface $con the ConnectionInterface connection to use
@return mixed The new primary key.
@throws PropelException Any exceptions caught during processing will be
rethrown wrapped into a PropelException. | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"StructureNodeParent",
"or",
"Criteria",
"object",
"."
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Map/StructureNodeParentTableMap.php#L465-L486 |
5,144 | taniko/romans | src/Parser.php | Parser.toInt | public static function toInt(string $str) : int
{
$result = 0;
$str = mb_convert_kana(self::replaceRoman($str), 'a');
foreach (self::$romans as $key => $value) {
while (mb_strpos($str, $key) === 0) {
$result += $value;
$str = mb_substr($str, strlen($key));
}
}
return $result;
} | php | public static function toInt(string $str) : int
{
$result = 0;
$str = mb_convert_kana(self::replaceRoman($str), 'a');
foreach (self::$romans as $key => $value) {
while (mb_strpos($str, $key) === 0) {
$result += $value;
$str = mb_substr($str, strlen($key));
}
}
return $result;
} | [
"public",
"static",
"function",
"toInt",
"(",
"string",
"$",
"str",
")",
":",
"int",
"{",
"$",
"result",
"=",
"0",
";",
"$",
"str",
"=",
"mb_convert_kana",
"(",
"self",
"::",
"replaceRoman",
"(",
"$",
"str",
")",
",",
"'a'",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"romans",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"while",
"(",
"mb_strpos",
"(",
"$",
"str",
",",
"$",
"key",
")",
"===",
"0",
")",
"{",
"$",
"result",
"+=",
"$",
"value",
";",
"$",
"str",
"=",
"mb_substr",
"(",
"$",
"str",
",",
"strlen",
"(",
"$",
"key",
")",
")",
";",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] | convert roman numerals to decimal
@param string $str roman numerals
@return int decimal | [
"convert",
"roman",
"numerals",
"to",
"decimal"
] | 60721a61a0050c83e876cbf009e70aa93cabb1d2 | https://github.com/taniko/romans/blob/60721a61a0050c83e876cbf009e70aa93cabb1d2/src/Parser.php#L19-L30 |
5,145 | taniko/romans | src/Parser.php | Parser.toRoman | public static function toRoman(int $num) : string
{
$result = '';
foreach (self::$romans as $roman => $value) {
$matches = intval($num / $value);
$result .= str_repeat($roman, $matches);
$num = $num % $value;
}
return $result;
} | php | public static function toRoman(int $num) : string
{
$result = '';
foreach (self::$romans as $roman => $value) {
$matches = intval($num / $value);
$result .= str_repeat($roman, $matches);
$num = $num % $value;
}
return $result;
} | [
"public",
"static",
"function",
"toRoman",
"(",
"int",
"$",
"num",
")",
":",
"string",
"{",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",
"self",
"::",
"$",
"romans",
"as",
"$",
"roman",
"=>",
"$",
"value",
")",
"{",
"$",
"matches",
"=",
"intval",
"(",
"$",
"num",
"/",
"$",
"value",
")",
";",
"$",
"result",
".=",
"str_repeat",
"(",
"$",
"roman",
",",
"$",
"matches",
")",
";",
"$",
"num",
"=",
"$",
"num",
"%",
"$",
"value",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | convert decimal to roman numerals
@param int $num decimal
@return string roman numerals | [
"convert",
"decimal",
"to",
"roman",
"numerals"
] | 60721a61a0050c83e876cbf009e70aa93cabb1d2 | https://github.com/taniko/romans/blob/60721a61a0050c83e876cbf009e70aa93cabb1d2/src/Parser.php#L37-L46 |
5,146 | unikent/lib-php-collections | src/API.php | API.solr_client | public function solr_client() {
if (!isset($this->_solrclient)) {
$this->_solrclient = new \Solarium\Client(array(
'endpoint' => array(
'localhost' => array(
'host' => $this->_url,
'port' => $this->_solr_port,
'path' => '/solr/' . $this->_collection . '/'
)
)
));
}
return $this->_solrclient;
} | php | public function solr_client() {
if (!isset($this->_solrclient)) {
$this->_solrclient = new \Solarium\Client(array(
'endpoint' => array(
'localhost' => array(
'host' => $this->_url,
'port' => $this->_solr_port,
'path' => '/solr/' . $this->_collection . '/'
)
)
));
}
return $this->_solrclient;
} | [
"public",
"function",
"solr_client",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_solrclient",
")",
")",
"{",
"$",
"this",
"->",
"_solrclient",
"=",
"new",
"\\",
"Solarium",
"\\",
"Client",
"(",
"array",
"(",
"'endpoint'",
"=>",
"array",
"(",
"'localhost'",
"=>",
"array",
"(",
"'host'",
"=>",
"$",
"this",
"->",
"_url",
",",
"'port'",
"=>",
"$",
"this",
"->",
"_solr_port",
",",
"'path'",
"=>",
"'/solr/'",
".",
"$",
"this",
"->",
"_collection",
".",
"'/'",
")",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_solrclient",
";",
"}"
] | Returns the SOLR client. | [
"Returns",
"the",
"SOLR",
"client",
"."
] | 8bb57de388641fd3adf8c94a90e70961907fb2cf | https://github.com/unikent/lib-php-collections/blob/8bb57de388641fd3adf8c94a90e70961907fb2cf/src/API.php#L125-L139 |
5,147 | unikent/lib-php-collections | src/API.php | API.build_rest_url | protected function build_rest_url($url, $params = array()) {
$base = '';
if (substr($this->_url, 0, 4) !== 'http') {
$base .= 'http://';
}
$base .= $this->_url;
if ($this->_port != 80) {
$base .= ':' . $this->_port;
}
$rurl = new \Rapid\URL($base . '/api/' . $url, $params);
return $rurl->out();
} | php | protected function build_rest_url($url, $params = array()) {
$base = '';
if (substr($this->_url, 0, 4) !== 'http') {
$base .= 'http://';
}
$base .= $this->_url;
if ($this->_port != 80) {
$base .= ':' . $this->_port;
}
$rurl = new \Rapid\URL($base . '/api/' . $url, $params);
return $rurl->out();
} | [
"protected",
"function",
"build_rest_url",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"base",
"=",
"''",
";",
"if",
"(",
"substr",
"(",
"$",
"this",
"->",
"_url",
",",
"0",
",",
"4",
")",
"!==",
"'http'",
")",
"{",
"$",
"base",
".=",
"'http://'",
";",
"}",
"$",
"base",
".=",
"$",
"this",
"->",
"_url",
";",
"if",
"(",
"$",
"this",
"->",
"_port",
"!=",
"80",
")",
"{",
"$",
"base",
".=",
"':'",
".",
"$",
"this",
"->",
"_port",
";",
"}",
"$",
"rurl",
"=",
"new",
"\\",
"Rapid",
"\\",
"URL",
"(",
"$",
"base",
".",
"'/api/'",
".",
"$",
"url",
",",
"$",
"params",
")",
";",
"return",
"$",
"rurl",
"->",
"out",
"(",
")",
";",
"}"
] | Build a REST URL.
@internal. | [
"Build",
"a",
"REST",
"URL",
"."
] | 8bb57de388641fd3adf8c94a90e70961907fb2cf | https://github.com/unikent/lib-php-collections/blob/8bb57de388641fd3adf8c94a90e70961907fb2cf/src/API.php#L173-L186 |
5,148 | unikent/lib-php-collections | src/API.php | API.api_call | protected function api_call($url, $params) {
$url = $this->build_rest_url($url, $params);
$result = $this->curl($url);
return json_decode($result);
} | php | protected function api_call($url, $params) {
$url = $this->build_rest_url($url, $params);
$result = $this->curl($url);
return json_decode($result);
} | [
"protected",
"function",
"api_call",
"(",
"$",
"url",
",",
"$",
"params",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"build_rest_url",
"(",
"$",
"url",
",",
"$",
"params",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"curl",
"(",
"$",
"url",
")",
";",
"return",
"json_decode",
"(",
"$",
"result",
")",
";",
"}"
] | Shorthand for API call. | [
"Shorthand",
"for",
"API",
"call",
"."
] | 8bb57de388641fd3adf8c94a90e70961907fb2cf | https://github.com/unikent/lib-php-collections/blob/8bb57de388641fd3adf8c94a90e70961907fb2cf/src/API.php#L191-L195 |
5,149 | unikent/lib-php-collections | src/API.php | API.get_images | public function get_images() {
$results = $this->api_call('images.php', array(
'collection' => $this->get_type()
));
return array_map(function($o) {
return $this->get_image($o);
}, $results);
} | php | public function get_images() {
$results = $this->api_call('images.php', array(
'collection' => $this->get_type()
));
return array_map(function($o) {
return $this->get_image($o);
}, $results);
} | [
"public",
"function",
"get_images",
"(",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"api_call",
"(",
"'images.php'",
",",
"array",
"(",
"'collection'",
"=>",
"$",
"this",
"->",
"get_type",
"(",
")",
")",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"$",
"o",
")",
"{",
"return",
"$",
"this",
"->",
"get_image",
"(",
"$",
"o",
")",
";",
"}",
",",
"$",
"results",
")",
";",
"}"
] | Returns a list of images in the collection. | [
"Returns",
"a",
"list",
"of",
"images",
"in",
"the",
"collection",
"."
] | 8bb57de388641fd3adf8c94a90e70961907fb2cf | https://github.com/unikent/lib-php-collections/blob/8bb57de388641fd3adf8c94a90e70961907fb2cf/src/API.php#L200-L208 |
5,150 | tux-rampage/rampage-php | library/rampage/core/ServiceManager.php | ServiceManager.setShared | public function setShared($name, $isShared)
{
$cName = $this->canonicalizeName($name);
$this->shared[$cName] = (bool)$isShared;
return $this;
} | php | public function setShared($name, $isShared)
{
$cName = $this->canonicalizeName($name);
$this->shared[$cName] = (bool)$isShared;
return $this;
} | [
"public",
"function",
"setShared",
"(",
"$",
"name",
",",
"$",
"isShared",
")",
"{",
"$",
"cName",
"=",
"$",
"this",
"->",
"canonicalizeName",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"shared",
"[",
"$",
"cName",
"]",
"=",
"(",
"bool",
")",
"$",
"isShared",
";",
"return",
"$",
"this",
";",
"}"
] | Custom setShared implementation.
This does not check if a service can be instanciated by this service manager.
Definitions may be added at runtime so don't care about instanciability.
@param string $name The service to mark as shared or not shared
@param bool $isShared Flag if the service should be shared or not
@return \rampage\core\ServiceManager | [
"Custom",
"setShared",
"implementation",
"."
] | 1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf | https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/ServiceManager.php#L68-L74 |
5,151 | tux-rampage/rampage-php | library/rampage/core/ServiceManager.php | ServiceManager.setInvokableClass | public function setInvokableClass($name, $invokableClass, $shared = null)
{
$invokableClass = strtr($invokableClass, '.', '\\');
return parent::setInvokableClass($name, $invokableClass, $shared);
} | php | public function setInvokableClass($name, $invokableClass, $shared = null)
{
$invokableClass = strtr($invokableClass, '.', '\\');
return parent::setInvokableClass($name, $invokableClass, $shared);
} | [
"public",
"function",
"setInvokableClass",
"(",
"$",
"name",
",",
"$",
"invokableClass",
",",
"$",
"shared",
"=",
"null",
")",
"{",
"$",
"invokableClass",
"=",
"strtr",
"(",
"$",
"invokableClass",
",",
"'.'",
",",
"'\\\\'",
")",
";",
"return",
"parent",
"::",
"setInvokableClass",
"(",
"$",
"name",
",",
"$",
"invokableClass",
",",
"$",
"shared",
")",
";",
"}"
] | Auto convert dottet class names to PHP class names
@see \Zend\ServiceManager\ServiceManager::setInvokableClass() | [
"Auto",
"convert",
"dottet",
"class",
"names",
"to",
"PHP",
"class",
"names"
] | 1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf | https://github.com/tux-rampage/rampage-php/blob/1c679b04a6d477e2f8fdb86135e1d9f0c128b1cf/library/rampage/core/ServiceManager.php#L81-L85 |
5,152 | raideer/tweech-irc-parser | src/Parser.php | Parser.parseParameters | protected function parseParameters($parsed)
{
$command = strtoupper($parsed['command']);
if (!array_key_exists($command, $this->paramsRegex)) {
return $parsed;
}
if (!preg_match($this->paramsRegex[$command], $parsed['params'], $params)) {
return $parsed;
}
$parsed = array_merge($parsed, $params);
if ($command == 353 && array_key_exists('users', $parsed)) {
$parsed['users'] = explode(' ', $parsed['users']);
}
return $this->removeIntegerKeys($parsed);
} | php | protected function parseParameters($parsed)
{
$command = strtoupper($parsed['command']);
if (!array_key_exists($command, $this->paramsRegex)) {
return $parsed;
}
if (!preg_match($this->paramsRegex[$command], $parsed['params'], $params)) {
return $parsed;
}
$parsed = array_merge($parsed, $params);
if ($command == 353 && array_key_exists('users', $parsed)) {
$parsed['users'] = explode(' ', $parsed['users']);
}
return $this->removeIntegerKeys($parsed);
} | [
"protected",
"function",
"parseParameters",
"(",
"$",
"parsed",
")",
"{",
"$",
"command",
"=",
"strtoupper",
"(",
"$",
"parsed",
"[",
"'command'",
"]",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"command",
",",
"$",
"this",
"->",
"paramsRegex",
")",
")",
"{",
"return",
"$",
"parsed",
";",
"}",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
"paramsRegex",
"[",
"$",
"command",
"]",
",",
"$",
"parsed",
"[",
"'params'",
"]",
",",
"$",
"params",
")",
")",
"{",
"return",
"$",
"parsed",
";",
"}",
"$",
"parsed",
"=",
"array_merge",
"(",
"$",
"parsed",
",",
"$",
"params",
")",
";",
"if",
"(",
"$",
"command",
"==",
"353",
"&&",
"array_key_exists",
"(",
"'users'",
",",
"$",
"parsed",
")",
")",
"{",
"$",
"parsed",
"[",
"'users'",
"]",
"=",
"explode",
"(",
"' '",
",",
"$",
"parsed",
"[",
"'users'",
"]",
")",
";",
"}",
"return",
"$",
"this",
"->",
"removeIntegerKeys",
"(",
"$",
"parsed",
")",
";",
"}"
] | Checks each message and runs the parameters through regex.
@param array $parsed
@return array | [
"Checks",
"each",
"message",
"and",
"runs",
"the",
"parameters",
"through",
"regex",
"."
] | 137ca6ecb74c4398169c1af9079e5dccb370e318 | https://github.com/raideer/tweech-irc-parser/blob/137ca6ecb74c4398169c1af9079e5dccb370e318/src/Parser.php#L96-L115 |
5,153 | raideer/tweech-irc-parser | src/Parser.php | Parser.parse | public function parse($message)
{
//Checking if the message is a full line
if (strpos($message, "\r\n") === false) {
return;
}
//Parsing the message
if (!preg_match($this->messageRegex, $message, $parsed)) {
$parsed = ['invalid' => $message];
return $parsed;
}
/*
* Raw message
*/
$parsed['raw'] = $parsed[0];
$parsed = $this->parseParameters($parsed);
return $this->removeIntegerKeys($parsed);
} | php | public function parse($message)
{
//Checking if the message is a full line
if (strpos($message, "\r\n") === false) {
return;
}
//Parsing the message
if (!preg_match($this->messageRegex, $message, $parsed)) {
$parsed = ['invalid' => $message];
return $parsed;
}
/*
* Raw message
*/
$parsed['raw'] = $parsed[0];
$parsed = $this->parseParameters($parsed);
return $this->removeIntegerKeys($parsed);
} | [
"public",
"function",
"parse",
"(",
"$",
"message",
")",
"{",
"//Checking if the message is a full line",
"if",
"(",
"strpos",
"(",
"$",
"message",
",",
"\"\\r\\n\"",
")",
"===",
"false",
")",
"{",
"return",
";",
"}",
"//Parsing the message",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
"messageRegex",
",",
"$",
"message",
",",
"$",
"parsed",
")",
")",
"{",
"$",
"parsed",
"=",
"[",
"'invalid'",
"=>",
"$",
"message",
"]",
";",
"return",
"$",
"parsed",
";",
"}",
"/*\n * Raw message\n */",
"$",
"parsed",
"[",
"'raw'",
"]",
"=",
"$",
"parsed",
"[",
"0",
"]",
";",
"$",
"parsed",
"=",
"$",
"this",
"->",
"parseParameters",
"(",
"$",
"parsed",
")",
";",
"return",
"$",
"this",
"->",
"removeIntegerKeys",
"(",
"$",
"parsed",
")",
";",
"}"
] | Main parsing function.
@param string $message Received irc message
@return array Parsed | [
"Main",
"parsing",
"function",
"."
] | 137ca6ecb74c4398169c1af9079e5dccb370e318 | https://github.com/raideer/tweech-irc-parser/blob/137ca6ecb74c4398169c1af9079e5dccb370e318/src/Parser.php#L124-L146 |
5,154 | osflab/view | Helper/Bootstrap/Addon/Menu.php | Menu.setMenu | public function setMenu(DropDownMenu $menu)
{
if ($this->menu instanceof DropDownMenu) {
Checkers::notice('A dropdown menu already exists. The old one will be delete.');
}
$this->menu = $menu;
return $this;
} | php | public function setMenu(DropDownMenu $menu)
{
if ($this->menu instanceof DropDownMenu) {
Checkers::notice('A dropdown menu already exists. The old one will be delete.');
}
$this->menu = $menu;
return $this;
} | [
"public",
"function",
"setMenu",
"(",
"DropDownMenu",
"$",
"menu",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"menu",
"instanceof",
"DropDownMenu",
")",
"{",
"Checkers",
"::",
"notice",
"(",
"'A dropdown menu already exists. The old one will be delete.'",
")",
";",
"}",
"$",
"this",
"->",
"menu",
"=",
"$",
"menu",
";",
"return",
"$",
"this",
";",
"}"
] | Attach a dropdown menu
@param \Osf\View\Helper\Bootstrap\Addon\Addon\DropDownMenu $menu
@return $this | [
"Attach",
"a",
"dropdown",
"menu"
] | e06601013e8ec86dc2055e000e58dffd963c78e2 | https://github.com/osflab/view/blob/e06601013e8ec86dc2055e000e58dffd963c78e2/Helper/Bootstrap/Addon/Menu.php#L35-L42 |
5,155 | osflab/view | Helper/Bootstrap/Addon/Menu.php | Menu.getMenuAttributes | public function getMenuAttributes():array
{
if ($this->menu !== null) {
$attrs = [];
if ($this->menu->getOrientationClass() == 'dropdown') {
$attrs['id'] = $this->menu->getLabelledBy();
}
$attrs['data-toggle'] = 'dropdown';
$attrs['aria-haspopup'] = 'true';
$attrs['aria-expanded'] = 'false';
return $attrs;
}
return [];
} | php | public function getMenuAttributes():array
{
if ($this->menu !== null) {
$attrs = [];
if ($this->menu->getOrientationClass() == 'dropdown') {
$attrs['id'] = $this->menu->getLabelledBy();
}
$attrs['data-toggle'] = 'dropdown';
$attrs['aria-haspopup'] = 'true';
$attrs['aria-expanded'] = 'false';
return $attrs;
}
return [];
} | [
"public",
"function",
"getMenuAttributes",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"menu",
"!==",
"null",
")",
"{",
"$",
"attrs",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"menu",
"->",
"getOrientationClass",
"(",
")",
"==",
"'dropdown'",
")",
"{",
"$",
"attrs",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
"menu",
"->",
"getLabelledBy",
"(",
")",
";",
"}",
"$",
"attrs",
"[",
"'data-toggle'",
"]",
"=",
"'dropdown'",
";",
"$",
"attrs",
"[",
"'aria-haspopup'",
"]",
"=",
"'true'",
";",
"$",
"attrs",
"[",
"'aria-expanded'",
"]",
"=",
"'false'",
";",
"return",
"$",
"attrs",
";",
"}",
"return",
"[",
"]",
";",
"}"
] | Attributes to add to attached element
@return array | [
"Attributes",
"to",
"add",
"to",
"attached",
"element"
] | e06601013e8ec86dc2055e000e58dffd963c78e2 | https://github.com/osflab/view/blob/e06601013e8ec86dc2055e000e58dffd963c78e2/Helper/Bootstrap/Addon/Menu.php#L48-L61 |
5,156 | ripaclub/zf2-hanger-snippet | src/View/Helper/SnippetHelper.php | SnippetHelper.setEnableAll | public function setEnableAll()
{
foreach ($this->snippets as $name => $config) {
$this->setEnabled($name);
}
return $this;
} | php | public function setEnableAll()
{
foreach ($this->snippets as $name => $config) {
$this->setEnabled($name);
}
return $this;
} | [
"public",
"function",
"setEnableAll",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"snippets",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"setEnabled",
"(",
"$",
"name",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Set Enable All
@return $this | [
"Set",
"Enable",
"All"
] | f055fe49eabea6f963b20e7db8fb81edf3eb3545 | https://github.com/ripaclub/zf2-hanger-snippet/blob/f055fe49eabea6f963b20e7db8fb81edf3eb3545/src/View/Helper/SnippetHelper.php#L57-L63 |
5,157 | ripaclub/zf2-hanger-snippet | src/View/Helper/SnippetHelper.php | SnippetHelper.setDisableAll | public function setDisableAll()
{
foreach ($this->snippets as $name => $config) {
$this->setDisabled($name);
}
return $this;
} | php | public function setDisableAll()
{
foreach ($this->snippets as $name => $config) {
$this->setDisabled($name);
}
return $this;
} | [
"public",
"function",
"setDisableAll",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"snippets",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"setDisabled",
"(",
"$",
"name",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Set Disable All
@return $this | [
"Set",
"Disable",
"All"
] | f055fe49eabea6f963b20e7db8fb81edf3eb3545 | https://github.com/ripaclub/zf2-hanger-snippet/blob/f055fe49eabea6f963b20e7db8fb81edf3eb3545/src/View/Helper/SnippetHelper.php#L69-L75 |
5,158 | ripaclub/zf2-hanger-snippet | src/View/Helper/SnippetHelper.php | SnippetHelper.renderSnippet | public function renderSnippet($name)
{
if (!isset($this->snippets[$name])) {
throw new InvalidArgumentException(
sprintf(
"Cannot find a snippet with name '%s'",
$name
)
);
}
return $this->getView()->render(
$this->snippets[$name]['template'],
$this->snippets[$name]['values']
);
} | php | public function renderSnippet($name)
{
if (!isset($this->snippets[$name])) {
throw new InvalidArgumentException(
sprintf(
"Cannot find a snippet with name '%s'",
$name
)
);
}
return $this->getView()->render(
$this->snippets[$name]['template'],
$this->snippets[$name]['values']
);
} | [
"public",
"function",
"renderSnippet",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"snippets",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"\"Cannot find a snippet with name '%s'\"",
",",
"$",
"name",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getView",
"(",
")",
"->",
"render",
"(",
"$",
"this",
"->",
"snippets",
"[",
"$",
"name",
"]",
"[",
"'template'",
"]",
",",
"$",
"this",
"->",
"snippets",
"[",
"$",
"name",
"]",
"[",
"'values'",
"]",
")",
";",
"}"
] | Render a single snippet
@param string $name The snippet name
@throws InvalidArgumentException
@return string | [
"Render",
"a",
"single",
"snippet"
] | f055fe49eabea6f963b20e7db8fb81edf3eb3545 | https://github.com/ripaclub/zf2-hanger-snippet/blob/f055fe49eabea6f963b20e7db8fb81edf3eb3545/src/View/Helper/SnippetHelper.php#L110-L125 |
5,159 | NuclearCMS/Synthesizer | src/Synthesizer.php | Synthesizer.splitText | protected function splitText($part)
{
if ($part === 'before' || $part === 'rest')
{
$parts = explode(static::separator, $this->text);
if (count($parts) === 1 && $part === 'rest')
{
return null;
}
return ($part === 'before') ? current($parts) : end($parts);
}
return str_replace(static::separator, '', $this->text);
} | php | protected function splitText($part)
{
if ($part === 'before' || $part === 'rest')
{
$parts = explode(static::separator, $this->text);
if (count($parts) === 1 && $part === 'rest')
{
return null;
}
return ($part === 'before') ? current($parts) : end($parts);
}
return str_replace(static::separator, '', $this->text);
} | [
"protected",
"function",
"splitText",
"(",
"$",
"part",
")",
"{",
"if",
"(",
"$",
"part",
"===",
"'before'",
"||",
"$",
"part",
"===",
"'rest'",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"static",
"::",
"separator",
",",
"$",
"this",
"->",
"text",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"===",
"1",
"&&",
"$",
"part",
"===",
"'rest'",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"$",
"part",
"===",
"'before'",
")",
"?",
"current",
"(",
"$",
"parts",
")",
":",
"end",
"(",
"$",
"parts",
")",
";",
"}",
"return",
"str_replace",
"(",
"static",
"::",
"separator",
",",
"''",
",",
"$",
"this",
"->",
"text",
")",
";",
"}"
] | Splits the text into given part
@param string $part
@return string | [
"Splits",
"the",
"text",
"into",
"given",
"part"
] | 750e24b7ab5d625af5471584108d2fad0443dbca | https://github.com/NuclearCMS/Synthesizer/blob/750e24b7ab5d625af5471584108d2fad0443dbca/src/Synthesizer.php#L75-L90 |
5,160 | gbprod/elastica-extra-bundle | src/ElasticaExtraBundle/Handler/DeleteIndexHandler.php | DeleteIndexHandler.handle | public function handle(Client $client, $index)
{
$index = $client->getIndex($index);
if (!$index->exists()) {
throw new IndexNotFoundException($index);
}
$index->delete();
} | php | public function handle(Client $client, $index)
{
$index = $client->getIndex($index);
if (!$index->exists()) {
throw new IndexNotFoundException($index);
}
$index->delete();
} | [
"public",
"function",
"handle",
"(",
"Client",
"$",
"client",
",",
"$",
"index",
")",
"{",
"$",
"index",
"=",
"$",
"client",
"->",
"getIndex",
"(",
"$",
"index",
")",
";",
"if",
"(",
"!",
"$",
"index",
"->",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IndexNotFoundException",
"(",
"$",
"index",
")",
";",
"}",
"$",
"index",
"->",
"delete",
"(",
")",
";",
"}"
] | Handle index deletion command
@param Client $client
@param string $index
@throws IndexNotFoundException | [
"Handle",
"index",
"deletion",
"command"
] | 7a3d925c79903a328a3d07fefe998c0056be7e59 | https://github.com/gbprod/elastica-extra-bundle/blob/7a3d925c79903a328a3d07fefe998c0056be7e59/src/ElasticaExtraBundle/Handler/DeleteIndexHandler.php#L23-L32 |
5,161 | pulkitjalan/requester | src/Requester.php | Requester.getGuzzleClient | public function getGuzzleClient()
{
$guzzle = $this->guzzleClient;
if ($this->retry) {
$guzzle = $this->addRetrySubscriber($guzzle);
}
return $guzzle;
} | php | public function getGuzzleClient()
{
$guzzle = $this->guzzleClient;
if ($this->retry) {
$guzzle = $this->addRetrySubscriber($guzzle);
}
return $guzzle;
} | [
"public",
"function",
"getGuzzleClient",
"(",
")",
"{",
"$",
"guzzle",
"=",
"$",
"this",
"->",
"guzzleClient",
";",
"if",
"(",
"$",
"this",
"->",
"retry",
")",
"{",
"$",
"guzzle",
"=",
"$",
"this",
"->",
"addRetrySubscriber",
"(",
"$",
"guzzle",
")",
";",
"}",
"return",
"$",
"guzzle",
";",
"}"
] | Getter for guzzle client.
@return \GuzzleHttp\Client | [
"Getter",
"for",
"guzzle",
"client",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L96-L105 |
5,162 | pulkitjalan/requester | src/Requester.php | Requester.addLogger | public function addLogger($logger, $format = 'CLF')
{
if (defined('GuzzleHttp\Subscriber\Log\Formatter::'.$format)) {
$format = constant('GuzzleHttp\Subscriber\Log\Formatter::'.$format);
}
$subscriber = new LogSubscriber($logger, $format);
$this->guzzleClient->getEmitter()->attach($subscriber);
} | php | public function addLogger($logger, $format = 'CLF')
{
if (defined('GuzzleHttp\Subscriber\Log\Formatter::'.$format)) {
$format = constant('GuzzleHttp\Subscriber\Log\Formatter::'.$format);
}
$subscriber = new LogSubscriber($logger, $format);
$this->guzzleClient->getEmitter()->attach($subscriber);
} | [
"public",
"function",
"addLogger",
"(",
"$",
"logger",
",",
"$",
"format",
"=",
"'CLF'",
")",
"{",
"if",
"(",
"defined",
"(",
"'GuzzleHttp\\Subscriber\\Log\\Formatter::'",
".",
"$",
"format",
")",
")",
"{",
"$",
"format",
"=",
"constant",
"(",
"'GuzzleHttp\\Subscriber\\Log\\Formatter::'",
".",
"$",
"format",
")",
";",
"}",
"$",
"subscriber",
"=",
"new",
"LogSubscriber",
"(",
"$",
"logger",
",",
"$",
"format",
")",
";",
"$",
"this",
"->",
"guzzleClient",
"->",
"getEmitter",
"(",
")",
"->",
"attach",
"(",
"$",
"subscriber",
")",
";",
"}"
] | Add a logger to the guzzle client.
@param Logger $logger PSR-3 Logger instance (monolog)
@param string $format Log output format
@return void | [
"Add",
"a",
"logger",
"to",
"the",
"guzzle",
"client",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L115-L123 |
5,163 | pulkitjalan/requester | src/Requester.php | Requester.addFile | public function addFile($filepath, $key = 'file')
{
$this->options = array_merge_recursive($this->options, [
'body' => [
$key => fopen($filepath, 'r'),
],
]);
return $this;
} | php | public function addFile($filepath, $key = 'file')
{
$this->options = array_merge_recursive($this->options, [
'body' => [
$key => fopen($filepath, 'r'),
],
]);
return $this;
} | [
"public",
"function",
"addFile",
"(",
"$",
"filepath",
",",
"$",
"key",
"=",
"'file'",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"array_merge_recursive",
"(",
"$",
"this",
"->",
"options",
",",
"[",
"'body'",
"=>",
"[",
"$",
"key",
"=>",
"fopen",
"(",
"$",
"filepath",
",",
"'r'",
")",
",",
"]",
",",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a file to the request.
@param string $filepath path to file
@param string $key optional post key, default to file
@return \PulkitJalan\Requester\Requester | [
"Add",
"a",
"file",
"to",
"the",
"request",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L244-L253 |
5,164 | pulkitjalan/requester | src/Requester.php | Requester.getUrl | public function getUrl()
{
if (!$this->url) {
throw new InvalidUrlException();
}
$url = $this->url;
if (! parse_url($this->url, PHP_URL_SCHEME)) {
$url = $this->getProtocol().$url;
}
return $url;
} | php | public function getUrl()
{
if (!$this->url) {
throw new InvalidUrlException();
}
$url = $this->url;
if (! parse_url($this->url, PHP_URL_SCHEME)) {
$url = $this->getProtocol().$url;
}
return $url;
} | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"url",
")",
"{",
"throw",
"new",
"InvalidUrlException",
"(",
")",
";",
"}",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
";",
"if",
"(",
"!",
"parse_url",
"(",
"$",
"this",
"->",
"url",
",",
"PHP_URL_SCHEME",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getProtocol",
"(",
")",
".",
"$",
"url",
";",
"}",
"return",
"$",
"url",
";",
"}"
] | Getter for the url will append protocol if one does not exist.
@return string | [
"Getter",
"for",
"the",
"url",
"will",
"append",
"protocol",
"if",
"one",
"does",
"not",
"exist",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L344-L357 |
5,165 | pulkitjalan/requester | src/Requester.php | Requester.getOptions | public function getOptions($options)
{
// Add verify to options
$options = array_merge(['verify' => $this->verify], $options);
if ($this->async) {
$options = array_merge(['future' => true], $options);
}
// merge and return
return array_merge_recursive($this->options, $options);
} | php | public function getOptions($options)
{
// Add verify to options
$options = array_merge(['verify' => $this->verify], $options);
if ($this->async) {
$options = array_merge(['future' => true], $options);
}
// merge and return
return array_merge_recursive($this->options, $options);
} | [
"public",
"function",
"getOptions",
"(",
"$",
"options",
")",
"{",
"// Add verify to options",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'verify'",
"=>",
"$",
"this",
"->",
"verify",
"]",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"this",
"->",
"async",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'future'",
"=>",
"true",
"]",
",",
"$",
"options",
")",
";",
"}",
"// merge and return",
"return",
"array_merge_recursive",
"(",
"$",
"this",
"->",
"options",
",",
"$",
"options",
")",
";",
"}"
] | Getter for options.
@return array | [
"Getter",
"for",
"options",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L364-L375 |
5,166 | pulkitjalan/requester | src/Requester.php | Requester.send | protected function send($function, array $options = [])
{
$guzzle = $this->getGuzzleClient();
$url = $this->getUrl();
// merge options
$options = $this->getOptions($options);
// need to reset after every request
$this->initialize();
return $guzzle->$function($url, $options);
} | php | protected function send($function, array $options = [])
{
$guzzle = $this->getGuzzleClient();
$url = $this->getUrl();
// merge options
$options = $this->getOptions($options);
// need to reset after every request
$this->initialize();
return $guzzle->$function($url, $options);
} | [
"protected",
"function",
"send",
"(",
"$",
"function",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"guzzle",
"=",
"$",
"this",
"->",
"getGuzzleClient",
"(",
")",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrl",
"(",
")",
";",
"// merge options",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
"$",
"options",
")",
";",
"// need to reset after every request",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"return",
"$",
"guzzle",
"->",
"$",
"function",
"(",
"$",
"url",
",",
"$",
"options",
")",
";",
"}"
] | Send the request using guzzle.
@param string $function function to call on guzzle
@param array $options options to pass
@return \GuzzleHttp\Message\ResponseInterface | [
"Send",
"the",
"request",
"using",
"guzzle",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L385-L398 |
5,167 | pulkitjalan/requester | src/Requester.php | Requester.addRetrySubscriber | protected function addRetrySubscriber(GuzzleClient $guzzle)
{
// Build retry subscriber
$retry = new RetrySubscriber([
'filter' => RetrySubscriber::createStatusFilter($this->retryOn),
'delay' => function ($number, $event) {
return $this->retryDelay;
},
'max' => $this->retry,
]);
// add the retry emitter
$guzzle->getEmitter()->attach($retry);
return $guzzle;
} | php | protected function addRetrySubscriber(GuzzleClient $guzzle)
{
// Build retry subscriber
$retry = new RetrySubscriber([
'filter' => RetrySubscriber::createStatusFilter($this->retryOn),
'delay' => function ($number, $event) {
return $this->retryDelay;
},
'max' => $this->retry,
]);
// add the retry emitter
$guzzle->getEmitter()->attach($retry);
return $guzzle;
} | [
"protected",
"function",
"addRetrySubscriber",
"(",
"GuzzleClient",
"$",
"guzzle",
")",
"{",
"// Build retry subscriber",
"$",
"retry",
"=",
"new",
"RetrySubscriber",
"(",
"[",
"'filter'",
"=>",
"RetrySubscriber",
"::",
"createStatusFilter",
"(",
"$",
"this",
"->",
"retryOn",
")",
",",
"'delay'",
"=>",
"function",
"(",
"$",
"number",
",",
"$",
"event",
")",
"{",
"return",
"$",
"this",
"->",
"retryDelay",
";",
"}",
",",
"'max'",
"=>",
"$",
"this",
"->",
"retry",
",",
"]",
")",
";",
"// add the retry emitter",
"$",
"guzzle",
"->",
"getEmitter",
"(",
")",
"->",
"attach",
"(",
"$",
"retry",
")",
";",
"return",
"$",
"guzzle",
";",
"}"
] | Add the retry subscriber to the guzzle client.
@param \GuzzleHttp\Client $guzzle
@return \GuzzleHttp\Client | [
"Add",
"the",
"retry",
"subscriber",
"to",
"the",
"guzzle",
"client",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L407-L422 |
5,168 | pulkitjalan/requester | src/Requester.php | Requester.initialize | protected function initialize()
{
$this->url = '';
$this->options = [];
$this->secure = array_get($this->config, 'secure', true);
$this->retryOn = array_get($this->config, 'retry.on', [500, 502, 503, 504]);
$this->retryDelay = array_get($this->config, 'retry.delay', 10);
$this->retry = array_get($this->config, 'retry.times', 5);
$this->verify = array_get($this->config, 'verify', true);
$this->async = array_get($this->config, 'async', false);
} | php | protected function initialize()
{
$this->url = '';
$this->options = [];
$this->secure = array_get($this->config, 'secure', true);
$this->retryOn = array_get($this->config, 'retry.on', [500, 502, 503, 504]);
$this->retryDelay = array_get($this->config, 'retry.delay', 10);
$this->retry = array_get($this->config, 'retry.times', 5);
$this->verify = array_get($this->config, 'verify', true);
$this->async = array_get($this->config, 'async', false);
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"''",
";",
"$",
"this",
"->",
"options",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"secure",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'secure'",
",",
"true",
")",
";",
"$",
"this",
"->",
"retryOn",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'retry.on'",
",",
"[",
"500",
",",
"502",
",",
"503",
",",
"504",
"]",
")",
";",
"$",
"this",
"->",
"retryDelay",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'retry.delay'",
",",
"10",
")",
";",
"$",
"this",
"->",
"retry",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'retry.times'",
",",
"5",
")",
";",
"$",
"this",
"->",
"verify",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'verify'",
",",
"true",
")",
";",
"$",
"this",
"->",
"async",
"=",
"array_get",
"(",
"$",
"this",
"->",
"config",
",",
"'async'",
",",
"false",
")",
";",
"}"
] | Resets all variables to default values
required if using the same instance for multiple requests.
@return void | [
"Resets",
"all",
"variables",
"to",
"default",
"values",
"required",
"if",
"using",
"the",
"same",
"instance",
"for",
"multiple",
"requests",
"."
] | a5706390a6455e8f97b39b86eed749d1f539c6bd | https://github.com/pulkitjalan/requester/blob/a5706390a6455e8f97b39b86eed749d1f539c6bd/src/Requester.php#L440-L450 |
5,169 | infusephp/admin | src/Controller.php | Controller.adminModules | private function adminModules()
{
$return = [];
foreach ($this->app[ 'config' ]->get('modules.all') as $module) {
$controller = '\\app\\'.$module.'\\Controller';
if (!class_exists($controller)) {
continue;
}
if (property_exists($controller, 'scaffoldAdmin') ||
property_exists($controller, 'hasAdminView')) {
$moduleInfo = [
'name' => $module,
'title' => Inflector::get()->titleize($module), ];
if (property_exists($controller, 'properties')) {
$moduleInfo = array_replace($moduleInfo, $controller::$properties);
}
$return[] = $moduleInfo;
}
}
return $return;
} | php | private function adminModules()
{
$return = [];
foreach ($this->app[ 'config' ]->get('modules.all') as $module) {
$controller = '\\app\\'.$module.'\\Controller';
if (!class_exists($controller)) {
continue;
}
if (property_exists($controller, 'scaffoldAdmin') ||
property_exists($controller, 'hasAdminView')) {
$moduleInfo = [
'name' => $module,
'title' => Inflector::get()->titleize($module), ];
if (property_exists($controller, 'properties')) {
$moduleInfo = array_replace($moduleInfo, $controller::$properties);
}
$return[] = $moduleInfo;
}
}
return $return;
} | [
"private",
"function",
"adminModules",
"(",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'modules.all'",
")",
"as",
"$",
"module",
")",
"{",
"$",
"controller",
"=",
"'\\\\app\\\\'",
".",
"$",
"module",
".",
"'\\\\Controller'",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"controller",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"property_exists",
"(",
"$",
"controller",
",",
"'scaffoldAdmin'",
")",
"||",
"property_exists",
"(",
"$",
"controller",
",",
"'hasAdminView'",
")",
")",
"{",
"$",
"moduleInfo",
"=",
"[",
"'name'",
"=>",
"$",
"module",
",",
"'title'",
"=>",
"Inflector",
"::",
"get",
"(",
")",
"->",
"titleize",
"(",
"$",
"module",
")",
",",
"]",
";",
"if",
"(",
"property_exists",
"(",
"$",
"controller",
",",
"'properties'",
")",
")",
"{",
"$",
"moduleInfo",
"=",
"array_replace",
"(",
"$",
"moduleInfo",
",",
"$",
"controller",
"::",
"$",
"properties",
")",
";",
"}",
"$",
"return",
"[",
"]",
"=",
"$",
"moduleInfo",
";",
"}",
"}",
"return",
"$",
"return",
";",
"}"
] | Returns a list of modules with admin sections.
@param array $modules input modules
@return array admin-enabled modules | [
"Returns",
"a",
"list",
"of",
"modules",
"with",
"admin",
"sections",
"."
] | ba54f1a623e6869835c6ee10f9cd1171c0e47a3c | https://github.com/infusephp/admin/blob/ba54f1a623e6869835c6ee10f9cd1171c0e47a3c/src/Controller.php#L178-L204 |
5,170 | infusephp/admin | src/Controller.php | Controller.fetchModelInfo | private function fetchModelInfo($module, $model = false)
{
// instantiate the controller
$controller = '\\app\\'.$module.'\\Controller';
$controllerObj = new $controller($this->app);
// get info about the controller
$properties = $controller::$properties;
// fetch all available models from the controller
$availableModels = $this->models($controllerObj);
// look for a default model
if (!$model) {
// when there is only one choice, use it
if (count($availableModels) == 1) {
return reset($availableModels);
} else {
$model = U::array_value($properties, 'defaultModel');
}
}
// convert the route name to the pluralized name
$inflector = Inflector::get();
$modelName = $inflector->singularize($inflector->camelize($model));
// attempt to fetch the model info
return U::array_value($availableModels, $modelName);
} | php | private function fetchModelInfo($module, $model = false)
{
// instantiate the controller
$controller = '\\app\\'.$module.'\\Controller';
$controllerObj = new $controller($this->app);
// get info about the controller
$properties = $controller::$properties;
// fetch all available models from the controller
$availableModels = $this->models($controllerObj);
// look for a default model
if (!$model) {
// when there is only one choice, use it
if (count($availableModels) == 1) {
return reset($availableModels);
} else {
$model = U::array_value($properties, 'defaultModel');
}
}
// convert the route name to the pluralized name
$inflector = Inflector::get();
$modelName = $inflector->singularize($inflector->camelize($model));
// attempt to fetch the model info
return U::array_value($availableModels, $modelName);
} | [
"private",
"function",
"fetchModelInfo",
"(",
"$",
"module",
",",
"$",
"model",
"=",
"false",
")",
"{",
"// instantiate the controller",
"$",
"controller",
"=",
"'\\\\app\\\\'",
".",
"$",
"module",
".",
"'\\\\Controller'",
";",
"$",
"controllerObj",
"=",
"new",
"$",
"controller",
"(",
"$",
"this",
"->",
"app",
")",
";",
"// get info about the controller",
"$",
"properties",
"=",
"$",
"controller",
"::",
"$",
"properties",
";",
"// fetch all available models from the controller",
"$",
"availableModels",
"=",
"$",
"this",
"->",
"models",
"(",
"$",
"controllerObj",
")",
";",
"// look for a default model",
"if",
"(",
"!",
"$",
"model",
")",
"{",
"// when there is only one choice, use it",
"if",
"(",
"count",
"(",
"$",
"availableModels",
")",
"==",
"1",
")",
"{",
"return",
"reset",
"(",
"$",
"availableModels",
")",
";",
"}",
"else",
"{",
"$",
"model",
"=",
"U",
"::",
"array_value",
"(",
"$",
"properties",
",",
"'defaultModel'",
")",
";",
"}",
"}",
"// convert the route name to the pluralized name",
"$",
"inflector",
"=",
"Inflector",
"::",
"get",
"(",
")",
";",
"$",
"modelName",
"=",
"$",
"inflector",
"->",
"singularize",
"(",
"$",
"inflector",
"->",
"camelize",
"(",
"$",
"model",
")",
")",
";",
"// attempt to fetch the model info",
"return",
"U",
"::",
"array_value",
"(",
"$",
"availableModels",
",",
"$",
"modelName",
")",
";",
"}"
] | Takes the pluralized model name from the route and gets info about the model.
@param string $modelRouteName the name that comes from the route (i.e. the route "/users" would supply "users")
@return array|null model info | [
"Takes",
"the",
"pluralized",
"model",
"name",
"from",
"the",
"route",
"and",
"gets",
"info",
"about",
"the",
"model",
"."
] | ba54f1a623e6869835c6ee10f9cd1171c0e47a3c | https://github.com/infusephp/admin/blob/ba54f1a623e6869835c6ee10f9cd1171c0e47a3c/src/Controller.php#L258-L286 |
5,171 | infusephp/admin | src/Controller.php | Controller.models | private function models($controller)
{
$properties = $controller::$properties;
$module = $this->name($controller);
$models = [];
foreach ((array) U::array_value($properties, 'models') as $model) {
$modelClassName = '\\app\\'.$module.'\\models\\'.$model;
$info = $modelClassName::metadata();
$models[ $model ] = array_replace($info, [
'route_base' => '/'.$module.'/'.$info[ 'plural_key' ], ]);
}
return $models;
} | php | private function models($controller)
{
$properties = $controller::$properties;
$module = $this->name($controller);
$models = [];
foreach ((array) U::array_value($properties, 'models') as $model) {
$modelClassName = '\\app\\'.$module.'\\models\\'.$model;
$info = $modelClassName::metadata();
$models[ $model ] = array_replace($info, [
'route_base' => '/'.$module.'/'.$info[ 'plural_key' ], ]);
}
return $models;
} | [
"private",
"function",
"models",
"(",
"$",
"controller",
")",
"{",
"$",
"properties",
"=",
"$",
"controller",
"::",
"$",
"properties",
";",
"$",
"module",
"=",
"$",
"this",
"->",
"name",
"(",
"$",
"controller",
")",
";",
"$",
"models",
"=",
"[",
"]",
";",
"foreach",
"(",
"(",
"array",
")",
"U",
"::",
"array_value",
"(",
"$",
"properties",
",",
"'models'",
")",
"as",
"$",
"model",
")",
"{",
"$",
"modelClassName",
"=",
"'\\\\app\\\\'",
".",
"$",
"module",
".",
"'\\\\models\\\\'",
".",
"$",
"model",
";",
"$",
"info",
"=",
"$",
"modelClassName",
"::",
"metadata",
"(",
")",
";",
"$",
"models",
"[",
"$",
"model",
"]",
"=",
"array_replace",
"(",
"$",
"info",
",",
"[",
"'route_base'",
"=>",
"'/'",
".",
"$",
"module",
".",
"'/'",
".",
"$",
"info",
"[",
"'plural_key'",
"]",
",",
"]",
")",
";",
"}",
"return",
"$",
"models",
";",
"}"
] | Fetches the models for a given controller.
@param object $controller
@return array | [
"Fetches",
"the",
"models",
"for",
"a",
"given",
"controller",
"."
] | ba54f1a623e6869835c6ee10f9cd1171c0e47a3c | https://github.com/infusephp/admin/blob/ba54f1a623e6869835c6ee10f9cd1171c0e47a3c/src/Controller.php#L295-L312 |
5,172 | nano7/Database | src/Model/HasScopes.php | HasScopes.applyScopes | protected function applyScopes(QueryBuilder $query, Model $model, $ignoreScopes = [])
{
// Verificar se deve ignorar todos os scopes
if (in_array('*', $ignoreScopes)) {
return;
}
// Carregar lista de scopes
$class = get_called_class();
$scopes = Arr::get(static::$scopes, $class, []);
// Aplicar scopes
foreach ($scopes as $sid => $scope) {
// Verificar se deve ignorar scope especifico
if (! in_array($sid, $ignoreScopes)) {
$scope->apply($query, $model);
}
}
} | php | protected function applyScopes(QueryBuilder $query, Model $model, $ignoreScopes = [])
{
// Verificar se deve ignorar todos os scopes
if (in_array('*', $ignoreScopes)) {
return;
}
// Carregar lista de scopes
$class = get_called_class();
$scopes = Arr::get(static::$scopes, $class, []);
// Aplicar scopes
foreach ($scopes as $sid => $scope) {
// Verificar se deve ignorar scope especifico
if (! in_array($sid, $ignoreScopes)) {
$scope->apply($query, $model);
}
}
} | [
"protected",
"function",
"applyScopes",
"(",
"QueryBuilder",
"$",
"query",
",",
"Model",
"$",
"model",
",",
"$",
"ignoreScopes",
"=",
"[",
"]",
")",
"{",
"// Verificar se deve ignorar todos os scopes",
"if",
"(",
"in_array",
"(",
"'*'",
",",
"$",
"ignoreScopes",
")",
")",
"{",
"return",
";",
"}",
"// Carregar lista de scopes",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"$",
"scopes",
"=",
"Arr",
"::",
"get",
"(",
"static",
"::",
"$",
"scopes",
",",
"$",
"class",
",",
"[",
"]",
")",
";",
"// Aplicar scopes",
"foreach",
"(",
"$",
"scopes",
"as",
"$",
"sid",
"=>",
"$",
"scope",
")",
"{",
"// Verificar se deve ignorar scope especifico",
"if",
"(",
"!",
"in_array",
"(",
"$",
"sid",
",",
"$",
"ignoreScopes",
")",
")",
"{",
"$",
"scope",
"->",
"apply",
"(",
"$",
"query",
",",
"$",
"model",
")",
";",
"}",
"}",
"}"
] | Apply scopes in query.
@param QueryBuilder $query
@param Model $model
@param array $ignoreScopes
@return void | [
"Apply",
"scopes",
"in",
"query",
"."
] | 7d8c10af415c469a317f40471f657104e4d5b52a | https://github.com/nano7/Database/blob/7d8c10af415c469a317f40471f657104e4d5b52a/src/Model/HasScopes.php#L36-L54 |
5,173 | webriq/core | module/User/src/Grid/User/Model/User/Structure.php | Structure.setGroupId | public function setGroupId( $groupId )
{
$this->groupId = (int) $groupId ?: null;
if ( $this->group && $this->group->id != $this->groupId )
{
$this->group = null;
}
return $this;
} | php | public function setGroupId( $groupId )
{
$this->groupId = (int) $groupId ?: null;
if ( $this->group && $this->group->id != $this->groupId )
{
$this->group = null;
}
return $this;
} | [
"public",
"function",
"setGroupId",
"(",
"$",
"groupId",
")",
"{",
"$",
"this",
"->",
"groupId",
"=",
"(",
"int",
")",
"$",
"groupId",
"?",
":",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"group",
"&&",
"$",
"this",
"->",
"group",
"->",
"id",
"!=",
"$",
"this",
"->",
"groupId",
")",
"{",
"$",
"this",
"->",
"group",
"=",
"null",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Set group-id
@param int $groupId
@return \User\Model\User\Structure | [
"Set",
"group",
"-",
"id"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/User/src/Grid/User/Model/User/Structure.php#L277-L287 |
5,174 | webriq/core | module/User/src/Grid/User/Model/User/Structure.php | Structure.getUri | public function getUri( $locale = null )
{
if ( empty( $locale ) )
{
$locale = $this->getLocale();
}
return '/app/'
. $locale
. '/user/view/'
. rawurlencode( $this->displayName );
} | php | public function getUri( $locale = null )
{
if ( empty( $locale ) )
{
$locale = $this->getLocale();
}
return '/app/'
. $locale
. '/user/view/'
. rawurlencode( $this->displayName );
} | [
"public",
"function",
"getUri",
"(",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"locale",
")",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"}",
"return",
"'/app/'",
".",
"$",
"locale",
".",
"'/user/view/'",
".",
"rawurlencode",
"(",
"$",
"this",
"->",
"displayName",
")",
";",
"}"
] | Get url for view user
@param string|null $locale
@return string | [
"Get",
"url",
"for",
"view",
"user"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/User/src/Grid/User/Model/User/Structure.php#L389-L400 |
5,175 | iwyg/template | Section.php | Section.getContent | public function getContent($index = null, $raw = false)
{
if (null === $index) {
return (bool)$raw ? $this->cbuff : join('', $this->cbuff);
}
if (isset($this->cbuff[(int)$index])) {
return $this->cbuff[(int)$index];
}
throw new \OutOfBoundsException(sprintf('No content at buffer %d or empty buffer.', (int)$index));
} | php | public function getContent($index = null, $raw = false)
{
if (null === $index) {
return (bool)$raw ? $this->cbuff : join('', $this->cbuff);
}
if (isset($this->cbuff[(int)$index])) {
return $this->cbuff[(int)$index];
}
throw new \OutOfBoundsException(sprintf('No content at buffer %d or empty buffer.', (int)$index));
} | [
"public",
"function",
"getContent",
"(",
"$",
"index",
"=",
"null",
",",
"$",
"raw",
"=",
"false",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"index",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"raw",
"?",
"$",
"this",
"->",
"cbuff",
":",
"join",
"(",
"''",
",",
"$",
"this",
"->",
"cbuff",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cbuff",
"[",
"(",
"int",
")",
"$",
"index",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cbuff",
"[",
"(",
"int",
")",
"$",
"index",
"]",
";",
"}",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"sprintf",
"(",
"'No content at buffer %d or empty buffer.'",
",",
"(",
"int",
")",
"$",
"index",
")",
")",
";",
"}"
] | Get the contents.
@param int|null $index
@param boolean $raw
@throws \OutOfBoundsException if the given indenx is invalid.
@return string|array | [
"Get",
"the",
"contents",
"."
] | ad7c8e79ce3b8fc7fcf82bc3e53737a4d7ecc16e | https://github.com/iwyg/template/blob/ad7c8e79ce3b8fc7fcf82bc3e53737a4d7ecc16e/Section.php#L70-L81 |
5,176 | phlexible/bundler | Builder/ResolvingBuilder.php | ResolvingBuilder.build | public function build()
{
$file = rtrim($this->cacheDir, '/').'/'.$this->getFilename();
$mapFile = $file.'.map';
$cache = new PuliResourceCollectionCache($file, $this->isDebug());
$resources = $this->resourceFinder->findByType($this->getType());
if (!$cache->isFresh($resources)) {
$resolvedResources = $this->resourceResolver->resolve($resources);
$mappedContent = $this->contentBuilder->build(
$this->getFilename(),
$resolvedResources,
array($this, 'sanitizePath'),
array($this, 'prefixContent')
);
$cache->write($mappedContent->getContent());
file_put_contents($mapFile, $mappedContent->getMap());
if (!$this->debug) {
$this->compressor->compressFile($file);
}
}
return new MappedAsset($file, $mapFile);
} | php | public function build()
{
$file = rtrim($this->cacheDir, '/').'/'.$this->getFilename();
$mapFile = $file.'.map';
$cache = new PuliResourceCollectionCache($file, $this->isDebug());
$resources = $this->resourceFinder->findByType($this->getType());
if (!$cache->isFresh($resources)) {
$resolvedResources = $this->resourceResolver->resolve($resources);
$mappedContent = $this->contentBuilder->build(
$this->getFilename(),
$resolvedResources,
array($this, 'sanitizePath'),
array($this, 'prefixContent')
);
$cache->write($mappedContent->getContent());
file_put_contents($mapFile, $mappedContent->getMap());
if (!$this->debug) {
$this->compressor->compressFile($file);
}
}
return new MappedAsset($file, $mapFile);
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"file",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"cacheDir",
",",
"'/'",
")",
".",
"'/'",
".",
"$",
"this",
"->",
"getFilename",
"(",
")",
";",
"$",
"mapFile",
"=",
"$",
"file",
".",
"'.map'",
";",
"$",
"cache",
"=",
"new",
"PuliResourceCollectionCache",
"(",
"$",
"file",
",",
"$",
"this",
"->",
"isDebug",
"(",
")",
")",
";",
"$",
"resources",
"=",
"$",
"this",
"->",
"resourceFinder",
"->",
"findByType",
"(",
"$",
"this",
"->",
"getType",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"cache",
"->",
"isFresh",
"(",
"$",
"resources",
")",
")",
"{",
"$",
"resolvedResources",
"=",
"$",
"this",
"->",
"resourceResolver",
"->",
"resolve",
"(",
"$",
"resources",
")",
";",
"$",
"mappedContent",
"=",
"$",
"this",
"->",
"contentBuilder",
"->",
"build",
"(",
"$",
"this",
"->",
"getFilename",
"(",
")",
",",
"$",
"resolvedResources",
",",
"array",
"(",
"$",
"this",
",",
"'sanitizePath'",
")",
",",
"array",
"(",
"$",
"this",
",",
"'prefixContent'",
")",
")",
";",
"$",
"cache",
"->",
"write",
"(",
"$",
"mappedContent",
"->",
"getContent",
"(",
")",
")",
";",
"file_put_contents",
"(",
"$",
"mapFile",
",",
"$",
"mappedContent",
"->",
"getMap",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"debug",
")",
"{",
"$",
"this",
"->",
"compressor",
"->",
"compressFile",
"(",
"$",
"file",
")",
";",
"}",
"}",
"return",
"new",
"MappedAsset",
"(",
"$",
"file",
",",
"$",
"mapFile",
")",
";",
"}"
] | Get all javascripts for the given section.
@return MappedAsset | [
"Get",
"all",
"javascripts",
"for",
"the",
"given",
"section",
"."
] | 4b126e8aff03e87e8d5f7e6de6f26b19a3116dfb | https://github.com/phlexible/bundler/blob/4b126e8aff03e87e8d5f7e6de6f26b19a3116dfb/Builder/ResolvingBuilder.php#L88-L115 |
5,177 | LaBlog/LaBlog | src/controllers/PostController.php | PostController.showPosts | public function showPosts($pagenumber = 1)
{
$posts = $this->post->findAll();
$viewParamaters = array(
'global' => $this->global,
'posts' => $posts,
'pageNumber' => $pagenumber
);
return \View::make($this->theme.'.posts', $viewParamaters);
} | php | public function showPosts($pagenumber = 1)
{
$posts = $this->post->findAll();
$viewParamaters = array(
'global' => $this->global,
'posts' => $posts,
'pageNumber' => $pagenumber
);
return \View::make($this->theme.'.posts', $viewParamaters);
} | [
"public",
"function",
"showPosts",
"(",
"$",
"pagenumber",
"=",
"1",
")",
"{",
"$",
"posts",
"=",
"$",
"this",
"->",
"post",
"->",
"findAll",
"(",
")",
";",
"$",
"viewParamaters",
"=",
"array",
"(",
"'global'",
"=>",
"$",
"this",
"->",
"global",
",",
"'posts'",
"=>",
"$",
"posts",
",",
"'pageNumber'",
"=>",
"$",
"pagenumber",
")",
";",
"return",
"\\",
"View",
"::",
"make",
"(",
"$",
"this",
"->",
"theme",
".",
"'.posts'",
",",
"$",
"viewParamaters",
")",
";",
"}"
] | Show all of the posts.
@return \View | [
"Show",
"all",
"of",
"the",
"posts",
"."
] | d23f7848bd9a3993cbb5913d967626e9914a009c | https://github.com/LaBlog/LaBlog/blob/d23f7848bd9a3993cbb5913d967626e9914a009c/src/controllers/PostController.php#L27-L38 |
5,178 | LaBlog/LaBlog | src/controllers/PostController.php | PostController.showPost | public function showPost($category, $postName)
{
if (!$this->post->exists($category, $postName)) {
return \Response::view($this->theme.'.404', array('global' => $this->global), 404);
}
$post = $this->post->getPost($category, $postName);
$category = $this->category->getCategory($category);
$viewParamaters = array(
'post' => $post,
'global' => $this->global,
'category' => $category
);
return \View::make($this->theme.'.post', $viewParamaters);
} | php | public function showPost($category, $postName)
{
if (!$this->post->exists($category, $postName)) {
return \Response::view($this->theme.'.404', array('global' => $this->global), 404);
}
$post = $this->post->getPost($category, $postName);
$category = $this->category->getCategory($category);
$viewParamaters = array(
'post' => $post,
'global' => $this->global,
'category' => $category
);
return \View::make($this->theme.'.post', $viewParamaters);
} | [
"public",
"function",
"showPost",
"(",
"$",
"category",
",",
"$",
"postName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"post",
"->",
"exists",
"(",
"$",
"category",
",",
"$",
"postName",
")",
")",
"{",
"return",
"\\",
"Response",
"::",
"view",
"(",
"$",
"this",
"->",
"theme",
".",
"'.404'",
",",
"array",
"(",
"'global'",
"=>",
"$",
"this",
"->",
"global",
")",
",",
"404",
")",
";",
"}",
"$",
"post",
"=",
"$",
"this",
"->",
"post",
"->",
"getPost",
"(",
"$",
"category",
",",
"$",
"postName",
")",
";",
"$",
"category",
"=",
"$",
"this",
"->",
"category",
"->",
"getCategory",
"(",
"$",
"category",
")",
";",
"$",
"viewParamaters",
"=",
"array",
"(",
"'post'",
"=>",
"$",
"post",
",",
"'global'",
"=>",
"$",
"this",
"->",
"global",
",",
"'category'",
"=>",
"$",
"category",
")",
";",
"return",
"\\",
"View",
"::",
"make",
"(",
"$",
"this",
"->",
"theme",
".",
"'.post'",
",",
"$",
"viewParamaters",
")",
";",
"}"
] | Show a single post.
@param string $postName The name of the post to retrieve.
@return \View | [
"Show",
"a",
"single",
"post",
"."
] | d23f7848bd9a3993cbb5913d967626e9914a009c | https://github.com/LaBlog/LaBlog/blob/d23f7848bd9a3993cbb5913d967626e9914a009c/src/controllers/PostController.php#L45-L61 |
5,179 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.process_file | protected function process_file($file_override = false)
{
$clean_room = function($__file_name, array $__data)
{
extract($__data, EXTR_REFS);
// Capture the view output
ob_start();
try
{
// Load the view within the current scope
include $__file_name;
}
catch (\Exception $e)
{
// Delete the output buffer
ob_end_clean();
// Re-throw the exception
throw $e;
}
// Get the captured output and close the buffer
return ob_get_clean();
};
return $clean_room($file_override ?: $this->file_name, $this->get_data());
} | php | protected function process_file($file_override = false)
{
$clean_room = function($__file_name, array $__data)
{
extract($__data, EXTR_REFS);
// Capture the view output
ob_start();
try
{
// Load the view within the current scope
include $__file_name;
}
catch (\Exception $e)
{
// Delete the output buffer
ob_end_clean();
// Re-throw the exception
throw $e;
}
// Get the captured output and close the buffer
return ob_get_clean();
};
return $clean_room($file_override ?: $this->file_name, $this->get_data());
} | [
"protected",
"function",
"process_file",
"(",
"$",
"file_override",
"=",
"false",
")",
"{",
"$",
"clean_room",
"=",
"function",
"(",
"$",
"__file_name",
",",
"array",
"$",
"__data",
")",
"{",
"extract",
"(",
"$",
"__data",
",",
"EXTR_REFS",
")",
";",
"// Capture the view output",
"ob_start",
"(",
")",
";",
"try",
"{",
"// Load the view within the current scope",
"include",
"$",
"__file_name",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"// Delete the output buffer",
"ob_end_clean",
"(",
")",
";",
"// Re-throw the exception",
"throw",
"$",
"e",
";",
"}",
"// Get the captured output and close the buffer",
"return",
"ob_get_clean",
"(",
")",
";",
"}",
";",
"return",
"$",
"clean_room",
"(",
"$",
"file_override",
"?",
":",
"$",
"this",
"->",
"file_name",
",",
"$",
"this",
"->",
"get_data",
"(",
")",
")",
";",
"}"
] | Captures the output that is generated when a view is included.
The view data will be extracted to make local variables. This method
is static to prevent object scope resolution.
$output = $this->process_file();
@param string File override
@param array variables
@return string | [
"Captures",
"the",
"output",
"that",
"is",
"generated",
"when",
"a",
"view",
"is",
"included",
".",
"The",
"view",
"data",
"will",
"be",
"extracted",
"to",
"make",
"local",
"variables",
".",
"This",
"method",
"is",
"static",
"to",
"prevent",
"object",
"scope",
"resolution",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L228-L255 |
5,180 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.get_data | protected function get_data($scope = 'all')
{
$clean_it = function ($data, $rules, $auto_filter)
{
foreach ($data as $key => &$value)
{
$filter = array_key_exists($key, $rules) ? $rules[$key] : null;
$filter = is_null($filter) ? $auto_filter : $filter;
$value = $filter ? \Security::clean($value, null, 'security.output_filter') : $value;
}
return $data;
};
$data = array();
if ( ! empty($this->data) and ($scope === 'all' or $scope === 'local'))
{
$data += $clean_it($this->data, $this->local_filter, $this->auto_filter);
}
if ( ! empty(static::$global_data) and ($scope === 'all' or $scope === 'global'))
{
$data += $clean_it(static::$global_data, static::$global_filter, $this->auto_filter);
}
return $data;
} | php | protected function get_data($scope = 'all')
{
$clean_it = function ($data, $rules, $auto_filter)
{
foreach ($data as $key => &$value)
{
$filter = array_key_exists($key, $rules) ? $rules[$key] : null;
$filter = is_null($filter) ? $auto_filter : $filter;
$value = $filter ? \Security::clean($value, null, 'security.output_filter') : $value;
}
return $data;
};
$data = array();
if ( ! empty($this->data) and ($scope === 'all' or $scope === 'local'))
{
$data += $clean_it($this->data, $this->local_filter, $this->auto_filter);
}
if ( ! empty(static::$global_data) and ($scope === 'all' or $scope === 'global'))
{
$data += $clean_it(static::$global_data, static::$global_filter, $this->auto_filter);
}
return $data;
} | [
"protected",
"function",
"get_data",
"(",
"$",
"scope",
"=",
"'all'",
")",
"{",
"$",
"clean_it",
"=",
"function",
"(",
"$",
"data",
",",
"$",
"rules",
",",
"$",
"auto_filter",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"$",
"filter",
"=",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"rules",
")",
"?",
"$",
"rules",
"[",
"$",
"key",
"]",
":",
"null",
";",
"$",
"filter",
"=",
"is_null",
"(",
"$",
"filter",
")",
"?",
"$",
"auto_filter",
":",
"$",
"filter",
";",
"$",
"value",
"=",
"$",
"filter",
"?",
"\\",
"Security",
"::",
"clean",
"(",
"$",
"value",
",",
"null",
",",
"'security.output_filter'",
")",
":",
"$",
"value",
";",
"}",
"return",
"$",
"data",
";",
"}",
";",
"$",
"data",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
"and",
"(",
"$",
"scope",
"===",
"'all'",
"or",
"$",
"scope",
"===",
"'local'",
")",
")",
"{",
"$",
"data",
"+=",
"$",
"clean_it",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"local_filter",
",",
"$",
"this",
"->",
"auto_filter",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"static",
"::",
"$",
"global_data",
")",
"and",
"(",
"$",
"scope",
"===",
"'all'",
"or",
"$",
"scope",
"===",
"'global'",
")",
")",
"{",
"$",
"data",
"+=",
"$",
"clean_it",
"(",
"static",
"::",
"$",
"global_data",
",",
"static",
"::",
"$",
"global_filter",
",",
"$",
"this",
"->",
"auto_filter",
")",
";",
"}",
"return",
"$",
"data",
";",
"}"
] | Retrieves all the data, both local and global. It filters the data if
necessary.
$data = $this->get_data();
@param string $scope local/glocal/all
@return array view data | [
"Retrieves",
"all",
"the",
"data",
"both",
"local",
"and",
"global",
".",
"It",
"filters",
"the",
"data",
"if",
"necessary",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L266-L294 |
5,181 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.auto_filter | public function auto_filter($filter = true)
{
if (func_num_args() == 0)
{
return $this->auto_filter;
}
$this->auto_filter = $filter;
return $this;
} | php | public function auto_filter($filter = true)
{
if (func_num_args() == 0)
{
return $this->auto_filter;
}
$this->auto_filter = $filter;
return $this;
} | [
"public",
"function",
"auto_filter",
"(",
"$",
"filter",
"=",
"true",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"auto_filter",
";",
"}",
"$",
"this",
"->",
"auto_filter",
"=",
"$",
"filter",
";",
"return",
"$",
"this",
";",
"}"
] | Sets whether to filter the data or not.
$view->auto_filter(false);
@param bool whether to auto filter or not
@return View | [
"Sets",
"whether",
"to",
"filter",
"the",
"data",
"or",
"not",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L358-L368 |
5,182 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.set_filename | public function set_filename($file)
{
// set find_file's one-time-only search paths
\Finder::instance()->flash($this->request_paths);
// locate the view file
if (($path = \Finder::search('views', $file, '.'.$this->extension, false, false)) === false)
{
throw new \FuelException('The requested view could not be found: '.\Fuel::clean_path($file));
}
// Store the file path locally
$this->file_name = $path;
return $this;
} | php | public function set_filename($file)
{
// set find_file's one-time-only search paths
\Finder::instance()->flash($this->request_paths);
// locate the view file
if (($path = \Finder::search('views', $file, '.'.$this->extension, false, false)) === false)
{
throw new \FuelException('The requested view could not be found: '.\Fuel::clean_path($file));
}
// Store the file path locally
$this->file_name = $path;
return $this;
} | [
"public",
"function",
"set_filename",
"(",
"$",
"file",
")",
"{",
"// set find_file's one-time-only search paths",
"\\",
"Finder",
"::",
"instance",
"(",
")",
"->",
"flash",
"(",
"$",
"this",
"->",
"request_paths",
")",
";",
"// locate the view file",
"if",
"(",
"(",
"$",
"path",
"=",
"\\",
"Finder",
"::",
"search",
"(",
"'views'",
",",
"$",
"file",
",",
"'.'",
".",
"$",
"this",
"->",
"extension",
",",
"false",
",",
"false",
")",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"FuelException",
"(",
"'The requested view could not be found: '",
".",
"\\",
"Fuel",
"::",
"clean_path",
"(",
"$",
"file",
")",
")",
";",
"}",
"// Store the file path locally",
"$",
"this",
"->",
"file_name",
"=",
"$",
"path",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the view filename.
$view->set_filename($file);
@param string view filename
@return View
@throws FuelException | [
"Sets",
"the",
"view",
"filename",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L380-L395 |
5,183 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.& | public function &get($key = null, $default = null)
{
if (func_num_args() === 0 or $key === null)
{
return $this->data;
}
elseif (array_key_exists($key, $this->data))
{
return $this->data[$key];
}
elseif (array_key_exists($key, static::$global_data))
{
return static::$global_data[$key];
}
if (is_null($default) and func_num_args() === 1)
{
throw new \OutOfBoundsException('View variable is not set: '.$key);
}
else
{
// assign it first, you can't return a return value by reference directly!
$default = \Fuel::value($default);
return $default;
}
} | php | public function &get($key = null, $default = null)
{
if (func_num_args() === 0 or $key === null)
{
return $this->data;
}
elseif (array_key_exists($key, $this->data))
{
return $this->data[$key];
}
elseif (array_key_exists($key, static::$global_data))
{
return static::$global_data[$key];
}
if (is_null($default) and func_num_args() === 1)
{
throw new \OutOfBoundsException('View variable is not set: '.$key);
}
else
{
// assign it first, you can't return a return value by reference directly!
$default = \Fuel::value($default);
return $default;
}
} | [
"public",
"function",
"&",
"get",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"===",
"0",
"or",
"$",
"key",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"data",
";",
"}",
"elseif",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
";",
"}",
"elseif",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"static",
"::",
"$",
"global_data",
")",
")",
"{",
"return",
"static",
"::",
"$",
"global_data",
"[",
"$",
"key",
"]",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"default",
")",
"and",
"func_num_args",
"(",
")",
"===",
"1",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'View variable is not set: '",
".",
"$",
"key",
")",
";",
"}",
"else",
"{",
"// assign it first, you can't return a return value by reference directly!",
"$",
"default",
"=",
"\\",
"Fuel",
"::",
"value",
"(",
"$",
"default",
")",
";",
"return",
"$",
"default",
";",
"}",
"}"
] | Searches for the given variable and returns its value.
Local variables will be returned before global variables.
$value = $view->get('foo', 'bar');
If the key is not given or null, the entire data array is returned.
If a default parameter is not given and the variable does not
exist, it will throw an OutOfBoundsException.
@param string The variable name
@param mixed The default value to return
@return mixed
@throws OutOfBoundsException | [
"Searches",
"for",
"the",
"given",
"variable",
"and",
"returns",
"its",
"value",
".",
"Local",
"variables",
"will",
"be",
"returned",
"before",
"global",
"variables",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L413-L438 |
5,184 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/view.php | View.render | public function render($file = null)
{
// reactivate the correct request
if (class_exists('Request', false))
{
$current_request = \Request::active();
\Request::active($this->active_request);
}
// store the current language, and set the correct render language
if ($this->active_language)
{
$current_language = \Config::get('language', 'en');
\Config::set('language', $this->active_language);
}
// override the view filename if needed
if ($file !== null)
{
$this->set_filename($file);
}
// and make sure we have one
if (empty($this->file_name))
{
throw new \FuelException('You must set the file to use within your view before rendering');
}
// combine local and global data and capture the output
$return = $this->process_file();
// restore the current language setting
$this->active_language and \Config::set('language', $current_language);
// and the active request class
if (isset($current_request))
{
\Request::active($current_request);
}
return $return;
} | php | public function render($file = null)
{
// reactivate the correct request
if (class_exists('Request', false))
{
$current_request = \Request::active();
\Request::active($this->active_request);
}
// store the current language, and set the correct render language
if ($this->active_language)
{
$current_language = \Config::get('language', 'en');
\Config::set('language', $this->active_language);
}
// override the view filename if needed
if ($file !== null)
{
$this->set_filename($file);
}
// and make sure we have one
if (empty($this->file_name))
{
throw new \FuelException('You must set the file to use within your view before rendering');
}
// combine local and global data and capture the output
$return = $this->process_file();
// restore the current language setting
$this->active_language and \Config::set('language', $current_language);
// and the active request class
if (isset($current_request))
{
\Request::active($current_request);
}
return $return;
} | [
"public",
"function",
"render",
"(",
"$",
"file",
"=",
"null",
")",
"{",
"// reactivate the correct request",
"if",
"(",
"class_exists",
"(",
"'Request'",
",",
"false",
")",
")",
"{",
"$",
"current_request",
"=",
"\\",
"Request",
"::",
"active",
"(",
")",
";",
"\\",
"Request",
"::",
"active",
"(",
"$",
"this",
"->",
"active_request",
")",
";",
"}",
"// store the current language, and set the correct render language",
"if",
"(",
"$",
"this",
"->",
"active_language",
")",
"{",
"$",
"current_language",
"=",
"\\",
"Config",
"::",
"get",
"(",
"'language'",
",",
"'en'",
")",
";",
"\\",
"Config",
"::",
"set",
"(",
"'language'",
",",
"$",
"this",
"->",
"active_language",
")",
";",
"}",
"// override the view filename if needed",
"if",
"(",
"$",
"file",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"set_filename",
"(",
"$",
"file",
")",
";",
"}",
"// and make sure we have one",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"file_name",
")",
")",
"{",
"throw",
"new",
"\\",
"FuelException",
"(",
"'You must set the file to use within your view before rendering'",
")",
";",
"}",
"// combine local and global data and capture the output",
"$",
"return",
"=",
"$",
"this",
"->",
"process_file",
"(",
")",
";",
"// restore the current language setting",
"$",
"this",
"->",
"active_language",
"and",
"\\",
"Config",
"::",
"set",
"(",
"'language'",
",",
"$",
"current_language",
")",
";",
"// and the active request class",
"if",
"(",
"isset",
"(",
"$",
"current_request",
")",
")",
"{",
"\\",
"Request",
"::",
"active",
"(",
"$",
"current_request",
")",
";",
"}",
"return",
"$",
"return",
";",
"}"
] | Renders the view object to a string. Global and local data are merged
and extracted to create local variables within the view file.
$output = $view->render();
[!!] Global variables with the same key name as local variables will be
overwritten by the local variable.
@param string view filename
@return string
@throws FuelException
@uses static::capture | [
"Renders",
"the",
"view",
"object",
"to",
"a",
"string",
".",
"Global",
"and",
"local",
"data",
"are",
"merged",
"and",
"extracted",
"to",
"create",
"local",
"variables",
"within",
"the",
"view",
"file",
"."
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/view.php#L536-L577 |
5,185 | tekkla/core-html | Core/Html/AbstractHtml.php | AbstractHtml.addCss | public function addCss($css)
{
if (!is_array($css)) {
// Clean css argument from unnecessary spaces
$css = preg_replace('/[ ]+/', ' ', $css);
// Do not trust the programmer and convert a possible
// string of multiple css class notations to array
$css = explode(' ', $css);
}
foreach ($css as $class) {
$this->css[$class] = $class;
}
} | php | public function addCss($css)
{
if (!is_array($css)) {
// Clean css argument from unnecessary spaces
$css = preg_replace('/[ ]+/', ' ', $css);
// Do not trust the programmer and convert a possible
// string of multiple css class notations to array
$css = explode(' ', $css);
}
foreach ($css as $class) {
$this->css[$class] = $class;
}
} | [
"public",
"function",
"addCss",
"(",
"$",
"css",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"css",
")",
")",
"{",
"// Clean css argument from unnecessary spaces",
"$",
"css",
"=",
"preg_replace",
"(",
"'/[ ]+/'",
",",
"' '",
",",
"$",
"css",
")",
";",
"// Do not trust the programmer and convert a possible",
"// string of multiple css class notations to array",
"$",
"css",
"=",
"explode",
"(",
"' '",
",",
"$",
"css",
")",
";",
"}",
"foreach",
"(",
"$",
"css",
"as",
"$",
"class",
")",
"{",
"$",
"this",
"->",
"css",
"[",
"$",
"class",
"]",
"=",
"$",
"class",
";",
"}",
"}"
] | Add one or more css classes to the html object.
Accepts single value, a string of space separated classnames or an array of classnames.
@param string|array $css | [
"Add",
"one",
"or",
"more",
"css",
"classes",
"to",
"the",
"html",
"object",
".",
"Accepts",
"single",
"value",
"a",
"string",
"of",
"space",
"separated",
"classnames",
"or",
"an",
"array",
"of",
"classnames",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/AbstractHtml.php#L233-L248 |
5,186 | tekkla/core-html | Core/Html/AbstractHtml.php | AbstractHtml.isHidden | public function isHidden(int $state = null)
{
$attrib = 'hidden';
if (empty($state)) {
return $this->checkAttribute($attrib);
}
if ($state == 0) {
$this->removeAttribute($attrib);
}
else {
$this->addAttribute($attrib);
}
} | php | public function isHidden(int $state = null)
{
$attrib = 'hidden';
if (empty($state)) {
return $this->checkAttribute($attrib);
}
if ($state == 0) {
$this->removeAttribute($attrib);
}
else {
$this->addAttribute($attrib);
}
} | [
"public",
"function",
"isHidden",
"(",
"int",
"$",
"state",
"=",
"null",
")",
"{",
"$",
"attrib",
"=",
"'hidden'",
";",
"if",
"(",
"empty",
"(",
"$",
"state",
")",
")",
"{",
"return",
"$",
"this",
"->",
"checkAttribute",
"(",
"$",
"attrib",
")",
";",
"}",
"if",
"(",
"$",
"state",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"removeAttribute",
"(",
"$",
"attrib",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"addAttribute",
"(",
"$",
"attrib",
")",
";",
"}",
"}"
] | Hidden attribute setter and checker
Accepts parameter "null", "0" and "1".
"null" eg no parameter means to check for a set hidden attribute
"0" means to remove hidden attribute
"1" means to set hidden attribute
@param int $state | [
"Hidden",
"attribute",
"setter",
"and",
"checker"
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/AbstractHtml.php#L551-L565 |
5,187 | tekkla/core-html | Core/Html/AbstractHtml.php | AbstractHtml.build | public function build(): string
{
$html_attr = [];
if (!$this->element) {
$this->element = strtolower((new \ReflectionClass($this))->getShortName());
}
if (!empty($this->id)) {
$html_attr['id'] = $this->id;
}
if (!empty($this->name)) {
$html_attr['name'] = $this->name;
}
if ($this->css) {
$this->css = array_unique($this->css);
$html_attr['class'] = implode(' ', $this->css);
}
if ($this->style) {
$styles = [];
foreach ($this->style as $name => $val) {
$styles[] = $name . ': ' . $val;
}
$html_attr['style'] = implode('; ', $styles);
}
if ($this->event) {
foreach ($this->event as $event => $val) {
$html_attr[$event] = $val;
}
}
if ($this->data) {
foreach ($this->data as $attr => $val) {
$html_attr['data-' . $attr] = $val;
}
}
if ($this->aria) {
foreach ($this->aria as $attr => $val) {
$html_attr['aria-' . $attr] = $val;
}
}
if ($this->attribute) {
foreach ($this->attribute as $attr => $val) {
$html_attr[$attr] = $val;
}
}
// we have all our attributes => build attribute string
$tmp_attr = [];
foreach ($html_attr as $name => $val) {
$tmp_attr[] = $val === false ? $name : $name . (strpos($name, 'data') === false ? '="' . $val . '"' : '=\'' . $val . '\'');
}
$html_attr = implode(' ', $tmp_attr);
// html attribute string has been created, lets build the element
switch ($this->element) {
case 'input':
case 'meta':
case 'img':
case 'link':
$html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>';
break;
default:
$html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>' . $this->inner . '</' . $this->element . '>';
break;
}
return $html;
} | php | public function build(): string
{
$html_attr = [];
if (!$this->element) {
$this->element = strtolower((new \ReflectionClass($this))->getShortName());
}
if (!empty($this->id)) {
$html_attr['id'] = $this->id;
}
if (!empty($this->name)) {
$html_attr['name'] = $this->name;
}
if ($this->css) {
$this->css = array_unique($this->css);
$html_attr['class'] = implode(' ', $this->css);
}
if ($this->style) {
$styles = [];
foreach ($this->style as $name => $val) {
$styles[] = $name . ': ' . $val;
}
$html_attr['style'] = implode('; ', $styles);
}
if ($this->event) {
foreach ($this->event as $event => $val) {
$html_attr[$event] = $val;
}
}
if ($this->data) {
foreach ($this->data as $attr => $val) {
$html_attr['data-' . $attr] = $val;
}
}
if ($this->aria) {
foreach ($this->aria as $attr => $val) {
$html_attr['aria-' . $attr] = $val;
}
}
if ($this->attribute) {
foreach ($this->attribute as $attr => $val) {
$html_attr[$attr] = $val;
}
}
// we have all our attributes => build attribute string
$tmp_attr = [];
foreach ($html_attr as $name => $val) {
$tmp_attr[] = $val === false ? $name : $name . (strpos($name, 'data') === false ? '="' . $val . '"' : '=\'' . $val . '\'');
}
$html_attr = implode(' ', $tmp_attr);
// html attribute string has been created, lets build the element
switch ($this->element) {
case 'input':
case 'meta':
case 'img':
case 'link':
$html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>';
break;
default:
$html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>' . $this->inner . '</' . $this->element . '>';
break;
}
return $html;
} | [
"public",
"function",
"build",
"(",
")",
":",
"string",
"{",
"$",
"html_attr",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"element",
")",
"{",
"$",
"this",
"->",
"element",
"=",
"strtolower",
"(",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
")",
"->",
"getShortName",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"html_attr",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"name",
")",
")",
"{",
"$",
"html_attr",
"[",
"'name'",
"]",
"=",
"$",
"this",
"->",
"name",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"css",
")",
"{",
"$",
"this",
"->",
"css",
"=",
"array_unique",
"(",
"$",
"this",
"->",
"css",
")",
";",
"$",
"html_attr",
"[",
"'class'",
"]",
"=",
"implode",
"(",
"' '",
",",
"$",
"this",
"->",
"css",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"style",
")",
"{",
"$",
"styles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"style",
"as",
"$",
"name",
"=>",
"$",
"val",
")",
"{",
"$",
"styles",
"[",
"]",
"=",
"$",
"name",
".",
"': '",
".",
"$",
"val",
";",
"}",
"$",
"html_attr",
"[",
"'style'",
"]",
"=",
"implode",
"(",
"'; '",
",",
"$",
"styles",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"event",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"event",
"as",
"$",
"event",
"=>",
"$",
"val",
")",
"{",
"$",
"html_attr",
"[",
"$",
"event",
"]",
"=",
"$",
"val",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"data",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"attr",
"=>",
"$",
"val",
")",
"{",
"$",
"html_attr",
"[",
"'data-'",
".",
"$",
"attr",
"]",
"=",
"$",
"val",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"aria",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"aria",
"as",
"$",
"attr",
"=>",
"$",
"val",
")",
"{",
"$",
"html_attr",
"[",
"'aria-'",
".",
"$",
"attr",
"]",
"=",
"$",
"val",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"attribute",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"attribute",
"as",
"$",
"attr",
"=>",
"$",
"val",
")",
"{",
"$",
"html_attr",
"[",
"$",
"attr",
"]",
"=",
"$",
"val",
";",
"}",
"}",
"// we have all our attributes => build attribute string",
"$",
"tmp_attr",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"html_attr",
"as",
"$",
"name",
"=>",
"$",
"val",
")",
"{",
"$",
"tmp_attr",
"[",
"]",
"=",
"$",
"val",
"===",
"false",
"?",
"$",
"name",
":",
"$",
"name",
".",
"(",
"strpos",
"(",
"$",
"name",
",",
"'data'",
")",
"===",
"false",
"?",
"'=\"'",
".",
"$",
"val",
".",
"'\"'",
":",
"'=\\''",
".",
"$",
"val",
".",
"'\\''",
")",
";",
"}",
"$",
"html_attr",
"=",
"implode",
"(",
"' '",
",",
"$",
"tmp_attr",
")",
";",
"// html attribute string has been created, lets build the element",
"switch",
"(",
"$",
"this",
"->",
"element",
")",
"{",
"case",
"'input'",
":",
"case",
"'meta'",
":",
"case",
"'img'",
":",
"case",
"'link'",
":",
"$",
"html",
"=",
"'<'",
".",
"$",
"this",
"->",
"element",
".",
"(",
"$",
"html_attr",
"?",
"' '",
".",
"$",
"html_attr",
":",
"''",
")",
".",
"'>'",
";",
"break",
";",
"default",
":",
"$",
"html",
"=",
"'<'",
".",
"$",
"this",
"->",
"element",
".",
"(",
"$",
"html_attr",
"?",
"' '",
".",
"$",
"html_attr",
":",
"''",
")",
".",
"'>'",
".",
"$",
"this",
"->",
"inner",
".",
"'</'",
".",
"$",
"this",
"->",
"element",
".",
"'>'",
";",
"break",
";",
"}",
"return",
"$",
"html",
";",
"}"
] | Builds and returns the html code created out of all set attributes and their values
@return string | [
"Builds",
"and",
"returns",
"the",
"html",
"code",
"created",
"out",
"of",
"all",
"set",
"attributes",
"and",
"their",
"values"
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/AbstractHtml.php#L572-L653 |
5,188 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByYear | public function filterByYear($year = null, $comparison = null)
{
if (is_array($year)) {
$useMinMax = false;
if (isset($year['min'])) {
$this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($year['max'])) {
$this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year, $comparison);
} | php | public function filterByYear($year = null, $comparison = null)
{
if (is_array($year)) {
$useMinMax = false;
if (isset($year['min'])) {
$this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($year['max'])) {
$this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_YEAR, $year, $comparison);
} | [
"public",
"function",
"filterByYear",
"(",
"$",
"year",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"year",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"year",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_YEAR",
",",
"$",
"year",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"year",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_YEAR",
",",
"$",
"year",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_YEAR",
",",
"$",
"year",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the year column
Example usage:
<code>
$query->filterByYear(1234); // WHERE year = 1234
$query->filterByYear(array(12, 34)); // WHERE year IN (12, 34)
$query->filterByYear(array('min' => 12)); // WHERE year > 12
</code>
@param mixed $year The value to use as filter.
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",
"year",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L447-L468 |
5,189 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByPublisher | public function filterByPublisher($publisher = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($publisher)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $publisher)) {
$publisher = str_replace('*', '%', $publisher);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_PUBLISHER, $publisher, $comparison);
} | php | public function filterByPublisher($publisher = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($publisher)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $publisher)) {
$publisher = str_replace('*', '%', $publisher);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_PUBLISHER, $publisher, $comparison);
} | [
"public",
"function",
"filterByPublisher",
"(",
"$",
"publisher",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"publisher",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"publisher",
")",
")",
"{",
"$",
"publisher",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"publisher",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_PUBLISHER",
",",
"$",
"publisher",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the publisher column
Example usage:
<code>
$query->filterByPublisher('fooValue'); // WHERE publisher = 'fooValue'
$query->filterByPublisher('%fooValue%'); // WHERE publisher LIKE '%fooValue%'
</code>
@param string $publisher 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"publisher",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L485-L497 |
5,190 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByJournal | public function filterByJournal($journal = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($journal)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $journal)) {
$journal = str_replace('*', '%', $journal);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_JOURNAL, $journal, $comparison);
} | php | public function filterByJournal($journal = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($journal)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $journal)) {
$journal = str_replace('*', '%', $journal);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_JOURNAL, $journal, $comparison);
} | [
"public",
"function",
"filterByJournal",
"(",
"$",
"journal",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"journal",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"journal",
")",
")",
"{",
"$",
"journal",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"journal",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_JOURNAL",
",",
"$",
"journal",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the journal column
Example usage:
<code>
$query->filterByJournal('fooValue'); // WHERE journal = 'fooValue'
$query->filterByJournal('%fooValue%'); // WHERE journal LIKE '%fooValue%'
</code>
@param string $journal 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"journal",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L514-L526 |
5,191 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByNumber | public function filterByNumber($number = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($number)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $number)) {
$number = str_replace('*', '%', $number);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_NUMBER, $number, $comparison);
} | php | public function filterByNumber($number = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($number)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $number)) {
$number = str_replace('*', '%', $number);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_NUMBER, $number, $comparison);
} | [
"public",
"function",
"filterByNumber",
"(",
"$",
"number",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"number",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"number",
")",
")",
"{",
"$",
"number",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"number",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_NUMBER",
",",
"$",
"number",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the number column
Example usage:
<code>
$query->filterByNumber('fooValue'); // WHERE number = 'fooValue'
$query->filterByNumber('%fooValue%'); // WHERE number LIKE '%fooValue%'
</code>
@param string $number 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"number",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L543-L555 |
5,192 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterBySchool | public function filterBySchool($school = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($school)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $school)) {
$school = str_replace('*', '%', $school);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_SCHOOL, $school, $comparison);
} | php | public function filterBySchool($school = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($school)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $school)) {
$school = str_replace('*', '%', $school);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_SCHOOL, $school, $comparison);
} | [
"public",
"function",
"filterBySchool",
"(",
"$",
"school",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"school",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"school",
")",
")",
"{",
"$",
"school",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"school",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_SCHOOL",
",",
"$",
"school",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the school column
Example usage:
<code>
$query->filterBySchool('fooValue'); // WHERE school = 'fooValue'
$query->filterBySchool('%fooValue%'); // WHERE school LIKE '%fooValue%'
</code>
@param string $school 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"school",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L572-L584 |
5,193 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByEdition | public function filterByEdition($edition = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($edition)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $edition)) {
$edition = str_replace('*', '%', $edition);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_EDITION, $edition, $comparison);
} | php | public function filterByEdition($edition = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($edition)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $edition)) {
$edition = str_replace('*', '%', $edition);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_EDITION, $edition, $comparison);
} | [
"public",
"function",
"filterByEdition",
"(",
"$",
"edition",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"edition",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"edition",
")",
")",
"{",
"$",
"edition",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"edition",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_EDITION",
",",
"$",
"edition",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the edition column
Example usage:
<code>
$query->filterByEdition('fooValue'); // WHERE edition = 'fooValue'
$query->filterByEdition('%fooValue%'); // WHERE edition LIKE '%fooValue%'
</code>
@param string $edition 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"edition",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L630-L642 |
5,194 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByVolume | public function filterByVolume($volume = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($volume)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $volume)) {
$volume = str_replace('*', '%', $volume);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_VOLUME, $volume, $comparison);
} | php | public function filterByVolume($volume = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($volume)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $volume)) {
$volume = str_replace('*', '%', $volume);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_VOLUME, $volume, $comparison);
} | [
"public",
"function",
"filterByVolume",
"(",
"$",
"volume",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"volume",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"volume",
")",
")",
"{",
"$",
"volume",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"volume",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_VOLUME",
",",
"$",
"volume",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the volume column
Example usage:
<code>
$query->filterByVolume('fooValue'); // WHERE volume = 'fooValue'
$query->filterByVolume('%fooValue%'); // WHERE volume LIKE '%fooValue%'
</code>
@param string $volume 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"volume",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L659-L671 |
5,195 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByAddress | public function filterByAddress($address = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address)) {
$address = str_replace('*', '%', $address);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_ADDRESS, $address, $comparison);
} | php | public function filterByAddress($address = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($address)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $address)) {
$address = str_replace('*', '%', $address);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_ADDRESS, $address, $comparison);
} | [
"public",
"function",
"filterByAddress",
"(",
"$",
"address",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"address",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"address",
")",
")",
"{",
"$",
"address",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"address",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_ADDRESS",
",",
"$",
"address",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the address column
Example usage:
<code>
$query->filterByAddress('fooValue'); // WHERE address = 'fooValue'
$query->filterByAddress('%fooValue%'); // WHERE address LIKE '%fooValue%'
</code>
@param string $address 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"address",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L688-L700 |
5,196 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByEditor | public function filterByEditor($editor = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($editor)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $editor)) {
$editor = str_replace('*', '%', $editor);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_EDITOR, $editor, $comparison);
} | php | public function filterByEditor($editor = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($editor)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $editor)) {
$editor = str_replace('*', '%', $editor);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_EDITOR, $editor, $comparison);
} | [
"public",
"function",
"filterByEditor",
"(",
"$",
"editor",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"editor",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"editor",
")",
")",
"{",
"$",
"editor",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"editor",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_EDITOR",
",",
"$",
"editor",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the editor column
Example usage:
<code>
$query->filterByEditor('fooValue'); // WHERE editor = 'fooValue'
$query->filterByEditor('%fooValue%'); // WHERE editor LIKE '%fooValue%'
</code>
@param string $editor 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"editor",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L717-L729 |
5,197 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByHowpublished | public function filterByHowpublished($howpublished = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($howpublished)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $howpublished)) {
$howpublished = str_replace('*', '%', $howpublished);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_HOWPUBLISHED, $howpublished, $comparison);
} | php | public function filterByHowpublished($howpublished = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($howpublished)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $howpublished)) {
$howpublished = str_replace('*', '%', $howpublished);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_HOWPUBLISHED, $howpublished, $comparison);
} | [
"public",
"function",
"filterByHowpublished",
"(",
"$",
"howpublished",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"howpublished",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"howpublished",
")",
")",
"{",
"$",
"howpublished",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"howpublished",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_HOWPUBLISHED",
",",
"$",
"howpublished",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the howpublished column
Example usage:
<code>
$query->filterByHowpublished('fooValue'); // WHERE howpublished = 'fooValue'
$query->filterByHowpublished('%fooValue%'); // WHERE howpublished LIKE '%fooValue%'
</code>
@param string $howpublished 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"howpublished",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L746-L758 |
5,198 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByNote | public function filterByNote($note = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($note)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $note)) {
$note = str_replace('*', '%', $note);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_NOTE, $note, $comparison);
} | php | public function filterByNote($note = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($note)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $note)) {
$note = str_replace('*', '%', $note);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_NOTE, $note, $comparison);
} | [
"public",
"function",
"filterByNote",
"(",
"$",
"note",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"note",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"note",
")",
")",
"{",
"$",
"note",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"note",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_NOTE",
",",
"$",
"note",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the note column
Example usage:
<code>
$query->filterByNote('fooValue'); // WHERE note = 'fooValue'
$query->filterByNote('%fooValue%'); // WHERE note LIKE '%fooValue%'
</code>
@param string $note 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"note",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L775-L787 |
5,199 | gossi/trixionary | src/model/Base/ReferenceQuery.php | ReferenceQuery.filterByBooktitle | public function filterByBooktitle($booktitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($booktitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $booktitle)) {
$booktitle = str_replace('*', '%', $booktitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_BOOKTITLE, $booktitle, $comparison);
} | php | public function filterByBooktitle($booktitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($booktitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $booktitle)) {
$booktitle = str_replace('*', '%', $booktitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ReferenceTableMap::COL_BOOKTITLE, $booktitle, $comparison);
} | [
"public",
"function",
"filterByBooktitle",
"(",
"$",
"booktitle",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"booktitle",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"booktitle",
")",
")",
"{",
"$",
"booktitle",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"booktitle",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ReferenceTableMap",
"::",
"COL_BOOKTITLE",
",",
"$",
"booktitle",
",",
"$",
"comparison",
")",
";",
"}"
] | Filter the query on the booktitle column
Example usage:
<code>
$query->filterByBooktitle('fooValue'); // WHERE booktitle = 'fooValue'
$query->filterByBooktitle('%fooValue%'); // WHERE booktitle LIKE '%fooValue%'
</code>
@param string $booktitle 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|ChildReferenceQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"booktitle",
"column"
] | 221a6c5322473d7d7f8e322958a3ee46d87da150 | https://github.com/gossi/trixionary/blob/221a6c5322473d7d7f8e322958a3ee46d87da150/src/model/Base/ReferenceQuery.php#L804-L816 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.