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 |
|---|---|---|---|---|---|---|---|---|---|---|
UnionOfRAD/lithium | template/view/adapter/File.php | File.render | public function render($template, $data = [], array $options = []) {
$defaults = ['context' => []];
$options += $defaults;
$this->_context = $options['context'] + $this->_context;
$this->_data = (array) $data + $this->_vars;
$this->_options = $options;
$template__ = $template;
unset($options, $template, ... | php | public function render($template, $data = [], array $options = []) {
$defaults = ['context' => []];
$options += $defaults;
$this->_context = $options['context'] + $this->_context;
$this->_data = (array) $data + $this->_vars;
$this->_options = $options;
$template__ = $template;
unset($options, $template, ... | [
"public",
"function",
"render",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'context'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",... | Renders content from a template file provided by `template()`.
@param string $template
@param array|string $data
@param array $options
@return string | [
"Renders",
"content",
"from",
"a",
"template",
"file",
"provided",
"by",
"template",
"()",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/view/adapter/File.php#L106-L125 |
UnionOfRAD/lithium | template/view/adapter/File.php | File.template | public function template($type, array $params) {
$library = Libraries::get(isset($params['library']) ? $params['library'] : true);
$params['library'] = $library['path'];
$path = $this->_paths($type, $params);
if ($this->_compile) {
$compiler = $this->_classes['compiler'];
$path = $compiler::template($pat... | php | public function template($type, array $params) {
$library = Libraries::get(isset($params['library']) ? $params['library'] : true);
$params['library'] = $library['path'];
$path = $this->_paths($type, $params);
if ($this->_compile) {
$compiler = $this->_classes['compiler'];
$path = $compiler::template($pat... | [
"public",
"function",
"template",
"(",
"$",
"type",
",",
"array",
"$",
"params",
")",
"{",
"$",
"library",
"=",
"Libraries",
"::",
"get",
"(",
"isset",
"(",
"$",
"params",
"[",
"'library'",
"]",
")",
"?",
"$",
"params",
"[",
"'library'",
"]",
":",
... | Returns a template file name
@param string $type
@param array $params
@return string | [
"Returns",
"a",
"template",
"file",
"name"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/view/adapter/File.php#L134-L144 |
UnionOfRAD/lithium | template/view/adapter/File.php | File._paths | protected function _paths($type, array $params) {
if (!isset($this->_paths[$type])) {
throw new TemplateException("Invalid template type '{$type}'.");
}
foreach ((array) $this->_paths[$type] as $path) {
if (!file_exists($path = Text::insert($path, $params))) {
continue;
}
return $path;
}
thro... | php | protected function _paths($type, array $params) {
if (!isset($this->_paths[$type])) {
throw new TemplateException("Invalid template type '{$type}'.");
}
foreach ((array) $this->_paths[$type] as $path) {
if (!file_exists($path = Text::insert($path, $params))) {
continue;
}
return $path;
}
thro... | [
"protected",
"function",
"_paths",
"(",
"$",
"type",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_paths",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
"TemplateException",
"(",
"\"Invalid template t... | Searches one or more path templates for a matching template file, and returns the file name.
@param string $type
@param array $params The set of options keys to be interpolated into the path templates
when searching for the correct file to load.
@return string Returns the first template file found. Throws an exception... | [
"Searches",
"one",
"or",
"more",
"path",
"templates",
"for",
"a",
"matching",
"template",
"file",
"and",
"returns",
"the",
"file",
"name",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/template/view/adapter/File.php#L224-L236 |
UnionOfRAD/lithium | data/source/database/adapter/Sqlite3.php | Sqlite3.enabled | public static function enabled($feature = null) {
if (!$feature) {
return extension_loaded('pdo_sqlite');
}
$features = [
'arrays' => false,
'transactions' => false,
'booleans' => true,
'schema' => true,
'relationships' => true,
'sources' => true
];
return isset($features[$feature]) ? $fe... | php | public static function enabled($feature = null) {
if (!$feature) {
return extension_loaded('pdo_sqlite');
}
$features = [
'arrays' => false,
'transactions' => false,
'booleans' => true,
'schema' => true,
'relationships' => true,
'sources' => true
];
return isset($features[$feature]) ? $fe... | [
"public",
"static",
"function",
"enabled",
"(",
"$",
"feature",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"feature",
")",
"{",
"return",
"extension_loaded",
"(",
"'pdo_sqlite'",
")",
";",
"}",
"$",
"features",
"=",
"[",
"'arrays'",
"=>",
"false",
","... | Check for required PHP extension, or supported database feature.
@param string $feature Test for support for a specific feature, i.e. `'transactions'`.
@return boolean Returns `true` if the particular feature (or if Sqlite) support is enabled,
otherwise `false`. | [
"Check",
"for",
"required",
"PHP",
"extension",
"or",
"supported",
"database",
"feature",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/database/adapter/Sqlite3.php#L101-L114 |
UnionOfRAD/lithium | data/source/database/adapter/Sqlite3.php | Sqlite3.sources | public function sources($model = null) {
$params = compact('model');
return Filters::run($this, __FUNCTION__, $params, function($params) {
$sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;";
$result = $this->_execute($sql);
$sources = [];
foreach ($result as $row) {
$sources... | php | public function sources($model = null) {
$params = compact('model');
return Filters::run($this, __FUNCTION__, $params, function($params) {
$sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;";
$result = $this->_execute($sql);
$sources = [];
foreach ($result as $row) {
$sources... | [
"public",
"function",
"sources",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'model'",
")",
";",
"return",
"Filters",
"::",
"run",
"(",
"$",
"this",
",",
"__FUNCTION__",
",",
"$",
"params",
",",
"function",
"(",
"$"... | Returns the list of tables in the currently-connected database.
@param string $model The fully-name-spaced class name of the model object making the request.
@return array Returns an array of objects to which models can connect.
@filter | [
"Returns",
"the",
"list",
"of",
"tables",
"in",
"the",
"currently",
"-",
"connected",
"database",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/database/adapter/Sqlite3.php#L165-L178 |
UnionOfRAD/lithium | data/source/database/adapter/Sqlite3.php | Sqlite3.describe | public function describe($entity, $fields = [], array $meta = []) {
$params = compact('entity', 'meta', 'fields');
return Filters::run($this, __FUNCTION__, $params, function($params) {
extract($params);
if ($fields) {
return $this->_instance('schema', compact('fields'));
}
$name = $this->_entityNa... | php | public function describe($entity, $fields = [], array $meta = []) {
$params = compact('entity', 'meta', 'fields');
return Filters::run($this, __FUNCTION__, $params, function($params) {
extract($params);
if ($fields) {
return $this->_instance('schema', compact('fields'));
}
$name = $this->_entityNa... | [
"public",
"function",
"describe",
"(",
"$",
"entity",
",",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"meta",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"compact",
"(",
"'entity'",
",",
"'meta'",
",",
"'fields'",
")",
";",
"return",
"Filter... | Gets the column schema for a given Sqlite3 table.
A column type may not always be available, i.e. when during creation of
the column no type was declared. Those columns are internally treated
by SQLite3 as having a `NONE` affinity. The final schema will contain no
information about type and length of such columns (bot... | [
"Gets",
"the",
"column",
"schema",
"for",
"a",
"given",
"Sqlite3",
"table",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/database/adapter/Sqlite3.php#L200-L231 |
UnionOfRAD/lithium | data/source/database/adapter/Sqlite3.php | Sqlite3.encoding | public function encoding($encoding = null) {
if ($encoding === null) {
$encoding = $this->connection
->query('PRAGMA encoding')
->fetchColumn();
return $encoding === 'utf8' ? 'UTF-8' : $encoding;
}
if (strcasecmp($encoding, 'utf-8') === 0 || strcasecmp($encoding, 'utf8') === 0) {
$encoding = 'ut... | php | public function encoding($encoding = null) {
if ($encoding === null) {
$encoding = $this->connection
->query('PRAGMA encoding')
->fetchColumn();
return $encoding === 'utf8' ? 'UTF-8' : $encoding;
}
if (strcasecmp($encoding, 'utf-8') === 0 || strcasecmp($encoding, 'utf8') === 0) {
$encoding = 'ut... | [
"public",
"function",
"encoding",
"(",
"$",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"encoding",
"===",
"null",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"connection",
"->",
"query",
"(",
"'PRAGMA encoding'",
")",
"->",
"fetchColumn",
... | Getter/Setter for the connection's encoding.
Sqlite uses the string `utf8` to identify the UTF-8 encoding. In general `UTF-8` is used
to identify that encoding. This methods allows both strings to be used for _setting_ the
encoding (in lower and uppercase, with or without dash) and will transparently convert
to Sqlite... | [
"Getter",
"/",
"Setter",
"for",
"the",
"connection",
"s",
"encoding",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/database/adapter/Sqlite3.php#L259-L271 |
UnionOfRAD/lithium | data/source/mongo_db/Result.php | Result._fetch | protected function _fetch() {
if (!$this->_resource) {
return false;
}
if (!$this->_resource->hasNext()) {
return null;
}
$result = $this->_resource->getNext();
if ($result instanceof MongoGridFSFile) {
$result = ['file' => $result] + $result->file;
}
return [$this->_iterator, $result];
} | php | protected function _fetch() {
if (!$this->_resource) {
return false;
}
if (!$this->_resource->hasNext()) {
return null;
}
$result = $this->_resource->getNext();
if ($result instanceof MongoGridFSFile) {
$result = ['file' => $result] + $result->file;
}
return [$this->_iterator, $result];
} | [
"protected",
"function",
"_fetch",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_resource",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"_resource",
"->",
"hasNext",
"(",
")",
")",
"{",
"return",
"null",
";",
"... | Fetches the next result from the resource.
@return array|boolean|null Returns a key/value pair for the next result,
`null` if there is none, `false` if something bad happened. | [
"Fetches",
"the",
"next",
"result",
"from",
"the",
"resource",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/source/mongo_db/Result.php#L28-L41 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext.read | public function read($category, $locale, $scope) {
$files = $this->_files($category, $locale, $scope);
foreach ($files as $file) {
$method = '_parse' . ucfirst(pathinfo($file, PATHINFO_EXTENSION));
if (!file_exists($file) || !is_readable($file)) {
continue;
}
$stream = fopen($file, 'rb');
$data... | php | public function read($category, $locale, $scope) {
$files = $this->_files($category, $locale, $scope);
foreach ($files as $file) {
$method = '_parse' . ucfirst(pathinfo($file, PATHINFO_EXTENSION));
if (!file_exists($file) || !is_readable($file)) {
continue;
}
$stream = fopen($file, 'rb');
$data... | [
"public",
"function",
"read",
"(",
"$",
"category",
",",
"$",
"locale",
",",
"$",
"scope",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"_files",
"(",
"$",
"category",
",",
"$",
"locale",
",",
"$",
"scope",
")",
";",
"foreach",
"(",
"$",
"file... | Reads data.
MO files are preferred over PO files when existent.
@see lithium\g11n\catalog\adapter\Gettext::_files()
@param string $category A category.
@param string $locale A locale identifier.
@param string $scope The scope for the current operation.
@return array | [
"Reads",
"data",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L115-L138 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext.write | public function write($category, $locale, $scope, array $data) {
$files = $this->_files($category, $locale, $scope);
foreach ($files as $file) {
$method = '_compile' . ucfirst(pathinfo($file, PATHINFO_EXTENSION));
if (!$stream = fopen($file, 'wb')) {
return false;
}
$this->{$method}($stream, $data... | php | public function write($category, $locale, $scope, array $data) {
$files = $this->_files($category, $locale, $scope);
foreach ($files as $file) {
$method = '_compile' . ucfirst(pathinfo($file, PATHINFO_EXTENSION));
if (!$stream = fopen($file, 'wb')) {
return false;
}
$this->{$method}($stream, $data... | [
"public",
"function",
"write",
"(",
"$",
"category",
",",
"$",
"locale",
",",
"$",
"scope",
",",
"array",
"$",
"data",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"_files",
"(",
"$",
"category",
",",
"$",
"locale",
",",
"$",
"scope",
")",
";"... | Writes data.
@param string $category A category.
@param string $locale A locale identifier.
@param string $scope The scope for the current operation.
@param array $data The data to write.
@return boolean | [
"Writes",
"data",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L149-L162 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._files | protected function _files($category, $locale, $scope) {
$path = $this->_config['path'];
$scope = $scope ?: 'default';
if (($pos = strpos($category, 'Template')) !== false) {
$category = substr($category, 0, $pos);
return ["{$path}/{$category}_{$scope}.pot"];
}
if ($category === 'message') {
$catego... | php | protected function _files($category, $locale, $scope) {
$path = $this->_config['path'];
$scope = $scope ?: 'default';
if (($pos = strpos($category, 'Template')) !== false) {
$category = substr($category, 0, $pos);
return ["{$path}/{$category}_{$scope}.pot"];
}
if ($category === 'message') {
$catego... | [
"protected",
"function",
"_files",
"(",
"$",
"category",
",",
"$",
"locale",
",",
"$",
"scope",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_config",
"[",
"'path'",
"]",
";",
"$",
"scope",
"=",
"$",
"scope",
"?",
":",
"'default'",
";",
"if",
... | Returns absolute paths to files according to configuration.
@param string $category
@param string $locale
@param string $scope
@return array | [
"Returns",
"absolute",
"paths",
"to",
"files",
"according",
"to",
"configuration",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L172-L190 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._parsePo | protected function _parsePo($stream) {
$defaults = [
'ids' => [],
'translated' => null,
'flags' => [],
'comments' => [],
'occurrences' => [],
'context' => null
];
$data = [];
$item = $defaults;
while ($line = fgets($stream)) {
$line = trim($line);
if ($line === '') {
$data = $thi... | php | protected function _parsePo($stream) {
$defaults = [
'ids' => [],
'translated' => null,
'flags' => [],
'comments' => [],
'occurrences' => [],
'context' => null
];
$data = [];
$item = $defaults;
while ($line = fgets($stream)) {
$line = trim($line);
if ($line === '') {
$data = $thi... | [
"protected",
"function",
"_parsePo",
"(",
"$",
"stream",
")",
"{",
"$",
"defaults",
"=",
"[",
"'ids'",
"=>",
"[",
"]",
",",
"'translated'",
"=>",
"null",
",",
"'flags'",
"=>",
"[",
"]",
",",
"'comments'",
"=>",
"[",
"]",
",",
"'occurrences'",
"=>",
"... | Parses portable object (PO) format.
This parser sacrifices some features of the reference implementation the
differences to that implementation are as follows.
- No support for comments spanning multiple lines.
- Translator and extracted comments are treated as being the same type.
- Message IDs are allowed to have ot... | [
"Parses",
"portable",
"object",
"(",
"PO",
")",
"format",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L206-L259 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._parseMo | protected function _parseMo($stream) {
$stat = fstat($stream);
if ($stat['size'] < static::MO_HEADER_SIZE) {
throw new RangeException("MO stream content has an invalid format.");
}
$magic = unpack('V1', fread($stream, 4));
$magic = hexdec(substr(dechex(current($magic)), -8));
if ($magic == static::MO_L... | php | protected function _parseMo($stream) {
$stat = fstat($stream);
if ($stat['size'] < static::MO_HEADER_SIZE) {
throw new RangeException("MO stream content has an invalid format.");
}
$magic = unpack('V1', fread($stream, 4));
$magic = hexdec(substr(dechex(current($magic)), -8));
if ($magic == static::MO_L... | [
"protected",
"function",
"_parseMo",
"(",
"$",
"stream",
")",
"{",
"$",
"stat",
"=",
"fstat",
"(",
"$",
"stream",
")",
";",
"if",
"(",
"$",
"stat",
"[",
"'size'",
"]",
"<",
"static",
"::",
"MO_HEADER_SIZE",
")",
"{",
"throw",
"new",
"RangeException",
... | Parses machine object (MO) format, independent of the machine's endian it
was created on. Both 32bit and 64bit systems are supported.
@link https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
@param resource $stream
@return array
@throws RangeException If stream content has an invalid format. | [
"Parses",
"machine",
"object",
"(",
"MO",
")",
"format",
"independent",
"of",
"the",
"machine",
"s",
"endian",
"it",
"was",
"created",
"on",
".",
"Both",
"32bit",
"and",
"64bit",
"systems",
"are",
"supported",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L280-L351 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._compilePo | protected function _compilePo($stream, array $data) {
$output[] = '# This file is distributed under the same license as the PACKAGE package.';
$output[] = '#';
$output[] = 'msgctxt ""';
$output[] = 'msgid ""';
$output[] = 'msgstr ""';
$output[] = '"Project-Id-Version: PACKAGE VERSION\n"';
$output[] = '"PO... | php | protected function _compilePo($stream, array $data) {
$output[] = '# This file is distributed under the same license as the PACKAGE package.';
$output[] = '#';
$output[] = 'msgctxt ""';
$output[] = 'msgid ""';
$output[] = 'msgstr ""';
$output[] = '"Project-Id-Version: PACKAGE VERSION\n"';
$output[] = '"PO... | [
"protected",
"function",
"_compilePo",
"(",
"$",
"stream",
",",
"array",
"$",
"data",
")",
"{",
"$",
"output",
"[",
"]",
"=",
"'# This file is distributed under the same license as the PACKAGE package.'",
";",
"$",
"output",
"[",
"]",
"=",
"'#'",
";",
"$",
"outp... | Compiles data into portable object (PO) format.
To improve portability accross libraries the header is generated according
to the format of the output of `xgettext`. This means using the same names for
placeholders as well as including an empty entry. The empty entry at the
beginning aids in parsing the file as it _at... | [
"Compiles",
"data",
"into",
"portable",
"object",
"(",
"PO",
")",
"format",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L381-L436 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._prepareForWrite | protected function _prepareForWrite(array $item) {
$filter = function ($value) use (&$filter) {
if (is_array($value)) {
return array_map($filter, $value);
}
$value = strtr($value, ["\\'" => "'", "\\\\" => "\\", "\r\n" => "\n"]);
$value = addcslashes($value, "\0..\37\\\"");
return $value;
};
$fi... | php | protected function _prepareForWrite(array $item) {
$filter = function ($value) use (&$filter) {
if (is_array($value)) {
return array_map($filter, $value);
}
$value = strtr($value, ["\\'" => "'", "\\\\" => "\\", "\r\n" => "\n"]);
$value = addcslashes($value, "\0..\37\\\"");
return $value;
};
$fi... | [
"protected",
"function",
"_prepareForWrite",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"filter",
"=",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"&",
"$",
"filter",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"... | Prepares an item before it is being written and escapes fields.
All characters from \000 to \037 (this includes new line and tab characters)
as well as the backslash (`\`) and the double quote (`"`) are escaped.
Literal Windows CRLFs (`\r\n`) are converted to LFs (`\n`) to improve cross platform
compatibility. Escape... | [
"Prepares",
"an",
"item",
"before",
"it",
"is",
"being",
"written",
"and",
"escapes",
"fields",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L474-L500 |
UnionOfRAD/lithium | g11n/catalog/adapter/Gettext.php | Gettext._merge | protected function _merge(array $data, array $item) {
$filter = function ($value) use (&$filter) {
if (is_array($value)) {
return array_map($filter, $value);
}
return stripcslashes($value);
};
$fields = ['id', 'ids', 'translated', 'context'];
foreach ($fields as $field) {
if (isset($item[$field... | php | protected function _merge(array $data, array $item) {
$filter = function ($value) use (&$filter) {
if (is_array($value)) {
return array_map($filter, $value);
}
return stripcslashes($value);
};
$fields = ['id', 'ids', 'translated', 'context'];
foreach ($fields as $field) {
if (isset($item[$field... | [
"protected",
"function",
"_merge",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"item",
")",
"{",
"$",
"filter",
"=",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"&",
"$",
"filter",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")... | Merges an item into given data and unescapes fields.
Please note that items with an id containing exclusively whitespace characters
or are empty are **not** being merged. Whitespace characters are space, tab, vertical
tab, line feed, carriage return and form feed.
@see lithium\g11n\catalog\Adapter::_merge()
@param ar... | [
"Merges",
"an",
"item",
"into",
"given",
"data",
"and",
"unescapes",
"fields",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/g11n/catalog/adapter/Gettext.php#L514-L535 |
UnionOfRAD/lithium | storage/cache/adapter/XCache.php | XCache.read | public function read(array $keys) {
if ($this->_config['scope']) {
$keys = $this->_addScopePrefix($this->_config['scope'], $keys);
}
$results = [];
foreach ($keys as $key) {
$result = xcache_get($key);
if ($result === null && !xcache_isset($key)) {
continue;
}
$results[$key] = $result;
}
... | php | public function read(array $keys) {
if ($this->_config['scope']) {
$keys = $this->_addScopePrefix($this->_config['scope'], $keys);
}
$results = [];
foreach ($keys as $key) {
$result = xcache_get($key);
if ($result === null && !xcache_isset($key)) {
continue;
}
$results[$key] = $result;
}
... | [
"public",
"function",
"read",
"(",
"array",
"$",
"keys",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_config",
"[",
"'scope'",
"]",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"_addScopePrefix",
"(",
"$",
"this",
"->",
"_config",
"[",
"'scope'",
"]... | Read values from the cache. Will attempt to return an array of data
containing key/value pairs of the requested data.
Note that this is not an atomic operation when using multiple keys.
@param array $keys Keys to uniquely identify the cached items.
@return array Cached values keyed by cache keys on successful read,
k... | [
"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/XCache.php#L120-L138 |
UnionOfRAD/lithium | storage/cache/adapter/XCache.php | XCache.delete | public function delete(array $keys) {
if ($this->_config['scope']) {
$keys = $this->_addScopePrefix($this->_config['scope'], $keys);
}
foreach ($keys as $key) {
if (!xcache_unset($key)) {
return false;
}
}
return true;
} | php | public function delete(array $keys) {
if ($this->_config['scope']) {
$keys = $this->_addScopePrefix($this->_config['scope'], $keys);
}
foreach ($keys as $key) {
if (!xcache_unset($key)) {
return false;
}
}
return true;
} | [
"public",
"function",
"delete",
"(",
"array",
"$",
"keys",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_config",
"[",
"'scope'",
"]",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"_addScopePrefix",
"(",
"$",
"this",
"->",
"_config",
"[",
"'scope'",
... | Will attempt to remove specified keys from the user space cache.
Note that this is not an atomic operation when using multiple keys.
@param array $keys Keys to uniquely identify the cached items.
@return boolean `true` on successful delete, `false` otherwise. | [
"Will",
"attempt",
"to",
"remove",
"specified",
"keys",
"from",
"the",
"user",
"space",
"cache",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/storage/cache/adapter/XCache.php#L148-L158 |
UnionOfRAD/lithium | storage/cache/adapter/XCache.php | XCache.clear | public function clear() {
$admin = (ini_get('xcache.admin.enable_auth') === "On");
if ($admin && (!isset($this->_config['username']) || !isset($this->_config['password']))) {
return false;
}
$credentials = [];
if (isset($_SERVER['PHP_AUTH_USER'])) {
$credentials['username'] = $_SERVER['PHP_AUTH_USER'];... | php | public function clear() {
$admin = (ini_get('xcache.admin.enable_auth') === "On");
if ($admin && (!isset($this->_config['username']) || !isset($this->_config['password']))) {
return false;
}
$credentials = [];
if (isset($_SERVER['PHP_AUTH_USER'])) {
$credentials['username'] = $_SERVER['PHP_AUTH_USER'];... | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"admin",
"=",
"(",
"ini_get",
"(",
"'xcache.admin.enable_auth'",
")",
"===",
"\"On\"",
")",
";",
"if",
"(",
"$",
"admin",
"&&",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_config",
"[",
"'username'",
... | Clears entire user-space cache by flushing it. All cache keys
using the configuration but *without* honoring the scope are removed.
This method requires valid XCache admin credentials to be set when the adapter
was configured, due to the use of the xcache_clear_cache admin method. If the
`xcache.admin.enable_auth` ini... | [
"Clears",
"entire",
"user",
"-",
"space",
"cache",
"by",
"flushing",
"it",
".",
"All",
"cache",
"keys",
"using",
"the",
"configuration",
"but",
"*",
"without",
"*",
"honoring",
"the",
"scope",
"are",
"removed",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/storage/cache/adapter/XCache.php#L206-L235 |
UnionOfRAD/lithium | net/http/Route.php | Route.parse | public function parse($request, array $options = []) {
$defaults = ['url' => $request->url];
$options += $defaults;
$url = '/' . trim($options['url'], '/');
$pattern = $this->_pattern;
if (!preg_match($pattern, $url, $match)) {
return false;
}
foreach ($this->_meta as $key => $compare) {
$value = $... | php | public function parse($request, array $options = []) {
$defaults = ['url' => $request->url];
$options += $defaults;
$url = '/' . trim($options['url'], '/');
$pattern = $this->_pattern;
if (!preg_match($pattern, $url, $match)) {
return false;
}
foreach ($this->_meta as $key => $compare) {
$value = $... | [
"public",
"function",
"parse",
"(",
"$",
"request",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'url'",
"=>",
"$",
"request",
"->",
"url",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"url",
"=... | Attempts to parse a request object and determine its execution details.
@see lithium\net\http\Request
@see lithium\net\http\Request::$params
@see lithium\net\http\Route::$_handler
@param \lithium\net\http\Request $request A request object containing the details of
the request to be routed.
@param array $options Used t... | [
"Attempts",
"to",
"parse",
"a",
"request",
"object",
"and",
"determine",
"its",
"execution",
"details",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L261-L298 |
UnionOfRAD/lithium | net/http/Route.php | Route.match | public function match(array $options = []) {
$defaults = ['action' => 'index', 'http:method' => 'GET'];
$query = null;
if (!$this->_config['continue']) {
$options += $defaults;
if (isset($options['?'])) {
$query = $options['?'];
$query = '?' . (is_array($query) ? http_build_query($query) : $query)... | php | public function match(array $options = []) {
$defaults = ['action' => 'index', 'http:method' => 'GET'];
$query = null;
if (!$this->_config['continue']) {
$options += $defaults;
if (isset($options['?'])) {
$query = $options['?'];
$query = '?' . (is_array($query) ? http_build_query($query) : $query)... | [
"public",
"function",
"match",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'action'",
"=>",
"'index'",
",",
"'http:method'",
"=>",
"'GET'",
"]",
";",
"$",
"query",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this"... | Matches a set of parameters against the route, and returns a URL string
if the route matches the parameters.
@param array $options An array of parameters.
@return string|boolean URL string on success, else `false` if the route didn't match. | [
"Matches",
"a",
"set",
"of",
"parameters",
"against",
"the",
"route",
"and",
"returns",
"a",
"URL",
"string",
"if",
"the",
"route",
"matches",
"the",
"parameters",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L307-L342 |
UnionOfRAD/lithium | net/http/Route.php | Route._matchMethod | protected function _matchMethod($options) {
$isMatch = (
!isset($this->_meta['http:method']) ||
$options['http:method'] === $this->_meta['http:method']
);
if (!$isMatch) {
return false;
}
unset($options['http:method']);
return $options;
} | php | protected function _matchMethod($options) {
$isMatch = (
!isset($this->_meta['http:method']) ||
$options['http:method'] === $this->_meta['http:method']
);
if (!$isMatch) {
return false;
}
unset($options['http:method']);
return $options;
} | [
"protected",
"function",
"_matchMethod",
"(",
"$",
"options",
")",
"{",
"$",
"isMatch",
"=",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_meta",
"[",
"'http:method'",
"]",
")",
"||",
"$",
"options",
"[",
"'http:method'",
"]",
"===",
"$",
"this",
"->",
... | Helper used by `Route::match()` which check if the required http method is compatible
with the route.
@see lithium\net\http\Route::match()
@param array $options An array of URL parameters.
@return mixed On success, returns an updated array of options, On failure, returns `false`. | [
"Helper",
"used",
"by",
"Route",
"::",
"match",
"()",
"which",
"check",
"if",
"the",
"required",
"http",
"method",
"is",
"compatible",
"with",
"the",
"route",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L363-L373 |
UnionOfRAD/lithium | net/http/Route.php | Route._matchKeys | protected function _matchKeys($options) {
$args = ['args' => 'args'];
$scope = [];
if (!empty($options['scope'])) {
$scope = (array) $options['scope'] + ['params' => []];
$scope = array_flip($scope['params']);
}
unset($options['scope']);
if (array_intersect_key($options, $this->_match) != $this->_ma... | php | protected function _matchKeys($options) {
$args = ['args' => 'args'];
$scope = [];
if (!empty($options['scope'])) {
$scope = (array) $options['scope'] + ['params' => []];
$scope = array_flip($scope['params']);
}
unset($options['scope']);
if (array_intersect_key($options, $this->_match) != $this->_ma... | [
"protected",
"function",
"_matchKeys",
"(",
"$",
"options",
")",
"{",
"$",
"args",
"=",
"[",
"'args'",
"=>",
"'args'",
"]",
";",
"$",
"scope",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'scope'",
"]",
")",
")",
"{",
... | A helper method used by `match()` to verify that options required to match this route are
present in a URL array.
@see lithium\net\http\Route::match()
@param array $options An array of URL parameters.
@return mixed On success, returns an updated array of options, merged with defaults. On
failure, returns `false`. | [
"A",
"helper",
"method",
"used",
"by",
"match",
"()",
"to",
"verify",
"that",
"options",
"required",
"to",
"match",
"this",
"route",
"are",
"present",
"in",
"a",
"URL",
"array",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L384-L416 |
UnionOfRAD/lithium | net/http/Route.php | Route._write | protected function _write($options, $defaults) {
$template = $this->_template;
$trimmed = true;
$options += ['args' => ''];
foreach (array_reverse($this->_keys, true) as $key) {
$value =& $options[$key];
$pattern = isset($this->_subPatterns[$key]) ? ":{$this->_subPatterns[$key]}" : '';
$rpl = "{:{$key... | php | protected function _write($options, $defaults) {
$template = $this->_template;
$trimmed = true;
$options += ['args' => ''];
foreach (array_reverse($this->_keys, true) as $key) {
$value =& $options[$key];
$pattern = isset($this->_subPatterns[$key]) ? ":{$this->_subPatterns[$key]}" : '';
$rpl = "{:{$key... | [
"protected",
"function",
"_write",
"(",
"$",
"options",
",",
"$",
"defaults",
")",
"{",
"$",
"template",
"=",
"$",
"this",
"->",
"_template",
";",
"$",
"trimmed",
"=",
"true",
";",
"$",
"options",
"+=",
"[",
"'args'",
"=>",
"''",
"]",
";",
"foreach",... | Writes a set of URL options to this route's template string.
@param array $options The options to write to this route, with defaults pre-merged.
@param array $defaults The default template options for this route (contains hard-coded
default values).
@return string Returns the route template string with option values i... | [
"Writes",
"a",
"set",
"of",
"URL",
"options",
"to",
"this",
"route",
"s",
"template",
"string",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L426-L453 |
UnionOfRAD/lithium | net/http/Route.php | Route.export | public function export() {
$result = [];
foreach ($this->_autoConfig as $key) {
if ($key === 'formatters') {
continue;
}
$result[$key] = $this->{'_' . $key};
}
return $result;
} | php | public function export() {
$result = [];
foreach ($this->_autoConfig as $key) {
if ($key === 'formatters') {
continue;
}
$result[$key] = $this->{'_' . $key};
}
return $result;
} | [
"public",
"function",
"export",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_autoConfig",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"'formatters'",
")",
"{",
"continue",
";",
"}",
"$",
"re... | Exports the properties that make up the route to an array, for debugging, caching or
introspection purposes.
@return array An array containing the properties of the route object, such as URL templates
and parameter lists. | [
"Exports",
"the",
"properties",
"that",
"make",
"up",
"the",
"route",
"to",
"an",
"array",
"for",
"debugging",
"caching",
"or",
"introspection",
"purposes",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L462-L472 |
UnionOfRAD/lithium | net/http/Route.php | Route.compile | public function compile() {
foreach ($this->_params as $key => $value) {
if (!strpos($key, ':')) {
continue;
}
unset($this->_params[$key]);
$this->_meta[$key] = $value;
}
$this->_match = $this->_params;
if ($this->_template === '/' || $this->_template === '') {
$this->_pattern = '@^/*$@';
... | php | public function compile() {
foreach ($this->_params as $key => $value) {
if (!strpos($key, ':')) {
continue;
}
unset($this->_params[$key]);
$this->_meta[$key] = $value;
}
$this->_match = $this->_params;
if ($this->_template === '/' || $this->_template === '') {
$this->_pattern = '@^/*$@';
... | [
"public",
"function",
"compile",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"key",
",",
"':'",
")",
")",
"{",
"continue",
";",
"}",
"unset",
"... | Compiles URL templates into regular expression patterns for matching against request URLs,
and extracts template parameters into match-parameter arrays.
@return void | [
"Compiles",
"URL",
"templates",
"into",
"regular",
"expression",
"patterns",
"for",
"matching",
"against",
"request",
"URLs",
"and",
"extracts",
"template",
"parameters",
"into",
"match",
"-",
"parameter",
"arrays",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L480-L518 |
UnionOfRAD/lithium | net/http/Route.php | Route._regex | protected function _regex($regex, $param, $token, $prefix) {
if ($regex) {
$this->_subPatterns[$param] = $regex;
} elseif ($param == 'args') {
$regex = '.*';
} else {
$regex = '[^\/]+';
}
$req = $param === 'args' || array_key_exists($param, $this->_params) ? '?' : '';
if ($prefix === '/') {
$p... | php | protected function _regex($regex, $param, $token, $prefix) {
if ($regex) {
$this->_subPatterns[$param] = $regex;
} elseif ($param == 'args') {
$regex = '.*';
} else {
$regex = '[^\/]+';
}
$req = $param === 'args' || array_key_exists($param, $this->_params) ? '?' : '';
if ($prefix === '/') {
$p... | [
"protected",
"function",
"_regex",
"(",
"$",
"regex",
",",
"$",
"param",
",",
"$",
"token",
",",
"$",
"prefix",
")",
"{",
"if",
"(",
"$",
"regex",
")",
"{",
"$",
"this",
"->",
"_subPatterns",
"[",
"$",
"param",
"]",
"=",
"$",
"regex",
";",
"}",
... | Generates a sub-expression capture group for a route regex, using an optional user-supplied
matching pattern.
@param string $regex An optional user-supplied match pattern. If a route is defined like
`"/{:id:\d+}"`, then the value will be `"\d+"`.
@param string $param The parameter name which the capture group is assig... | [
"Generates",
"a",
"sub",
"-",
"expression",
"capture",
"group",
"for",
"a",
"route",
"regex",
"using",
"an",
"optional",
"user",
"-",
"supplied",
"matching",
"pattern",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/http/Route.php#L535-L554 |
UnionOfRAD/lithium | console/Router.php | Router.parse | public static function parse($request = null) {
$defaults = ['command' => null, 'action' => 'run', 'args' => []];
$params = $request ? (array) $request->params + $defaults : $defaults;
if (!empty($request->argv)) {
$args = $request->argv;
while ($args) {
$arg = array_shift($args);
if (preg_match('... | php | public static function parse($request = null) {
$defaults = ['command' => null, 'action' => 'run', 'args' => []];
$params = $request ? (array) $request->params + $defaults : $defaults;
if (!empty($request->argv)) {
$args = $request->argv;
while ($args) {
$arg = array_shift($args);
if (preg_match('... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"defaults",
"=",
"[",
"'command'",
"=>",
"null",
",",
"'action'",
"=>",
"'run'",
",",
"'args'",
"=>",
"[",
"]",
"]",
";",
"$",
"params",
"=",
"$",
"request",
... | Parse incoming request from console. Short and long (GNU-style) options
in the form of `-f`, `--foo`, `--foo-bar` and `--foo=bar` are parsed.
XF68-style long options (i.e. `-foo`) are not supported but support
can be added by extending this class.
If passing through `--foo-bar` this previously (pre 1.1) resulted in
th... | [
"Parse",
"incoming",
"request",
"from",
"console",
".",
"Short",
"and",
"long",
"(",
"GNU",
"-",
"style",
")",
"options",
"in",
"the",
"form",
"of",
"-",
"f",
"--",
"foo",
"--",
"foo",
"-",
"bar",
"and",
"--",
"foo",
"=",
"bar",
"are",
"parsed",
".... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/Router.php#L34-L62 |
UnionOfRAD/lithium | security/auth/adapter/Http.php | Http._basic | protected function _basic($request) {
$users = $this->_config['users'];
$username = $request->env('PHP_AUTH_USER');
$auth = $this->_classes['auth'];
$basic = $auth::encode($username, $request->env('PHP_AUTH_PW'));
$encoded = ['response' => null];
if (isset($users[$username])) {
$encoded = $auth::encode(... | php | protected function _basic($request) {
$users = $this->_config['users'];
$username = $request->env('PHP_AUTH_USER');
$auth = $this->_classes['auth'];
$basic = $auth::encode($username, $request->env('PHP_AUTH_PW'));
$encoded = ['response' => null];
if (isset($users[$username])) {
$encoded = $auth::encode(... | [
"protected",
"function",
"_basic",
"(",
"$",
"request",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"_config",
"[",
"'users'",
"]",
";",
"$",
"username",
"=",
"$",
"request",
"->",
"env",
"(",
"'PHP_AUTH_USER'",
")",
";",
"$",
"auth",
"=",
"$",
... | Handler for HTTP Basic Authentication
@param \lithium\action\Request $request
@return void|array | [
"Handler",
"for",
"HTTP",
"Basic",
"Authentication"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/security/auth/adapter/Http.php#L114-L129 |
UnionOfRAD/lithium | security/auth/adapter/Http.php | Http._digest | protected function _digest($request) {
$username = $password = null;
$auth = $this->_classes['auth'];
$data = $auth::decode($request->env('PHP_AUTH_DIGEST'));
$data['realm'] = $this->_config['realm'];
$data['method'] = $request->method;
$users = $this->_config['users'];
if (!empty($data['username']) && !... | php | protected function _digest($request) {
$username = $password = null;
$auth = $this->_classes['auth'];
$data = $auth::decode($request->env('PHP_AUTH_DIGEST'));
$data['realm'] = $this->_config['realm'];
$data['method'] = $request->method;
$users = $this->_config['users'];
if (!empty($data['username']) && !... | [
"protected",
"function",
"_digest",
"(",
"$",
"request",
")",
"{",
"$",
"username",
"=",
"$",
"password",
"=",
"null",
";",
"$",
"auth",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'auth'",
"]",
";",
"$",
"data",
"=",
"$",
"auth",
"::",
"decode",
"("... | Handler for HTTP Digest Authentication
@param \lithium\action\Request $request
@return boolean|array | [
"Handler",
"for",
"HTTP",
"Digest",
"Authentication"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/security/auth/adapter/Http.php#L137-L160 |
UnionOfRAD/lithium | util/Collection.php | Collection.invoke | public function invoke($method, array $params = [], array $options = []) {
$class = get_class($this);
$defaults = ['merge' => false, 'collect' => false];
$options += $defaults;
$data = [];
foreach ($this as $object) {
$value = call_user_func_array([&$object, $method], $params);
($options['merge']) ? $d... | php | public function invoke($method, array $params = [], array $options = []) {
$class = get_class($this);
$defaults = ['merge' => false, 'collect' => false];
$options += $defaults;
$data = [];
foreach ($this as $object) {
$value = call_user_func_array([&$object, $method], $params);
($options['merge']) ? $d... | [
"public",
"function",
"invoke",
"(",
"$",
"method",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"defaults",
"=",
"[",
"'merge'... | Handles dispatching of methods against all items in the collection.
@param string $method The name of the method to call on each instance in the collection.
@param array $params The parameters to pass on each method call.
@param array $options Specifies options for how to run the given method against the object
collec... | [
"Handles",
"dispatching",
"of",
"methods",
"against",
"all",
"items",
"in",
"the",
"collection",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L187-L198 |
UnionOfRAD/lithium | util/Collection.php | Collection.respondsTo | public function respondsTo($method, $internal = false) {
$magicMethod = count($this->_data) > 0 && $this->_data[0]->respondsTo($method, $internal);
return $magicMethod || parent::respondsTo($method, $internal);
} | php | public function respondsTo($method, $internal = false) {
$magicMethod = count($this->_data) > 0 && $this->_data[0]->respondsTo($method, $internal);
return $magicMethod || parent::respondsTo($method, $internal);
} | [
"public",
"function",
"respondsTo",
"(",
"$",
"method",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"$",
"magicMethod",
"=",
"count",
"(",
"$",
"this",
"->",
"_data",
")",
">",
"0",
"&&",
"$",
"this",
"->",
"_data",
"[",
"0",
"]",
"->",
"responds... | 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/Collection.php#L220-L223 |
UnionOfRAD/lithium | util/Collection.php | Collection.to | public function to($format, array $options = []) {
$defaults = ['internal' => false];
$options += $defaults;
$data = $options['internal'] ? $this->_data : $this;
return $this->_to($format, $data, $options);
} | php | public function to($format, array $options = []) {
$defaults = ['internal' => false];
$options += $defaults;
$data = $options['internal'] ? $this->_data : $this;
return $this->_to($format, $data, $options);
} | [
"public",
"function",
"to",
"(",
"$",
"format",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'internal'",
"=>",
"false",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"data",
"=",
"$",
"options",
... | Converts a `Collection` object to another type of object, or a simple type such as an array.
The supported values of `$format` depend on the format handlers registered in the static
property `Collection::$_formats`. The `Collection` class comes with built-in support for
array conversion, but other formats may be regist... | [
"Converts",
"a",
"Collection",
"object",
"to",
"another",
"type",
"of",
"object",
"or",
"a",
"simple",
"type",
"such",
"as",
"an",
"array",
".",
"The",
"supported",
"values",
"of",
"$format",
"depend",
"on",
"the",
"format",
"handlers",
"registered",
"in",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L253-L258 |
UnionOfRAD/lithium | util/Collection.php | Collection.find | public function find($filter, array $options = []) {
$defaults = ['collect' => true];
$options += $defaults;
$data = array_filter($this->_data, $filter);
if ($options['collect']) {
$class = get_class($this);
$data = new $class(compact('data'));
}
return $data;
} | php | public function find($filter, array $options = []) {
$defaults = ['collect' => true];
$options += $defaults;
$data = array_filter($this->_data, $filter);
if ($options['collect']) {
$class = get_class($this);
$data = new $class(compact('data'));
}
return $data;
} | [
"public",
"function",
"find",
"(",
"$",
"filter",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'collect'",
"=>",
"true",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"data",
"=",
"array_filter",
"... | Filters a copy of the items in the collection.
@param callback $filter Callback to use for filtering.
@param array $options The available options are:
- `'collect'`: If `true`, the results will be returned wrapped in a new
`Collection` object or subclass. Defaults to `true`.
@return mixed The filtered items. Will be a... | [
"Filters",
"a",
"copy",
"of",
"the",
"items",
"in",
"the",
"collection",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L296-L306 |
UnionOfRAD/lithium | util/Collection.php | Collection.first | public function first($filter = null) {
if (!$filter) {
return $this->rewind();
}
foreach ($this as $item) {
if ($filter($item)) {
return $item;
}
}
} | php | public function first($filter = null) {
if (!$filter) {
return $this->rewind();
}
foreach ($this as $item) {
if ($filter($item)) {
return $item;
}
}
} | [
"public",
"function",
"first",
"(",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"filter",
")",
"{",
"return",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"as",
"$",
"item",
")",
"{",
"if",
"(",
... | Rewinds the collection and returns the first item or when a filter is used,
returns the first non-empty item after the filter is applied.
@see lithium\util\Collection::rewind()
@param callable $filter An optional callable through which items will be passed.
If the return value of this function is trueish, it will be ... | [
"Rewinds",
"the",
"collection",
"and",
"returns",
"the",
"first",
"item",
"or",
"when",
"a",
"filter",
"is",
"used",
"returns",
"the",
"first",
"non",
"-",
"empty",
"item",
"after",
"the",
"filter",
"is",
"applied",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L320-L329 |
UnionOfRAD/lithium | util/Collection.php | Collection.map | public function map($filter, array $options = []) {
$defaults = ['collect' => true];
$options += $defaults;
$data = array_map($filter, $this->_data);
if ($options['collect']) {
$class = get_class($this);
return new $class(compact('data'));
}
return $data;
} | php | public function map($filter, array $options = []) {
$defaults = ['collect' => true];
$options += $defaults;
$data = array_map($filter, $this->_data);
if ($options['collect']) {
$class = get_class($this);
return new $class(compact('data'));
}
return $data;
} | [
"public",
"function",
"map",
"(",
"$",
"filter",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'collect'",
"=>",
"true",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"data",
"=",
"array_map",
"(",
... | Applies a callback to a copy of all data in the collection
and returns the result.
@link http://php.net/array_map
@param callback $filter The filter to apply.
@param array $options The available options are:
- `'collect'`: If `true`, the results will be returned wrapped
in a new `Collection` object or subclass.
@retur... | [
"Applies",
"a",
"callback",
"to",
"a",
"copy",
"of",
"all",
"data",
"in",
"the",
"collection",
"and",
"returns",
"the",
"result",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L355-L365 |
UnionOfRAD/lithium | util/Collection.php | Collection.sort | public function sort($sorter = 'sort', array $options = []) {
if (is_string($sorter) && strpos($sorter, 'sort') !== false && is_callable($sorter)) {
call_user_func_array($sorter, [&$this->_data]);
} elseif (is_callable($sorter)) {
usort($this->_data, $sorter);
}
return $this;
} | php | public function sort($sorter = 'sort', array $options = []) {
if (is_string($sorter) && strpos($sorter, 'sort') !== false && is_callable($sorter)) {
call_user_func_array($sorter, [&$this->_data]);
} elseif (is_callable($sorter)) {
usort($this->_data, $sorter);
}
return $this;
} | [
"public",
"function",
"sort",
"(",
"$",
"sorter",
"=",
"'sort'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"sorter",
")",
"&&",
"strpos",
"(",
"$",
"sorter",
",",
"'sort'",
")",
"!==",
"false",
"&&",
... | Sorts the objects in the collection.
@link http://php.net/sort
@link http://php.net/usort
@link http://php.net/strcmp
@param string|callable $sorter The sorter for the data. Either a callable to use
as the sort function or a string with the name of a well-known sort function like
`'natsort'` or a compare function like... | [
"Sorts",
"the",
"objects",
"in",
"the",
"collection",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L392-L399 |
UnionOfRAD/lithium | util/Collection.php | Collection.offsetUnset | public function offsetUnset($offset) {
prev($this->_data);
if (key($this->_data) === null) {
$this->rewind();
}
unset($this->_data[$offset]);
} | php | public function offsetUnset($offset) {
prev($this->_data);
if (key($this->_data) === null) {
$this->rewind();
}
unset($this->_data[$offset]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
"{",
"prev",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"if",
"(",
"key",
"(",
"$",
"this",
"->",
"_data",
")",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"... | Unsets an offset.
@param string $offset The offset to unset. | [
"Unsets",
"an",
"offset",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L440-L446 |
UnionOfRAD/lithium | util/Collection.php | Collection.next | public function next() {
$value = next($this->_data);
return key($this->_data) !== null ? $value : false;
} | php | public function next() {
$value = next($this->_data);
return key($this->_data) !== null ? $value : false;
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"value",
"=",
"next",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"return",
"key",
"(",
"$",
"this",
"->",
"_data",
")",
"!==",
"null",
"?",
"$",
"value",
":",
"false",
";",
"}"
] | Moves forward to the next item.
@return mixed The next item or `false`, in case there's no next item or the collection
is empty. | [
"Moves",
"forward",
"to",
"the",
"next",
"item",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L512-L515 |
UnionOfRAD/lithium | util/Collection.php | Collection.append | public function append($value) {
is_object($value) ? $this->_data[] =& $value : $this->_data[] = $value;
} | php | public function append($value) {
is_object($value) ? $this->_data[] =& $value : $this->_data[] = $value;
} | [
"public",
"function",
"append",
"(",
"$",
"value",
")",
"{",
"is_object",
"(",
"$",
"value",
")",
"?",
"$",
"this",
"->",
"_data",
"[",
"]",
"=",
"&",
"$",
"value",
":",
"$",
"this",
"->",
"_data",
"[",
"]",
"=",
"$",
"value",
";",
"}"
] | Appends an item.
@param mixed $value The item to append. | [
"Appends",
"an",
"item",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L522-L524 |
UnionOfRAD/lithium | util/Collection.php | Collection.toArray | public static function toArray($data, array $options = []) {
$defaults = ['handlers' => []];
$options += $defaults;
$result = [];
foreach ($data as $key => $item) {
switch (true) {
case is_array($item):
$result[$key] = static::toArray($item, $options);
break;
case (!is_object($item)):
... | php | public static function toArray($data, array $options = []) {
$defaults = ['handlers' => []];
$options += $defaults;
$result = [];
foreach ($data as $key => $item) {
switch (true) {
case is_array($item):
$result[$key] = static::toArray($item, $options);
break;
case (!is_object($item)):
... | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'handlers'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"result",
"=",
... | Exports a `Collection` instance to an array. Used by `Collection::to()`.
@param mixed $data Either a `Collection` instance, or an array representing a `Collection`'s
internal state.
@param array $options Options used when converting `$data` to an array:
- `'handlers'` _array_: An array where the keys are fully-namespa... | [
"Exports",
"a",
"Collection",
"instance",
"to",
"an",
"array",
".",
"Used",
"by",
"Collection",
"::",
"to",
"()",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Collection.php#L558-L589 |
UnionOfRAD/lithium | analysis/logger/adapter/FirePhp.php | FirePhp.bind | public function bind($response) {
$this->_response = $response;
$this->_response->headers += $this->_headers;
foreach ($this->_queue as $message) {
$this->_write($message);
}
} | php | public function bind($response) {
$this->_response = $response;
$this->_response->headers += $this->_headers;
foreach ($this->_queue as $message) {
$this->_write($message);
}
} | [
"public",
"function",
"bind",
"(",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"_response",
"=",
"$",
"response",
";",
"$",
"this",
"->",
"_response",
"->",
"headers",
"+=",
"$",
"this",
"->",
"_headers",
";",
"foreach",
"(",
"$",
"this",
"->",
"_q... | Binds the response object to the logger and sets the required Wildfire
protocol headers.
@param object $response An instance of a response object (usually `lithium\action\Response`)
with HTTP request information.
@return void | [
"Binds",
"the",
"response",
"object",
"to",
"the",
"logger",
"and",
"sets",
"the",
"required",
"Wildfire",
"protocol",
"headers",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/logger/adapter/FirePhp.php#L136-L143 |
UnionOfRAD/lithium | analysis/logger/adapter/FirePhp.php | FirePhp.write | public function write($priority, $message) {
return function($params) {
$priority = $params['priority'];
$message = $params['message'];
$message = $this->_format($priority, $message);
$this->_write($message);
return true;
};
} | php | public function write($priority, $message) {
return function($params) {
$priority = $params['priority'];
$message = $params['message'];
$message = $this->_format($priority, $message);
$this->_write($message);
return true;
};
} | [
"public",
"function",
"write",
"(",
"$",
"priority",
",",
"$",
"message",
")",
"{",
"return",
"function",
"(",
"$",
"params",
")",
"{",
"$",
"priority",
"=",
"$",
"params",
"[",
"'priority'",
"]",
";",
"$",
"message",
"=",
"$",
"params",
"[",
"'messa... | Appends a log message to the response header for FirePHP.
@param string $priority Represents the message priority.
@param string $message Contains the actual message to store.
@return boolean Always returns `true`. Note that in order for message-writing to take effect,
the adapter must be bound to the `Response` objec... | [
"Appends",
"a",
"log",
"message",
"to",
"the",
"response",
"header",
"for",
"FirePHP",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/logger/adapter/FirePhp.php#L154-L162 |
UnionOfRAD/lithium | analysis/logger/adapter/FirePhp.php | FirePhp._write | protected function _write($message) {
if (!$this->_response) {
return $this->_queue[] = $message;
}
$this->_response->headers[$message['key']] = $message['content'];
} | php | protected function _write($message) {
if (!$this->_response) {
return $this->_queue[] = $message;
}
$this->_response->headers[$message['key']] = $message['content'];
} | [
"protected",
"function",
"_write",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_response",
")",
"{",
"return",
"$",
"this",
"->",
"_queue",
"[",
"]",
"=",
"$",
"message",
";",
"}",
"$",
"this",
"->",
"_response",
"->",
"heade... | Helper method that writes the message to the header of a bound `Response` object. If no
`Response` object is bound when this method is called, it is stored in a message queue.
@see lithium\analysis\logger\adapter\FirePhp::_format()
@param array $message A message containing the key and the content to store.
@return ar... | [
"Helper",
"method",
"that",
"writes",
"the",
"message",
"to",
"the",
"header",
"of",
"a",
"bound",
"Response",
"object",
".",
"If",
"no",
"Response",
"object",
"is",
"bound",
"when",
"this",
"method",
"is",
"called",
"it",
"is",
"stored",
"in",
"a",
"mes... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/logger/adapter/FirePhp.php#L172-L177 |
UnionOfRAD/lithium | analysis/logger/adapter/FirePhp.php | FirePhp._format | protected function _format($type, $message) {
$key = 'X-Wf-1-1-1-' . $this->_counter++;
$content = [['Type' => $this->_levels[$type]], $message];
$content = json_encode($content);
$content = strlen($content) . '|' . $content . '|';
return compact('key', 'content');
} | php | protected function _format($type, $message) {
$key = 'X-Wf-1-1-1-' . $this->_counter++;
$content = [['Type' => $this->_levels[$type]], $message];
$content = json_encode($content);
$content = strlen($content) . '|' . $content . '|';
return compact('key', 'content');
} | [
"protected",
"function",
"_format",
"(",
"$",
"type",
",",
"$",
"message",
")",
"{",
"$",
"key",
"=",
"'X-Wf-1-1-1-'",
".",
"$",
"this",
"->",
"_counter",
"++",
";",
"$",
"content",
"=",
"[",
"[",
"'Type'",
"=>",
"$",
"this",
"->",
"_levels",
"[",
... | Generates a string representation of the type and message, suitable for FirePHP.
@param string $type Represents the message priority.
@param string $message Contains the actual message to store.
@return array Returns the encoded string representations of the priority and message, in the
`'key'` and `'content'` keys, r... | [
"Generates",
"a",
"string",
"representation",
"of",
"the",
"type",
"and",
"message",
"suitable",
"for",
"FirePHP",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/analysis/logger/adapter/FirePhp.php#L187-L195 |
UnionOfRAD/lithium | util/Set.php | Set.append | public static function append(array $array, array $array2) {
$arrays = func_get_args();
$array = array_shift($arrays);
foreach ($arrays as $array2) {
if (!$array && $array2) {
$array = $array2;
continue;
}
foreach ($array2 as $key => $value) {
if (!array_key_exists($key, $array)) {
$arra... | php | public static function append(array $array, array $array2) {
$arrays = func_get_args();
$array = array_shift($arrays);
foreach ($arrays as $array2) {
if (!$array && $array2) {
$array = $array2;
continue;
}
foreach ($array2 as $key => $value) {
if (!array_key_exists($key, $array)) {
$arra... | [
"public",
"static",
"function",
"append",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"array2",
")",
"{",
"$",
"arrays",
"=",
"func_get_args",
"(",
")",
";",
"$",
"array",
"=",
"array_shift",
"(",
"$",
"arrays",
")",
";",
"foreach",
"(",
"$",
"arr... | Add the keys/values in `$array2` that are not found in `$array` onto the end of `$array`.
@param mixed $array Original array.
@param mixed $array2 Second array to add onto the original.
@return array An array containing all the keys of the second array not already present in the
first. | [
"Add",
"the",
"keys",
"/",
"values",
"in",
"$array2",
"that",
"are",
"not",
"found",
"in",
"$array",
"onto",
"the",
"end",
"of",
"$array",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L40-L57 |
UnionOfRAD/lithium | util/Set.php | Set.check | public static function check($data, $path = null) {
if (!$path) {
return $data;
}
$path = is_array($path) ? $path : explode('.', $path);
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i === count($path) - 1) {
retu... | php | public static function check($data, $path = null) {
if (!$path) {
return $data;
}
$path = is_array($path) ? $path : explode('.', $path);
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i === count($path) - 1) {
retu... | [
"public",
"static",
"function",
"check",
"(",
"$",
"data",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"path",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"path",
"=",
"is_array",
"(",
"$",
"path",
")",
"?",
"$",
"path",
... | Checks if a particular path is set in an array. Tests by key name, or dot-delimited key
name, i.e.:
``` embed:lithium\tests\cases\util\SetTest::testCheck(1-4) ```
@param mixed $data Data to check on.
@param mixed $path A dot-delimited string.
@return boolean `true` if path is found, `false` otherwise. | [
"Checks",
"if",
"a",
"particular",
"path",
"is",
"set",
"in",
"an",
"array",
".",
"Tests",
"by",
"key",
"name",
"or",
"dot",
"-",
"delimited",
"key",
"name",
"i",
".",
"e",
".",
":"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L69-L88 |
UnionOfRAD/lithium | util/Set.php | Set.combine | public static function combine($data, $path1 = null, $path2 = null, $groupPath = null) {
if (!$data) {
return [];
}
if (is_object($data)) {
$data = get_object_vars($data);
}
if (is_array($path1)) {
$format = array_shift($path1);
$keys = static::format($data, $format, $path1);
} else {
$keys =... | php | public static function combine($data, $path1 = null, $path2 = null, $groupPath = null) {
if (!$data) {
return [];
}
if (is_object($data)) {
$data = get_object_vars($data);
}
if (is_array($path1)) {
$format = array_shift($path1);
$keys = static::format($data, $format, $path1);
} else {
$keys =... | [
"public",
"static",
"function",
"combine",
"(",
"$",
"data",
",",
"$",
"path1",
"=",
"null",
",",
"$",
"path2",
"=",
"null",
",",
"$",
"groupPath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if"... | Creates an associative array using a `$path1` as the path to build its keys, and optionally
`$path2` as path to get the values. If `$path2` is not specified, all values will be
initialized to `null` (useful for `Set::merge()`). You can optionally group the values by
what is obtained when following the path specified in... | [
"Creates",
"an",
"associative",
"array",
"using",
"a",
"$path1",
"as",
"the",
"path",
"to",
"build",
"its",
"keys",
"and",
"optionally",
"$path2",
"as",
"path",
"to",
"get",
"the",
"values",
".",
"If",
"$path2",
"is",
"not",
"specified",
"all",
"values",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L102-L145 |
UnionOfRAD/lithium | util/Set.php | Set.contains | public static function contains(array $array1, array $array2) {
if (!$array1 || !$array2) {
return false;
}
foreach ($array2 as $key => $val) {
if (!isset($array1[$key]) || $array1[$key] !== $val) {
return false;
}
if (is_array($val) && !static::contains($array1[$key], $val)) {
return false;
... | php | public static function contains(array $array1, array $array2) {
if (!$array1 || !$array2) {
return false;
}
foreach ($array2 as $key => $val) {
if (!isset($array1[$key]) || $array1[$key] !== $val) {
return false;
}
if (is_array($val) && !static::contains($array1[$key], $val)) {
return false;
... | [
"public",
"static",
"function",
"contains",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
")",
"{",
"if",
"(",
"!",
"$",
"array1",
"||",
"!",
"$",
"array2",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"array2",
"as",
"$"... | Determines if the array elements in `$array2` are wholly contained within `$array1`. Works
recursively.
@param array $array1 First value.
@param array $array2 Second value.
@return boolean Returns `true` if `$array1` wholly contains the keys and values of `$array2`,
otherwise, returns `false`. Returns `false` if eithe... | [
"Determines",
"if",
"the",
"array",
"elements",
"in",
"$array2",
"are",
"wholly",
"contained",
"within",
"$array1",
".",
"Works",
"recursively",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L156-L169 |
UnionOfRAD/lithium | util/Set.php | Set.depth | public static function depth($data, array $options = []) {
$defaults = ['all' => false, 'count' => 0];
$options += $defaults;
if (!$data) {
return 0;
}
if (!$options['all']) {
return (is_array(reset($data))) ? static::depth(reset($data)) + 1 : 1;
}
$depth = [$options['count']];
if (is_array($da... | php | public static function depth($data, array $options = []) {
$defaults = ['all' => false, 'count' => 0];
$options += $defaults;
if (!$data) {
return 0;
}
if (!$options['all']) {
return (is_array(reset($data))) ? static::depth(reset($data)) + 1 : 1;
}
$depth = [$options['count']];
if (is_array($da... | [
"public",
"static",
"function",
"depth",
"(",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'all'",
"=>",
"false",
",",
"'count'",
"=>",
"0",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
... | Counts the dimensions of an array. If `$all` is set to `false` (which is the default) it will
only consider the dimension of the first element in the array.
@param array $data Array to count dimensions on.
@param array $options
@return integer The number of dimensions in `$array`. | [
"Counts",
"the",
"dimensions",
"of",
"an",
"array",
".",
"If",
"$all",
"is",
"set",
"to",
"false",
"(",
"which",
"is",
"the",
"default",
")",
"it",
"will",
"only",
"consider",
"the",
"dimension",
"of",
"the",
"first",
"element",
"in",
"the",
"array",
"... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L179-L201 |
UnionOfRAD/lithium | util/Set.php | Set.diff | public static function diff(array $val1, array $val2) {
if (!$val1 || !$val2) {
return $val2 ?: $val1;
}
$out = [];
foreach ($val1 as $key => $val) {
$exists = isset($val2[$key]);
if (($exists && $val2[$key] !== $val) || !$exists) {
$out[$key] = $val;
}
unset($val2[$key]);
}
foreach ($... | php | public static function diff(array $val1, array $val2) {
if (!$val1 || !$val2) {
return $val2 ?: $val1;
}
$out = [];
foreach ($val1 as $key => $val) {
$exists = isset($val2[$key]);
if (($exists && $val2[$key] !== $val) || !$exists) {
$out[$key] = $val;
}
unset($val2[$key]);
}
foreach ($... | [
"public",
"static",
"function",
"diff",
"(",
"array",
"$",
"val1",
",",
"array",
"$",
"val2",
")",
"{",
"if",
"(",
"!",
"$",
"val1",
"||",
"!",
"$",
"val2",
")",
"{",
"return",
"$",
"val2",
"?",
":",
"$",
"val1",
";",
"}",
"$",
"out",
"=",
"[... | Computes the difference between two arrays.
@param array $val1 First value.
@param array $val2 Second value.
@return array Computed difference. | [
"Computes",
"the",
"difference",
"between",
"two",
"arrays",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L210-L231 |
UnionOfRAD/lithium | util/Set.php | Set.extract | public static function extract(array $data, $path = null, array $options = []) {
$defaults = ['flatten' => true];
$options += $defaults;
if (!$data) {
return [];
}
if ($path === '/') {
return array_filter($data, function($data) {
return ($data === 0 || $data === '0' || !empty($data));
});
}
... | php | public static function extract(array $data, $path = null, array $options = []) {
$defaults = ['flatten' => true];
$options += $defaults;
if (!$data) {
return [];
}
if ($path === '/') {
return array_filter($data, function($data) {
return ($data === 0 || $data === '0' || !empty($data));
});
}
... | [
"public",
"static",
"function",
"extract",
"(",
"array",
"$",
"data",
",",
"$",
"path",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'flatten'",
"=>",
"true",
"]",
";",
"$",
"options",
"+=",
"$",
... | Implements partial support for XPath 2.0.
@param array $data An array of data to extract from.
@param string $path An absolute XPath 2.0 path. Only absolute paths starting with a
single slash are supported right now. Implemented selectors:
- `'/User/id'`: Similar to the classic {n}.User.id.
- `'/User[2]/name'`: Select... | [
"Implements",
"partial",
"support",
"for",
"XPath",
"2",
".",
"0",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L256-L392 |
UnionOfRAD/lithium | util/Set.php | Set.flatten | public static function flatten($data, array $options = []) {
$defaults = ['separator' => '.', 'path' => null];
$options += $defaults;
$result = [];
if ($options['path'] !== null) {
$options['path'] .= $options['separator'];
}
foreach ($data as $key => $val) {
if (!is_array($val)) {
$result[$optio... | php | public static function flatten($data, array $options = []) {
$defaults = ['separator' => '.', 'path' => null];
$options += $defaults;
$result = [];
if ($options['path'] !== null) {
$options['path'] .= $options['separator'];
}
foreach ($data as $key => $val) {
if (!is_array($val)) {
$result[$optio... | [
"public",
"static",
"function",
"flatten",
"(",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'separator'",
"=>",
"'.'",
",",
"'path'",
"=>",
"null",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
... | Collapses a multi-dimensional array into a single dimension, using a delimited array path
for each array element's key, i.e. [array('Foo' => ['Bar' => 'Far'])] becomes
['0.Foo.Bar' => 'Far'].
@param array $data array to flatten
@param array $options Available options are:
- `'separator'`: String to separate array keys... | [
"Collapses",
"a",
"multi",
"-",
"dimensional",
"array",
"into",
"a",
"single",
"dimension",
"using",
"a",
"delimited",
"array",
"path",
"for",
"each",
"array",
"element",
"s",
"key",
"i",
".",
"e",
".",
"[",
"array",
"(",
"Foo",
"=",
">",
"[",
"Bar",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L405-L422 |
UnionOfRAD/lithium | util/Set.php | Set.expand | public static function expand(array $data, array $options = []) {
$defaults = ['separator' => '.'];
$options += $defaults;
$result = [];
foreach ($data as $key => $val) {
if (strpos($key, $options['separator']) === false) {
if (!isset($result[$key])) {
$result[$key] = $val;
}
continue;
}... | php | public static function expand(array $data, array $options = []) {
$defaults = ['separator' => '.'];
$options += $defaults;
$result = [];
foreach ($data as $key => $val) {
if (strpos($key, $options['separator']) === false) {
if (!isset($result[$key])) {
$result[$key] = $val;
}
continue;
}... | [
"public",
"static",
"function",
"expand",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'separator'",
"=>",
"'.'",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"result",
... | Accepts a one-dimensional array where the keys are separated by a delimiter.
@param array $data The one-dimensional array to expand.
@param array $options The options used when expanding the array:
- `'separator'` _string_: The delimiter to use when separating keys. Defaults
to `'.'`.
@return array Returns a multi-dim... | [
"Accepts",
"a",
"one",
"-",
"dimensional",
"array",
"where",
"the",
"keys",
"are",
"separated",
"by",
"a",
"delimiter",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L434-L456 |
UnionOfRAD/lithium | util/Set.php | Set.format | public static function format($data, $format, $keys) {
$extracted = [];
$count = count($keys);
if (!$count) {
return;
}
for ($i = 0; $i < $count; $i++) {
$extracted[] = static::extract($data, $keys[$i]);
}
$out = [];
$data = $extracted;
$count = count($data[0]);
if (preg_match_all('/\{([0-9]... | php | public static function format($data, $format, $keys) {
$extracted = [];
$count = count($keys);
if (!$count) {
return;
}
for ($i = 0; $i < $count; $i++) {
$extracted[] = static::extract($data, $keys[$i]);
}
$out = [];
$data = $extracted;
$count = count($data[0]);
if (preg_match_all('/\{([0-9]... | [
"public",
"static",
"function",
"format",
"(",
"$",
"data",
",",
"$",
"format",
",",
"$",
"keys",
")",
"{",
"$",
"extracted",
"=",
"[",
"]",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"keys",
")",
";",
"if",
"(",
"!",
"$",
"count",
")",
"{",
... | Returns a series of values extracted from an array, formatted in a format string.
@param array $data Source array from which to extract the data.
@param string $format Format string into which values will be inserted using `sprintf()`.
@param array $keys An array containing one or more `Set::extract()`-style key paths... | [
"Returns",
"a",
"series",
"of",
"values",
"extracted",
"from",
"an",
"array",
"formatted",
"in",
"a",
"format",
"string",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L467-L513 |
UnionOfRAD/lithium | util/Set.php | Set.insert | public static function insert($list, $path, $data = []) {
if (!is_array($path)) {
$path = explode('.', $path);
}
$_list =& $list;
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i === count($path) - 1) {
$_list[$key... | php | public static function insert($list, $path, $data = []) {
if (!is_array($path)) {
$path = explode('.', $path);
}
$_list =& $list;
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i === count($path) - 1) {
$_list[$key... | [
"public",
"static",
"function",
"insert",
"(",
"$",
"list",
",",
"$",
"path",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",
"explode",
"(",
"'.'",
",",
"$",
"path",
"... | Inserts `$data` into an array as defined by `$path`.
@param mixed $list Where to insert into.
@param mixed $path A dot-delimited string.
@param array $data Data to insert.
@return array | [
"Inserts",
"$data",
"into",
"an",
"array",
"as",
"defined",
"by",
"$path",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L523-L543 |
UnionOfRAD/lithium | util/Set.php | Set.isNumeric | public static function isNumeric($array = null) {
if (empty($array)) {
return null;
}
if ($array === range(0, count($array) - 1)) {
return true;
}
$numeric = true;
$keys = array_keys($array);
$count = count($keys);
for ($i = 0; $i < $count; $i++) {
if (!is_numeric($array[$keys[$i]])) {
$nu... | php | public static function isNumeric($array = null) {
if (empty($array)) {
return null;
}
if ($array === range(0, count($array) - 1)) {
return true;
}
$numeric = true;
$keys = array_keys($array);
$count = count($keys);
for ($i = 0; $i < $count; $i++) {
if (!is_numeric($array[$keys[$i]])) {
$nu... | [
"public",
"static",
"function",
"isNumeric",
"(",
"$",
"array",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"array",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"array",
"===",
"range",
"(",
"0",
",",
"count",
"(",
"$",
... | Checks to see if all the values in the array are numeric.
@param array $array The array to check. If null, the value of the current Set object.
@return mixed `true` if values are numeric, `false` if not and `null` if the array to
check is empty. | [
"Checks",
"to",
"see",
"if",
"all",
"the",
"values",
"in",
"the",
"array",
"are",
"numeric",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L552-L570 |
UnionOfRAD/lithium | util/Set.php | Set.matches | public static function matches($data, $conditions, $i = null, $length = null) {
if (!$conditions) {
return true;
}
if (is_string($conditions)) {
return (boolean) static::extract($data, $conditions);
}
foreach ($conditions as $condition) {
if ($condition === ':last') {
if ($i !== $length) {
r... | php | public static function matches($data, $conditions, $i = null, $length = null) {
if (!$conditions) {
return true;
}
if (is_string($conditions)) {
return (boolean) static::extract($data, $conditions);
}
foreach ($conditions as $condition) {
if ($condition === ':last') {
if ($i !== $length) {
r... | [
"public",
"static",
"function",
"matches",
"(",
"$",
"data",
",",
"$",
"conditions",
",",
"$",
"i",
"=",
"null",
",",
"$",
"length",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"conditions",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"is_st... | This function can be used to see if a single item or a given XPath
match certain conditions.
@param array $data An array of data to execute the match on.
@param mixed $conditions An array of condition strings or an XPath expression.
@param integer $i Optional: The 'nth'-number of the item being matched.
@param integer... | [
"This",
"function",
"can",
"be",
"used",
"to",
"see",
"if",
"a",
"single",
"item",
"or",
"a",
"given",
"XPath",
"match",
"certain",
"conditions",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L582-L637 |
UnionOfRAD/lithium | util/Set.php | Set.merge | public static function merge(array $array1, array $array2) {
$args = [$array1, $array2];
if (!$array1 || !$array2) {
return $array1 ?: $array2;
}
$result = (array) current($args);
while (($arg = next($args)) !== false) {
foreach ((array) $arg as $key => $val) {
if (is_array($val) && isset($result[... | php | public static function merge(array $array1, array $array2) {
$args = [$array1, $array2];
if (!$array1 || !$array2) {
return $array1 ?: $array2;
}
$result = (array) current($args);
while (($arg = next($args)) !== false) {
foreach ((array) $arg as $key => $val) {
if (is_array($val) && isset($result[... | [
"public",
"static",
"function",
"merge",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
")",
"{",
"$",
"args",
"=",
"[",
"$",
"array1",
",",
"$",
"array2",
"]",
";",
"if",
"(",
"!",
"$",
"array1",
"||",
"!",
"$",
"array2",
")",
"{",
... | This method can be thought of as a hybrid between PHP's `array_merge()`
and `array_merge_recursive()`. The difference to the two is that if an
array key contains another array then the function behaves recursive
(unlike `array_merge()`) but does not do if for keys containing strings
(unlike `array_merge_recursive()`).... | [
"This",
"method",
"can",
"be",
"thought",
"of",
"as",
"a",
"hybrid",
"between",
"PHP",
"s",
"array_merge",
"()",
"and",
"array_merge_recursive",
"()",
".",
"The",
"difference",
"to",
"the",
"two",
"is",
"that",
"if",
"an",
"array",
"key",
"contains",
"anot... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L652-L672 |
UnionOfRAD/lithium | util/Set.php | Set.normalize | public static function normalize($list, $assoc = true, $sep = ',', $trim = true) {
if (is_string($list)) {
$list = explode($sep, $list);
$list = ($trim) ? array_map('trim', $list) : $list;
return ($assoc) ? static::normalize($list) : $list;
}
if (!is_array($list)) {
return $list;
}
$keys = array... | php | public static function normalize($list, $assoc = true, $sep = ',', $trim = true) {
if (is_string($list)) {
$list = explode($sep, $list);
$list = ($trim) ? array_map('trim', $list) : $list;
return ($assoc) ? static::normalize($list) : $list;
}
if (!is_array($list)) {
return $list;
}
$keys = array... | [
"public",
"static",
"function",
"normalize",
"(",
"$",
"list",
",",
"$",
"assoc",
"=",
"true",
",",
"$",
"sep",
"=",
"','",
",",
"$",
"trim",
"=",
"true",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"list",
")",
")",
"{",
"$",
"list",
"=",
"exp... | Normalizes a string or array list.
```
Set::normalize('foo,bar'); // returns ['foo' => null, 'bar' => null];
Set::normalize(['foo', 'bar' => 'baz']; // returns ['foo' => null, 'bar' => 'baz'];
```
@param string|array $list List to normalize.
@param boolean $assoc If `true`, `$list` will be converted to an associative... | [
"Normalizes",
"a",
"string",
"or",
"array",
"list",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L688-L724 |
UnionOfRAD/lithium | util/Set.php | Set.remove | public static function remove($list, $path = null) {
if (empty($path)) {
return $list;
}
if (!is_array($path)) {
$path = explode('.', $path);
}
$_list =& $list;
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i =... | php | public static function remove($list, $path = null) {
if (empty($path)) {
return $list;
}
if (!is_array($path)) {
$path = explode('.', $path);
}
$_list =& $list;
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i =... | [
"public",
"static",
"function",
"remove",
"(",
"$",
"list",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"list",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"path",
")",
")",
... | Removes an element from an array as defined by `$path`.
@param mixed $list From where to remove.
@param mixed $path A dot-delimited string.
@return array Array with `$path` removed from its value. | [
"Removes",
"an",
"element",
"from",
"an",
"array",
"as",
"defined",
"by",
"$path",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L733-L756 |
UnionOfRAD/lithium | util/Set.php | Set.sort | public static function sort($data, $path, $dir = 'asc') {
$flatten = function($flatten, $results, $key = null) {
$stack = [];
foreach ((array) $results as $k => $r) {
$id = $k;
if ($key !== null) {
$id = $key;
}
if (is_array($r)) {
$stack = array_merge($stack, $flatten($flatten, $r, $i... | php | public static function sort($data, $path, $dir = 'asc') {
$flatten = function($flatten, $results, $key = null) {
$stack = [];
foreach ((array) $results as $k => $r) {
$id = $k;
if ($key !== null) {
$id = $key;
}
if (is_array($r)) {
$stack = array_merge($stack, $flatten($flatten, $r, $i... | [
"public",
"static",
"function",
"sort",
"(",
"$",
"data",
",",
"$",
"path",
",",
"$",
"dir",
"=",
"'asc'",
")",
"{",
"$",
"flatten",
"=",
"function",
"(",
"$",
"flatten",
",",
"$",
"results",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"stack",
... | Sorts an array by any value, determined by a `Set`-compatible path.
@param array $data
@param string $path A `Set`-compatible path to the array value.
@param string $dir Either `'asc'` (the default) or `'desc'`.
@return array | [
"Sorts",
"an",
"array",
"by",
"any",
"value",
"determined",
"by",
"a",
"Set",
"-",
"compatible",
"path",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/util/Set.php#L766-L797 |
UnionOfRAD/lithium | net/socket/Stream.php | Stream.open | public function open(array $options = []) {
parent::open($options);
$config = $this->_config;
if (!$config['scheme'] || !$config['host']) {
return false;
}
$scheme = ($config['scheme'] !== 'udp') ? 'tcp' : 'udp';
$port = $config['port'] ?: 80;
$host = "{$scheme}://{$config['host']}:{$port}";
$flags ... | php | public function open(array $options = []) {
parent::open($options);
$config = $this->_config;
if (!$config['scheme'] || !$config['host']) {
return false;
}
$scheme = ($config['scheme'] !== 'udp') ? 'tcp' : 'udp';
$port = $config['port'] ?: 80;
$host = "{$scheme}://{$config['host']}:{$port}";
$flags ... | [
"public",
"function",
"open",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"parent",
"::",
"open",
"(",
"$",
"options",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"_config",
";",
"if",
"(",
"!",
"$",
"config",
"[",
"'scheme'",
"]"... | Opens a socket and initializes the internal resource handle.
@param array $options update the config settings
@return mixed Returns `false` if the socket configuration does not contain the
`'scheme'` or `'host'` settings, or if configuration fails, otherwise returns a
resource stream. Throws exception if there is a ne... | [
"Opens",
"a",
"socket",
"and",
"initializes",
"the",
"internal",
"resource",
"handle",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/socket/Stream.php#L33-L61 |
UnionOfRAD/lithium | net/socket/Stream.php | Stream.read | public function read($length = null, $offset = null) {
if (!is_resource($this->_resource)) {
return false;
}
if (!$length) {
return stream_get_contents($this->_resource);
}
return stream_get_contents($this->_resource, $length, $offset);
} | php | public function read($length = null, $offset = null) {
if (!is_resource($this->_resource)) {
return false;
}
if (!$length) {
return stream_get_contents($this->_resource);
}
return stream_get_contents($this->_resource, $length, $offset);
} | [
"public",
"function",
"read",
"(",
"$",
"length",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"_resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"length... | Reads data from the stream resource
@param integer $length If specified, will read up to $length bytes from the stream.
If no value is specified, all remaining bytes in the buffer will be read.
@param integer $offset Seek to the specified byte offset before reading.
@return string Returns string read from stream resou... | [
"Reads",
"data",
"from",
"the",
"stream",
"resource"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/socket/Stream.php#L89-L97 |
UnionOfRAD/lithium | net/socket/Stream.php | Stream.write | public function write($data = null) {
if (!is_resource($this->_resource)) {
return false;
}
if (!is_object($data)) {
$data = $this->_instance($this->_classes['request'], (array) $data + $this->_config);
}
return fwrite($this->_resource, (string) $data, strlen((string) $data));
} | php | public function write($data = null) {
if (!is_resource($this->_resource)) {
return false;
}
if (!is_object($data)) {
$data = $this->_instance($this->_classes['request'], (array) $data + $this->_config);
}
return fwrite($this->_resource, (string) $data, strlen((string) $data));
} | [
"public",
"function",
"write",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"_resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
... | writes data to the stream resource
@param string $data The string to be written.
@return mixed False on error, number of bytes written otherwise. | [
"writes",
"data",
"to",
"the",
"stream",
"resource"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/socket/Stream.php#L105-L113 |
UnionOfRAD/lithium | net/socket/Stream.php | Stream.timeout | public function timeout($time) {
if (!is_resource($this->_resource)) {
return false;
}
return stream_set_timeout($this->_resource, $time);
} | php | public function timeout($time) {
if (!is_resource($this->_resource)) {
return false;
}
return stream_set_timeout($this->_resource, $time);
} | [
"public",
"function",
"timeout",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"_resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"stream_set_timeout",
"(",
"$",
"this",
"->",
"_resource",
",",
"$",
... | Set timeout period on a stream.
@link http://php.net/function.stream-set-timeout.php
PHP Manual: stream_set_timeout()
@param integer $time The timeout value in seconds.
@return boolean | [
"Set",
"timeout",
"period",
"on",
"a",
"stream",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/socket/Stream.php#L123-L128 |
UnionOfRAD/lithium | net/socket/Stream.php | Stream.encoding | public function encoding($charset) {
if (!function_exists('stream_encoding')) {
return false;
}
return is_resource($this->_resource) ? stream_encoding($this->_resource, $charset) : false;
} | php | public function encoding($charset) {
if (!function_exists('stream_encoding')) {
return false;
}
return is_resource($this->_resource) ? stream_encoding($this->_resource, $charset) : false;
} | [
"public",
"function",
"encoding",
"(",
"$",
"charset",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'stream_encoding'",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"is_resource",
"(",
"$",
"this",
"->",
"_resource",
")",
"?",
"stream_encodi... | Sets the character set for stream encoding if possible. The `stream_encoding`
function is not guaranteed to be available as it is seems as if it's experimental
or just not officially documented. If the function is not available returns `false`.
@link http://php.net/function.stream-encoding.php stream_encoding()
@param... | [
"Sets",
"the",
"character",
"set",
"for",
"stream",
"encoding",
"if",
"possible",
".",
"The",
"stream_encoding",
"function",
"is",
"not",
"guaranteed",
"to",
"be",
"available",
"as",
"it",
"is",
"seems",
"as",
"if",
"it",
"s",
"experimental",
"or",
"just",
... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/net/socket/Stream.php#L140-L145 |
UnionOfRAD/lithium | data/entity/Document.php | Document.& | public function &__get($name) {
if (strpos($name, '.')) {
return $this->_getNested($name);
}
if (isset($this->_embedded[$name]) && !isset($this->_relationships[$name])) {
throw new RuntimeException("Not implemented.");
}
$result =& parent::__get($name);
if ($result !== null || array_key_exists($name... | php | public function &__get($name) {
if (strpos($name, '.')) {
return $this->_getNested($name);
}
if (isset($this->_embedded[$name]) && !isset($this->_relationships[$name])) {
throw new RuntimeException("Not implemented.");
}
$result =& parent::__get($name);
if ($result !== null || array_key_exists($name... | [
"public",
"function",
"&",
"__get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_getNested",
"(",
"$",
"name",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
... | PHP magic method used when accessing fields as document properties, i.e. `$document->_id`.
@param $name The field name, as specified with an object property.
@return mixed Returns the value of the field specified in `$name`, and wraps complex data
types in sub-`Document` objects. | [
"PHP",
"magic",
"method",
"used",
"when",
"accessing",
"fields",
"as",
"document",
"properties",
"i",
".",
"e",
".",
"$document",
"-",
">",
"_id",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L126-L159 |
UnionOfRAD/lithium | data/entity/Document.php | Document.sync | public function sync($id = null, array $data = [], array $options = []) {
$defaults = ['recursive' => true];
$options += $defaults;
if (!$options['recursive']) {
return parent::sync($id, $data, $options);
}
foreach ($this->_updated as $key => $val) {
if (is_object($val) && method_exists($val, 'sync'))... | php | public function sync($id = null, array $data = [], array $options = []) {
$defaults = ['recursive' => true];
$options += $defaults;
if (!$options['recursive']) {
return parent::sync($id, $data, $options);
}
foreach ($this->_updated as $key => $val) {
if (is_object($val) && method_exists($val, 'sync'))... | [
"public",
"function",
"sync",
"(",
"$",
"id",
"=",
"null",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'recursive'",
"=>",
"true",
"]",
";",
"$",
"options",
"+=",
... | Extends the parent implementation to ensure that child documents are properly synced as well.
@param mixed $id
@param array $data
@param array $options Options when calling this method:
- `'recursive'` _boolean_: If `true` attempts to sync nested objects as well.
Otherwise, only syncs the current object. Defaults to `... | [
"Extends",
"the",
"parent",
"implementation",
"to",
"ensure",
"that",
"child",
"documents",
"are",
"properly",
"synced",
"as",
"well",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L184-L199 |
UnionOfRAD/lithium | data/entity/Document.php | Document._relation | protected function _relation($classType, $key, $data, $options = []) {
return parent::_relation($classType, $key, $data, ['exists' => false] + $options);
} | php | protected function _relation($classType, $key, $data, $options = []) {
return parent::_relation($classType, $key, $data, ['exists' => false] + $options);
} | [
"protected",
"function",
"_relation",
"(",
"$",
"classType",
",",
"$",
"key",
",",
"$",
"data",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"parent",
"::",
"_relation",
"(",
"$",
"classType",
",",
"$",
"key",
",",
"$",
"data",
",",
"[",... | Instantiates a new `Document` object as a descendant of the current object, and sets all
default values and internal state.
@param string $classType The type of class to create, either `'entity'` or `'set'`.
@param string $key The key name to which the related object is assigned.
@param array $data The internal data o... | [
"Instantiates",
"a",
"new",
"Document",
"object",
"as",
"a",
"descendant",
"of",
"the",
"current",
"object",
"and",
"sets",
"all",
"default",
"values",
"and",
"internal",
"state",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L211-L213 |
UnionOfRAD/lithium | data/entity/Document.php | Document.__isset | public function __isset($name) {
if (strpos($name, '.')) {
return $this->_getNested($name) !== null;
}
return isset($this->_updated[$name]);
} | php | public function __isset($name) {
if (strpos($name, '.')) {
return $this->_getNested($name) !== null;
}
return isset($this->_updated[$name]);
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_getNested",
"(",
"$",
"name",
")",
"!==",
"null",
";",
"}",
"return",
"isset",
"(",
"$",... | PHP magic method used to check the presence of a field as document properties, i.e.
`$document->_id`.
@param $name The field name, as specified with an object property.
@return boolean True if the field specified in `$name` exists, false otherwise. | [
"PHP",
"magic",
"method",
"used",
"to",
"check",
"the",
"presence",
"of",
"a",
"field",
"as",
"document",
"properties",
"i",
".",
"e",
".",
"$document",
"-",
">",
"_id",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L281-L286 |
UnionOfRAD/lithium | data/entity/Document.php | Document.set | public function set(array $data, array $options = []) {
$defaults = ['init' => false];
$options += $defaults;
$cast = ($schema = $this->schema());
foreach ($data as $key => $val) {
unset($this->_increment[$key]);
if (strpos($key, '.')) {
$this->_setNested($key, $val);
continue;
}
if ($cast... | php | public function set(array $data, array $options = []) {
$defaults = ['init' => false];
$options += $defaults;
$cast = ($schema = $this->schema());
foreach ($data as $key => $val) {
unset($this->_increment[$key]);
if (strpos($key, '.')) {
$this->_setNested($key, $val);
continue;
}
if ($cast... | [
"public",
"function",
"set",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'init'",
"=>",
"false",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"$",
"cast",
"=",
"(",
"$",
... | Allows several properties to be assigned at once.
For example:
```
$doc->set(['title' => 'Lorem Ipsum', 'value' => 42]);
```
@param array $data An associative array of fields and values to assign to the `Document`.
@param array $options
@return void | [
"Allows",
"several",
"properties",
"to",
"be",
"assigned",
"at",
"once",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L324-L350 |
UnionOfRAD/lithium | data/entity/Document.php | Document.rewind | public function rewind() {
reset($this->_data);
reset($this->_updated);
$this->_valid = (count($this->_updated) > 0);
return current($this->_updated);
} | php | public function rewind() {
reset($this->_data);
reset($this->_updated);
$this->_valid = (count($this->_updated) > 0);
return current($this->_updated);
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"reset",
"(",
"$",
"this",
"->",
"_updated",
")",
";",
"$",
"this",
"->",
"_valid",
"=",
"(",
"count",
"(",
"$",
"this",
"->",
"_updated",
")",
">"... | Rewinds to the first item.
@return mixed The current item after rewinding. | [
"Rewinds",
"to",
"the",
"first",
"item",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L401-L406 |
UnionOfRAD/lithium | data/entity/Document.php | Document.next | public function next() {
$prev = key($this->_data);
$this->_valid = (next($this->_data) !== false);
$cur = key($this->_data);
if (isset($this->_removed[$cur])) {
return $this->next();
}
if (!$this->_valid && $cur !== $prev && $cur !== null) {
$this->_valid = true;
}
return $this->_valid ? $this->... | php | public function next() {
$prev = key($this->_data);
$this->_valid = (next($this->_data) !== false);
$cur = key($this->_data);
if (isset($this->_removed[$cur])) {
return $this->next();
}
if (!$this->_valid && $cur !== $prev && $cur !== null) {
$this->_valid = true;
}
return $this->_valid ? $this->... | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"prev",
"=",
"key",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"$",
"this",
"->",
"_valid",
"=",
"(",
"next",
"(",
"$",
"this",
"->",
"_data",
")",
"!==",
"false",
")",
";",
"$",
"cur",
"=",
"... | Returns the next `Document` in the set, and advances the object's internal pointer. If the
end of the set is reached, a new document will be fetched from the data source connection
handle (`$_handle`). If no more records can be fetched, returns `null`.
@return mixed Returns the next record in the set, or `null`, if no... | [
"Returns",
"the",
"next",
"Document",
"in",
"the",
"set",
"and",
"advances",
"the",
"object",
"s",
"internal",
"pointer",
".",
"If",
"the",
"end",
"of",
"the",
"set",
"is",
"reached",
"a",
"new",
"document",
"will",
"be",
"fetched",
"from",
"the",
"data"... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/entity/Document.php#L448-L460 |
UnionOfRAD/lithium | console/command/Create.php | Create._init | protected function _init() {
parent::_init();
$this->library = $this->library ?: true;
$defaults = ['prefix' => null, 'path' => null];
$this->_library = (array) Libraries::get($this->library) + $defaults;
} | php | protected function _init() {
parent::_init();
$this->library = $this->library ?: true;
$defaults = ['prefix' => null, 'path' => null];
$this->_library = (array) Libraries::get($this->library) + $defaults;
} | [
"protected",
"function",
"_init",
"(",
")",
"{",
"parent",
"::",
"_init",
"(",
")",
";",
"$",
"this",
"->",
"library",
"=",
"$",
"this",
"->",
"library",
"?",
":",
"true",
";",
"$",
"defaults",
"=",
"[",
"'prefix'",
"=>",
"null",
",",
"'path'",
"=>... | Class initializer. Parses template and sets up params that need to be filled.
@return void | [
"Class",
"initializer",
".",
"Parses",
"template",
"and",
"sets",
"up",
"params",
"that",
"need",
"to",
"be",
"filled",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L82-L87 |
UnionOfRAD/lithium | console/command/Create.php | Create.run | public function run($command = null) {
if ($command && !$this->request->args()) {
return $this->_default($command);
}
$this->request->shift();
$this->template = $this->template ?: $command;
if (!$command) {
return false;
}
if ($this->_execute($command)) {
return true;
}
$this->error("{$comma... | php | public function run($command = null) {
if ($command && !$this->request->args()) {
return $this->_default($command);
}
$this->request->shift();
$this->template = $this->template ?: $command;
if (!$command) {
return false;
}
if ($this->_execute($command)) {
return true;
}
$this->error("{$comma... | [
"public",
"function",
"run",
"(",
"$",
"command",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"command",
"&&",
"!",
"$",
"this",
"->",
"request",
"->",
"args",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_default",
"(",
"$",
"command",
")",
";",... | Run the create command. Takes `$command` and delegates to `$command::$method`
@param string $command
@return boolean | [
"Run",
"the",
"create",
"command",
".",
"Takes",
"$command",
"and",
"delegates",
"to",
"$command",
"::",
"$method"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L95-L110 |
UnionOfRAD/lithium | console/command/Create.php | Create._execute | protected function _execute($command) {
try {
if (!$class = $this->_instance($command)) {
return false;
}
} catch (ClassNotFoundException $e) {
return false;
}
$data = [];
$params = $class->invokeMethod('_params');
foreach ($params as $param) {
$data[$param] = $class->invokeMethod("_{$param... | php | protected function _execute($command) {
try {
if (!$class = $this->_instance($command)) {
return false;
}
} catch (ClassNotFoundException $e) {
return false;
}
$data = [];
$params = $class->invokeMethod('_params');
foreach ($params as $param) {
$data[$param] = $class->invokeMethod("_{$param... | [
"protected",
"function",
"_execute",
"(",
"$",
"command",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"$",
"class",
"=",
"$",
"this",
"->",
"_instance",
"(",
"$",
"command",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"ClassNotFoundExcep... | Execute the given sub-command for the current request.
@param string $command The sub-command name. example: Model, Controller, Test
@return boolean | [
"Execute",
"the",
"given",
"sub",
"-",
"command",
"for",
"the",
"current",
"request",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L118-L138 |
UnionOfRAD/lithium | console/command/Create.php | Create._default | protected function _default($name) {
$commands = [
['model', $name],
['controller', $name],
['test', 'model', $name],
['test', 'controller', $name]
];
foreach ($commands as $args) {
$command = $this->template = $this->request->params['command'] = array_shift($args);
$this->request->params['actio... | php | protected function _default($name) {
$commands = [
['model', $name],
['controller', $name],
['test', 'model', $name],
['test', 'controller', $name]
];
foreach ($commands as $args) {
$command = $this->template = $this->request->params['command'] = array_shift($args);
$this->request->params['actio... | [
"protected",
"function",
"_default",
"(",
"$",
"name",
")",
"{",
"$",
"commands",
"=",
"[",
"[",
"'model'",
",",
"$",
"name",
"]",
",",
"[",
"'controller'",
",",
"$",
"name",
"]",
",",
"[",
"'test'",
",",
"'model'",
",",
"$",
"name",
"]",
",",
"[... | Run through the default set. model, controller, test model, test controller
@param string $name class name to create
@return boolean | [
"Run",
"through",
"the",
"default",
"set",
".",
"model",
"controller",
"test",
"model",
"test",
"controller"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L146-L163 |
UnionOfRAD/lithium | console/command/Create.php | Create._namespace | protected function _namespace($request, $options = []) {
$name = $request->command;
$defaults = [
'prefix' => $this->_library['prefix'],
'prepend' => null,
'spaces' => [
'model' => 'models', 'view' => 'views', 'controller' => 'controllers',
'command' => 'extensions.command', 'adapter' => 'extensio... | php | protected function _namespace($request, $options = []) {
$name = $request->command;
$defaults = [
'prefix' => $this->_library['prefix'],
'prepend' => null,
'spaces' => [
'model' => 'models', 'view' => 'views', 'controller' => 'controllers',
'command' => 'extensions.command', 'adapter' => 'extensio... | [
"protected",
"function",
"_namespace",
"(",
"$",
"request",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"name",
"=",
"$",
"request",
"->",
"command",
";",
"$",
"defaults",
"=",
"[",
"'prefix'",
"=>",
"$",
"this",
"->",
"_library",
"[",
"'prefi... | Get the namespace.
@param string $request
@param array $options
@return string | [
"Get",
"the",
"namespace",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L172-L189 |
UnionOfRAD/lithium | console/command/Create.php | Create._params | protected function _params() {
$contents = $this->_template();
if (empty($contents)) {
return [];
}
preg_match_all('/(?:\{:(?P<params>[^}]+)\})/', $contents, $keys);
if (!empty($keys['params'])) {
return array_values(array_unique($keys['params']));
}
return [];
} | php | protected function _params() {
$contents = $this->_template();
if (empty($contents)) {
return [];
}
preg_match_all('/(?:\{:(?P<params>[^}]+)\})/', $contents, $keys);
if (!empty($keys['params'])) {
return array_values(array_unique($keys['params']));
}
return [];
} | [
"protected",
"function",
"_params",
"(",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"_template",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"contents",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"preg_match_all",
"(",
"'/(?:\\{:(?P<params>[... | Parse a template to find available variables specified in `{:name}` format. Each variable
corresponds to a method in the sub command. For example, a `{:namespace}` variable will
call the namespace method in the model command when `li3 create model Post` is called.
@return array | [
"Parse",
"a",
"template",
"to",
"find",
"available",
"variables",
"specified",
"in",
"{",
":",
"name",
"}",
"format",
".",
"Each",
"variable",
"corresponds",
"to",
"a",
"method",
"in",
"the",
"sub",
"command",
".",
"For",
"example",
"a",
"{",
":",
"names... | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L198-L210 |
UnionOfRAD/lithium | console/command/Create.php | Create._template | protected function _template() {
$file = Libraries::locate('command.create.template', $this->template, [
'filter' => false, 'type' => 'file', 'suffix' => '.txt.php'
]);
if (!$file || is_array($file)) {
return false;
}
return file_get_contents($file);
} | php | protected function _template() {
$file = Libraries::locate('command.create.template', $this->template, [
'filter' => false, 'type' => 'file', 'suffix' => '.txt.php'
]);
if (!$file || is_array($file)) {
return false;
}
return file_get_contents($file);
} | [
"protected",
"function",
"_template",
"(",
")",
"{",
"$",
"file",
"=",
"Libraries",
"::",
"locate",
"(",
"'command.create.template'",
",",
"$",
"this",
"->",
"template",
",",
"[",
"'filter'",
"=>",
"false",
",",
"'type'",
"=>",
"'file'",
",",
"'suffix'",
"... | Returns the contents of the template.
@return string | [
"Returns",
"the",
"contents",
"of",
"the",
"template",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L217-L225 |
UnionOfRAD/lithium | console/command/Create.php | Create._instance | protected function _instance($name, array $config = []) {
if ($class = Libraries::locate('command.create', Inflector::camelize($name))) {
$this->request->params['template'] = $this->template;
return new $class([
'request' => $this->request,
'classes' => $this->_classes
]);
}
return parent::_inst... | php | protected function _instance($name, array $config = []) {
if ($class = Libraries::locate('command.create', Inflector::camelize($name))) {
$this->request->params['template'] = $this->template;
return new $class([
'request' => $this->request,
'classes' => $this->_classes
]);
}
return parent::_inst... | [
"protected",
"function",
"_instance",
"(",
"$",
"name",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"class",
"=",
"Libraries",
"::",
"locate",
"(",
"'command.create'",
",",
"Inflector",
"::",
"camelize",
"(",
"$",
"name",
")",... | Get an instance of a sub-command
@param string $name the name of the sub-command to instantiate
@param array $config
@return object | [
"Get",
"an",
"instance",
"of",
"a",
"sub",
"-",
"command"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L234-L244 |
UnionOfRAD/lithium | console/command/Create.php | Create._save | protected function _save(array $params = []) {
$defaults = ['namespace' => null, 'class' => null];
$params += $defaults;
if (empty($params['class']) || empty($this->_library['path'])) {
return false;
}
$contents = $this->_template();
$result = Text::insert($contents, $params);
$namespace = str_replace... | php | protected function _save(array $params = []) {
$defaults = ['namespace' => null, 'class' => null];
$params += $defaults;
if (empty($params['class']) || empty($this->_library['path'])) {
return false;
}
$contents = $this->_template();
$result = Text::insert($contents, $params);
$namespace = str_replace... | [
"protected",
"function",
"_save",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'namespace'",
"=>",
"null",
",",
"'class'",
"=>",
"null",
"]",
";",
"$",
"params",
"+=",
"$",
"defaults",
";",
"if",
"(",
"empty",
"... | Save a template with the current params. Writes file to `Create::$path`.
@param array $params
@return string|boolean A result string on success of writing the file. If any errors
occur along the way such as missing information boolean false is returned. | [
"Save",
"a",
"template",
"with",
"the",
"current",
"params",
".",
"Writes",
"file",
"to",
"Create",
"::",
"$path",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/console/command/Create.php#L253-L284 |
UnionOfRAD/lithium | data/model/Query.php | Query.map | public function map($map = null) {
if ($map !== null) {
$this->_map = $map;
return $this;
}
return $this->_map;
} | php | public function map($map = null) {
if ($map !== null) {
$this->_map = $map;
return $this;
}
return $this->_map;
} | [
"public",
"function",
"map",
"(",
"$",
"map",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"map",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_map",
"=",
"$",
"map",
";",
"return",
"$",
"this",
";",
"}",
"return",
"$",
"this",
"->",
"_map",
";",
"... | Generates a schema map of the query's result set, where the keys are aliases, and the values
are arrays of field names.
@param array $map
@return array | [
"Generates",
"a",
"schema",
"map",
"of",
"the",
"query",
"s",
"result",
"set",
"where",
"the",
"keys",
"are",
"aliases",
"and",
"the",
"values",
"are",
"arrays",
"of",
"field",
"names",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L236-L242 |
UnionOfRAD/lithium | data/model/Query.php | Query.calculate | public function calculate($calculate = null) {
if ($calculate) {
$this->_config['calculate'] = $calculate;
return $this;
}
return $this->_config['calculate'];
} | php | public function calculate($calculate = null) {
if ($calculate) {
$this->_config['calculate'] = $calculate;
return $this;
}
return $this->_config['calculate'];
} | [
"public",
"function",
"calculate",
"(",
"$",
"calculate",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"calculate",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'calculate'",
"]",
"=",
"$",
"calculate",
";",
"return",
"$",
"this",
";",
"}",
"return",
"$",... | Accessor method for `Query` calculate values.
@param string $calculate Value for calculate config setting.
@return mixed Current calculate config value. | [
"Accessor",
"method",
"for",
"Query",
"calculate",
"values",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L250-L256 |
UnionOfRAD/lithium | data/model/Query.php | Query.model | public function model($model = null) {
if (!$model) {
return $this->_config['model'];
}
$this->_config['model'] = $model;
$this->_config['source'] = $this->_config['source'] ?: $model::meta('source');
return $this;
} | php | public function model($model = null) {
if (!$model) {
return $this->_config['model'];
}
$this->_config['model'] = $model;
$this->_config['source'] = $this->_config['source'] ?: $model::meta('source');
return $this;
} | [
"public",
"function",
"model",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"model",
")",
"{",
"return",
"$",
"this",
"->",
"_config",
"[",
"'model'",
"]",
";",
"}",
"$",
"this",
"->",
"_config",
"[",
"'model'",
"]",
"=",
"$",
... | Set or get the associated model.
Will also set the source table, i.e. `$this->_config['source']` when setting the model.
@param string|null $model Name of model to use, or `null` to retrieve current one.
@return string|Query Either the current model name in use when $model is `null`,
or the query itself when setting ... | [
"Set",
"or",
"get",
"the",
"associated",
"model",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L267-L275 |
UnionOfRAD/lithium | data/model/Query.php | Query.conditions | public function conditions($conditions = null) {
if (!$conditions) {
return $this->_config['conditions'] ?: $this->_entityConditions();
}
$this->_config['conditions'] = array_merge(
(array) $this->_config['conditions'], (array) $conditions
);
return $this;
} | php | public function conditions($conditions = null) {
if (!$conditions) {
return $this->_config['conditions'] ?: $this->_entityConditions();
}
$this->_config['conditions'] = array_merge(
(array) $this->_config['conditions'], (array) $conditions
);
return $this;
} | [
"public",
"function",
"conditions",
"(",
"$",
"conditions",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"conditions",
")",
"{",
"return",
"$",
"this",
"->",
"_config",
"[",
"'conditions'",
"]",
"?",
":",
"$",
"this",
"->",
"_entityConditions",
"(",
")"... | Set or append to existing conditions, or get current conditions.
When getting current conditions and none are configured for the query,
will ask the bound entity for its conditions instead.
@param string|array|null $conditions Condition/s to append to existing conditions.
Provide `null` to get current conditions.
@re... | [
"Set",
"or",
"append",
"to",
"existing",
"conditions",
"or",
"get",
"current",
"conditions",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L288-L296 |
UnionOfRAD/lithium | data/model/Query.php | Query.having | public function having($having = null) {
if (!$having) {
return $this->_config['having'];
}
$this->_config['having'] = array_merge(
(array) $this->_config['having'], (array) $having
);
return $this;
} | php | public function having($having = null) {
if (!$having) {
return $this->_config['having'];
}
$this->_config['having'] = array_merge(
(array) $this->_config['having'], (array) $having
);
return $this;
} | [
"public",
"function",
"having",
"(",
"$",
"having",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"having",
")",
"{",
"return",
"$",
"this",
"->",
"_config",
"[",
"'having'",
"]",
";",
"}",
"$",
"this",
"->",
"_config",
"[",
"'having'",
"]",
"=",
"... | Set and get _having_.
@param mixed $having String or array to append to existing having.
@return string|Query Either the currrent _having_ when $having is
`null` or the query itself when setting _having_. | [
"Set",
"and",
"get",
"_having_",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L305-L313 |
UnionOfRAD/lithium | data/model/Query.php | Query.fields | public function fields($fields = null, $overwrite = false) {
if ($fields === false || $overwrite) {
$this->_fields = [0 => [], 1 => []];
}
if ($fields === null) {
return array_merge(array_keys($this->_fields[1]), $this->_fields[0]);
}
if (!$fields) {
return $this;
}
foreach ((array) $fields as $k... | php | public function fields($fields = null, $overwrite = false) {
if ($fields === false || $overwrite) {
$this->_fields = [0 => [], 1 => []];
}
if ($fields === null) {
return array_merge(array_keys($this->_fields[1]), $this->_fields[0]);
}
if (!$fields) {
return $this;
}
foreach ((array) $fields as $k... | [
"public",
"function",
"fields",
"(",
"$",
"fields",
"=",
"null",
",",
"$",
"overwrite",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fields",
"===",
"false",
"||",
"$",
"overwrite",
")",
"{",
"$",
"this",
"->",
"_fields",
"=",
"[",
"0",
"=>",
"[",
"]... | Set, get or reset fields option for query.
Usage:
```
// to add a field
$query->fields('created');
// to add several fields
$query->fields(['title','body','modified']);
// to reset fields to none
$query->fields(false);
// should be followed by a 2nd call to fields with required fields
```
@param mixed $fields strin... | [
"Set",
"get",
"or",
"reset",
"fields",
"option",
"for",
"query",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L335-L358 |
UnionOfRAD/lithium | data/model/Query.php | Query.limit | public function limit($limit = null) {
if ($limit) {
$this->_config['limit'] = (integer) $limit;
return $this;
}
if ($limit === false) {
$this->_config['limit'] = null;
return $this;
}
return $this->_config['limit'];
} | php | public function limit($limit = null) {
if ($limit) {
$this->_config['limit'] = (integer) $limit;
return $this;
}
if ($limit === false) {
$this->_config['limit'] = null;
return $this;
}
return $this->_config['limit'];
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"limit",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'limit'",
"]",
"=",
"(",
"integer",
")",
"$",
"limit",
";",
"return",
"$",
"this",
";",
"}",
"if",
"... | Set or get the limit for the amount of results to return.
@param integer|boolean $limit An integer indicating the number of results to limit or
`false` to employ no limit at all. Or `null` to retrieve the current limit.
@return integer|null|Query Either the currrent limit when $limit is
`null` or the query itself when... | [
"Set",
"or",
"get",
"the",
"limit",
"for",
"the",
"amount",
"of",
"results",
"to",
"return",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L368-L378 |
UnionOfRAD/lithium | data/model/Query.php | Query.offset | public function offset($offset = null) {
if ($offset !== null) {
$this->_config['offset'] = (integer) $offset;
return $this;
}
return $this->_config['offset'];
} | php | public function offset($offset = null) {
if ($offset !== null) {
$this->_config['offset'] = (integer) $offset;
return $this;
}
return $this->_config['offset'];
} | [
"public",
"function",
"offset",
"(",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"offset",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'offset'",
"]",
"=",
"(",
"integer",
")",
"$",
"offset",
";",
"return",
"$",
"this",
... | Set and get method for query's offset, i.e. which records to get
@param integer|null $offset
@return integer|\lithium\data\Query | [
"Set",
"and",
"get",
"method",
"for",
"query",
"s",
"offset",
"i",
".",
"e",
".",
"which",
"records",
"to",
"get"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L386-L392 |
UnionOfRAD/lithium | data/model/Query.php | Query.page | public function page($page = null) {
if ($page) {
$this->_config['page'] = $page = ((integer) $page ?: 1);
$this->offset(($page - 1) * $this->_config['limit']);
return $this;
}
return $this->_config['page'];
} | php | public function page($page = null) {
if ($page) {
$this->_config['page'] = $page = ((integer) $page ?: 1);
$this->offset(($page - 1) * $this->_config['limit']);
return $this;
}
return $this->_config['page'];
} | [
"public",
"function",
"page",
"(",
"$",
"page",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"page",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'page'",
"]",
"=",
"$",
"page",
"=",
"(",
"(",
"integer",
")",
"$",
"page",
"?",
":",
"1",
")",
";",
... | Set and get method for page, in relation to limit, of which records to get
@param integer|null $page
@return integer|\lithium\data\Query | [
"Set",
"and",
"get",
"method",
"for",
"page",
"in",
"relation",
"to",
"limit",
"of",
"which",
"records",
"to",
"get"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L400-L407 |
UnionOfRAD/lithium | data/model/Query.php | Query.order | public function order($order = null) {
if ($order) {
$this->_config['order'] = $order;
return $this;
}
return $this->_config['order'];
} | php | public function order($order = null) {
if ($order) {
$this->_config['order'] = $order;
return $this;
}
return $this->_config['order'];
} | [
"public",
"function",
"order",
"(",
"$",
"order",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"order",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'order'",
"]",
"=",
"$",
"order",
";",
"return",
"$",
"this",
";",
"}",
"return",
"$",
"this",
"->",
... | Set and get method for the query's order specification.
@param array|string|null $order
@return array|\lithium\data\Query | [
"Set",
"and",
"get",
"method",
"for",
"the",
"query",
"s",
"order",
"specification",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L415-L421 |
UnionOfRAD/lithium | data/model/Query.php | Query.group | public function group($group = null) {
if ($group) {
$this->_config['group'] = $group;
return $this;
}
if ($group === false) {
$this->_config['group'] = null;
return $this;
}
return $this->_config['group'];
} | php | public function group($group = null) {
if ($group) {
$this->_config['group'] = $group;
return $this;
}
if ($group === false) {
$this->_config['group'] = null;
return $this;
}
return $this->_config['group'];
} | [
"public",
"function",
"group",
"(",
"$",
"group",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"group",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'group'",
"]",
"=",
"$",
"group",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"group",
"==... | Set and get method for the `Query` group config setting.
@param string|array|null $group
@return array|null|\lithium\data\Query | [
"Set",
"and",
"get",
"method",
"for",
"the",
"Query",
"group",
"config",
"setting",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L429-L439 |
UnionOfRAD/lithium | data/model/Query.php | Query.comment | public function comment($comment = null) {
if ($comment) {
$this->_config['comment'] = $comment;
return $this;
}
return $this->_config['comment'];
} | php | public function comment($comment = null) {
if ($comment) {
$this->_config['comment'] = $comment;
return $this;
}
return $this->_config['comment'];
} | [
"public",
"function",
"comment",
"(",
"$",
"comment",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"comment",
")",
"{",
"$",
"this",
"->",
"_config",
"[",
"'comment'",
"]",
"=",
"$",
"comment",
";",
"return",
"$",
"this",
";",
"}",
"return",
"$",
"this",... | Set and get method for current query's comment.
Comment will have no effect on query, but will be passed along so data source can log it.
@param string|null $comment
@return string|\lithium\data\Query | [
"Set",
"and",
"get",
"method",
"for",
"current",
"query",
"s",
"comment",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L449-L455 |
UnionOfRAD/lithium | data/model/Query.php | Query.data | public function data($data = []) {
$bind =& $this->_entity;
if ($data) {
$bind ? $bind->set($data) : $this->_data = array_merge($this->_data, $data);
return $this;
}
$data = $bind ? $bind->data() : $this->_data;
return ($list = $this->_config['whitelist']) ? array_intersect_key($data, $list) : $data;
... | php | public function data($data = []) {
$bind =& $this->_entity;
if ($data) {
$bind ? $bind->set($data) : $this->_data = array_merge($this->_data, $data);
return $this;
}
$data = $bind ? $bind->data() : $this->_data;
return ($list = $this->_config['whitelist']) ? array_intersect_key($data, $list) : $data;
... | [
"public",
"function",
"data",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"bind",
"=",
"&",
"$",
"this",
"->",
"_entity",
";",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"bind",
"?",
"$",
"bind",
"->",
"set",
"(",
"$",
"data",
")",
":",
"$"... | Set and get method for the query's record's data.
@param array $data if set, will set given array.
@return array Empty array if no data, array of data if the record has it. | [
"Set",
"and",
"get",
"method",
"for",
"the",
"query",
"s",
"record",
"s",
"data",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L477-L486 |
UnionOfRAD/lithium | data/model/Query.php | Query.relationships | public function relationships($relpath = null, $config = null) {
if ($config) {
if (!$relpath) {
throw new InvalidArgumentException("The relation dotted path is empty.");
}
if (isset($config['model']) && isset($config['alias'])) {
$this->_models[$config['alias']] = $config['model'];
}
$this->_c... | php | public function relationships($relpath = null, $config = null) {
if ($config) {
if (!$relpath) {
throw new InvalidArgumentException("The relation dotted path is empty.");
}
if (isset($config['model']) && isset($config['alias'])) {
$this->_models[$config['alias']] = $config['model'];
}
$this->_c... | [
"public",
"function",
"relationships",
"(",
"$",
"relpath",
"=",
"null",
",",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"$",
"relpath",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The re... | Set and get the relationships.
@param string $relpath A dotted path.
@param array $config the config array to set.
@return mixed The relationships array or a relationship array if `$relpath` is set. Returns
`null` if a join doesn't exist.
@throws InvalidArgumentException | [
"Set",
"and",
"get",
"the",
"relationships",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L497-L514 |
UnionOfRAD/lithium | data/model/Query.php | Query.joins | public function joins($name = null, $join = null) {
if (is_array($name)) {
$join = $name;
$name = null;
}
if ($join) {
if (!$name) {
$this->_config['joins'][] = $join;
} else {
$this->_config['joins'][$name] = $join;
}
return $this;
}
if (!$name) {
return $this->_config['joins'];
... | php | public function joins($name = null, $join = null) {
if (is_array($name)) {
$join = $name;
$name = null;
}
if ($join) {
if (!$name) {
$this->_config['joins'][] = $join;
} else {
$this->_config['joins'][$name] = $join;
}
return $this;
}
if (!$name) {
return $this->_config['joins'];
... | [
"public",
"function",
"joins",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"join",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"join",
"=",
"$",
"name",
";",
"$",
"name",
"=",
"null",
";",
"}",
"if",
"(",
... | Set and get the joins
@param string $name Optional name of join. Unless two parameters are passed, this parameter
is regonized as `$join`.
@param object|string $join A single query object or an array of query objects
@return mixed The joins array or a join array if `$name` is set. Returns `null` if a join
doesn't exis... | [
"Set",
"and",
"get",
"the",
"joins"
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L525-L544 |
UnionOfRAD/lithium | data/model/Query.php | Query.export | public function export(Source $source, array $options = []) {
$defaults = ['keys' => []];
$options += $defaults;
if ($options['keys']) {
$keys = array_flip($options['keys']);
} else {
$keys =& $this->_config;
}
list($copy, $apply) = Set::slice($keys, $source->methods());
if (isset($keys['with'])) ... | php | public function export(Source $source, array $options = []) {
$defaults = ['keys' => []];
$options += $defaults;
if ($options['keys']) {
$keys = array_flip($options['keys']);
} else {
$keys =& $this->_config;
}
list($copy, $apply) = Set::slice($keys, $source->methods());
if (isset($keys['with'])) ... | [
"public",
"function",
"export",
"(",
"Source",
"$",
"source",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'keys'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"if",
"(",
"$",
"optio... | Convert the query's properties to the data sources' syntax and return it as an array.
@param \lithium\data\Source $source Instance of the data source to use for conversion.
@param array $options Options to use when exporting the data.
@return array Returns an array containing a data source-specific representation of a... | [
"Convert",
"the",
"query",
"s",
"properties",
"to",
"the",
"data",
"sources",
"syntax",
"and",
"return",
"it",
"as",
"an",
"array",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L553-L591 |
UnionOfRAD/lithium | data/model/Query.php | Query.applyStrategy | public function applyStrategy(Source $source) {
if ($this->_built) {
return;
}
$this->_built = true;
if (!$this->_config['with']) {
return;
}
$options = [];
if (isset($this->_config['strategy'])) {
$options['strategy'] = $this->_config['strategy'];
}
$source->applyStrategy($options, $this);
... | php | public function applyStrategy(Source $source) {
if ($this->_built) {
return;
}
$this->_built = true;
if (!$this->_config['with']) {
return;
}
$options = [];
if (isset($this->_config['strategy'])) {
$options['strategy'] = $this->_config['strategy'];
}
$source->applyStrategy($options, $this);
... | [
"public",
"function",
"applyStrategy",
"(",
"Source",
"$",
"source",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_built",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_built",
"=",
"true",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_config",
"[",
... | Helper method used by `export()` which delegate the query generation to the data source.
@param \lithium\data\Source $source Instance of the data source to use for conversion. | [
"Helper",
"method",
"used",
"by",
"export",
"()",
"which",
"delegate",
"the",
"query",
"generation",
"to",
"the",
"data",
"source",
"."
] | train | https://github.com/UnionOfRAD/lithium/blob/bec3f4fdf61ea5002904754f43941ad1430ecec7/data/model/Query.php#L598-L611 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.