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
|
---|---|---|---|---|---|---|---|---|---|---|---|
12,100 | monolyth-php/improse | src/View.php | View.getVariables | protected function getVariables()
{
$reflection = new ReflectionClass($this);
foreach ($reflection->getProperties(
ReflectionProperty::IS_PROTECTED |
ReflectionProperty::IS_PRIVATE |
ReflectionProperty::IS_STATIC
) as $property) {
$ignore[] = $property->name;
}
$values = [];
foreach ($this as $prop => $value) {
if (!in_array($prop, $ignore)) {
if (is_object($value)) {
if (method_exists($value, 'jsonSerialize')) {
$value = $value->jsonSerialize();
} elseif (method_exists($value, 'getArrayCopy')) {
$value = $value->getArrayCopy();
}
}
$values[$prop] = $value;
}
}
return $values;
} | php | protected function getVariables()
{
$reflection = new ReflectionClass($this);
foreach ($reflection->getProperties(
ReflectionProperty::IS_PROTECTED |
ReflectionProperty::IS_PRIVATE |
ReflectionProperty::IS_STATIC
) as $property) {
$ignore[] = $property->name;
}
$values = [];
foreach ($this as $prop => $value) {
if (!in_array($prop, $ignore)) {
if (is_object($value)) {
if (method_exists($value, 'jsonSerialize')) {
$value = $value->jsonSerialize();
} elseif (method_exists($value, 'getArrayCopy')) {
$value = $value->getArrayCopy();
}
}
$values[$prop] = $value;
}
}
return $values;
} | [
"protected",
"function",
"getVariables",
"(",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"reflection",
"->",
"getProperties",
"(",
"ReflectionProperty",
"::",
"IS_PROTECTED",
"|",
"ReflectionProperty",
"::",
"IS_PRIVATE",
"|",
"ReflectionProperty",
"::",
"IS_STATIC",
")",
"as",
"$",
"property",
")",
"{",
"$",
"ignore",
"[",
"]",
"=",
"$",
"property",
"->",
"name",
";",
"}",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"prop",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"prop",
",",
"$",
"ignore",
")",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"value",
",",
"'jsonSerialize'",
")",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"jsonSerialize",
"(",
")",
";",
"}",
"elseif",
"(",
"method_exists",
"(",
"$",
"value",
",",
"'getArrayCopy'",
")",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"getArrayCopy",
"(",
")",
";",
"}",
"}",
"$",
"values",
"[",
"$",
"prop",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"values",
";",
"}"
] | Internal method to get all template variables, i.e. the public properties
on the view class.
@return array A hash of key/value pairs. | [
"Internal",
"method",
"to",
"get",
"all",
"template",
"variables",
"i",
".",
"e",
".",
"the",
"public",
"properties",
"on",
"the",
"view",
"class",
"."
] | 14b369c6d67436532c81526fc37531a327157524 | https://github.com/monolyth-php/improse/blob/14b369c6d67436532c81526fc37531a327157524/src/View.php#L113-L137 |
12,101 | zepi/turbo-base | Zepi/Web/AccessControl/src/EventHandler/ProfileChangePassword.php | ProfileChangePassword.execute | public function execute(Framework $framework, WebRequest $request, Response $response)
{
// Set the title for the page
$this->setTitle($this->translate('Profile - Change password', '\\Zepi\\Web\\AccessControl'));
// Get the Form object
$changePasswordForm = $this->createForm($framework, $request, $response);
// Process the submitted form data
$changePasswordForm->processFormData($request, $response);
$result = false;
$errors = array();
if ($changePasswordForm->isSubmitted()) {
$errors = $changePasswordForm->validateFormData($framework);
if (count($errors) === 0) {
$result = $this->changePassword($changePasswordForm, $framework, $request, $response);
}
}
// Fill the errors into the error box
$errorBox = $changePasswordForm->getPart('login-errors');
$errorBox->updateErrorBox($changePasswordForm, $result, $errors);
// If $result isn't true, display the login form
if (!$changePasswordForm->isSubmitted() || $errorBox->hasErrors()) {
$renderedOutput = $this->render('\\Zepi\\Web\\AccessControl\\Templates\\ProfileChangePasswordForm', array(
'result' => $result,
'errors' => $errors,
'form' => $changePasswordForm,
'layoutRenderer' => $this->getLayoutRenderer()
));
$response->setOutput($renderedOutput);
} else {
// Display the successful changed message
$response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\ProfileChangePasswordFinished'));
}
} | php | public function execute(Framework $framework, WebRequest $request, Response $response)
{
// Set the title for the page
$this->setTitle($this->translate('Profile - Change password', '\\Zepi\\Web\\AccessControl'));
// Get the Form object
$changePasswordForm = $this->createForm($framework, $request, $response);
// Process the submitted form data
$changePasswordForm->processFormData($request, $response);
$result = false;
$errors = array();
if ($changePasswordForm->isSubmitted()) {
$errors = $changePasswordForm->validateFormData($framework);
if (count($errors) === 0) {
$result = $this->changePassword($changePasswordForm, $framework, $request, $response);
}
}
// Fill the errors into the error box
$errorBox = $changePasswordForm->getPart('login-errors');
$errorBox->updateErrorBox($changePasswordForm, $result, $errors);
// If $result isn't true, display the login form
if (!$changePasswordForm->isSubmitted() || $errorBox->hasErrors()) {
$renderedOutput = $this->render('\\Zepi\\Web\\AccessControl\\Templates\\ProfileChangePasswordForm', array(
'result' => $result,
'errors' => $errors,
'form' => $changePasswordForm,
'layoutRenderer' => $this->getLayoutRenderer()
));
$response->setOutput($renderedOutput);
} else {
// Display the successful changed message
$response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\ProfileChangePasswordFinished'));
}
} | [
"public",
"function",
"execute",
"(",
"Framework",
"$",
"framework",
",",
"WebRequest",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"// Set the title for the page",
"$",
"this",
"->",
"setTitle",
"(",
"$",
"this",
"->",
"translate",
"(",
"'Profile - Change password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
")",
";",
"// Get the Form object",
"$",
"changePasswordForm",
"=",
"$",
"this",
"->",
"createForm",
"(",
"$",
"framework",
",",
"$",
"request",
",",
"$",
"response",
")",
";",
"// Process the submitted form data",
"$",
"changePasswordForm",
"->",
"processFormData",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"$",
"result",
"=",
"false",
";",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"changePasswordForm",
"->",
"isSubmitted",
"(",
")",
")",
"{",
"$",
"errors",
"=",
"$",
"changePasswordForm",
"->",
"validateFormData",
"(",
"$",
"framework",
")",
";",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
"===",
"0",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"changePassword",
"(",
"$",
"changePasswordForm",
",",
"$",
"framework",
",",
"$",
"request",
",",
"$",
"response",
")",
";",
"}",
"}",
"// Fill the errors into the error box",
"$",
"errorBox",
"=",
"$",
"changePasswordForm",
"->",
"getPart",
"(",
"'login-errors'",
")",
";",
"$",
"errorBox",
"->",
"updateErrorBox",
"(",
"$",
"changePasswordForm",
",",
"$",
"result",
",",
"$",
"errors",
")",
";",
"// If $result isn't true, display the login form",
"if",
"(",
"!",
"$",
"changePasswordForm",
"->",
"isSubmitted",
"(",
")",
"||",
"$",
"errorBox",
"->",
"hasErrors",
"(",
")",
")",
"{",
"$",
"renderedOutput",
"=",
"$",
"this",
"->",
"render",
"(",
"'\\\\Zepi\\\\Web\\\\AccessControl\\\\Templates\\\\ProfileChangePasswordForm'",
",",
"array",
"(",
"'result'",
"=>",
"$",
"result",
",",
"'errors'",
"=>",
"$",
"errors",
",",
"'form'",
"=>",
"$",
"changePasswordForm",
",",
"'layoutRenderer'",
"=>",
"$",
"this",
"->",
"getLayoutRenderer",
"(",
")",
")",
")",
";",
"$",
"response",
"->",
"setOutput",
"(",
"$",
"renderedOutput",
")",
";",
"}",
"else",
"{",
"// Display the successful changed message",
"$",
"response",
"->",
"setOutput",
"(",
"$",
"this",
"->",
"render",
"(",
"'\\\\Zepi\\\\Web\\\\AccessControl\\\\Templates\\\\ProfileChangePasswordFinished'",
")",
")",
";",
"}",
"}"
] | Displays the change password site for the profile.
@access public
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\WebRequest $request
@param \Zepi\Turbo\Response\Response $response | [
"Displays",
"the",
"change",
"password",
"site",
"for",
"the",
"profile",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/EventHandler/ProfileChangePassword.php#L90-L128 |
12,102 | zepi/turbo-base | Zepi/Web/AccessControl/src/EventHandler/ProfileChangePassword.php | ProfileChangePassword.createForm | protected function createForm(Framework $framework, WebRequest $request, Response $response)
{
// Create the form
$form = new Form('change-password', $request->getFullRoute('profile/change-password'), 'post');
// Add the user data group
$errorBox = new ErrorBox(
'login-errors',
1
);
$form->addPart($errorBox);
// Add the user data group
$group = new Group(
'change-password',
$this->translate('Please insert your old and your new password', '\\Zepi\\Web\\AccessControl'),
array(
new Password(
'old-password',
$this->translate('Old password', '\\Zepi\\Web\\AccessControl'),
true
),
new Password(
'new-password',
$this->translate('New password', '\\Zepi\\Web\\AccessControl'),
true
),
new Password(
'new-password-confirmed',
$this->translate('Confirm new password', '\\Zepi\\Web\\AccessControl'),
true
),
)
);
$form->addPart($group);
// Add the submit button
$buttonGroup = new ButtonGroup(
'buttons',
array(
new Submit(
'submit',
$this->translate('Change password', '\\Zepi\\Web\\AccessControl')
)
),
100
);
$form->addPart($buttonGroup);
return $form;
} | php | protected function createForm(Framework $framework, WebRequest $request, Response $response)
{
// Create the form
$form = new Form('change-password', $request->getFullRoute('profile/change-password'), 'post');
// Add the user data group
$errorBox = new ErrorBox(
'login-errors',
1
);
$form->addPart($errorBox);
// Add the user data group
$group = new Group(
'change-password',
$this->translate('Please insert your old and your new password', '\\Zepi\\Web\\AccessControl'),
array(
new Password(
'old-password',
$this->translate('Old password', '\\Zepi\\Web\\AccessControl'),
true
),
new Password(
'new-password',
$this->translate('New password', '\\Zepi\\Web\\AccessControl'),
true
),
new Password(
'new-password-confirmed',
$this->translate('Confirm new password', '\\Zepi\\Web\\AccessControl'),
true
),
)
);
$form->addPart($group);
// Add the submit button
$buttonGroup = new ButtonGroup(
'buttons',
array(
new Submit(
'submit',
$this->translate('Change password', '\\Zepi\\Web\\AccessControl')
)
),
100
);
$form->addPart($buttonGroup);
return $form;
} | [
"protected",
"function",
"createForm",
"(",
"Framework",
"$",
"framework",
",",
"WebRequest",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"// Create the form",
"$",
"form",
"=",
"new",
"Form",
"(",
"'change-password'",
",",
"$",
"request",
"->",
"getFullRoute",
"(",
"'profile/change-password'",
")",
",",
"'post'",
")",
";",
"// Add the user data group",
"$",
"errorBox",
"=",
"new",
"ErrorBox",
"(",
"'login-errors'",
",",
"1",
")",
";",
"$",
"form",
"->",
"addPart",
"(",
"$",
"errorBox",
")",
";",
"// Add the user data group",
"$",
"group",
"=",
"new",
"Group",
"(",
"'change-password'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Please insert your old and your new password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"array",
"(",
"new",
"Password",
"(",
"'old-password'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Old password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"true",
")",
",",
"new",
"Password",
"(",
"'new-password'",
",",
"$",
"this",
"->",
"translate",
"(",
"'New password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"true",
")",
",",
"new",
"Password",
"(",
"'new-password-confirmed'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Confirm new password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"true",
")",
",",
")",
")",
";",
"$",
"form",
"->",
"addPart",
"(",
"$",
"group",
")",
";",
"// Add the submit button",
"$",
"buttonGroup",
"=",
"new",
"ButtonGroup",
"(",
"'buttons'",
",",
"array",
"(",
"new",
"Submit",
"(",
"'submit'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Change password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
")",
")",
",",
"100",
")",
";",
"$",
"form",
"->",
"addPart",
"(",
"$",
"buttonGroup",
")",
";",
"return",
"$",
"form",
";",
"}"
] | Returns the Form object for the change password form
@access protected
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\WebRequest $request
@param \Zepi\Turbo\Response\Response $response
@return \Zepi\Web\UserInterface\Form\Form | [
"Returns",
"the",
"Form",
"object",
"for",
"the",
"change",
"password",
"form"
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/EventHandler/ProfileChangePassword.php#L204-L254 |
12,103 | tenside/core | src/Util/FunctionAvailabilityCheck.php | FunctionAvailabilityCheck.isFunctionEnabled | public static function isFunctionEnabled($function, $extension = null)
{
return
(null === $extension || extension_loaded($extension))
&& !static::isFunctionBlacklistedInPhpIni($function)
&& !static::isFunctionBlacklistedInSuhosin($function)
&& static::isFunctionDefined($function);
} | php | public static function isFunctionEnabled($function, $extension = null)
{
return
(null === $extension || extension_loaded($extension))
&& !static::isFunctionBlacklistedInPhpIni($function)
&& !static::isFunctionBlacklistedInSuhosin($function)
&& static::isFunctionDefined($function);
} | [
"public",
"static",
"function",
"isFunctionEnabled",
"(",
"$",
"function",
",",
"$",
"extension",
"=",
"null",
")",
"{",
"return",
"(",
"null",
"===",
"$",
"extension",
"||",
"extension_loaded",
"(",
"$",
"extension",
")",
")",
"&&",
"!",
"static",
"::",
"isFunctionBlacklistedInPhpIni",
"(",
"$",
"function",
")",
"&&",
"!",
"static",
"::",
"isFunctionBlacklistedInSuhosin",
"(",
"$",
"function",
")",
"&&",
"static",
"::",
"isFunctionDefined",
"(",
"$",
"function",
")",
";",
"}"
] | Check if function is defined.
@param string $function The function to test.
@param string|null $extension The optional name of an php extension providing said function.
@return bool | [
"Check",
"if",
"function",
"is",
"defined",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Util/FunctionAvailabilityCheck.php#L52-L59 |
12,104 | tenside/core | src/Util/FunctionAvailabilityCheck.php | FunctionAvailabilityCheck.isFunctionBlacklistedInSuhosin | public static function isFunctionBlacklistedInSuhosin($function)
{
if (!extension_loaded('suhosin')) {
return false;
}
if (!isset(self::$blackListSuhosin)) {
self::$blackListSuhosin = static::prepareList(ini_get('suhosin.executor.func.blacklist'));
}
return static::isFunctionsMentionedInList($function, self::$blackListSuhosin);
} | php | public static function isFunctionBlacklistedInSuhosin($function)
{
if (!extension_loaded('suhosin')) {
return false;
}
if (!isset(self::$blackListSuhosin)) {
self::$blackListSuhosin = static::prepareList(ini_get('suhosin.executor.func.blacklist'));
}
return static::isFunctionsMentionedInList($function, self::$blackListSuhosin);
} | [
"public",
"static",
"function",
"isFunctionBlacklistedInSuhosin",
"(",
"$",
"function",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'suhosin'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"blackListSuhosin",
")",
")",
"{",
"self",
"::",
"$",
"blackListSuhosin",
"=",
"static",
"::",
"prepareList",
"(",
"ini_get",
"(",
"'suhosin.executor.func.blacklist'",
")",
")",
";",
"}",
"return",
"static",
"::",
"isFunctionsMentionedInList",
"(",
"$",
"function",
",",
"self",
"::",
"$",
"blackListSuhosin",
")",
";",
"}"
] | Check if function is blacklisted in Suhosin.
@param string $function The function to test.
@return bool | [
"Check",
"if",
"function",
"is",
"blacklisted",
"in",
"Suhosin",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Util/FunctionAvailabilityCheck.php#L80-L91 |
12,105 | tenside/core | src/Util/FunctionAvailabilityCheck.php | FunctionAvailabilityCheck.isFunctionBlacklistedInPhpIni | public static function isFunctionBlacklistedInPhpIni($function)
{
if (!isset(self::$blackListPhpIni)) {
self::$blackListPhpIni = static::prepareList(ini_get('disable_functions'));
}
return static::isFunctionsMentionedInList($function, self::$blackListPhpIni);
} | php | public static function isFunctionBlacklistedInPhpIni($function)
{
if (!isset(self::$blackListPhpIni)) {
self::$blackListPhpIni = static::prepareList(ini_get('disable_functions'));
}
return static::isFunctionsMentionedInList($function, self::$blackListPhpIni);
} | [
"public",
"static",
"function",
"isFunctionBlacklistedInPhpIni",
"(",
"$",
"function",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"blackListPhpIni",
")",
")",
"{",
"self",
"::",
"$",
"blackListPhpIni",
"=",
"static",
"::",
"prepareList",
"(",
"ini_get",
"(",
"'disable_functions'",
")",
")",
";",
"}",
"return",
"static",
"::",
"isFunctionsMentionedInList",
"(",
"$",
"function",
",",
"self",
"::",
"$",
"blackListPhpIni",
")",
";",
"}"
] | Check if method is blacklisted in Suhosin.
@param string $function The function to test.
@return bool | [
"Check",
"if",
"method",
"is",
"blacklisted",
"in",
"Suhosin",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Util/FunctionAvailabilityCheck.php#L100-L107 |
12,106 | Stratadox/HydrationMapping | src/Property/Relationship/HasManyProxies.php | HasManyProxies.inProperty | public static function inProperty(
string $name,
DeserializesCollections $collection,
ProducesProxies $proxyBuilder
): ExposesDataKey {
return new self($name, $name, $collection, $proxyBuilder);
} | php | public static function inProperty(
string $name,
DeserializesCollections $collection,
ProducesProxies $proxyBuilder
): ExposesDataKey {
return new self($name, $name, $collection, $proxyBuilder);
} | [
"public",
"static",
"function",
"inProperty",
"(",
"string",
"$",
"name",
",",
"DeserializesCollections",
"$",
"collection",
",",
"ProducesProxies",
"$",
"proxyBuilder",
")",
":",
"ExposesDataKey",
"{",
"return",
"new",
"self",
"(",
"$",
"name",
",",
"$",
"name",
",",
"$",
"collection",
",",
"$",
"proxyBuilder",
")",
";",
"}"
] | Creates a new lazily loaded has-many mapping.
@param string $name The name of both the key and
the property.
@param DeserializesCollections $collection The deserializer for the
collection.
@param ProducesProxies $proxyBuilder The proxy builder.
@return ExposesDataKey The lazy has-many mapping. | [
"Creates",
"a",
"new",
"lazily",
"loaded",
"has",
"-",
"many",
"mapping",
"."
] | b145deaaf76ab8c8060f0cba1a8c6f73da375982 | https://github.com/Stratadox/HydrationMapping/blob/b145deaaf76ab8c8060f0cba1a8c6f73da375982/src/Property/Relationship/HasManyProxies.php#L48-L54 |
12,107 | Stratadox/HydrationMapping | src/Property/Relationship/HasManyProxies.php | HasManyProxies.inPropertyWithDifferentKey | public static function inPropertyWithDifferentKey(
string $name,
string $key,
DeserializesCollections $collection,
ProducesProxies $proxyBuilder
): ExposesDataKey {
return new self($name, $key, $collection, $proxyBuilder);
} | php | public static function inPropertyWithDifferentKey(
string $name,
string $key,
DeserializesCollections $collection,
ProducesProxies $proxyBuilder
): ExposesDataKey {
return new self($name, $key, $collection, $proxyBuilder);
} | [
"public",
"static",
"function",
"inPropertyWithDifferentKey",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"key",
",",
"DeserializesCollections",
"$",
"collection",
",",
"ProducesProxies",
"$",
"proxyBuilder",
")",
":",
"ExposesDataKey",
"{",
"return",
"new",
"self",
"(",
"$",
"name",
",",
"$",
"key",
",",
"$",
"collection",
",",
"$",
"proxyBuilder",
")",
";",
"}"
] | Creates a new lazily loading has-many mapping, using the data from a
specific key.
@param string $name The name of the property.
@param string $key The array key to use.
@param DeserializesCollections $collection The deserializer for the
collection.
@param ProducesProxies $proxyBuilder The proxy builder.
@return ExposesDataKey The lazy has-many mapping. | [
"Creates",
"a",
"new",
"lazily",
"loading",
"has",
"-",
"many",
"mapping",
"using",
"the",
"data",
"from",
"a",
"specific",
"key",
"."
] | b145deaaf76ab8c8060f0cba1a8c6f73da375982 | https://github.com/Stratadox/HydrationMapping/blob/b145deaaf76ab8c8060f0cba1a8c6f73da375982/src/Property/Relationship/HasManyProxies.php#L67-L74 |
12,108 | Stratadox/HydrationMapping | src/Property/Relationship/HasManyProxies.php | HasManyProxies.makeSomeProxies | private function makeSomeProxies(int $amount, ?object $owner): array
{
$proxies = [];
for ($i = 0; $i < $amount; ++$i) {
$proxies[] = $this->proxyBuilder->createFor($owner, $this->name(), $i);
}
return $proxies;
} | php | private function makeSomeProxies(int $amount, ?object $owner): array
{
$proxies = [];
for ($i = 0; $i < $amount; ++$i) {
$proxies[] = $this->proxyBuilder->createFor($owner, $this->name(), $i);
}
return $proxies;
} | [
"private",
"function",
"makeSomeProxies",
"(",
"int",
"$",
"amount",
",",
"?",
"object",
"$",
"owner",
")",
":",
"array",
"{",
"$",
"proxies",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"amount",
";",
"++",
"$",
"i",
")",
"{",
"$",
"proxies",
"[",
"]",
"=",
"$",
"this",
"->",
"proxyBuilder",
"->",
"createFor",
"(",
"$",
"owner",
",",
"$",
"this",
"->",
"name",
"(",
")",
",",
"$",
"i",
")",
";",
"}",
"return",
"$",
"proxies",
";",
"}"
] | Produces the proxies for in the collection.
@param int $amount The amount of proxies to produce.
@param object|null $owner The object that holds a reference to the proxy.
@return array List of proxy objects. | [
"Produces",
"the",
"proxies",
"for",
"in",
"the",
"collection",
"."
] | b145deaaf76ab8c8060f0cba1a8c6f73da375982 | https://github.com/Stratadox/HydrationMapping/blob/b145deaaf76ab8c8060f0cba1a8c6f73da375982/src/Property/Relationship/HasManyProxies.php#L112-L119 |
12,109 | drdplusinfo/drdplus-combat-actions | DrdPlus/CombatActions/CombatActions.php | CombatActions.sanitizeRoundsOfAiming | private function sanitizeRoundsOfAiming($roundsOfAiming): int
{
try {
$roundsOfAiming = ToInteger::toPositiveInteger($roundsOfAiming);
if ($roundsOfAiming > 3) {
return 3;
}
return $roundsOfAiming;
} catch (\Granam\Integer\Tools\Exceptions\Exception $integerException) {
throw new Exceptions\InvalidFormatOfRoundsOfAiming($integerException->getMessage());
}
} | php | private function sanitizeRoundsOfAiming($roundsOfAiming): int
{
try {
$roundsOfAiming = ToInteger::toPositiveInteger($roundsOfAiming);
if ($roundsOfAiming > 3) {
return 3;
}
return $roundsOfAiming;
} catch (\Granam\Integer\Tools\Exceptions\Exception $integerException) {
throw new Exceptions\InvalidFormatOfRoundsOfAiming($integerException->getMessage());
}
} | [
"private",
"function",
"sanitizeRoundsOfAiming",
"(",
"$",
"roundsOfAiming",
")",
":",
"int",
"{",
"try",
"{",
"$",
"roundsOfAiming",
"=",
"ToInteger",
"::",
"toPositiveInteger",
"(",
"$",
"roundsOfAiming",
")",
";",
"if",
"(",
"$",
"roundsOfAiming",
">",
"3",
")",
"{",
"return",
"3",
";",
"}",
"return",
"$",
"roundsOfAiming",
";",
"}",
"catch",
"(",
"\\",
"Granam",
"\\",
"Integer",
"\\",
"Tools",
"\\",
"Exceptions",
"\\",
"Exception",
"$",
"integerException",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"InvalidFormatOfRoundsOfAiming",
"(",
"$",
"integerException",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Aiming gives bonus up to three rounds of aim, any addition is thrown away.
@param int $roundsOfAiming
@return int
@throws \DrdPlus\CombatActions\Exceptions\InvalidFormatOfRoundsOfAiming | [
"Aiming",
"gives",
"bonus",
"up",
"to",
"three",
"rounds",
"of",
"aim",
"any",
"addition",
"is",
"thrown",
"away",
"."
] | a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0 | https://github.com/drdplusinfo/drdplus-combat-actions/blob/a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0/DrdPlus/CombatActions/CombatActions.php#L152-L164 |
12,110 | drdplusinfo/drdplus-combat-actions | DrdPlus/CombatActions/CombatActions.php | CombatActions.getAttackNumberModifier | public function getAttackNumberModifier(): int
{
$attackNumber = 0;
foreach ($this->combatActionCodes as $combatActionCode) {
if ($combatActionCode->getValue() === MeleeCombatActionCode::HEADLESS_ATTACK) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === MeleeCombatActionCode::PRESSURE) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === RangedCombatActionCode::AIMED_SHOT) {
$attackNumber += $this->finishedRoundsOfAiming;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_EASILY_ACCESSIBLE_ITEM) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_HARDLY_ACCESSIBLE_ITEM) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === CombatActionCode::LAYING) {
$attackNumber -= 4;
}
if ($combatActionCode->getValue() === CombatActionCode::SITTING_OR_ON_KNEELS) {
$attackNumber -= 2;
}
if ($combatActionCode->getValue() === CombatActionCode::BLINDFOLD_FIGHT) {
$attackNumber -= 6;
}
if ($combatActionCode->getValue() === CombatActionCode::FIGHT_IN_REDUCED_VISIBILITY) {
/** @noinspection PrefixedIncDecrementEquivalentInspection */
$attackNumber -= 1;
}
}
return $attackNumber;
} | php | public function getAttackNumberModifier(): int
{
$attackNumber = 0;
foreach ($this->combatActionCodes as $combatActionCode) {
if ($combatActionCode->getValue() === MeleeCombatActionCode::HEADLESS_ATTACK) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === MeleeCombatActionCode::PRESSURE) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === RangedCombatActionCode::AIMED_SHOT) {
$attackNumber += $this->finishedRoundsOfAiming;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_EASILY_ACCESSIBLE_ITEM) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_HARDLY_ACCESSIBLE_ITEM) {
$attackNumber += 2;
}
if ($combatActionCode->getValue() === CombatActionCode::LAYING) {
$attackNumber -= 4;
}
if ($combatActionCode->getValue() === CombatActionCode::SITTING_OR_ON_KNEELS) {
$attackNumber -= 2;
}
if ($combatActionCode->getValue() === CombatActionCode::BLINDFOLD_FIGHT) {
$attackNumber -= 6;
}
if ($combatActionCode->getValue() === CombatActionCode::FIGHT_IN_REDUCED_VISIBILITY) {
/** @noinspection PrefixedIncDecrementEquivalentInspection */
$attackNumber -= 1;
}
}
return $attackNumber;
} | [
"public",
"function",
"getAttackNumberModifier",
"(",
")",
":",
"int",
"{",
"$",
"attackNumber",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"combatActionCodes",
"as",
"$",
"combatActionCode",
")",
"{",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"MeleeCombatActionCode",
"::",
"HEADLESS_ATTACK",
")",
"{",
"$",
"attackNumber",
"+=",
"2",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"MeleeCombatActionCode",
"::",
"PRESSURE",
")",
"{",
"$",
"attackNumber",
"+=",
"2",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"RangedCombatActionCode",
"::",
"AIMED_SHOT",
")",
"{",
"$",
"attackNumber",
"+=",
"$",
"this",
"->",
"finishedRoundsOfAiming",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"PUT_OUT_EASILY_ACCESSIBLE_ITEM",
")",
"{",
"$",
"attackNumber",
"+=",
"2",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"PUT_OUT_HARDLY_ACCESSIBLE_ITEM",
")",
"{",
"$",
"attackNumber",
"+=",
"2",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"LAYING",
")",
"{",
"$",
"attackNumber",
"-=",
"4",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"SITTING_OR_ON_KNEELS",
")",
"{",
"$",
"attackNumber",
"-=",
"2",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"BLINDFOLD_FIGHT",
")",
"{",
"$",
"attackNumber",
"-=",
"6",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"FIGHT_IN_REDUCED_VISIBILITY",
")",
"{",
"/** @noinspection PrefixedIncDecrementEquivalentInspection */",
"$",
"attackNumber",
"-=",
"1",
";",
"}",
"}",
"return",
"$",
"attackNumber",
";",
"}"
] | Note about AIMED SHOT, you have to provide rounds of aim to get expected attack number.
Maximum counted is +3, more if truncated.
@return int | [
"Note",
"about",
"AIMED",
"SHOT",
"you",
"have",
"to",
"provide",
"rounds",
"of",
"aim",
"to",
"get",
"expected",
"attack",
"number",
".",
"Maximum",
"counted",
"is",
"+",
"3",
"more",
"if",
"truncated",
"."
] | a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0 | https://github.com/drdplusinfo/drdplus-combat-actions/blob/a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0/DrdPlus/CombatActions/CombatActions.php#L253-L288 |
12,111 | drdplusinfo/drdplus-combat-actions | DrdPlus/CombatActions/CombatActions.php | CombatActions.getDefenseNumberModifierAgainstFasterOpponent | public function getDefenseNumberModifierAgainstFasterOpponent(): int
{
$defenseNumberModifier = $this->getDefenseNumberModifier();
foreach ($this->combatActionCodes as $combatActionCode) {
if ($combatActionCode->getValue() === CombatActionCode::RUN) {
$defenseNumberModifier -= 4;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_HARDLY_ACCESSIBLE_ITEM) {
$defenseNumberModifier -= 4;
}
}
return $defenseNumberModifier;
} | php | public function getDefenseNumberModifierAgainstFasterOpponent(): int
{
$defenseNumberModifier = $this->getDefenseNumberModifier();
foreach ($this->combatActionCodes as $combatActionCode) {
if ($combatActionCode->getValue() === CombatActionCode::RUN) {
$defenseNumberModifier -= 4;
}
if ($combatActionCode->getValue() === CombatActionCode::PUT_OUT_HARDLY_ACCESSIBLE_ITEM) {
$defenseNumberModifier -= 4;
}
}
return $defenseNumberModifier;
} | [
"public",
"function",
"getDefenseNumberModifierAgainstFasterOpponent",
"(",
")",
":",
"int",
"{",
"$",
"defenseNumberModifier",
"=",
"$",
"this",
"->",
"getDefenseNumberModifier",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"combatActionCodes",
"as",
"$",
"combatActionCode",
")",
"{",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"RUN",
")",
"{",
"$",
"defenseNumberModifier",
"-=",
"4",
";",
"}",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"PUT_OUT_HARDLY_ACCESSIBLE_ITEM",
")",
"{",
"$",
"defenseNumberModifier",
"-=",
"4",
";",
"}",
"}",
"return",
"$",
"defenseNumberModifier",
";",
"}"
] | Against those opponents acting faster then you, you can have significantly lower defense because they catch you
unprepared.
@return int | [
"Against",
"those",
"opponents",
"acting",
"faster",
"then",
"you",
"you",
"can",
"have",
"significantly",
"lower",
"defense",
"because",
"they",
"catch",
"you",
"unprepared",
"."
] | a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0 | https://github.com/drdplusinfo/drdplus-combat-actions/blob/a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0/DrdPlus/CombatActions/CombatActions.php#L377-L390 |
12,112 | drdplusinfo/drdplus-combat-actions | DrdPlus/CombatActions/CombatActions.php | CombatActions.getSpeedModifier | public function getSpeedModifier(): int
{
$speedBonus = 0;
foreach ($this->combatActionCodes as $combatActionCode) {
/** can not be combined with RUN, but that should be solved in @see validateActionCodesCoWork */
if ($combatActionCode->getValue() === CombatActionCode::MOVE) {
/** see PPH page 107 left column */
$speedBonus += 8;
}
/** can not be combined with MOVE, but that should be solved in @see validateActionCodesCoWork */
if ($combatActionCode->getValue() === CombatActionCode::RUN) {
/** see PPH page 107 left column */
$speedBonus += 22;
}
}
return $speedBonus;
} | php | public function getSpeedModifier(): int
{
$speedBonus = 0;
foreach ($this->combatActionCodes as $combatActionCode) {
/** can not be combined with RUN, but that should be solved in @see validateActionCodesCoWork */
if ($combatActionCode->getValue() === CombatActionCode::MOVE) {
/** see PPH page 107 left column */
$speedBonus += 8;
}
/** can not be combined with MOVE, but that should be solved in @see validateActionCodesCoWork */
if ($combatActionCode->getValue() === CombatActionCode::RUN) {
/** see PPH page 107 left column */
$speedBonus += 22;
}
}
return $speedBonus;
} | [
"public",
"function",
"getSpeedModifier",
"(",
")",
":",
"int",
"{",
"$",
"speedBonus",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"combatActionCodes",
"as",
"$",
"combatActionCode",
")",
"{",
"/** can not be combined with RUN, but that should be solved in @see validateActionCodesCoWork */",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"MOVE",
")",
"{",
"/** see PPH page 107 left column */",
"$",
"speedBonus",
"+=",
"8",
";",
"}",
"/** can not be combined with MOVE, but that should be solved in @see validateActionCodesCoWork */",
"if",
"(",
"$",
"combatActionCode",
"->",
"getValue",
"(",
")",
"===",
"CombatActionCode",
"::",
"RUN",
")",
"{",
"/** see PPH page 107 left column */",
"$",
"speedBonus",
"+=",
"22",
";",
"}",
"}",
"return",
"$",
"speedBonus",
";",
"}"
] | In case of MOVE or RUN there is significant speed increment.
@return int | [
"In",
"case",
"of",
"MOVE",
"or",
"RUN",
"there",
"is",
"significant",
"speed",
"increment",
"."
] | a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0 | https://github.com/drdplusinfo/drdplus-combat-actions/blob/a12fb21acbe53ac3cebac0f8b38c767ad93b6ae0/DrdPlus/CombatActions/CombatActions.php#L397-L414 |
12,113 | Niirrty/Niirrty.Translation | src/Sources/AbstractSource.php | AbstractSource.setLogger | public final function setLogger( ?LoggerInterface $logger )
{
$this->_options[ 'logger' ] = null === $logger ? new NullLogger() : $logger;
unset( $this->_options[ 'data' ] );
return $this;
} | php | public final function setLogger( ?LoggerInterface $logger )
{
$this->_options[ 'logger' ] = null === $logger ? new NullLogger() : $logger;
unset( $this->_options[ 'data' ] );
return $this;
} | [
"public",
"final",
"function",
"setLogger",
"(",
"?",
"LoggerInterface",
"$",
"logger",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"'logger'",
"]",
"=",
"null",
"===",
"$",
"logger",
"?",
"new",
"NullLogger",
"(",
")",
":",
"$",
"logger",
";",
"unset",
"(",
"$",
"this",
"->",
"_options",
"[",
"'data'",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets a new logger or null if no logger should be used.
@param \Psr\Log\LoggerInterface|null $logger
@return \Niirrty\Translation\Sources\ISource | [
"Sets",
"a",
"new",
"logger",
"or",
"null",
"if",
"no",
"logger",
"should",
"be",
"used",
"."
] | 5b1ad27fb87c14435edd2dc03e9af46dd5062de8 | https://github.com/Niirrty/Niirrty.Translation/blob/5b1ad27fb87c14435edd2dc03e9af46dd5062de8/src/Sources/AbstractSource.php#L112-L121 |
12,114 | Niirrty/Niirrty.Translation | src/Sources/AbstractSource.php | AbstractSource.setOption | public function setOption( string $name, $value )
{
$this->_options[ $name ] = $value;
unset( $this->_options[ 'data' ] );
return $this;
} | php | public function setOption( string $name, $value )
{
$this->_options[ $name ] = $value;
unset( $this->_options[ 'data' ] );
return $this;
} | [
"public",
"function",
"setOption",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"unset",
"(",
"$",
"this",
"->",
"_options",
"[",
"'data'",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets a options value.
@param string $name
@param mixed $value
@return \Niirrty\Translation\Sources\AbstractSource | [
"Sets",
"a",
"options",
"value",
"."
] | 5b1ad27fb87c14435edd2dc03e9af46dd5062de8 | https://github.com/Niirrty/Niirrty.Translation/blob/5b1ad27fb87c14435edd2dc03e9af46dd5062de8/src/Sources/AbstractSource.php#L174-L183 |
12,115 | iRAP-software/package-table-creator | TableEditor.php | TableEditor.addFields | public function addFields(array $fields)
{
foreach ($fields as $field)
{
$name = $field->getName();
$addFields[$name] = $field; # we key by name to prevent duplicates!
}
$keysString = "";
$fieldStrings = array();
foreach ($addFields as $fieldName => $field)
{
$fieldStrings[] = $field->getFieldString();
/* @var $field DatabaseField */
if ($field->isPrimaryKey())
{
$errMsg = 'Do not set field to be primary key when adding fields. ' .
'Instead, use the changePrimaryKey method';
throw new \Exception($errMsg);
}
elseif ($field->isKey())
{
if ($keysString !== "")
{
$keysString .= ", ";
}
if ($field->isUnique())
{
$keysString .= "UNIQUE ";
}
$keysString .= "KEY (`" . $fieldName . "`) ";
}
}
$fieldsString = implode(", ", $fieldStrings);
$fieldsString .= $keysString;
$query =
"ALTER TABLE " .
"`" . $this->m_name . "` " .
"ADD " .
"(" . $fieldsString . ") ";
$result = $this->m_mysqliConn->query($query);
if ($result !== TRUE)
{
throw new \Exception('Error creating table with query: ' . $query);
}
} | php | public function addFields(array $fields)
{
foreach ($fields as $field)
{
$name = $field->getName();
$addFields[$name] = $field; # we key by name to prevent duplicates!
}
$keysString = "";
$fieldStrings = array();
foreach ($addFields as $fieldName => $field)
{
$fieldStrings[] = $field->getFieldString();
/* @var $field DatabaseField */
if ($field->isPrimaryKey())
{
$errMsg = 'Do not set field to be primary key when adding fields. ' .
'Instead, use the changePrimaryKey method';
throw new \Exception($errMsg);
}
elseif ($field->isKey())
{
if ($keysString !== "")
{
$keysString .= ", ";
}
if ($field->isUnique())
{
$keysString .= "UNIQUE ";
}
$keysString .= "KEY (`" . $fieldName . "`) ";
}
}
$fieldsString = implode(", ", $fieldStrings);
$fieldsString .= $keysString;
$query =
"ALTER TABLE " .
"`" . $this->m_name . "` " .
"ADD " .
"(" . $fieldsString . ") ";
$result = $this->m_mysqliConn->query($query);
if ($result !== TRUE)
{
throw new \Exception('Error creating table with query: ' . $query);
}
} | [
"public",
"function",
"addFields",
"(",
"array",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"name",
"=",
"$",
"field",
"->",
"getName",
"(",
")",
";",
"$",
"addFields",
"[",
"$",
"name",
"]",
"=",
"$",
"field",
";",
"# we key by name to prevent duplicates!",
"}",
"$",
"keysString",
"=",
"\"\"",
";",
"$",
"fieldStrings",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"addFields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fieldStrings",
"[",
"]",
"=",
"$",
"field",
"->",
"getFieldString",
"(",
")",
";",
"/* @var $field DatabaseField */",
"if",
"(",
"$",
"field",
"->",
"isPrimaryKey",
"(",
")",
")",
"{",
"$",
"errMsg",
"=",
"'Do not set field to be primary key when adding fields. '",
".",
"'Instead, use the changePrimaryKey method'",
";",
"throw",
"new",
"\\",
"Exception",
"(",
"$",
"errMsg",
")",
";",
"}",
"elseif",
"(",
"$",
"field",
"->",
"isKey",
"(",
")",
")",
"{",
"if",
"(",
"$",
"keysString",
"!==",
"\"\"",
")",
"{",
"$",
"keysString",
".=",
"\", \"",
";",
"}",
"if",
"(",
"$",
"field",
"->",
"isUnique",
"(",
")",
")",
"{",
"$",
"keysString",
".=",
"\"UNIQUE \"",
";",
"}",
"$",
"keysString",
".=",
"\"KEY (`\"",
".",
"$",
"fieldName",
".",
"\"`) \"",
";",
"}",
"}",
"$",
"fieldsString",
"=",
"implode",
"(",
"\", \"",
",",
"$",
"fieldStrings",
")",
";",
"$",
"fieldsString",
".=",
"$",
"keysString",
";",
"$",
"query",
"=",
"\"ALTER TABLE \"",
".",
"\"`\"",
".",
"$",
"this",
"->",
"m_name",
".",
"\"` \"",
".",
"\"ADD \"",
".",
"\"(\"",
".",
"$",
"fieldsString",
".",
"\") \"",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"m_mysqliConn",
"->",
"query",
"(",
"$",
"query",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"TRUE",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Error creating table with query: '",
".",
"$",
"query",
")",
";",
"}",
"}"
] | Adds the specified fields to this table.
@param array $fields - an array of DatabaseField objects | [
"Adds",
"the",
"specified",
"fields",
"to",
"this",
"table",
"."
] | 069dfe5b95ec1bff4acc7d28affabce3e005c69c | https://github.com/iRAP-software/package-table-creator/blob/069dfe5b95ec1bff4acc7d28affabce3e005c69c/TableEditor.php#L49-L103 |
12,116 | iRAP-software/package-table-creator | TableEditor.php | TableEditor.removeKey | public function removeKey($key)
{
if (is_array($key))
{
$keyString = "(" . implode(',', $key) . ")";
}
else
{
$keyString = "`" . $key . "`";
}
$query =
"ALTER TABLE " .
'`' . $this->m_name . '` ' .
"DROP INDEX " . $keyString;
$result = $this->m_mysqliConn->query($query);
return $result;
} | php | public function removeKey($key)
{
if (is_array($key))
{
$keyString = "(" . implode(',', $key) . ")";
}
else
{
$keyString = "`" . $key . "`";
}
$query =
"ALTER TABLE " .
'`' . $this->m_name . '` ' .
"DROP INDEX " . $keyString;
$result = $this->m_mysqliConn->query($query);
return $result;
} | [
"public",
"function",
"removeKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"keyString",
"=",
"\"(\"",
".",
"implode",
"(",
"','",
",",
"$",
"key",
")",
".",
"\")\"",
";",
"}",
"else",
"{",
"$",
"keyString",
"=",
"\"`\"",
".",
"$",
"key",
".",
"\"`\"",
";",
"}",
"$",
"query",
"=",
"\"ALTER TABLE \"",
".",
"'`'",
".",
"$",
"this",
"->",
"m_name",
".",
"'` '",
".",
"\"DROP INDEX \"",
".",
"$",
"keyString",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"m_mysqliConn",
"->",
"query",
"(",
"$",
"query",
")",
";",
"return",
"$",
"result",
";",
"}"
] | Remove a key from the database. This does not remove the field itself.
@param String $key - the name of the field that is currently a key.
@throws Exception | [
"Remove",
"a",
"key",
"from",
"the",
"database",
".",
"This",
"does",
"not",
"remove",
"the",
"field",
"itself",
"."
] | 069dfe5b95ec1bff4acc7d28affabce3e005c69c | https://github.com/iRAP-software/package-table-creator/blob/069dfe5b95ec1bff4acc7d28affabce3e005c69c/TableEditor.php#L140-L158 |
12,117 | iRAP-software/package-table-creator | TableEditor.php | TableEditor.changeEngine | public function changeEngine($engine)
{
$allowed_engines = array(
self::ENGINE_INNODB,
self::ENGINE_MYISAM
);
if (!in_array($engine, $allowed_engines))
{
throw new \Exception('Unrecognized engine: ' . $engine);
}
$query =
"ALTER TABLE `" . $this->m_name . "` " .
"ENGINE=" . $engine;
$result = $this->m_mysqliConn->query($query);
return $result;
} | php | public function changeEngine($engine)
{
$allowed_engines = array(
self::ENGINE_INNODB,
self::ENGINE_MYISAM
);
if (!in_array($engine, $allowed_engines))
{
throw new \Exception('Unrecognized engine: ' . $engine);
}
$query =
"ALTER TABLE `" . $this->m_name . "` " .
"ENGINE=" . $engine;
$result = $this->m_mysqliConn->query($query);
return $result;
} | [
"public",
"function",
"changeEngine",
"(",
"$",
"engine",
")",
"{",
"$",
"allowed_engines",
"=",
"array",
"(",
"self",
"::",
"ENGINE_INNODB",
",",
"self",
"::",
"ENGINE_MYISAM",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"engine",
",",
"$",
"allowed_engines",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Unrecognized engine: '",
".",
"$",
"engine",
")",
";",
"}",
"$",
"query",
"=",
"\"ALTER TABLE `\"",
".",
"$",
"this",
"->",
"m_name",
".",
"\"` \"",
".",
"\"ENGINE=\"",
".",
"$",
"engine",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"m_mysqliConn",
"->",
"query",
"(",
"$",
"query",
")",
";",
"return",
"$",
"result",
";",
"}"
] | Change the tables engine to something else. Please make use of this classes constants
when providing the engine parameter.
@param String $engine - the name of the engine to change to.
@return type
@throws Exception | [
"Change",
"the",
"tables",
"engine",
"to",
"something",
"else",
".",
"Please",
"make",
"use",
"of",
"this",
"classes",
"constants",
"when",
"providing",
"the",
"engine",
"parameter",
"."
] | 069dfe5b95ec1bff4acc7d28affabce3e005c69c | https://github.com/iRAP-software/package-table-creator/blob/069dfe5b95ec1bff4acc7d28affabce3e005c69c/TableEditor.php#L243-L261 |
12,118 | squire-assistant/process | ProcessBuilder.php | ProcessBuilder.setOption | public function setOption($name, $value)
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
$this->options[$name] = $value;
return $this;
} | php | public function setOption($name, $value)
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
$this->options[$name] = $value;
return $this;
} | [
"public",
"function",
"setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The %s() method is deprecated since version 3.3 and will be removed in 4.0.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"->",
"options",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a proc_open option.
@param string $name The option name
@param string $value The option value
@return $this
@deprecated since version 3.3, to be removed in 4.0. | [
"Adds",
"a",
"proc_open",
"option",
"."
] | 472d47ef8f312fc0c6c1eb26df1e508550aea243 | https://github.com/squire-assistant/process/blob/472d47ef8f312fc0c6c1eb26df1e508550aea243/ProcessBuilder.php#L227-L234 |
12,119 | anekdotes/support | src/anekdotes/Arr.php | Arr.sortByKey | public static function sortByKey($data, $sortKey, $sort_flags = SORT_ASC)
{
if (empty($data) or empty($sortKey)) {
return $data;
}
$ordered = [];
$i = 0;
foreach ($data as $key => $value) {
++$i;
$ordered[$value[$sortKey].'-'.$i] = $value;
}
switch ($sort_flags) {
case SORT_ASC:
ksort($ordered, SORT_NUMERIC);
break;
case SORT_DESC:
krsort($ordered, SORT_NUMERIC);
break;
}
return array_values($ordered);
} | php | public static function sortByKey($data, $sortKey, $sort_flags = SORT_ASC)
{
if (empty($data) or empty($sortKey)) {
return $data;
}
$ordered = [];
$i = 0;
foreach ($data as $key => $value) {
++$i;
$ordered[$value[$sortKey].'-'.$i] = $value;
}
switch ($sort_flags) {
case SORT_ASC:
ksort($ordered, SORT_NUMERIC);
break;
case SORT_DESC:
krsort($ordered, SORT_NUMERIC);
break;
}
return array_values($ordered);
} | [
"public",
"static",
"function",
"sortByKey",
"(",
"$",
"data",
",",
"$",
"sortKey",
",",
"$",
"sort_flags",
"=",
"SORT_ASC",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"or",
"empty",
"(",
"$",
"sortKey",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"ordered",
"=",
"[",
"]",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"++",
"$",
"i",
";",
"$",
"ordered",
"[",
"$",
"value",
"[",
"$",
"sortKey",
"]",
".",
"'-'",
".",
"$",
"i",
"]",
"=",
"$",
"value",
";",
"}",
"switch",
"(",
"$",
"sort_flags",
")",
"{",
"case",
"SORT_ASC",
":",
"ksort",
"(",
"$",
"ordered",
",",
"SORT_NUMERIC",
")",
";",
"break",
";",
"case",
"SORT_DESC",
":",
"krsort",
"(",
"$",
"ordered",
",",
"SORT_NUMERIC",
")",
";",
"break",
";",
"}",
"return",
"array_values",
"(",
"$",
"ordered",
")",
";",
"}"
] | Sort the array by an object's key value.
@param array $data The array to sort
@param string $sortKey On which object's key the array must be sorted
@param \enum $sort_flags Either SORT_ASC or SORT_DESC. Defines if the sort is ascending or descending
@return array The ordered array | [
"Sort",
"the",
"array",
"by",
"an",
"object",
"s",
"key",
"value",
"."
] | 071befb735b6ec464be41dc9be7eeeb4b2a89467 | https://github.com/anekdotes/support/blob/071befb735b6ec464be41dc9be7eeeb4b2a89467/src/anekdotes/Arr.php#L19-L42 |
12,120 | anekdotes/support | src/anekdotes/Arr.php | Arr.getWhere | public static function getWhere($array, $key, $search, $default = null)
{
foreach ($array as $item) {
if (isset($item[$key]) && $item[$key] == $search) {
return $item;
}
}
return $default;
} | php | public static function getWhere($array, $key, $search, $default = null)
{
foreach ($array as $item) {
if (isset($item[$key]) && $item[$key] == $search) {
return $item;
}
}
return $default;
} | [
"public",
"static",
"function",
"getWhere",
"(",
"$",
"array",
",",
"$",
"key",
",",
"$",
"search",
",",
"$",
"default",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"item",
"[",
"$",
"key",
"]",
")",
"&&",
"$",
"item",
"[",
"$",
"key",
"]",
"==",
"$",
"search",
")",
"{",
"return",
"$",
"item",
";",
"}",
"}",
"return",
"$",
"default",
";",
"}"
] | Get an object in the array where its key is the same as the search value.
@param array $array Array to search in
@param string $key Key we're searching on
@param mixed $search Value we're searching in the object
@param mixed $default Default value in case no boject has the matching value for its key
@return mixed Found object | [
"Get",
"an",
"object",
"in",
"the",
"array",
"where",
"its",
"key",
"is",
"the",
"same",
"as",
"the",
"search",
"value",
"."
] | 071befb735b6ec464be41dc9be7eeeb4b2a89467 | https://github.com/anekdotes/support/blob/071befb735b6ec464be41dc9be7eeeb4b2a89467/src/anekdotes/Arr.php#L72-L81 |
12,121 | anekdotes/support | src/anekdotes/Arr.php | Arr.seedShuffle | public static function seedShuffle(&$array, $seed)
{
@mt_srand($seed);
for ($i = count($array) - 1; $i > 0; --$i) {
$j = @mt_rand(0, $i);
$tmp = $array[$i];
$array[$i] = $array[$j];
$array[$j] = $tmp;
}
} | php | public static function seedShuffle(&$array, $seed)
{
@mt_srand($seed);
for ($i = count($array) - 1; $i > 0; --$i) {
$j = @mt_rand(0, $i);
$tmp = $array[$i];
$array[$i] = $array[$j];
$array[$j] = $tmp;
}
} | [
"public",
"static",
"function",
"seedShuffle",
"(",
"&",
"$",
"array",
",",
"$",
"seed",
")",
"{",
"@",
"mt_srand",
"(",
"$",
"seed",
")",
";",
"for",
"(",
"$",
"i",
"=",
"count",
"(",
"$",
"array",
")",
"-",
"1",
";",
"$",
"i",
">",
"0",
";",
"--",
"$",
"i",
")",
"{",
"$",
"j",
"=",
"@",
"mt_rand",
"(",
"0",
",",
"$",
"i",
")",
";",
"$",
"tmp",
"=",
"$",
"array",
"[",
"$",
"i",
"]",
";",
"$",
"array",
"[",
"$",
"i",
"]",
"=",
"$",
"array",
"[",
"$",
"j",
"]",
";",
"$",
"array",
"[",
"$",
"j",
"]",
"=",
"$",
"tmp",
";",
"}",
"}"
] | Shuffles the array using a Seed.
@param array $array Array we're shuffling
@param int $seed Seed we're using to shuffle
@link https://en.wikipedia.org/wiki/Fisher–Yates_shuffle | [
"Shuffles",
"the",
"array",
"using",
"a",
"Seed",
"."
] | 071befb735b6ec464be41dc9be7eeeb4b2a89467 | https://github.com/anekdotes/support/blob/071befb735b6ec464be41dc9be7eeeb4b2a89467/src/anekdotes/Arr.php#L117-L126 |
12,122 | ptorn/bth-anax-user | src/User/UserActiveRecordModel.php | UserActiveRecordModel.setUserData | public function setUserData(User $user)
{
$userVarArray = get_object_vars($user);
foreach ($userVarArray as $key => $value) {
if ($value !== null) {
$this->{$key} = $value;
}
}
} | php | public function setUserData(User $user)
{
$userVarArray = get_object_vars($user);
foreach ($userVarArray as $key => $value) {
if ($value !== null) {
$this->{$key} = $value;
}
}
} | [
"public",
"function",
"setUserData",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"userVarArray",
"=",
"get_object_vars",
"(",
"$",
"user",
")",
";",
"foreach",
"(",
"$",
"userVarArray",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"key",
"}",
"=",
"$",
"value",
";",
"}",
"}",
"}"
] | Dynamicly set user properties to its value.
@param User $user user object | [
"Dynamicly",
"set",
"user",
"properties",
"to",
"its",
"value",
"."
] | 223e569cbebfd3f9302bdef648b13b73cb3f1d19 | https://github.com/ptorn/bth-anax-user/blob/223e569cbebfd3f9302bdef648b13b73cb3f1d19/src/User/UserActiveRecordModel.php#L91-L100 |
12,123 | ptorn/bth-anax-user | src/User/UserActiveRecordModel.php | UserActiveRecordModel.findAllUsers | public function findAllUsers()
{
$this->checkDb();
return $this->db->connect()
->select()
->from($this->tableName)
->where("deleted IS NULL")
->execute()
->fetchAllClass(get_class($this));
} | php | public function findAllUsers()
{
$this->checkDb();
return $this->db->connect()
->select()
->from($this->tableName)
->where("deleted IS NULL")
->execute()
->fetchAllClass(get_class($this));
} | [
"public",
"function",
"findAllUsers",
"(",
")",
"{",
"$",
"this",
"->",
"checkDb",
"(",
")",
";",
"return",
"$",
"this",
"->",
"db",
"->",
"connect",
"(",
")",
"->",
"select",
"(",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"tableName",
")",
"->",
"where",
"(",
"\"deleted IS NULL\"",
")",
"->",
"execute",
"(",
")",
"->",
"fetchAllClass",
"(",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"}"
] | Returns all users stored and that are not deleted.
@return array Array with all users. | [
"Returns",
"all",
"users",
"stored",
"and",
"that",
"are",
"not",
"deleted",
"."
] | 223e569cbebfd3f9302bdef648b13b73cb3f1d19 | https://github.com/ptorn/bth-anax-user/blob/223e569cbebfd3f9302bdef648b13b73cb3f1d19/src/User/UserActiveRecordModel.php#L125-L134 |
12,124 | maikovisky/laravel-plus | src/PackagerHelper.php | PackagerHelper.removeDir | public function removeDir($path)
{
if ($path == 'packages' or $path == '/') {
return false;
}
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $file) {
if (is_dir("$path/$file")) {
$this->removeDir("$path/$file");
} else {
@chmod("$path/$file", 0777);
@unlink("$path/$file");
}
}
return rmdir($path);
} | php | public function removeDir($path)
{
if ($path == 'packages' or $path == '/') {
return false;
}
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $file) {
if (is_dir("$path/$file")) {
$this->removeDir("$path/$file");
} else {
@chmod("$path/$file", 0777);
@unlink("$path/$file");
}
}
return rmdir($path);
} | [
"public",
"function",
"removeDir",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"path",
"==",
"'packages'",
"or",
"$",
"path",
"==",
"'/'",
")",
"{",
"return",
"false",
";",
"}",
"$",
"files",
"=",
"array_diff",
"(",
"scandir",
"(",
"$",
"path",
")",
",",
"[",
"'.'",
",",
"'..'",
"]",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"is_dir",
"(",
"\"$path/$file\"",
")",
")",
"{",
"$",
"this",
"->",
"removeDir",
"(",
"\"$path/$file\"",
")",
";",
"}",
"else",
"{",
"@",
"chmod",
"(",
"\"$path/$file\"",
",",
"0777",
")",
";",
"@",
"unlink",
"(",
"\"$path/$file\"",
")",
";",
"}",
"}",
"return",
"rmdir",
"(",
"$",
"path",
")",
";",
"}"
] | Remove a directory if it exists.
@param string $path Path of the directory to remove.
@return void | [
"Remove",
"a",
"directory",
"if",
"it",
"exists",
"."
] | 554ff8da981aa0b0c521c0c9326edc7569049b0c | https://github.com/maikovisky/laravel-plus/blob/554ff8da981aa0b0c521c0c9326edc7569049b0c/src/PackagerHelper.php#L90-L107 |
12,125 | Softpampa/moip-sdk-php | src/Payments/Resources/Notifications.php | Notifications.delete | public function delete($id = null)
{
if (! $id) {
$id = $this->data->id;
}
return $this->client->delete('/{id}', ['id' => $id]);
} | php | public function delete($id = null)
{
if (! $id) {
$id = $this->data->id;
}
return $this->client->delete('/{id}', ['id' => $id]);
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"data",
"->",
"id",
";",
"}",
"return",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"'/{id}'",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"}"
] | Delete a notification preference
@param int $id
@return $this | [
"Delete",
"a",
"notification",
"preference"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Notifications.php#L48-L55 |
12,126 | Softpampa/moip-sdk-php | src/Payments/Resources/Notifications.php | Notifications.setWebHook | public function setWebHook($url)
{
$this->data->target = $url;
$this->data->media = self::DEFAULT_MEDIA;
return $this;
} | php | public function setWebHook($url)
{
$this->data->target = $url;
$this->data->media = self::DEFAULT_MEDIA;
return $this;
} | [
"public",
"function",
"setWebHook",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"target",
"=",
"$",
"url",
";",
"$",
"this",
"->",
"data",
"->",
"media",
"=",
"self",
"::",
"DEFAULT_MEDIA",
";",
"return",
"$",
"this",
";",
"}"
] | Set WebHook URL
@param string $url
@return $this | [
"Set",
"WebHook",
"URL"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Notifications.php#L84-L90 |
12,127 | Softpampa/moip-sdk-php | src/Payments/Resources/Notifications.php | Notifications.setEventsList | public function setEventsList(array $events)
{
$this->data->events = array_merge($this->data->events, $events);
return $this;
} | php | public function setEventsList(array $events)
{
$this->data->events = array_merge($this->data->events, $events);
return $this;
} | [
"public",
"function",
"setEventsList",
"(",
"array",
"$",
"events",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"events",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
"->",
"events",
",",
"$",
"events",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set a list of events name
@param array $events
@return $this | [
"Set",
"a",
"list",
"of",
"events",
"name"
] | 621a71bd2ef1f9b690cd3431507af608152f6ad2 | https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Payments/Resources/Notifications.php#L111-L116 |
12,128 | slickframework/orm | src/Event/AbstractEvent.php | AbstractEvent.getEntityName | public function getEntityName()
{
if (null == $this->entityName) {
$this->setEntityName(get_class($this->getEntity()));
}
return $this->entityName;
} | php | public function getEntityName()
{
if (null == $this->entityName) {
$this->setEntityName(get_class($this->getEntity()));
}
return $this->entityName;
} | [
"public",
"function",
"getEntityName",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"entityName",
")",
"{",
"$",
"this",
"->",
"setEntityName",
"(",
"get_class",
"(",
"$",
"this",
"->",
"getEntity",
"(",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"entityName",
";",
"}"
] | Gets the entity class name that triggers the event
@return string | [
"Gets",
"the",
"entity",
"class",
"name",
"that",
"triggers",
"the",
"event"
] | c5c782f5e3a46cdc6c934eda4411cb9edc48f969 | https://github.com/slickframework/orm/blob/c5c782f5e3a46cdc6c934eda4411cb9edc48f969/src/Event/AbstractEvent.php#L73-L79 |
12,129 | phellow/intl | src/IntlService.php | IntlService.replace | protected function replace($text, $replacements)
{
if (is_array($replacements)) {
foreach ($replacements as $var => $replacement) {
$regex = str_replace('key', preg_quote($var, '/'), $this->translateReplaceRegex);
$text = preg_replace($regex, $replacement, $text);
}
}
return $text;
} | php | protected function replace($text, $replacements)
{
if (is_array($replacements)) {
foreach ($replacements as $var => $replacement) {
$regex = str_replace('key', preg_quote($var, '/'), $this->translateReplaceRegex);
$text = preg_replace($regex, $replacement, $text);
}
}
return $text;
} | [
"protected",
"function",
"replace",
"(",
"$",
"text",
",",
"$",
"replacements",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"replacements",
")",
")",
"{",
"foreach",
"(",
"$",
"replacements",
"as",
"$",
"var",
"=>",
"$",
"replacement",
")",
"{",
"$",
"regex",
"=",
"str_replace",
"(",
"'key'",
",",
"preg_quote",
"(",
"$",
"var",
",",
"'/'",
")",
",",
"$",
"this",
"->",
"translateReplaceRegex",
")",
";",
"$",
"text",
"=",
"preg_replace",
"(",
"$",
"regex",
",",
"$",
"replacement",
",",
"$",
"text",
")",
";",
"}",
"}",
"return",
"$",
"text",
";",
"}"
] | Replace text variables.
@param string $text
@param array|null $replacements
@return string | [
"Replace",
"text",
"variables",
"."
] | 7817f57242a6084ce68ddfb3055191c955ec14f1 | https://github.com/phellow/intl/blob/7817f57242a6084ce68ddfb3055191c955ec14f1/src/IntlService.php#L158-L167 |
12,130 | phellow/intl | src/IntlService.php | IntlService._ | public function _($text, $replacements = null, $locale = null)
{
if (!$locale) {
$locale = $this->getLocale();
}
if ($this->translator !== null) {
$text = $this->translator->translate($text, $locale);
}
return $this->replace($text, $replacements);
} | php | public function _($text, $replacements = null, $locale = null)
{
if (!$locale) {
$locale = $this->getLocale();
}
if ($this->translator !== null) {
$text = $this->translator->translate($text, $locale);
}
return $this->replace($text, $replacements);
} | [
"public",
"function",
"_",
"(",
"$",
"text",
",",
"$",
"replacements",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"locale",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"translator",
"!==",
"null",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"translator",
"->",
"translate",
"(",
"$",
"text",
",",
"$",
"locale",
")",
";",
"}",
"return",
"$",
"this",
"->",
"replace",
"(",
"$",
"text",
",",
"$",
"replacements",
")",
";",
"}"
] | Translate a text.
@param string $text The text to translate.
@param array|null $replacements Values that should be replaced.
@param string $locale The locale or null to use the current locale.
@return string Translated text or given text if no translation found. | [
"Translate",
"a",
"text",
"."
] | 7817f57242a6084ce68ddfb3055191c955ec14f1 | https://github.com/phellow/intl/blob/7817f57242a6084ce68ddfb3055191c955ec14f1/src/IntlService.php#L178-L189 |
12,131 | phellow/intl | src/IntlService.php | IntlService._n | public function _n($textSingular, $textPlural, $number, $replacements = null, $locale = null)
{
if (!$locale) {
$locale = $this->getLocale();
}
if ($this->translator !== null) {
$text = $this->translator->translatePlurals($textSingular, $textPlural, $number, $locale);
} else {
$text = $number == 1 ? $textSingular : $textPlural;
}
return $this->replace($text, $replacements);
} | php | public function _n($textSingular, $textPlural, $number, $replacements = null, $locale = null)
{
if (!$locale) {
$locale = $this->getLocale();
}
if ($this->translator !== null) {
$text = $this->translator->translatePlurals($textSingular, $textPlural, $number, $locale);
} else {
$text = $number == 1 ? $textSingular : $textPlural;
}
return $this->replace($text, $replacements);
} | [
"public",
"function",
"_n",
"(",
"$",
"textSingular",
",",
"$",
"textPlural",
",",
"$",
"number",
",",
"$",
"replacements",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"locale",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"translator",
"!==",
"null",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"translator",
"->",
"translatePlurals",
"(",
"$",
"textSingular",
",",
"$",
"textPlural",
",",
"$",
"number",
",",
"$",
"locale",
")",
";",
"}",
"else",
"{",
"$",
"text",
"=",
"$",
"number",
"==",
"1",
"?",
"$",
"textSingular",
":",
"$",
"textPlural",
";",
"}",
"return",
"$",
"this",
"->",
"replace",
"(",
"$",
"text",
",",
"$",
"replacements",
")",
";",
"}"
] | Translate the given text based on the given number.
@param string $textSingular The text in its singular form.
@param string $textPlural The text in its plural form.
@param int $number The number.
@param array|null $replacements Values that should be replaced.
@param string $locale The locale or null to use the current locale.
@return string Translated text or given text if no translation found. | [
"Translate",
"the",
"given",
"text",
"based",
"on",
"the",
"given",
"number",
"."
] | 7817f57242a6084ce68ddfb3055191c955ec14f1 | https://github.com/phellow/intl/blob/7817f57242a6084ce68ddfb3055191c955ec14f1/src/IntlService.php#L202-L215 |
12,132 | phellow/intl | src/IntlService.php | IntlService.formatDateTime | public function formatDateTime(\DateTime $datetime, $format, $calendar = \IntlDateFormatter::GREGORIAN)
{
$types = array(
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
);
if (is_array($format)) {
if (isset($format[0])) {
$types[0] = $format[0];
}
if (isset($format[1])) {
$types[1] = $format[1];
}
$pattern = null;
} else {
$pattern = $format;
}
$formatter = new \IntlDateFormatter(
$this->currentLocale,
$types[0],
$types[1],
$datetime->getTimezone()->getName(),
$calendar,
$pattern
);
return $formatter->format($datetime);
} | php | public function formatDateTime(\DateTime $datetime, $format, $calendar = \IntlDateFormatter::GREGORIAN)
{
$types = array(
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
);
if (is_array($format)) {
if (isset($format[0])) {
$types[0] = $format[0];
}
if (isset($format[1])) {
$types[1] = $format[1];
}
$pattern = null;
} else {
$pattern = $format;
}
$formatter = new \IntlDateFormatter(
$this->currentLocale,
$types[0],
$types[1],
$datetime->getTimezone()->getName(),
$calendar,
$pattern
);
return $formatter->format($datetime);
} | [
"public",
"function",
"formatDateTime",
"(",
"\\",
"DateTime",
"$",
"datetime",
",",
"$",
"format",
",",
"$",
"calendar",
"=",
"\\",
"IntlDateFormatter",
"::",
"GREGORIAN",
")",
"{",
"$",
"types",
"=",
"array",
"(",
"\\",
"IntlDateFormatter",
"::",
"NONE",
",",
"\\",
"IntlDateFormatter",
"::",
"NONE",
",",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"format",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"format",
"[",
"0",
"]",
")",
")",
"{",
"$",
"types",
"[",
"0",
"]",
"=",
"$",
"format",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"format",
"[",
"1",
"]",
")",
")",
"{",
"$",
"types",
"[",
"1",
"]",
"=",
"$",
"format",
"[",
"1",
"]",
";",
"}",
"$",
"pattern",
"=",
"null",
";",
"}",
"else",
"{",
"$",
"pattern",
"=",
"$",
"format",
";",
"}",
"$",
"formatter",
"=",
"new",
"\\",
"IntlDateFormatter",
"(",
"$",
"this",
"->",
"currentLocale",
",",
"$",
"types",
"[",
"0",
"]",
",",
"$",
"types",
"[",
"1",
"]",
",",
"$",
"datetime",
"->",
"getTimezone",
"(",
")",
"->",
"getName",
"(",
")",
",",
"$",
"calendar",
",",
"$",
"pattern",
")",
";",
"return",
"$",
"formatter",
"->",
"format",
"(",
"$",
"datetime",
")",
";",
"}"
] | Format DateTime to current locale format.
@param \DateTime $datetime DateTime to format.
@param string|array $format Format string or array like [datetype, timetype].
@param int $calendar IntlDateFormatter calendar to use.
@return string | [
"Format",
"DateTime",
"to",
"current",
"locale",
"format",
"."
] | 7817f57242a6084ce68ddfb3055191c955ec14f1 | https://github.com/phellow/intl/blob/7817f57242a6084ce68ddfb3055191c955ec14f1/src/IntlService.php#L226-L252 |
12,133 | xmmedia/XMMailManagerBundle | Component/MailManager.php | MailManager.getSender | public function getSender()
{
$sender = $this->createSender();
$sender->setFrom($this->fromEmail, $this->fromName);
if ($this->replyToEmail) {
$sender->setReplyTo($this->replyToEmail);
}
return $sender;
} | php | public function getSender()
{
$sender = $this->createSender();
$sender->setFrom($this->fromEmail, $this->fromName);
if ($this->replyToEmail) {
$sender->setReplyTo($this->replyToEmail);
}
return $sender;
} | [
"public",
"function",
"getSender",
"(",
")",
"{",
"$",
"sender",
"=",
"$",
"this",
"->",
"createSender",
"(",
")",
";",
"$",
"sender",
"->",
"setFrom",
"(",
"$",
"this",
"->",
"fromEmail",
",",
"$",
"this",
"->",
"fromName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"replyToEmail",
")",
"{",
"$",
"sender",
"->",
"setReplyTo",
"(",
"$",
"this",
"->",
"replyToEmail",
")",
";",
"}",
"return",
"$",
"sender",
";",
"}"
] | Creates a sender instance and sets the from email & name
and reply to address.
@return MailSender | [
"Creates",
"a",
"sender",
"instance",
"and",
"sets",
"the",
"from",
"email",
"&",
"name",
"and",
"reply",
"to",
"address",
"."
] | 1fab55b0db1a9c6f22c84c545dd8f9f31191922d | https://github.com/xmmedia/XMMailManagerBundle/blob/1fab55b0db1a9c6f22c84c545dd8f9f31191922d/Component/MailManager.php#L100-L111 |
12,134 | dms-org/package.faqs | src/Core/FaqLoaderService.php | FaqLoaderService.loadFaqs | public function loadFaqs() : array
{
return $this->repository->matching(
$this->repository->criteria()
->orderByAsc(Faq::ORDER_TO_DISPLAY)
);
} | php | public function loadFaqs() : array
{
return $this->repository->matching(
$this->repository->criteria()
->orderByAsc(Faq::ORDER_TO_DISPLAY)
);
} | [
"public",
"function",
"loadFaqs",
"(",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"repository",
"->",
"matching",
"(",
"$",
"this",
"->",
"repository",
"->",
"criteria",
"(",
")",
"->",
"orderByAsc",
"(",
"Faq",
"::",
"ORDER_TO_DISPLAY",
")",
")",
";",
"}"
] | Loads the FAQ's
@return Faq[] | [
"Loads",
"the",
"FAQ",
"s"
] | 90644fd913e4aa1a56f8dd8c172c8369051952bc | https://github.com/dms-org/package.faqs/blob/90644fd913e4aa1a56f8dd8c172c8369051952bc/src/Core/FaqLoaderService.php#L30-L36 |
12,135 | marando/phpSOFA | src/Marando/IAU/iauD2tf.php | iauD2tf.D2tf | public static function D2tf($ndp, $days, &$sign, array &$ihmsf) {
$nrs;
$n;
$rs;
$rm;
$rh;
$a;
$w;
$ah;
$am;
$as;
$af;
/* Handle sign. */
$sign = $days >= 0.0 ? '+' : '-';
/* Interval in seconds. */
$a = DAYSEC * abs($days);
/* Pre-round if resolution coarser than 1s (then pretend ndp=1). */
if ($ndp < 0) {
$nrs = 1;
for ($n = 1; $n <= -$ndp; $n++) {
$nrs *= ($n == 2 || $n == 4) ? 6 : 10;
}
$rs = (double)$nrs;
$w = $a / $rs;
$a = $rs * intval($w);
}
/* Express the unit of each field in resolution units. */
$nrs = 1;
for ($n = 1; $n <= $ndp; $n++) {
$nrs *= 10;
}
$rs = (double)$nrs;
$rm = $rs * 60.0;
$rh = $rm * 60.0;
/* Round the interval and express in resolution units. */
$a = round($rs * $a);
/* Break into fields. */
$ah = $a / $rh;
$ah = intval($ah);
$a -= $ah * $rh;
$am = $a / $rm;
$am = intval($am);
$a -= $am * $rm;
$as = $a / $rs;
$as = intval($as);
$af = $a - $as * $rs;
/* Return results. */
$ihmsf[0] = (int)$ah;
$ihmsf[1] = (int)$am;
$ihmsf[2] = (int)$as;
$ihmsf[3] = (int)$af;
return;
} | php | public static function D2tf($ndp, $days, &$sign, array &$ihmsf) {
$nrs;
$n;
$rs;
$rm;
$rh;
$a;
$w;
$ah;
$am;
$as;
$af;
/* Handle sign. */
$sign = $days >= 0.0 ? '+' : '-';
/* Interval in seconds. */
$a = DAYSEC * abs($days);
/* Pre-round if resolution coarser than 1s (then pretend ndp=1). */
if ($ndp < 0) {
$nrs = 1;
for ($n = 1; $n <= -$ndp; $n++) {
$nrs *= ($n == 2 || $n == 4) ? 6 : 10;
}
$rs = (double)$nrs;
$w = $a / $rs;
$a = $rs * intval($w);
}
/* Express the unit of each field in resolution units. */
$nrs = 1;
for ($n = 1; $n <= $ndp; $n++) {
$nrs *= 10;
}
$rs = (double)$nrs;
$rm = $rs * 60.0;
$rh = $rm * 60.0;
/* Round the interval and express in resolution units. */
$a = round($rs * $a);
/* Break into fields. */
$ah = $a / $rh;
$ah = intval($ah);
$a -= $ah * $rh;
$am = $a / $rm;
$am = intval($am);
$a -= $am * $rm;
$as = $a / $rs;
$as = intval($as);
$af = $a - $as * $rs;
/* Return results. */
$ihmsf[0] = (int)$ah;
$ihmsf[1] = (int)$am;
$ihmsf[2] = (int)$as;
$ihmsf[3] = (int)$af;
return;
} | [
"public",
"static",
"function",
"D2tf",
"(",
"$",
"ndp",
",",
"$",
"days",
",",
"&",
"$",
"sign",
",",
"array",
"&",
"$",
"ihmsf",
")",
"{",
"$",
"nrs",
";",
"$",
"n",
";",
"$",
"rs",
";",
"$",
"rm",
";",
"$",
"rh",
";",
"$",
"a",
";",
"$",
"w",
";",
"$",
"ah",
";",
"$",
"am",
";",
"$",
"as",
";",
"$",
"af",
";",
"/* Handle sign. */",
"$",
"sign",
"=",
"$",
"days",
">=",
"0.0",
"?",
"'+'",
":",
"'-'",
";",
"/* Interval in seconds. */",
"$",
"a",
"=",
"DAYSEC",
"*",
"abs",
"(",
"$",
"days",
")",
";",
"/* Pre-round if resolution coarser than 1s (then pretend ndp=1). */",
"if",
"(",
"$",
"ndp",
"<",
"0",
")",
"{",
"$",
"nrs",
"=",
"1",
";",
"for",
"(",
"$",
"n",
"=",
"1",
";",
"$",
"n",
"<=",
"-",
"$",
"ndp",
";",
"$",
"n",
"++",
")",
"{",
"$",
"nrs",
"*=",
"(",
"$",
"n",
"==",
"2",
"||",
"$",
"n",
"==",
"4",
")",
"?",
"6",
":",
"10",
";",
"}",
"$",
"rs",
"=",
"(",
"double",
")",
"$",
"nrs",
";",
"$",
"w",
"=",
"$",
"a",
"/",
"$",
"rs",
";",
"$",
"a",
"=",
"$",
"rs",
"*",
"intval",
"(",
"$",
"w",
")",
";",
"}",
"/* Express the unit of each field in resolution units. */",
"$",
"nrs",
"=",
"1",
";",
"for",
"(",
"$",
"n",
"=",
"1",
";",
"$",
"n",
"<=",
"$",
"ndp",
";",
"$",
"n",
"++",
")",
"{",
"$",
"nrs",
"*=",
"10",
";",
"}",
"$",
"rs",
"=",
"(",
"double",
")",
"$",
"nrs",
";",
"$",
"rm",
"=",
"$",
"rs",
"*",
"60.0",
";",
"$",
"rh",
"=",
"$",
"rm",
"*",
"60.0",
";",
"/* Round the interval and express in resolution units. */",
"$",
"a",
"=",
"round",
"(",
"$",
"rs",
"*",
"$",
"a",
")",
";",
"/* Break into fields. */",
"$",
"ah",
"=",
"$",
"a",
"/",
"$",
"rh",
";",
"$",
"ah",
"=",
"intval",
"(",
"$",
"ah",
")",
";",
"$",
"a",
"-=",
"$",
"ah",
"*",
"$",
"rh",
";",
"$",
"am",
"=",
"$",
"a",
"/",
"$",
"rm",
";",
"$",
"am",
"=",
"intval",
"(",
"$",
"am",
")",
";",
"$",
"a",
"-=",
"$",
"am",
"*",
"$",
"rm",
";",
"$",
"as",
"=",
"$",
"a",
"/",
"$",
"rs",
";",
"$",
"as",
"=",
"intval",
"(",
"$",
"as",
")",
";",
"$",
"af",
"=",
"$",
"a",
"-",
"$",
"as",
"*",
"$",
"rs",
";",
"/* Return results. */",
"$",
"ihmsf",
"[",
"0",
"]",
"=",
"(",
"int",
")",
"$",
"ah",
";",
"$",
"ihmsf",
"[",
"1",
"]",
"=",
"(",
"int",
")",
"$",
"am",
";",
"$",
"ihmsf",
"[",
"2",
"]",
"=",
"(",
"int",
")",
"$",
"as",
";",
"$",
"ihmsf",
"[",
"3",
"]",
"=",
"(",
"int",
")",
"$",
"af",
";",
"return",
";",
"}"
] | - - - - - - - -
i a u D 2 t f
- - - - - - - -
Decompose days to hours, minutes, seconds, fraction.
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: vector/matrix support function.
Given:
ndp int resolution (Note 1)
days double interval in days
Returned:
sign char '+' or '-'
ihmsf int[4] hours, minutes, seconds, fraction
Notes:
1) The argument ndp is interpreted as follows:
ndp resolution
: ...0000 00 00
-7 1000 00 00
-6 100 00 00
-5 10 00 00
-4 1 00 00
-3 0 10 00
-2 0 01 00
-1 0 00 10
0 0 00 01
1 0 00 00.1
2 0 00 00.01
3 0 00 00.001
: 0 00 00.000...
2) The largest positive useful value for ndp is determined by the
size of days, the format of double on the target platform, and
the risk of overflowing ihmsf[3]. On a typical platform, for
days up to 1.0, the available floating-point precision might
correspond to ndp=12. However, the practical limit is typically
ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
only 16 bits.
3) The absolute value of days may exceed 1.0. In cases where it
does not, it is up to the caller to test for and handle the
case where days is very nearly 1.0 and rounds up to 24 hours,
by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
This revision: 2013 June 18
SOFA release 2015-02-09
Copyright (C) 2015 IAU SOFA Board. See notes at end. | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"D",
"2",
"t",
"f",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauD2tf.php#L65-L125 |
12,136 | phlexible/phlexible | src/Phlexible/Component/MediaCache/Storage/AbstractStorage.php | AbstractStorage.replaceExtension | protected function replaceExtension($filename, $ext)
{
$ext = str_replace('.', '', $ext);
$filename = $this->removeExtension($filename);
return $filename.'.'.$ext;
} | php | protected function replaceExtension($filename, $ext)
{
$ext = str_replace('.', '', $ext);
$filename = $this->removeExtension($filename);
return $filename.'.'.$ext;
} | [
"protected",
"function",
"replaceExtension",
"(",
"$",
"filename",
",",
"$",
"ext",
")",
"{",
"$",
"ext",
"=",
"str_replace",
"(",
"'.'",
",",
"''",
",",
"$",
"ext",
")",
";",
"$",
"filename",
"=",
"$",
"this",
"->",
"removeExtension",
"(",
"$",
"filename",
")",
";",
"return",
"$",
"filename",
".",
"'.'",
".",
"$",
"ext",
";",
"}"
] | Remove a filename extension.
@param string $filename
@param string $ext
@return string | [
"Remove",
"a",
"filename",
"extension",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Component/MediaCache/Storage/AbstractStorage.php#L92-L98 |
12,137 | sasedev/extra-tools-bundle | src/Sasedev/ExtraToolsBundle/Util/UnitConverter/ChainUnitConverter.php | ChainUnitConverter.guessConvert | public function guessConvert($value, $destinationUnit, $locale = null)
{
$result = array();
if (preg_match('#([\d,\.\s]+)\s*([^\s]+)#', $value, $result) > 0) {
return $this->convert(\floatval(\str_replace(array(',', ' '), array('.', ''), $result[1])), $result[2], $destinationUnit,
$locale);
}
return null;
} | php | public function guessConvert($value, $destinationUnit, $locale = null)
{
$result = array();
if (preg_match('#([\d,\.\s]+)\s*([^\s]+)#', $value, $result) > 0) {
return $this->convert(\floatval(\str_replace(array(',', ' '), array('.', ''), $result[1])), $result[2], $destinationUnit,
$locale);
}
return null;
} | [
"public",
"function",
"guessConvert",
"(",
"$",
"value",
",",
"$",
"destinationUnit",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'#([\\d,\\.\\s]+)\\s*([^\\s]+)#'",
",",
"$",
"value",
",",
"$",
"result",
")",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"convert",
"(",
"\\",
"floatval",
"(",
"\\",
"str_replace",
"(",
"array",
"(",
"','",
",",
"' '",
")",
",",
"array",
"(",
"'.'",
",",
"''",
")",
",",
"$",
"result",
"[",
"1",
"]",
")",
")",
",",
"$",
"result",
"[",
"2",
"]",
",",
"$",
"destinationUnit",
",",
"$",
"locale",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Tries to guess the source unit by parsing the string and then apply a convertion.
Returns null if fails or not supported.
@param string $value
@param string $destinationUnit
@param
string the locale (optional)
@return mixed The converted value | [
"Tries",
"to",
"guess",
"the",
"source",
"unit",
"by",
"parsing",
"the",
"string",
"and",
"then",
"apply",
"a",
"convertion",
".",
"Returns",
"null",
"if",
"fails",
"or",
"not",
"supported",
"."
] | 14037d6b5c8ba9520ffe33f26057e2e53bea7a75 | https://github.com/sasedev/extra-tools-bundle/blob/14037d6b5c8ba9520ffe33f26057e2e53bea7a75/src/Sasedev/ExtraToolsBundle/Util/UnitConverter/ChainUnitConverter.php#L30-L40 |
12,138 | cekurte/component-bundle | src/EventListener/ResponseListener.php | ResponseListener.onKernelResponse | public function onKernelResponse(FilterResponseEvent $event)
{
$response = $event->getResponse();
if ($response instanceof SerializedResponse) {
$acceptableContentTypes = $event->getRequest()->getAcceptableContentTypes();
$format = 'json';
foreach ($acceptableContentTypes as $item) {
if (strpos($item, 'xml') !== false) {
$format = 'xml';
break;
}
}
$serializedData = $this->serializer->serialize($response->getData(), $format, null);
$response->setContent($serializedData);
}
} | php | public function onKernelResponse(FilterResponseEvent $event)
{
$response = $event->getResponse();
if ($response instanceof SerializedResponse) {
$acceptableContentTypes = $event->getRequest()->getAcceptableContentTypes();
$format = 'json';
foreach ($acceptableContentTypes as $item) {
if (strpos($item, 'xml') !== false) {
$format = 'xml';
break;
}
}
$serializedData = $this->serializer->serialize($response->getData(), $format, null);
$response->setContent($serializedData);
}
} | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"$",
"response",
"instanceof",
"SerializedResponse",
")",
"{",
"$",
"acceptableContentTypes",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
"->",
"getAcceptableContentTypes",
"(",
")",
";",
"$",
"format",
"=",
"'json'",
";",
"foreach",
"(",
"$",
"acceptableContentTypes",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"item",
",",
"'xml'",
")",
"!==",
"false",
")",
"{",
"$",
"format",
"=",
"'xml'",
";",
"break",
";",
"}",
"}",
"$",
"serializedData",
"=",
"$",
"this",
"->",
"serializer",
"->",
"serialize",
"(",
"$",
"response",
"->",
"getData",
"(",
")",
",",
"$",
"format",
",",
"null",
")",
";",
"$",
"response",
"->",
"setContent",
"(",
"$",
"serializedData",
")",
";",
"}",
"}"
] | Modify the Response given the Request if the Response is a instance of SerializedResponse.
@param FilterResponseEvent $event | [
"Modify",
"the",
"Response",
"given",
"the",
"Request",
"if",
"the",
"Response",
"is",
"a",
"instance",
"of",
"SerializedResponse",
"."
] | 0c9b802068492095362e29a61180396463ff9904 | https://github.com/cekurte/component-bundle/blob/0c9b802068492095362e29a61180396463ff9904/src/EventListener/ResponseListener.php#L69-L89 |
12,139 | krisanalfa/bono-lang | src/Bono/Lang/Driver/FileDriver.php | FileDriver.buildLists | protected function buildLists()
{
$lists = array();
$langList = array();
$path = $this->config['lang.path'];
$objects = new RII(new RDI($path), RII::SELF_FIRST);
foreach ($objects as $object) {
if ($object->getExtension() === 'php') {
$pathName = $object->getPathName();
$explodedPathName = explode('/', dirname($pathName));
$fileName = end($explodedPathName);
$langList[$fileName] = true;
$lists[$fileName] = require_once $pathName;
}
}
$this->langList = $langList;
$this->list = $this->arrayDot($lists);
} | php | protected function buildLists()
{
$lists = array();
$langList = array();
$path = $this->config['lang.path'];
$objects = new RII(new RDI($path), RII::SELF_FIRST);
foreach ($objects as $object) {
if ($object->getExtension() === 'php') {
$pathName = $object->getPathName();
$explodedPathName = explode('/', dirname($pathName));
$fileName = end($explodedPathName);
$langList[$fileName] = true;
$lists[$fileName] = require_once $pathName;
}
}
$this->langList = $langList;
$this->list = $this->arrayDot($lists);
} | [
"protected",
"function",
"buildLists",
"(",
")",
"{",
"$",
"lists",
"=",
"array",
"(",
")",
";",
"$",
"langList",
"=",
"array",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"config",
"[",
"'lang.path'",
"]",
";",
"$",
"objects",
"=",
"new",
"RII",
"(",
"new",
"RDI",
"(",
"$",
"path",
")",
",",
"RII",
"::",
"SELF_FIRST",
")",
";",
"foreach",
"(",
"$",
"objects",
"as",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"object",
"->",
"getExtension",
"(",
")",
"===",
"'php'",
")",
"{",
"$",
"pathName",
"=",
"$",
"object",
"->",
"getPathName",
"(",
")",
";",
"$",
"explodedPathName",
"=",
"explode",
"(",
"'/'",
",",
"dirname",
"(",
"$",
"pathName",
")",
")",
";",
"$",
"fileName",
"=",
"end",
"(",
"$",
"explodedPathName",
")",
";",
"$",
"langList",
"[",
"$",
"fileName",
"]",
"=",
"true",
";",
"$",
"lists",
"[",
"$",
"fileName",
"]",
"=",
"require_once",
"$",
"pathName",
";",
"}",
"}",
"$",
"this",
"->",
"langList",
"=",
"$",
"langList",
";",
"$",
"this",
"->",
"list",
"=",
"$",
"this",
"->",
"arrayDot",
"(",
"$",
"lists",
")",
";",
"}"
] | Build list of translation and available language in specific folder
@return void | [
"Build",
"list",
"of",
"translation",
"and",
"available",
"language",
"in",
"specific",
"folder"
] | 58a402d23499ff81ce34d061185d7cc514982bfc | https://github.com/krisanalfa/bono-lang/blob/58a402d23499ff81ce34d061185d7cc514982bfc/src/Bono/Lang/Driver/FileDriver.php#L76-L96 |
12,140 | krisanalfa/bono-lang | src/Bono/Lang/Driver/FileDriver.php | FileDriver.getAppBasePath | protected function getAppBasePath()
{
$path = dirname($_SERVER['SCRIPT_FILENAME']);
return (is_link($path)) ? dirname(readlink($path)) : dirname($path);
} | php | protected function getAppBasePath()
{
$path = dirname($_SERVER['SCRIPT_FILENAME']);
return (is_link($path)) ? dirname(readlink($path)) : dirname($path);
} | [
"protected",
"function",
"getAppBasePath",
"(",
")",
"{",
"$",
"path",
"=",
"dirname",
"(",
"$",
"_SERVER",
"[",
"'SCRIPT_FILENAME'",
"]",
")",
";",
"return",
"(",
"is_link",
"(",
"$",
"path",
")",
")",
"?",
"dirname",
"(",
"readlink",
"(",
"$",
"path",
")",
")",
":",
"dirname",
"(",
"$",
"path",
")",
";",
"}"
] | Get absolute path of working application
@return string | [
"Get",
"absolute",
"path",
"of",
"working",
"application"
] | 58a402d23499ff81ce34d061185d7cc514982bfc | https://github.com/krisanalfa/bono-lang/blob/58a402d23499ff81ce34d061185d7cc514982bfc/src/Bono/Lang/Driver/FileDriver.php#L103-L108 |
12,141 | AnonymPHP/Anonym-Library | src/Anonym/Cron/BasicCron.php | BasicCron.event | public function event(Closure $event)
{
if (null !== $response = $event()) {
$this->resolveEventResponse($response);
}
return $this;
} | php | public function event(Closure $event)
{
if (null !== $response = $event()) {
$this->resolveEventResponse($response);
}
return $this;
} | [
"public",
"function",
"event",
"(",
"Closure",
"$",
"event",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"response",
"=",
"$",
"event",
"(",
")",
")",
"{",
"$",
"this",
"->",
"resolveEventResponse",
"(",
"$",
"response",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | add a event
@param Closure $event
@return $this | [
"add",
"a",
"event"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Cron/BasicCron.php#L88-L95 |
12,142 | AnonymPHP/Anonym-Library | src/Anonym/Cron/BasicCron.php | BasicCron.resolveEventResponse | private function resolveEventResponse($response)
{
if (is_string($response)) {
$response = new ExecTask($response);
}
if ($response instanceof TaskReposity && !$response instanceof ClosureTask) {
EventReposity::addBasic($response);
} else {
throw new CronInstanceException(
sprintf(
'Event Response must be an instance of %s and cant be an instance of %s',
TaskReposity::class,
ClosureTask::class
)
);
}
} | php | private function resolveEventResponse($response)
{
if (is_string($response)) {
$response = new ExecTask($response);
}
if ($response instanceof TaskReposity && !$response instanceof ClosureTask) {
EventReposity::addBasic($response);
} else {
throw new CronInstanceException(
sprintf(
'Event Response must be an instance of %s and cant be an instance of %s',
TaskReposity::class,
ClosureTask::class
)
);
}
} | [
"private",
"function",
"resolveEventResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"response",
")",
")",
"{",
"$",
"response",
"=",
"new",
"ExecTask",
"(",
"$",
"response",
")",
";",
"}",
"if",
"(",
"$",
"response",
"instanceof",
"TaskReposity",
"&&",
"!",
"$",
"response",
"instanceof",
"ClosureTask",
")",
"{",
"EventReposity",
"::",
"addBasic",
"(",
"$",
"response",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"CronInstanceException",
"(",
"sprintf",
"(",
"'Event Response must be an instance of %s and cant be an instance of %s'",
",",
"TaskReposity",
"::",
"class",
",",
"ClosureTask",
"::",
"class",
")",
")",
";",
"}",
"}"
] | resolve the response from add event method
@param mixed $response
@throws CronInstanceException | [
"resolve",
"the",
"response",
"from",
"add",
"event",
"method"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Cron/BasicCron.php#L103-L120 |
12,143 | AnonymPHP/Anonym-Library | src/Anonym/Cron/BasicCron.php | BasicCron.removeJob | public function removeJob($job = '')
{
if ($job instanceof TaskReposity) {
$job = $job->buildCommandWithExpression();
}
$refrector = new CronEntry();
$job = $refrector->parse($job);
$this->getManager()->removeJob($job);
return $this;
} | php | public function removeJob($job = '')
{
if ($job instanceof TaskReposity) {
$job = $job->buildCommandWithExpression();
}
$refrector = new CronEntry();
$job = $refrector->parse($job);
$this->getManager()->removeJob($job);
return $this;
} | [
"public",
"function",
"removeJob",
"(",
"$",
"job",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"job",
"instanceof",
"TaskReposity",
")",
"{",
"$",
"job",
"=",
"$",
"job",
"->",
"buildCommandWithExpression",
"(",
")",
";",
"}",
"$",
"refrector",
"=",
"new",
"CronEntry",
"(",
")",
";",
"$",
"job",
"=",
"$",
"refrector",
"->",
"parse",
"(",
"$",
"job",
")",
";",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"removeJob",
"(",
"$",
"job",
")",
";",
"return",
"$",
"this",
";",
"}"
] | remove a job
@param string $job
@return $this | [
"remove",
"a",
"job"
] | c967ad804f84e8fb204593a0959cda2fed5ae075 | https://github.com/AnonymPHP/Anonym-Library/blob/c967ad804f84e8fb204593a0959cda2fed5ae075/src/Anonym/Cron/BasicCron.php#L183-L196 |
12,144 | zepi/turbo-base | Zepi/Core/Utils/src/Helper/CliHelper.php | CliHelper.inputText | public function inputText($text, $defaultValue = '')
{
$defaultValueStr = '';
if ($defaultValue != '') {
$defaultValueStr = '[' . $defaultValue . '] ';
}
echo $text . ' ' . $defaultValueStr;
$handle = fopen('php://stdin', 'r');
$line = fgets($handle);
$preparedLine = strtolower(trim($line));
if ($preparedLine === '') {
$preparedLine = $defaultValue;
}
return $preparedLine;
} | php | public function inputText($text, $defaultValue = '')
{
$defaultValueStr = '';
if ($defaultValue != '') {
$defaultValueStr = '[' . $defaultValue . '] ';
}
echo $text . ' ' . $defaultValueStr;
$handle = fopen('php://stdin', 'r');
$line = fgets($handle);
$preparedLine = strtolower(trim($line));
if ($preparedLine === '') {
$preparedLine = $defaultValue;
}
return $preparedLine;
} | [
"public",
"function",
"inputText",
"(",
"$",
"text",
",",
"$",
"defaultValue",
"=",
"''",
")",
"{",
"$",
"defaultValueStr",
"=",
"''",
";",
"if",
"(",
"$",
"defaultValue",
"!=",
"''",
")",
"{",
"$",
"defaultValueStr",
"=",
"'['",
".",
"$",
"defaultValue",
".",
"'] '",
";",
"}",
"echo",
"$",
"text",
".",
"' '",
".",
"$",
"defaultValueStr",
";",
"$",
"handle",
"=",
"fopen",
"(",
"'php://stdin'",
",",
"'r'",
")",
";",
"$",
"line",
"=",
"fgets",
"(",
"$",
"handle",
")",
";",
"$",
"preparedLine",
"=",
"strtolower",
"(",
"trim",
"(",
"$",
"line",
")",
")",
";",
"if",
"(",
"$",
"preparedLine",
"===",
"''",
")",
"{",
"$",
"preparedLine",
"=",
"$",
"defaultValue",
";",
"}",
"return",
"$",
"preparedLine",
";",
"}"
] | Asks the cli user for input text.
@access public
@param string $text
@param string $defaultValue
@return string | [
"Asks",
"the",
"cli",
"user",
"for",
"input",
"text",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Core/Utils/src/Helper/CliHelper.php#L87-L105 |
12,145 | arvici/framework | src/Arvici/Heart/Tools/DebugBarHelper.php | DebugBarHelper.inject | public function inject(Response &$response)
{
$renderer = $this->debugBar->getJavascriptRenderer('/__debug__/');
if (stripos($response->headers->get('Content-Type'), 'text/html') === 0) {
$content = $response->getContent();
$content = self::injectHtml($content, $renderer->renderHead(), '</head>');
$content = self::injectHtml($content, $renderer->render(), '</body>');
$response->setContent($content);
}
} | php | public function inject(Response &$response)
{
$renderer = $this->debugBar->getJavascriptRenderer('/__debug__/');
if (stripos($response->headers->get('Content-Type'), 'text/html') === 0) {
$content = $response->getContent();
$content = self::injectHtml($content, $renderer->renderHead(), '</head>');
$content = self::injectHtml($content, $renderer->render(), '</body>');
$response->setContent($content);
}
} | [
"public",
"function",
"inject",
"(",
"Response",
"&",
"$",
"response",
")",
"{",
"$",
"renderer",
"=",
"$",
"this",
"->",
"debugBar",
"->",
"getJavascriptRenderer",
"(",
"'/__debug__/'",
")",
";",
"if",
"(",
"stripos",
"(",
"$",
"response",
"->",
"headers",
"->",
"get",
"(",
"'Content-Type'",
")",
",",
"'text/html'",
")",
"===",
"0",
")",
"{",
"$",
"content",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"$",
"content",
"=",
"self",
"::",
"injectHtml",
"(",
"$",
"content",
",",
"$",
"renderer",
"->",
"renderHead",
"(",
")",
",",
"'</head>'",
")",
";",
"$",
"content",
"=",
"self",
"::",
"injectHtml",
"(",
"$",
"content",
",",
"$",
"renderer",
"->",
"render",
"(",
")",
",",
"'</body>'",
")",
";",
"$",
"response",
"->",
"setContent",
"(",
"$",
"content",
")",
";",
"}",
"}"
] | Inject the debug bar.
@param Response $response | [
"Inject",
"the",
"debug",
"bar",
"."
] | 4d0933912fef8f9edc756ef1ace009e96d9fc4b1 | https://github.com/arvici/framework/blob/4d0933912fef8f9edc756ef1ace009e96d9fc4b1/src/Arvici/Heart/Tools/DebugBarHelper.php#L93-L103 |
12,146 | arvici/framework | src/Arvici/Heart/Tools/DebugBarHelper.php | DebugBarHelper.injectHtml | private static function injectHtml($html, $code, $before)
{
$pos = strripos($html, $before);
if ($pos === false) {
return $html.$code;
}
return substr($html, 0, $pos).$code.substr($html, $pos);
} | php | private static function injectHtml($html, $code, $before)
{
$pos = strripos($html, $before);
if ($pos === false) {
return $html.$code;
}
return substr($html, 0, $pos).$code.substr($html, $pos);
} | [
"private",
"static",
"function",
"injectHtml",
"(",
"$",
"html",
",",
"$",
"code",
",",
"$",
"before",
")",
"{",
"$",
"pos",
"=",
"strripos",
"(",
"$",
"html",
",",
"$",
"before",
")",
";",
"if",
"(",
"$",
"pos",
"===",
"false",
")",
"{",
"return",
"$",
"html",
".",
"$",
"code",
";",
"}",
"return",
"substr",
"(",
"$",
"html",
",",
"0",
",",
"$",
"pos",
")",
".",
"$",
"code",
".",
"substr",
"(",
"$",
"html",
",",
"$",
"pos",
")",
";",
"}"
] | Inject html code before a tag.
@param string $html
@param string $code
@param string $before
@return string | [
"Inject",
"html",
"code",
"before",
"a",
"tag",
"."
] | 4d0933912fef8f9edc756ef1ace009e96d9fc4b1 | https://github.com/arvici/framework/blob/4d0933912fef8f9edc756ef1ace009e96d9fc4b1/src/Arvici/Heart/Tools/DebugBarHelper.php#L141-L148 |
12,147 | jivoo/http | src/SapiServer.php | SapiServer.serve | public function serve(ResponseInterface $response, $cookies = [])
{
if (headers_sent($file, $line)) {
throw new HeadersSentException(
'Headers already sent in ' . $file . ' on line ' . $line
);
}
$this->triggerEvent('serve', new \Jivoo\Event($this, [
'response' => $response,
'cookies' => $cookies
]));
$this->serveStatus($response);
$this->serveCookies($cookies);
$this->serveHeaders($response);
$this->serveBody($response, $this->compression);
$this->triggerEvent('served', new \Jivoo\Event($this, [
'response' => $response,
'cookies' => $cookies
]));
} | php | public function serve(ResponseInterface $response, $cookies = [])
{
if (headers_sent($file, $line)) {
throw new HeadersSentException(
'Headers already sent in ' . $file . ' on line ' . $line
);
}
$this->triggerEvent('serve', new \Jivoo\Event($this, [
'response' => $response,
'cookies' => $cookies
]));
$this->serveStatus($response);
$this->serveCookies($cookies);
$this->serveHeaders($response);
$this->serveBody($response, $this->compression);
$this->triggerEvent('served', new \Jivoo\Event($this, [
'response' => $response,
'cookies' => $cookies
]));
} | [
"public",
"function",
"serve",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"cookies",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"headers_sent",
"(",
"$",
"file",
",",
"$",
"line",
")",
")",
"{",
"throw",
"new",
"HeadersSentException",
"(",
"'Headers already sent in '",
".",
"$",
"file",
".",
"' on line '",
".",
"$",
"line",
")",
";",
"}",
"$",
"this",
"->",
"triggerEvent",
"(",
"'serve'",
",",
"new",
"\\",
"Jivoo",
"\\",
"Event",
"(",
"$",
"this",
",",
"[",
"'response'",
"=>",
"$",
"response",
",",
"'cookies'",
"=>",
"$",
"cookies",
"]",
")",
")",
";",
"$",
"this",
"->",
"serveStatus",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"serveCookies",
"(",
"$",
"cookies",
")",
";",
"$",
"this",
"->",
"serveHeaders",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"serveBody",
"(",
"$",
"response",
",",
"$",
"this",
"->",
"compression",
")",
";",
"$",
"this",
"->",
"triggerEvent",
"(",
"'served'",
",",
"new",
"\\",
"Jivoo",
"\\",
"Event",
"(",
"$",
"this",
",",
"[",
"'response'",
"=>",
"$",
"response",
",",
"'cookies'",
"=>",
"$",
"cookies",
"]",
")",
")",
";",
"}"
] | Serve a response.
@param ResponseInterface $response The response.
@param Cookie\ResponseCookie[]|\Traversable $cookies
@throws HeadersSentException If the headers have already been sent. | [
"Serve",
"a",
"response",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L141-L160 |
12,148 | jivoo/http | src/SapiServer.php | SapiServer.serveStatus | protected function serveStatus(ResponseInterface $response)
{
$protocol = $response->getProtocolVersion();
$status = $response->getStatusCode();
$reason = $response->getReasonPhrase();
if ($reason != '') {
$reason = ' ' . $reason;
}
header('HTTP/' . $protocol . ' ' . $status . $reason);
} | php | protected function serveStatus(ResponseInterface $response)
{
$protocol = $response->getProtocolVersion();
$status = $response->getStatusCode();
$reason = $response->getReasonPhrase();
if ($reason != '') {
$reason = ' ' . $reason;
}
header('HTTP/' . $protocol . ' ' . $status . $reason);
} | [
"protected",
"function",
"serveStatus",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"protocol",
"=",
"$",
"response",
"->",
"getProtocolVersion",
"(",
")",
";",
"$",
"status",
"=",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
";",
"$",
"reason",
"=",
"$",
"response",
"->",
"getReasonPhrase",
"(",
")",
";",
"if",
"(",
"$",
"reason",
"!=",
"''",
")",
"{",
"$",
"reason",
"=",
"' '",
".",
"$",
"reason",
";",
"}",
"header",
"(",
"'HTTP/'",
".",
"$",
"protocol",
".",
"' '",
".",
"$",
"status",
".",
"$",
"reason",
")",
";",
"}"
] | Set the status line.
@param ResponseInterface $response The response. | [
"Set",
"the",
"status",
"line",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L167-L176 |
12,149 | jivoo/http | src/SapiServer.php | SapiServer.serveCookies | protected function serveCookies($cookies)
{
foreach ($cookies as $cookie) {
if ($cookie->hasChanged()) {
$expiration = $cookie->getExpiration();
if (isset($expiration)) {
$expiration = $expiration->getTimestamp();
} else {
$expiration = 0;
}
setcookie(
$cookie->getName(),
$cookie->get(),
$expiration,
$cookie->getPath(),
$cookie->getDomain(),
$cookie->isSecure(),
$cookie->isHttpOnly()
);
}
}
} | php | protected function serveCookies($cookies)
{
foreach ($cookies as $cookie) {
if ($cookie->hasChanged()) {
$expiration = $cookie->getExpiration();
if (isset($expiration)) {
$expiration = $expiration->getTimestamp();
} else {
$expiration = 0;
}
setcookie(
$cookie->getName(),
$cookie->get(),
$expiration,
$cookie->getPath(),
$cookie->getDomain(),
$cookie->isSecure(),
$cookie->isHttpOnly()
);
}
}
} | [
"protected",
"function",
"serveCookies",
"(",
"$",
"cookies",
")",
"{",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"cookie",
")",
"{",
"if",
"(",
"$",
"cookie",
"->",
"hasChanged",
"(",
")",
")",
"{",
"$",
"expiration",
"=",
"$",
"cookie",
"->",
"getExpiration",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"expiration",
")",
")",
"{",
"$",
"expiration",
"=",
"$",
"expiration",
"->",
"getTimestamp",
"(",
")",
";",
"}",
"else",
"{",
"$",
"expiration",
"=",
"0",
";",
"}",
"setcookie",
"(",
"$",
"cookie",
"->",
"getName",
"(",
")",
",",
"$",
"cookie",
"->",
"get",
"(",
")",
",",
"$",
"expiration",
",",
"$",
"cookie",
"->",
"getPath",
"(",
")",
",",
"$",
"cookie",
"->",
"getDomain",
"(",
")",
",",
"$",
"cookie",
"->",
"isSecure",
"(",
")",
",",
"$",
"cookie",
"->",
"isHttpOnly",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Set the cookies.
@param Cookie\ResponseCookie[]|\Traversable $cookies | [
"Set",
"the",
"cookies",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L183-L204 |
12,150 | jivoo/http | src/SapiServer.php | SapiServer.serveHeaders | protected function serveHeaders(ResponseInterface $response)
{
header_remove('X-Powered-By');
foreach ($response->getHeaders() as $header => $values) {
header($header . ': ' . array_shift($values), true);
foreach ($values as $value) {
header($header . ': ' . $value, false);
}
}
} | php | protected function serveHeaders(ResponseInterface $response)
{
header_remove('X-Powered-By');
foreach ($response->getHeaders() as $header => $values) {
header($header . ': ' . array_shift($values), true);
foreach ($values as $value) {
header($header . ': ' . $value, false);
}
}
} | [
"protected",
"function",
"serveHeaders",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"header_remove",
"(",
"'X-Powered-By'",
")",
";",
"foreach",
"(",
"$",
"response",
"->",
"getHeaders",
"(",
")",
"as",
"$",
"header",
"=>",
"$",
"values",
")",
"{",
"header",
"(",
"$",
"header",
".",
"': '",
".",
"array_shift",
"(",
"$",
"values",
")",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"header",
"(",
"$",
"header",
".",
"': '",
".",
"$",
"value",
",",
"false",
")",
";",
"}",
"}",
"}"
] | Set the headers.
@param ResponseInterface $response The response. | [
"Set",
"the",
"headers",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L211-L220 |
12,151 | jivoo/http | src/SapiServer.php | SapiServer.serveBody | protected function serveBody(ResponseInterface $response, $compression = null)
{
$body = $response->getBody();
$body->rewind();
$out = fopen('php://output', 'wb');
if ($compression == 'bzip2') {
fwrite($out, bzcompress($body->getContents()));
} elseif ($compression == 'gzip') {
fwrite($out, gzencode($body->getContents()));
} else {
while (! $body->eof()) {
fwrite($out, $body->read(8192));
}
}
fclose($out);
$body->close();
} | php | protected function serveBody(ResponseInterface $response, $compression = null)
{
$body = $response->getBody();
$body->rewind();
$out = fopen('php://output', 'wb');
if ($compression == 'bzip2') {
fwrite($out, bzcompress($body->getContents()));
} elseif ($compression == 'gzip') {
fwrite($out, gzencode($body->getContents()));
} else {
while (! $body->eof()) {
fwrite($out, $body->read(8192));
}
}
fclose($out);
$body->close();
} | [
"protected",
"function",
"serveBody",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"compression",
"=",
"null",
")",
"{",
"$",
"body",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"$",
"body",
"->",
"rewind",
"(",
")",
";",
"$",
"out",
"=",
"fopen",
"(",
"'php://output'",
",",
"'wb'",
")",
";",
"if",
"(",
"$",
"compression",
"==",
"'bzip2'",
")",
"{",
"fwrite",
"(",
"$",
"out",
",",
"bzcompress",
"(",
"$",
"body",
"->",
"getContents",
"(",
")",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"compression",
"==",
"'gzip'",
")",
"{",
"fwrite",
"(",
"$",
"out",
",",
"gzencode",
"(",
"$",
"body",
"->",
"getContents",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"while",
"(",
"!",
"$",
"body",
"->",
"eof",
"(",
")",
")",
"{",
"fwrite",
"(",
"$",
"out",
",",
"$",
"body",
"->",
"read",
"(",
"8192",
")",
")",
";",
"}",
"}",
"fclose",
"(",
"$",
"out",
")",
";",
"$",
"body",
"->",
"close",
"(",
")",
";",
"}"
] | Output the response body.
@param ResponseInterface $response The response.
@param string $compression Compression to use: 'bzip2' or 'gzip'. | [
"Output",
"the",
"response",
"body",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L228-L244 |
12,152 | jivoo/http | src/SapiServer.php | SapiServer.listen | public function listen()
{
$request = $this->request;
$response = new Response(Status::OK);
$first = $this->getNext($this->middleware);
$response = $first($request, $response);
$this->serve($response, $this->getCookies());
} | php | public function listen()
{
$request = $this->request;
$response = new Response(Status::OK);
$first = $this->getNext($this->middleware);
$response = $first($request, $response);
$this->serve($response, $this->getCookies());
} | [
"public",
"function",
"listen",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"request",
";",
"$",
"response",
"=",
"new",
"Response",
"(",
"Status",
"::",
"OK",
")",
";",
"$",
"first",
"=",
"$",
"this",
"->",
"getNext",
"(",
"$",
"this",
"->",
"middleware",
")",
";",
"$",
"response",
"=",
"$",
"first",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"$",
"this",
"->",
"serve",
"(",
"$",
"response",
",",
"$",
"this",
"->",
"getCookies",
"(",
")",
")",
";",
"}"
] | Start server, i.e. create a response for the current request using the
available middleware and request handler. | [
"Start",
"server",
"i",
".",
"e",
".",
"create",
"a",
"response",
"for",
"the",
"current",
"request",
"using",
"the",
"available",
"middleware",
"and",
"request",
"handler",
"."
] | 3c1d8dba66978bc91fc2b324dd941e5da3b253bc | https://github.com/jivoo/http/blob/3c1d8dba66978bc91fc2b324dd941e5da3b253bc/src/SapiServer.php#L266-L273 |
12,153 | zerospam/sdk-framework | src/Client/Middleware/RefreshToken/RefreshTokenMiddleware.php | RefreshTokenMiddleware.handleRefreshToken | public function handleRefreshToken(AccessToken $previousToken, int $tries): AccessToken
{
return $this->client->getConfiguration()->refreshToken($previousToken->getRefreshToken());
} | php | public function handleRefreshToken(AccessToken $previousToken, int $tries): AccessToken
{
return $this->client->getConfiguration()->refreshToken($previousToken->getRefreshToken());
} | [
"public",
"function",
"handleRefreshToken",
"(",
"AccessToken",
"$",
"previousToken",
",",
"int",
"$",
"tries",
")",
":",
"AccessToken",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"getConfiguration",
"(",
")",
"->",
"refreshToken",
"(",
"$",
"previousToken",
"->",
"getRefreshToken",
"(",
")",
")",
";",
"}"
] | Take care of refreshing the token
@param AccessToken $previousToken
@param int $tries
@return AccessToken | [
"Take",
"care",
"of",
"refreshing",
"the",
"token"
] | 6780b81584619cb177d5d5e14fd7e87a9d8e48fd | https://github.com/zerospam/sdk-framework/blob/6780b81584619cb177d5d5e14fd7e87a9d8e48fd/src/Client/Middleware/RefreshToken/RefreshTokenMiddleware.php#L46-L49 |
12,154 | indigophp-archive/fuel-core | lib/Fuel/Validation/RuleProvider/ModelProvider.php | ModelProvider.populateValidator | public static function populateValidator(Validator $validator)
{
if (static::$provider === null)
{
static::setProvider(new FromArray(true, 'validation'));
}
return static::$provider->populateValidator($validator);
} | php | public static function populateValidator(Validator $validator)
{
if (static::$provider === null)
{
static::setProvider(new FromArray(true, 'validation'));
}
return static::$provider->populateValidator($validator);
} | [
"public",
"static",
"function",
"populateValidator",
"(",
"Validator",
"$",
"validator",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"provider",
"===",
"null",
")",
"{",
"static",
"::",
"setProvider",
"(",
"new",
"FromArray",
"(",
"true",
",",
"'validation'",
")",
")",
";",
"}",
"return",
"static",
"::",
"$",
"provider",
"->",
"populateValidator",
"(",
"$",
"validator",
")",
";",
"}"
] | Populates the given validator with the needed rules
@param Validator $validator
@return Validator | [
"Populates",
"the",
"given",
"validator",
"with",
"the",
"needed",
"rules"
] | 275462154fb7937f8e1c2c541b31d8e7c5760e39 | https://github.com/indigophp-archive/fuel-core/blob/275462154fb7937f8e1c2c541b31d8e7c5760e39/lib/Fuel/Validation/RuleProvider/ModelProvider.php#L50-L58 |
12,155 | priskz/paylorm | src/Priskz/Paylorm/Data/MySQL/Eloquent/CrudRepository.php | CrudRepository.first | public function first(array $parameter = [])
{
// Merge any base/common query parameters with given parameters taking precedence.
$parameter = array_merge($this->parameter, $parameter);
// Begin building query.
$query = $this->model;
// Add filters to the query.
if(array_key_exists(self::FILTER_KEY, $parameter))
{
foreach($parameter[self::FILTER_KEY] as $field => $filter)
{
// Check if the value is an array, if not treat as a standard where equal clause.
if( ! is_array($filter))
{
$query = $query->where($field, '=', $filter);
}
else
{
// If filter array is an array, utilize expected key/values.
if(array_key_exists('or', $filter))
{
if($filter['or'])
{
$query = $query->orWhere($filter['field'], $filter['operator'], $filter['value']);
}
}
else
{
$query = $query->where($filter['field'], $filter['operator'], $filter['value']);
}
}
}
}
// Add order parameters to the query.
if(array_key_exists(self::ORDER_KEY, $parameter))
{
foreach($parameter[self::ORDER_KEY] as $field => $direction)
{
$query = $query->orderBy($field, $direction);
}
}
// Add relationship joins to query.
if(array_key_exists(self::EMBED_KEY, $parameter))
{
foreach($parameter[self::EMBED_KEY] as $relationship)
{
$this->eagerLoad($relationship);
}
}
// Run the query.
$result = $this->retrieve($query);
// Determine what to return based on count.
switch($result->count())
{
case 0:
return new Payload($result, 'not_found');
break;
default:
return new Payload($result->first(), 'found');
break;
}
} | php | public function first(array $parameter = [])
{
// Merge any base/common query parameters with given parameters taking precedence.
$parameter = array_merge($this->parameter, $parameter);
// Begin building query.
$query = $this->model;
// Add filters to the query.
if(array_key_exists(self::FILTER_KEY, $parameter))
{
foreach($parameter[self::FILTER_KEY] as $field => $filter)
{
// Check if the value is an array, if not treat as a standard where equal clause.
if( ! is_array($filter))
{
$query = $query->where($field, '=', $filter);
}
else
{
// If filter array is an array, utilize expected key/values.
if(array_key_exists('or', $filter))
{
if($filter['or'])
{
$query = $query->orWhere($filter['field'], $filter['operator'], $filter['value']);
}
}
else
{
$query = $query->where($filter['field'], $filter['operator'], $filter['value']);
}
}
}
}
// Add order parameters to the query.
if(array_key_exists(self::ORDER_KEY, $parameter))
{
foreach($parameter[self::ORDER_KEY] as $field => $direction)
{
$query = $query->orderBy($field, $direction);
}
}
// Add relationship joins to query.
if(array_key_exists(self::EMBED_KEY, $parameter))
{
foreach($parameter[self::EMBED_KEY] as $relationship)
{
$this->eagerLoad($relationship);
}
}
// Run the query.
$result = $this->retrieve($query);
// Determine what to return based on count.
switch($result->count())
{
case 0:
return new Payload($result, 'not_found');
break;
default:
return new Payload($result->first(), 'found');
break;
}
} | [
"public",
"function",
"first",
"(",
"array",
"$",
"parameter",
"=",
"[",
"]",
")",
"{",
"// Merge any base/common query parameters with given parameters taking precedence.",
"$",
"parameter",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"parameter",
",",
"$",
"parameter",
")",
";",
"// Begin building query.",
"$",
"query",
"=",
"$",
"this",
"->",
"model",
";",
"// Add filters to the query.",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"FILTER_KEY",
",",
"$",
"parameter",
")",
")",
"{",
"foreach",
"(",
"$",
"parameter",
"[",
"self",
"::",
"FILTER_KEY",
"]",
"as",
"$",
"field",
"=>",
"$",
"filter",
")",
"{",
"// Check if the value is an array, if not treat as a standard where equal clause.",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filter",
")",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"where",
"(",
"$",
"field",
",",
"'='",
",",
"$",
"filter",
")",
";",
"}",
"else",
"{",
"// If filter array is an array, utilize expected key/values.",
"if",
"(",
"array_key_exists",
"(",
"'or'",
",",
"$",
"filter",
")",
")",
"{",
"if",
"(",
"$",
"filter",
"[",
"'or'",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"orWhere",
"(",
"$",
"filter",
"[",
"'field'",
"]",
",",
"$",
"filter",
"[",
"'operator'",
"]",
",",
"$",
"filter",
"[",
"'value'",
"]",
")",
";",
"}",
"}",
"else",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"where",
"(",
"$",
"filter",
"[",
"'field'",
"]",
",",
"$",
"filter",
"[",
"'operator'",
"]",
",",
"$",
"filter",
"[",
"'value'",
"]",
")",
";",
"}",
"}",
"}",
"}",
"// Add order parameters to the query.",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"ORDER_KEY",
",",
"$",
"parameter",
")",
")",
"{",
"foreach",
"(",
"$",
"parameter",
"[",
"self",
"::",
"ORDER_KEY",
"]",
"as",
"$",
"field",
"=>",
"$",
"direction",
")",
"{",
"$",
"query",
"=",
"$",
"query",
"->",
"orderBy",
"(",
"$",
"field",
",",
"$",
"direction",
")",
";",
"}",
"}",
"// Add relationship joins to query.",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"EMBED_KEY",
",",
"$",
"parameter",
")",
")",
"{",
"foreach",
"(",
"$",
"parameter",
"[",
"self",
"::",
"EMBED_KEY",
"]",
"as",
"$",
"relationship",
")",
"{",
"$",
"this",
"->",
"eagerLoad",
"(",
"$",
"relationship",
")",
";",
"}",
"}",
"// Run the query.",
"$",
"result",
"=",
"$",
"this",
"->",
"retrieve",
"(",
"$",
"query",
")",
";",
"// Determine what to return based on count.",
"switch",
"(",
"$",
"result",
"->",
"count",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"new",
"Payload",
"(",
"$",
"result",
",",
"'not_found'",
")",
";",
"break",
";",
"default",
":",
"return",
"new",
"Payload",
"(",
"$",
"result",
"->",
"first",
"(",
")",
",",
"'found'",
")",
";",
"break",
";",
"}",
"}"
] | Get a single object based on given parameters.
@param array $parameter
@return Payload | [
"Get",
"a",
"single",
"object",
"based",
"on",
"given",
"parameters",
"."
] | ae59eb4d9382f0c6fd361cca8ae465a0da88bc93 | https://github.com/priskz/paylorm/blob/ae59eb4d9382f0c6fd361cca8ae465a0da88bc93/src/Priskz/Paylorm/Data/MySQL/Eloquent/CrudRepository.php#L182-L250 |
12,156 | priskz/paylorm | src/Priskz/Paylorm/Data/MySQL/Eloquent/CrudRepository.php | CrudRepository.retrieve | public function retrieve($selectQuery)
{
// Eager load configured relationships.
$selectQuery = $this->setEagerLoaded($selectQuery);
// Execute the query.
$retrieved = $selectQuery->get();
// Eager load configured relationships.
return $this->setLazyLoaded($retrieved);
} | php | public function retrieve($selectQuery)
{
// Eager load configured relationships.
$selectQuery = $this->setEagerLoaded($selectQuery);
// Execute the query.
$retrieved = $selectQuery->get();
// Eager load configured relationships.
return $this->setLazyLoaded($retrieved);
} | [
"public",
"function",
"retrieve",
"(",
"$",
"selectQuery",
")",
"{",
"// Eager load configured relationships.",
"$",
"selectQuery",
"=",
"$",
"this",
"->",
"setEagerLoaded",
"(",
"$",
"selectQuery",
")",
";",
"// Execute the query.",
"$",
"retrieved",
"=",
"$",
"selectQuery",
"->",
"get",
"(",
")",
";",
"// Eager load configured relationships.",
"return",
"$",
"this",
"->",
"setLazyLoaded",
"(",
"$",
"retrieved",
")",
";",
"}"
] | Retrieve the data.
@param query $selectQuery
@return Collection|Single of Domain\Model | [
"Retrieve",
"the",
"data",
"."
] | ae59eb4d9382f0c6fd361cca8ae465a0da88bc93 | https://github.com/priskz/paylorm/blob/ae59eb4d9382f0c6fd361cca8ae465a0da88bc93/src/Priskz/Paylorm/Data/MySQL/Eloquent/CrudRepository.php#L408-L418 |
12,157 | getmoxy/event | src/Event/Dispatcher.php | Dispatcher.dispatch | public function dispatch($data)
{
$event = new \Moxy\Event($this->_name, $data);
foreach($this->_listeners as $listener) {
$listener->call($event);
}
} | php | public function dispatch($data)
{
$event = new \Moxy\Event($this->_name, $data);
foreach($this->_listeners as $listener) {
$listener->call($event);
}
} | [
"public",
"function",
"dispatch",
"(",
"$",
"data",
")",
"{",
"$",
"event",
"=",
"new",
"\\",
"Moxy",
"\\",
"Event",
"(",
"$",
"this",
"->",
"_name",
",",
"$",
"data",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_listeners",
"as",
"$",
"listener",
")",
"{",
"$",
"listener",
"->",
"call",
"(",
"$",
"event",
")",
";",
"}",
"}"
] | Dispatch an Event
Iterates the list of Event Listeners
and calls each of them sequentially
@author Tom Morton
@param array $data An array of Data | [
"Dispatch",
"an",
"Event"
] | d12b8f15916007151249aa03e3c09f7863a2d29c | https://github.com/getmoxy/event/blob/d12b8f15916007151249aa03e3c09f7863a2d29c/src/Event/Dispatcher.php#L38-L47 |
12,158 | sebardo/ecommerce | EcommerceBundle/Controller/FeatureController.php | FeatureController.createAction | public function createAction(Request $request)
{
$entity = new Feature();
$form = $this->createForm(new FeatureType(), $entity);
$form->bind($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'feature.created');
return $this->redirect($this->generateUrl('ecommerce_feature_show', array('id' => $entity->getId())));
}
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | php | public function createAction(Request $request)
{
$entity = new Feature();
$form = $this->createForm(new FeatureType(), $entity);
$form->bind($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->get('session')->getFlashBag()->add('success', 'feature.created');
return $this->redirect($this->generateUrl('ecommerce_feature_show', array('id' => $entity->getId())));
}
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"entity",
"=",
"new",
"Feature",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"FeatureType",
"(",
")",
",",
"$",
"entity",
")",
";",
"$",
"form",
"->",
"bind",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"form",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"em",
"->",
"persist",
"(",
"$",
"entity",
")",
";",
"$",
"em",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
"->",
"getFlashBag",
"(",
")",
"->",
"add",
"(",
"'success'",
",",
"'feature.created'",
")",
";",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'ecommerce_feature_show'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"entity",
"->",
"getId",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"entity",
",",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Creates a new Feature entity.
@param Request $request The request
@return array|RedirectResponse
@Route("/")
@Method("POST")
@Template("EcommerceBundle:Feature:new.html.twig") | [
"Creates",
"a",
"new",
"Feature",
"entity",
"."
] | 3e17545e69993f10a1df17f9887810c7378fc7f9 | https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/FeatureController.php#L78-L98 |
12,159 | sebardo/ecommerce | EcommerceBundle/Controller/FeatureController.php | FeatureController.newAction | public function newAction()
{
$entity = new Feature();
if ($this->getRequest()->query->has('category')) {
$em = $this->getDoctrine()->getManager();
$category = $em->getRepository('EcommerceBundle:Category')->
find($this->getRequest()->query->get('category'));
$entity->setCategory($category);
}
$form = $this->createForm(new FeatureType(), $entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | php | public function newAction()
{
$entity = new Feature();
if ($this->getRequest()->query->has('category')) {
$em = $this->getDoctrine()->getManager();
$category = $em->getRepository('EcommerceBundle:Category')->
find($this->getRequest()->query->get('category'));
$entity->setCategory($category);
}
$form = $this->createForm(new FeatureType(), $entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
} | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"entity",
"=",
"new",
"Feature",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"query",
"->",
"has",
"(",
"'category'",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"category",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'EcommerceBundle:Category'",
")",
"->",
"find",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"query",
"->",
"get",
"(",
"'category'",
")",
")",
";",
"$",
"entity",
"->",
"setCategory",
"(",
"$",
"category",
")",
";",
"}",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"FeatureType",
"(",
")",
",",
"$",
"entity",
")",
";",
"return",
"array",
"(",
"'entity'",
"=>",
"$",
"entity",
",",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
",",
")",
";",
"}"
] | Displays a form to create a new Feature entity.
@return array
@Route("/new")
@Method("GET")
@Template() | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Feature",
"entity",
"."
] | 3e17545e69993f10a1df17f9887810c7378fc7f9 | https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/FeatureController.php#L109-L128 |
12,160 | sebardo/ecommerce | EcommerceBundle/Controller/FeatureController.php | FeatureController.sortAction | public function sortAction(Request $request, $categoryId)
{
$em = $this->getDoctrine()->getManager();
/** @var Category $category */
$category = $em->getRepository('EcommerceBundle:Category')->find($categoryId);
if (!$category) {
throw $this->createNotFoundException('Unable to find Category entity.');
}
if ($request->isXmlHttpRequest()) {
$this->get('admin_manager')->sort('EcommerceBundle:Feature', $request->get('values'));
return new Response(0, 200);
}
$features = $em->getRepository('EcommerceBundle:Feature')->findBy(
array('category' => $category),
array('order' => 'asc')
);
return array(
'features' => $features,
'category' => $category
);
} | php | public function sortAction(Request $request, $categoryId)
{
$em = $this->getDoctrine()->getManager();
/** @var Category $category */
$category = $em->getRepository('EcommerceBundle:Category')->find($categoryId);
if (!$category) {
throw $this->createNotFoundException('Unable to find Category entity.');
}
if ($request->isXmlHttpRequest()) {
$this->get('admin_manager')->sort('EcommerceBundle:Feature', $request->get('values'));
return new Response(0, 200);
}
$features = $em->getRepository('EcommerceBundle:Feature')->findBy(
array('category' => $category),
array('order' => 'asc')
);
return array(
'features' => $features,
'category' => $category
);
} | [
"public",
"function",
"sortAction",
"(",
"Request",
"$",
"request",
",",
"$",
"categoryId",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"/** @var Category $category */",
"$",
"category",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'EcommerceBundle:Category'",
")",
"->",
"find",
"(",
"$",
"categoryId",
")",
";",
"if",
"(",
"!",
"$",
"category",
")",
"{",
"throw",
"$",
"this",
"->",
"createNotFoundException",
"(",
"'Unable to find Category entity.'",
")",
";",
"}",
"if",
"(",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"$",
"this",
"->",
"get",
"(",
"'admin_manager'",
")",
"->",
"sort",
"(",
"'EcommerceBundle:Feature'",
",",
"$",
"request",
"->",
"get",
"(",
"'values'",
")",
")",
";",
"return",
"new",
"Response",
"(",
"0",
",",
"200",
")",
";",
"}",
"$",
"features",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'EcommerceBundle:Feature'",
")",
"->",
"findBy",
"(",
"array",
"(",
"'category'",
"=>",
"$",
"category",
")",
",",
"array",
"(",
"'order'",
"=>",
"'asc'",
")",
")",
";",
"return",
"array",
"(",
"'features'",
"=>",
"$",
"features",
",",
"'category'",
"=>",
"$",
"category",
")",
";",
"}"
] | Sorts a list of features.
@param Request $request
@param int $categoryId
@throws NotFoundHttpException
@return array|Response
@Route("/category/{categoryId}/sort")
@Method({"GET", "POST"})
@Template | [
"Sorts",
"a",
"list",
"of",
"features",
"."
] | 3e17545e69993f10a1df17f9887810c7378fc7f9 | https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/FeatureController.php#L286-L312 |
12,161 | sebardo/ecommerce | EcommerceBundle/Controller/FeatureController.php | FeatureController.toggleFiltrableAction | public function toggleFiltrableAction(Request $request, $id)
{
if (false === $request->isXmlHttpRequest()) {
throw $this->createNotFoundException();
}
$isFiltrable = $this->get('admin_manager')->toggleFiltrable('EcommerceBundle:Feature', $id);
return new Response(intval($isFiltrable), 200);
} | php | public function toggleFiltrableAction(Request $request, $id)
{
if (false === $request->isXmlHttpRequest()) {
throw $this->createNotFoundException();
}
$isFiltrable = $this->get('admin_manager')->toggleFiltrable('EcommerceBundle:Feature', $id);
return new Response(intval($isFiltrable), 200);
} | [
"public",
"function",
"toggleFiltrableAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"createNotFoundException",
"(",
")",
";",
"}",
"$",
"isFiltrable",
"=",
"$",
"this",
"->",
"get",
"(",
"'admin_manager'",
")",
"->",
"toggleFiltrable",
"(",
"'EcommerceBundle:Feature'",
",",
"$",
"id",
")",
";",
"return",
"new",
"Response",
"(",
"intval",
"(",
"$",
"isFiltrable",
")",
",",
"200",
")",
";",
"}"
] | Set a list of features as filtrable.
@param Request $request
@param int $id
@throws NotFoundHttpException
@return Response
@Route("/{id}/toggle-filtrable")
@Method("POST")
@Template | [
"Set",
"a",
"list",
"of",
"features",
"as",
"filtrable",
"."
] | 3e17545e69993f10a1df17f9887810c7378fc7f9 | https://github.com/sebardo/ecommerce/blob/3e17545e69993f10a1df17f9887810c7378fc7f9/EcommerceBundle/Controller/FeatureController.php#L327-L336 |
12,162 | jamesmoss/treasure-chest | src/TreasureChest/KeyMapper.php | KeyMapper.getNamespaceKey | protected function getNamespaceKey(array $namespaces, $key)
{
if(empty($namespaces)) {
return $key;
}
$component = '';
$parts = array();
foreach($namespaces as $namespace) {
$component.= $this->delimiter.$namespace;
$parts[] = $this->getVersionNumber(substr($component, 1));
}
// generate the full key which will be passed to the low level cache functions
$newKey = implode($this->delimiter, $parts).$this->delimiter;
$newKey.= substr($component, 1).$this->delimiter;
$newKey.= $key;
return $newKey;
} | php | protected function getNamespaceKey(array $namespaces, $key)
{
if(empty($namespaces)) {
return $key;
}
$component = '';
$parts = array();
foreach($namespaces as $namespace) {
$component.= $this->delimiter.$namespace;
$parts[] = $this->getVersionNumber(substr($component, 1));
}
// generate the full key which will be passed to the low level cache functions
$newKey = implode($this->delimiter, $parts).$this->delimiter;
$newKey.= substr($component, 1).$this->delimiter;
$newKey.= $key;
return $newKey;
} | [
"protected",
"function",
"getNamespaceKey",
"(",
"array",
"$",
"namespaces",
",",
"$",
"key",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"namespaces",
")",
")",
"{",
"return",
"$",
"key",
";",
"}",
"$",
"component",
"=",
"''",
";",
"$",
"parts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"namespaces",
"as",
"$",
"namespace",
")",
"{",
"$",
"component",
".=",
"$",
"this",
"->",
"delimiter",
".",
"$",
"namespace",
";",
"$",
"parts",
"[",
"]",
"=",
"$",
"this",
"->",
"getVersionNumber",
"(",
"substr",
"(",
"$",
"component",
",",
"1",
")",
")",
";",
"}",
"// generate the full key which will be passed to the low level cache functions",
"$",
"newKey",
"=",
"implode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"parts",
")",
".",
"$",
"this",
"->",
"delimiter",
";",
"$",
"newKey",
".=",
"substr",
"(",
"$",
"component",
",",
"1",
")",
".",
"$",
"this",
"->",
"delimiter",
";",
"$",
"newKey",
".=",
"$",
"key",
";",
"return",
"$",
"newKey",
";",
"}"
] | generates the final cache identifier for the provided namespace and key
@param $namespace
@param $key
@return string The final key name which gets passed to the store | [
"generates",
"the",
"final",
"cache",
"identifier",
"for",
"the",
"provided",
"namespace",
"and",
"key"
] | 2343b14f58ce7aa18d7ea2cfe3be02a4eec2ca52 | https://github.com/jamesmoss/treasure-chest/blob/2343b14f58ce7aa18d7ea2cfe3be02a4eec2ca52/src/TreasureChest/KeyMapper.php#L68-L87 |
12,163 | webriq/core | module/Tag/src/Grid/Tag/Model/Tag/Mapper.php | Mapper.findByName | public function findByName( $name )
{
$platform = $this->getDbAdapter()
->getPlatform();
return $this->findOne( array(
new Sql\Predicate\Expression(
'LOWER(' . $platform->quoteIdentifier( 'name' ) . ') = ?',
mb_strtolower( $name, 'UTF-8' )
),
) );
} | php | public function findByName( $name )
{
$platform = $this->getDbAdapter()
->getPlatform();
return $this->findOne( array(
new Sql\Predicate\Expression(
'LOWER(' . $platform->quoteIdentifier( 'name' ) . ') = ?',
mb_strtolower( $name, 'UTF-8' )
),
) );
} | [
"public",
"function",
"findByName",
"(",
"$",
"name",
")",
"{",
"$",
"platform",
"=",
"$",
"this",
"->",
"getDbAdapter",
"(",
")",
"->",
"getPlatform",
"(",
")",
";",
"return",
"$",
"this",
"->",
"findOne",
"(",
"array",
"(",
"new",
"Sql",
"\\",
"Predicate",
"\\",
"Expression",
"(",
"'LOWER('",
".",
"$",
"platform",
"->",
"quoteIdentifier",
"(",
"'name'",
")",
".",
"') = ?'",
",",
"mb_strtolower",
"(",
"$",
"name",
",",
"'UTF-8'",
")",
")",
",",
")",
")",
";",
"}"
] | Get tag by name
@param string $name
@return \Tag\Model\Tag\Structure|null | [
"Get",
"tag",
"by",
"name"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Tag/src/Grid/Tag/Model/Tag/Mapper.php#L103-L114 |
12,164 | webriq/core | module/Tag/src/Grid/Tag/Model/Tag/Mapper.php | Mapper.isNameExists | public function isNameExists( $name, $excludeId = null )
{
$platform = $this->getDbAdapter()
->getPlatform();
$nameEq = new Sql\Predicate\Expression(
'LOWER(' . $platform->quoteIdentifier( 'name' ) . ') = ?',
mb_strtolower( $name, 'UTF-8' )
);
return $this->isExists( empty( $excludeId ) ? array(
$nameEq,
) : array(
$nameEq,
new Sql\Predicate\Operator(
'id',
Sql\Predicate\Operator::OP_NE,
$excludeId
),
) );
} | php | public function isNameExists( $name, $excludeId = null )
{
$platform = $this->getDbAdapter()
->getPlatform();
$nameEq = new Sql\Predicate\Expression(
'LOWER(' . $platform->quoteIdentifier( 'name' ) . ') = ?',
mb_strtolower( $name, 'UTF-8' )
);
return $this->isExists( empty( $excludeId ) ? array(
$nameEq,
) : array(
$nameEq,
new Sql\Predicate\Operator(
'id',
Sql\Predicate\Operator::OP_NE,
$excludeId
),
) );
} | [
"public",
"function",
"isNameExists",
"(",
"$",
"name",
",",
"$",
"excludeId",
"=",
"null",
")",
"{",
"$",
"platform",
"=",
"$",
"this",
"->",
"getDbAdapter",
"(",
")",
"->",
"getPlatform",
"(",
")",
";",
"$",
"nameEq",
"=",
"new",
"Sql",
"\\",
"Predicate",
"\\",
"Expression",
"(",
"'LOWER('",
".",
"$",
"platform",
"->",
"quoteIdentifier",
"(",
"'name'",
")",
".",
"') = ?'",
",",
"mb_strtolower",
"(",
"$",
"name",
",",
"'UTF-8'",
")",
")",
";",
"return",
"$",
"this",
"->",
"isExists",
"(",
"empty",
"(",
"$",
"excludeId",
")",
"?",
"array",
"(",
"$",
"nameEq",
",",
")",
":",
"array",
"(",
"$",
"nameEq",
",",
"new",
"Sql",
"\\",
"Predicate",
"\\",
"Operator",
"(",
"'id'",
",",
"Sql",
"\\",
"Predicate",
"\\",
"Operator",
"::",
"OP_NE",
",",
"$",
"excludeId",
")",
",",
")",
")",
";",
"}"
] | Is name already exists
@param string $name
@param int|null $excludeId
@return bool | [
"Is",
"name",
"already",
"exists"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Tag/src/Grid/Tag/Model/Tag/Mapper.php#L188-L208 |
12,165 | okaufmann/google-movies-client | src/GoogleMoviesClient/HttpClient/HttpClient.php | HttpClient.send | private function send($path, $method, array $parameters = [], array $headers = [], $body = null)
{
$request = $this->createRequest($path, $method, $parameters, $headers, $body);
$event = new RequestEvent($request);
$this->eventDispatcher->dispatch(GoogleMoviesClientEvents::REQUEST, $event);
$this->lastResponse = $event->getResponse();
if ($this->lastResponse instanceof Response) {
return (string) $this->lastResponse->getBody();
}
return [];
} | php | private function send($path, $method, array $parameters = [], array $headers = [], $body = null)
{
$request = $this->createRequest($path, $method, $parameters, $headers, $body);
$event = new RequestEvent($request);
$this->eventDispatcher->dispatch(GoogleMoviesClientEvents::REQUEST, $event);
$this->lastResponse = $event->getResponse();
if ($this->lastResponse instanceof Response) {
return (string) $this->lastResponse->getBody();
}
return [];
} | [
"private",
"function",
"send",
"(",
"$",
"path",
",",
"$",
"method",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequest",
"(",
"$",
"path",
",",
"$",
"method",
",",
"$",
"parameters",
",",
"$",
"headers",
",",
"$",
"body",
")",
";",
"$",
"event",
"=",
"new",
"RequestEvent",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"GoogleMoviesClientEvents",
"::",
"REQUEST",
",",
"$",
"event",
")",
";",
"$",
"this",
"->",
"lastResponse",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"lastResponse",
"instanceof",
"Response",
")",
"{",
"return",
"(",
"string",
")",
"$",
"this",
"->",
"lastResponse",
"->",
"getBody",
"(",
")",
";",
"}",
"return",
"[",
"]",
";",
"}"
] | Create the request object and send it out to listening events.
@param $path
@param $method
@param array $parameters
@param array $headers
@param null $body
@return string | [
"Create",
"the",
"request",
"object",
"and",
"send",
"it",
"out",
"to",
"listening",
"events",
"."
] | 70ad4d3c640016cf24a0fd45ed8509029a6c02c6 | https://github.com/okaufmann/google-movies-client/blob/70ad4d3c640016cf24a0fd45ed8509029a6c02c6/src/GoogleMoviesClient/HttpClient/HttpClient.php#L212-L226 |
12,166 | okaufmann/google-movies-client | src/GoogleMoviesClient/HttpClient/HttpClient.php | HttpClient.registerDefaults | public function registerDefaults()
{
$requestSubscriber = new RequestSubscriber();
$this->addSubscriber($requestSubscriber);
$userAgentHeaderPlugin = new UserAgentHeaderPlugin();
$this->addSubscriber($userAgentHeaderPlugin);
return $this;
} | php | public function registerDefaults()
{
$requestSubscriber = new RequestSubscriber();
$this->addSubscriber($requestSubscriber);
$userAgentHeaderPlugin = new UserAgentHeaderPlugin();
$this->addSubscriber($userAgentHeaderPlugin);
return $this;
} | [
"public",
"function",
"registerDefaults",
"(",
")",
"{",
"$",
"requestSubscriber",
"=",
"new",
"RequestSubscriber",
"(",
")",
";",
"$",
"this",
"->",
"addSubscriber",
"(",
"$",
"requestSubscriber",
")",
";",
"$",
"userAgentHeaderPlugin",
"=",
"new",
"UserAgentHeaderPlugin",
"(",
")",
";",
"$",
"this",
"->",
"addSubscriber",
"(",
"$",
"userAgentHeaderPlugin",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Register the default plugins.
@return $this | [
"Register",
"the",
"default",
"plugins",
"."
] | 70ad4d3c640016cf24a0fd45ed8509029a6c02c6 | https://github.com/okaufmann/google-movies-client/blob/70ad4d3c640016cf24a0fd45ed8509029a6c02c6/src/GoogleMoviesClient/HttpClient/HttpClient.php#L308-L317 |
12,167 | okaufmann/google-movies-client | src/GoogleMoviesClient/HttpClient/HttpClient.php | HttpClient.setDefaultLogging | public function setDefaultLogging(array $parameters)
{
if (! class_exists('\Monolog\Logger')) {
//@codeCoverageIgnoreStart
throw new \RuntimeException(
'Could not find any logger set and the monolog logger library was not found
to provide a default, you have to set a custom logger on the client or
have you forgot adding monolog to your composer.json?'
);
//@codeCoverageIgnoreEnd
} else {
$logger = new Logger('google-movie-client');
$logger->pushHandler($parameters['handler']);
}
if ($this->getAdapter() instanceof GuzzleAdapter) {
$subscriber = new LogSubscriber($logger);
$this->getAdapter()->getClient()->getEmitter()->attach($subscriber);
}
return $this;
} | php | public function setDefaultLogging(array $parameters)
{
if (! class_exists('\Monolog\Logger')) {
//@codeCoverageIgnoreStart
throw new \RuntimeException(
'Could not find any logger set and the monolog logger library was not found
to provide a default, you have to set a custom logger on the client or
have you forgot adding monolog to your composer.json?'
);
//@codeCoverageIgnoreEnd
} else {
$logger = new Logger('google-movie-client');
$logger->pushHandler($parameters['handler']);
}
if ($this->getAdapter() instanceof GuzzleAdapter) {
$subscriber = new LogSubscriber($logger);
$this->getAdapter()->getClient()->getEmitter()->attach($subscriber);
}
return $this;
} | [
"public",
"function",
"setDefaultLogging",
"(",
"array",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'\\Monolog\\Logger'",
")",
")",
"{",
"//@codeCoverageIgnoreStart",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Could not find any logger set and the monolog logger library was not found\n to provide a default, you have to set a custom logger on the client or\n have you forgot adding monolog to your composer.json?'",
")",
";",
"//@codeCoverageIgnoreEnd",
"}",
"else",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'google-movie-client'",
")",
";",
"$",
"logger",
"->",
"pushHandler",
"(",
"$",
"parameters",
"[",
"'handler'",
"]",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getAdapter",
"(",
")",
"instanceof",
"GuzzleAdapter",
")",
"{",
"$",
"subscriber",
"=",
"new",
"LogSubscriber",
"(",
"$",
"logger",
")",
";",
"$",
"this",
"->",
"getAdapter",
"(",
")",
"->",
"getClient",
"(",
")",
"->",
"getEmitter",
"(",
")",
"->",
"attach",
"(",
"$",
"subscriber",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Enable logging.
@param array $parameters
@throws \RuntimeException
@return $this | [
"Enable",
"logging",
"."
] | 70ad4d3c640016cf24a0fd45ed8509029a6c02c6 | https://github.com/okaufmann/google-movies-client/blob/70ad4d3c640016cf24a0fd45ed8509029a6c02c6/src/GoogleMoviesClient/HttpClient/HttpClient.php#L400-L421 |
12,168 | wasabi-cms/cms | src/Model/Entity/Page.php | Page.getStatus | public function getStatus()
{
if (isset($this->_statuses[(int) $this->status])) {
return $this->_statuses[(int) $this->status];
}
throw new \Exception('Status "' . $this->status . '" not found for Page with id ' . $this->id . '.');
} | php | public function getStatus()
{
if (isset($this->_statuses[(int) $this->status])) {
return $this->_statuses[(int) $this->status];
}
throw new \Exception('Status "' . $this->status . '" not found for Page with id ' . $this->id . '.');
} | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_statuses",
"[",
"(",
"int",
")",
"$",
"this",
"->",
"status",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_statuses",
"[",
"(",
"int",
")",
"$",
"this",
"->",
"status",
"]",
";",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"'Status \"'",
".",
"$",
"this",
"->",
"status",
".",
"'\" not found for Page with id '",
".",
"$",
"this",
"->",
"id",
".",
"'.'",
")",
";",
"}"
] | Retrieve the current status of a page.
@return mixed
@throws \Exception | [
"Retrieve",
"the",
"current",
"status",
"of",
"a",
"page",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/Model/Entity/Page.php#L114-L120 |
12,169 | wasabi-cms/cms | src/Model/Entity/Page.php | Page.initializeContentAreas | public function initializeContentAreas()
{
$content = $this->_getContent();
foreach ($content as $contentAreaDefintion)
{
$contentArea = new ContentArea($contentAreaDefintion);
$this->_contentAreas[$contentArea->id] = $contentArea;
}
} | php | public function initializeContentAreas()
{
$content = $this->_getContent();
foreach ($content as $contentAreaDefintion)
{
$contentArea = new ContentArea($contentAreaDefintion);
$this->_contentAreas[$contentArea->id] = $contentArea;
}
} | [
"public",
"function",
"initializeContentAreas",
"(",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"_getContent",
"(",
")",
";",
"foreach",
"(",
"$",
"content",
"as",
"$",
"contentAreaDefintion",
")",
"{",
"$",
"contentArea",
"=",
"new",
"ContentArea",
"(",
"$",
"contentAreaDefintion",
")",
";",
"$",
"this",
"->",
"_contentAreas",
"[",
"$",
"contentArea",
"->",
"id",
"]",
"=",
"$",
"contentArea",
";",
"}",
"}"
] | Initialize the content areas of this page.
@return void | [
"Initialize",
"the",
"content",
"areas",
"of",
"this",
"page",
"."
] | 2787b6422ea1d719cf49951b3253fd0ac31d22ca | https://github.com/wasabi-cms/cms/blob/2787b6422ea1d719cf49951b3253fd0ac31d22ca/src/Model/Entity/Page.php#L127-L137 |
12,170 | JaredClemence/binn | src/core/BinnFactory.php | BinnFactory.determineSubTypeOfIndexedContainers | private function determineSubTypeOfIndexedContainers($data) {
list( $allNumeric, $inSequence ) = $this->detectContainerKeyFlags( $data );
if( $allNumeric == false ){
return "\xE2";
}else if( $inSequence ){
return "\xE0";
}else{
return "\xE1";
}
} | php | private function determineSubTypeOfIndexedContainers($data) {
list( $allNumeric, $inSequence ) = $this->detectContainerKeyFlags( $data );
if( $allNumeric == false ){
return "\xE2";
}else if( $inSequence ){
return "\xE0";
}else{
return "\xE1";
}
} | [
"private",
"function",
"determineSubTypeOfIndexedContainers",
"(",
"$",
"data",
")",
"{",
"list",
"(",
"$",
"allNumeric",
",",
"$",
"inSequence",
")",
"=",
"$",
"this",
"->",
"detectContainerKeyFlags",
"(",
"$",
"data",
")",
";",
"if",
"(",
"$",
"allNumeric",
"==",
"false",
")",
"{",
"return",
"\"\\xE2\"",
";",
"}",
"else",
"if",
"(",
"$",
"inSequence",
")",
"{",
"return",
"\"\\xE0\"",
";",
"}",
"else",
"{",
"return",
"\"\\xE1\"",
";",
"}",
"}"
] | We select the container subtype that uses the lowest number of bytes to get
the job done.
To do this, we determine:
1. Are ALL indexes numeric? If yes, then the object is a LIST or a MAP; if no, then the object is an OBJECT
2. Are ALL indexes in sequence starting at 0? If yes, then the object is a LIST. If no, the object is a MAP.
@param array|object $data
@return string | [
"We",
"select",
"the",
"container",
"subtype",
"that",
"uses",
"the",
"lowest",
"number",
"of",
"bytes",
"to",
"get",
"the",
"job",
"done",
"."
] | 838591e7a92c0f257c09a1df141d80737a20f7d9 | https://github.com/JaredClemence/binn/blob/838591e7a92c0f257c09a1df141d80737a20f7d9/src/core/BinnFactory.php#L138-L147 |
12,171 | JaredClemence/binn | src/core/BinnFactory.php | BinnFactory.detectContainerKeyFlags | private function detectContainerKeyFlags($data) {
$allNumeric = true;
$inSequence = true;
$expectedIndex = 0;
foreach( $data as $key=>$value ){
if( $key == $expectedIndex ){
$expectedIndex++;
}else{
$inSequence = false;
}
if( is_numeric($key) == false ){
$allNumeric = false;
}
}
return [ $allNumeric, $inSequence ];
} | php | private function detectContainerKeyFlags($data) {
$allNumeric = true;
$inSequence = true;
$expectedIndex = 0;
foreach( $data as $key=>$value ){
if( $key == $expectedIndex ){
$expectedIndex++;
}else{
$inSequence = false;
}
if( is_numeric($key) == false ){
$allNumeric = false;
}
}
return [ $allNumeric, $inSequence ];
} | [
"private",
"function",
"detectContainerKeyFlags",
"(",
"$",
"data",
")",
"{",
"$",
"allNumeric",
"=",
"true",
";",
"$",
"inSequence",
"=",
"true",
";",
"$",
"expectedIndex",
"=",
"0",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"key",
"==",
"$",
"expectedIndex",
")",
"{",
"$",
"expectedIndex",
"++",
";",
"}",
"else",
"{",
"$",
"inSequence",
"=",
"false",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
"==",
"false",
")",
"{",
"$",
"allNumeric",
"=",
"false",
";",
"}",
"}",
"return",
"[",
"$",
"allNumeric",
",",
"$",
"inSequence",
"]",
";",
"}"
] | Detect the status of keys to determine whether they are all numeric and in sequence from zero.
[ 0=>..., 1=>..., 2=>... ] === in sequence from zero
[ 1=>..., 15=>..., 19=>... ] === all numeric
[ "index1"=>..., "index2"=>... ] === neither numeric or in sequence
@param array|object $data
@return array | [
"Detect",
"the",
"status",
"of",
"keys",
"to",
"determine",
"whether",
"they",
"are",
"all",
"numeric",
"and",
"in",
"sequence",
"from",
"zero",
"."
] | 838591e7a92c0f257c09a1df141d80737a20f7d9 | https://github.com/JaredClemence/binn/blob/838591e7a92c0f257c09a1df141d80737a20f7d9/src/core/BinnFactory.php#L159-L174 |
12,172 | cobonto/module | src/Classes/Module.php | Module.checkOnDisk | public static function checkOnDisk()
{
$args = func_get_args();
if (count($args) == 2)
$module = $args[0] . DIRECTORY_SEPARATOR . $args[1];
elseif (count($args) == 1)
$module = $args[1];
else
throw new \Exception();
$module = str_replace('\\', DIRECTORY_SEPARATOR, $module);
return (bool)app('files')->exists(app_path('Modules') . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Module.php');
} | php | public static function checkOnDisk()
{
$args = func_get_args();
if (count($args) == 2)
$module = $args[0] . DIRECTORY_SEPARATOR . $args[1];
elseif (count($args) == 1)
$module = $args[1];
else
throw new \Exception();
$module = str_replace('\\', DIRECTORY_SEPARATOR, $module);
return (bool)app('files')->exists(app_path('Modules') . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Module.php');
} | [
"public",
"static",
"function",
"checkOnDisk",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"2",
")",
"$",
"module",
"=",
"$",
"args",
"[",
"0",
"]",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"args",
"[",
"1",
"]",
";",
"elseif",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"1",
")",
"$",
"module",
"=",
"$",
"args",
"[",
"1",
"]",
";",
"else",
"throw",
"new",
"\\",
"Exception",
"(",
")",
";",
"$",
"module",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"DIRECTORY_SEPARATOR",
",",
"$",
"module",
")",
";",
"return",
"(",
"bool",
")",
"app",
"(",
"'files'",
")",
"->",
"exists",
"(",
"app_path",
"(",
"'Modules'",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"module",
".",
"DIRECTORY_SEPARATOR",
".",
"'Module.php'",
")",
";",
"}"
] | check module is disk or not
@return bool | [
"check",
"module",
"is",
"disk",
"or",
"not"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L221-L232 |
12,173 | cobonto/module | src/Classes/Module.php | Module.isInstalled | public static function isInstalled($author, $name)
{
if (!self::checkOnDisk($author, $name))
return false;
return self::getFromDb($author, $name);
} | php | public static function isInstalled($author, $name)
{
if (!self::checkOnDisk($author, $name))
return false;
return self::getFromDb($author, $name);
} | [
"public",
"static",
"function",
"isInstalled",
"(",
"$",
"author",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"checkOnDisk",
"(",
"$",
"author",
",",
"$",
"name",
")",
")",
"return",
"false",
";",
"return",
"self",
"::",
"getFromDb",
"(",
"$",
"author",
",",
"$",
"name",
")",
";",
"}"
] | check module is installed
@param $author
@param $name
@return bool | [
"check",
"module",
"is",
"installed"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L254-L259 |
12,174 | cobonto/module | src/Classes/Module.php | Module.getInstance | public static function getInstance()
{
$args = func_get_args();
if (count($args) == 2)
{
$author = $args[0];
$name = $args[1];
}
elseif (count($args) == 1)
{
list($author, $name) = explode('\\', $args[0]);
}
else
throw new \Exception();
// check module is exist in host
if (!self::checkOnDisk($author, $name))
return null;
if (!isset(self::$instance[$author . '*' . $name]))
{
// get class namespace
$class = strval(\App::getNamespace() . 'Modules\\' . $author . '\\' . $name . '\\Module');
$object = new $class;
self::$instance[$author . '*' . $name] = $object;
// get data from database
}
return self::$instance[$author . '*' . $name];
} | php | public static function getInstance()
{
$args = func_get_args();
if (count($args) == 2)
{
$author = $args[0];
$name = $args[1];
}
elseif (count($args) == 1)
{
list($author, $name) = explode('\\', $args[0]);
}
else
throw new \Exception();
// check module is exist in host
if (!self::checkOnDisk($author, $name))
return null;
if (!isset(self::$instance[$author . '*' . $name]))
{
// get class namespace
$class = strval(\App::getNamespace() . 'Modules\\' . $author . '\\' . $name . '\\Module');
$object = new $class;
self::$instance[$author . '*' . $name] = $object;
// get data from database
}
return self::$instance[$author . '*' . $name];
} | [
"public",
"static",
"function",
"getInstance",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"2",
")",
"{",
"$",
"author",
"=",
"$",
"args",
"[",
"0",
"]",
";",
"$",
"name",
"=",
"$",
"args",
"[",
"1",
"]",
";",
"}",
"elseif",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"1",
")",
"{",
"list",
"(",
"$",
"author",
",",
"$",
"name",
")",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"args",
"[",
"0",
"]",
")",
";",
"}",
"else",
"throw",
"new",
"\\",
"Exception",
"(",
")",
";",
"// check module is exist in host",
"if",
"(",
"!",
"self",
"::",
"checkOnDisk",
"(",
"$",
"author",
",",
"$",
"name",
")",
")",
"return",
"null",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"instance",
"[",
"$",
"author",
".",
"'*'",
".",
"$",
"name",
"]",
")",
")",
"{",
"// get class namespace",
"$",
"class",
"=",
"strval",
"(",
"\\",
"App",
"::",
"getNamespace",
"(",
")",
".",
"'Modules\\\\'",
".",
"$",
"author",
".",
"'\\\\'",
".",
"$",
"name",
".",
"'\\\\Module'",
")",
";",
"$",
"object",
"=",
"new",
"$",
"class",
";",
"self",
"::",
"$",
"instance",
"[",
"$",
"author",
".",
"'*'",
".",
"$",
"name",
"]",
"=",
"$",
"object",
";",
"// get data from database",
"}",
"return",
"self",
"::",
"$",
"instance",
"[",
"$",
"author",
".",
"'*'",
".",
"$",
"name",
"]",
";",
"}"
] | get instance of module object
@param $author
@param $name
@return bool|Module | [
"get",
"instance",
"of",
"module",
"object"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L273-L302 |
12,175 | cobonto/module | src/Classes/Module.php | Module.getModulesFromDisk | public static function getModulesFromDisk()
{
// check Modules folder is created or not
if (!app('files')->exists(app_path('Modules')))
app('files')->makeDirectory(app_path('Modules'));
$authors = app('files')->directories(app_path('Modules'));
$results = [];
if ($authors && count($authors))
{
foreach ($authors as $author)
{
$authorName = basename($author);
$modules = app('files')->directories($author);
if ($modules && count($modules))
{
foreach ($modules as $module)
{
// check module yaml
$ymlPath = $module . '/module.yml';
if (app('files')->exists($ymlPath))
{
$detail = Yaml::parse(app('files')->get($ymlPath));
$results[$authorName][] = $detail;
}
}
}
}
}
return $results;
} | php | public static function getModulesFromDisk()
{
// check Modules folder is created or not
if (!app('files')->exists(app_path('Modules')))
app('files')->makeDirectory(app_path('Modules'));
$authors = app('files')->directories(app_path('Modules'));
$results = [];
if ($authors && count($authors))
{
foreach ($authors as $author)
{
$authorName = basename($author);
$modules = app('files')->directories($author);
if ($modules && count($modules))
{
foreach ($modules as $module)
{
// check module yaml
$ymlPath = $module . '/module.yml';
if (app('files')->exists($ymlPath))
{
$detail = Yaml::parse(app('files')->get($ymlPath));
$results[$authorName][] = $detail;
}
}
}
}
}
return $results;
} | [
"public",
"static",
"function",
"getModulesFromDisk",
"(",
")",
"{",
"// check Modules folder is created or not",
"if",
"(",
"!",
"app",
"(",
"'files'",
")",
"->",
"exists",
"(",
"app_path",
"(",
"'Modules'",
")",
")",
")",
"app",
"(",
"'files'",
")",
"->",
"makeDirectory",
"(",
"app_path",
"(",
"'Modules'",
")",
")",
";",
"$",
"authors",
"=",
"app",
"(",
"'files'",
")",
"->",
"directories",
"(",
"app_path",
"(",
"'Modules'",
")",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"authors",
"&&",
"count",
"(",
"$",
"authors",
")",
")",
"{",
"foreach",
"(",
"$",
"authors",
"as",
"$",
"author",
")",
"{",
"$",
"authorName",
"=",
"basename",
"(",
"$",
"author",
")",
";",
"$",
"modules",
"=",
"app",
"(",
"'files'",
")",
"->",
"directories",
"(",
"$",
"author",
")",
";",
"if",
"(",
"$",
"modules",
"&&",
"count",
"(",
"$",
"modules",
")",
")",
"{",
"foreach",
"(",
"$",
"modules",
"as",
"$",
"module",
")",
"{",
"// check module yaml",
"$",
"ymlPath",
"=",
"$",
"module",
".",
"'/module.yml'",
";",
"if",
"(",
"app",
"(",
"'files'",
")",
"->",
"exists",
"(",
"$",
"ymlPath",
")",
")",
"{",
"$",
"detail",
"=",
"Yaml",
"::",
"parse",
"(",
"app",
"(",
"'files'",
")",
"->",
"get",
"(",
"$",
"ymlPath",
")",
")",
";",
"$",
"results",
"[",
"$",
"authorName",
"]",
"[",
"]",
"=",
"$",
"detail",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"$",
"results",
";",
"}"
] | get from disk | [
"get",
"from",
"disk"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L323-L352 |
12,176 | cobonto/module | src/Classes/Module.php | Module.renderConfigure | protected function renderConfigure()
{
$this->fillValues();
$this->tpl_form = 'admin.helpers.form.form';
$this->generateForm();
// assign some vars
$this->assign->params([
'form_url' => route(config('app.admin_url') . '.modules.save', ['author' => strtolower(camel_case($this->author)), 'name' => strtolower(camel_case($this->name))]),
'route_list' => route(config('app.admin_url') . '.modules.index'),
]);
return view($this->tpl_form, $this->assign->getViewData());
} | php | protected function renderConfigure()
{
$this->fillValues();
$this->tpl_form = 'admin.helpers.form.form';
$this->generateForm();
// assign some vars
$this->assign->params([
'form_url' => route(config('app.admin_url') . '.modules.save', ['author' => strtolower(camel_case($this->author)), 'name' => strtolower(camel_case($this->name))]),
'route_list' => route(config('app.admin_url') . '.modules.index'),
]);
return view($this->tpl_form, $this->assign->getViewData());
} | [
"protected",
"function",
"renderConfigure",
"(",
")",
"{",
"$",
"this",
"->",
"fillValues",
"(",
")",
";",
"$",
"this",
"->",
"tpl_form",
"=",
"'admin.helpers.form.form'",
";",
"$",
"this",
"->",
"generateForm",
"(",
")",
";",
"// assign some vars",
"$",
"this",
"->",
"assign",
"->",
"params",
"(",
"[",
"'form_url'",
"=>",
"route",
"(",
"config",
"(",
"'app.admin_url'",
")",
".",
"'.modules.save'",
",",
"[",
"'author'",
"=>",
"strtolower",
"(",
"camel_case",
"(",
"$",
"this",
"->",
"author",
")",
")",
",",
"'name'",
"=>",
"strtolower",
"(",
"camel_case",
"(",
"$",
"this",
"->",
"name",
")",
")",
"]",
")",
",",
"'route_list'",
"=>",
"route",
"(",
"config",
"(",
"'app.admin_url'",
")",
".",
"'.modules.index'",
")",
",",
"]",
")",
";",
"return",
"view",
"(",
"$",
"this",
"->",
"tpl_form",
",",
"$",
"this",
"->",
"assign",
"->",
"getViewData",
"(",
")",
")",
";",
"}"
] | prepare and render configuration form | [
"prepare",
"and",
"render",
"configuration",
"form"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L365-L376 |
12,177 | cobonto/module | src/Classes/Module.php | Module.addCSS | public function addCSS($files)
{
if (!is_array($files))
$files = [$files];
foreach ($files as $key => $file)
{
$files[$key] = $this->mediaPath . 'css/' . $file;
}
$this->assign->addCSS($files, true);
} | php | public function addCSS($files)
{
if (!is_array($files))
$files = [$files];
foreach ($files as $key => $file)
{
$files[$key] = $this->mediaPath . 'css/' . $file;
}
$this->assign->addCSS($files, true);
} | [
"public",
"function",
"addCSS",
"(",
"$",
"files",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"files",
")",
")",
"$",
"files",
"=",
"[",
"$",
"files",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"key",
"=>",
"$",
"file",
")",
"{",
"$",
"files",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"mediaPath",
".",
"'css/'",
".",
"$",
"file",
";",
"}",
"$",
"this",
"->",
"assign",
"->",
"addCSS",
"(",
"$",
"files",
",",
"true",
")",
";",
"}"
] | add css file for module
@param $files | [
"add",
"css",
"file",
"for",
"module"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L480-L489 |
12,178 | cobonto/module | src/Classes/Module.php | Module.addPlugin | public function addPlugin($file)
{
$path = $this->mediaPath . 'plugins/';
$this->assign->addJS($path . $file . '/' . $file . '.min.js', true);
$this->assign->addCSS($path . $file . '/' . $file . '.css', true);
} | php | public function addPlugin($file)
{
$path = $this->mediaPath . 'plugins/';
$this->assign->addJS($path . $file . '/' . $file . '.min.js', true);
$this->assign->addCSS($path . $file . '/' . $file . '.css', true);
} | [
"public",
"function",
"addPlugin",
"(",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"mediaPath",
".",
"'plugins/'",
";",
"$",
"this",
"->",
"assign",
"->",
"addJS",
"(",
"$",
"path",
".",
"$",
"file",
".",
"'/'",
".",
"$",
"file",
".",
"'.min.js'",
",",
"true",
")",
";",
"$",
"this",
"->",
"assign",
"->",
"addCSS",
"(",
"$",
"path",
".",
"$",
"file",
".",
"'/'",
".",
"$",
"file",
".",
"'.css'",
",",
"true",
")",
";",
"}"
] | add plugin file for module
@param $files | [
"add",
"plugin",
"file",
"for",
"module"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L510-L515 |
12,179 | cobonto/module | src/Classes/Module.php | Module.getModulesByFile | public static function getModulesByFile($file = 'Module.php')
{
$modules = Module::getModules();
$source = app_path('Modules' . DIRECTORY_SEPARATOR . '{author}' . DIRECTORY_SEPARATOR . '{module}' . DIRECTORY_SEPARATOR . $file);
$files = [];
if ($modules && count($modules))
foreach ($modules as $author => $subModules)
{
foreach ($subModules as $module)
{
$data = ['{author}' => $module['author'], '{module}' => $module['name']];
$real_source = str_replace(array_keys($data), array_values($data), $source);
if (\File::exists($real_source))
{
$files[] = [
'author' => $author,
'module' => $module,
'name' => $author . DIRECTORY_SEPARATOR . $module['name'],
'installed' => isset($module['installed']),
];
}
}
}
return $files;
} | php | public static function getModulesByFile($file = 'Module.php')
{
$modules = Module::getModules();
$source = app_path('Modules' . DIRECTORY_SEPARATOR . '{author}' . DIRECTORY_SEPARATOR . '{module}' . DIRECTORY_SEPARATOR . $file);
$files = [];
if ($modules && count($modules))
foreach ($modules as $author => $subModules)
{
foreach ($subModules as $module)
{
$data = ['{author}' => $module['author'], '{module}' => $module['name']];
$real_source = str_replace(array_keys($data), array_values($data), $source);
if (\File::exists($real_source))
{
$files[] = [
'author' => $author,
'module' => $module,
'name' => $author . DIRECTORY_SEPARATOR . $module['name'],
'installed' => isset($module['installed']),
];
}
}
}
return $files;
} | [
"public",
"static",
"function",
"getModulesByFile",
"(",
"$",
"file",
"=",
"'Module.php'",
")",
"{",
"$",
"modules",
"=",
"Module",
"::",
"getModules",
"(",
")",
";",
"$",
"source",
"=",
"app_path",
"(",
"'Modules'",
".",
"DIRECTORY_SEPARATOR",
".",
"'{author}'",
".",
"DIRECTORY_SEPARATOR",
".",
"'{module}'",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"file",
")",
";",
"$",
"files",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"modules",
"&&",
"count",
"(",
"$",
"modules",
")",
")",
"foreach",
"(",
"$",
"modules",
"as",
"$",
"author",
"=>",
"$",
"subModules",
")",
"{",
"foreach",
"(",
"$",
"subModules",
"as",
"$",
"module",
")",
"{",
"$",
"data",
"=",
"[",
"'{author}'",
"=>",
"$",
"module",
"[",
"'author'",
"]",
",",
"'{module}'",
"=>",
"$",
"module",
"[",
"'name'",
"]",
"]",
";",
"$",
"real_source",
"=",
"str_replace",
"(",
"array_keys",
"(",
"$",
"data",
")",
",",
"array_values",
"(",
"$",
"data",
")",
",",
"$",
"source",
")",
";",
"if",
"(",
"\\",
"File",
"::",
"exists",
"(",
"$",
"real_source",
")",
")",
"{",
"$",
"files",
"[",
"]",
"=",
"[",
"'author'",
"=>",
"$",
"author",
",",
"'module'",
"=>",
"$",
"module",
",",
"'name'",
"=>",
"$",
"author",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"module",
"[",
"'name'",
"]",
",",
"'installed'",
"=>",
"isset",
"(",
"$",
"module",
"[",
"'installed'",
"]",
")",
",",
"]",
";",
"}",
"}",
"}",
"return",
"$",
"files",
";",
"}"
] | Get name of all modules that exists
@param string $file that must be exits
@return array | [
"Get",
"name",
"of",
"all",
"modules",
"that",
"exists"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L562-L586 |
12,180 | cobonto/module | src/Classes/Module.php | Module.updateVersion | public function updateVersion()
{
\DB::table('modules')->where([
['name', '=', $this->name],
['author', '=', $this->author],
])->update(['version' => $this->version]);
} | php | public function updateVersion()
{
\DB::table('modules')->where([
['name', '=', $this->name],
['author', '=', $this->author],
])->update(['version' => $this->version]);
} | [
"public",
"function",
"updateVersion",
"(",
")",
"{",
"\\",
"DB",
"::",
"table",
"(",
"'modules'",
")",
"->",
"where",
"(",
"[",
"[",
"'name'",
",",
"'='",
",",
"$",
"this",
"->",
"name",
"]",
",",
"[",
"'author'",
",",
"'='",
",",
"$",
"this",
"->",
"author",
"]",
",",
"]",
")",
"->",
"update",
"(",
"[",
"'version'",
"=>",
"$",
"this",
"->",
"version",
"]",
")",
";",
"}"
] | Update database version | [
"Update",
"database",
"version"
] | 0978b5305c3d6f13ef7e0e5297855bd09eee6b76 | https://github.com/cobonto/module/blob/0978b5305c3d6f13ef7e0e5297855bd09eee6b76/src/Classes/Module.php#L670-L677 |
12,181 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.persist | public function persist(AbstractEntity $entity)
{
/** @var InserterTrait $this */
if ($entity->isNew()) {
return $this->insert($entity);
}
/** @var UpdaterTrait $this */
return $this->update($entity);
} | php | public function persist(AbstractEntity $entity)
{
/** @var InserterTrait $this */
if ($entity->isNew()) {
return $this->insert($entity);
}
/** @var UpdaterTrait $this */
return $this->update($entity);
} | [
"public",
"function",
"persist",
"(",
"AbstractEntity",
"$",
"entity",
")",
"{",
"/** @var InserterTrait $this */",
"if",
"(",
"$",
"entity",
"->",
"isNew",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"insert",
"(",
"$",
"entity",
")",
";",
"}",
"/** @var UpdaterTrait $this */",
"return",
"$",
"this",
"->",
"update",
"(",
"$",
"entity",
")",
";",
"}"
] | Persist this entity, inserting it if new and otherwise updating it
@param AbstractEntity $entity
@return AbstractEntity | [
"Persist",
"this",
"entity",
"inserting",
"it",
"if",
"new",
"and",
"otherwise",
"updating",
"it"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L160-L169 |
12,182 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.getPrimaryKeyWheres | protected function getPrimaryKeyWheres(AbstractEntity $entity)
{
$wheres = [];
$arrayCopy = $entity->getArrayCopy();
foreach ($this->primaryKey as $keyColumn) {
$wheres[$keyColumn] = $arrayCopy[$keyColumn];
}
return $wheres;
} | php | protected function getPrimaryKeyWheres(AbstractEntity $entity)
{
$wheres = [];
$arrayCopy = $entity->getArrayCopy();
foreach ($this->primaryKey as $keyColumn) {
$wheres[$keyColumn] = $arrayCopy[$keyColumn];
}
return $wheres;
} | [
"protected",
"function",
"getPrimaryKeyWheres",
"(",
"AbstractEntity",
"$",
"entity",
")",
"{",
"$",
"wheres",
"=",
"[",
"]",
";",
"$",
"arrayCopy",
"=",
"$",
"entity",
"->",
"getArrayCopy",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"primaryKey",
"as",
"$",
"keyColumn",
")",
"{",
"$",
"wheres",
"[",
"$",
"keyColumn",
"]",
"=",
"$",
"arrayCopy",
"[",
"$",
"keyColumn",
"]",
";",
"}",
"return",
"$",
"wheres",
";",
"}"
] | Get a wheres array for finding the row that matches an entity
@return array | [
"Get",
"a",
"wheres",
"array",
"for",
"finding",
"the",
"row",
"that",
"matches",
"an",
"entity"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L198-L208 |
12,183 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.initialize | protected function initialize()
{
if ($this->initialized) {
return;
}
if (! is_object($this->prototype)) {
$this->prototype = new ArrayObject;
}
if (! $this->hydrator instanceof HydratorInterface) {
$this->hydrator = new ArraySerializable;
}
$this->initialized = true;
} | php | protected function initialize()
{
if ($this->initialized) {
return;
}
if (! is_object($this->prototype)) {
$this->prototype = new ArrayObject;
}
if (! $this->hydrator instanceof HydratorInterface) {
$this->hydrator = new ArraySerializable;
}
$this->initialized = true;
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"prototype",
")",
")",
"{",
"$",
"this",
"->",
"prototype",
"=",
"new",
"ArrayObject",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"hydrator",
"instanceof",
"HydratorInterface",
")",
"{",
"$",
"this",
"->",
"hydrator",
"=",
"new",
"ArraySerializable",
";",
"}",
"$",
"this",
"->",
"initialized",
"=",
"true",
";",
"}"
] | Set up the hydrator and prototype of this mapper if not yet set | [
"Set",
"up",
"the",
"hydrator",
"and",
"prototype",
"of",
"this",
"mapper",
"if",
"not",
"yet",
"set"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L213-L228 |
12,184 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.execute | protected function execute(PreparableSqlInterface $query)
{
$statement = $this->getSqlObject()->prepareStatementForSqlObject($query);
$resultSet = new HydratingResultSet($this->hydrator, $this->prototype);
return $resultSet->initialize($statement->execute());
} | php | protected function execute(PreparableSqlInterface $query)
{
$statement = $this->getSqlObject()->prepareStatementForSqlObject($query);
$resultSet = new HydratingResultSet($this->hydrator, $this->prototype);
return $resultSet->initialize($statement->execute());
} | [
"protected",
"function",
"execute",
"(",
"PreparableSqlInterface",
"$",
"query",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getSqlObject",
"(",
")",
"->",
"prepareStatementForSqlObject",
"(",
"$",
"query",
")",
";",
"$",
"resultSet",
"=",
"new",
"HydratingResultSet",
"(",
"$",
"this",
"->",
"hydrator",
",",
"$",
"this",
"->",
"prototype",
")",
";",
"return",
"$",
"resultSet",
"->",
"initialize",
"(",
"$",
"statement",
"->",
"execute",
"(",
")",
")",
";",
"}"
] | Execute a given query
@param PreparableSqlInterface $query Query to be executed
@return HydratingResultSet | [
"Execute",
"a",
"given",
"query"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L236-L242 |
12,185 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.executeAndGetResultsAsEntity | protected function executeAndGetResultsAsEntity(PreparableSqlInterface $query)
{
$data = $this->execute($query)->current();
if (! $data || count($data) === 0) {
return false;
}
return $data;
} | php | protected function executeAndGetResultsAsEntity(PreparableSqlInterface $query)
{
$data = $this->execute($query)->current();
if (! $data || count($data) === 0) {
return false;
}
return $data;
} | [
"protected",
"function",
"executeAndGetResultsAsEntity",
"(",
"PreparableSqlInterface",
"$",
"query",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"execute",
"(",
"$",
"query",
")",
"->",
"current",
"(",
")",
";",
"if",
"(",
"!",
"$",
"data",
"||",
"count",
"(",
"$",
"data",
")",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"data",
";",
"}"
] | Execute a given query and return the result as a single Entity object or
false if no results are returned from the query.
@param PreparableSqlInterface $query Query to be executed
@return AbstractEntity|bool | [
"Execute",
"a",
"given",
"query",
"and",
"return",
"the",
"result",
"as",
"a",
"single",
"Entity",
"object",
"or",
"false",
"if",
"no",
"results",
"are",
"returned",
"from",
"the",
"query",
"."
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L251-L260 |
12,186 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.executeAndGetResultsAsEntityIterator | protected function executeAndGetResultsAsEntityIterator(PreparableSqlInterface $query)
{
$entities = $this->execute($query)
->toEntityArray();
return new EntityIterator($entities);
} | php | protected function executeAndGetResultsAsEntityIterator(PreparableSqlInterface $query)
{
$entities = $this->execute($query)
->toEntityArray();
return new EntityIterator($entities);
} | [
"protected",
"function",
"executeAndGetResultsAsEntityIterator",
"(",
"PreparableSqlInterface",
"$",
"query",
")",
"{",
"$",
"entities",
"=",
"$",
"this",
"->",
"execute",
"(",
"$",
"query",
")",
"->",
"toEntityArray",
"(",
")",
";",
"return",
"new",
"EntityIterator",
"(",
"$",
"entities",
")",
";",
"}"
] | Execute a given query and return the result as an Entity Iterator object
@param PreparableSqlInterface $query Query to be executed
@return EntityIterator | [
"Execute",
"a",
"given",
"query",
"and",
"return",
"the",
"result",
"as",
"an",
"Entity",
"Iterator",
"object"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L268-L274 |
12,187 | synapsestudios/synapse-base | src/Synapse/Mapper/AbstractMapper.php | AbstractMapper.executeAndGetResultsAsArray | protected function executeAndGetResultsAsArray(PreparableSqlInterface $query)
{
$statement = $this->getSqlObject()->prepareStatementForSqlObject($query);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->toArray();
} | php | protected function executeAndGetResultsAsArray(PreparableSqlInterface $query)
{
$statement = $this->getSqlObject()->prepareStatementForSqlObject($query);
$resultSet = new ResultSet();
$resultSet->initialize($statement->execute());
return $resultSet->toArray();
} | [
"protected",
"function",
"executeAndGetResultsAsArray",
"(",
"PreparableSqlInterface",
"$",
"query",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"getSqlObject",
"(",
")",
"->",
"prepareStatementForSqlObject",
"(",
"$",
"query",
")",
";",
"$",
"resultSet",
"=",
"new",
"ResultSet",
"(",
")",
";",
"$",
"resultSet",
"->",
"initialize",
"(",
"$",
"statement",
"->",
"execute",
"(",
")",
")",
";",
"return",
"$",
"resultSet",
"->",
"toArray",
"(",
")",
";",
"}"
] | Execute the given query and return the result as an array of arrays
@param PreparableSqlInterface $query Query to be executed
@return array | [
"Execute",
"the",
"given",
"query",
"and",
"return",
"the",
"result",
"as",
"an",
"array",
"of",
"arrays"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/Mapper/AbstractMapper.php#L282-L290 |
12,188 | rbnvrw/crispus | app/Crispus/Filesystem.php | Filesystem.getFiles | public function getFiles($sDirectory, $sExt = '')
{
$aFiles = array();
if(!is_dir($sDirectory)){
return null;
}
foreach(new \DirectoryIterator($sDirectory) as $oFileInfo){
if($oFileInfo->isFile()){
if(empty($sExt) || $sExt == $oFileInfo->getExtension()){
$aFiles[] = $oFileInfo->getPathname();
}
}
}
return $aFiles;
} | php | public function getFiles($sDirectory, $sExt = '')
{
$aFiles = array();
if(!is_dir($sDirectory)){
return null;
}
foreach(new \DirectoryIterator($sDirectory) as $oFileInfo){
if($oFileInfo->isFile()){
if(empty($sExt) || $sExt == $oFileInfo->getExtension()){
$aFiles[] = $oFileInfo->getPathname();
}
}
}
return $aFiles;
} | [
"public",
"function",
"getFiles",
"(",
"$",
"sDirectory",
",",
"$",
"sExt",
"=",
"''",
")",
"{",
"$",
"aFiles",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"sDirectory",
")",
")",
"{",
"return",
"null",
";",
"}",
"foreach",
"(",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
"sDirectory",
")",
"as",
"$",
"oFileInfo",
")",
"{",
"if",
"(",
"$",
"oFileInfo",
"->",
"isFile",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sExt",
")",
"||",
"$",
"sExt",
"==",
"$",
"oFileInfo",
"->",
"getExtension",
"(",
")",
")",
"{",
"$",
"aFiles",
"[",
"]",
"=",
"$",
"oFileInfo",
"->",
"getPathname",
"(",
")",
";",
"}",
"}",
"}",
"return",
"$",
"aFiles",
";",
"}"
] | Helper function to get all files in a directory
@param string $sDirectory start directory
@param string $sExt optional limit to file extensions
@return array the matched files | [
"Helper",
"function",
"to",
"get",
"all",
"files",
"in",
"a",
"directory"
] | 46a5f71c92b31de56c16540ef5c50a363106f1ff | https://github.com/rbnvrw/crispus/blob/46a5f71c92b31de56c16540ef5c50a363106f1ff/app/Crispus/Filesystem.php#L21-L38 |
12,189 | gintonicweb/websockets | src/Websocket/JwtAuthenticationProvider.php | JwtAuthenticationProvider.processAuthenticate | public function processAuthenticate($token, $extra = null)
{
try {
$token = JWT::decode($token, Security::salt(), Configure::read('Websockets.allowedAlgs'));
} catch (Exception $e) {
if (Configure::read('debug')) {
throw $e;
}
return ["FAILURE"];
}
if ($token->id == 'server') {
return ["SUCCESS", ["authid" => $token->id]];
}
$fields = Configure::read('Websockets.fields');
$table = TableRegistry::get(Configure::read('Websockets.userModel'));
$conditions = [$table->aliasField($fields['id']) => $token->id];
if (!empty(Configure::read('Websockets.scope'))) {
$conditions = array_merge($conditions, Configure::read('Websockets.scope'));
}
$result = $table->find('all')
->where($conditions)
->first();
if (empty($result)) {
return ["FAILURE"];
}
return ["SUCCESS", ["authid" => $result->id]];
} | php | public function processAuthenticate($token, $extra = null)
{
try {
$token = JWT::decode($token, Security::salt(), Configure::read('Websockets.allowedAlgs'));
} catch (Exception $e) {
if (Configure::read('debug')) {
throw $e;
}
return ["FAILURE"];
}
if ($token->id == 'server') {
return ["SUCCESS", ["authid" => $token->id]];
}
$fields = Configure::read('Websockets.fields');
$table = TableRegistry::get(Configure::read('Websockets.userModel'));
$conditions = [$table->aliasField($fields['id']) => $token->id];
if (!empty(Configure::read('Websockets.scope'))) {
$conditions = array_merge($conditions, Configure::read('Websockets.scope'));
}
$result = $table->find('all')
->where($conditions)
->first();
if (empty($result)) {
return ["FAILURE"];
}
return ["SUCCESS", ["authid" => $result->id]];
} | [
"public",
"function",
"processAuthenticate",
"(",
"$",
"token",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"token",
"=",
"JWT",
"::",
"decode",
"(",
"$",
"token",
",",
"Security",
"::",
"salt",
"(",
")",
",",
"Configure",
"::",
"read",
"(",
"'Websockets.allowedAlgs'",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"Configure",
"::",
"read",
"(",
"'debug'",
")",
")",
"{",
"throw",
"$",
"e",
";",
"}",
"return",
"[",
"\"FAILURE\"",
"]",
";",
"}",
"if",
"(",
"$",
"token",
"->",
"id",
"==",
"'server'",
")",
"{",
"return",
"[",
"\"SUCCESS\"",
",",
"[",
"\"authid\"",
"=>",
"$",
"token",
"->",
"id",
"]",
"]",
";",
"}",
"$",
"fields",
"=",
"Configure",
"::",
"read",
"(",
"'Websockets.fields'",
")",
";",
"$",
"table",
"=",
"TableRegistry",
"::",
"get",
"(",
"Configure",
"::",
"read",
"(",
"'Websockets.userModel'",
")",
")",
";",
"$",
"conditions",
"=",
"[",
"$",
"table",
"->",
"aliasField",
"(",
"$",
"fields",
"[",
"'id'",
"]",
")",
"=>",
"$",
"token",
"->",
"id",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"Configure",
"::",
"read",
"(",
"'Websockets.scope'",
")",
")",
")",
"{",
"$",
"conditions",
"=",
"array_merge",
"(",
"$",
"conditions",
",",
"Configure",
"::",
"read",
"(",
"'Websockets.scope'",
")",
")",
";",
"}",
"$",
"result",
"=",
"$",
"table",
"->",
"find",
"(",
"'all'",
")",
"->",
"where",
"(",
"$",
"conditions",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"result",
")",
")",
"{",
"return",
"[",
"\"FAILURE\"",
"]",
";",
"}",
"return",
"[",
"\"SUCCESS\"",
",",
"[",
"\"authid\"",
"=>",
"$",
"result",
"->",
"id",
"]",
"]",
";",
"}"
] | Authenticate users based on their JWT. This is inspired by
the method _findUser in admads JWT plugin
@see https://github.com/ADmad/cakephp-jwt-auth/blob/master/src/Auth/JwtAuthenticate.php
@param string $token The token identifier.
@param mixed $extra Unused
@return array | [
"Authenticate",
"users",
"based",
"on",
"their",
"JWT",
".",
"This",
"is",
"inspired",
"by",
"the",
"method",
"_findUser",
"in",
"admads",
"JWT",
"plugin"
] | bc83550cce73a2fa33265f318f1f081685bf97f6 | https://github.com/gintonicweb/websockets/blob/bc83550cce73a2fa33265f318f1f081685bf97f6/src/Websocket/JwtAuthenticationProvider.php#L32-L62 |
12,190 | chemel/addic7ed-cli | src/Database/Addic7edDatabase.php | Addic7edDatabase.getShowId | public function getShowId($term)
{
$lowerTerm = strtolower($term);
if (isset($this->searches[$lowerTerm])) {
return $this->searches[$lowerTerm];
}
$searchData = $this->scrapper->search($term);
if (!isset($searchData->showId)) {
return;
}
$showId = $searchData->showId;
return $this->searches[$lowerTerm] = $showId;
} | php | public function getShowId($term)
{
$lowerTerm = strtolower($term);
if (isset($this->searches[$lowerTerm])) {
return $this->searches[$lowerTerm];
}
$searchData = $this->scrapper->search($term);
if (!isset($searchData->showId)) {
return;
}
$showId = $searchData->showId;
return $this->searches[$lowerTerm] = $showId;
} | [
"public",
"function",
"getShowId",
"(",
"$",
"term",
")",
"{",
"$",
"lowerTerm",
"=",
"strtolower",
"(",
"$",
"term",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"searches",
"[",
"$",
"lowerTerm",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"searches",
"[",
"$",
"lowerTerm",
"]",
";",
"}",
"$",
"searchData",
"=",
"$",
"this",
"->",
"scrapper",
"->",
"search",
"(",
"$",
"term",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"searchData",
"->",
"showId",
")",
")",
"{",
"return",
";",
"}",
"$",
"showId",
"=",
"$",
"searchData",
"->",
"showId",
";",
"return",
"$",
"this",
"->",
"searches",
"[",
"$",
"lowerTerm",
"]",
"=",
"$",
"showId",
";",
"}"
] | Get show id
@param string term
@return int showId | [
"Get",
"show",
"id"
] | e10ff6f4a3a37151b9141f15c231ba480aa1c78c | https://github.com/chemel/addic7ed-cli/blob/e10ff6f4a3a37151b9141f15c231ba480aa1c78c/src/Database/Addic7edDatabase.php#L31-L48 |
12,191 | chemel/addic7ed-cli | src/Database/Addic7edDatabase.php | Addic7edDatabase.getShowData | public function getShowData($showId, $season=1)
{
if (isset($this->shows[$showId][$season])) {
return $this->shows[$showId][$season];
}
$showData = $this->scrapper->show($showId, $season);
return $this->shows[$showId][$season] = $showData;
} | php | public function getShowData($showId, $season=1)
{
if (isset($this->shows[$showId][$season])) {
return $this->shows[$showId][$season];
}
$showData = $this->scrapper->show($showId, $season);
return $this->shows[$showId][$season] = $showData;
} | [
"public",
"function",
"getShowData",
"(",
"$",
"showId",
",",
"$",
"season",
"=",
"1",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"shows",
"[",
"$",
"showId",
"]",
"[",
"$",
"season",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"shows",
"[",
"$",
"showId",
"]",
"[",
"$",
"season",
"]",
";",
"}",
"$",
"showData",
"=",
"$",
"this",
"->",
"scrapper",
"->",
"show",
"(",
"$",
"showId",
",",
"$",
"season",
")",
";",
"return",
"$",
"this",
"->",
"shows",
"[",
"$",
"showId",
"]",
"[",
"$",
"season",
"]",
"=",
"$",
"showData",
";",
"}"
] | Get show data
@param int showId
@return array showData | [
"Get",
"show",
"data"
] | e10ff6f4a3a37151b9141f15c231ba480aa1c78c | https://github.com/chemel/addic7ed-cli/blob/e10ff6f4a3a37151b9141f15c231ba480aa1c78c/src/Database/Addic7edDatabase.php#L57-L66 |
12,192 | AlexHowansky/ork-base | src/Image/Inline.php | Inline.encode | public function encode()
{
if (empty($this->image) === true) {
throw new \RuntimeException('No source image has been specified.');
}
$str = '<img src="data:' . $this->mimeType . ';base64,' . base64_encode($this->image) . '"';
if (empty($this->extraHtml) === false) {
$str .= ' ' . trim($this->extraHtml);
}
$str .= ' />';
return $str;
} | php | public function encode()
{
if (empty($this->image) === true) {
throw new \RuntimeException('No source image has been specified.');
}
$str = '<img src="data:' . $this->mimeType . ';base64,' . base64_encode($this->image) . '"';
if (empty($this->extraHtml) === false) {
$str .= ' ' . trim($this->extraHtml);
}
$str .= ' />';
return $str;
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"image",
")",
"===",
"true",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'No source image has been specified.'",
")",
";",
"}",
"$",
"str",
"=",
"'<img src=\"data:'",
".",
"$",
"this",
"->",
"mimeType",
".",
"';base64,'",
".",
"base64_encode",
"(",
"$",
"this",
"->",
"image",
")",
".",
"'\"'",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"extraHtml",
")",
"===",
"false",
")",
"{",
"$",
"str",
".=",
"' '",
".",
"trim",
"(",
"$",
"this",
"->",
"extraHtml",
")",
";",
"}",
"$",
"str",
".=",
"' />'",
";",
"return",
"$",
"str",
";",
"}"
] | Encode the current image as an inline IMG tag.
@return string The image encoded as an inline IMG tag. | [
"Encode",
"the",
"current",
"image",
"as",
"an",
"inline",
"IMG",
"tag",
"."
] | 5f4ab14e63bbc8b17898639fd1fff86ee6659bb0 | https://github.com/AlexHowansky/ork-base/blob/5f4ab14e63bbc8b17898639fd1fff86ee6659bb0/src/Image/Inline.php#L60-L71 |
12,193 | AlexHowansky/ork-base | src/Image/Inline.php | Inline.setImageFromFile | public function setImageFromFile($file)
{
if (preg_match('/\.([^\.]+)$/', $file, $match) === 1) {
$this->setMimeType('image/' . $match[1]);
}
return $this->setImageFromBlob(file_get_contents($file));
} | php | public function setImageFromFile($file)
{
if (preg_match('/\.([^\.]+)$/', $file, $match) === 1) {
$this->setMimeType('image/' . $match[1]);
}
return $this->setImageFromBlob(file_get_contents($file));
} | [
"public",
"function",
"setImageFromFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/\\.([^\\.]+)$/'",
",",
"$",
"file",
",",
"$",
"match",
")",
"===",
"1",
")",
"{",
"$",
"this",
"->",
"setMimeType",
"(",
"'image/'",
".",
"$",
"match",
"[",
"1",
"]",
")",
";",
"}",
"return",
"$",
"this",
"->",
"setImageFromBlob",
"(",
"file_get_contents",
"(",
"$",
"file",
")",
")",
";",
"}"
] | Set the image source from a file.
@param string $file The image file.
@return \Ork\Image\Inline Allow method chaining. | [
"Set",
"the",
"image",
"source",
"from",
"a",
"file",
"."
] | 5f4ab14e63bbc8b17898639fd1fff86ee6659bb0 | https://github.com/AlexHowansky/ork-base/blob/5f4ab14e63bbc8b17898639fd1fff86ee6659bb0/src/Image/Inline.php#L136-L142 |
12,194 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader.Attach | public static function Attach($ExtensionType) {
switch ($ExtensionType) {
case self::CONTEXT_APPLICATION:
if (Gdn::ApplicationManager() instanceof Gdn_ApplicationManager) {
$EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
foreach ($EnabledApplications as $EnabledApplication) {
self::AttachApplication($EnabledApplication);
}
}
break;
case self::CONTEXT_PLUGIN:
if (Gdn::PluginManager() instanceof Gdn_PluginManager) {
foreach (Gdn::PluginManager()->SearchPaths() as $SearchPath => $SearchPathName) {
if ($SearchPathName === TRUE || $SearchPathName == 1)
$SearchPathName = md5($SearchPath);
// If we have already loaded the plugin manager, use its internal folder list
if (Gdn::PluginManager()->Started()) {
$Folders = Gdn::PluginManager()->EnabledPluginFolders($SearchPath);
foreach ($Folders as $PluginFolder) {
$FullPluginPath = CombinePaths(array($SearchPath, $PluginFolder));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN, $FullPluginPath, array(
'SearchSubfolders' => TRUE,
'Extension' => $SearchPathName,
'Structure' => Gdn_Autoloader_Map::STRUCTURE_SPLIT,
'SplitTopic' => strtolower($PluginFolder),
'PreWarm' => TRUE
));
}
$PluginMap = self::GetMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN);
if ($PluginMap && !$PluginMap->MapIsOnDisk())
Gdn::PluginManager()->ForceAutoloaderIndex();
}
}
}
break;
case self::CONTEXT_THEME:
break;
}
} | php | public static function Attach($ExtensionType) {
switch ($ExtensionType) {
case self::CONTEXT_APPLICATION:
if (Gdn::ApplicationManager() instanceof Gdn_ApplicationManager) {
$EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
foreach ($EnabledApplications as $EnabledApplication) {
self::AttachApplication($EnabledApplication);
}
}
break;
case self::CONTEXT_PLUGIN:
if (Gdn::PluginManager() instanceof Gdn_PluginManager) {
foreach (Gdn::PluginManager()->SearchPaths() as $SearchPath => $SearchPathName) {
if ($SearchPathName === TRUE || $SearchPathName == 1)
$SearchPathName = md5($SearchPath);
// If we have already loaded the plugin manager, use its internal folder list
if (Gdn::PluginManager()->Started()) {
$Folders = Gdn::PluginManager()->EnabledPluginFolders($SearchPath);
foreach ($Folders as $PluginFolder) {
$FullPluginPath = CombinePaths(array($SearchPath, $PluginFolder));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN, $FullPluginPath, array(
'SearchSubfolders' => TRUE,
'Extension' => $SearchPathName,
'Structure' => Gdn_Autoloader_Map::STRUCTURE_SPLIT,
'SplitTopic' => strtolower($PluginFolder),
'PreWarm' => TRUE
));
}
$PluginMap = self::GetMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN);
if ($PluginMap && !$PluginMap->MapIsOnDisk())
Gdn::PluginManager()->ForceAutoloaderIndex();
}
}
}
break;
case self::CONTEXT_THEME:
break;
}
} | [
"public",
"static",
"function",
"Attach",
"(",
"$",
"ExtensionType",
")",
"{",
"switch",
"(",
"$",
"ExtensionType",
")",
"{",
"case",
"self",
"::",
"CONTEXT_APPLICATION",
":",
"if",
"(",
"Gdn",
"::",
"ApplicationManager",
"(",
")",
"instanceof",
"Gdn_ApplicationManager",
")",
"{",
"$",
"EnabledApplications",
"=",
"Gdn",
"::",
"ApplicationManager",
"(",
")",
"->",
"EnabledApplicationFolders",
"(",
")",
";",
"foreach",
"(",
"$",
"EnabledApplications",
"as",
"$",
"EnabledApplication",
")",
"{",
"self",
"::",
"AttachApplication",
"(",
"$",
"EnabledApplication",
")",
";",
"}",
"}",
"break",
";",
"case",
"self",
"::",
"CONTEXT_PLUGIN",
":",
"if",
"(",
"Gdn",
"::",
"PluginManager",
"(",
")",
"instanceof",
"Gdn_PluginManager",
")",
"{",
"foreach",
"(",
"Gdn",
"::",
"PluginManager",
"(",
")",
"->",
"SearchPaths",
"(",
")",
"as",
"$",
"SearchPath",
"=>",
"$",
"SearchPathName",
")",
"{",
"if",
"(",
"$",
"SearchPathName",
"===",
"TRUE",
"||",
"$",
"SearchPathName",
"==",
"1",
")",
"$",
"SearchPathName",
"=",
"md5",
"(",
"$",
"SearchPath",
")",
";",
"// If we have already loaded the plugin manager, use its internal folder list",
"if",
"(",
"Gdn",
"::",
"PluginManager",
"(",
")",
"->",
"Started",
"(",
")",
")",
"{",
"$",
"Folders",
"=",
"Gdn",
"::",
"PluginManager",
"(",
")",
"->",
"EnabledPluginFolders",
"(",
"$",
"SearchPath",
")",
";",
"foreach",
"(",
"$",
"Folders",
"as",
"$",
"PluginFolder",
")",
"{",
"$",
"FullPluginPath",
"=",
"CombinePaths",
"(",
"array",
"(",
"$",
"SearchPath",
",",
"$",
"PluginFolder",
")",
")",
";",
"self",
"::",
"RegisterMap",
"(",
"self",
"::",
"MAP_LIBRARY",
",",
"self",
"::",
"CONTEXT_PLUGIN",
",",
"$",
"FullPluginPath",
",",
"array",
"(",
"'SearchSubfolders'",
"=>",
"TRUE",
",",
"'Extension'",
"=>",
"$",
"SearchPathName",
",",
"'Structure'",
"=>",
"Gdn_Autoloader_Map",
"::",
"STRUCTURE_SPLIT",
",",
"'SplitTopic'",
"=>",
"strtolower",
"(",
"$",
"PluginFolder",
")",
",",
"'PreWarm'",
"=>",
"TRUE",
")",
")",
";",
"}",
"$",
"PluginMap",
"=",
"self",
"::",
"GetMap",
"(",
"self",
"::",
"MAP_LIBRARY",
",",
"self",
"::",
"CONTEXT_PLUGIN",
")",
";",
"if",
"(",
"$",
"PluginMap",
"&&",
"!",
"$",
"PluginMap",
"->",
"MapIsOnDisk",
"(",
")",
")",
"Gdn",
"::",
"PluginManager",
"(",
")",
"->",
"ForceAutoloaderIndex",
"(",
")",
";",
"}",
"}",
"}",
"break",
";",
"case",
"self",
"::",
"CONTEXT_THEME",
":",
"break",
";",
"}",
"}"
] | Attach mappings for vanilla extension folders
@param string $ExtensionType type of extension to map. one of: CONTEXT_THEME, CONTEXT_PLUGIN, CONTEXT_APPLICATION | [
"Attach",
"mappings",
"for",
"vanilla",
"extension",
"folders"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L77-L129 |
12,195 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader.Map | public static function Map($MapHash) {
if (array_key_exists($MapHash, self::$Maps))
return self::$Maps[$MapHash];
if (is_null($MapHash)) return self::$Maps;
return FALSE;
} | php | public static function Map($MapHash) {
if (array_key_exists($MapHash, self::$Maps))
return self::$Maps[$MapHash];
if (is_null($MapHash)) return self::$Maps;
return FALSE;
} | [
"public",
"static",
"function",
"Map",
"(",
"$",
"MapHash",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"MapHash",
",",
"self",
"::",
"$",
"Maps",
")",
")",
"return",
"self",
"::",
"$",
"Maps",
"[",
"$",
"MapHash",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"MapHash",
")",
")",
"return",
"self",
"::",
"$",
"Maps",
";",
"return",
"FALSE",
";",
"}"
] | Get an Autoloader Map by hash
@param type $MapHash
@return Gdn_Autoloader_Map | [
"Get",
"an",
"Autoloader",
"Map",
"by",
"hash"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L275-L281 |
12,196 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader.GetMap | public static function GetMap($MapType, $ContextType, $Extension = self::CONTEXT_CORE, $MapRootLocation = PATH_CACHE) {
$MapHash = self::MakeMapHash($MapType, $ContextType, $Extension, $MapRootLocation);
return self::Map($MapHash);
} | php | public static function GetMap($MapType, $ContextType, $Extension = self::CONTEXT_CORE, $MapRootLocation = PATH_CACHE) {
$MapHash = self::MakeMapHash($MapType, $ContextType, $Extension, $MapRootLocation);
return self::Map($MapHash);
} | [
"public",
"static",
"function",
"GetMap",
"(",
"$",
"MapType",
",",
"$",
"ContextType",
",",
"$",
"Extension",
"=",
"self",
"::",
"CONTEXT_CORE",
",",
"$",
"MapRootLocation",
"=",
"PATH_CACHE",
")",
"{",
"$",
"MapHash",
"=",
"self",
"::",
"MakeMapHash",
"(",
"$",
"MapType",
",",
"$",
"ContextType",
",",
"$",
"Extension",
",",
"$",
"MapRootLocation",
")",
";",
"return",
"self",
"::",
"Map",
"(",
"$",
"MapHash",
")",
";",
"}"
] | Lookup and return an Autoloader Map
@param type $MapType
@param type $ContextType
@param type $Extension
@param type $MapRootLocation
@return Gdn_Autoloader_Map | [
"Lookup",
"and",
"return",
"an",
"Autoloader",
"Map"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L292-L295 |
12,197 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader.SmartFree | public static function SmartFree($ContextType = NULL, $MapResourceArray = NULL) {
$CacheFolder = @opendir(PATH_CACHE);
if (!$CacheFolder) return TRUE;
while ($File = readdir($CacheFolder)) {
$Extension = pathinfo($File, PATHINFO_EXTENSION);
if ($Extension == 'ini' && $File != 'locale_map.ini')
@unlink(CombinePaths(array(PATH_CACHE, $File)));
}
} | php | public static function SmartFree($ContextType = NULL, $MapResourceArray = NULL) {
$CacheFolder = @opendir(PATH_CACHE);
if (!$CacheFolder) return TRUE;
while ($File = readdir($CacheFolder)) {
$Extension = pathinfo($File, PATHINFO_EXTENSION);
if ($Extension == 'ini' && $File != 'locale_map.ini')
@unlink(CombinePaths(array(PATH_CACHE, $File)));
}
} | [
"public",
"static",
"function",
"SmartFree",
"(",
"$",
"ContextType",
"=",
"NULL",
",",
"$",
"MapResourceArray",
"=",
"NULL",
")",
"{",
"$",
"CacheFolder",
"=",
"@",
"opendir",
"(",
"PATH_CACHE",
")",
";",
"if",
"(",
"!",
"$",
"CacheFolder",
")",
"return",
"TRUE",
";",
"while",
"(",
"$",
"File",
"=",
"readdir",
"(",
"$",
"CacheFolder",
")",
")",
"{",
"$",
"Extension",
"=",
"pathinfo",
"(",
"$",
"File",
",",
"PATHINFO_EXTENSION",
")",
";",
"if",
"(",
"$",
"Extension",
"==",
"'ini'",
"&&",
"$",
"File",
"!=",
"'locale_map.ini'",
")",
"@",
"unlink",
"(",
"CombinePaths",
"(",
"array",
"(",
"PATH_CACHE",
",",
"$",
"File",
")",
")",
")",
";",
"}",
"}"
] | This method frees the map storing information about the specified resource
Takes a maptype, and an array of information about the resource in question:
a plugininfo array, in the case of a plugin, or
@param string $ContextType type of map to consider (one of the MAP_ constants)
@param array $MapResourceArray array of information about the mapped resource | [
"This",
"method",
"frees",
"the",
"map",
"storing",
"information",
"about",
"the",
"specified",
"resource"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L470-L480 |
12,198 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader.Start | public static function Start() {
self::$Prefixes = array(
self::CONTEXT_CORE => 'c',
self::CONTEXT_APPLICATION => 'a',
self::CONTEXT_PLUGIN => 'p',
self::CONTEXT_THEME => 't'
);
self::$ContextOrder = array(
self::CONTEXT_THEME,
self::CONTEXT_LOCALE,
self::CONTEXT_PLUGIN,
self::CONTEXT_APPLICATION,
self::CONTEXT_CORE
);
self::$Maps = array();
self::$MapGroups = array();
// Register autoloader with the SPL
spl_autoload_register(array('Gdn_Autoloader', 'Lookup'));
// Configure library/core and library/database
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/core');
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/database');
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/vendors');
// Register shutdown function to auto save changed cache files
register_shutdown_function(array('Gdn_Autoloader', 'Shutdown'));
} | php | public static function Start() {
self::$Prefixes = array(
self::CONTEXT_CORE => 'c',
self::CONTEXT_APPLICATION => 'a',
self::CONTEXT_PLUGIN => 'p',
self::CONTEXT_THEME => 't'
);
self::$ContextOrder = array(
self::CONTEXT_THEME,
self::CONTEXT_LOCALE,
self::CONTEXT_PLUGIN,
self::CONTEXT_APPLICATION,
self::CONTEXT_CORE
);
self::$Maps = array();
self::$MapGroups = array();
// Register autoloader with the SPL
spl_autoload_register(array('Gdn_Autoloader', 'Lookup'));
// Configure library/core and library/database
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/core');
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/database');
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/vendors');
// Register shutdown function to auto save changed cache files
register_shutdown_function(array('Gdn_Autoloader', 'Shutdown'));
} | [
"public",
"static",
"function",
"Start",
"(",
")",
"{",
"self",
"::",
"$",
"Prefixes",
"=",
"array",
"(",
"self",
"::",
"CONTEXT_CORE",
"=>",
"'c'",
",",
"self",
"::",
"CONTEXT_APPLICATION",
"=>",
"'a'",
",",
"self",
"::",
"CONTEXT_PLUGIN",
"=>",
"'p'",
",",
"self",
"::",
"CONTEXT_THEME",
"=>",
"'t'",
")",
";",
"self",
"::",
"$",
"ContextOrder",
"=",
"array",
"(",
"self",
"::",
"CONTEXT_THEME",
",",
"self",
"::",
"CONTEXT_LOCALE",
",",
"self",
"::",
"CONTEXT_PLUGIN",
",",
"self",
"::",
"CONTEXT_APPLICATION",
",",
"self",
"::",
"CONTEXT_CORE",
")",
";",
"self",
"::",
"$",
"Maps",
"=",
"array",
"(",
")",
";",
"self",
"::",
"$",
"MapGroups",
"=",
"array",
"(",
")",
";",
"// Register autoloader with the SPL",
"spl_autoload_register",
"(",
"array",
"(",
"'Gdn_Autoloader'",
",",
"'Lookup'",
")",
")",
";",
"// Configure library/core and library/database",
"self",
"::",
"RegisterMap",
"(",
"self",
"::",
"MAP_LIBRARY",
",",
"self",
"::",
"CONTEXT_CORE",
",",
"PATH_LIBRARY",
".",
"'/core'",
")",
";",
"self",
"::",
"RegisterMap",
"(",
"self",
"::",
"MAP_LIBRARY",
",",
"self",
"::",
"CONTEXT_CORE",
",",
"PATH_LIBRARY",
".",
"'/database'",
")",
";",
"self",
"::",
"RegisterMap",
"(",
"self",
"::",
"MAP_LIBRARY",
",",
"self",
"::",
"CONTEXT_CORE",
",",
"PATH_LIBRARY",
".",
"'/vendors'",
")",
";",
"// Register shutdown function to auto save changed cache files",
"register_shutdown_function",
"(",
"array",
"(",
"'Gdn_Autoloader'",
",",
"'Shutdown'",
")",
")",
";",
"}"
] | Register core mappings
Set up the autoloader with known searchg directories, hook into the SPL autoloader
and load existing caches.
@param void | [
"Register",
"core",
"mappings"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L490-L519 |
12,199 | bishopb/vanilla | library/core/class.autoloader.php | Gdn_Autoloader_Map.Load | public static function Load($MapType, $ContextType, $MapRootLocation, $Options) {
return new Gdn_Autoloader_Map($MapType, $ContextType, $MapRootLocation, $Options);
} | php | public static function Load($MapType, $ContextType, $MapRootLocation, $Options) {
return new Gdn_Autoloader_Map($MapType, $ContextType, $MapRootLocation, $Options);
} | [
"public",
"static",
"function",
"Load",
"(",
"$",
"MapType",
",",
"$",
"ContextType",
",",
"$",
"MapRootLocation",
",",
"$",
"Options",
")",
"{",
"return",
"new",
"Gdn_Autoloader_Map",
"(",
"$",
"MapType",
",",
"$",
"ContextType",
",",
"$",
"MapRootLocation",
",",
"$",
"Options",
")",
";",
"}"
] | Autoloader cache static constructor
@return Gdn_Autoloader_Map | [
"Autoloader",
"cache",
"static",
"constructor"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.autoloader.php#L703-L705 |
Subsets and Splits