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
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.elementAtOrDefault
public function elementAtOrDefault($key, $default = null) { /** @var $it \Iterator|\ArrayAccess */ $it = $this->getIterator(); if ($it instanceof \ArrayAccess) return $it->offsetExists($key) ? $it->offsetGet($key) : $default; foreach ($it as $k => $v) { if (...
php
public function elementAtOrDefault($key, $default = null) { /** @var $it \Iterator|\ArrayAccess */ $it = $this->getIterator(); if ($it instanceof \ArrayAccess) return $it->offsetExists($key) ? $it->offsetGet($key) : $default; foreach ($it as $k => $v) { if (...
[ "public", "function", "elementAtOrDefault", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "/** @var $it \\Iterator|\\ArrayAccess */", "$", "it", "=", "$", "this", "->", "getIterator", "(", ")", ";", "if", "(", "$", "it", "instanceof", "\\", ...
Returns the value at a specified key in a sequence or a default value if the key is not found. <p><b>Syntax</b>: elementAtOrDefault (key [, default]) <p>If the type of source iterator implements {@link ArrayAccess}, that implementation is used to obtain the value at the specified key. Otherwise, this method obtains the...
[ "Returns", "the", "value", "at", "a", "specified", "key", "in", "a", "sequence", "or", "a", "default", "value", "if", "the", "key", "is", "not", "found", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "elementAtOrDefault", "(", "key", "[",...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L56-L69
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.first
public function first($predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } throw new \UnexpectedValueException(Errors::NO_MATCHES); }
php
public function first($predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } throw new \UnexpectedValueException(Errors::NO_MATCHES); }
[ "public", "function", "first", "(", "$", "predicate", "=", "null", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "Functions", "::", "$", "true", ")", ";", "foreach", "(", "$", "this", "as", ...
Returns the first element of a sequence. <p><b>Syntax</b>: first () <p>Returns the first element of a sequence. <p>The first method throws an exception if source contains no elements. To instead return a default value when the source sequence is empty, use the {@link firstOrDefault} method. <p><b>Syntax</b>: first (pre...
[ "Returns", "the", "first", "element", "of", "a", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "first", "()", "<p", ">", "Returns", "the", "first", "element", "of", "a", "sequence", ".", "<p", ">", "The", "first", "method", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L84-L93
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.firstOrDefault
public function firstOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } return $default; }
php
public function firstOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } return $default; }
[ "public", "function", "firstOrDefault", "(", "$", "default", "=", "null", ",", "$", "predicate", "=", "null", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "Functions", "::", "$", "true", ")", ...
Returns the first element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: firstOrDefault ([default]) <p>Returns the first element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: firstOrDefault ([default [, predicate {(v, k) ==> result}]...
[ "Returns", "the", "first", "element", "of", "a", "sequence", "or", "a", "default", "value", "if", "the", "sequence", "contains", "no", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "firstOrDefault", "(", "[", "default", "]", ")"...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L107-L116
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.firstOrFallback
public function firstOrFallback($fallback, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } return $fallback(); }
php
public function firstOrFallback($fallback, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $v; } return $fallback(); }
[ "public", "function", "firstOrFallback", "(", "$", "fallback", ",", "$", "predicate", "=", "null", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "Functions", "::", "$", "true", ")", ";", "foreac...
Returns the first element of a sequence, or the result of calling a fallback function if the sequence contains no elements. <p><b>Syntax</b>: firstOrFallback ([fallback {() ==> value}]) <p>Returns the first element of a sequence, or the result of calling a fallback function if the sequence contains no elements. <p><b>S...
[ "Returns", "the", "first", "element", "of", "a", "sequence", "or", "the", "result", "of", "calling", "a", "fallback", "function", "if", "the", "sequence", "contains", "no", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "firstOrFal...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L130-L139
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.lastOrDefault
public function lastOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); $found = false; $value = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) { $found = true; ...
php
public function lastOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); $found = false; $value = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) { $found = true; ...
[ "public", "function", "lastOrDefault", "(", "$", "default", "=", "null", ",", "$", "predicate", "=", "null", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "Functions", "::", "$", "true", ")", ...
Returns the last element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: lastOrDefault ([default]) <p>Returns the last element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: lastOrDefault ([default [, predicate {(v, k) ==> result}]]) <...
[ "Returns", "the", "last", "element", "of", "a", "sequence", "or", "a", "default", "value", "if", "the", "sequence", "contains", "no", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "lastOrDefault", "(", "[", "default", "]", ")", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L183-L196
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.singleOrDefault
public function singleOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); $found = false; $value = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) { if ($found) ...
php
public function singleOrDefault($default = null, $predicate = null) { $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true); $found = false; $value = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) { if ($found) ...
[ "public", "function", "singleOrDefault", "(", "$", "default", "=", "null", ",", "$", "predicate", "=", "null", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "Functions", "::", "$", "true", ")", ...
Returns the only element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: singleOrDefault ([default]) <p>Returns the only element of a sequence, or a default value if the sequence contains no elements. <p><b>Syntax</b>: singleOrDefault ([default [, predicate {(v, k) ==> result}]...
[ "Returns", "the", "only", "element", "of", "a", "sequence", "or", "a", "default", "value", "if", "the", "sequence", "contains", "no", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "singleOrDefault", "(", "[", "default", "]", ")"...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L270-L285
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.indexOf
public function indexOf($value) { $array = $this->tryGetArrayCopy(); if ($array !== null) return array_search($value, $array, true); else { foreach ($this as $k => $v) { if ($v === $value) return $k; } return...
php
public function indexOf($value) { $array = $this->tryGetArrayCopy(); if ($array !== null) return array_search($value, $array, true); else { foreach ($this as $k => $v) { if ($v === $value) return $k; } return...
[ "public", "function", "indexOf", "(", "$", "value", ")", "{", "$", "array", "=", "$", "this", "->", "tryGetArrayCopy", "(", ")", ";", "if", "(", "$", "array", "!==", "null", ")", "return", "array_search", "(", "$", "value", ",", "$", "array", ",", ...
Searches for the specified value and returns the key of the first occurrence. <p><b>Syntax</b>: indexOf (value) <p>To search for the zero-based index of the first occurence, call {@link toValues} method first. @param mixed $value The value to locate in the sequence. @return mixed The key of the first occurrence of valu...
[ "Searches", "for", "the", "specified", "value", "and", "returns", "the", "key", "of", "the", "first", "occurrence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "indexOf", "(", "value", ")", "<p", ">", "To", "search", "for", "the", "zero...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L325-L337
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.lastIndexOf
public function lastIndexOf($value) { $key = null; foreach ($this as $k => $v) { if ($v === $value) $key = $k; } return $key; // not -1 }
php
public function lastIndexOf($value) { $key = null; foreach ($this as $k => $v) { if ($v === $value) $key = $k; } return $key; // not -1 }
[ "public", "function", "lastIndexOf", "(", "$", "value", ")", "{", "$", "key", "=", "null", ";", "foreach", "(", "$", "this", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "$", "v", "===", "$", "value", ")", "$", "key", "=", "$", "k", ...
Searches for the specified value and returns the key of the last occurrence. <p><b>Syntax</b>: lastIndexOf (value) <p>To search for the zero-based index of the last occurence, call {@link toValues} method first. @param mixed $value The value to locate in the sequence. @return mixed The key of the last occurrence of val...
[ "Searches", "for", "the", "specified", "value", "and", "returns", "the", "key", "of", "the", "last", "occurrence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "lastIndexOf", "(", "value", ")", "<p", ">", "To", "search", "for", "the", "z...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L347-L355
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.findIndex
public function findIndex($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $k; } return null; // not -1 }
php
public function findIndex($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); foreach ($this as $k => $v) { if ($predicate($v, $k)) return $k; } return null; // not -1 }
[ "public", "function", "findIndex", "(", "$", "predicate", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "foreach", "(", "$", "this", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(...
Searches for an element that matches the conditions defined by the specified predicate, and returns the key of the first occurrence. <p><b>Syntax</b>: findIndex (predicate {(v, k) ==> result}) <p>To search for the zero-based index of the first occurence, call {@link toValues} method first. @param callable $predicate {(...
[ "Searches", "for", "an", "element", "that", "matches", "the", "conditions", "defined", "by", "the", "specified", "predicate", "and", "returns", "the", "key", "of", "the", "first", "occurrence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "f...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L365-L374
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.findLastIndex
public function findLastIndex($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); $key = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) $key = $k; } return $key; // not -1 }
php
public function findLastIndex($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); $key = null; foreach ($this as $k => $v) { if ($predicate($v, $k)) $key = $k; } return $key; // not -1 }
[ "public", "function", "findLastIndex", "(", "$", "predicate", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "$", "key", "=", "null", ";", "foreach", "(", "$", "this", "as", "$", "k", "=...
Searches for an element that matches the conditions defined by the specified predicate, and returns the key of the last occurrence. <p><b>Syntax</b>: findLastIndex (predicate {(v, k) ==> result}) <p>To search for the zero-based index of the last occurence, call {@link toValues} method first. @param callable $predicate ...
[ "Searches", "for", "an", "element", "that", "matches", "the", "conditions", "defined", "by", "the", "specified", "predicate", "and", "returns", "the", "key", "of", "the", "last", "occurrence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "fi...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L384-L394
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.skip
public function skip(int $count) { return new self(function() use ($count) { $it = $this->getIterator(); $it->rewind(); for ($i = 0; $i < $count && $it->valid(); ++$i) $it->next(); while ($it->valid()) { yield $it->key() => $it-...
php
public function skip(int $count) { return new self(function() use ($count) { $it = $this->getIterator(); $it->rewind(); for ($i = 0; $i < $count && $it->valid(); ++$i) $it->next(); while ($it->valid()) { yield $it->key() => $it-...
[ "public", "function", "skip", "(", "int", "$", "count", ")", "{", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "count", ")", "{", "$", "it", "=", "$", "this", "->", "getIterator", "(", ")", ";", "$", "it", "->", "rewind", ...
Bypasses a specified number of elements in a sequence and then returns the remaining elements. <p><b>Syntax</b>: skip (count) <p>If source contains fewer than count elements, an empty sequence is returned. If count is less than or equal to zero, all elements of source are yielded. <p>The {@link take} and skip methods a...
[ "Bypasses", "a", "specified", "number", "of", "elements", "in", "a", "sequence", "and", "then", "returns", "the", "remaining", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "skip", "(", "count", ")", "<p", ">", "If", "source", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L405-L417
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.skipWhile
public function skipWhile($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { $yielding = false; foreach ($this as $k => $v) { if (!$yielding && !$predicate($v, $k)) $yielding = ...
php
public function skipWhile($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { $yielding = false; foreach ($this as $k => $v) { if (!$yielding && !$predicate($v, $k)) $yielding = ...
[ "public", "function", "skipWhile", "(", "$", "predicate", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "predicate", "...
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. <p><b>Syntax</b>: skipWhile (predicate {(v, k) ==> result}) <p>This method tests each element of source by using predicate and skips the element if the result is true. After the predicate function returns f...
[ "Bypasses", "elements", "in", "a", "sequence", "as", "long", "as", "a", "specified", "condition", "is", "true", "and", "then", "returns", "the", "remaining", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "skipWhile", "(", "predica...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L428-L441
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.take
public function take(int $count) { if ($count <= 0) return new self(new \EmptyIterator, false); return new self(function() use ($count) { foreach ($this as $k => $v) { yield $k => $v; if (--$count == 0) break; }...
php
public function take(int $count) { if ($count <= 0) return new self(new \EmptyIterator, false); return new self(function() use ($count) { foreach ($this as $k => $v) { yield $k => $v; if (--$count == 0) break; }...
[ "public", "function", "take", "(", "int", "$", "count", ")", "{", "if", "(", "$", "count", "<=", "0", ")", "return", "new", "self", "(", "new", "\\", "EmptyIterator", ",", "false", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use"...
Returns a specified number of contiguous elements from the start of a sequence. <p><b>Syntax</b>: take (count) <p>Take enumerates source and yields elements until count elements have been yielded or source contains no more elements. If count is less than or equal to zero, source is not enumerated and an empty sequence ...
[ "Returns", "a", "specified", "number", "of", "contiguous", "elements", "from", "the", "start", "of", "a", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "take", "(", "count", ")", "<p", ">", "Take", "enumerates", "source", "and",...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L452-L464
Athari/YaLinqo
YaLinqo/EnumerablePagination.php
EnumerablePagination.takeWhile
public function takeWhile($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { foreach ($this as $k => $v) { if (!$predicate($v, $k)) break; yield $k => $v; } ...
php
public function takeWhile($predicate) { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { foreach ($this as $k => $v) { if (!$predicate($v, $k)) break; yield $k => $v; } ...
[ "public", "function", "takeWhile", "(", "$", "predicate", ")", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "predicate", "...
Returns elements from a sequence as long as a specified condition is true. <p><b>Syntax</b>: takeWhile (predicate {(v, k) ==> result}) <p>The takeWhile method tests each element of source by using predicate and yields the element if the result is true. Enumeration stops when the predicate function returns false for an ...
[ "Returns", "elements", "from", "a", "sequence", "as", "long", "as", "a", "specified", "condition", "is", "true", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "takeWhile", "(", "predicate", "{", "(", "v", "k", ")", "==", ">", "result", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerablePagination.php#L475-L486
Athari/YaLinqo
YaLinqo/Utils.php
Utils.createLambda
public static function createLambda($closure, string $closureArgs, $default = null) { if ($closure === null) { if ($default === null) throw new \InvalidArgumentException(self::ERROR_CLOSURE_NULL); return $default; } if ($closure instanceof \Closure) ...
php
public static function createLambda($closure, string $closureArgs, $default = null) { if ($closure === null) { if ($default === null) throw new \InvalidArgumentException(self::ERROR_CLOSURE_NULL); return $default; } if ($closure instanceof \Closure) ...
[ "public", "static", "function", "createLambda", "(", "$", "closure", ",", "string", "$", "closureArgs", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "closure", "===", "null", ")", "{", "if", "(", "$", "default", "===", "null", ")", "th...
Convert string lambda to callable function. If callable is passed, return as is. @param callable|null $closure @param string $closureArgs @param \Closure|callable|null $default @throws \InvalidArgumentException Both closure and default are null. @throws \InvalidArgumentException Incorrect lambda syntax. @return callabl...
[ "Convert", "string", "lambda", "to", "callable", "function", ".", "If", "callable", "is", "passed", "return", "as", "is", "." ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Utils.php#L56-L70
Athari/YaLinqo
YaLinqo/Utils.php
Utils.createComparer
public static function createComparer($closure, $sortOrder, &$isReversed) { if ($closure === null) { $isReversed = false; return $sortOrder === SORT_DESC ? Functions::$compareStrictReversed : Functions::$compareStrict; } elseif (is_int($closure)) { switch ...
php
public static function createComparer($closure, $sortOrder, &$isReversed) { if ($closure === null) { $isReversed = false; return $sortOrder === SORT_DESC ? Functions::$compareStrictReversed : Functions::$compareStrict; } elseif (is_int($closure)) { switch ...
[ "public", "static", "function", "createComparer", "(", "$", "closure", ",", "$", "sortOrder", ",", "&", "$", "isReversed", ")", "{", "if", "(", "$", "closure", "===", "null", ")", "{", "$", "isReversed", "=", "false", ";", "return", "$", "sortOrder", "...
Convert string lambda or SORT_ flags to callable function. Sets isReversed to false if descending is reversed. @param callable|int|null $closure @param int $sortOrder @param bool $isReversed @return callable|string|null @throws \InvalidArgumentException Incorrect lambda syntax. @throws \InvalidArgumentException Incorre...
[ "Convert", "string", "lambda", "or", "SORT_", "flags", "to", "callable", "function", ".", "Sets", "isReversed", "to", "false", "if", "descending", "is", "reversed", "." ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Utils.php#L81-L109
Athari/YaLinqo
YaLinqo/Utils.php
Utils.lambdaToSortFlagsAndOrder
public static function lambdaToSortFlagsAndOrder($closure, &$sortOrder) { if ($sortOrder !== SORT_ASC && $sortOrder !== SORT_DESC) $sortOrder = $sortOrder ? SORT_DESC : SORT_ASC; if (is_int($closure)) return $closure; elseif (($closure === null || is_string($closure))...
php
public static function lambdaToSortFlagsAndOrder($closure, &$sortOrder) { if ($sortOrder !== SORT_ASC && $sortOrder !== SORT_DESC) $sortOrder = $sortOrder ? SORT_DESC : SORT_ASC; if (is_int($closure)) return $closure; elseif (($closure === null || is_string($closure))...
[ "public", "static", "function", "lambdaToSortFlagsAndOrder", "(", "$", "closure", ",", "&", "$", "sortOrder", ")", "{", "if", "(", "$", "sortOrder", "!==", "SORT_ASC", "&&", "$", "sortOrder", "!==", "SORT_DESC", ")", "$", "sortOrder", "=", "$", "sortOrder", ...
Convert string lambda to SORT_ flags. Convert sortOrder from bool to SORT_ order. @param callable|string|int|null $closure @param int|bool $sortOrder @return callable|string|int|null
[ "Convert", "string", "lambda", "to", "SORT_", "flags", ".", "Convert", "sortOrder", "from", "bool", "to", "SORT_", "order", "." ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Utils.php#L117-L127
Athari/YaLinqo
YaLinqo/Utils.php
Utils.createLambdaFromString
private static function createLambdaFromString(string $closure, string $closureArgs) { $posDollar = strpos($closure, '$'); if ($posDollar !== false) { if (isset(self::$lambdaCache[$closure][$closureArgs])) return self::$lambdaCache[$closure][$closureArgs]; $po...
php
private static function createLambdaFromString(string $closure, string $closureArgs) { $posDollar = strpos($closure, '$'); if ($posDollar !== false) { if (isset(self::$lambdaCache[$closure][$closureArgs])) return self::$lambdaCache[$closure][$closureArgs]; $po...
[ "private", "static", "function", "createLambdaFromString", "(", "string", "$", "closure", ",", "string", "$", "closureArgs", ")", "{", "$", "posDollar", "=", "strpos", "(", "$", "closure", ",", "'$'", ")", ";", "if", "(", "$", "posDollar", "!==", "false", ...
Convert string lambda to callable function. @param string $closure @param string $closureArgs @throws \InvalidArgumentException Incorrect lambda syntax. @return string|null
[ "Convert", "string", "lambda", "to", "callable", "function", "." ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Utils.php#L136-L163
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.cast
public function cast(string $type): Enumerable { switch ($type) { case 'array': return $this->select(function($v) { return (array)$v; }); case 'int': case 'integer': case 'long': return $this->select(function($v) { return (int)$...
php
public function cast(string $type): Enumerable { switch ($type) { case 'array': return $this->select(function($v) { return (array)$v; }); case 'int': case 'integer': case 'long': return $this->select(function($v) { return (int)$...
[ "public", "function", "cast", "(", "string", "$", "type", ")", ":", "Enumerable", "{", "switch", "(", "$", "type", ")", "{", "case", "'array'", ":", "return", "$", "this", "->", "select", "(", "function", "(", "$", "v", ")", "{", "return", "(", "ar...
Casts the elements of a sequence to the specified type. <p><b>Syntax</b>: cast (type) <p>The cast method causes an error if an element cannot be cast (exact error depends on the implementation of PHP casting), to get only elements of the specified type, use {@link ofType}. @param string $type The type to cast the eleme...
[ "Casts", "the", "elements", "of", "a", "sequence", "to", "the", "specified", "type", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "cast", "(", "type", ")", "<p", ">", "The", "cast", "method", "causes", "an", "error", "if", "an", "eleme...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L74-L97
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.ofType
public function ofType(string $type): Enumerable { switch ($type) { case 'array': return $this->where(function($v) { return is_array($v); }); case 'int': case 'integer': case 'long': return $this->where(function($v) { return is_...
php
public function ofType(string $type): Enumerable { switch ($type) { case 'array': return $this->where(function($v) { return is_array($v); }); case 'int': case 'integer': case 'long': return $this->where(function($v) { return is_...
[ "public", "function", "ofType", "(", "string", "$", "type", ")", ":", "Enumerable", "{", "switch", "(", "$", "type", ")", "{", "case", "'array'", ":", "return", "$", "this", "->", "where", "(", "function", "(", "$", "v", ")", "{", "return", "is_array...
Filters the elements of a sequence based on a specified type. <p><b>Syntax</b>: ofType (type) <p>The ofType method returns only elements of the specified type. To instead receive an error if an element cannot be cast, use {@link cast}. @param string $type The type to filter the elements of the sequence on. Can be eithe...
[ "Filters", "the", "elements", "of", "a", "sequence", "based", "on", "a", "specified", "type", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "ofType", "(", "type", ")", "<p", ">", "The", "ofType", "method", "returns", "only", "elements", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L107-L136
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.select
public function select($selectorValue, $selectorKey = null): Enumerable { $selectorValue = Utils::createLambda($selectorValue, 'v,k'); $selectorKey = Utils::createLambda($selectorKey, 'v,k', Functions::$key); return new self(function() use ($selectorValue, $selectorKey) { foreac...
php
public function select($selectorValue, $selectorKey = null): Enumerable { $selectorValue = Utils::createLambda($selectorValue, 'v,k'); $selectorKey = Utils::createLambda($selectorKey, 'v,k', Functions::$key); return new self(function() use ($selectorValue, $selectorKey) { foreac...
[ "public", "function", "select", "(", "$", "selectorValue", ",", "$", "selectorKey", "=", "null", ")", ":", "Enumerable", "{", "$", "selectorValue", "=", "Utils", "::", "createLambda", "(", "$", "selectorValue", ",", "'v,k'", ")", ";", "$", "selectorKey", "...
Projects each element of a sequence into a new form. <p><b>Syntax</b>: select (selectorValue {(v, k) ==> result} [, selectorKey {(v, k) ==> result}]) <p>This projection method requires the transform functions, selectorValue and selectorKey, to produce one key-value pair for each value in the source sequence. If selecto...
[ "Projects", "each", "element", "of", "a", "sequence", "into", "a", "new", "form", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "select", "(", "selectorValue", "{", "(", "v", "k", ")", "==", ">", "result", "}", "[", "selectorKey", "{", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L147-L156
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.selectMany
public function selectMany($collectionSelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $collectionSelector = Utils::createLambda($collectionSelector, 'v,k', Functions::$value); $resultSelectorValue = Utils::createLambda($resultSelectorValue, 'v,k1,k2', Functions...
php
public function selectMany($collectionSelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $collectionSelector = Utils::createLambda($collectionSelector, 'v,k', Functions::$value); $resultSelectorValue = Utils::createLambda($resultSelectorValue, 'v,k1,k2', Functions...
[ "public", "function", "selectMany", "(", "$", "collectionSelector", "=", "null", ",", "$", "resultSelectorValue", "=", "null", ",", "$", "resultSelectorKey", "=", "null", ")", ":", "Enumerable", "{", "$", "collectionSelector", "=", "Utils", "::", "createLambda",...
Projects each element of a sequence to a sequence and flattens the resulting sequences into one sequence. <p><b>Syntax</b>: selectMany () <p>The selectMany method enumerates the input sequence, where each element is a sequence, and then enumerates and yields the elements of each such sequence. That is, for each element...
[ "Projects", "each", "element", "of", "a", "sequence", "to", "a", "sequence", "and", "flattens", "the", "resulting", "sequences", "into", "one", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "selectMany", "()", "<p", ">", "The", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L173-L186
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.where
public function where($predicate): Enumerable { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { foreach ($this as $k => $v) if ($predicate($v, $k)) yield $k => $v; }); }
php
public function where($predicate): Enumerable { $predicate = Utils::createLambda($predicate, 'v,k'); return new self(function() use ($predicate) { foreach ($this as $k => $v) if ($predicate($v, $k)) yield $k => $v; }); }
[ "public", "function", "where", "(", "$", "predicate", ")", ":", "Enumerable", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$",...
Filters a sequence of values based on a predicate. <p><b>Syntax</b>: where (predicate {(v, k) ==> result}) @param callable $predicate {(v, k) ==> result} A function to test each element for a condition. @return Enumerable A sequence that contains elements from the input sequence that satisfy the condition. @package YaL...
[ "Filters", "a", "sequence", "of", "values", "based", "on", "a", "predicate", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "where", "(", "predicate", "{", "(", "v", "k", ")", "==", ">", "result", "}", ")" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L195-L204
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.orderByDir
public function orderByDir($sortOrder, $keySelector = null, $comparer = null): OrderedEnumerable { $sortFlags = Utils::lambdaToSortFlagsAndOrder($comparer, $sortOrder); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); $isReversed = $sortOrder == SORT_DESC; ...
php
public function orderByDir($sortOrder, $keySelector = null, $comparer = null): OrderedEnumerable { $sortFlags = Utils::lambdaToSortFlagsAndOrder($comparer, $sortOrder); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); $isReversed = $sortOrder == SORT_DESC; ...
[ "public", "function", "orderByDir", "(", "$", "sortOrder", ",", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "$", "sortFlags", "=", "Utils", "::", "lambdaToSortFlagsAndOrder", "(", "$", "comparer", "...
Sorts the elements of a sequence in a particular direction (ascending, descending) according to a key. <p><b>Syntax</b>: orderByDir (false|true [, {(v, k) ==> key} [, {(a, b) ==> diff}]]) <p>Three methods are defined to extend the type {@link OrderedEnumerable}, which is the return type of this method. These three meth...
[ "Sorts", "the", "elements", "of", "a", "sequence", "in", "a", "particular", "direction", "(", "ascending", "descending", ")", "according", "to", "a", "key", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "orderByDir", "(", "false|true", "[", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L222-L229
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.orderBy
public function orderBy($keySelector = null, $comparer = null): OrderedEnumerable { return $this->orderByDir(false, $keySelector, $comparer); }
php
public function orderBy($keySelector = null, $comparer = null): OrderedEnumerable { return $this->orderByDir(false, $keySelector, $comparer); }
[ "public", "function", "orderBy", "(", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "return", "$", "this", "->", "orderByDir", "(", "false", ",", "$", "keySelector", ",", "$", "comparer", ")", ";"...
Sorts the elements of a sequence in ascending order according to a key. <p><b>Syntax</b>: orderBy ([{(v, k) ==> key} [, {(a, b) ==> diff}]]) <p>Three methods are defined to extend the type {@link OrderedEnumerable}, which is the return type of this method. These three methods, namely {@link OrderedEnumerable::thenBy th...
[ "Sorts", "the", "elements", "of", "a", "sequence", "in", "ascending", "order", "according", "to", "a", "key", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "orderBy", "(", "[", "{", "(", "v", "k", ")", "==", ">", "key", "}", "[", "{...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L242-L245
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.orderByDescending
public function orderByDescending($keySelector = null, $comparer = null): OrderedEnumerable { return $this->orderByDir(true, $keySelector, $comparer); }
php
public function orderByDescending($keySelector = null, $comparer = null): OrderedEnumerable { return $this->orderByDir(true, $keySelector, $comparer); }
[ "public", "function", "orderByDescending", "(", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "return", "$", "this", "->", "orderByDir", "(", "true", ",", "$", "keySelector", ",", "$", "comparer", "...
Sorts the elements of a sequence in descending order according to a key. <p><b>Syntax</b>: orderByDescending ([{(v, k) ==> key} [, {(a, b) ==> diff}]]) <p>Three methods are defined to extend the type {@link OrderedEnumerable}, which is the return type of this method. These three methods, namely {@link OrderedEnumerable...
[ "Sorts", "the", "elements", "of", "a", "sequence", "in", "descending", "order", "according", "to", "a", "key", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "orderByDescending", "(", "[", "{", "(", "v", "k", ")", "==", ">", "key", "}", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L258-L261
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.groupJoin
public function groupJoin($inner, $outerKeySelector = null, $innerKeySelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $inner = self::from($inner); $outerKeySelector = Utils::createLambda($outerKeySelector, 'v,k', Functions::$key); $innerKeySelector = Uti...
php
public function groupJoin($inner, $outerKeySelector = null, $innerKeySelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $inner = self::from($inner); $outerKeySelector = Utils::createLambda($outerKeySelector, 'v,k', Functions::$key); $innerKeySelector = Uti...
[ "public", "function", "groupJoin", "(", "$", "inner", ",", "$", "outerKeySelector", "=", "null", ",", "$", "innerKeySelector", "=", "null", ",", "$", "resultSelectorValue", "=", "null", ",", "$", "resultSelectorKey", "=", "null", ")", ":", "Enumerable", "{",...
Correlates the elements of two sequences based on equality of keys and groups the results. <p><b>Syntax</b>: groupJoin (inner [, outerKeySelector {(v, k) ==> key} [, innerKeySelector {(v, k) ==> key} [, resultSelectorValue {(v, e, k) ==> value} [, resultSelectorKey {(v, e, k) ==> key}]]]]) <p>GroupJoin produces hierarc...
[ "Correlates", "the", "elements", "of", "two", "sequences", "based", "on", "equality", "of", "keys", "and", "groups", "the", "results", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "groupJoin", "(", "inner", "[", "outerKeySelector", "{", "(",...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L281-L299
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.join
public function join($inner, $outerKeySelector = null, $innerKeySelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $inner = self::from($inner); $outerKeySelector = Utils::createLambda($outerKeySelector, 'v,k', Functions::$key); $innerKeySelector = Utils::c...
php
public function join($inner, $outerKeySelector = null, $innerKeySelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $inner = self::from($inner); $outerKeySelector = Utils::createLambda($outerKeySelector, 'v,k', Functions::$key); $innerKeySelector = Utils::c...
[ "public", "function", "join", "(", "$", "inner", ",", "$", "outerKeySelector", "=", "null", ",", "$", "innerKeySelector", "=", "null", ",", "$", "resultSelectorValue", "=", "null", ",", "$", "resultSelectorKey", "=", "null", ")", ":", "Enumerable", "{", "$...
Correlates the elements of two sequences based on matching keys. <p><b>Syntax</b>: join (inner [, outerKeySelector {(v, k) ==> key} [, innerKeySelector {(v, k) ==> key} [, resultSelectorValue {(v1, v2, k) ==> value} [, resultSelectorKey {(v1, v2, k) ==> key}]]]]) <p>A join refers to the operation of correlating the ele...
[ "Correlates", "the", "elements", "of", "two", "sequences", "based", "on", "matching", "keys", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "join", "(", "inner", "[", "outerKeySelector", "{", "(", "v", "k", ")", "==", ">", "key", "}", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L315-L334
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.groupBy
public function groupBy($keySelector = null, $valueSelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); ...
php
public function groupBy($keySelector = null, $valueSelector = null, $resultSelectorValue = null, $resultSelectorKey = null): Enumerable { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); ...
[ "public", "function", "groupBy", "(", "$", "keySelector", "=", "null", ",", "$", "valueSelector", "=", "null", ",", "$", "resultSelectorValue", "=", "null", ",", "$", "resultSelectorKey", "=", "null", ")", ":", "Enumerable", "{", "$", "keySelector", "=", "...
Groups the elements of a sequence by its keys or a specified key selector function. <p><b>Syntax</b>: groupBy () <p>Groups the elements of a sequence by its keys. <p><b>Syntax</b>: groupBy (keySelector {(v, k) ==> key}) <p>Groups the elements of a sequence according to a specified key selector function. <p><b>Syntax</b...
[ "Groups", "the", "elements", "of", "a", "sequence", "by", "its", "keys", "or", "a", "specified", "key", "selector", "function", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "groupBy", "()", "<p", ">", "Groups", "the", "elements", "of", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L354-L363
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.aggregate
public function aggregate($func, $seed = null) { $func = Utils::createLambda($func, 'a,v,k'); $result = $seed; if ($seed !== null) { foreach ($this as $k => $v) { $result = $func($result, $v, $k); } } else { $assigned = fal...
php
public function aggregate($func, $seed = null) { $func = Utils::createLambda($func, 'a,v,k'); $result = $seed; if ($seed !== null) { foreach ($this as $k => $v) { $result = $func($result, $v, $k); } } else { $assigned = fal...
[ "public", "function", "aggregate", "(", "$", "func", ",", "$", "seed", "=", "null", ")", "{", "$", "func", "=", "Utils", "::", "createLambda", "(", "$", "func", ",", "'a,v,k'", ")", ";", "$", "result", "=", "$", "seed", ";", "if", "(", "$", "seed...
Applies an accumulator function over a sequence. If seed is not null, its value is used as the initial accumulator value. <p><b>Syntax</b>: aggregate (func {(a, v, k) ==> accum} [, seed]) <p>Aggregate method makes it simple to perform a calculation over a sequence of values. This method works by calling func one time f...
[ "Applies", "an", "accumulator", "function", "over", "a", "sequence", ".", "If", "seed", "is", "not", "null", "its", "value", "is", "used", "as", "the", "initial", "accumulator", "value", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "aggreg...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L380-L405
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.aggregateOrDefault
public function aggregateOrDefault($func, $seed = null, $default = null) { $func = Utils::createLambda($func, 'a,v,k'); $result = $seed; $assigned = false; if ($seed !== null) { foreach ($this as $k => $v) { $result = $func($result, $v, $k); ...
php
public function aggregateOrDefault($func, $seed = null, $default = null) { $func = Utils::createLambda($func, 'a,v,k'); $result = $seed; $assigned = false; if ($seed !== null) { foreach ($this as $k => $v) { $result = $func($result, $v, $k); ...
[ "public", "function", "aggregateOrDefault", "(", "$", "func", ",", "$", "seed", "=", "null", ",", "$", "default", "=", "null", ")", "{", "$", "func", "=", "Utils", "::", "createLambda", "(", "$", "func", ",", "'a,v,k'", ")", ";", "$", "result", "=", ...
Applies an accumulator function over a sequence. If seed is not null, its value is used as the initial accumulator value. <p>aggregateOrDefault (func {(a, v, k) ==> accum} [, seed [, default]]) <p>Aggregate method makes it simple to perform a calculation over a sequence of values. This method works by calling func one ...
[ "Applies", "an", "accumulator", "function", "over", "a", "sequence", ".", "If", "seed", "is", "not", "null", "its", "value", "is", "used", "as", "the", "initial", "accumulator", "value", ".", "<p", ">", "aggregateOrDefault", "(", "func", "{", "(", "a", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L418-L442
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.average
public function average($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $sum = $count = 0; foreach ($this as $k => $v) { $sum += $selector($v, $k); $count++; } if ($count === 0) throw new \Unexpect...
php
public function average($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $sum = $count = 0; foreach ($this as $k => $v) { $sum += $selector($v, $k); $count++; } if ($count === 0) throw new \Unexpect...
[ "public", "function", "average", "(", "$", "selector", "=", "null", ")", "{", "$", "selector", "=", "Utils", "::", "createLambda", "(", "$", "selector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "$", "sum", "=", "$", "count", "=",...
Computes the average of a sequence of numeric values. <p><b>Syntax</b>: average () <p>Computes the average of a sequence of numeric values. <p><b>Syntax</b>: average (selector {(v, k) ==> result}) <p>Computes the average of a sequence of numeric values that are obtained by invoking a transform function on each element ...
[ "Computes", "the", "average", "of", "a", "sequence", "of", "numeric", "values", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "average", "()", "<p", ">", "Computes", "the", "average", "of", "a", "sequence", "of", "numeric", "values", ".", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L455-L467
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.count
public function count($predicate = null): int { $it = $this->getIterator(); if ($it instanceof \Countable && $predicate === null) return count($it); $predicate = Utils::createLambda($predicate, 'v,k', Functions::$value); $count = 0; foreach ($it as $k => $v) ...
php
public function count($predicate = null): int { $it = $this->getIterator(); if ($it instanceof \Countable && $predicate === null) return count($it); $predicate = Utils::createLambda($predicate, 'v,k', Functions::$value); $count = 0; foreach ($it as $k => $v) ...
[ "public", "function", "count", "(", "$", "predicate", "=", "null", ")", ":", "int", "{", "$", "it", "=", "$", "this", "->", "getIterator", "(", ")", ";", "if", "(", "$", "it", "instanceof", "\\", "Countable", "&&", "$", "predicate", "===", "null", ...
Returns the number of elements in a sequence. <p><b>Syntax</b>: count () <p>If source iterator implements {@link Countable}, that implementation is used to obtain the count of elements. Otherwise, this method determines the count. <p><b>Syntax</b>: count (predicate {(v, k) ==> result}) <p>Returns a number that represen...
[ "Returns", "the", "number", "of", "elements", "in", "a", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "count", "()", "<p", ">", "If", "source", "iterator", "implements", "{" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L479-L493
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.max
public function max($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $max = -PHP_INT_MAX; $assigned = false; foreach ($this as $k => $v) { $max = max($max, $selector($v, $k)); $assigned = true; } if (!$...
php
public function max($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $max = -PHP_INT_MAX; $assigned = false; foreach ($this as $k => $v) { $max = max($max, $selector($v, $k)); $assigned = true; } if (!$...
[ "public", "function", "max", "(", "$", "selector", "=", "null", ")", "{", "$", "selector", "=", "Utils", "::", "createLambda", "(", "$", "selector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "$", "max", "=", "-", "PHP_INT_MAX", ";...
Returns the maximum value in a sequence of values. <p><b>Syntax</b>: max () <p>Returns the maximum value in a sequence of values. <p><b>Syntax</b>: max (selector {(v, k) ==> value}) <p>Invokes a transform function on each element of a sequence and returns the maximum value. @param callable|null $selector {(v, k) ==> va...
[ "Returns", "the", "maximum", "value", "in", "a", "sequence", "of", "values", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "max", "()", "<p", ">", "Returns", "the", "maximum", "value", "in", "a", "sequence", "of", "values", ".", "<p", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L506-L519
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.maxBy
public function maxBy($comparer, $selector = null) { $comparer = Utils::createLambda($comparer, 'a,b', Functions::$compareStrict); $enum = $this; if ($selector !== null) $enum = $enum->select($selector); return $enum->aggregate(function($a, $b) use ($comparer) { return $...
php
public function maxBy($comparer, $selector = null) { $comparer = Utils::createLambda($comparer, 'a,b', Functions::$compareStrict); $enum = $this; if ($selector !== null) $enum = $enum->select($selector); return $enum->aggregate(function($a, $b) use ($comparer) { return $...
[ "public", "function", "maxBy", "(", "$", "comparer", ",", "$", "selector", "=", "null", ")", "{", "$", "comparer", "=", "Utils", "::", "createLambda", "(", "$", "comparer", ",", "'a,b'", ",", "Functions", "::", "$", "compareStrict", ")", ";", "$", "enu...
Returns the maximum value in a sequence of values, using specified comparer. <p><b>Syntax</b>: maxBy (comparer {(a, b) ==> diff}) <p>Returns the maximum value in a sequence of values, using specified comparer. <p><b>Syntax</b>: maxBy (comparer {(a, b) ==> diff}, selector {(v, k) ==> value}) <p>Invokes a transform funct...
[ "Returns", "the", "maximum", "value", "in", "a", "sequence", "of", "values", "using", "specified", "comparer", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "maxBy", "(", "comparer", "{", "(", "a", "b", ")", "==", ">", "diff", "}", ")",...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L533-L541
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.min
public function min($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $min = PHP_INT_MAX; $assigned = false; foreach ($this as $k => $v) { $min = min($min, $selector($v, $k)); $assigned = true; } if (!$a...
php
public function min($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $min = PHP_INT_MAX; $assigned = false; foreach ($this as $k => $v) { $min = min($min, $selector($v, $k)); $assigned = true; } if (!$a...
[ "public", "function", "min", "(", "$", "selector", "=", "null", ")", "{", "$", "selector", "=", "Utils", "::", "createLambda", "(", "$", "selector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "$", "min", "=", "PHP_INT_MAX", ";", "$...
Returns the minimum value in a sequence of values. <p><b>Syntax</b>: min () <p>Returns the minimum value in a sequence of values. <p><b>Syntax</b>: min (selector {(v, k) ==> value}) <p>Invokes a transform function on each element of a sequence and returns the minimum value. @param callable|null $selector {(v, k) ==> va...
[ "Returns", "the", "minimum", "value", "in", "a", "sequence", "of", "values", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "min", "()", "<p", ">", "Returns", "the", "minimum", "value", "in", "a", "sequence", "of", "values", ".", "<p", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L554-L567
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.sum
public function sum($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $sum = 0; foreach ($this as $k => $v) $sum += $selector($v, $k); return $sum; }
php
public function sum($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $sum = 0; foreach ($this as $k => $v) $sum += $selector($v, $k); return $sum; }
[ "public", "function", "sum", "(", "$", "selector", "=", "null", ")", "{", "$", "selector", "=", "Utils", "::", "createLambda", "(", "$", "selector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "$", "sum", "=", "0", ";", "foreach", ...
Computes the sum of a sequence of values. <p><b>Syntax</b>: sum () <p>Computes the sum of a sequence of values. <p><b>Syntax</b>: sum (selector {(v, k) ==> result}) <p>Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. <p>This method retu...
[ "Computes", "the", "sum", "of", "a", "sequence", "of", "values", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "sum", "()", "<p", ">", "Computes", "the", "sum", "of", "a", "sequence", "of", "values", ".", "<p", ">", "<b", ">", "Syntax...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L602-L610
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.all
public function all($predicate): bool { $predicate = Utils::createLambda($predicate, 'v,k'); foreach ($this as $k => $v) { if (!$predicate($v, $k)) return false; } return true; }
php
public function all($predicate): bool { $predicate = Utils::createLambda($predicate, 'v,k'); foreach ($this as $k => $v) { if (!$predicate($v, $k)) return false; } return true; }
[ "public", "function", "all", "(", "$", "predicate", ")", ":", "bool", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ")", ";", "foreach", "(", "$", "this", "as", "$", "k", "=>", "$", "v", ")", "{", ...
Determines whether all elements of a sequence satisfy a condition. <p><b>Syntax</b>: all (predicate {(v, k) ==> result}) <p>Determines whether all elements of a sequence satisfy a condition. The enumeration of source is stopped as soon as the result can be determined. @param callable $predicate {(v, k) ==> result} A fu...
[ "Determines", "whether", "all", "elements", "of", "a", "sequence", "satisfy", "a", "condition", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "all", "(", "predicate", "{", "(", "v", "k", ")", "==", ">", "result", "}", ")", "<p", ">", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L624-L633
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.any
public function any($predicate = null): bool { $predicate = Utils::createLambda($predicate, 'v,k', false); if ($predicate) { foreach ($this as $k => $v) { if ($predicate($v, $k)) return true; } return false; } e...
php
public function any($predicate = null): bool { $predicate = Utils::createLambda($predicate, 'v,k', false); if ($predicate) { foreach ($this as $k => $v) { if ($predicate($v, $k)) return true; } return false; } e...
[ "public", "function", "any", "(", "$", "predicate", "=", "null", ")", ":", "bool", "{", "$", "predicate", "=", "Utils", "::", "createLambda", "(", "$", "predicate", ",", "'v,k'", ",", "false", ")", ";", "if", "(", "$", "predicate", ")", "{", "foreach...
Determines whether a sequence contains any elements. <p><b>Syntax</b>: any () <p>Determines whether a sequence contains any elements. The enumeration of source is stopped as soon as the result can be determined. <p><b>Syntax</b>: any (predicate {(v, k) ==> result}) <p>Determines whether any element of a sequence exists...
[ "Determines", "whether", "a", "sequence", "contains", "any", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "any", "()", "<p", ">", "Determines", "whether", "a", "sequence", "contains", "any", "elements", ".", "The", "enumeration", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L645-L663
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.append
public function append($value, $key = null): Enumerable { return new self(function() use ($value, $key) { yield from $this; yield $key => $value; }); }
php
public function append($value, $key = null): Enumerable { return new self(function() use ($value, $key) { yield from $this; yield $key => $value; }); }
[ "public", "function", "append", "(", "$", "value", ",", "$", "key", "=", "null", ")", ":", "Enumerable", "{", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "value", ",", "$", "key", ")", "{", "yield", "from", "$", "this", "...
Appends a value to the end of the sequence. <p><b>Syntax</b>: append (other, value) <p>Appends a value to the end of the sequence with null key. <p><b>Syntax</b>: append (other, value, key) <p>Appends a value to the end of the sequence with the specified key. @param mixed $value The value to append. @param mixed $key T...
[ "Appends", "a", "value", "to", "the", "end", "of", "the", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "append", "(", "other", "value", ")", "<p", ">", "Appends", "a", "value", "to", "the", "end", "of", "the", "sequence", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L676-L682
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.concat
public function concat($other): Enumerable { $other = self::from($other); return new self(function() use ($other) { yield from $this; yield from $other; }); }
php
public function concat($other): Enumerable { $other = self::from($other); return new self(function() use ($other) { yield from $this; yield from $other; }); }
[ "public", "function", "concat", "(", "$", "other", ")", ":", "Enumerable", "{", "$", "other", "=", "self", "::", "from", "(", "$", "other", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "other", ")", "{", "yield", ...
Concatenates two sequences. <p>This method differs from the {@link union} method because the concat method returns all the original elements in the input sequences. The union method returns only unique elements. <p><b>Syntax</b>: concat (other) @param array|\Iterator|\IteratorAggregate|Enumerable $other The sequence to...
[ "Concatenates", "two", "sequences", ".", "<p", ">", "This", "method", "differs", "from", "the", "{" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L692-L700
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.contains
public function contains($value): bool { foreach ($this as $v) { if ($v === $value) return true; } return false; }
php
public function contains($value): bool { foreach ($this as $v) { if ($v === $value) return true; } return false; }
[ "public", "function", "contains", "(", "$", "value", ")", ":", "bool", "{", "foreach", "(", "$", "this", "as", "$", "v", ")", "{", "if", "(", "$", "v", "===", "$", "value", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Determines whether a sequence contains a specified element. <p><b>Syntax</b>: contains (value) <p>Determines whether a sequence contains a specified element. Enumeration is terminated as soon as a matching element is found. @param $value mixed The value to locate in the sequence. @return bool true if the source sequenc...
[ "Determines", "whether", "a", "sequence", "contains", "a", "specified", "element", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "contains", "(", "value", ")", "<p", ">", "Determines", "whether", "a", "sequence", "contains", "a", "specified", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L710-L717
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.distinct
public function distinct($keySelector = null): Enumerable { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); return new self(function() use ($keySelector) { $set = []; foreach ($this as $k => $v) { $key = $keySelector($v, $k); ...
php
public function distinct($keySelector = null): Enumerable { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); return new self(function() use ($keySelector) { $set = []; foreach ($this as $k => $v) { $key = $keySelector($v, $k); ...
[ "public", "function", "distinct", "(", "$", "keySelector", "=", "null", ")", ":", "Enumerable", "{", "$", "keySelector", "=", "Utils", "::", "createLambda", "(", "$", "keySelector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "return", ...
Returns distinct elements from a sequence. <p>Element keys are values identifying elements. They are used as array keys and are subject to the same rules as array keys, for example, integer 100 and string "100" are considered equal. <p><b>Syntax</b>: distinct () <p>Returns distinct elements from a sequence using values...
[ "Returns", "distinct", "elements", "from", "a", "sequence", ".", "<p", ">", "Element", "keys", "are", "values", "identifying", "elements", ".", "They", "are", "used", "as", "array", "keys", "and", "are", "subject", "to", "the", "same", "rules", "as", "arra...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L730-L744
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.prepend
public function prepend($value, $key = null): Enumerable { return new self(function() use ($value, $key) { yield $key => $value; yield from $this; }); }
php
public function prepend($value, $key = null): Enumerable { return new self(function() use ($value, $key) { yield $key => $value; yield from $this; }); }
[ "public", "function", "prepend", "(", "$", "value", ",", "$", "key", "=", "null", ")", ":", "Enumerable", "{", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "value", ",", "$", "key", ")", "{", "yield", "$", "key", "=>", "$"...
Adds a value to the beginning of the sequence. <p><b>Syntax</b>: prepend (other, value) <p>Adds a value to the beginning of the sequence with null key. <p><b>Syntax</b>: prepend (other, value, key) <p>Adds a value to the beginning of the sequence with the specified key. @param mixed $value The value to prepend. @param ...
[ "Adds", "a", "value", "to", "the", "beginning", "of", "the", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "prepend", "(", "other", "value", ")", "<p", ">", "Adds", "a", "value", "to", "the", "beginning", "of", "the", "seque...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L823-L829
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.union
public function union($other, $keySelector = null): Enumerable { $other = self::from($other); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); return new self(function() use ($other, $keySelector) { $set = []; foreach ($this as $k => $v) { ...
php
public function union($other, $keySelector = null): Enumerable { $other = self::from($other); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); return new self(function() use ($other, $keySelector) { $set = []; foreach ($this as $k => $v) { ...
[ "public", "function", "union", "(", "$", "other", ",", "$", "keySelector", "=", "null", ")", ":", "Enumerable", "{", "$", "other", "=", "self", "::", "from", "(", "$", "other", ")", ";", "$", "keySelector", "=", "Utils", "::", "createLambda", "(", "$...
Produces the set union of two sequences. <p>Element keys are values identifying elements. They are used as array keys and are subject to the same rules as array keys, for example, integer 100 and string "100" are considered equal. <p>This method excludes duplicates from the return set. This is different behavior to the...
[ "Produces", "the", "set", "union", "of", "two", "sequences", ".", "<p", ">", "Element", "keys", "are", "values", "identifying", "elements", ".", "They", "are", "used", "as", "array", "keys", "and", "are", "subject", "to", "the", "same", "rules", "as", "a...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L844-L866
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toArray
public function toArray(): array { /** @var $it \Iterator|\ArrayIterator */ $it = $this->getIterator(); if ($it instanceof \ArrayIterator) return $it->getArrayCopy(); $array = []; foreach ($it as $k => $v) $array[$k] = $v; return $array; }
php
public function toArray(): array { /** @var $it \Iterator|\ArrayIterator */ $it = $this->getIterator(); if ($it instanceof \ArrayIterator) return $it->getArrayCopy(); $array = []; foreach ($it as $k => $v) $array[$k] = $v; return $array; }
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "/** @var $it \\Iterator|\\ArrayIterator */", "$", "it", "=", "$", "this", "->", "getIterator", "(", ")", ";", "if", "(", "$", "it", "instanceof", "\\", "ArrayIterator", ")", "return", "$", "it", ...
Creates an array from a sequence. <p><b>Syntax</b>: toArray () <p>The toArray method forces immediate query evaluation and returns an array that contains the query results. <p>The toArray method does not traverse into elements of the sequence, only the sequence itself is converted. That is, if elements of the sequence ...
[ "Creates", "an", "array", "from", "a", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toArray", "()", "<p", ">", "The", "toArray", "method", "forces", "immediate", "query", "evaluation", "and", "returns", "an", "array", "that", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L881-L892
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toArrayDeepProc
protected function toArrayDeepProc($enum): array { $array = []; foreach ($enum as $k => $v) $array[$k] = $v instanceof \Traversable || is_array($v) ? $this->toArrayDeepProc($v) : $v; return $array; }
php
protected function toArrayDeepProc($enum): array { $array = []; foreach ($enum as $k => $v) $array[$k] = $v instanceof \Traversable || is_array($v) ? $this->toArrayDeepProc($v) : $v; return $array; }
[ "protected", "function", "toArrayDeepProc", "(", "$", "enum", ")", ":", "array", "{", "$", "array", "=", "[", "]", ";", "foreach", "(", "$", "enum", "as", "$", "k", "=>", "$", "v", ")", "$", "array", "[", "$", "k", "]", "=", "$", "v", "instance...
Proc for {@link toArrayDeep}. @param $enum \Traversable Source sequence. @return array An array that contains the elements from the input sequence. @package YaLinqo\Conversion
[ "Proc", "for", "{" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L914-L920
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toList
public function toList(): array { /** @var $it \Iterator|\ArrayIterator */ $it = $this->getIterator(); if ($it instanceof \ArrayIterator) return array_values($it->getArrayCopy()); $array = []; foreach ($it as $v) $array[] = $v; return $array; ...
php
public function toList(): array { /** @var $it \Iterator|\ArrayIterator */ $it = $this->getIterator(); if ($it instanceof \ArrayIterator) return array_values($it->getArrayCopy()); $array = []; foreach ($it as $v) $array[] = $v; return $array; ...
[ "public", "function", "toList", "(", ")", ":", "array", "{", "/** @var $it \\Iterator|\\ArrayIterator */", "$", "it", "=", "$", "this", "->", "getIterator", "(", ")", ";", "if", "(", "$", "it", "instanceof", "\\", "ArrayIterator", ")", "return", "array_values"...
Creates an array from a sequence, with sequental integer keys. <p><b>Syntax</b>: toList () <p>The toList method forces immediate query evaluation and returns an array that contains the query results. <p>The toList method does not traverse into elements of the sequence, only the sequence itself is converted. That is, if...
[ "Creates", "an", "array", "from", "a", "sequence", "with", "sequental", "integer", "keys", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toList", "()", "<p", ">", "The", "toList", "method", "forces", "immediate", "query", "evaluation", "and"...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L931-L942
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toListDeepProc
protected function toListDeepProc($enum): array { $array = []; foreach ($enum as $v) $array[] = $v instanceof \Traversable || is_array($v) ? $this->toListDeepProc($v) : $v; return $array; }
php
protected function toListDeepProc($enum): array { $array = []; foreach ($enum as $v) $array[] = $v instanceof \Traversable || is_array($v) ? $this->toListDeepProc($v) : $v; return $array; }
[ "protected", "function", "toListDeepProc", "(", "$", "enum", ")", ":", "array", "{", "$", "array", "=", "[", "]", ";", "foreach", "(", "$", "enum", "as", "$", "v", ")", "$", "array", "[", "]", "=", "$", "v", "instanceof", "\\", "Traversable", "||",...
Proc for {@link toListDeep}. @param $enum \Traversable Source sequence. @return array An array that contains the elements from the input sequence. @package YaLinqo\Conversion
[ "Proc", "for", "{" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L964-L970
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toDictionary
public function toDictionary($keySelector = null, $valueSelector = null): array { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $dic = []; foreach ($this as $k => $v) ...
php
public function toDictionary($keySelector = null, $valueSelector = null): array { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $dic = []; foreach ($this as $k => $v) ...
[ "public", "function", "toDictionary", "(", "$", "keySelector", "=", "null", ",", "$", "valueSelector", "=", "null", ")", ":", "array", "{", "$", "keySelector", "=", "Utils", "::", "createLambda", "(", "$", "keySelector", ",", "'v,k'", ",", "Functions", "::...
Creates an array from a sequence according to specified key selector and value selector functions. <p><b>Syntax</b>: toDictionary ([keySelector {(v, k) ==> key} [, valueSelector {(v, k) ==> value}]]) <p>The toDictionary method returns an array, a one-to-one dictionary that maps keys to values. If the source sequence co...
[ "Creates", "an", "array", "from", "a", "sequence", "according", "to", "specified", "key", "selector", "and", "value", "selector", "functions", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toDictionary", "(", "[", "keySelector", "{", "(", "v...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L981-L990
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toLookup
public function toLookup($keySelector = null, $valueSelector = null): array { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $lookup = []; foreach ($this as $k => $v) ...
php
public function toLookup($keySelector = null, $valueSelector = null): array { $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $lookup = []; foreach ($this as $k => $v) ...
[ "public", "function", "toLookup", "(", "$", "keySelector", "=", "null", ",", "$", "valueSelector", "=", "null", ")", ":", "array", "{", "$", "keySelector", "=", "Utils", "::", "createLambda", "(", "$", "keySelector", ",", "'v,k'", ",", "Functions", "::", ...
Creates an array from a sequence according to specified key selector and value selector functions. <p><b>Syntax</b>: toLookup ([keySelector {(v, k) ==> key} [, valueSelector {(v, k) ==> value}]]) <p>The toLookup method returns an array, a one-to-many dictionary that maps keys to arrays of values. @param callable|null $...
[ "Creates", "an", "array", "from", "a", "sequence", "according", "to", "specified", "key", "selector", "and", "value", "selector", "functions", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toLookup", "(", "[", "keySelector", "{", "(", "v", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1015-L1024
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toObject
public function toObject($propertySelector = null, $valueSelector = null): \stdClass { $propertySelector = Utils::createLambda($propertySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $obj = new \stdClass(); foreach ...
php
public function toObject($propertySelector = null, $valueSelector = null): \stdClass { $propertySelector = Utils::createLambda($propertySelector, 'v,k', Functions::$key); $valueSelector = Utils::createLambda($valueSelector, 'v,k', Functions::$value); $obj = new \stdClass(); foreach ...
[ "public", "function", "toObject", "(", "$", "propertySelector", "=", "null", ",", "$", "valueSelector", "=", "null", ")", ":", "\\", "stdClass", "{", "$", "propertySelector", "=", "Utils", "::", "createLambda", "(", "$", "propertySelector", ",", "'v,k'", ","...
Transform the sequence to an object. <p><b>Syntax</b>: toObject ([propertySelector {(v, k) ==> name} [, valueSelector {(v, k) ==> value}]]) @param callable|null $propertySelector {(v, k) ==> name} A function to extract a property name from an element. Must return a valid PHP identifier. Default: key. @param callable|nu...
[ "Transform", "the", "sequence", "to", "an", "object", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toObject", "(", "[", "propertySelector", "{", "(", "v", "k", ")", "==", ">", "name", "}", "[", "valueSelector", "{", "(", "v", "k", "...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1058-L1067
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.toString
public function toString(string $separator = '', $valueSelector = null): string { $valueSelector = Utils::createLambda($valueSelector, 'v,k', false); $array = $valueSelector ? $this->select($valueSelector)->toList() : $this->toList(); return implode($separator, $array); }
php
public function toString(string $separator = '', $valueSelector = null): string { $valueSelector = Utils::createLambda($valueSelector, 'v,k', false); $array = $valueSelector ? $this->select($valueSelector)->toList() : $this->toList(); return implode($separator, $array); }
[ "public", "function", "toString", "(", "string", "$", "separator", "=", "''", ",", "$", "valueSelector", "=", "null", ")", ":", "string", "{", "$", "valueSelector", "=", "Utils", "::", "createLambda", "(", "$", "valueSelector", ",", "'v,k'", ",", "false", ...
Returns a string containing a string representation of all the sequence values, with the separator string between each element. <p><b>Syntax</b>: toString ([separator [, selector]]) @param string $separator A string separating values in the result string. Default: ''. @param callable|null $valueSelector {(v, k) ==> val...
[ "Returns", "a", "string", "containing", "a", "string", "representation", "of", "all", "the", "sequence", "values", "with", "the", "separator", "string", "between", "each", "element", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toString", "("...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1078-L1083
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.call
public function call($action): Enumerable { $action = Utils::createLambda($action, 'v,k'); return new self(function() use ($action) { foreach ($this as $k => $v) { $action($v, $k); yield $k => $v; } }); }
php
public function call($action): Enumerable { $action = Utils::createLambda($action, 'v,k'); return new self(function() use ($action) { foreach ($this as $k => $v) { $action($v, $k); yield $k => $v; } }); }
[ "public", "function", "call", "(", "$", "action", ")", ":", "Enumerable", "{", "$", "action", "=", "Utils", "::", "createLambda", "(", "$", "action", ",", "'v,k'", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "action...
Invokes an action for each element in the sequence. <p><b>Syntax</b>: process (action {(v, k) ==> void}) <p>Process method does not start enumeration itself. To force enumeration, you can use {@link each} method. <p>Original LINQ method name: do. @param callable $action {(v, k) ==> void} The action to invoke for each e...
[ "Invokes", "an", "action", "for", "each", "element", "in", "the", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "process", "(", "action", "{", "(", "v", "k", ")", "==", ">", "void", "}", ")", "<p", ">", "Process", "method"...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1098-L1108
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.each
public function each($action = null) { $action = Utils::createLambda($action, 'v,k', Functions::$blank); foreach ($this as $k => $v) $action($v, $k); }
php
public function each($action = null) { $action = Utils::createLambda($action, 'v,k', Functions::$blank); foreach ($this as $k => $v) $action($v, $k); }
[ "public", "function", "each", "(", "$", "action", "=", "null", ")", "{", "$", "action", "=", "Utils", "::", "createLambda", "(", "$", "action", ",", "'v,k'", ",", "Functions", "::", "$", "blank", ")", ";", "foreach", "(", "$", "this", "as", "$", "k...
Invokes an action for each element in the sequence. <p><b>Syntax</b>: each (action {(v, k) ==> void}) <p>Each method forces enumeration. To just add side-effect without enumerating, you can use {@link process} method. <p>Original LINQ method name: foreach. @param callable $action {(v, k) ==> void} The action to invoke ...
[ "Invokes", "an", "action", "for", "each", "element", "in", "the", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "each", "(", "action", "{", "(", "v", "k", ")", "==", ">", "void", "}", ")", "<p", ">", "Each", "method", "f...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1118-L1124
Athari/YaLinqo
YaLinqo/Enumerable.php
Enumerable.writeLine
public function writeLine($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); foreach ($this as $k => $v) { echo $selector($v, $k), PHP_EOL; } }
php
public function writeLine($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); foreach ($this as $k => $v) { echo $selector($v, $k), PHP_EOL; } }
[ "public", "function", "writeLine", "(", "$", "selector", "=", "null", ")", "{", "$", "selector", "=", "Utils", "::", "createLambda", "(", "$", "selector", ",", "'v,k'", ",", "Functions", "::", "$", "value", ")", ";", "foreach", "(", "$", "this", "as", ...
Output all the sequence values, with a new line after each element. <p><b>Syntax</b>: writeLine ([selector]) @param callable|null $selector {(v, k) ==> value} A transform function to apply to each element. Default: value. @return string @see echo, PHP_EOL @package YaLinqo\Actions
[ "Output", "all", "the", "sequence", "values", "with", "a", "new", "line", "after", "each", "element", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "writeLine", "(", "[", "selector", "]", ")" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/Enumerable.php#L1147-L1154
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.cycle
public static function cycle($source): Enumerable { $source = self::from($source); return new self(function() use ($source) { $isEmpty = true; while (true) { foreach ($source as $v) { yield $v; $isEmpty = false; ...
php
public static function cycle($source): Enumerable { $source = self::from($source); return new self(function() use ($source) { $isEmpty = true; while (true) { foreach ($source as $v) { yield $v; $isEmpty = false; ...
[ "public", "static", "function", "cycle", "(", "$", "source", ")", ":", "Enumerable", "{", "$", "source", "=", "self", "::", "from", "(", "$", "source", ")", ";", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "source", ")", "{...
Cycles through the source sequence. <p><b>Syntax</b>: cycle (source) <p>Source keys are discarded. @param array|\Iterator|\IteratorAggregate|Enumerable $source Source sequence. @throws \InvalidArgumentException If source is not array or Traversible or Enumerable. @throws \UnexpectedValueException If source contains no ...
[ "Cycles", "through", "the", "source", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "cycle", "(", "source", ")", "<p", ">", "Source", "keys", "are", "discarded", "." ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L28-L43
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.from
public static function from($source): Enumerable { $it = null; if ($source instanceof Enumerable) return $source; elseif (is_array($source)) $it = new \ArrayIterator($source); elseif ($source instanceof \IteratorAggregate) $it = $source->getIterato...
php
public static function from($source): Enumerable { $it = null; if ($source instanceof Enumerable) return $source; elseif (is_array($source)) $it = new \ArrayIterator($source); elseif ($source instanceof \IteratorAggregate) $it = $source->getIterato...
[ "public", "static", "function", "from", "(", "$", "source", ")", ":", "Enumerable", "{", "$", "it", "=", "null", ";", "if", "(", "$", "source", "instanceof", "Enumerable", ")", "return", "$", "source", ";", "elseif", "(", "is_array", "(", "$", "source"...
Converts source into Enumerable sequence. <p><b>Syntax</b>: from (source) <p>Result depends on the type of source: <ul> <li><b>array</b>: Enumerable from ArrayIterator; <li><b>Enumerable</b>: Enumerable source itself; <li><b>Iterator</b>: Enumerable from Iterator; <li><b>IteratorAggregate</b>: Enumerable from Iterator ...
[ "Converts", "source", "into", "Enumerable", "sequence", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "from", "(", "source", ")", "<p", ">", "Result", "depends", "on", "the", "type", "of", "source", ":", "<ul", ">", "<li", ">", "<b", ">...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L72-L87
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.generate
public static function generate($funcValue, $seedValue = null, $funcKey = null, $seedKey = null): Enumerable { $funcValue = Utils::createLambda($funcValue, 'v,k'); $funcKey = Utils::createLambda($funcKey, 'v,k', false); return new self(function() use ($funcValue, $funcKey, $seedValue, $seed...
php
public static function generate($funcValue, $seedValue = null, $funcKey = null, $seedKey = null): Enumerable { $funcValue = Utils::createLambda($funcValue, 'v,k'); $funcKey = Utils::createLambda($funcKey, 'v,k', false); return new self(function() use ($funcValue, $funcKey, $seedValue, $seed...
[ "public", "static", "function", "generate", "(", "$", "funcValue", ",", "$", "seedValue", "=", "null", ",", "$", "funcKey", "=", "null", ",", "$", "seedKey", "=", "null", ")", ":", "Enumerable", "{", "$", "funcValue", "=", "Utils", "::", "createLambda", ...
Generates a sequence by mimicking a for loop. <p><b>Syntax</b>: generate (funcValue {(v, k) ==> value} [, seedValue [, funcKey {(v, k) ==> key} [, seedKey]]]) <p>If seedValue is null, the first value will be the result of calling funcValue on seedValue and seedKey. The same applies for seedKey. @param callable $funcVal...
[ "Generates", "a", "sequence", "by", "mimicking", "a", "for", "loop", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "generate", "(", "funcValue", "{", "(", "v", "k", ")", "==", ">", "value", "}", "[", "seedValue", "[", "funcKey", "{", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L100-L117
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.toInfinity
public static function toInfinity(int $start = 0, int $step = 1): Enumerable { return new self(function() use ($start, $step) { $value = $start - $step; while (true) yield $value += $step; }); }
php
public static function toInfinity(int $start = 0, int $step = 1): Enumerable { return new self(function() use ($start, $step) { $value = $start - $step; while (true) yield $value += $step; }); }
[ "public", "static", "function", "toInfinity", "(", "int", "$", "start", "=", "0", ",", "int", "$", "step", "=", "1", ")", ":", "Enumerable", "{", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", "start", ",", "$", "step", ")", ...
Generates a sequence of integral numbers to infinity. <p><b>Syntax</b>: toInfinity ([start [, step]]) @param int $start The first integer in the sequence. Default: 0. @param int $step The difference between adjacent integers. Default: 1. @return Enumerable @package YaLinqo\Generation
[ "Generates", "a", "sequence", "of", "integral", "numbers", "to", "infinity", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toInfinity", "(", "[", "start", "[", "step", "]]", ")" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L127-L134
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.matches
public static function matches(string $subject, string $pattern, int $flags = PREG_SET_ORDER): Enumerable { return new self(function() use ($subject, $pattern, $flags) { preg_match_all($pattern, $subject, $matches, $flags); return $matches !== false ? self::from($matches)->getIterato...
php
public static function matches(string $subject, string $pattern, int $flags = PREG_SET_ORDER): Enumerable { return new self(function() use ($subject, $pattern, $flags) { preg_match_all($pattern, $subject, $matches, $flags); return $matches !== false ? self::from($matches)->getIterato...
[ "public", "static", "function", "matches", "(", "string", "$", "subject", ",", "string", "$", "pattern", ",", "int", "$", "flags", "=", "PREG_SET_ORDER", ")", ":", "Enumerable", "{", "return", "new", "self", "(", "function", "(", ")", "use", "(", "$", ...
Searches subject for all matches to the regular expression given in pattern and enumerates them in the order specified by flags. After the first match is found, the subsequent searches are continued on from end of the last match. <p><b>Syntax</b>: matches (subject, pattern [, flags]) @param string $subject The input st...
[ "Searches", "subject", "for", "all", "matches", "to", "the", "regular", "expression", "given", "in", "pattern", "and", "enumerates", "them", "in", "the", "order", "specified", "by", "flags", ".", "After", "the", "first", "match", "is", "found", "the", "subse...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L146-L152
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.toNegativeInfinity
public static function toNegativeInfinity(int $start = 0, int $step = 1): Enumerable { return self::toInfinity($start, -$step); }
php
public static function toNegativeInfinity(int $start = 0, int $step = 1): Enumerable { return self::toInfinity($start, -$step); }
[ "public", "static", "function", "toNegativeInfinity", "(", "int", "$", "start", "=", "0", ",", "int", "$", "step", "=", "1", ")", ":", "Enumerable", "{", "return", "self", "::", "toInfinity", "(", "$", "start", ",", "-", "$", "step", ")", ";", "}" ]
Generates a sequence of integral numbers to negative infinity. <p><b>Syntax</b>: toNegativeInfinity ([start [, step]]) @param int $start The first integer in the sequence. Default: 0. @param int $step The difference between adjacent integers. Default: 1. @return Enumerable @package YaLinqo\Generation
[ "Generates", "a", "sequence", "of", "integral", "numbers", "to", "negative", "infinity", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "toNegativeInfinity", "(", "[", "start", "[", "step", "]]", ")" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L162-L165
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.range
public static function range(int $start, int $count, int $step = 1): Enumerable { if ($count <= 0) return self::emptyEnum(); return new self(function() use ($start, $count, $step) { $value = $start - $step; while ($count-- > 0) yield $value += $ste...
php
public static function range(int $start, int $count, int $step = 1): Enumerable { if ($count <= 0) return self::emptyEnum(); return new self(function() use ($start, $count, $step) { $value = $start - $step; while ($count-- > 0) yield $value += $ste...
[ "public", "static", "function", "range", "(", "int", "$", "start", ",", "int", "$", "count", ",", "int", "$", "step", "=", "1", ")", ":", "Enumerable", "{", "if", "(", "$", "count", "<=", "0", ")", "return", "self", "::", "emptyEnum", "(", ")", "...
Generates a sequence of integral numbers, beginning with start and containing count elements. <p><b>Syntax</b>: range (start, count [, step]) <p>Keys in the generated sequence are sequental: 0, 1, 2 etc. <p>Example: range(3, 4, 2) = 3, 5, 7, 9. @param int $start The value of the first integer in the sequence. @param in...
[ "Generates", "a", "sequence", "of", "integral", "numbers", "beginning", "with", "start", "and", "containing", "count", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "range", "(", "start", "count", "[", "step", "]", ")", "<p", ">...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L190-L199
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.rangeDown
public static function rangeDown(int $start, int $count, int $step = 1): Enumerable { return self::range($start, $count, -$step); }
php
public static function rangeDown(int $start, int $count, int $step = 1): Enumerable { return self::range($start, $count, -$step); }
[ "public", "static", "function", "rangeDown", "(", "int", "$", "start", ",", "int", "$", "count", ",", "int", "$", "step", "=", "1", ")", ":", "Enumerable", "{", "return", "self", "::", "range", "(", "$", "start", ",", "$", "count", ",", "-", "$", ...
Generates a reversed sequence of integral numbers, beginning with start and containing count elements. <p><b>Syntax</b>: rangeDown (start, count [, step]) <p>Keys in the generated sequence are sequental: 0, 1, 2 etc. <p>Example: rangeDown(9, 4, 2) = 9, 7, 5, 3. @param int $start The value of the first integer in the se...
[ "Generates", "a", "reversed", "sequence", "of", "integral", "numbers", "beginning", "with", "start", "and", "containing", "count", "elements", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "rangeDown", "(", "start", "count", "[", "step", "]", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L212-L215
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.rangeTo
public static function rangeTo(int $start, int $end, $step = 1): Enumerable { if ($step <= 0) throw new \InvalidArgumentException(Errors::STEP_NEGATIVE); return new self(function() use ($start, $end, $step) { if ($start <= $end) { for ($i = $start; $i < $end; ...
php
public static function rangeTo(int $start, int $end, $step = 1): Enumerable { if ($step <= 0) throw new \InvalidArgumentException(Errors::STEP_NEGATIVE); return new self(function() use ($start, $end, $step) { if ($start <= $end) { for ($i = $start; $i < $end; ...
[ "public", "static", "function", "rangeTo", "(", "int", "$", "start", ",", "int", "$", "end", ",", "$", "step", "=", "1", ")", ":", "Enumerable", "{", "if", "(", "$", "step", "<=", "0", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "Erro...
Generates a sequence of integral numbers within a specified range from start to end. <p><b>Syntax</b>: rangeTo (start, end [, step]) <p>Keys in the generated sequence are sequental: 0, 1, 2 etc. <p>Example: rangeTo(3, 9, 2) = 3, 5, 7, 9. @param int $start The value of the first integer in the sequence. @param int $end ...
[ "Generates", "a", "sequence", "of", "integral", "numbers", "within", "a", "specified", "range", "from", "start", "to", "end", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "rangeTo", "(", "start", "end", "[", "step", "]", ")", "<p", ">", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L229-L243
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.repeat
public static function repeat($element, $count = null): Enumerable { if ($count < 0) throw new \InvalidArgumentException(Errors::COUNT_LESS_THAN_ZERO); return new self(function() use ($element, $count) { for ($i = 0; $i < $count || $count === null; $i++) yield...
php
public static function repeat($element, $count = null): Enumerable { if ($count < 0) throw new \InvalidArgumentException(Errors::COUNT_LESS_THAN_ZERO); return new self(function() use ($element, $count) { for ($i = 0; $i < $count || $count === null; $i++) yield...
[ "public", "static", "function", "repeat", "(", "$", "element", ",", "$", "count", "=", "null", ")", ":", "Enumerable", "{", "if", "(", "$", "count", "<", "0", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "Errors", "::", "COUNT_LESS_THAN_ZERO...
Generates an sequence that contains one repeated value. <p><b>Syntax</b>: repeat (element) <p>Generates an endless sequence that contains one repeated value. <p><b>Syntax</b>: repeat (element, count) <p>Generates a sequence of specified length that contains one repeated value. <p>Keys in the generated sequence are sequ...
[ "Generates", "an", "sequence", "that", "contains", "one", "repeated", "value", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "repeat", "(", "element", ")", "<p", ">", "Generates", "an", "endless", "sequence", "that", "contains", "one", "repea...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L258-L266
Athari/YaLinqo
YaLinqo/EnumerableGeneration.php
EnumerableGeneration.split
public static function split(string $subject, string $pattern, int $flags = 0): Enumerable { return new self( new \ArrayIterator(preg_split($pattern, $subject, -1, $flags)), false ); }
php
public static function split(string $subject, string $pattern, int $flags = 0): Enumerable { return new self( new \ArrayIterator(preg_split($pattern, $subject, -1, $flags)), false ); }
[ "public", "static", "function", "split", "(", "string", "$", "subject", ",", "string", "$", "pattern", ",", "int", "$", "flags", "=", "0", ")", ":", "Enumerable", "{", "return", "new", "self", "(", "new", "\\", "ArrayIterator", "(", "preg_split", "(", ...
Split the given string by a regular expression. <p><b>Syntax</b>: split (subject, pattern [, flags]) @param string $subject The input string. @param string $pattern The pattern to search for, as a string. @param int $flags flags can be any combination of the following flags: PREG_SPLIT_NO_EMPTY, PREG_SPLIT_DELIM_CAPTUR...
[ "Split", "the", "given", "string", "by", "a", "regular", "expression", ".", "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "split", "(", "subject", "pattern", "[", "flags", "]", ")" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/EnumerableGeneration.php#L278-L284
Athari/YaLinqo
YaLinqo/OrderedEnumerable.php
OrderedEnumerable.thenByDir
public function thenByDir($sortOrder, $keySelector = null, $comparer = null): OrderedEnumerable { $sortFlags = Utils::lambdaToSortFlagsAndOrder($comparer, $sortOrder); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); $isReversed = $sortOrder == SORT_DESC; $...
php
public function thenByDir($sortOrder, $keySelector = null, $comparer = null): OrderedEnumerable { $sortFlags = Utils::lambdaToSortFlagsAndOrder($comparer, $sortOrder); $keySelector = Utils::createLambda($keySelector, 'v,k', Functions::$value); $isReversed = $sortOrder == SORT_DESC; $...
[ "public", "function", "thenByDir", "(", "$", "sortOrder", ",", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "$", "sortFlags", "=", "Utils", "::", "lambdaToSortFlagsAndOrder", "(", "$", "comparer", ",...
<p><b>Syntax</b>: thenByDir (false|true [, {{(v, k) ==> key} [, {{(a, b) ==> diff}]]) <p>Performs a subsequent ordering of elements in a sequence in a particular direction (ascending, descending) according to a key. <p>Three methods are defined to extend the type OrderedEnumerable, which is the return type of this meth...
[ "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "thenByDir", "(", "false|true", "[", "{{", "(", "v", "k", ")", "==", ">", "key", "}", "[", "{{", "(", "a", "b", ")", "==", ">", "diff", "}", "]]", ")", "<p", ">", "Performs", "a", "subseq...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/OrderedEnumerable.php#L73-L80
Athari/YaLinqo
YaLinqo/OrderedEnumerable.php
OrderedEnumerable.thenBy
public function thenBy($keySelector = null, $comparer = null): OrderedEnumerable { return $this->thenByDir(false, $keySelector, $comparer); }
php
public function thenBy($keySelector = null, $comparer = null): OrderedEnumerable { return $this->thenByDir(false, $keySelector, $comparer); }
[ "public", "function", "thenBy", "(", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "return", "$", "this", "->", "thenByDir", "(", "false", ",", "$", "keySelector", ",", "$", "comparer", ")", ";", ...
<p><b>Syntax</b>: thenBy ([{{(v, k) ==> key} [, {{(a, b) ==> diff}]]) <p>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key. <p>Three methods are defined to extend the type OrderedEnumerable, which is the return type of this method. These three methods, namely {@link then...
[ "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "thenBy", "(", "[", "{{", "(", "v", "k", ")", "==", ">", "key", "}", "[", "{{", "(", "a", "b", ")", "==", ">", "diff", "}", "]]", ")", "<p", ">", "Performs", "a", "subsequent", "ordering"...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/OrderedEnumerable.php#L92-L95
Athari/YaLinqo
YaLinqo/OrderedEnumerable.php
OrderedEnumerable.thenByDescending
public function thenByDescending($keySelector = null, $comparer = null): OrderedEnumerable { return $this->thenByDir(true, $keySelector, $comparer); }
php
public function thenByDescending($keySelector = null, $comparer = null): OrderedEnumerable { return $this->thenByDir(true, $keySelector, $comparer); }
[ "public", "function", "thenByDescending", "(", "$", "keySelector", "=", "null", ",", "$", "comparer", "=", "null", ")", ":", "OrderedEnumerable", "{", "return", "$", "this", "->", "thenByDir", "(", "true", ",", "$", "keySelector", ",", "$", "comparer", ")"...
<p><b>Syntax</b>: thenByDescending ([{{(v, k) ==> key} [, {{(a, b) ==> diff}]]) <p>Performs a subsequent ordering of the elements in a sequence in descending order according to a key. <p>Three methods are defined to extend the type OrderedEnumerable, which is the return type of this method. These three methods, namely ...
[ "<p", ">", "<b", ">", "Syntax<", "/", "b", ">", ":", "thenByDescending", "(", "[", "{{", "(", "v", "k", ")", "==", ">", "key", "}", "[", "{{", "(", "a", "b", ")", "==", ">", "diff", "}", "]]", ")", "<p", ">", "Performs", "a", "subsequent", ...
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/OrderedEnumerable.php#L107-L110
Athari/YaLinqo
YaLinqo/OrderedEnumerable.php
OrderedEnumerable.getIterator
public function getIterator(): \Traversable { $canMultisort = $this->sortFlags !== null; $array = $this->source->tryGetArrayCopy(); $it = $this->trySortBySingleField($array, $canMultisort); if ($it !== null) return $it; return $this->sortByMultipleFields($array,...
php
public function getIterator(): \Traversable { $canMultisort = $this->sortFlags !== null; $array = $this->source->tryGetArrayCopy(); $it = $this->trySortBySingleField($array, $canMultisort); if ($it !== null) return $it; return $this->sortByMultipleFields($array,...
[ "public", "function", "getIterator", "(", ")", ":", "\\", "Traversable", "{", "$", "canMultisort", "=", "$", "this", "->", "sortFlags", "!==", "null", ";", "$", "array", "=", "$", "this", "->", "source", "->", "tryGetArrayCopy", "(", ")", ";", "$", "it...
{@inheritdoc}
[ "{" ]
train
https://github.com/Athari/YaLinqo/blob/939469772b36d4d454836681e0be2f220cf1e5cb/YaLinqo/OrderedEnumerable.php#L113-L123
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php
GenerationalCacheStrategy.generateKey
public function generateKey($annotation, $value) { $key = $this->keyGenerator->generateKey($value); if (null === $key) { throw new InvalidCacheKeyException(); } return $annotation . '__GCS__' . $key; }
php
public function generateKey($annotation, $value) { $key = $this->keyGenerator->generateKey($value); if (null === $key) { throw new InvalidCacheKeyException(); } return $annotation . '__GCS__' . $key; }
[ "public", "function", "generateKey", "(", "$", "annotation", ",", "$", "value", ")", "{", "$", "key", "=", "$", "this", "->", "keyGenerator", "->", "generateKey", "(", "$", "value", ")", ";", "if", "(", "null", "===", "$", "key", ")", "{", "throw", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php#L61-L70
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php
GenerationalCacheStrategy.saveBlock
public function saveBlock($key, $block) { return $this->cache->save($key, $block, $this->lifetime); }
php
public function saveBlock($key, $block) { return $this->cache->save($key, $block, $this->lifetime); }
[ "public", "function", "saveBlock", "(", "$", "key", ",", "$", "block", ")", "{", "return", "$", "this", "->", "cache", "->", "save", "(", "$", "key", ",", "$", "block", ",", "$", "this", "->", "lifetime", ")", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/CacheStrategy/GenerationalCacheStrategy.php#L75-L78
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php
DoctrineCacheAdapter.save
public function save($key, $value, $lifetime = 0) { return $this->cache->save($key, $value, $lifetime); }
php
public function save($key, $value, $lifetime = 0) { return $this->cache->save($key, $value, $lifetime); }
[ "public", "function", "save", "(", "$", "key", ",", "$", "value", ",", "$", "lifetime", "=", "0", ")", "{", "return", "$", "this", "->", "cache", "->", "save", "(", "$", "key", ",", "$", "value", ",", "$", "lifetime", ")", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/CacheProvider/DoctrineCacheAdapter.php#L45-L48
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/Node/CacheNode.php
CacheNode.compile
public function compile(\Twig_Compiler $compiler) { $i = self::$cacheCount++; if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) { $extension = 'Asm89\Twig\CacheExtension\Extension'; } else { $extension = 'asm89_cache'; } $compiler ...
php
public function compile(\Twig_Compiler $compiler) { $i = self::$cacheCount++; if (version_compare(\Twig_Environment::VERSION, '1.26.0', '>=')) { $extension = 'Asm89\Twig\CacheExtension\Extension'; } else { $extension = 'asm89_cache'; } $compiler ...
[ "public", "function", "compile", "(", "\\", "Twig_Compiler", "$", "compiler", ")", "{", "$", "i", "=", "self", "::", "$", "cacheCount", "++", ";", "if", "(", "version_compare", "(", "\\", "Twig_Environment", "::", "VERSION", ",", "'1.26.0'", ",", "'>='", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/Node/CacheNode.php#L38-L70
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php
IndexedChainingCacheStrategy.generateKey
public function generateKey($annotation, $value) { if (!is_array($value) || null === $strategyKey = key($value)) { throw new NonExistingStrategyKeyException(); } if (!isset($this->strategies[$strategyKey])) { throw new NonExistingStrategyException($strategyKey); ...
php
public function generateKey($annotation, $value) { if (!is_array($value) || null === $strategyKey = key($value)) { throw new NonExistingStrategyKeyException(); } if (!isset($this->strategies[$strategyKey])) { throw new NonExistingStrategyException($strategyKey); ...
[ "public", "function", "generateKey", "(", "$", "annotation", ",", "$", "value", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", "||", "null", "===", "$", "strategyKey", "=", "key", "(", "$", "value", ")", ")", "{", "throw", "new", "No...
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/CacheStrategy/IndexedChainingCacheStrategy.php#L53-L67
asm89/twig-cache-extension
lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php
Cache.parse
public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $annotation = $this->parser->getExpressionParser()->parseExpression(); $key = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(\Twig_Token...
php
public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $annotation = $this->parser->getExpressionParser()->parseExpression(); $key = $this->parser->getExpressionParser()->parseExpression(); $stream->expect(\Twig_Token...
[ "public", "function", "parse", "(", "\\", "Twig_Token", "$", "token", ")", "{", "$", "lineno", "=", "$", "token", "->", "getLine", "(", ")", ";", "$", "stream", "=", "$", "this", "->", "parser", "->", "getStream", "(", ")", ";", "$", "annotation", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/asm89/twig-cache-extension/blob/630ea7abdc3fc62ba6786c02590a1560e449cf55/lib/Asm89/Twig/CacheExtension/TokenParser/Cache.php#L44-L58
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/DataTable/Columns/Factory.php
Factory.getColumnClassName
public function getColumnClassName($options) { $model = $this->config->getDataModel(); $namespace = __NAMESPACE__ . '\\'; //if the relationship is set if ($method = $this->validator->arrayGet($options, 'relationship')) { if (method_exists($model, $method)) { $relationship = $model->{$method}(); ...
php
public function getColumnClassName($options) { $model = $this->config->getDataModel(); $namespace = __NAMESPACE__ . '\\'; //if the relationship is set if ($method = $this->validator->arrayGet($options, 'relationship')) { if (method_exists($model, $method)) { $relationship = $model->{$method}(); ...
[ "public", "function", "getColumnClassName", "(", "$", "options", ")", "{", "$", "model", "=", "$", "this", "->", "config", "->", "getDataModel", "(", ")", ";", "$", "namespace", "=", "__NAMESPACE__", ".", "'\\\\'", ";", "//if the relationship is set", "if", ...
Gets the column class name depending on whether or not it's a relationship and what type of relationship it is @param array $options @return string
[ "Gets", "the", "column", "class", "name", "depending", "on", "whether", "or", "not", "it", "s", "a", "relationship", "and", "what", "type", "of", "relationship", "it", "is" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/DataTable/Columns/Factory.php#L145-L172
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/DataTable/Columns/Factory.php
Factory.getColumnOptions
public function getColumnOptions() { //make sure we only run this once and then return the cached version if (!sizeof($this->columnOptions)) { foreach ($this->getColumns() as $column) { $this->columnOptions[] = $column->getOptions(); } } return $this->columnOptions; }
php
public function getColumnOptions() { //make sure we only run this once and then return the cached version if (!sizeof($this->columnOptions)) { foreach ($this->getColumns() as $column) { $this->columnOptions[] = $column->getOptions(); } } return $this->columnOptions; }
[ "public", "function", "getColumnOptions", "(", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "columnOptions", ")", ")", "{", "foreach", "(", "$", "this", "->", "getColumns", "(", ...
Gets the column objects as an integer-indexed array @return array
[ "Gets", "the", "column", "objects", "as", "an", "integer", "-", "indexed", "array" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/DataTable/Columns/Factory.php#L228-L240
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/DataTable/Columns/Factory.php
Factory.getRelatedColumns
public function getRelatedColumns() { //make sure we only run this once and then return the cached version if (!sizeof($this->relatedColumns)) { foreach ($this->getColumns() as $column) { if ($column->getOption('is_related')) { $this->relatedColumns[$column->getOption('column_name')] = $column...
php
public function getRelatedColumns() { //make sure we only run this once and then return the cached version if (!sizeof($this->relatedColumns)) { foreach ($this->getColumns() as $column) { if ($column->getOption('is_related')) { $this->relatedColumns[$column->getOption('column_name')] = $column...
[ "public", "function", "getRelatedColumns", "(", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "relatedColumns", ")", ")", "{", "foreach", "(", "$", "this", "->", "getColumns", "(",...
Gets the columns that are relationship columns @return array
[ "Gets", "the", "columns", "that", "are", "relationship", "columns" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/DataTable/Columns/Factory.php#L292-L307
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/DataTable/Columns/Factory.php
Factory.getComputedColumns
public function getComputedColumns() { //make sure we only run this once and then return the cached version if (!sizeof($this->computedColumns)) { foreach ($this->getColumns() as $column) { if (!$column->getOption('is_related') && $column->getOption('is_computed')) { $this->computedColumns[$co...
php
public function getComputedColumns() { //make sure we only run this once and then return the cached version if (!sizeof($this->computedColumns)) { foreach ($this->getColumns() as $column) { if (!$column->getOption('is_related') && $column->getOption('is_computed')) { $this->computedColumns[$co...
[ "public", "function", "getComputedColumns", "(", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "computedColumns", ")", ")", "{", "foreach", "(", "$", "this", "->", "getColumns", "(...
Gets the columns that are computed @return array
[ "Gets", "the", "columns", "that", "are", "computed" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/DataTable/Columns/Factory.php#L314-L329
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Includes/Multup.php
Multup.open
public static function open($input, $rules, $path, $random = true) { return new Multup( $input, $rules, $path, $random ); }
php
public static function open($input, $rules, $path, $random = true) { return new Multup( $input, $rules, $path, $random ); }
[ "public", "static", "function", "open", "(", "$", "input", ",", "$", "rules", ",", "$", "path", ",", "$", "random", "=", "true", ")", "{", "return", "new", "Multup", "(", "$", "input", ",", "$", "rules", ",", "$", "path", ",", "$", "random", ")",...
Static call, Laravel style. Returns a new Multup object, allowing for chainable calls @param string $input name of the file to upload @param string $rules laravel style validation rules string @param string $path relative to /public/ to move the images if valid @param bool $random Whether or not to randomize the fi...
[ "Static", "call", "Laravel", "style", ".", "Returns", "a", "new", "Multup", "object", "allowing", "for", "chainable", "calls" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Includes/Multup.php#L96-L99
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Includes/Multup.php
Multup.upload
public function upload() { $this->image = array($this->input => Input::file($this->input)); $result = array(); $result[] = $this->post_upload_process($this->upload_image()); return $result; if ($image) { $this->image = array( $this->input => array( 'name' => $image->getClientOriginalNa...
php
public function upload() { $this->image = array($this->input => Input::file($this->input)); $result = array(); $result[] = $this->post_upload_process($this->upload_image()); return $result; if ($image) { $this->image = array( $this->input => array( 'name' => $image->getClientOriginalNa...
[ "public", "function", "upload", "(", ")", "{", "$", "this", "->", "image", "=", "array", "(", "$", "this", "->", "input", "=>", "Input", "::", "file", "(", "$", "this", "->", "input", ")", ")", ";", "$", "result", "=", "array", "(", ")", ";", "...
/* Upload the image @return array of results each result will be an array() with keys: errors array -> empty if saved properly, otherwise $validation->errors object path string -> full URL to the file if saved, empty if not saved filename string -> name of the saved file or file that could not be uploaded
[ "/", "*", "Upload", "the", "image", "@return", "array", "of", "results", "each", "result", "will", "be", "an", "array", "()", "with", "keys", ":", "errors", "array", "-", ">", "empty", "if", "saved", "properly", "otherwise", "$validation", "-", ">", "err...
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Includes/Multup.php#L121-L175
FrozenNode/Laravel-Administrator
src/controllers/AdminController.php
AdminController.customModelAction
public function customModelAction($modelName) { $config = app('itemconfig'); $actionFactory = app('admin_action_factory'); $actionName = $this->request->input('action_name', false); $dataTable = app('admin_datatable'); //get the sort options and filters $page = $this->request->input('page', 1); $sortOpt...
php
public function customModelAction($modelName) { $config = app('itemconfig'); $actionFactory = app('admin_action_factory'); $actionName = $this->request->input('action_name', false); $dataTable = app('admin_datatable'); //get the sort options and filters $page = $this->request->input('page', 1); $sortOpt...
[ "public", "function", "customModelAction", "(", "$", "modelName", ")", "{", "$", "config", "=", "app", "(", "'itemconfig'", ")", ";", "$", "actionFactory", "=", "app", "(", "'admin_action_factory'", ")", ";", "$", "actionName", "=", "$", "this", "->", "req...
POST method for handling custom model actions @param string $modelName @return JSON
[ "POST", "method", "for", "handling", "custom", "model", "actions" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/controllers/AdminController.php#L214-L266
FrozenNode/Laravel-Administrator
src/controllers/AdminController.php
AdminController.displayFile
public function displayFile() { //get the stored path of the original $path = $this->request->input('path'); $data = File::get($path); $file = new SFile($path); $headers = array( 'Content-Type' => $file->getMimeType(), 'Content-Length' => $file->getSize(), 'Content-Disposition' => 'attachment; file...
php
public function displayFile() { //get the stored path of the original $path = $this->request->input('path'); $data = File::get($path); $file = new SFile($path); $headers = array( 'Content-Type' => $file->getMimeType(), 'Content-Length' => $file->getSize(), 'Content-Disposition' => 'attachment; file...
[ "public", "function", "displayFile", "(", ")", "{", "//get the stored path of the original", "$", "path", "=", "$", "this", "->", "request", "->", "input", "(", "'path'", ")", ";", "$", "data", "=", "File", "::", "get", "(", "$", "path", ")", ";", "$", ...
The GET method that displays a file field's file @return Image / File
[ "The", "GET", "method", "that", "displays", "a", "file", "field", "s", "file" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/controllers/AdminController.php#L430-L444
FrozenNode/Laravel-Administrator
src/controllers/AdminController.php
AdminController.resolveDynamicFormRequestErrors
protected function resolveDynamicFormRequestErrors(Request $request) { try { $config = app('itemconfig'); $fieldFactory = app('admin_field_factory'); } catch (\ReflectionException $e) { return null; } if (array_key_exists('form_request', $config->getOptions())) { try { $model = $config->getFill...
php
protected function resolveDynamicFormRequestErrors(Request $request) { try { $config = app('itemconfig'); $fieldFactory = app('admin_field_factory'); } catch (\ReflectionException $e) { return null; } if (array_key_exists('form_request', $config->getOptions())) { try { $model = $config->getFill...
[ "protected", "function", "resolveDynamicFormRequestErrors", "(", "Request", "$", "request", ")", "{", "try", "{", "$", "config", "=", "app", "(", "'itemconfig'", ")", ";", "$", "fieldFactory", "=", "app", "(", "'admin_field_factory'", ")", ";", "}", "catch", ...
POST method to capture any form request errors @param \Illuminate\Http\Request $request
[ "POST", "method", "to", "capture", "any", "form", "request", "errors" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/controllers/AdminController.php#L641-L669
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Actions/Factory.php
Factory.getGlobalActions
public function getGlobalActions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->globalActions) || $override) { $this->globalActions = array(); //loop over the actions to build the list foreach ($this->config->getOption('global_actions') as $...
php
public function getGlobalActions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->globalActions) || $override) { $this->globalActions = array(); //loop over the actions to build the list foreach ($this->config->getOption('global_actions') as $...
[ "public", "function", "getGlobalActions", "(", "$", "override", "=", "false", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "globalActions", ")", "||", "$", "override", ")", "{", ...
Gets all global actions @param bool $override @return array of Action objects
[ "Gets", "all", "global", "actions" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Actions/Factory.php#L222-L237
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Actions/Factory.php
Factory.getGlobalActionsOptions
public function getGlobalActionsOptions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->globalActionsOptions) || $override) { $this->globalActionsOptions = array(); //loop over the global actions to build the list foreach ($this->getGlobalAct...
php
public function getGlobalActionsOptions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->globalActionsOptions) || $override) { $this->globalActionsOptions = array(); //loop over the global actions to build the list foreach ($this->getGlobalAct...
[ "public", "function", "getGlobalActionsOptions", "(", "$", "override", "=", "false", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "globalActionsOptions", ")", "||", "$", "override", ...
Gets all actions as arrays of options @param bool $override @return array of Action options
[ "Gets", "all", "actions", "as", "arrays", "of", "options" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Actions/Factory.php#L246-L261
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Actions/Factory.php
Factory.getActionPermissions
public function getActionPermissions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->actionPermissions) || $override) { $this->actionPermissions = array(); $model = $this->config->getDataModel(); $options = $this->config->getOption('action_per...
php
public function getActionPermissions($override = false) { //make sure we only run this once and then return the cached version if (!sizeof($this->actionPermissions) || $override) { $this->actionPermissions = array(); $model = $this->config->getDataModel(); $options = $this->config->getOption('action_per...
[ "public", "function", "getActionPermissions", "(", "$", "override", "=", "false", ")", "{", "//make sure we only run this once and then return the cached version", "if", "(", "!", "sizeof", "(", "$", "this", "->", "actionPermissions", ")", "||", "$", "override", ")", ...
Gets all action permissions @param bool $override @return array of Action objects
[ "Gets", "all", "action", "permissions" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Actions/Factory.php#L270-L298
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Relationships/BelongsToMany.php
BelongsToMany.constrainQuery
public function constrainQuery(EloquentBuilder &$query, $relatedModel, $constraint) { //if the column hasn't been joined yet, join it if (!$this->validator->isJoined($query, $this->getOption('table'))) { $query->join($this->getOption('table'), $relatedModel->getTable().'.'.$relatedModel->getKeyName(), '=', $t...
php
public function constrainQuery(EloquentBuilder &$query, $relatedModel, $constraint) { //if the column hasn't been joined yet, join it if (!$this->validator->isJoined($query, $this->getOption('table'))) { $query->join($this->getOption('table'), $relatedModel->getTable().'.'.$relatedModel->getKeyName(), '=', $t...
[ "public", "function", "constrainQuery", "(", "EloquentBuilder", "&", "$", "query", ",", "$", "relatedModel", ",", "$", "constraint", ")", "{", "//if the column hasn't been joined yet, join it", "if", "(", "!", "$", "this", "->", "validator", "->", "isJoined", "(",...
Constrains a query by a given set of constraints @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Model $relatedModel @param string $constraint @return void
[ "Constrains", "a", "query", "by", "a", "given", "set", "of", "constraints" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Relationships/BelongsToMany.php#L133-L142
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Time.php
Time.getDateString
public function getDateString(DateTime $time) { if ($this->getOption('type') === 'date') { return $time->format('Y-m-d'); } else if ($this->getOption('type') === 'datetime') { return $time->format('Y-m-d H:i:s'); } else { return $time->format('H:i:s'); } }
php
public function getDateString(DateTime $time) { if ($this->getOption('type') === 'date') { return $time->format('Y-m-d'); } else if ($this->getOption('type') === 'datetime') { return $time->format('Y-m-d H:i:s'); } else { return $time->format('H:i:s'); } }
[ "public", "function", "getDateString", "(", "DateTime", "$", "time", ")", "{", "if", "(", "$", "this", "->", "getOption", "(", "'type'", ")", "===", "'date'", ")", "{", "return", "$", "time", "->", "format", "(", "'Y-m-d'", ")", ";", "}", "else", "if...
Get a date format from a time depending on the type of time field this is @param int $time @return string
[ "Get", "a", "date", "format", "from", "a", "time", "depending", "on", "the", "type", "of", "time", "field", "this", "is" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Time.php#L99-L113
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Config/Model/Config.php
Config.getDataModel
public function getDataModel() { if (!$this->model) { $name = $this->getOption('model'); $this->model = new $name; } return $this->model; }
php
public function getDataModel() { if (!$this->model) { $name = $this->getOption('model'); $this->model = new $name; } return $this->model; }
[ "public", "function", "getDataModel", "(", ")", "{", "if", "(", "!", "$", "this", "->", "model", ")", "{", "$", "name", "=", "$", "this", "->", "getOption", "(", "'model'", ")", ";", "$", "this", "->", "model", "=", "new", "$", "name", ";", "}", ...
Fetches the data model for a config @return \Illuminate\Database\Eloquent\Model
[ "Fetches", "the", "data", "model", "for", "a", "config" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Config/Model/Config.php#L82-L91
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Config/Model/Config.php
Config.getRelationshipInputs
protected function getRelationshipInputs(\Illuminate\Http\Request $request, array $fields) { $inputs = array(); //run through the edit fields to find the relationships foreach ($fields as $name => $field) { if ($field->getOption('external')) { $inputs[$name] = $this->formatRelationshipInput($request...
php
protected function getRelationshipInputs(\Illuminate\Http\Request $request, array $fields) { $inputs = array(); //run through the edit fields to find the relationships foreach ($fields as $name => $field) { if ($field->getOption('external')) { $inputs[$name] = $this->formatRelationshipInput($request...
[ "protected", "function", "getRelationshipInputs", "(", "\\", "Illuminate", "\\", "Http", "\\", "Request", "$", "request", ",", "array", "$", "fields", ")", "{", "$", "inputs", "=", "array", "(", ")", ";", "//run through the edit fields to find the relationships", ...
Gets the relationship inputs @param \Illuminate\Http\Request $request @param array $fields @return array
[ "Gets", "the", "relationship", "inputs" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Config/Model/Config.php#L459-L473
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.validateOptions
public function validateOptions($name, $options) { if (is_string($options)) { $name = $options; $options = array(); } //if the name is not a string or the options is not an array at this point, throw an error because we can't do anything with it if (!is_string($name) || !is_array($options)) { thr...
php
public function validateOptions($name, $options) { if (is_string($options)) { $name = $options; $options = array(); } //if the name is not a string or the options is not an array at this point, throw an error because we can't do anything with it if (!is_string($name) || !is_array($options)) { thr...
[ "public", "function", "validateOptions", "(", "$", "name", ",", "$", "options", ")", "{", "if", "(", "is_string", "(", "$", "options", ")", ")", "{", "$", "name", "=", "$", "options", ";", "$", "options", "=", "array", "(", ")", ";", "}", "//if the...
Validates an options array item. This could be a string $name and array $options, or a positive integer $name and string $options. @param mixed $name @param mixed $options @return array
[ "Validates", "an", "options", "array", "item", ".", "This", "could", "be", "a", "string", "$name", "and", "array", "$options", "or", "a", "positive", "integer", "$name", "and", "string", "$options", "." ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L202-L220
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.getRelationshipKey
public function getRelationshipKey($field) { $model = $this->config->getDataModel(); $invalidArgument = new \InvalidArgumentException("The '" . $field . "' relationship field you supplied for " . $this->config->getOption('name') . " is not a valid relationship method name on the supplied Eloquent model"); ...
php
public function getRelationshipKey($field) { $model = $this->config->getDataModel(); $invalidArgument = new \InvalidArgumentException("The '" . $field . "' relationship field you supplied for " . $this->config->getOption('name') . " is not a valid relationship method name on the supplied Eloquent model"); ...
[ "public", "function", "getRelationshipKey", "(", "$", "field", ")", "{", "$", "model", "=", "$", "this", "->", "config", "->", "getDataModel", "(", ")", ";", "$", "invalidArgument", "=", "new", "\\", "InvalidArgumentException", "(", "\"The '\"", ".", "$", ...
Given a field name, returns the type key or false @param string $field the field type to check @return string|false
[ "Given", "a", "field", "name", "returns", "the", "type", "key", "or", "false" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L298-L334
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.findField
public function findField($field) { $fields = $this->getEditFields(); //return either the Field object or throw an InvalidArgumentException if (!isset($fields[$field])) { throw new \InvalidArgumentException("The " . $field . " field does not exist on the " . $this->config->getOption('name') . " model"); ...
php
public function findField($field) { $fields = $this->getEditFields(); //return either the Field object or throw an InvalidArgumentException if (!isset($fields[$field])) { throw new \InvalidArgumentException("The " . $field . " field does not exist on the " . $this->config->getOption('name') . " model"); ...
[ "public", "function", "findField", "(", "$", "field", ")", "{", "$", "fields", "=", "$", "this", "->", "getEditFields", "(", ")", ";", "//return either the Field object or throw an InvalidArgumentException", "if", "(", "!", "isset", "(", "$", "fields", "[", "$",...
Given a field name, this returns the field object from the edit fields array @param string $field @return \Frozennode\Administrator\Fields\Field
[ "Given", "a", "field", "name", "this", "returns", "the", "field", "object", "from", "the", "edit", "fields", "array" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L343-L354
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.findFilter
public function findFilter($field) { $filters = $this->getFilters(); //return either the Field object or throw an InvalidArgumentException if (!isset($filters[$field])) { throw new \InvalidArgumentException("The " . $field . " filter does not exist on the " . $this->config->getOption('name') . " model"); ...
php
public function findFilter($field) { $filters = $this->getFilters(); //return either the Field object or throw an InvalidArgumentException if (!isset($filters[$field])) { throw new \InvalidArgumentException("The " . $field . " filter does not exist on the " . $this->config->getOption('name') . " model"); ...
[ "public", "function", "findFilter", "(", "$", "field", ")", "{", "$", "filters", "=", "$", "this", "->", "getFilters", "(", ")", ";", "//return either the Field object or throw an InvalidArgumentException", "if", "(", "!", "isset", "(", "$", "filters", "[", "$",...
Given a field name, this returns the field object from the filters array @param string $field @return \Frozennode\Administrator\Fields\Field
[ "Given", "a", "field", "name", "this", "returns", "the", "field", "object", "from", "the", "filters", "array" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L363-L374
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.getEditFields
public function getEditFields($loadRelationships = true, $override = false) { if (!sizeof($this->editFields) || $override) { $this->editFields = array(); //iterate over each supplied edit field foreach ($this->config->getOption('edit_fields') as $name => $options) { $fieldObject = $this->make($nam...
php
public function getEditFields($loadRelationships = true, $override = false) { if (!sizeof($this->editFields) || $override) { $this->editFields = array(); //iterate over each supplied edit field foreach ($this->config->getOption('edit_fields') as $name => $options) { $fieldObject = $this->make($nam...
[ "public", "function", "getEditFields", "(", "$", "loadRelationships", "=", "true", ",", "$", "override", "=", "false", ")", "{", "if", "(", "!", "sizeof", "(", "$", "this", "->", "editFields", ")", "||", "$", "override", ")", "{", "$", "this", "->", ...
Creates the edit fields as Field objects @param boolean $loadRelationships //if set to false, no relationship options will be loaded @param boolean $override //if set to true, the fields will be re-loaded, otherwise it will use the cached fields @return array
[ "Creates", "the", "edit", "fields", "as", "Field", "objects" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L384-L399
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/Fields/Factory.php
Factory.applyConstraints
public function applyConstraints($constraints, EloquentBuilder &$query, Field $fieldObject) { $configConstraints = $fieldObject->getOption('constraints'); if (sizeof($configConstraints)) { //iterate over the config constraints foreach ($configConstraints as $key => $relationshipName) { //now that w...
php
public function applyConstraints($constraints, EloquentBuilder &$query, Field $fieldObject) { $configConstraints = $fieldObject->getOption('constraints'); if (sizeof($configConstraints)) { //iterate over the config constraints foreach ($configConstraints as $key => $relationshipName) { //now that w...
[ "public", "function", "applyConstraints", "(", "$", "constraints", ",", "EloquentBuilder", "&", "$", "query", ",", "Field", "$", "fieldObject", ")", "{", "$", "configConstraints", "=", "$", "fieldObject", "->", "getOption", "(", "'constraints'", ")", ";", "if"...
Takes the supplied $selectedItems mixed value and formats it to a usable array @param mixed $constraints @param \Illuminate\Database\Query\Builder $query @param \Frozennode\Administrator\Fields\Field $fieldObject @return array
[ "Takes", "the", "supplied", "$selectedItems", "mixed", "value", "and", "formats", "it", "to", "a", "usable", "array" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/Fields/Factory.php#L712-L741
FrozenNode/Laravel-Administrator
src/Frozennode/Administrator/DataTable/Columns/Relationships/BelongsTo.php
BelongsTo.filterQuery
public function filterQuery(&$selects) { $model = $this->config->getDataModel(); $joins = $where = ''; $columnName = $this->getOption('column_name'); $nested = $this->getOption('nested'); $num_pieces = sizeof($nested['pieces']); //if there is more than one nested relationship, we need to join all the tabl...
php
public function filterQuery(&$selects) { $model = $this->config->getDataModel(); $joins = $where = ''; $columnName = $this->getOption('column_name'); $nested = $this->getOption('nested'); $num_pieces = sizeof($nested['pieces']); //if there is more than one nested relationship, we need to join all the tabl...
[ "public", "function", "filterQuery", "(", "&", "$", "selects", ")", "{", "$", "model", "=", "$", "this", "->", "config", "->", "getDataModel", "(", ")", ";", "$", "joins", "=", "$", "where", "=", "''", ";", "$", "columnName", "=", "$", "this", "->"...
Adds selects to a query @param array $selects @return void
[ "Adds", "selects", "to", "a", "query" ]
train
https://github.com/FrozenNode/Laravel-Administrator/blob/34d604c2029ce2b11f93599baf4ec909501fd356/src/Frozennode/Administrator/DataTable/Columns/Relationships/BelongsTo.php#L92-L131