repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
FriendsOfCake/search | src/Model/Filter/Base.php | Base.skip | public function skip()
{
return !$this->present() ||
($this->filterEmpty() &&
empty($this->_args[$this->name()]) &&
!is_numeric($this->_args[$this->name()])
);
} | php | public function skip()
{
return !$this->present() ||
($this->filterEmpty() &&
empty($this->_args[$this->name()]) &&
!is_numeric($this->_args[$this->name()])
);
} | [
"public",
"function",
"skip",
"(",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"present",
"(",
")",
"||",
"(",
"$",
"this",
"->",
"filterEmpty",
"(",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"_args",
"[",
"$",
"this",
"->",
"name",
"(",
")",
... | Checks whether this finder should be skipped.
@return bool | [
"Checks",
"whether",
"this",
"finder",
"should",
"be",
"skipped",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Base.php#L177-L184 |
FriendsOfCake/search | src/Model/Filter/Base.php | Base.value | public function value()
{
$value = $this->_config['defaultValue'];
$passedValue = $this->passedValue();
if ($passedValue === null) {
return $value;
}
return $passedValue;
} | php | public function value()
{
$value = $this->_config['defaultValue'];
$passedValue = $this->passedValue();
if ($passedValue === null) {
return $value;
}
return $passedValue;
} | [
"public",
"function",
"value",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_config",
"[",
"'defaultValue'",
"]",
";",
"$",
"passedValue",
"=",
"$",
"this",
"->",
"passedValue",
"(",
")",
";",
"if",
"(",
"$",
"passedValue",
"===",
"null",
")... | Get the value of the "name" from HTTP GET arguments.
@return mixed | [
"Get",
"the",
"value",
"of",
"the",
"name",
"from",
"HTTP",
"GET",
"arguments",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Base.php#L191-L201 |
FriendsOfCake/search | src/Model/Filter/Base.php | Base.validate | public function validate(array $value = null)
{
if ($value === null) {
return $this->getConfig('validate');
}
$this->setConfig('validate', $value);
} | php | public function validate(array $value = null)
{
if ($value === null) {
return $this->getConfig('validate');
}
$this->setConfig('validate', $value);
} | [
"public",
"function",
"validate",
"(",
"array",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getConfig",
"(",
"'validate'",
")",
";",
"}",
"$",
"this",
"->",
"setConfig",
"(",
... | Get / Set the validation rules.
@param array|null $value Value.
@return array|null
@codeCoverageIgnore
@internal | [
"Get",
"/",
"Set",
"the",
"validation",
"rules",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Base.php#L255-L262 |
FriendsOfCake/search | src/Model/Filter/Value.php | Value.process | public function process()
{
$value = $this->value();
if ($value === null) {
return false;
}
$isMultiValue = is_array($value);
if ($isMultiValue &&
empty($value)
) {
return false;
}
if (!$this->manager()->getReposit... | php | public function process()
{
$value = $this->value();
if ($value === null) {
return false;
}
$isMultiValue = is_array($value);
if ($isMultiValue &&
empty($value)
) {
return false;
}
if (!$this->manager()->getReposit... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
"(",
")",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"isMultiValue",
"=",
"is_array",
"(",
"$",
"value",
... | Process a value condition ($x == $y).
@return bool | [
"Process",
"a",
"value",
"condition",
"(",
"$x",
"==",
"$y",
")",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Value.php#L24-L62 |
FriendsOfCake/search | src/Model/Filter/Exists.php | Exists.process | public function process()
{
$value = $this->value();
if (!is_scalar($value) || $value === '') {
return false;
}
$bool = (bool)$value;
$nullValue = $this->getConfig('nullValue');
$comparison = ' !=';
if (!$bool) {
$comparison = '';
... | php | public function process()
{
$value = $this->value();
if (!is_scalar($value) || $value === '') {
return false;
}
$bool = (bool)$value;
$nullValue = $this->getConfig('nullValue');
$comparison = ' !=';
if (!$bool) {
$comparison = '';
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
"(",
")",
";",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"===",
"''",
")",
"{",
"return",
"false",
";",
"}",
"$",
"boo... | Check if a value is truthy/falsy and pass as condition aware of NULLable.
@return bool | [
"Check",
"if",
"a",
"value",
"is",
"truthy",
"/",
"falsy",
"and",
"pass",
"as",
"condition",
"aware",
"of",
"NULLable",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Exists.php#L23-L62 |
FriendsOfCake/search | src/Model/Filter/Boolean.php | Boolean.process | public function process()
{
$value = $this->value();
if (!is_scalar($value)) {
return false;
}
if (is_string($value)) {
$value = strtolower($value);
}
$bool = null;
if (in_array($value, $this->getConfig('truthy'), true)) {
... | php | public function process()
{
$value = $this->value();
if (!is_scalar($value)) {
return false;
}
if (is_string($value)) {
$value = strtolower($value);
}
$bool = null;
if (in_array($value, $this->getConfig('truthy'), true)) {
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
"(",
")",
";",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
... | Check if a value is truthy/falsy and pass as condition.
@return bool | [
"Check",
"if",
"a",
"value",
"is",
"truthy",
"/",
"falsy",
"and",
"pass",
"as",
"condition",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Boolean.php#L25-L63 |
FriendsOfCake/search | src/Model/Filter/FilterCollection.php | FilterCollection.add | public function add($name, $filter, array $options = [])
{
$this->_filters[$name] = $this->_loadFilter($name, $filter, $options);
return $this;
} | php | public function add($name, $filter, array $options = [])
{
$this->_filters[$name] = $this->_loadFilter($name, $filter, $options);
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"filter",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_filters",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"_loadFilter",
"(",
"$",
"name",
",",
"$",
"... | Adds filter to the collection.
@param string $name Filter name.
@param string $filter Filter class name in short form like "Search.Value" or FQCN.
@param array $options Filter options.
@return $this | [
"Adds",
"filter",
"to",
"the",
"collection",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/FilterCollection.php#L58-L63 |
FriendsOfCake/search | src/Model/Filter/FilterCollection.php | FilterCollection._loadFilter | protected function _loadFilter($name, $filter, array $options = [])
{
if (empty($options['className'])) {
$class = $filter;
} else {
$class = $options['className'];
unset($options['className']);
}
$className = App::className($class, 'Model/Filter'... | php | protected function _loadFilter($name, $filter, array $options = [])
{
if (empty($options['className'])) {
$class = $filter;
} else {
$class = $options['className'];
unset($options['className']);
}
$className = App::className($class, 'Model/Filter'... | [
"protected",
"function",
"_loadFilter",
"(",
"$",
"name",
",",
"$",
"filter",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'className'",
"]",
")",
")",
"{",
"$",
"class",
"=",
"$",
"filter",
... | Loads a search filter.
@param string $name Filter name.
@param string $filter Filter class name in short form like "Search.Value" or FQCN.
@param array $options Filter options.
@return \Search\Model\Filter\Base
@throws \InvalidArgumentException When no filter was found. | [
"Loads",
"a",
"search",
"filter",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/FilterCollection.php#L74-L89 |
FriendsOfCake/search | src/Model/Behavior/SearchBehavior.php | SearchBehavior.initialize | public function initialize(array $config)
{
parent::initialize($config);
if (isset($config['emptyValues'])) {
$this->setConfig('emptyValues', $config['emptyValues'], false);
}
$collectionClass = $this->getConfig('collectionClass');
if ($collectionClass) {
... | php | public function initialize(array $config)
{
parent::initialize($config);
if (isset($config['emptyValues'])) {
$this->setConfig('emptyValues', $config['emptyValues'], false);
}
$collectionClass = $this->getConfig('collectionClass');
if ($collectionClass) {
... | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
")",
"{",
"parent",
"::",
"initialize",
"(",
"$",
"config",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'emptyValues'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"setConfig",
"... | Overwrite emptyValues config value
@param array $config Config
@return void | [
"Overwrite",
"emptyValues",
"config",
"value"
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Behavior/SearchBehavior.php#L41-L64 |
FriendsOfCake/search | src/Controller/Component/PrgComponent.php | PrgComponent.startup | public function startup()
{
if (!$this->request->is('post') || !$this->_actionCheck()) {
return null;
}
list($url) = explode('?', $this->request->getRequestTarget());
$params = $this->_filterParams();
if ($params) {
$url .= '?' . http_build_query($pa... | php | public function startup()
{
if (!$this->request->is('post') || !$this->_actionCheck()) {
return null;
}
list($url) = explode('?', $this->request->getRequestTarget());
$params = $this->_filterParams();
if ($params) {
$url .= '?' . http_build_query($pa... | [
"public",
"function",
"startup",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"is",
"(",
"'post'",
")",
"||",
"!",
"$",
"this",
"->",
"_actionCheck",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"list",
"(",
"$",
"url",
... | Checks if the current request has posted data and redirects the users
to the same action after converting the post data into GET params
@return \Cake\Http\Response|null | [
"Checks",
"if",
"the",
"current",
"request",
"has",
"posted",
"data",
"and",
"redirects",
"the",
"users",
"to",
"the",
"same",
"action",
"after",
"converting",
"the",
"post",
"data",
"into",
"GET",
"params"
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Controller/Component/PrgComponent.php#L58-L72 |
FriendsOfCake/search | src/Controller/Component/PrgComponent.php | PrgComponent.beforeRender | public function beforeRender()
{
if (!$this->_actionCheck()) {
return null;
}
$controller = $this->_registry->getController();
$modelClass = $this->getConfig('modelClass', $controller->modelClass);
if (!$modelClass) {
return null;
}
l... | php | public function beforeRender()
{
if (!$this->_actionCheck()) {
return null;
}
$controller = $this->_registry->getController();
$modelClass = $this->getConfig('modelClass', $controller->modelClass);
if (!$modelClass) {
return null;
}
l... | [
"public",
"function",
"beforeRender",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_actionCheck",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"controller",
"=",
"$",
"this",
"->",
"_registry",
"->",
"getController",
"(",
")",
";",
"$",... | Populates the $_isSearch view variable based on the current request.
You need to configure the modelClass config if you are not using the controller's
default modelClass property.
@return \Cake\Http\Response|null | [
"Populates",
"the",
"$_isSearch",
"view",
"variable",
"based",
"on",
"the",
"current",
"request",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Controller/Component/PrgComponent.php#L82-L107 |
FriendsOfCake/search | src/Controller/Component/PrgComponent.php | PrgComponent._actionCheck | protected function _actionCheck()
{
$actions = $this->getConfig('actions');
if (is_bool($actions)) {
return $actions;
}
return in_array($this->request->getParam('action'), (array)$actions, true);
} | php | protected function _actionCheck()
{
$actions = $this->getConfig('actions');
if (is_bool($actions)) {
return $actions;
}
return in_array($this->request->getParam('action'), (array)$actions, true);
} | [
"protected",
"function",
"_actionCheck",
"(",
")",
"{",
"$",
"actions",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'actions'",
")",
";",
"if",
"(",
"is_bool",
"(",
"$",
"actions",
")",
")",
"{",
"return",
"$",
"actions",
";",
"}",
"return",
"in_array",... | Checks if the action should be processed by the component.
@return bool | [
"Checks",
"if",
"the",
"action",
"should",
"be",
"processed",
"by",
"the",
"component",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Controller/Component/PrgComponent.php#L114-L122 |
FriendsOfCake/search | src/Controller/Component/PrgComponent.php | PrgComponent._filterParams | protected function _filterParams()
{
$params = Hash::filter((array)$this->request->getData());
foreach ((array)$this->getConfig('queryStringBlacklist') as $field) {
unset($params[$field]);
}
foreach ((array)$this->getConfig('emptyValues') as $field => $value) {
... | php | protected function _filterParams()
{
$params = Hash::filter((array)$this->request->getData());
foreach ((array)$this->getConfig('queryStringBlacklist') as $field) {
unset($params[$field]);
}
foreach ((array)$this->getConfig('emptyValues') as $field => $value) {
... | [
"protected",
"function",
"_filterParams",
"(",
")",
"{",
"$",
"params",
"=",
"Hash",
"::",
"filter",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"request",
"->",
"getData",
"(",
")",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"g... | Filters the params from POST data and merges in the whitelisted query string ones.
@return array | [
"Filters",
"the",
"params",
"from",
"POST",
"data",
"and",
"merges",
"in",
"the",
"whitelisted",
"query",
"string",
"ones",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Controller/Component/PrgComponent.php#L129-L155 |
FriendsOfCake/search | src/Model/Filter/Callback.php | Callback.process | public function process()
{
$ret = call_user_func(
$this->getConfig('callback'),
$this->getQuery(),
$this->getArgs(),
$this
);
if ($ret === null) {
return true;
}
return $ret;
} | php | public function process()
{
$ret = call_user_func(
$this->getConfig('callback'),
$this->getQuery(),
$this->getArgs(),
$this
);
if ($ret === null) {
return true;
}
return $ret;
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"ret",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'callback'",
")",
",",
"$",
"this",
"->",
"getQuery",
"(",
")",
",",
"$",
"this",
"->",
"getArgs",
"(",
")",
",",
"$",
"th... | Modify query using callback.
@return bool | [
"Modify",
"query",
"using",
"callback",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Callback.php#L12-L25 |
FriendsOfCake/search | src/View/Helper/SearchHelper.php | SearchHelper.resetLink | public function resetLink($label, array $options = [])
{
return $this->Html->link($label, $this->resetUrl(), $options);
} | php | public function resetLink($label, array $options = [])
{
return $this->Html->link($label, $this->resetUrl(), $options);
} | [
"public",
"function",
"resetLink",
"(",
"$",
"label",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"Html",
"->",
"link",
"(",
"$",
"label",
",",
"$",
"this",
"->",
"resetUrl",
"(",
")",
",",
"$",
"options",
... | Returns a reset link for the search form.
@param string $label Label text.
@param array $options Array of options and HTML attributes.
@return string HTML. | [
"Returns",
"a",
"reset",
"link",
"for",
"the",
"search",
"form",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/View/Helper/SearchHelper.php#L77-L80 |
FriendsOfCake/search | src/View/Helper/SearchHelper.php | SearchHelper.resetUrl | public function resetUrl()
{
$query = $this->request->getQuery();
$searchParams = (array)$this->_View->get('_searchParams');
$query = array_diff_key($query, $searchParams);
$additionalBlacklist = (array)$this->getConfig('additionalBlacklist');
foreach ($additionalBlacklist ... | php | public function resetUrl()
{
$query = $this->request->getQuery();
$searchParams = (array)$this->_View->get('_searchParams');
$query = array_diff_key($query, $searchParams);
$additionalBlacklist = (array)$this->getConfig('additionalBlacklist');
foreach ($additionalBlacklist ... | [
"public",
"function",
"resetUrl",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"request",
"->",
"getQuery",
"(",
")",
";",
"$",
"searchParams",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"_View",
"->",
"get",
"(",
"'_searchParams'",
")",
";",... | Returns the cleaned URL.
@return array URL with cleaned Query string. | [
"Returns",
"the",
"cleaned",
"URL",
"."
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/View/Helper/SearchHelper.php#L87-L102 |
FriendsOfCake/search | src/Model/Filter/Escaper/DefaultEscaper.php | DefaultEscaper.formatWildcards | public function formatWildcards($value)
{
$from = $to = $substFrom = $substTo = [];
if ($this->getConfig('wildcardAny') !== '%') {
$from[] = $this->getConfig('fromWildCardAny');
$to[] = $this->getConfig('toWildCardAny');
$substFrom[] = $this->getConfig('wildcardAn... | php | public function formatWildcards($value)
{
$from = $to = $substFrom = $substTo = [];
if ($this->getConfig('wildcardAny') !== '%') {
$from[] = $this->getConfig('fromWildCardAny');
$to[] = $this->getConfig('toWildCardAny');
$substFrom[] = $this->getConfig('wildcardAn... | [
"public",
"function",
"formatWildcards",
"(",
"$",
"value",
")",
"{",
"$",
"from",
"=",
"$",
"to",
"=",
"$",
"substFrom",
"=",
"$",
"substTo",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'wildcardAny'",
")",
"!==",
"'%'",
"... | Replace substitutions with original wildcards
but first, escape the original wildcards in the text to use them as normal search text
@param string $value Value.
@return string Value | [
"Replace",
"substitutions",
"with",
"original",
"wildcards",
"but",
"first",
"escape",
"the",
"original",
"wildcards",
"in",
"the",
"text",
"to",
"use",
"them",
"as",
"normal",
"search",
"text"
] | train | https://github.com/FriendsOfCake/search/blob/b57d024a2d83215d402dae79b2bcad0142e712fd/src/Model/Filter/Escaper/DefaultEscaper.php#L39-L62 |
UnionOfRAD/lithium | net/Socket.php | Socket.send | public function send($message = null, array $options = []) {
$defaults = ['response' => $this->_classes['response']];
$options += $defaults;
if ($this->write($message)) {
$config = ['message' => $this->read()] + $this->_config;
return $this->_instance($options['response'], $config);
}
} | php | public function send($message = null, array $options = []) {
$defaults = ['response' => $this->_classes['response']];
$options += $defaults;
if ($this->write($message)) {
$config = ['message' => $this->read()] + $this->_config;
return $this->_instance($options['response'], $config);
}
} | [
"public",
"function",
"send",
"(",
"$",
"message",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'response'",
"=>",
"$",
"this",
"->",
"_classes",
"[",
"'response'",
"]",
"]",
";",
"$",
"options",
"... | Aggregates read and write methods into a coherent request response
@param \lithium\net\Message $message
@param array $options
- '`response`': a fully-namespaced string for the response object
@return object a response object based on `\lithium\net\Message` | [
"Aggregates",
"read",
"and",
"write",
"methods",
"into",
"a",
"coherent",
"request",
"response"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/Socket.php#L143-L151 |
UnionOfRAD/lithium | net/HostString.php | HostString.parse | public static function parse($host) {
if ($host[0] === ':') {
return ['port' => (integer) substr($host, 1)];
}
if ($host[0] === '[') {
if (($close = strpos($host, ']')) === false) {
throw new LogicException("Failed to parse host string `{$host}`.");
}
if (strlen($host) > $close + 1) {
if ($hos... | php | public static function parse($host) {
if ($host[0] === ':') {
return ['port' => (integer) substr($host, 1)];
}
if ($host[0] === '[') {
if (($close = strpos($host, ']')) === false) {
throw new LogicException("Failed to parse host string `{$host}`.");
}
if (strlen($host) > $close + 1) {
if ($hos... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"host",
")",
"{",
"if",
"(",
"$",
"host",
"[",
"0",
"]",
"===",
"':'",
")",
"{",
"return",
"[",
"'port'",
"=>",
"(",
"integer",
")",
"substr",
"(",
"$",
"host",
",",
"1",
")",
"]",
";",
"}",
... | Parses host string that can either hold just the host name (i.e. `localhost`), a
host/port combination (i.e. `localhost:8080`) or just the port prefixed with a
colon (i.e. `:8080`). Also works with IPv4 and IPv6 addresses.
Note: IPv6 addresses must be enclosed in square brackets `'[::1]:80'`.
@param string $host The ... | [
"Parses",
"host",
"string",
"that",
"can",
"either",
"hold",
"just",
"the",
"host",
"name",
"(",
"i",
".",
"e",
".",
"localhost",
")",
"a",
"host",
"/",
"port",
"combination",
"(",
"i",
".",
"e",
".",
"localhost",
":",
"8080",
")",
"or",
"just",
"t... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/HostString.php#L30-L56 |
UnionOfRAD/lithium | core/Object.php | Object._init | protected function _init() {
foreach ($this->_autoConfig as $key => $flag) {
if (!isset($this->_config[$key]) && !isset($this->_config[$flag])) {
continue;
}
if ($flag === 'merge') {
$this->{"_{$key}"} = $this->_config[$key] + $this->{"_{$key}"};
} else {
$this->{"_$flag"} = $this->_config[$f... | php | protected function _init() {
foreach ($this->_autoConfig as $key => $flag) {
if (!isset($this->_config[$key]) && !isset($this->_config[$flag])) {
continue;
}
if ($flag === 'merge') {
$this->{"_{$key}"} = $this->_config[$key] + $this->{"_{$key}"};
} else {
$this->{"_$flag"} = $this->_config[$f... | [
"protected",
"function",
"_init",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_autoConfig",
"as",
"$",
"key",
"=>",
"$",
"flag",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_config",
"[",
"$",
"key",
"]",
")",
"&&",
"!",
... | Initializer function called by the constructor unless the constructor `'init'` flag is set
to `false`. May be used for testing purposes, where objects need to be manipulated in an
un-initialized state, or for high-overhead operations that require more control than the
constructor provides. Additionally, this method ite... | [
"Initializer",
"function",
"called",
"by",
"the",
"constructor",
"unless",
"the",
"constructor",
"init",
"flag",
"is",
"set",
"to",
"false",
".",
"May",
"be",
"used",
"for",
"testing",
"purposes",
"where",
"objects",
"need",
"to",
"be",
"manipulated",
"in",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Object.php#L112-L124 |
UnionOfRAD/lithium | core/Object.php | Object.invokeMethod | public function invokeMethod($method, $params = []) {
switch (count($params)) {
case 0:
return $this->{$method}();
case 1:
return $this->{$method}($params[0]);
case 2:
return $this->{$method}($params[0], $params[1]);
case 3:
return $this->{$method}($params[0], $params[1], $params[2]);
c... | php | public function invokeMethod($method, $params = []) {
switch (count($params)) {
case 0:
return $this->{$method}();
case 1:
return $this->{$method}($params[0]);
case 2:
return $this->{$method}($params[0], $params[1]);
case 3:
return $this->{$method}($params[0], $params[1], $params[2]);
c... | [
"public",
"function",
"invokeMethod",
"(",
"$",
"method",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"switch",
"(",
"count",
"(",
"$",
"params",
")",
")",
"{",
"case",
"0",
":",
"return",
"$",
"this",
"->",
"{",
"$",
"method",
"}",
"(",
")",
... | Calls a method on this object with the given parameters. Provides an OO wrapper
for call_user_func_array, and improves performance by using straight method calls
in most cases.
@param string $method Name of the method to call
@param array $params Parameter list to use when calling $method
@return mixed Returns the ... | [
"Calls",
"a",
"method",
"on",
"this",
"object",
"with",
"the",
"given",
"parameters",
".",
"Provides",
"an",
"OO",
"wrapper",
"for",
"call_user_func_array",
"and",
"improves",
"performance",
"by",
"using",
"straight",
"method",
"calls",
"in",
"most",
"cases",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Object.php#L135-L152 |
UnionOfRAD/lithium | core/Object.php | Object._filter | protected function _filter($method, $params, $callback, $filters = []) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::run()` and `::apply()`.';
trigger_error($message, E_USER_DEPRECATED);
list(, $method) = explode('::', $method);
foreach ($filter... | php | protected function _filter($method, $params, $callback, $filters = []) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::run()` and `::apply()`.';
trigger_error($message, E_USER_DEPRECATED);
list(, $method) = explode('::', $method);
foreach ($filter... | [
"protected",
"function",
"_filter",
"(",
"$",
"method",
",",
"$",
"params",
",",
"$",
"callback",
",",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"$",
"message",
"=",
"'`'",
".",
"__METHOD__",
".",
"'()` has been deprecated in favor of '",
";",
"$",
"message... | Executes a set of filters against a method by taking a method's main implementation as a
callback, and iteratively wrapping the filters around it. This, along with the `Filters`
class, is the core of Lithium's filters system. This system allows you to "reach into" an
object's methods which are marked as _filterable_, a... | [
"Executes",
"a",
"set",
"of",
"filters",
"against",
"a",
"method",
"by",
"taking",
"a",
"method",
"s",
"main",
"implementation",
"as",
"a",
"callback",
"and",
"iteratively",
"wrapping",
"the",
"filters",
"around",
"it",
".",
"This",
"along",
"with",
"the",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Object.php#L289-L300 |
UnionOfRAD/lithium | analysis/Logger.php | Logger.write | public static function write($priority, $message, array $options = []) {
$defaults = ['name' => null];
$options += $defaults;
$result = true;
if (isset(static::$_configurations[$options['name']])) {
$name = $options['name'];
$methods = [$name => static::adapter($name)->write($priority, $message, $options... | php | public static function write($priority, $message, array $options = []) {
$defaults = ['name' => null];
$options += $defaults;
$result = true;
if (isset(static::$_configurations[$options['name']])) {
$name = $options['name'];
$methods = [$name => static::adapter($name)->write($priority, $message, $options... | [
"public",
"static",
"function",
"write",
"(",
"$",
"priority",
",",
"$",
"message",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'name'",
"=>",
"null",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",... | Writes a message to one or more log adapters, where the adapters that are written to are the
ones that respond to the given priority level.
@param string $priority The priority of the log message to be written.
@param string $message The message to be written.
@param array $options An array of adapter-specific options... | [
"Writes",
"a",
"message",
"to",
"one",
"or",
"more",
"log",
"adapters",
"where",
"the",
"adapters",
"that",
"are",
"written",
"to",
"are",
"the",
"ones",
"that",
"respond",
"to",
"the",
"given",
"priority",
"level",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/Logger.php#L105-L140 |
UnionOfRAD/lithium | analysis/Logger.php | Logger.respondsTo | public static function respondsTo($method, $internal = false) {
return isset(static::$_priorities[$method]) || parent::respondsTo($method, $internal);
} | php | public static function respondsTo($method, $internal = false) {
return isset(static::$_priorities[$method]) || parent::respondsTo($method, $internal);
} | [
"public",
"static",
"function",
"respondsTo",
"(",
"$",
"method",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"return",
"isset",
"(",
"static",
"::",
"$",
"_priorities",
"[",
"$",
"method",
"]",
")",
"||",
"parent",
"::",
"respondsTo",
"(",
"$",
"met... | Determines if a given method can be called.
@param string $method Name of the method.
@param boolean $internal Provide `true` to perform check from inside the
class/object. When `false` checks also for public visibility;
defaults to `false`.
@return boolean Returns `true` if the method can be called, `false` otherwise... | [
"Determines",
"if",
"a",
"given",
"method",
"can",
"be",
"called",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/Logger.php#L169-L171 |
UnionOfRAD/lithium | analysis/Logger.php | Logger._initConfig | protected static function _initConfig($name, $config) {
$defaults = ['priority' => true];
return parent::_initConfig($name, $config) + $defaults;
} | php | protected static function _initConfig($name, $config) {
$defaults = ['priority' => true];
return parent::_initConfig($name, $config) + $defaults;
} | [
"protected",
"static",
"function",
"_initConfig",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"$",
"defaults",
"=",
"[",
"'priority'",
"=>",
"true",
"]",
";",
"return",
"parent",
"::",
"_initConfig",
"(",
"$",
"name",
",",
"$",
"config",
")",
"+",
... | This method is called automatically to initialize the default configuration of a log adapter,
such that the adapter defaults to accepting log messages of any priority (i.e. the
`'priority'` key is set to `true`).
@param string $name The name of the logger configuration.
@param array $config The logger configuration as... | [
"This",
"method",
"is",
"called",
"automatically",
"to",
"initialize",
"the",
"default",
"configuration",
"of",
"a",
"log",
"adapter",
"such",
"that",
"the",
"adapter",
"defaults",
"to",
"accepting",
"log",
"messages",
"of",
"any",
"priority",
"(",
"i",
".",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/Logger.php#L182-L185 |
UnionOfRAD/lithium | analysis/Logger.php | Logger._configsByPriority | protected static function _configsByPriority($priority, $message, array $options = []) {
$configs = [];
$key = 'priority';
foreach (array_keys(static::$_configurations) as $name) {
$config = static::config($name);
$nameMatch = ($config[$key] === true || $config[$key] === $priority);
$arrayMatch = (is_ar... | php | protected static function _configsByPriority($priority, $message, array $options = []) {
$configs = [];
$key = 'priority';
foreach (array_keys(static::$_configurations) as $name) {
$config = static::config($name);
$nameMatch = ($config[$key] === true || $config[$key] === $priority);
$arrayMatch = (is_ar... | [
"protected",
"static",
"function",
"_configsByPriority",
"(",
"$",
"priority",
",",
"$",
"message",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"configs",
"=",
"[",
"]",
";",
"$",
"key",
"=",
"'priority'",
";",
"foreach",
"(",
"array_ke... | Gets the names of the adapter configurations that respond to a specific priority. The list
of adapter configurations returned will be used to write a message with the given priority.
@param string $priority The priority level of a message to be written.
@param string $message The message to write to the adapter.
@para... | [
"Gets",
"the",
"names",
"of",
"the",
"adapter",
"configurations",
"that",
"respond",
"to",
"a",
"specific",
"priority",
".",
"The",
"list",
"of",
"adapter",
"configurations",
"returned",
"will",
"be",
"used",
"to",
"write",
"a",
"message",
"with",
"the",
"gi... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/Logger.php#L198-L213 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship._init | protected function _init() {
parent::_init();
$config =& $this->_config;
if (!$config['to']) {
$assoc = preg_replace("/\\w+$/", "", $config['from']) . $config['name'];
$config['to'] = Libraries::locate('models', $assoc);
} elseif (!strpos($config['to'], '\\')) {
$config['to'] = preg_replace("/\\w+$/",... | php | protected function _init() {
parent::_init();
$config =& $this->_config;
if (!$config['to']) {
$assoc = preg_replace("/\\w+$/", "", $config['from']) . $config['name'];
$config['to'] = Libraries::locate('models', $assoc);
} elseif (!strpos($config['to'], '\\')) {
$config['to'] = preg_replace("/\\w+$/",... | [
"protected",
"function",
"_init",
"(",
")",
"{",
"parent",
"::",
"_init",
"(",
")",
";",
"$",
"config",
"=",
"&",
"$",
"this",
"->",
"_config",
";",
"if",
"(",
"!",
"$",
"config",
"[",
"'to'",
"]",
")",
"{",
"$",
"assoc",
"=",
"preg_replace",
"("... | Initializes the `Relationship` object by attempting to automatically generate any values
that were not provided in the constructor configuration. | [
"Initializes",
"the",
"Relationship",
"object",
"by",
"attempting",
"to",
"automatically",
"generate",
"any",
"values",
"that",
"were",
"not",
"provided",
"in",
"the",
"constructor",
"configuration",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L137-L155 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship.data | public function data($key = null) {
if (!$key) {
return $this->_config;
}
return isset($this->_config[$key]) ? $this->_config[$key] : null;
} | php | public function data($key = null) {
if (!$key) {
return $this->_config;
}
return isset($this->_config[$key]) ? $this->_config[$key] : null;
} | [
"public",
"function",
"data",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"_config",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"_config",
"[",
"$",
"key",
"]",
")",
"?",
... | Returns the named configuration item, or all configuration data, if no parameter is given.
@param string $key The name of the configuration item to return, or `null` to return all
items.
@return mixed Returns a single configuration item (mixed), or an array of all items. | [
"Returns",
"the",
"named",
"configuration",
"item",
"or",
"all",
"configuration",
"data",
"if",
"no",
"parameter",
"is",
"given",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L164-L169 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship.get | public function get($object, array $options = []) {
$link = $this->link();
$strategies = $this->_strategies();
if (!isset($strategies[$link]) || !is_callable($strategies[$link])) {
$msg = "Attempted to get object for invalid relationship link type `{$link}`.";
throw new ConfigException($msg);
}
return ... | php | public function get($object, array $options = []) {
$link = $this->link();
$strategies = $this->_strategies();
if (!isset($strategies[$link]) || !is_callable($strategies[$link])) {
$msg = "Attempted to get object for invalid relationship link type `{$link}`.";
throw new ConfigException($msg);
}
return ... | [
"public",
"function",
"get",
"(",
"$",
"object",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"link",
"=",
"$",
"this",
"->",
"link",
"(",
")",
";",
"$",
"strategies",
"=",
"$",
"this",
"->",
"_strategies",
"(",
")",
";",
"if",
"... | Gets a related object (or objects) for the given object connected to it by this relationship.
@param object $object The object to get the related data for.
@param array $options Additional options to merge into the query to be performed, where
applicable.
@return object Returns the object(s) for this relationship. | [
"Gets",
"a",
"related",
"object",
"(",
"or",
"objects",
")",
"for",
"the",
"given",
"object",
"connected",
"to",
"it",
"by",
"this",
"relationship",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L190-L199 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship.query | public function query($object) {
$conditions = (array) $this->constraints();
foreach ($this->key() as $from => $to) {
if (!isset($object->{$from})) {
return null;
}
$conditions[$to] = $object->{$from};
if (is_object($conditions[$to]) && $conditions[$to] instanceof Countable) {
$conditions[$to]... | php | public function query($object) {
$conditions = (array) $this->constraints();
foreach ($this->key() as $from => $to) {
if (!isset($object->{$from})) {
return null;
}
$conditions[$to] = $object->{$from};
if (is_object($conditions[$to]) && $conditions[$to] instanceof Countable) {
$conditions[$to]... | [
"public",
"function",
"query",
"(",
"$",
"object",
")",
"{",
"$",
"conditions",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"constraints",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"key",
"(",
")",
"as",
"$",
"from",
"=>",
"$",
"to",
")",
... | Generates query parameters for a related object (or objects) for the given object
connected to it by this relationship.
@param object $object The object to get the related data for.
@return object Returns the object(s) for this relationship. | [
"Generates",
"query",
"parameters",
"for",
"a",
"related",
"object",
"(",
"or",
"objects",
")",
"for",
"the",
"given",
"object",
"connected",
"to",
"it",
"by",
"this",
"relationship",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L208-L224 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship.foreignKey | public function foreignKey($primaryKey) {
$result = [];
$entity = $this->_classes['entity'];
$keys = ($this->type() === 'belongsTo') ? array_flip($this->key()) : $this->key();
$primaryKey = ($primaryKey instanceof $entity) ? $primaryKey->to('array') : $primaryKey;
foreach ($keys as $key => $foreignKey) {
... | php | public function foreignKey($primaryKey) {
$result = [];
$entity = $this->_classes['entity'];
$keys = ($this->type() === 'belongsTo') ? array_flip($this->key()) : $this->key();
$primaryKey = ($primaryKey instanceof $entity) ? $primaryKey->to('array') : $primaryKey;
foreach ($keys as $key => $foreignKey) {
... | [
"public",
"function",
"foreignKey",
"(",
"$",
"primaryKey",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'entity'",
"]",
";",
"$",
"keys",
"=",
"(",
"$",
"this",
"->",
"type",
"(",
")",
"==... | Build foreign keys from primary keys array.
@param $primaryKey An array where keys are primary keys and values are
the associated values of primary keys.
@return array An array where keys are foreign keys and values are
the associated values of foreign keys. | [
"Build",
"foreign",
"keys",
"from",
"primary",
"keys",
"array",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L234-L244 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship._keys | protected function _keys($keys) {
if (!$keys) {
return [];
}
$config = $this->_config;
$hasType = ($config['type'] === 'hasOne' || $config['type'] === 'hasMany');
$related = Libraries::locate('models', $config[$hasType ? 'from' : 'to']);
if (!class_exists($related)) {
throw new ClassNotFoundException... | php | protected function _keys($keys) {
if (!$keys) {
return [];
}
$config = $this->_config;
$hasType = ($config['type'] === 'hasOne' || $config['type'] === 'hasMany');
$related = Libraries::locate('models', $config[$hasType ? 'from' : 'to']);
if (!class_exists($related)) {
throw new ClassNotFoundException... | [
"protected",
"function",
"_keys",
"(",
"$",
"keys",
")",
"{",
"if",
"(",
"!",
"$",
"keys",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"config",
"=",
"$",
"this",
"->",
"_config",
";",
"$",
"hasType",
"=",
"(",
"$",
"config",
"[",
"'type'",
"]... | Generates an array of relationship key pairs, where the keys are fields on the origin model,
and values are fields on the lniked model. | [
"Generates",
"an",
"array",
"of",
"relationship",
"key",
"pairs",
"where",
"the",
"keys",
"are",
"fields",
"on",
"the",
"origin",
"model",
"and",
"values",
"are",
"fields",
"on",
"the",
"lniked",
"model",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L263-L286 |
UnionOfRAD/lithium | data/model/Relationship.php | Relationship._strategies | protected function _strategies() {
return [
static::LINK_EMBEDDED => function($object, $relationship) {
$fieldName = $relationship->fieldName();
return $object->{$fieldName};
},
static::LINK_CONTAINED => function($object, $relationship) {
$isArray = ($relationship->type() === "hasMany");
retu... | php | protected function _strategies() {
return [
static::LINK_EMBEDDED => function($object, $relationship) {
$fieldName = $relationship->fieldName();
return $object->{$fieldName};
},
static::LINK_CONTAINED => function($object, $relationship) {
$isArray = ($relationship->type() === "hasMany");
retu... | [
"protected",
"function",
"_strategies",
"(",
")",
"{",
"return",
"[",
"static",
"::",
"LINK_EMBEDDED",
"=>",
"function",
"(",
"$",
"object",
",",
"$",
"relationship",
")",
"{",
"$",
"fieldName",
"=",
"$",
"relationship",
"->",
"fieldName",
"(",
")",
";",
... | Strategies used to query related objects, indexed by key. | [
"Strategies",
"used",
"to",
"query",
"related",
"objects",
"indexed",
"by",
"key",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Relationship.php#L291-L315 |
UnionOfRAD/lithium | console/Command.php | Command._init | protected function _init() {
parent::_init();
$this->request = $this->_config['request'];
if (!is_object($this->request) || !$this->request->params) {
return;
}
$default = ['command' => null, 'action' => null, 'args' => null];
$params = array_diff_key((array) $this->request->params, $default);
foreac... | php | protected function _init() {
parent::_init();
$this->request = $this->_config['request'];
if (!is_object($this->request) || !$this->request->params) {
return;
}
$default = ['command' => null, 'action' => null, 'args' => null];
$params = array_diff_key((array) $this->request->params, $default);
foreac... | [
"protected",
"function",
"_init",
"(",
")",
"{",
"parent",
"::",
"_init",
"(",
")",
";",
"$",
"this",
"->",
"request",
"=",
"$",
"this",
"->",
"_config",
"[",
"'request'",
"]",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"request",
")... | Command Initializer.
Populates the `$response` property with a new instance of the `Response` class passing it
configuration and assigns the values from named parameters of the request (if applicable) to
properties of the command.
@return void | [
"Command",
"Initializer",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L105-L125 |
UnionOfRAD/lithium | console/Command.php | Command._help | protected function _help() {
$help = new Help([
'request' => $this->request,
'response' => $this->response,
'classes' => $this->_classes
]);
return $help->run(get_class($this));
} | php | protected function _help() {
$help = new Help([
'request' => $this->request,
'response' => $this->response,
'classes' => $this->_classes
]);
return $help->run(get_class($this));
} | [
"protected",
"function",
"_help",
"(",
")",
"{",
"$",
"help",
"=",
"new",
"Help",
"(",
"[",
"'request'",
"=>",
"$",
"this",
"->",
"request",
",",
"'response'",
"=>",
"$",
"this",
"->",
"response",
",",
"'classes'",
"=>",
"$",
"this",
"->",
"_classes",
... | Invokes the `Help` command.
The invoked Help command will take over request and response objects of
the originally invoked command. Thus the response of the Help command
becomes the response of the original one.
@return boolean | [
"Invokes",
"the",
"Help",
"command",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L162-L169 |
UnionOfRAD/lithium | console/Command.php | Command.out | public function out($output = null, $options = ['nl' => 1]) {
if ($this->silent) {
return;
}
return $this->_response('output', $output, $options);
} | php | public function out($output = null, $options = ['nl' => 1]) {
if ($this->silent) {
return;
}
return $this->_response('output', $output, $options);
} | [
"public",
"function",
"out",
"(",
"$",
"output",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"'nl'",
"=>",
"1",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"silent",
")",
"{",
"return",
";",
"}",
"return",
"$",
"this",
"->",
"_response",
"(",
... | Writes a string to the output stream.
@param string|array $output The string or an array of strings to write.
@param mixed $options When passed an integer or boolean it is used as the number of
of new lines, when passed a string it is interpreted as style
to use otherwise when an array following options are available:... | [
"Writes",
"a",
"string",
"to",
"the",
"output",
"stream",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L183-L188 |
UnionOfRAD/lithium | console/Command.php | Command.in | public function in($prompt = null, array $options = []) {
$defaults = ['choices' => null, 'default' => null, 'quit' => 'q'];
$options += $defaults;
$choices = null;
if (is_array($options['choices'])) {
$choices = '(' . implode('/', $options['choices']) . ')';
}
$default = $options['default'] ? "[{$optio... | php | public function in($prompt = null, array $options = []) {
$defaults = ['choices' => null, 'default' => null, 'quit' => 'q'];
$options += $defaults;
$choices = null;
if (is_array($options['choices'])) {
$choices = '(' . implode('/', $options['choices']) . ')';
}
$default = $options['default'] ? "[{$optio... | [
"public",
"function",
"in",
"(",
"$",
"prompt",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'choices'",
"=>",
"null",
",",
"'default'",
"=>",
"null",
",",
"'quit'",
"=>",
"'q'",
"]",
";",
"$",
"... | Handles input. Will continue to loop until `$options['quit']` or
result is part of `$options['choices']`.
@param string $prompt
@param array $options
@return string|boolean Returns the result of the input data. If the input is
equal to the `quit` option boolean `false` is returned. | [
"Handles",
"input",
".",
"Will",
"continue",
"to",
"loop",
"until",
"$options",
"[",
"quit",
"]",
"or",
"result",
"is",
"part",
"of",
"$options",
"[",
"choices",
"]",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L215-L243 |
UnionOfRAD/lithium | console/Command.php | Command.header | public function header($text, $line = null) {
if (!$line) {
$line = strlen($text);
}
$this->hr($line);
$this->out($text, 'heading');
$this->hr($line);
} | php | public function header($text, $line = null) {
if (!$line) {
$line = strlen($text);
}
$this->hr($line);
$this->out($text, 'heading');
$this->hr($line);
} | [
"public",
"function",
"header",
"(",
"$",
"text",
",",
"$",
"line",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"strlen",
"(",
"$",
"text",
")",
";",
"}",
"$",
"this",
"->",
"hr",
"(",
"$",
"line",
")",
"... | Writes a header to the output stream. In addition to the actual text,
horizontal lines before and afterwards are written. The lines will have
the same length as the text. This behavior can be modified by providing
the length of lines as a second paramerter.
Given the text `'Lithium'` this generates following output:
... | [
"Writes",
"a",
"header",
"to",
"the",
"output",
"stream",
".",
"In",
"addition",
"to",
"the",
"actual",
"text",
"horizontal",
"lines",
"before",
"and",
"afterwards",
"are",
"written",
".",
"The",
"lines",
"will",
"have",
"the",
"same",
"length",
"as",
"the... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L263-L270 |
UnionOfRAD/lithium | console/Command.php | Command.columns | public function columns($rows, $options = []) {
$defaults = ['separator' => "\t", "error" => false];
$options += $defaults;
$lengths = array_reduce($rows, function($columns, $row) {
foreach ((array) $row as $key => $val) {
if (!isset($columns[$key]) || strlen($val) > $columns[$key]) {
$columns[$key] =... | php | public function columns($rows, $options = []) {
$defaults = ['separator' => "\t", "error" => false];
$options += $defaults;
$lengths = array_reduce($rows, function($columns, $row) {
foreach ((array) $row as $key => $val) {
if (!isset($columns[$key]) || strlen($val) > $columns[$key]) {
$columns[$key] =... | [
"public",
"function",
"columns",
"(",
"$",
"rows",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'separator'",
"=>",
"\"\\t\"",
",",
"\"error\"",
"=>",
"false",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
... | Writes rows of columns.
This method expects asceding integer values as the keys, which map to the appropriate
columns. Currently, there is no special "header" option, but you can define them for your
own.
Example Usage:
```
$output = [
['Name', 'Age'],
['----', '---'],
];
foreach($users as $user) {
$output[] = [$use... | [
"Writes",
"rows",
"of",
"columns",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L312-L336 |
UnionOfRAD/lithium | console/Command.php | Command.stop | public function stop($status = 0, $message = null) {
if ($message) {
($status == 0) ? $this->out($message) : $this->error($message);
}
exit($status);
} | php | public function stop($status = 0, $message = null) {
if ($message) {
($status == 0) ? $this->out($message) : $this->error($message);
}
exit($status);
} | [
"public",
"function",
"stop",
"(",
"$",
"status",
"=",
"0",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"message",
")",
"{",
"(",
"$",
"status",
"==",
"0",
")",
"?",
"$",
"this",
"->",
"out",
"(",
"$",
"message",
")",
":",
"$"... | Stop execution, by exiting the script.
@param integer $status Numeric value that will be used on `exit()`.
@param string|null $message An optional message that will be written to the stream.
@return void | [
"Stop",
"execution",
"by",
"exiting",
"the",
"script",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L375-L380 |
UnionOfRAD/lithium | console/Command.php | Command._response | protected function _response($type, $string, $options) {
$defaults = ['nl' => 1, 'style' => null];
if (!is_array($options)) {
if (is_bool($options)) {
$options = ['nl' => (integer) $options];
} elseif (is_int($options)) {
$options = ['nl' => $options];
} elseif (is_string($options)) {
$options... | php | protected function _response($type, $string, $options) {
$defaults = ['nl' => 1, 'style' => null];
if (!is_array($options)) {
if (is_bool($options)) {
$options = ['nl' => (integer) $options];
} elseif (is_int($options)) {
$options = ['nl' => $options];
} elseif (is_string($options)) {
$options... | [
"protected",
"function",
"_response",
"(",
"$",
"type",
",",
"$",
"string",
",",
"$",
"options",
")",
"{",
"$",
"defaults",
"=",
"[",
"'nl'",
"=>",
"1",
",",
"'style'",
"=>",
"null",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
... | Handles the response that is sent to the stream.
@param string $type The stream either output or error.
@param string|array $string The message to render.
@param mixed $options When passed an integer or boolean it is used as the number of
of new lines, when passed a string it is interpreted as style
to use otherwise w... | [
"Handles",
"the",
"response",
"that",
"is",
"sent",
"to",
"the",
"stream",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Command.php#L395-L425 |
UnionOfRAD/lithium | action/Response.php | Response._init | protected function _init() {
parent::_init();
$router = $this->_classes['router'];
if ($this->_config['location']) {
$location = $router::match($this->_config['location'], $this->_config['request']);
$this->headers('Location', $location);
}
} | php | protected function _init() {
parent::_init();
$router = $this->_classes['router'];
if ($this->_config['location']) {
$location = $router::match($this->_config['location'], $this->_config['request']);
$this->headers('Location', $location);
}
} | [
"protected",
"function",
"_init",
"(",
")",
"{",
"parent",
"::",
"_init",
"(",
")",
";",
"$",
"router",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'router'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_config",
"[",
"'location'",
"]",
")",
"{",
"$",
... | Sets the Location header using `$config['location']` and `$config['request']` passed in
through the constructor if provided.
@return void | [
"Sets",
"the",
"Location",
"header",
"using",
"$config",
"[",
"location",
"]",
"and",
"$config",
"[",
"request",
"]",
"passed",
"in",
"through",
"the",
"constructor",
"if",
"provided",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L76-L84 |
UnionOfRAD/lithium | action/Response.php | Response.cache | public function cache($expires) {
if ($expires === false) {
$headers = [
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
'Cache-Control' => [
'no-store, no-cache, must-revalidate',
'post-check=0, pre-check=0',
'max-age=0'
],
'Pragma' => 'no-cache'
];
} else {
$expires = is_int(... | php | public function cache($expires) {
if ($expires === false) {
$headers = [
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
'Cache-Control' => [
'no-store, no-cache, must-revalidate',
'post-check=0, pre-check=0',
'max-age=0'
],
'Pragma' => 'no-cache'
];
} else {
$expires = is_int(... | [
"public",
"function",
"cache",
"(",
"$",
"expires",
")",
"{",
"if",
"(",
"$",
"expires",
"===",
"false",
")",
"{",
"$",
"headers",
"=",
"[",
"'Expires'",
"=>",
"'Mon, 26 Jul 1997 05:00:00 GMT'",
",",
"'Cache-Control'",
"=>",
"[",
"'no-store, no-cache, must-reval... | Controls how or whether the client browser and web proxies should cache this response.
@param mixed $expires This can be a Unix timestamp indicating when the page expires, or a
string indicating the relative time offset that a page should expire, i.e. `"+5 hours".
Finally, `$expires` can be set to `false` to completel... | [
"Controls",
"how",
"or",
"whether",
"the",
"client",
"browser",
"and",
"web",
"proxies",
"should",
"cache",
"this",
"response",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L95-L116 |
UnionOfRAD/lithium | action/Response.php | Response.type | public function type($type = null) {
if ($type === null && $this->_type === null) {
$type = 'html';
}
return parent::type($type);
} | php | public function type($type = null) {
if ($type === null && $this->_type === null) {
$type = 'html';
}
return parent::type($type);
} | [
"public",
"function",
"type",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
"&&",
"$",
"this",
"->",
"_type",
"===",
"null",
")",
"{",
"$",
"type",
"=",
"'html'",
";",
"}",
"return",
"parent",
"::",
"type",
"(",
... | Sets/Gets the content type. If `'type'` is null, the method will attempt to determine the
type from the params, then from the environment setting
@param string $type a full content type i.e. `'application/json'` or simple name `'json'`
@return string A simple content type name, i.e. `'html'`, `'xml'`, `'json'`, etc., ... | [
"Sets",
"/",
"Gets",
"the",
"content",
"type",
".",
"If",
"type",
"is",
"null",
"the",
"method",
"will",
"attempt",
"to",
"determine",
"the",
"type",
"from",
"the",
"params",
"then",
"from",
"the",
"environment",
"setting"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L126-L131 |
UnionOfRAD/lithium | action/Response.php | Response.render | public function render() {
$code = null;
if (isset($this->headers['location']) || isset($this->headers['Location'])) {
if ($this->status['code'] === 200) {
$this->status(302);
}
$code = $this->status['code'];
}
if ($cookies = $this->_cookies()) {
$this->headers('Set-Cookie', $cookies);
}
$t... | php | public function render() {
$code = null;
if (isset($this->headers['location']) || isset($this->headers['Location'])) {
if ($this->status['code'] === 200) {
$this->status(302);
}
$code = $this->status['code'];
}
if ($cookies = $this->_cookies()) {
$this->headers('Set-Cookie', $cookies);
}
$t... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"code",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"'location'",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"'Location'",
"]",
")",
")",
... | Render a response by writing headers and output. Output is echoed in
chunks because of an issue where `echo` time increases exponentially
on long message bodies.
Reponses which have a `Location` header set are indicating a
redirect, will get their status code automatically adjusted to `302`
(Found/Moved Temporarily) i... | [
"Render",
"a",
"response",
"by",
"writing",
"headers",
"and",
"output",
".",
"Output",
"is",
"echoed",
"in",
"chunks",
"because",
"of",
"an",
"issue",
"where",
"echo",
"time",
"increases",
"exponentially",
"on",
"long",
"message",
"bodies",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L151-L172 |
UnionOfRAD/lithium | action/Response.php | Response._writeHeaders | protected function _writeHeaders($headers, $code = null) {
foreach ((array) $headers as $header) {
$code ? header($header, false, $code) : header($header, false);
}
} | php | protected function _writeHeaders($headers, $code = null) {
foreach ((array) $headers as $header) {
$code ? header($header, false, $code) : header($header, false);
}
} | [
"protected",
"function",
"_writeHeaders",
"(",
"$",
"headers",
",",
"$",
"code",
"=",
"null",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"headers",
"as",
"$",
"header",
")",
"{",
"$",
"code",
"?",
"header",
"(",
"$",
"header",
",",
"false",
... | Writes raw headers to output.
@param string|array $headers Either a raw header string, or an array of header strings. Use
an array if a single header must be written multiple times with different values.
Otherwise, additional values for duplicate headers will overwrite previous values.
@param integer $code Optional. I... | [
"Writes",
"raw",
"headers",
"to",
"output",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L195-L199 |
UnionOfRAD/lithium | action/Response.php | Response.headers | public function headers($key = null, $value = null, $replace = true) {
if ($key === 'download' || $key === 'Download') {
$message = "Shorthand header `Download` with `<FILENAME>` has been deprecated ";
$message .= "because it's too magic. Please use `Content-Disposition` ";
$message .= "with `attachment; fi... | php | public function headers($key = null, $value = null, $replace = true) {
if ($key === 'download' || $key === 'Download') {
$message = "Shorthand header `Download` with `<FILENAME>` has been deprecated ";
$message .= "because it's too magic. Please use `Content-Disposition` ";
$message .= "with `attachment; fi... | [
"public",
"function",
"headers",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"replace",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"'download'",
"||",
"$",
"key",
"===",
"'Download'",
")",
"{",
"$",
"message",
... | Expands on `\net\http\Message::headers()` with some magic conversions for shorthand headers.
@deprecated This method will be removed in a future version. Note that the parent `header()`
wil continue to exist.
@param string|array $key
@param mixed $value
@param boolean $replace
@return mixed | [
"Expands",
"on",
"\\",
"net",
"\\",
"http",
"\\",
"Message",
"::",
"headers",
"()",
"with",
"some",
"magic",
"conversions",
"for",
"shorthand",
"headers",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Response.php#L213-L224 |
UnionOfRAD/lithium | data/Schema.php | Schema.is | public function is($condition, $field) {
if (!isset($this->_fields[$field])) {
return null;
}
return isset($this->_fields[$field][$condition]) && $this->_fields[$field][$condition];
} | php | public function is($condition, $field) {
if (!isset($this->_fields[$field])) {
return null;
}
return isset($this->_fields[$field][$condition]) && $this->_fields[$field][$condition];
} | [
"public",
"function",
"is",
"(",
"$",
"condition",
",",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_fields",
"[",
"$",
"field",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
... | Detects properties of a field, i.e. if it supports arrays.
@param string $condition
@param string $field
@return boolean | [
"Detects",
"properties",
"of",
"a",
"field",
"i",
".",
"e",
".",
"if",
"it",
"supports",
"arrays",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/Schema.php#L113-L118 |
UnionOfRAD/lithium | analysis/logger/adapter/Syslog.php | Syslog.write | public function write($priority, $message) {
$config = $this->_config;
if (!$this->_isConnected) {
closelog();
openlog($config['identity'], $config['options'], $config['facility']);
$this->_isConnected = true;
}
return function($params) {
$priority = $this->_priorities[$params['priority']];
ret... | php | public function write($priority, $message) {
$config = $this->_config;
if (!$this->_isConnected) {
closelog();
openlog($config['identity'], $config['options'], $config['facility']);
$this->_isConnected = true;
}
return function($params) {
$priority = $this->_priorities[$params['priority']];
ret... | [
"public",
"function",
"write",
"(",
"$",
"priority",
",",
"$",
"message",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"_config",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_isConnected",
")",
"{",
"closelog",
"(",
")",
";",
"openlog",
"(",
"$",
... | Appends `$message` to the system log.
@param string $priority The message priority string. Maps to a `syslogd` priority constant.
@param string $message The message to write.
@return \Closure Function returning boolean `true` on successful write, `false` otherwise. | [
"Appends",
"$message",
"to",
"the",
"system",
"log",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/logger/adapter/Syslog.php#L71-L84 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.paths | public static function paths($path = null) {
if (empty($path)) {
return static::$_paths;
}
if (is_string($path)) {
return isset(static::$_paths[$path]) ? static::$_paths[$path] : null;
}
static::$_paths = array_filter(array_merge(static::$_paths, (array) $path));
} | php | public static function paths($path = null) {
if (empty($path)) {
return static::$_paths;
}
if (is_string($path)) {
return isset(static::$_paths[$path]) ? static::$_paths[$path] : null;
}
static::$_paths = array_filter(array_merge(static::$_paths, (array) $path));
} | [
"public",
"static",
"function",
"paths",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"static",
"::",
"$",
"_paths",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"path",
")",
")",
"{",
"... | Accessor method for the class path templates which `Libraries` uses to look up and load
classes. Using this method, you can define your own types of classes, or modify the default
organization of built-in class types.
For example, in a queuing application, you can define a class type called `'job'`:
```
Libraries::pat... | [
"Accessor",
"method",
"for",
"the",
"class",
"path",
"templates",
"which",
"Libraries",
"uses",
"to",
"look",
"up",
"and",
"load",
"classes",
".",
"Using",
"this",
"method",
"you",
"can",
"define",
"your",
"own",
"types",
"of",
"classes",
"or",
"modify",
"... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L216-L224 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.add | public static function add($name, array $config = []) {
$defaults = [
'name' => $name,
'path' => null,
'prefix' => $name . "\\",
'suffix' => '.php',
'loader' => null,
'includePath' => false,
'transform' => null,
'bootstrap' => true,
'defer' => false,
'default' => false
];
if ($name =... | php | public static function add($name, array $config = []) {
$defaults = [
'name' => $name,
'path' => null,
'prefix' => $name . "\\",
'suffix' => '.php',
'loader' => null,
'includePath' => false,
'transform' => null,
'bootstrap' => true,
'defer' => false,
'default' => false
];
if ($name =... | [
"public",
"static",
"function",
"add",
"(",
"$",
"name",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'path'",
"=>",
"null",
",",
"'prefix'",
"=>",
"$",
"name",
".",
"\"\\\\\"",... | Adds a class library from which files can be loaded.
The `add()` method registers a named library configuration to your application, and is used
to allow the framework to auto-load classes on an as-needed basis.
### Adding libraries to your application
In Lithium, libraries represent the broadest unit of class organ... | [
"Adds",
"a",
"class",
"library",
"from",
"which",
"files",
"can",
"be",
"loaded",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L271-L306 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._configure | protected static function _configure($config) {
if ($config['includePath']) {
$path = ($config['includePath'] === true) ? $config['path'] : $config['includePath'];
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
}
if ($config['bootstrap'] === true) {
$path = "{$config['path']}/config/boots... | php | protected static function _configure($config) {
if ($config['includePath']) {
$path = ($config['includePath'] === true) ? $config['path'] : $config['includePath'];
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
}
if ($config['bootstrap'] === true) {
$path = "{$config['path']}/config/boots... | [
"protected",
"static",
"function",
"_configure",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"config",
"[",
"'includePath'",
"]",
")",
"{",
"$",
"path",
"=",
"(",
"$",
"config",
"[",
"'includePath'",
"]",
"===",
"true",
")",
"?",
"$",
"config",
"["... | Configures the application environment based on a library's settings, including appending to
the include path, loading a bootstrap file, and registering a loader with SPL's autoloading
system.
@param array $config The new library's configuration array.
@return void | [
"Configures",
"the",
"application",
"environment",
"based",
"on",
"a",
"library",
"s",
"settings",
"including",
"appending",
"to",
"the",
"include",
"path",
"loading",
"a",
"bootstrap",
"file",
"and",
"registering",
"a",
"loader",
"with",
"SPL",
"s",
"autoloadin... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L316-L331 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.get | public static function get($name = null, $key = null) {
$configs = static::$_configurations;
if (!$name && !$key) {
return $configs;
}
if ($name === true) {
$name = static::$_default;
}
if (is_array($name) || (!$name && $key)) {
$name = $name ?: array_keys(static::$_configurations);
$call = [ge... | php | public static function get($name = null, $key = null) {
$configs = static::$_configurations;
if (!$name && !$key) {
return $configs;
}
if ($name === true) {
$name = static::$_default;
}
if (is_array($name) || (!$name && $key)) {
$name = $name ?: array_keys(static::$_configurations);
$call = [ge... | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"configs",
"=",
"static",
"::",
"$",
"_configurations",
";",
"if",
"(",
"!",
"$",
"name",
"&&",
"!",
"$",
"key",
")",
"{",
"return"... | Allows library information to be retrieved in various ways, including:
By name:
``` embed:lithium\tests\cases\core\LibrariesTest::testLibraryConfigAccess(1-1) ```
With no parameters, to return all configuration for all libraries:
``` embed:lithium\tests\cases\core\LibrariesTest::testLibraryConfigAccess(22-22) ```
By... | [
"Allows",
"library",
"information",
"to",
"be",
"retrieved",
"in",
"various",
"ways",
"including",
":"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L361-L388 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.remove | public static function remove($name) {
foreach ((array) $name as $library) {
if (isset(static::$_configurations[$library])) {
if (static::$_configurations[$library]['loader']) {
spl_autoload_unregister(static::$_configurations[$library]['loader']);
}
unset(static::$_configurations[$library]);
}... | php | public static function remove($name) {
foreach ((array) $name as $library) {
if (isset(static::$_configurations[$library])) {
if (static::$_configurations[$library]['loader']) {
spl_autoload_unregister(static::$_configurations[$library]['loader']);
}
unset(static::$_configurations[$library]);
}... | [
"public",
"static",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"name",
"as",
"$",
"library",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"_configurations",
"[",
"$",
"library",
"]",
")",
")... | Removes a registered library, and unregister's the library's autoloader, if it has one.
@param mixed $name A string or array of library names indicating the libraries you wish to
remove, i.e. `'app'` or `'lithium'`. This can also be used to unload plugins by name. | [
"Removes",
"a",
"registered",
"library",
"and",
"unregister",
"s",
"the",
"library",
"s",
"autoloader",
"if",
"it",
"has",
"one",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L396-L405 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.find | public static function find($library, array $options = []) {
$format = function($file, $config) {
$trim = [strlen($config['path']) + 1, strlen($config['suffix'])];
$rTrim = strpos($file, $config['suffix']) !== false ? -$trim[1] : 9999;
$file = preg_split('/[\/\\\\]/', substr($file, $trim[0], $rTrim));
ret... | php | public static function find($library, array $options = []) {
$format = function($file, $config) {
$trim = [strlen($config['path']) + 1, strlen($config['suffix'])];
$rTrim = strpos($file, $config['suffix']) !== false ? -$trim[1] : 9999;
$file = preg_split('/[\/\\\\]/', substr($file, $trim[0], $rTrim));
ret... | [
"public",
"static",
"function",
"find",
"(",
"$",
"library",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"format",
"=",
"function",
"(",
"$",
"file",
",",
"$",
"config",
")",
"{",
"$",
"trim",
"=",
"[",
"strlen",
"(",
"$",
"config... | Finds the classes or namespaces belonging to a particular library. _Note_: This method
assumes loaded class libraries use a consistent class-to-file naming convention.
@param mixed $library The name of a library added to the application with `Libraries::add()`,
or `true` to search all libraries.
@param array $options ... | [
"Finds",
"the",
"classes",
"or",
"namespaces",
"belonging",
"to",
"a",
"particular",
"library",
".",
"_Note_",
":",
"This",
"method",
"assumes",
"loaded",
"class",
"libraries",
"use",
"a",
"consistent",
"class",
"-",
"to",
"-",
"file",
"naming",
"convention",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L433-L476 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.load | public static function load($class, $require = false) {
$path = isset(static::$_cachedPaths[$class]) ? static::$_cachedPaths[$class] : null;
$path = $path ?: static::path($class);
if ($path && include $path) {
static::$_cachedPaths[$class] = $path;
if (method_exists($class, '__init')) {
$message = "S... | php | public static function load($class, $require = false) {
$path = isset(static::$_cachedPaths[$class]) ? static::$_cachedPaths[$class] : null;
$path = $path ?: static::path($class);
if ($path && include $path) {
static::$_cachedPaths[$class] = $path;
if (method_exists($class, '__init')) {
$message = "S... | [
"public",
"static",
"function",
"load",
"(",
"$",
"class",
",",
"$",
"require",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"isset",
"(",
"static",
"::",
"$",
"_cachedPaths",
"[",
"$",
"class",
"]",
")",
"?",
"static",
"::",
"$",
"_cachedPaths",
"[",
... | Loads the class definition specified by `$class`. Looks through the list of libraries
defined in `$_configurations`, which are added through `lithium\core\Libraries::add()`.
@see lithium\core\Libraries::add()
@see lithium\core\Libraries::path()
@param string $class The fully-namespaced (where applicable) name of the c... | [
"Loads",
"the",
"class",
"definition",
"specified",
"by",
"$class",
".",
"Looks",
"through",
"the",
"list",
"of",
"libraries",
"defined",
"in",
"$_configurations",
"which",
"are",
"added",
"through",
"lithium",
"\\",
"core",
"\\",
"Libraries",
"::",
"add",
"()... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L489-L507 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.map | public static function map(array $classes) {
foreach ($classes as $key => $value) {
unset(static::$_cachedPaths[$key]);
}
static::$_map = array_merge(static::$_map, $classes);
} | php | public static function map(array $classes) {
foreach ($classes as $key => $value) {
unset(static::$_cachedPaths[$key]);
}
static::$_map = array_merge(static::$_map, $classes);
} | [
"public",
"static",
"function",
"map",
"(",
"array",
"$",
"classes",
")",
"{",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"unset",
"(",
"static",
"::",
"$",
"_cachedPaths",
"[",
"$",
"key",
"]",
")",
";",
"}",
... | Associtates fully-namespaced class names to their corresponding paths on
the file system.
Once a class is associtated to a path using `lithium\core\Libraries::map()`
the PSR-0 loader or custom class loader setted using the `transform` or `loader`
option of `lithium\core\Libraries::add()` are ignored and the associtate... | [
"Associtates",
"fully",
"-",
"namespaced",
"class",
"names",
"to",
"their",
"corresponding",
"paths",
"on",
"the",
"file",
"system",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L522-L527 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.unmap | public static function unmap($classes) {
if (!is_array($classes)) {
$classes = [$classes];
}
foreach ($classes as $value) {
unset(static::$_map[$value]);
}
} | php | public static function unmap($classes) {
if (!is_array($classes)) {
$classes = [$classes];
}
foreach ($classes as $value) {
unset(static::$_map[$value]);
}
} | [
"public",
"static",
"function",
"unmap",
"(",
"$",
"classes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"[",
"$",
"classes",
"]",
";",
"}",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"value",
"... | Unmap fully-namespaced class names mapped using `lithium\core\Libraries::map()`.
@see lithium\core\Libraries::map()
@param mixed $classes An array of fully-namespaced class names or
a string with a fully-namespaced class name. | [
"Unmap",
"fully",
"-",
"namespaced",
"class",
"names",
"mapped",
"using",
"lithium",
"\\",
"core",
"\\",
"Libraries",
"::",
"map",
"()",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L536-L543 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.path | public static function path($class, array $options = []) {
$defaults = ['dirs' => false];
$options += $defaults;
$class = ltrim($class, '\\');
if (isset(static::$_cachedPaths[$class]) && !$options['dirs']) {
return static::$_cachedPaths[$class];
}
if (isset(static::$_map[$class]) && !$options['dirs']) {... | php | public static function path($class, array $options = []) {
$defaults = ['dirs' => false];
$options += $defaults;
$class = ltrim($class, '\\');
if (isset(static::$_cachedPaths[$class]) && !$options['dirs']) {
return static::$_cachedPaths[$class];
}
if (isset(static::$_map[$class]) && !$options['dirs']) {... | [
"public",
"static",
"function",
"path",
"(",
"$",
"class",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'dirs'",
"=>",
"false",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"class",
"=",
"ltrim",
... | Get the corresponding physical file path for a class or namespace name.
@param string $class The class name to locate the physical file for. If `$options['dirs']` is
set to `true`, `$class` may also be a namespace name, in which case the corresponding
directory will be located.
@param array $options Options for conver... | [
"Get",
"the",
"corresponding",
"physical",
"file",
"path",
"for",
"a",
"class",
"or",
"namespace",
"name",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L558-L596 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.realPath | public static function realPath($path) {
if (($absolutePath = realpath($path)) !== false) {
return $absolutePath;
}
if (!preg_match('%^phar://([^.]+\.phar(?:\.gz)?)(.+)%', $path, $pathComponents)) {
return;
}
list(, $relativePath, $pharPath) = $pathComponents;
$pharPath = implode('/', array_reduce(ex... | php | public static function realPath($path) {
if (($absolutePath = realpath($path)) !== false) {
return $absolutePath;
}
if (!preg_match('%^phar://([^.]+\.phar(?:\.gz)?)(.+)%', $path, $pathComponents)) {
return;
}
list(, $relativePath, $pharPath) = $pathComponents;
$pharPath = implode('/', array_reduce(ex... | [
"public",
"static",
"function",
"realPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"(",
"$",
"absolutePath",
"=",
"realpath",
"(",
"$",
"path",
")",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"absolutePath",
";",
"}",
"if",
"(",
"!",
"preg_match",... | Wraps the PHP `realpath()` function to add support for finding paths to files inside Phar
archives.
@param string $path An unresolved path to a file inside a Phar archive which may or may not
exist.
@return string If `$path` is a valid path to a file inside a Phar archive, returns a string
in the format `'phar://<path... | [
"Wraps",
"the",
"PHP",
"realpath",
"()",
"function",
"to",
"add",
"support",
"for",
"finding",
"paths",
"to",
"files",
"inside",
"Phar",
"archives",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L608-L631 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._transformPath | protected static function _transformPath($transform, $class, array $options = []) {
if ((is_callable($transform)) && $file = $transform($class, $options)) {
return $file;
}
if (is_array($transform)) {
list($match, $replace) = $transform;
return preg_replace($match, $replace, $class) ?: null;
}
} | php | protected static function _transformPath($transform, $class, array $options = []) {
if ((is_callable($transform)) && $file = $transform($class, $options)) {
return $file;
}
if (is_array($transform)) {
list($match, $replace) = $transform;
return preg_replace($match, $replace, $class) ?: null;
}
} | [
"protected",
"static",
"function",
"_transformPath",
"(",
"$",
"transform",
",",
"$",
"class",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"(",
"is_callable",
"(",
"$",
"transform",
")",
")",
"&&",
"$",
"file",
"=",
"$",
"transf... | Handles the conversion of a class name to a file name using a custom transformation typically
defined in the `'transform'` key of a configuration defined through `Libraries::add()`.
The transformation can either be a closure which receives two parameters (the class name
as a string, and the library configuration as an... | [
"Handles",
"the",
"conversion",
"of",
"a",
"class",
"name",
"to",
"a",
"file",
"name",
"using",
"a",
"custom",
"transformation",
"typically",
"defined",
"in",
"the",
"transform",
"key",
"of",
"a",
"configuration",
"defined",
"through",
"Libraries",
"::",
"add"... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L652-L660 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.instance | public static function instance($type, $name, array $options = []) {
$params = compact('type', 'name', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$name = $params['name'];
$type = $params['type'];
if (!$name && !$type) {
$message = "Invalid class loo... | php | public static function instance($type, $name, array $options = []) {
$params = compact('type', 'name', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$name = $params['name'];
$type = $params['type'];
if (!$name && !$type) {
$message = "Invalid class loo... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"type",
",",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'type'",
",",
"'name'",
",",
"'options'",
")",
";",
"return",
"Filters",
"::",... | Uses service location (i.e. `Libraries::locate()`) to look up a named class of a particular
type, and creates an instance of it, and passes an array of parameters to the constructor.
If the given class can't be found, an exception is thrown.
@param string $type The type of class as defined by `Libraries::$_paths`.
@p... | [
"Uses",
"service",
"location",
"(",
"i",
".",
"e",
".",
"Libraries",
"::",
"locate",
"()",
")",
"to",
"look",
"up",
"a",
"named",
"class",
"of",
"a",
"particular",
"type",
"and",
"creates",
"an",
"instance",
"of",
"it",
"and",
"passes",
"an",
"array",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L676-L701 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.locate | public static function locate($type, $name = null, array $options = []) {
if (is_object($name) || strpos($name, '\\') !== false) {
return $name;
}
$ident = $name ? ($type . '.' . $name) : ($type . '.*');
$ident .= $options ? '.' . md5(serialize($options)) : null;
if (isset(static::$_cachedPaths[$ident]))... | php | public static function locate($type, $name = null, array $options = []) {
if (is_object($name) || strpos($name, '\\') !== false) {
return $name;
}
$ident = $name ? ($type . '.' . $name) : ($type . '.*');
$ident .= $options ? '.' . md5(serialize($options)) : null;
if (isset(static::$_cachedPaths[$ident]))... | [
"public",
"static",
"function",
"locate",
"(",
"$",
"type",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"name",
")",
"||",
"strpos",
"(",
"$",
"name",
",",
"'\\\\'",
")",... | Performs service location for an object of a specific type. If `$name` is a string, finds the
first instance of a class with the given name in any registered library (i.e. apps, plugins
or vendor libraries registered via `Libraries::add()`), based on each library's order of
precedence. For example, this will find the f... | [
"Performs",
"service",
"location",
"for",
"an",
"object",
"of",
"a",
"specific",
"type",
".",
"If",
"$name",
"is",
"a",
"string",
"finds",
"the",
"first",
"instance",
"of",
"a",
"class",
"with",
"the",
"given",
"name",
"in",
"any",
"registered",
"library",... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L761-L796 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.cache | public static function cache($cache = null) {
if ($cache === false) {
static::$_cachedPaths = [];
}
if (is_array($cache)) {
static::$_cachedPaths += $cache;
}
return static::$_cachedPaths;
} | php | public static function cache($cache = null) {
if ($cache === false) {
static::$_cachedPaths = [];
}
if (is_array($cache)) {
static::$_cachedPaths += $cache;
}
return static::$_cachedPaths;
} | [
"public",
"static",
"function",
"cache",
"(",
"$",
"cache",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"cache",
"===",
"false",
")",
"{",
"static",
"::",
"$",
"_cachedPaths",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"cache",
")",
")"... | Returns or sets the the class path cache used for mapping class names to file paths, or
locating classes using `Libraries::locate()`.
@param array $cache An array of keys and values to use when pre-populating the cache. Keys
are either class names (which match to file paths as values), or dot-separated
lookup paths us... | [
"Returns",
"or",
"sets",
"the",
"the",
"class",
"path",
"cache",
"used",
"for",
"mapping",
"class",
"names",
"to",
"file",
"paths",
"or",
"locating",
"classes",
"using",
"Libraries",
"::",
"locate",
"()",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L809-L817 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._locateDeferred | protected static function _locateDeferred($defer, $paths, $params, array $options = []) {
$libraries = static::$_configurations;
if (isset($options['library'])) {
$libraries = static::get((array) $options['library']);
}
foreach ($libraries as $library => $config) {
if ($config['defer'] !== $defer && $def... | php | protected static function _locateDeferred($defer, $paths, $params, array $options = []) {
$libraries = static::$_configurations;
if (isset($options['library'])) {
$libraries = static::get((array) $options['library']);
}
foreach ($libraries as $library => $config) {
if ($config['defer'] !== $defer && $def... | [
"protected",
"static",
"function",
"_locateDeferred",
"(",
"$",
"defer",
",",
"$",
"paths",
",",
"$",
"params",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"libraries",
"=",
"static",
"::",
"$",
"_configurations",
";",
"if",
"(",
"isset... | Performs service location lookups by library, based on the library's `'defer'` flag.
Libraries with `'defer'` set to `true` will be searched last when looking up services.
@see lithium\core\Libraries::$_paths
@see lithium\core\Libraries::locate()
@param boolean|null $defer A boolean flag indicating which libraries to ... | [
"Performs",
"service",
"location",
"lookups",
"by",
"library",
"based",
"on",
"the",
"library",
"s",
"defer",
"flag",
".",
"Libraries",
"with",
"defer",
"set",
"to",
"true",
"will",
"be",
"searched",
"last",
"when",
"looking",
"up",
"services",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L837-L857 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._searchPaths | protected static function _searchPaths($paths, $library) {
$result = [];
foreach ($paths as $tpl => $opts) {
if (is_int($tpl)) {
$tpl = $opts;
$opts = [];
}
if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
continue;
}
$result[] = $tpl;
}
return $res... | php | protected static function _searchPaths($paths, $library) {
$result = [];
foreach ($paths as $tpl => $opts) {
if (is_int($tpl)) {
$tpl = $opts;
$opts = [];
}
if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
continue;
}
$result[] = $tpl;
}
return $res... | [
"protected",
"static",
"function",
"_searchPaths",
"(",
"$",
"paths",
",",
"$",
"library",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"tpl",
"=>",
"$",
"opts",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"t... | Returns the list of valid search path templates for the given service location lookup.
@see lithium\core\Libraries::$_paths
@see lithium\core\Libraries::_search()
@param array $paths The list of all possible path templates from `Libraries::$_paths`.
@param string $library The name of the library being searched.
@retur... | [
"Returns",
"the",
"list",
"of",
"valid",
"search",
"path",
"templates",
"for",
"the",
"given",
"service",
"location",
"lookup",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L868-L882 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._locateAll | protected static function _locateAll(array $params, array $options = []) {
$defaults = ['libraries' => null, 'recursive' => true, 'namespaces' => false];
$options += $defaults;
$paths = (array) static::$_paths[$params['type']];
$libraries = $options['library'] ? $options['library'] : $options['libraries'];
$... | php | protected static function _locateAll(array $params, array $options = []) {
$defaults = ['libraries' => null, 'recursive' => true, 'namespaces' => false];
$options += $defaults;
$paths = (array) static::$_paths[$params['type']];
$libraries = $options['library'] ? $options['library'] : $options['libraries'];
$... | [
"protected",
"static",
"function",
"_locateAll",
"(",
"array",
"$",
"params",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'libraries'",
"=>",
"null",
",",
"'recursive'",
"=>",
"true",
",",
"'namespaces'",
"=>",
"fal... | Locates all possible classes for given set of parameters.
@param array $params
@param array $options
@return array | [
"Locates",
"all",
"possible",
"classes",
"for",
"given",
"set",
"of",
"parameters",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L891-L911 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._locatePath | protected static function _locatePath($type, $params) {
if (!isset(static::$_paths[$type])) {
return null;
}
$params += ['app' => LITHIUM_APP_PATH, 'root' => LITHIUM_LIBRARY_PATH];
foreach (static::$_paths[$type] as $path) {
if (is_dir($path = str_replace('\\', '/', Text::insert($path, $params)))) {
... | php | protected static function _locatePath($type, $params) {
if (!isset(static::$_paths[$type])) {
return null;
}
$params += ['app' => LITHIUM_APP_PATH, 'root' => LITHIUM_LIBRARY_PATH];
foreach (static::$_paths[$type] as $path) {
if (is_dir($path = str_replace('\\', '/', Text::insert($path, $params)))) {
... | [
"protected",
"static",
"function",
"_locatePath",
"(",
"$",
"type",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"_paths",
"[",
"$",
"type",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"params",
"+=",
... | Helper function for returning known paths given a certain type.
@see lithium\core\Libraries::$_paths
@param string $type Path type (specified in `Libraries::$_paths`).
@param array $params Path parameters.
@return string|null Valid path name or `null` when no of path of given tpe is set. | [
"Helper",
"function",
"for",
"returning",
"known",
"paths",
"given",
"a",
"certain",
"type",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L921-L932 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._search | protected static function _search($config, $options, $name = null) {
$defaults = [
'path' => null,
'suffix' => null,
'namespaces' => false,
'recursive' => false,
'preFilter' => '/[A-Z][A-Za-z0-9]+\./',
'filter' => false,
'exclude' => false,
'format' => function ($file, $config) {
$trim = [... | php | protected static function _search($config, $options, $name = null) {
$defaults = [
'path' => null,
'suffix' => null,
'namespaces' => false,
'recursive' => false,
'preFilter' => '/[A-Z][A-Za-z0-9]+\./',
'filter' => false,
'exclude' => false,
'format' => function ($file, $config) {
$trim = [... | [
"protected",
"static",
"function",
"_search",
"(",
"$",
"config",
",",
"$",
"options",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"defaults",
"=",
"[",
"'path'",
"=>",
"null",
",",
"'suffix'",
"=>",
"null",
",",
"'namespaces'",
"=>",
"false",
",",
... | Search file system.
@param string $config
@param array $options
@param string $name
@return array | [
"Search",
"file",
"system",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L942-L994 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._filter | protected static function _filter($libs, array $config, array $options = []) {
if (is_callable($options['format'])) {
foreach ($libs as $i => $file) {
$libs[$i] = $options['format']($file, $config);
}
$libs = $options['name'] ? preg_grep("/{$options['name']}$/", $libs) : $libs;
}
if ($exclude = $opti... | php | protected static function _filter($libs, array $config, array $options = []) {
if (is_callable($options['format'])) {
foreach ($libs as $i => $file) {
$libs[$i] = $options['format']($file, $config);
}
$libs = $options['name'] ? preg_grep("/{$options['name']}$/", $libs) : $libs;
}
if ($exclude = $opti... | [
"protected",
"static",
"function",
"_filter",
"(",
"$",
"libs",
",",
"array",
"$",
"config",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"options",
"[",
"'format'",
"]",
")",
")",
"{",
"foreach",
"(",
... | Filters a list of library search results by the given set of options.
@param array $libs List of found libraries.
@param array $config The configuration of the library currently being searched within.
@param array $options The options used to filter/format `$libs`.
@return array Returns a copy of `$libs`, filtered and... | [
"Filters",
"a",
"list",
"of",
"library",
"search",
"results",
"by",
"the",
"given",
"set",
"of",
"options",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L1005-L1027 |
UnionOfRAD/lithium | core/Libraries.php | Libraries._params | protected static function _params($type, $name = "*") {
if (!$name) {
$name = '*';
}
$library = $namespace = $class = '*';
if (strpos($type, '.') !== false) {
$parts = explode('.', $type);
$type = array_shift($parts);
switch (count($parts)) {
case 1:
list($class) = $parts;
break;
... | php | protected static function _params($type, $name = "*") {
if (!$name) {
$name = '*';
}
$library = $namespace = $class = '*';
if (strpos($type, '.') !== false) {
$parts = explode('.', $type);
$type = array_shift($parts);
switch (count($parts)) {
case 1:
list($class) = $parts;
break;
... | [
"protected",
"static",
"function",
"_params",
"(",
"$",
"type",
",",
"$",
"name",
"=",
"\"*\"",
")",
"{",
"if",
"(",
"!",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"'*'",
";",
"}",
"$",
"library",
"=",
"$",
"namespace",
"=",
"$",
"class",
"=",
"... | Get params from type.
@param string $type
@param string $name default: '*'
@return array type, namespace, class, name | [
"Get",
"params",
"from",
"type",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L1036-L1066 |
UnionOfRAD/lithium | core/Libraries.php | Libraries.applyFilter | public static function applyFilter($method, $filter = null) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::apply()` and `::clear()`.';
trigger_error($message, E_USER_DEPRECATED);
$class = get_called_class();
if ($method === false) {
Filters::c... | php | public static function applyFilter($method, $filter = null) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::apply()` and `::clear()`.';
trigger_error($message, E_USER_DEPRECATED);
$class = get_called_class();
if ($method === false) {
Filters::c... | [
"public",
"static",
"function",
"applyFilter",
"(",
"$",
"method",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"'`'",
".",
"__METHOD__",
".",
"'()` has been deprecated in favor of '",
";",
"$",
"message",
".=",
"'`\\lithium\\aop\\Filters::apply... | Apply a closure to a method in `Libraries`.
@deprecated Replaced by `\lithium\aop\Filters::apply()` and `::clear()`.
@see lithium\util\collection\Filters
@param string $method The name of the method to apply the closure to.
@param Closure $filter The closure that is used to filter the method.
@return void | [
"Apply",
"a",
"closure",
"to",
"a",
"method",
"in",
"Libraries",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/core/Libraries.php#L1087-L1105 |
UnionOfRAD/lithium | util/Validator.php | Validator.reset | public static function reset() {
$alnum = '[A-Fa-f0-9]';
$class = get_called_class();
Filters::clear($class);
static::$_rules = [
'alphaNumeric' => '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu',
'blank' => '/[^\\s]/',
'creditCard' => [
'amex' => '/^3[4|7]\\d{13}$/',
'bankcard' =... | php | public static function reset() {
$alnum = '[A-Fa-f0-9]';
$class = get_called_class();
Filters::clear($class);
static::$_rules = [
'alphaNumeric' => '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu',
'blank' => '/[^\\s]/',
'creditCard' => [
'amex' => '/^3[4|7]\\d{13}$/',
'bankcard' =... | [
"public",
"static",
"function",
"reset",
"(",
")",
"{",
"$",
"alnum",
"=",
"'[A-Fa-f0-9]'",
";",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"Filters",
"::",
"clear",
"(",
"$",
"class",
")",
";",
"static",
"::",
"$",
"_rules",
"=",
"[",
"'a... | Initializes the list of default validation rules. | [
"Initializes",
"the",
"list",
"of",
"default",
"validation",
"rules",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L177-L372 |
UnionOfRAD/lithium | util/Validator.php | Validator.respondsTo | public static function respondsTo($method, $internal = false) {
$rule = preg_replace("/^is([A-Z][A-Za-z0-9]+)$/", '$1', $method);
$rule[0] = strtolower($rule[0]);
return isset(static::$_rules[$rule]) || parent::respondsTo($method, $internal);
} | php | public static function respondsTo($method, $internal = false) {
$rule = preg_replace("/^is([A-Z][A-Za-z0-9]+)$/", '$1', $method);
$rule[0] = strtolower($rule[0]);
return isset(static::$_rules[$rule]) || parent::respondsTo($method, $internal);
} | [
"public",
"static",
"function",
"respondsTo",
"(",
"$",
"method",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"$",
"rule",
"=",
"preg_replace",
"(",
"\"/^is([A-Z][A-Za-z0-9]+)$/\"",
",",
"'$1'",
",",
"$",
"method",
")",
";",
"$",
"rule",
"[",
"0",
"]",... | Determines if a given method can be called.
@param string $method Name of the method.
@param boolean $internal Provide `true` to perform check from inside the
class/object. When `false` checks also for public visibility;
defaults to `false`.
@return boolean Returns `true` if the method can be called, `false` otherwise... | [
"Determines",
"if",
"a",
"given",
"method",
"can",
"be",
"called",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L402-L406 |
UnionOfRAD/lithium | util/Validator.php | Validator.check | public static function check(array $values, array $rules, array $options = []) {
$defaults = [
'notEmpty',
'message' => null,
'required' => true,
'skipEmpty' => false,
'format' => 'any',
'on' => null,
'last' => false
];
$options += $defaults;
$params = compact('values', 'rules', 'options')... | php | public static function check(array $values, array $rules, array $options = []) {
$defaults = [
'notEmpty',
'message' => null,
'required' => true,
'skipEmpty' => false,
'format' => 'any',
'on' => null,
'last' => false
];
$options += $defaults;
$params = compact('values', 'rules', 'options')... | [
"public",
"static",
"function",
"check",
"(",
"array",
"$",
"values",
",",
"array",
"$",
"rules",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'notEmpty'",
",",
"'message'",
"=>",
"null",
",",
"'required'",
"=>",
... | Checks a set of values against a specified rules list. This method may be used to validate
any arbitrary array of data against a set of validation rules.
@param array $values An array of key/value pairs, where the values are to be checked.
@param array $rules An array of rules to check the values in `$values` against.... | [
"Checks",
"a",
"set",
"of",
"values",
"against",
"a",
"specified",
"rules",
"list",
".",
"This",
"method",
"may",
"be",
"used",
"to",
"validate",
"any",
"arbitrary",
"array",
"of",
"data",
"against",
"a",
"set",
"of",
"validation",
"rules",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L461-L524 |
UnionOfRAD/lithium | util/Validator.php | Validator.add | public static function add($name, $rule = null, array $options = []) {
if (!is_array($name)) {
$name = [$name => $rule];
}
static::$_rules = Set::merge(static::$_rules, $name);
if (!empty($options)) {
$options = array_combine(array_keys($name), array_fill(0, count($name), $options));
static::$_options... | php | public static function add($name, $rule = null, array $options = []) {
if (!is_array($name)) {
$name = [$name => $rule];
}
static::$_rules = Set::merge(static::$_rules, $name);
if (!empty($options)) {
$options = array_combine(array_keys($name), array_fill(0, count($name), $options));
static::$_options... | [
"public",
"static",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"rule",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"[",
"$",
"name",
"=... | Adds to or replaces built-in validation rules specified in `Validator::$_rules`. Any new
validation rules created are automatically callable as validation methods.
For example:
```
Validator::add('zeroToNine', '/^[0-9]$/');
$isValid = Validator::isZeroToNine("5"); // true
$isValid = Validator::isZeroToNine("20"); // ... | [
"Adds",
"to",
"or",
"replaces",
"built",
"-",
"in",
"validation",
"rules",
"specified",
"in",
"Validator",
"::",
"$_rules",
".",
"Any",
"new",
"validation",
"rules",
"created",
"are",
"automatically",
"callable",
"as",
"validation",
"methods",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L583-L593 |
UnionOfRAD/lithium | util/Validator.php | Validator.rule | public static function rule($rule, $value, $format = 'any', array $options = []) {
if (!isset(static::$_rules[$rule])) {
throw new InvalidArgumentException("Rule `{$rule}` is not a validation rule.");
}
$defaults = isset(static::$_options[$rule]) ? static::$_options[$rule] : [];
$options = (array) $options +... | php | public static function rule($rule, $value, $format = 'any', array $options = []) {
if (!isset(static::$_rules[$rule])) {
throw new InvalidArgumentException("Rule `{$rule}` is not a validation rule.");
}
$defaults = isset(static::$_options[$rule]) ? static::$_options[$rule] : [];
$options = (array) $options +... | [
"public",
"static",
"function",
"rule",
"(",
"$",
"rule",
",",
"$",
"value",
",",
"$",
"format",
"=",
"'any'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"_rules",
"[",
"$",
"rule",
... | Checks a single value against a single validation rule in one or more formats.
@param string $rule
@param mixed $value
@param string $format
@param array $options
@return boolean Returns `true` or `false` indicating whether the validation rule check
succeeded or failed.
@filter | [
"Checks",
"a",
"single",
"value",
"against",
"a",
"single",
"validation",
"rule",
"in",
"one",
"or",
"more",
"formats",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L606-L624 |
UnionOfRAD/lithium | util/Validator.php | Validator.rules | public static function rules($name = null) {
if (!$name) {
return array_keys(static::$_rules);
}
return isset(static::$_rules[$name]) ? static::$_rules[$name] : null;
} | php | public static function rules($name = null) {
if (!$name) {
return array_keys(static::$_rules);
}
return isset(static::$_rules[$name]) ? static::$_rules[$name] : null;
} | [
"public",
"static",
"function",
"rules",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"name",
")",
"{",
"return",
"array_keys",
"(",
"static",
"::",
"$",
"_rules",
")",
";",
"}",
"return",
"isset",
"(",
"static",
"::",
"$",
"_rules... | Returns a list of available validation rules, or the configuration details of a single rule.
@param string $name Optional name of a rule to get the details of. If not specified, an array
of all available rule names is returned. Otherwise, returns the details of a
single rule. This can be a regular expression string, a... | [
"Returns",
"a",
"list",
"of",
"available",
"validation",
"rules",
"or",
"the",
"configuration",
"details",
"of",
"a",
"single",
"rule",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L636-L641 |
UnionOfRAD/lithium | util/Validator.php | Validator._checkFormats | protected static function _checkFormats($rules) {
return function($params) use ($rules) {
$value = $params['value'];
$format = $params['format'];
$options = $params['options'];
$defaults = ['all' => true];
$options += $defaults;
$formats = (array) $format;
$options['all'] = ($format === 'any');... | php | protected static function _checkFormats($rules) {
return function($params) use ($rules) {
$value = $params['value'];
$format = $params['format'];
$options = $params['options'];
$defaults = ['all' => true];
$options += $defaults;
$formats = (array) $format;
$options['all'] = ($format === 'any');... | [
"protected",
"static",
"function",
"_checkFormats",
"(",
"$",
"rules",
")",
"{",
"return",
"function",
"(",
"$",
"params",
")",
"use",
"(",
"$",
"rules",
")",
"{",
"$",
"value",
"=",
"$",
"params",
"[",
"'value'",
"]",
";",
"$",
"format",
"=",
"$",
... | Perform validation checks against a value using an array of all possible formats for a rule,
and an array specifying which formats within the rule to use.
@param array $rules All available rules.
@return \Closure Function returning boolean `true` if validation succeeded, `false` otherwise. | [
"Perform",
"validation",
"checks",
"against",
"a",
"value",
"using",
"an",
"array",
"of",
"all",
"possible",
"formats",
"for",
"a",
"rule",
"and",
"an",
"array",
"specifying",
"which",
"formats",
"within",
"the",
"rule",
"to",
"use",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Validator.php#L650-L676 |
UnionOfRAD/lithium | storage/cache/adapter/Redis.php | Redis._init | protected function _init() {
if (!$this->connection) {
$this->connection = new RedisCore();
}
$method = $this->_config['persistent'] ? 'pconnect' : 'connect';
if (HostString::isSocket($this->_config['host'])) {
$this->connection->{$method}($this->_config['host']);
} else {
$host = HostString::parse(... | php | protected function _init() {
if (!$this->connection) {
$this->connection = new RedisCore();
}
$method = $this->_config['persistent'] ? 'pconnect' : 'connect';
if (HostString::isSocket($this->_config['host'])) {
$this->connection->{$method}($this->_config['host']);
} else {
$host = HostString::parse(... | [
"protected",
"function",
"_init",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connection",
")",
"{",
"$",
"this",
"->",
"connection",
"=",
"new",
"RedisCore",
"(",
")",
";",
"}",
"$",
"method",
"=",
"$",
"this",
"->",
"_config",
"[",
"'persi... | Initialize the Redis connection object, connect to the Redis server and sets
prefix using the scope if provided.
@return void | [
"Initialize",
"the",
"Redis",
"connection",
"object",
"connect",
"to",
"the",
"Redis",
"server",
"and",
"sets",
"prefix",
"using",
"the",
"scope",
"if",
"provided",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/storage/cache/adapter/Redis.php#L111-L130 |
UnionOfRAD/lithium | storage/cache/adapter/Redis.php | Redis.write | public function write(array $keys, $expiry = null) {
$expiry = $expiry || $expiry === Cache::PERSIST ? $expiry : $this->_config['expiry'];
if (!$expiry || $expiry === Cache::PERSIST) {
$ttl = null;
} elseif (is_int($expiry)) {
$ttl = $expiry;
} else {
$ttl = strtotime($expiry) - time();
}
if (cou... | php | public function write(array $keys, $expiry = null) {
$expiry = $expiry || $expiry === Cache::PERSIST ? $expiry : $this->_config['expiry'];
if (!$expiry || $expiry === Cache::PERSIST) {
$ttl = null;
} elseif (is_int($expiry)) {
$ttl = $expiry;
} else {
$ttl = strtotime($expiry) - time();
}
if (cou... | [
"public",
"function",
"write",
"(",
"array",
"$",
"keys",
",",
"$",
"expiry",
"=",
"null",
")",
"{",
"$",
"expiry",
"=",
"$",
"expiry",
"||",
"$",
"expiry",
"===",
"Cache",
"::",
"PERSIST",
"?",
"$",
"expiry",
":",
"$",
"this",
"->",
"_config",
"["... | Write values to the cache. All items to be cached will receive an
expiration time of `$expiry`.
@param array $keys Key/value pairs with keys to uniquely identify the to-be-cached item.
@param string|integer $expiry A `strtotime()` compatible cache time or TTL in seconds.
To persist an item use `\lithium\storage\Cache:... | [
"Write",
"values",
"to",
"the",
"cache",
".",
"All",
"items",
"to",
"be",
"cached",
"will",
"receive",
"an",
"expiration",
"time",
"of",
"$expiry",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/storage/cache/adapter/Redis.php#L181-L213 |
UnionOfRAD/lithium | storage/cache/adapter/Redis.php | Redis.read | public function read(array $keys) {
if (count($keys) > 1) {
$results = [];
$data = $this->connection->mGet($keys);
foreach ($data as $key => $item) {
$key = $keys[$key];
if ($item === false && !$connection->exists($key)) {
continue;
}
$results[$key] = $item;
}
return $results;
... | php | public function read(array $keys) {
if (count($keys) > 1) {
$results = [];
$data = $this->connection->mGet($keys);
foreach ($data as $key => $item) {
$key = $keys[$key];
if ($item === false && !$connection->exists($key)) {
continue;
}
$results[$key] = $item;
}
return $results;
... | [
"public",
"function",
"read",
"(",
"array",
"$",
"keys",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"keys",
")",
">",
"1",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"connection",
"->",
"mGet",
"(",
"$",
"... | Read values from the cache. Will attempt to return an array of data
containing key/value pairs of the requested data.
@param array $keys Keys to uniquely identify the cached items.
@return array Cached values keyed by cache keys on successful read,
keys which could not be read will not be included in
the results array... | [
"Read",
"values",
"from",
"the",
"cache",
".",
"Will",
"attempt",
"to",
"return",
"an",
"array",
"of",
"data",
"containing",
"key",
"/",
"value",
"pairs",
"of",
"the",
"requested",
"data",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/storage/cache/adapter/Redis.php#L224-L241 |
UnionOfRAD/lithium | g11n/catalog/Adapter.php | Adapter._merge | protected function _merge(array $data, array $item) {
if (!isset($item['id'])) {
return $data;
}
$id = $item['id'];
$defaults = [
'ids' => [],
'translated' => null,
'flags' => [],
'comments' => [],
'occurrences' => []
];
$item += $defaults;
if (isset($item['context']) && $item['context... | php | protected function _merge(array $data, array $item) {
if (!isset($item['id'])) {
return $data;
}
$id = $item['id'];
$defaults = [
'ids' => [],
'translated' => null,
'flags' => [],
'comments' => [],
'occurrences' => []
];
$item += $defaults;
if (isset($item['context']) && $item['context... | [
"protected",
"function",
"_merge",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"item",
"[",
"'id'",
"]",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"id",
"=",
"$",
"item",
"[",
... | Merges an item into given data.
@param array $data Data to merge item into.
@param array $item Item to merge into $data. The item must have an `'id'` key.
@return array The merged data. | [
"Merges",
"an",
"item",
"into",
"given",
"data",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/Adapter.php#L72-L104 |
UnionOfRAD/lithium | template/view/Compiler.php | Compiler.template | public static function template($file, array $options = []) {
$cachePath = Libraries::get(true, 'resources') . '/tmp/cache/templates';
$defaults = ['path' => $cachePath, 'fallback' => false];
$options += $defaults;
$stats = stat($file);
$oname = basename(dirname($file)) . '_' . basename($file, '.php');
$... | php | public static function template($file, array $options = []) {
$cachePath = Libraries::get(true, 'resources') . '/tmp/cache/templates';
$defaults = ['path' => $cachePath, 'fallback' => false];
$options += $defaults;
$stats = stat($file);
$oname = basename(dirname($file)) . '_' . basename($file, '.php');
$... | [
"public",
"static",
"function",
"template",
"(",
"$",
"file",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"cachePath",
"=",
"Libraries",
"::",
"get",
"(",
"true",
",",
"'resources'",
")",
".",
"'/tmp/cache/templates'",
";",
"$",
"defaults... | Compiles a template and writes it to a cache file, which is used for inclusion.
@param string $file The full path to the template that will be compiled.
@param array $options Options for compilation include:
- `path`: Path where the compiled template should be written.
- `fallback`: Boolean indicating that if the comp... | [
"Compiles",
"a",
"template",
"and",
"writes",
"it",
"to",
"a",
"cache",
"file",
"which",
"is",
"used",
"for",
"inclusion",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/view/Compiler.php#L55-L85 |
UnionOfRAD/lithium | template/view/Compiler.php | Compiler.compile | public static function compile($string) {
$patterns = static::$_processors;
return preg_replace(array_keys($patterns), array_values($patterns), $string);
} | php | public static function compile($string) {
$patterns = static::$_processors;
return preg_replace(array_keys($patterns), array_values($patterns), $string);
} | [
"public",
"static",
"function",
"compile",
"(",
"$",
"string",
")",
"{",
"$",
"patterns",
"=",
"static",
"::",
"$",
"_processors",
";",
"return",
"preg_replace",
"(",
"array_keys",
"(",
"$",
"patterns",
")",
",",
"array_values",
"(",
"$",
"patterns",
")",
... | Preprocess the passed `$string` (usually a PHP template) for syntax replacements
using sets of regular expressions.
@see lithium\template\view\Compiler::$_processors
@param string $string The string to be preprocessed.
@return string Processed string. | [
"Preprocess",
"the",
"passed",
"$string",
"(",
"usually",
"a",
"PHP",
"template",
")",
"for",
"syntax",
"replacements",
"using",
"sets",
"of",
"regular",
"expressions",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/view/Compiler.php#L95-L98 |
UnionOfRAD/lithium | template/Helper.php | Helper._init | protected function _init() {
parent::_init();
if (!$this->_context) {
return;
}
$this->_context->strings($this->_strings);
if ($this->_config['handlers']) {
$this->_context->handlers($this->_config['handlers']);
}
} | php | protected function _init() {
parent::_init();
if (!$this->_context) {
return;
}
$this->_context->strings($this->_strings);
if ($this->_config['handlers']) {
$this->_context->handlers($this->_config['handlers']);
}
} | [
"protected",
"function",
"_init",
"(",
")",
"{",
"parent",
"::",
"_init",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_context",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_context",
"->",
"strings",
"(",
"$",
"this",
"->",
"_strings"... | Imports local string definitions into rendering context.
@return void | [
"Imports",
"local",
"string",
"definitions",
"into",
"rendering",
"context",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L85-L96 |
UnionOfRAD/lithium | template/Helper.php | Helper.escape | public function escape($value, $method = null, array $options = []) {
$defaults = ['escape' => true];
$options += $defaults;
if ($options['escape'] === false) {
return $value;
}
if (is_array($value)) {
return array_map([$this, __FUNCTION__], $value);
}
return htmlspecialchars($value, ENT_QUOTES, 'U... | php | public function escape($value, $method = null, array $options = []) {
$defaults = ['escape' => true];
$options += $defaults;
if ($options['escape'] === false) {
return $value;
}
if (is_array($value)) {
return array_map([$this, __FUNCTION__], $value);
}
return htmlspecialchars($value, ENT_QUOTES, 'U... | [
"public",
"function",
"escape",
"(",
"$",
"value",
",",
"$",
"method",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'escape'",
"=>",
"true",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
... | Escapes values according to the output type of the rendering context. Helpers that output to
non-HTML/XML contexts should override this method accordingly.
@param string $value
@param mixed $method
@param array $options
@return mixed | [
"Escapes",
"values",
"according",
"to",
"the",
"output",
"type",
"of",
"the",
"rendering",
"context",
".",
"Helpers",
"that",
"output",
"to",
"non",
"-",
"HTML",
"/",
"XML",
"contexts",
"should",
"override",
"this",
"method",
"accordingly",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L107-L118 |
UnionOfRAD/lithium | template/Helper.php | Helper._options | protected function _options(array $defaults, array $scope) {
$scope += $defaults;
$options = array_diff_key($scope, $defaults);
return [$scope, $options];
} | php | protected function _options(array $defaults, array $scope) {
$scope += $defaults;
$options = array_diff_key($scope, $defaults);
return [$scope, $options];
} | [
"protected",
"function",
"_options",
"(",
"array",
"$",
"defaults",
",",
"array",
"$",
"scope",
")",
"{",
"$",
"scope",
"+=",
"$",
"defaults",
";",
"$",
"options",
"=",
"array_diff_key",
"(",
"$",
"scope",
",",
"$",
"defaults",
")",
";",
"return",
"[",... | Takes the defaults and current options, merges them and returns options which have
the default keys removed and full set of options as the scope.
@param array $defaults
@param array $scope the complete set of options
@return array $scope, $options | [
"Takes",
"the",
"defaults",
"and",
"current",
"options",
"merges",
"them",
"and",
"returns",
"options",
"which",
"have",
"the",
"default",
"keys",
"removed",
"and",
"full",
"set",
"of",
"options",
"as",
"the",
"scope",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L128-L132 |
UnionOfRAD/lithium | template/Helper.php | Helper._render | protected function _render($method, $string, $params, array $options = []) {
$strings = $this->_strings;
if (isset($params['options']['scope'])) {
$options['scope'] = $params['options']['scope'];
unset($params['options']['scope']);
}
if ($this->_context) {
foreach ($params as $key => $value) {
$h... | php | protected function _render($method, $string, $params, array $options = []) {
$strings = $this->_strings;
if (isset($params['options']['scope'])) {
$options['scope'] = $params['options']['scope'];
unset($params['options']['scope']);
}
if ($this->_context) {
foreach ($params as $key => $value) {
$h... | [
"protected",
"function",
"_render",
"(",
"$",
"method",
",",
"$",
"string",
",",
"$",
"params",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"strings",
"=",
"$",
"this",
"->",
"_strings",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
... | Render a string template after applying context filters
Use examples in the Html::link() method:
`return $this->_render(__METHOD__, 'link', compact('title', 'url', 'options'), $scope);`
@param string $method name of method that is calling the render (for context filters)
@param string $string template key (in Helper::... | [
"Render",
"a",
"string",
"template",
"after",
"applying",
"context",
"filters",
"Use",
"examples",
"in",
"the",
"Html",
"::",
"link",
"()",
"method",
":",
"return",
"$this",
"-",
">",
"_render",
"(",
"__METHOD__",
"link",
"compact",
"(",
"title",
"url",
"o... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L153-L171 |
UnionOfRAD/lithium | template/Helper.php | Helper._attributes | protected function _attributes($params, $method = null, array $options = []) {
$defaults = ['escape' => true, 'prepend' => ' ', 'append' => ''];
$options += $defaults;
$result = [];
if (!is_array($params)) {
return !$params ? '' : $options['prepend'] . $params;
}
foreach ($params as $key => $value) {
... | php | protected function _attributes($params, $method = null, array $options = []) {
$defaults = ['escape' => true, 'prepend' => ' ', 'append' => ''];
$options += $defaults;
$result = [];
if (!is_array($params)) {
return !$params ? '' : $options['prepend'] . $params;
}
foreach ($params as $key => $value) {
... | [
"protected",
"function",
"_attributes",
"(",
"$",
"params",
",",
"$",
"method",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'escape'",
"=>",
"true",
",",
"'prepend'",
"=>",
"' '",
",",
"'append'",
"... | Converts a set of parameters to HTML attributes into a string.
@see lithium\template\view\Renderer::__call()
@param array|string $params The parameters where key is the attribute name and
the value the attribute value. When string will simply prepend with the
prepend-string (by default `' '`) unless $params is falsey ... | [
"Converts",
"a",
"set",
"of",
"parameters",
"to",
"HTML",
"attributes",
"into",
"a",
"string",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L192-L206 |
UnionOfRAD/lithium | template/Helper.php | Helper._attribute | protected function _attribute($key, $value, array $options = []) {
$defaults = ['escape' => true, 'format' => '%s="%s"'];
$options += $defaults;
if (in_array($key, $this->_minimized)) {
$isMini = ($value === 1 || $value === true || $value === $key);
if (!($value = $isMini ? $key : $value)) {
return nul... | php | protected function _attribute($key, $value, array $options = []) {
$defaults = ['escape' => true, 'format' => '%s="%s"'];
$options += $defaults;
if (in_array($key, $this->_minimized)) {
$isMini = ($value === 1 || $value === true || $value === $key);
if (!($value = $isMini ? $key : $value)) {
return nul... | [
"protected",
"function",
"_attribute",
"(",
"$",
"key",
",",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'escape'",
"=>",
"true",
",",
"'format'",
"=>",
"'%s=\"%s\"'",
"]",
";",
"$",
"options",
"+=... | Convert a key/value pair to a valid HTML attribute.
@param string $key The key name of the HTML attribute.
@param mixed $value The HTML attribute value.
@param array $options The options used when converting the key/value pair to attributes:
- `'escape'` _boolean_: Indicates whether `$key` and `$value` should be
HTML-... | [
"Convert",
"a",
"key",
"/",
"value",
"pair",
"to",
"a",
"valid",
"HTML",
"attribute",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/Helper.php#L219-L235 |
UnionOfRAD/lithium | action/Dispatcher.php | Dispatcher.run | public static function run($request, array $options = []) {
$params = compact('request', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$router = static::$_classes['router'];
$request = $params['request'];
$options = $params['options'];
if (($result = $... | php | public static function run($request, array $options = []) {
$params = compact('request', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$router = static::$_classes['router'];
$request = $params['request'];
$options = $params['options'];
if (($result = $... | [
"public",
"static",
"function",
"run",
"(",
"$",
"request",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'request'",
",",
"'options'",
")",
";",
"return",
"Filters",
"::",
"run",
"(",
"get_called_class",
"... | Dispatches a request based on a request object (an instance or subclass of
`lithium\net\http\Request`).
@see lithium\action\Request
@see lithium\action\Response
@param object $request An instance of a request object (usually `lithium\action\Request`)
with HTTP request information.
@param array $options
@return mixed R... | [
"Dispatches",
"a",
"request",
"based",
"on",
"a",
"request",
"object",
"(",
"an",
"instance",
"or",
"subclass",
"of",
"lithium",
"\\",
"net",
"\\",
"http",
"\\",
"Request",
")",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Dispatcher.php#L151-L171 |
UnionOfRAD/lithium | action/Dispatcher.php | Dispatcher.applyRules | public static function applyRules(&$params) {
$values = [];
$rules = static::$_rules;
if (!$params) {
return false;
}
if (isset($params['controller']) && is_string($params['controller'])) {
$controller = $params['controller'];
if (strpos($controller, '.') !== false) {
list($library, $controlle... | php | public static function applyRules(&$params) {
$values = [];
$rules = static::$_rules;
if (!$params) {
return false;
}
if (isset($params['controller']) && is_string($params['controller'])) {
$controller = $params['controller'];
if (strpos($controller, '.') !== false) {
list($library, $controlle... | [
"public",
"static",
"function",
"applyRules",
"(",
"&",
"$",
"params",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"$",
"rules",
"=",
"static",
"::",
"$",
"_rules",
";",
"if",
"(",
"!",
"$",
"params",
")",
"{",
"return",
"false",
";",
"}",
"if",... | Attempts to apply a set of formatting rules from `$_rules` to a `$params` array, where each
formatting rule is applied if the key of the rule in `$_rules` is present and not empty in
`$params`. Also performs sanity checking against `$params` to ensure that no value
matching a rule is present unless the rule check pass... | [
"Attempts",
"to",
"apply",
"a",
"set",
"of",
"formatting",
"rules",
"from",
"$_rules",
"to",
"a",
"$params",
"array",
"where",
"each",
"formatting",
"rule",
"is",
"applied",
"if",
"the",
"key",
"of",
"the",
"rule",
"in",
"$_rules",
"is",
"present",
"and",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Dispatcher.php#L182-L230 |
UnionOfRAD/lithium | action/Dispatcher.php | Dispatcher._callable | protected static function _callable($request, $params, $options) {
$params = compact('request', 'params', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$options = ['request' => $params['request']] + $params['options'];
$controller = $params['params']['controll... | php | protected static function _callable($request, $params, $options) {
$params = compact('request', 'params', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$options = ['request' => $params['request']] + $params['options'];
$controller = $params['params']['controll... | [
"protected",
"static",
"function",
"_callable",
"(",
"$",
"request",
",",
"$",
"params",
",",
"$",
"options",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'request'",
",",
"'params'",
",",
"'options'",
")",
";",
"return",
"Filters",
"::",
"run",
"(",
... | Accepts parameters generated by the `Router` class in `Dispatcher::run()`, and produces a
callable controller object. By default, this method uses the `'controller'` path lookup
configuration in `Libraries::locate()` to return a callable object.
@param object $request The instance of the `Request` class either passed ... | [
"Accepts",
"parameters",
"generated",
"by",
"the",
"Router",
"class",
"in",
"Dispatcher",
"::",
"run",
"()",
"and",
"produces",
"a",
"callable",
"controller",
"object",
".",
"By",
"default",
"this",
"method",
"uses",
"the",
"controller",
"path",
"lookup",
"con... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Dispatcher.php#L244-L257 |
UnionOfRAD/lithium | action/Dispatcher.php | Dispatcher._call | protected static function _call($callable, $request, $params) {
$params = compact('callable', 'request', 'params');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
if (is_callable($callable = $params['callable'])) {
return $callable($params['request'], $params['params']);
... | php | protected static function _call($callable, $request, $params) {
$params = compact('callable', 'request', 'params');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
if (is_callable($callable = $params['callable'])) {
return $callable($params['request'], $params['params']);
... | [
"protected",
"static",
"function",
"_call",
"(",
"$",
"callable",
",",
"$",
"request",
",",
"$",
"params",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'callable'",
",",
"'request'",
",",
"'params'",
")",
";",
"return",
"Filters",
"::",
"run",
"(",
"... | Invokes the callable object returned by `_callable()`, and returns the results, usually a
`Response` object instance.
@see lithium\action
@param object $callable Typically a closure or instance of `lithium\action\Controller`.
@param object $request An instance of `lithium\action\Request`.
@param array $params An array... | [
"Invokes",
"the",
"callable",
"object",
"returned",
"by",
"_callable",
"()",
"and",
"returns",
"the",
"results",
"usually",
"a",
"Response",
"object",
"instance",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/action/Dispatcher.php#L273-L281 |
UnionOfRAD/lithium | data/source/Http.php | Http.respondsTo | public function respondsTo($method, $internal = false) {
return isset($this->_methods[$method]) || parent::respondsTo($method, $internal);
} | php | public function respondsTo($method, $internal = false) {
return isset($this->_methods[$method]) || parent::respondsTo($method, $internal);
} | [
"public",
"function",
"respondsTo",
"(",
"$",
"method",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_methods",
"[",
"$",
"method",
"]",
")",
"||",
"parent",
"::",
"respondsTo",
"(",
"$",
"method",
",",
"$... | Determines if a given method can be called.
@param string $method Name of the method.
@param boolean $internal Provide `true` to perform check from inside the
class/object. When `false` checks also for public visibility;
defaults to `false`.
@return boolean Returns `true` if the method can be called, `false` otherwise... | [
"Determines",
"if",
"a",
"given",
"method",
"can",
"be",
"called",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/Http.php#L153-L155 |
UnionOfRAD/lithium | data/source/Http.php | Http.send | public function send($query = null, array $options = []) {
$query = !is_object($query) ? new Query((array) $query) : $query;
$method = $query->method() ?: "get";
$path = $query->path();
$data = $query->data();
$insert = (array) $options + $data + $query->export($this);
if (preg_match_all('/\{:(\w+)\}/', $p... | php | public function send($query = null, array $options = []) {
$query = !is_object($query) ? new Query((array) $query) : $query;
$method = $query->method() ?: "get";
$path = $query->path();
$data = $query->data();
$insert = (array) $options + $data + $query->export($this);
if (preg_match_all('/\{:(\w+)\}/', $p... | [
"public",
"function",
"send",
"(",
"$",
"query",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"!",
"is_object",
"(",
"$",
"query",
")",
"?",
"new",
"Query",
"(",
"(",
"array",
")",
"$",
"query",
")",
":... | Method to send to a specific resource.
@param array $query a query object
@param array $options array.
@return mixed | [
"Method",
"to",
"send",
"to",
"a",
"specific",
"resource",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/Http.php#L164-L179 |
UnionOfRAD/lithium | data/source/Http.php | Http.disconnect | public function disconnect() {
if ($this->_isConnected && $this->connection !== null) {
$this->_isConnected = false;
}
return !$this->_isConnected;
} | php | public function disconnect() {
if ($this->_isConnected && $this->connection !== null) {
$this->_isConnected = false;
}
return !$this->_isConnected;
} | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isConnected",
"&&",
"$",
"this",
"->",
"connection",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_isConnected",
"=",
"false",
";",
"}",
"return",
"!",
"$",
"this",
"-... | Disconnect from socket.
@return boolean | [
"Disconnect",
"from",
"socket",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/Http.php#L198-L203 |
UnionOfRAD/lithium | data/source/Http.php | Http.read | public function read($query, array $options = []) {
$query = !is_object($query) ? new Query() : $query;
$query->method() ?: $query->method("get");
$query->path() ?: $query->path("/{:source}");
$params = [$query, $options];
return Filters::run($this, __FUNCTION__, $params, function($params) {
list($query,... | php | public function read($query, array $options = []) {
$query = !is_object($query) ? new Query() : $query;
$query->method() ?: $query->method("get");
$query->path() ?: $query->path("/{:source}");
$params = [$query, $options];
return Filters::run($this, __FUNCTION__, $params, function($params) {
list($query,... | [
"public",
"function",
"read",
"(",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"!",
"is_object",
"(",
"$",
"query",
")",
"?",
"new",
"Query",
"(",
")",
":",
"$",
"query",
";",
"$",
"query",
"->",
"met... | Read used by model to GET.
@param object $query
@param array $options
@return string
@filter | [
"Read",
"used",
"by",
"model",
"to",
"GET",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/Http.php#L256-L267 |
UnionOfRAD/lithium | data/source/Http.php | Http.relationship | public function relationship($class, $type, $name, array $options = []) {
if (isset($this->_classes['relationship'])) {
return $this->_instance('relationship', compact('type', 'name') + $options);
}
return null;
} | php | public function relationship($class, $type, $name, array $options = []) {
if (isset($this->_classes['relationship'])) {
return $this->_instance('relationship', compact('type', 'name') + $options);
}
return null;
} | [
"public",
"function",
"relationship",
"(",
"$",
"class",
",",
"$",
"type",
",",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_classes",
"[",
"'relationship'",
"]",
")",
")",
"{",
... | Defines or modifies the default settings of a relationship between two models.
@param string $class
@param string $type
@param string $name
@param array $options
@return array Returns an array containing the configuration for a model relationship. | [
"Defines",
"or",
"modifies",
"the",
"default",
"settings",
"of",
"a",
"relationship",
"between",
"two",
"models",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/Http.php#L320-L325 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.