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
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.firstWhere
public function firstWhere($key, $operator, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->filterWhere($key, $operator, $value); }
php
public function firstWhere($key, $operator, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->filterWhere($key, $operator, $value); }
[ "public", "function", "firstWhere", "(", "$", "key", ",", "$", "operator", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "retur...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L324-L331
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.where
public function where($key, $operator, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->where($key, $operator, $value); }
php
public function where($key, $operator, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->where($key, $operator, $value); }
[ "public", "function", "where", "(", "$", "key", ",", "$", "operator", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L336-L343
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.whereNotIn
public function whereNotIn($key, $values, $strict = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereNotIn($key, $values, $strict); }
php
public function whereNotIn($key, $values, $strict = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereNotIn($key, $values, $strict); }
[ "public", "function", "whereNotIn", "(", "$", "key", ",", "$", "values", ",", "$", "strict", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "retur...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L358-L365
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.whereStrict
public function whereStrict($key, $value) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereStrict($key, $value); }
php
public function whereStrict($key, $value) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereStrict($key, $value); }
[ "public", "function", "whereStrict", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "whereStric...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L370-L377
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.whereInStrict
public function whereInStrict($key, $values) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereInStrict($key, $values); }
php
public function whereInStrict($key, $values) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->whereInStrict($key, $values); }
[ "public", "function", "whereInStrict", "(", "$", "key", ",", "$", "values", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "whereIn...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L394-L401
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.flatten
public function flatten($depth = INF) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->flatten($depth); }
php
public function flatten($depth = INF) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->flatten($depth); }
[ "public", "function", "flatten", "(", "$", "depth", "=", "INF", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "flatten", "(", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L417-L424
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.groupBy
public function groupBy($groupBy, $preserveKeys = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->groupBy($groupBy, $preserveKeys); }
php
public function groupBy($groupBy, $preserveKeys = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->groupBy($groupBy, $preserveKeys); }
[ "public", "function", "groupBy", "(", "$", "groupBy", ",", "$", "preserveKeys", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "paren...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L466-L473
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.keyBy
public function keyBy($keyBy) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->keyBy($keyBy); }
php
public function keyBy($keyBy) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->keyBy($keyBy); }
[ "public", "function", "keyBy", "(", "$", "keyBy", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "keyBy", "(", "$", "keyBy", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L478-L485
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.implode
public function implode($value, $glue = null) { $this->initializeProxy(); return parent::implode($value, $glue); }
php
public function implode($value, $glue = null) { $this->initializeProxy(); return parent::implode($value, $glue); }
[ "public", "function", "implode", "(", "$", "value", ",", "$", "glue", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "return", "parent", "::", "implode", "(", "$", "value", ",", "$", "glue", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L505-L510
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.intersect
public function intersect($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->intersect($items); }
php
public function intersect($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->intersect($items); }
[ "public", "function", "intersect", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "intersect", "(", "$", "items"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L515-L522
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.pluck
public function pluck($value, $key = null) { // TODO : automagic call to QB if not initialized $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->pluck($value, $key); }
php
public function pluck($value, $key = null) { // TODO : automagic call to QB if not initialized $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->pluck($value, $key); }
[ "public", "function", "pluck", "(", "$", "value", ",", "$", "key", "=", "null", ")", "{", "// TODO : automagic call to QB if not initialized", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L570-L578
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.map
public function map(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->map($callback); }
php
public function map(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->map($callback); }
[ "public", "function", "map", "(", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "map", "(", "$", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L583-L590
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.mapToDictionary
public function mapToDictionary(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->mapWithKeys($callback); }
php
public function mapToDictionary(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->mapWithKeys($callback); }
[ "public", "function", "mapToDictionary", "(", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "mapWithKeys"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L619-L626
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.flatMap
public function flatMap(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->flatMap($callback); }
php
public function flatMap(callable $callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->flatMap($callback); }
[ "public", "function", "flatMap", "(", "callable", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "flatMap", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L631-L638
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.merge
public function merge($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->merge($items); }
php
public function merge($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->merge($items); }
[ "public", "function", "merge", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "merge", "(", "$", "items", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L653-L660
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.pad
public function pad($size, $value) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent($size, $value); }
php
public function pad($size, $value) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent($size, $value); }
[ "public", "function", "pad", "(", "$", "size", ",", "$", "value", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "(", "$", "size", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L665-L672
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.combine
public function combine($values) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->combine($values); }
php
public function combine($values) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->combine($values); }
[ "public", "function", "combine", "(", "$", "values", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "combine", "(", "$", "values", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L677-L684
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.times
public static function times($amount, callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->times($amount, $callback); }
php
public static function times($amount, callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->times($amount, $callback); }
[ "public", "static", "function", "times", "(", "$", "amount", ",", "callable", "$", "callback", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L689-L696
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.crossJoin
public function crossJoin(...$lists) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->times(func_num_args()); }
php
public function crossJoin(...$lists) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->times(func_num_args()); }
[ "public", "function", "crossJoin", "(", "...", "$", "lists", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "times", "(", "func_num...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L701-L708
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.diffAssoc
public function diffAssoc($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffAssoc($items); }
php
public function diffAssoc($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->diffAssoc($items); }
[ "public", "function", "diffAssoc", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "diffAssoc", "(", "$", "items"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L713-L720
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.intersectKey
public function intersectKey($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->intersectKey($items); }
php
public function intersectKey($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->intersectKey($items); }
[ "public", "function", "intersectKey", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "intersectKey", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L725-L732
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.union
public function union($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->union($items); }
php
public function union($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->union($items); }
[ "public", "function", "union", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "union", "(", "$", "items", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L737-L744
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.nth
public function nth($step, $offset = 0) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->nth($step, $offset); }
php
public function nth($step, $offset = 0) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->nth($step, $offset); }
[ "public", "function", "nth", "(", "$", "step", ",", "$", "offset", "=", "0", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "nt...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L762-L769
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.only
public function only($keys) { // TODO : we could rely on the QB if // the collection hasn't been initialized yet $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->only($keys); }
php
public function only($keys) { // TODO : we could rely on the QB if // the collection hasn't been initialized yet $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->only($keys); }
[ "public", "function", "only", "(", "$", "keys", ")", "{", "// TODO : we could rely on the QB if", "// the collection hasn't been initialized yet", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L774-L783
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.forPage
public function forPage($page, $perPage) { // TODO : check possibility of partial loading // if not initialized $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->forPage($page, $perPage); }
php
public function forPage($page, $perPage) { // TODO : check possibility of partial loading // if not initialized $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->forPage($page, $perPage); }
[ "public", "function", "forPage", "(", "$", "page", ",", "$", "perPage", ")", "{", "// TODO : check possibility of partial loading", "// if not initialized", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollecti...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L788-L797
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.partition
public function partition($callback, $operator = null, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: return $parent->partition($callback); case 2: return $parent->pa...
php
public function partition($callback, $operator = null, $value = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: return $parent->partition($callback); case 2: return $parent->pa...
[ "public", "function", "partition", "(", "$", "callback", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L802-L816
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.prepend
public function prepend($value, $key = null) { if (!$this->relationshipLoaded) { $key ? $this->prependedItems[$key] = $value : $this->prependedItems[] = $value; return $this; } return parent::prepend($value, $key); }
php
public function prepend($value, $key = null) { if (!$this->relationshipLoaded) { $key ? $this->prependedItems[$key] = $value : $this->prependedItems[] = $value; return $this; } return parent::prepend($value, $key); }
[ "public", "function", "prepend", "(", "$", "value", ",", "$", "key", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "relationshipLoaded", ")", "{", "$", "key", "?", "$", "this", "->", "prependedItems", "[", "$", "key", "]", "=", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L841-L852
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.push
public function push($value) { if (!$this->relationshipLoaded) { $this->pushedItems[] = $value; return $this; } return parent::push($value); }
php
public function push($value) { if (!$this->relationshipLoaded) { $this->pushedItems[] = $value; return $this; } return parent::push($value); }
[ "public", "function", "push", "(", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "relationshipLoaded", ")", "{", "$", "this", "->", "pushedItems", "[", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}", "return", "parent", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L857-L866
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.reduce
public function reduce(callable $callback, $initial = null) { $this->initializeProxy(); return parent::reduce($callback, $initial); }
php
public function reduce(callable $callback, $initial = null) { $this->initializeProxy(); return parent::reduce($callback, $initial); }
[ "public", "function", "reduce", "(", "callable", "$", "callback", ",", "$", "initial", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "return", "parent", "::", "reduce", "(", "$", "callback", ",", "$", "initial", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L910-L915
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.reject
public function reject($callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->reject($callback); }
php
public function reject($callback) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->reject($callback); }
[ "public", "function", "reject", "(", "$", "callback", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "reject", "(", "$", "callback"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L920-L927
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.search
public function search($value, $strict = false) { $this->initializeProxy(); return parent::search($value, $strict); }
php
public function search($value, $strict = false) { $this->initializeProxy(); return parent::search($value, $strict); }
[ "public", "function", "search", "(", "$", "value", ",", "$", "strict", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "return", "parent", "::", "search", "(", "$", "value", ",", "$", "strict", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L944-L949
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.shuffle
public function shuffle($seed = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->shuffle($seed); }
php
public function shuffle($seed = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->shuffle($seed); }
[ "public", "function", "shuffle", "(", "$", "seed", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "shuffle", "(", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L966-L973
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.slice
public function slice($offset, $length = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->slice($offset, $length); }
php
public function slice($offset, $length = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->slice($offset, $length); }
[ "public", "function", "slice", "(", "$", "offset", ",", "$", "length", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L978-L985
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.split
public function split($numberOfGroups) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->split($numberOfGroups); }
php
public function split($numberOfGroups) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->split($numberOfGroups); }
[ "public", "function", "split", "(", "$", "numberOfGroups", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "split", "(", "$", "numbe...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L990-L997
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.chunk
public function chunk($size) { // TODO : partial loading ? $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->chunk($size); }
php
public function chunk($size) { // TODO : partial loading ? $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->chunk($size); }
[ "public", "function", "chunk", "(", "$", "size", ")", "{", "// TODO : partial loading ?", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "chunk",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1002-L1010
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.sort
public function sort(callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sort($callback); }
php
public function sort(callable $callback = null) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sort($callback); }
[ "public", "function", "sort", "(", "callable", "$", "callback", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "sort",...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1015-L1022
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.sortBy
public function sortBy($callback, $options = SORT_REGULAR, $descending = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sortBy($callback, $options, $descending); }
php
public function sortBy($callback, $options = SORT_REGULAR, $descending = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sortBy($callback, $options, $descending); }
[ "public", "function", "sortBy", "(", "$", "callback", ",", "$", "options", "=", "SORT_REGULAR", ",", "$", "descending", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection"...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1027-L1034
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.sortKeys
public function sortKeys($options = SORT_REGULAR, $descending = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sortKeys($options, $descending); }
php
public function sortKeys($options = SORT_REGULAR, $descending = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->sortKeys($options, $descending); }
[ "public", "function", "sortKeys", "(", "$", "options", "=", "SORT_REGULAR", ",", "$", "descending", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1039-L1046
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.splice
public function splice($offset, $length = null, $replacement = []) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: $parent->splice($offset); break; case 2: $parent->s...
php
public function splice($offset, $length = null, $replacement = []) { $this->initializeProxy(); $parent = $this->toBaseCollection(); switch (func_num_args()) { case 1: $parent->splice($offset); break; case 2: $parent->s...
[ "public", "function", "splice", "(", "$", "offset", ",", "$", "length", "=", "null", ",", "$", "replacement", "=", "[", "]", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1051-L1068
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.take
public function take($limit) { // TODO: partial loading $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->take($limit); }
php
public function take($limit) { // TODO: partial loading $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->take($limit); }
[ "public", "function", "take", "(", "$", "limit", ")", "{", "// TODO: partial loading", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "take", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1083-L1091
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.unique
public function unique($key = null, $strict = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->unique($key, $strict); }
php
public function unique($key = null, $strict = false) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->unique($key, $strict); }
[ "public", "function", "unique", "(", "$", "key", "=", "null", ",", "$", "strict", "=", "false", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1116-L1123
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.when
public function when($value, callable $callback, callable $default = null) { $this->initializeProxy(); return parent::when($value, $callback); }
php
public function when($value, callable $callback, callable $default = null) { $this->initializeProxy(); return parent::when($value, $callback); }
[ "public", "function", "when", "(", "$", "value", ",", "callable", "$", "callback", ",", "callable", "$", "default", "=", "null", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "return", "parent", "::", "when", "(", "$", "value", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1140-L1145
analogueorm/analogue
src/System/Proxies/CollectionProxy.php
CollectionProxy.zip
public function zip($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->zip($items); }
php
public function zip($items) { $this->initializeProxy(); $parent = $this->toBaseCollection(); return $parent->zip($items); }
[ "public", "function", "zip", "(", "$", "items", ")", "{", "$", "this", "->", "initializeProxy", "(", ")", ";", "$", "parent", "=", "$", "this", "->", "toBaseCollection", "(", ")", ";", "return", "$", "parent", "->", "zip", "(", "$", "items", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Proxies/CollectionProxy.php#L1150-L1157
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.addConstraints
public function addConstraints() { $parentTable = $this->parentMap->getTable(); $this->setJoin(); if (static::$constraints) { $farParentKeyName = $this->farParentMap->getKeyName(); $this->query->where( $parentTable.'.'.$this->firstKey, ...
php
public function addConstraints() { $parentTable = $this->parentMap->getTable(); $this->setJoin(); if (static::$constraints) { $farParentKeyName = $this->farParentMap->getKeyName(); $this->query->where( $parentTable.'.'.$this->firstKey, ...
[ "public", "function", "addConstraints", "(", ")", "{", "$", "parentTable", "=", "$", "this", "->", "parentMap", "->", "getTable", "(", ")", ";", "$", "this", "->", "setJoin", "(", ")", ";", "if", "(", "static", "::", "$", "constraints", ")", "{", "$"...
Set the base constraints on the relation query. @return void
[ "Set", "the", "base", "constraints", "on", "the", "relation", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L69-L84
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.getRelationCountQuery
public function getRelationCountQuery(Query $query, Query $parent) { $parentTable = $this->parentMap->getTable(); $this->setJoin($query); $query->select(new Expression('count(*)')); $key = $this->wrap($parentTable.'.'.$this->firstKey); return $query->where($this->getHasCo...
php
public function getRelationCountQuery(Query $query, Query $parent) { $parentTable = $this->parentMap->getTable(); $this->setJoin($query); $query->select(new Expression('count(*)')); $key = $this->wrap($parentTable.'.'.$this->firstKey); return $query->where($this->getHasCo...
[ "public", "function", "getRelationCountQuery", "(", "Query", "$", "query", ",", "Query", "$", "parent", ")", "{", "$", "parentTable", "=", "$", "this", "->", "parentMap", "->", "getTable", "(", ")", ";", "$", "this", "->", "setJoin", "(", "$", "query", ...
Add the constraints for a relationship count query. @param Query $query @param Query $parent @return Query
[ "Add", "the", "constraints", "for", "a", "relationship", "count", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L94-L105
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.setJoin
protected function setJoin(Query $query = null) { $query = $query ?: $this->query; $foreignKey = $this->relatedMap->getTable().'.'.$this->secondKey; $query->join($this->parentMap->getTable(), $this->getQualifiedParentKeyName(), '=', $foreignKey); }
php
protected function setJoin(Query $query = null) { $query = $query ?: $this->query; $foreignKey = $this->relatedMap->getTable().'.'.$this->secondKey; $query->join($this->parentMap->getTable(), $this->getQualifiedParentKeyName(), '=', $foreignKey); }
[ "protected", "function", "setJoin", "(", "Query", "$", "query", "=", "null", ")", "{", "$", "query", "=", "$", "query", "?", ":", "$", "this", "->", "query", ";", "$", "foreignKey", "=", "$", "this", "->", "relatedMap", "->", "getTable", "(", ")", ...
Set the join clause on the query. @param null|Query $query @return void
[ "Set", "the", "join", "clause", "on", "the", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L114-L121
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.addEagerConstraints
public function addEagerConstraints(array $results) { $table = $this->parentMap->getTable(); $this->query->whereIn($table.'.'.$this->firstKey, $this->getKeysFromResults($results)); }
php
public function addEagerConstraints(array $results) { $table = $this->parentMap->getTable(); $this->query->whereIn($table.'.'.$this->firstKey, $this->getKeysFromResults($results)); }
[ "public", "function", "addEagerConstraints", "(", "array", "$", "results", ")", "{", "$", "table", "=", "$", "this", "->", "parentMap", "->", "getTable", "(", ")", ";", "$", "this", "->", "query", "->", "whereIn", "(", "$", "table", ".", "'.'", ".", ...
Set the constraints for an eager load of the relation. @param array $results @return void
[ "Set", "the", "constraints", "for", "an", "eager", "load", "of", "the", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L130-L135
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.get
public function get($columns = ['*']): Collection { // First we'll add the proper select columns onto the query so it is run with // the proper columns. Then, we will get the results and hydrate out pivot // entities with the result of those columns as a separate model relation. $sel...
php
public function get($columns = ['*']): Collection { // First we'll add the proper select columns onto the query so it is run with // the proper columns. Then, we will get the results and hydrate out pivot // entities with the result of those columns as a separate model relation. $sel...
[ "public", "function", "get", "(", "$", "columns", "=", "[", "'*'", "]", ")", ":", "Collection", "{", "// First we'll add the proper select columns onto the query so it is run with", "// the proper columns. Then, we will get the results and hydrate out pivot", "// entities with the re...
Execute the query as a "select" statement. @param array $columns @return EntityCollection
[ "Execute", "the", "query", "as", "a", "select", "statement", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L221-L238
analogueorm/analogue
src/Relationships/HasManyThrough.php
HasManyThrough.getSelectColumns
protected function getSelectColumns(array $columns = ['*']) { if ($columns == ['*']) { $columns = [$this->relatedMap->getTable().'.*']; } return array_merge($columns, [$this->parentMap->getTable().'.'.$this->firstKey]); }
php
protected function getSelectColumns(array $columns = ['*']) { if ($columns == ['*']) { $columns = [$this->relatedMap->getTable().'.*']; } return array_merge($columns, [$this->parentMap->getTable().'.'.$this->firstKey]); }
[ "protected", "function", "getSelectColumns", "(", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "$", "columns", "==", "[", "'*'", "]", ")", "{", "$", "columns", "=", "[", "$", "this", "->", "relatedMap", "->", "getTable", "(", ...
Set the select clause for the relation query. @param array $columns @return BelongsToMany
[ "Set", "the", "select", "clause", "for", "the", "relation", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/HasManyThrough.php#L247-L254
analogueorm/analogue
src/System/SingleTableInheritanceScope.php
SingleTableInheritanceScope.getTypeStringForEntity
protected function getTypeStringForEntity($class, EntityMap $entityMap) { $class = $entityMap->getClass(); $type = array_keys( $entityMap->getDiscriminatorColumnMap(), $class ); if (count($type) == 0) { return $class; } return $t...
php
protected function getTypeStringForEntity($class, EntityMap $entityMap) { $class = $entityMap->getClass(); $type = array_keys( $entityMap->getDiscriminatorColumnMap(), $class ); if (count($type) == 0) { return $class; } return $t...
[ "protected", "function", "getTypeStringForEntity", "(", "$", "class", ",", "EntityMap", "$", "entityMap", ")", "{", "$", "class", "=", "$", "entityMap", "->", "getClass", "(", ")", ";", "$", "type", "=", "array_keys", "(", "$", "entityMap", "->", "getDiscr...
Get the normalized value to use for query on discriminator column. @param string $class @param EntityMap $entityMap @return string
[ "Get", "the", "normalized", "value", "to", "use", "for", "query", "on", "discriminator", "column", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/SingleTableInheritanceScope.php#L55-L69
analogueorm/analogue
src/System/SingleTableInheritanceScope.php
SingleTableInheritanceScope.remove
public function remove(Query $query) { $query = $query->getQuery(); foreach ((array) $query->wheres as $key => $where) { if ($this->isSingleTableConstraint($where, $this->column)) { unset($query->wheres[$key]); $query->wheres = array_values($query->where...
php
public function remove(Query $query) { $query = $query->getQuery(); foreach ((array) $query->wheres as $key => $where) { if ($this->isSingleTableConstraint($where, $this->column)) { unset($query->wheres[$key]); $query->wheres = array_values($query->where...
[ "public", "function", "remove", "(", "Query", "$", "query", ")", "{", "$", "query", "=", "$", "query", "->", "getQuery", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "query", "->", "wheres", "as", "$", "key", "=>", "$", "where", ")", "{...
Remove the scope from the given Analogue query builder. @param mixed $query @return void
[ "Remove", "the", "scope", "from", "the", "given", "Analogue", "query", "builder", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/SingleTableInheritanceScope.php#L90-L101
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.getRelationCountQuery
public function getRelationCountQuery(Query $query, Query $parent) { $query->select(new Expression('count(*)')); $key = $this->wrap($this->getQualifiedParentKeyName()); return $query->where($this->getHasCompareKey(), '=', new Expression($key)); }
php
public function getRelationCountQuery(Query $query, Query $parent) { $query->select(new Expression('count(*)')); $key = $this->wrap($this->getQualifiedParentKeyName()); return $query->where($this->getHasCompareKey(), '=', new Expression($key)); }
[ "public", "function", "getRelationCountQuery", "(", "Query", "$", "query", ",", "Query", "$", "parent", ")", "{", "$", "query", "->", "select", "(", "new", "Expression", "(", "'count(*)'", ")", ")", ";", "$", "key", "=", "$", "this", "->", "wrap", "(",...
Add the constraints for a relationship count query. @param Query $query @param Query $parent @return Query
[ "Add", "the", "constraints", "for", "a", "relationship", "count", "query", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L185-L192
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.noConstraints
public static function noConstraints(Closure $callback) { static::$constraints = false; // When resetting the relation where clause, we want to shift the first element // off of the bindings, leaving only the constraints that the developers put // as "extra" on the relationships, an...
php
public static function noConstraints(Closure $callback) { static::$constraints = false; // When resetting the relation where clause, we want to shift the first element // off of the bindings, leaving only the constraints that the developers put // as "extra" on the relationships, an...
[ "public", "static", "function", "noConstraints", "(", "Closure", "$", "callback", ")", "{", "static", "::", "$", "constraints", "=", "false", ";", "// When resetting the relation where clause, we want to shift the first element", "// off of the bindings, leaving only the constrai...
Run a callback with constraints disabled on the relation. @param Closure $callback @return mixed
[ "Run", "a", "callback", "with", "constraints", "disabled", "on", "the", "relation", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L201-L213
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.getKeys
protected function getKeys(array $entities, $key = null) { if (is_null($key)) { $key = $this->relatedMap->getKeyName(); } $host = $this; return array_unique(array_values(array_map(function ($value) use ($key, $host) { if (!$value instanceof InternallyMappabl...
php
protected function getKeys(array $entities, $key = null) { if (is_null($key)) { $key = $this->relatedMap->getKeyName(); } $host = $this; return array_unique(array_values(array_map(function ($value) use ($key, $host) { if (!$value instanceof InternallyMappabl...
[ "protected", "function", "getKeys", "(", "array", "$", "entities", ",", "$", "key", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "$", "key", "=", "$", "this", "->", "relatedMap", "->", "getKeyName", "(", ")", ";", ...
Get all of the primary keys for an array of entities. @param array $entities @param string $key @return array
[ "Get", "all", "of", "the", "primary", "keys", "for", "an", "array", "of", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L223-L238
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.getKeysFromResults
protected function getKeysFromResults(array $results, $key = null) { if (is_null($key)) { $key = $this->parentMap->getKeyName(); } return array_unique(array_values(array_map(function ($value) use ($key) { return $value[$key]; }, $results))); }
php
protected function getKeysFromResults(array $results, $key = null) { if (is_null($key)) { $key = $this->parentMap->getKeyName(); } return array_unique(array_values(array_map(function ($value) use ($key) { return $value[$key]; }, $results))); }
[ "protected", "function", "getKeysFromResults", "(", "array", "$", "results", ",", "$", "key", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "$", "key", "=", "$", "this", "->", "parentMap", "->", "getKeyName", "(", ")", ...
Get all the keys from a result set. @param array $results @param string $key @return array
[ "Get", "all", "the", "keys", "from", "a", "result", "set", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L248-L257
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.cacheRelation
protected function cacheRelation($results, $relation) { $cache = $this->parentMapper->getEntityCache(); $cache->cacheLoadedRelationResult($this->parent->getEntityKeyName(), $relation, $results, $this); }
php
protected function cacheRelation($results, $relation) { $cache = $this->parentMapper->getEntityCache(); $cache->cacheLoadedRelationResult($this->parent->getEntityKeyName(), $relation, $results, $this); }
[ "protected", "function", "cacheRelation", "(", "$", "results", ",", "$", "relation", ")", "{", "$", "cache", "=", "$", "this", "->", "parentMapper", "->", "getEntityCache", "(", ")", ";", "$", "cache", "->", "cacheLoadedRelationResult", "(", "$", "this", "...
Cache the link between parent and related into the mapper's Entity Cache. @param EntityCollection|Mappable $results result of the relation query @param string $relation name of the relation method on the parent entity @return void
[ "Cache", "the", "link", "between", "parent", "and", "related", "into", "the", "mapper", "s", "Entity", "Cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L392-L397
analogueorm/analogue
src/Relationships/Relationship.php
Relationship.getEntityHash
protected function getEntityHash(Mappable $entity) { $class = get_class($entity); $keyName = Mapper::getMapper($class)->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }
php
protected function getEntityHash(Mappable $entity) { $class = get_class($entity); $keyName = Mapper::getMapper($class)->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }
[ "protected", "function", "getEntityHash", "(", "Mappable", "$", "entity", ")", "{", "$", "class", "=", "get_class", "(", "$", "entity", ")", ";", "$", "keyName", "=", "Mapper", "::", "getMapper", "(", "$", "class", ")", "->", "getEntityMap", "(", ")", ...
Get a combo type.primaryKey. @param Mappable $entity @return string
[ "Get", "a", "combo", "type", ".", "primaryKey", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Relationship.php#L416-L423
analogueorm/analogue
src/Entity.php
Entity.toArray
public function toArray() { // First, call the trait method before filtering // with Entity specific methods $attributes = $this->attributesToArray($this->attributes); foreach ($this->attributes as $key => $attribute) { if (in_array($key, $this->hidden)) { ...
php
public function toArray() { // First, call the trait method before filtering // with Entity specific methods $attributes = $this->attributesToArray($this->attributes); foreach ($this->attributes as $key => $attribute) { if (in_array($key, $this->hidden)) { ...
[ "public", "function", "toArray", "(", ")", "{", "// First, call the trait method before filtering", "// with Entity specific methods", "$", "attributes", "=", "$", "this", "->", "attributesToArray", "(", "$", "this", "->", "attributes", ")", ";", "foreach", "(", "$", ...
Convert every attributes to value / arrays. @return array
[ "Convert", "every", "attributes", "to", "value", "/", "arrays", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Entity.php#L103-L121
analogueorm/analogue
src/System/Builders/EntityBuilder.php
EntityBuilder.build
public function build(array $attributes) { // If the object we are building is a value object, // we won't be using the instance cache. if (!$this->useCache || $this->entityMap->getKeyName() === null) { return $this->buildEntity($attributes); } $instanceCache = $...
php
public function build(array $attributes) { // If the object we are building is a value object, // we won't be using the instance cache. if (!$this->useCache || $this->entityMap->getKeyName() === null) { return $this->buildEntity($attributes); } $instanceCache = $...
[ "public", "function", "build", "(", "array", "$", "attributes", ")", "{", "// If the object we are building is a value object,", "// we won't be using the instance cache.", "if", "(", "!", "$", "this", "->", "useCache", "||", "$", "this", "->", "entityMap", "->", "get...
Convert an array of attributes into an entity, or retrieve entity instance from cache. @param array $attributes @return mixed
[ "Convert", "an", "array", "of", "attributes", "into", "an", "entity", "or", "retrieve", "entity", "instance", "from", "cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/EntityBuilder.php#L79-L92
analogueorm/analogue
src/System/Builders/EntityBuilder.php
EntityBuilder.buildEntity
protected function buildEntity(array $attributes) { $wrapper = $this->getWrapperInstance(); // Hydrate any embedded Value Object // // TODO Move this to the result builder instead, // as we'll handle this the same way as they were // eager loaded relationships. ...
php
protected function buildEntity(array $attributes) { $wrapper = $this->getWrapperInstance(); // Hydrate any embedded Value Object // // TODO Move this to the result builder instead, // as we'll handle this the same way as they were // eager loaded relationships. ...
[ "protected", "function", "buildEntity", "(", "array", "$", "attributes", ")", "{", "$", "wrapper", "=", "$", "this", "->", "getWrapperInstance", "(", ")", ";", "// Hydrate any embedded Value Object", "//", "// TODO Move this to the result builder instead,", "// as we'll h...
Actually build an entity. @param array $attributes @return mixed
[ "Actually", "build", "an", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/EntityBuilder.php#L101-L126
analogueorm/analogue
src/System/Builders/EntityBuilder.php
EntityBuilder.hydrateValueObjects
protected function hydrateValueObjects(&$attributes) { foreach ($this->entityMap->getEmbeddables() as $localKey => $valueClass) { $this->hydrateValueObject($attributes, $localKey, $valueClass); } }
php
protected function hydrateValueObjects(&$attributes) { foreach ($this->entityMap->getEmbeddables() as $localKey => $valueClass) { $this->hydrateValueObject($attributes, $localKey, $valueClass); } }
[ "protected", "function", "hydrateValueObjects", "(", "&", "$", "attributes", ")", "{", "foreach", "(", "$", "this", "->", "entityMap", "->", "getEmbeddables", "(", ")", "as", "$", "localKey", "=>", "$", "valueClass", ")", "{", "$", "this", "->", "hydrateVa...
Hydrate value object embedded in this entity. @param array $attributes @throws \Analogue\ORM\Exceptions\MappingException @return void
[ "Hydrate", "value", "object", "embedded", "in", "this", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/EntityBuilder.php#L161-L166
analogueorm/analogue
src/System/Builders/EntityBuilder.php
EntityBuilder.hydrateValueObject
protected function hydrateValueObject(&$attributes, $localKey, $valueClass) { $map = $this->mapper->getManager()->getValueMap($valueClass); $embeddedAttributes = $map->getAttributes(); $valueObject = $this->mapper->getManager()->getValueObjectInstance($valueClass); $voWrapper = $th...
php
protected function hydrateValueObject(&$attributes, $localKey, $valueClass) { $map = $this->mapper->getManager()->getValueMap($valueClass); $embeddedAttributes = $map->getAttributes(); $valueObject = $this->mapper->getManager()->getValueObjectInstance($valueClass); $voWrapper = $th...
[ "protected", "function", "hydrateValueObject", "(", "&", "$", "attributes", ",", "$", "localKey", ",", "$", "valueClass", ")", "{", "$", "map", "=", "$", "this", "->", "mapper", "->", "getManager", "(", ")", "->", "getValueMap", "(", "$", "valueClass", "...
Hydrate a single value object. @param array $attributes @param string $localKey @param string $valueClass @throws \Analogue\ORM\Exceptions\MappingException @return void
[ "Hydrate", "a", "single", "value", "object", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Builders/EntityBuilder.php#L179-L197
analogueorm/analogue
src/System/Manager.php
Manager.mapper
public function mapper($entity, $entityMap = null) { if ($entity instanceof Wrapper) { throw new MappingException('Tried to instantiate mapper on wrapped Entity'); } $entity = $this->resolveEntityClass($entity); $entity = $this->getInverseMorphMap($entity); // ...
php
public function mapper($entity, $entityMap = null) { if ($entity instanceof Wrapper) { throw new MappingException('Tried to instantiate mapper on wrapped Entity'); } $entity = $this->resolveEntityClass($entity); $entity = $this->getInverseMorphMap($entity); // ...
[ "public", "function", "mapper", "(", "$", "entity", ",", "$", "entityMap", "=", "null", ")", "{", "if", "(", "$", "entity", "instanceof", "Wrapper", ")", "{", "throw", "new", "MappingException", "(", "'Tried to instantiate mapper on wrapped Entity'", ")", ";", ...
Create a mapper for a given entity. @param \Analogue\ORM\Mappable|string|array|\Traversable $entity @param mixed $entityMap @throws MappingException @throws \InvalidArgumentException @return Mapper
[ "Create", "a", "mapper", "for", "a", "given", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L167-L183
analogueorm/analogue
src/System/Manager.php
Manager.resolveEntityClass
protected function resolveEntityClass($entity) { // We first check if the entity is traversable and we'll resolve // the entity based on the first item of the object. if ($this->isTraversable($entity)) { if (!count($entity)) { throw new \InvalidArgumentException('...
php
protected function resolveEntityClass($entity) { // We first check if the entity is traversable and we'll resolve // the entity based on the first item of the object. if ($this->isTraversable($entity)) { if (!count($entity)) { throw new \InvalidArgumentException('...
[ "protected", "function", "resolveEntityClass", "(", "$", "entity", ")", "{", "// We first check if the entity is traversable and we'll resolve", "// the entity based on the first item of the object.", "if", "(", "$", "this", "->", "isTraversable", "(", "$", "entity", ")", ")"...
This method resolve entity class from mappable instances or iterators. @param \Analogue\ORM\Mappable|string|array|\Traversable $entity @throws \InvalidArgumentException @return string
[ "This", "method", "resolve", "entity", "class", "from", "mappable", "instances", "or", "iterators", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L194-L219
analogueorm/analogue
src/System/Manager.php
Manager.getInverseMorphMap
public function getInverseMorphMap($key) { return array_key_exists($key, $this->morphMap) ? $this->morphMap[$key] : $key; }
php
public function getInverseMorphMap($key) { return array_key_exists($key, $this->morphMap) ? $this->morphMap[$key] : $key; }
[ "public", "function", "getInverseMorphMap", "(", "$", "key", ")", "{", "return", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "morphMap", ")", "?", "$", "this", "->", "morphMap", "[", "$", "key", "]", ":", "$", "key", ";", "}" ]
@param string $key @return string
[ "@param", "string", "$key" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L226-L229
analogueorm/analogue
src/System/Manager.php
Manager.buildMapper
protected function buildMapper($entity, $entityMap) { // If an EntityMap hasn't been manually registered by the user // register it at runtime. if (!$this->isRegisteredEntity($entity)) { $this->register($entity, $entityMap); } $entityMap = $this->entityClasses[$e...
php
protected function buildMapper($entity, $entityMap) { // If an EntityMap hasn't been manually registered by the user // register it at runtime. if (!$this->isRegisteredEntity($entity)) { $this->register($entity, $entityMap); } $entityMap = $this->entityClasses[$e...
[ "protected", "function", "buildMapper", "(", "$", "entity", ",", "$", "entityMap", ")", "{", "// If an EntityMap hasn't been manually registered by the user", "// register it at runtime.", "if", "(", "!", "$", "this", "->", "isRegisteredEntity", "(", "$", "entity", ")",...
Build a new Mapper instance for a given Entity. @param string $entity @param mixed $entityMap @throws MappingException @return Mapper
[ "Build", "a", "new", "Mapper", "instance", "for", "a", "given", "Entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L241-L270
analogueorm/analogue
src/System/Manager.php
Manager.isRegisteredEntity
public function isRegisteredEntity($entity) { if (!is_string($entity)) { $entity = get_class($entity); } return array_key_exists($entity, $this->entityClasses); }
php
public function isRegisteredEntity($entity) { if (!is_string($entity)) { $entity = get_class($entity); } return array_key_exists($entity, $this->entityClasses); }
[ "public", "function", "isRegisteredEntity", "(", "$", "entity", ")", "{", "if", "(", "!", "is_string", "(", "$", "entity", ")", ")", "{", "$", "entity", "=", "get_class", "(", "$", "entity", ")", ";", "}", "return", "array_key_exists", "(", "$", "entit...
Check if the entity is already registered. @param string|Entity $entity @return bool
[ "Check", "if", "the", "entity", "is", "already", "registered", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L293-L300
analogueorm/analogue
src/System/Manager.php
Manager.isRegisteredValueObject
public function isRegisteredValueObject($object) { if (!is_string($object)) { $object = get_class($object); } return array_key_exists($object, $this->valueClasses); }
php
public function isRegisteredValueObject($object) { if (!is_string($object)) { $object = get_class($object); } return array_key_exists($object, $this->valueClasses); }
[ "public", "function", "isRegisteredValueObject", "(", "$", "object", ")", "{", "if", "(", "!", "is_string", "(", "$", "object", ")", ")", "{", "$", "object", "=", "get_class", "(", "$", "object", ")", ";", "}", "return", "array_key_exists", "(", "$", "...
Check if a value class is already registered. @param string|\stdClass $object @return bool
[ "Check", "if", "a", "value", "class", "is", "already", "registered", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L319-L326
analogueorm/analogue
src/System/Manager.php
Manager.register
public function register($entity, $entityMap = null) { // If an object is provider, get the class name from it if (!is_string($entity)) { $entity = get_class($entity); } if ($this->isRegisteredEntity($entity)) { throw new MappingException("Entity $entity is a...
php
public function register($entity, $entityMap = null) { // If an object is provider, get the class name from it if (!is_string($entity)) { $entity = get_class($entity); } if ($this->isRegisteredEntity($entity)) { throw new MappingException("Entity $entity is a...
[ "public", "function", "register", "(", "$", "entity", ",", "$", "entityMap", "=", "null", ")", "{", "// If an object is provider, get the class name from it", "if", "(", "!", "is_string", "(", "$", "entity", ")", ")", "{", "$", "entity", "=", "get_class", "(",...
Register an entity. @param string|\Analogue\ORM\Mappable $entity entity's class name @param string|EntityMap $entityMap map's class name @throws MappingException @return void
[ "Register", "an", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L398-L428
analogueorm/analogue
src/System/Manager.php
Manager.getEntityMapInstanceFor
protected function getEntityMapInstanceFor($entity) { // First, we'll try to load the entity map from cache, to // save from time consuming parsing of the relationships $entityMap = $this->getEntityMapInstanceFromCache($entity); if ($entityMap !== null) { return $entityM...
php
protected function getEntityMapInstanceFor($entity) { // First, we'll try to load the entity map from cache, to // save from time consuming parsing of the relationships $entityMap = $this->getEntityMapInstanceFromCache($entity); if ($entityMap !== null) { return $entityM...
[ "protected", "function", "getEntityMapInstanceFor", "(", "$", "entity", ")", "{", "// First, we'll try to load the entity map from cache, to", "// save from time consuming parsing of the relationships", "$", "entityMap", "=", "$", "this", "->", "getEntityMapInstanceFromCache", "(",...
Get the entity map instance for a custom entity. @param string $entity @return \Analogue\ORM\EntityMap
[ "Get", "the", "entity", "map", "instance", "for", "a", "custom", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L437-L465
analogueorm/analogue
src/System/Manager.php
Manager.getEntityMapInstanceFromCache
protected function getEntityMapInstanceFromCache(string $entityClass) { if ($this->cache == null) { return; } if ($this->cache->has($entityClass)) { return unserialize($this->cache->get($entityClass)); } }
php
protected function getEntityMapInstanceFromCache(string $entityClass) { if ($this->cache == null) { return; } if ($this->cache->has($entityClass)) { return unserialize($this->cache->get($entityClass)); } }
[ "protected", "function", "getEntityMapInstanceFromCache", "(", "string", "$", "entityClass", ")", "{", "if", "(", "$", "this", "->", "cache", "==", "null", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "cache", "->", "has", "(", "$", "ent...
Get Entity Map instance from cache. @param string $entityClass @return EntityMap|null
[ "Get", "Entity", "Map", "instance", "from", "cache", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L474-L483
analogueorm/analogue
src/System/Manager.php
Manager.findMapInNamespace
protected function findMapInNamespace($class, $namespace) { $parts = explode('\\', $class); $baseClass = $parts[count($parts) - 1]; $expectedClass = $namespace.$baseClass.'Map'; if (class_exists($expectedClass)) { return new $expectedClass(); } return ...
php
protected function findMapInNamespace($class, $namespace) { $parts = explode('\\', $class); $baseClass = $parts[count($parts) - 1]; $expectedClass = $namespace.$baseClass.'Map'; if (class_exists($expectedClass)) { return new $expectedClass(); } return ...
[ "protected", "function", "findMapInNamespace", "(", "$", "class", ",", "$", "namespace", ")", "{", "$", "parts", "=", "explode", "(", "'\\\\'", ",", "$", "class", ")", ";", "$", "baseClass", "=", "$", "parts", "[", "count", "(", "$", "parts", ")", "-...
Look in a custom namespace for an Entity/ValueMap. @param string $class @param string $namespace @return ValueMap|EntityMap|bool
[ "Look", "in", "a", "custom", "namespace", "for", "an", "Entity", "/", "ValueMap", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L512-L525
analogueorm/analogue
src/System/Manager.php
Manager.repository
public function repository($entity) { if (!is_string($entity)) { $entity = get_class($entity); } // First we check if the repository is not already created. if (array_key_exists($entity, $this->repositories)) { return $this->repositories[$entity]; } ...
php
public function repository($entity) { if (!is_string($entity)) { $entity = get_class($entity); } // First we check if the repository is not already created. if (array_key_exists($entity, $this->repositories)) { return $this->repositories[$entity]; } ...
[ "public", "function", "repository", "(", "$", "entity", ")", "{", "if", "(", "!", "is_string", "(", "$", "entity", ")", ")", "{", "$", "entity", "=", "get_class", "(", "$", "entity", ")", ";", "}", "// First we check if the repository is not already created.",...
Get the Repository instance for the given Entity. @param \Analogue\ORM\Mappable|string $entity @throws \InvalidArgumentException @throws MappingException @return \Analogue\ORM\Repository
[ "Get", "the", "Repository", "instance", "for", "the", "given", "Entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L567-L581
analogueorm/analogue
src/System/Manager.php
Manager.isValueObject
public function isValueObject($object) { if (!is_string($object)) { $object = get_class($object); } return array_key_exists($object, $this->valueClasses); }
php
public function isValueObject($object) { if (!is_string($object)) { $object = get_class($object); } return array_key_exists($object, $this->valueClasses); }
[ "public", "function", "isValueObject", "(", "$", "object", ")", "{", "if", "(", "!", "is_string", "(", "$", "object", ")", ")", "{", "$", "object", "=", "get_class", "(", "$", "object", ")", ";", "}", "return", "array_key_exists", "(", "$", "object", ...
Return true is the object is registered as value object. @param mixed $object @return bool
[ "Return", "true", "is", "the", "object", "is", "registered", "as", "value", "object", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L590-L597
analogueorm/analogue
src/System/Manager.php
Manager.getValueMap
public function getValueMap($valueObject) { if (!is_string($valueObject)) { $valueObject = get_class($valueObject); } if (!array_key_exists($valueObject, $this->valueClasses)) { $this->registerValueObject($valueObject); } /** @var ValueMap $valueMap ...
php
public function getValueMap($valueObject) { if (!is_string($valueObject)) { $valueObject = get_class($valueObject); } if (!array_key_exists($valueObject, $this->valueClasses)) { $this->registerValueObject($valueObject); } /** @var ValueMap $valueMap ...
[ "public", "function", "getValueMap", "(", "$", "valueObject", ")", "{", "if", "(", "!", "is_string", "(", "$", "valueObject", ")", ")", "{", "$", "valueObject", "=", "get_class", "(", "$", "valueObject", ")", ";", "}", "if", "(", "!", "array_key_exists",...
Get the Value Map for a given Value Object Class. @param string $valueObject @throws MappingException @return \Analogue\ORM\ValueMap
[ "Get", "the", "Value", "Map", "for", "a", "given", "Value", "Object", "Class", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L608-L624
analogueorm/analogue
src/System/Manager.php
Manager.registerValueObject
public function registerValueObject($valueObject, $valueMap = null) { if (!is_string($valueObject)) { $valueObject = get_class($valueObject); } if ($valueMap === null) { // First, we'll look into registered namespaces for Entity Maps, // if any. Then we'...
php
public function registerValueObject($valueObject, $valueMap = null) { if (!is_string($valueObject)) { $valueObject = get_class($valueObject); } if ($valueMap === null) { // First, we'll look into registered namespaces for Entity Maps, // if any. Then we'...
[ "public", "function", "registerValueObject", "(", "$", "valueObject", ",", "$", "valueMap", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "valueObject", ")", ")", "{", "$", "valueObject", "=", "get_class", "(", "$", "valueObject", ")", ";...
Register a Value Object. @param string $valueObject @param string $valueMap @throws MappingException @return void
[ "Register", "a", "Value", "Object", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L636-L658
analogueorm/analogue
src/System/Manager.php
Manager.registerPlugin
public function registerPlugin($plugin) { /** @var AnaloguePluginInterface $plugin */ $plugin = new $plugin($this); $this->events = array_merge($this->events, $plugin->getCustomEvents()); $plugin->register(); }
php
public function registerPlugin($plugin) { /** @var AnaloguePluginInterface $plugin */ $plugin = new $plugin($this); $this->events = array_merge($this->events, $plugin->getCustomEvents()); $plugin->register(); }
[ "public", "function", "registerPlugin", "(", "$", "plugin", ")", "{", "/** @var AnaloguePluginInterface $plugin */", "$", "plugin", "=", "new", "$", "plugin", "(", "$", "this", ")", ";", "$", "this", "->", "events", "=", "array_merge", "(", "$", "this", "->"...
Register Analogue Plugin. @param string $plugin class @return void
[ "Register", "Analogue", "Plugin", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L691-L699
analogueorm/analogue
src/System/Manager.php
Manager.registerGlobalEvent
public function registerGlobalEvent($event, $callback) { if (!array_key_exists($event, $this->events)) { throw new \LogicException("Analogue : Event $event doesn't exist"); } $this->eventDispatcher->listen("analogue.{$event}.*", $callback); //$this->eventDispatcher->list...
php
public function registerGlobalEvent($event, $callback) { if (!array_key_exists($event, $this->events)) { throw new \LogicException("Analogue : Event $event doesn't exist"); } $this->eventDispatcher->listen("analogue.{$event}.*", $callback); //$this->eventDispatcher->list...
[ "public", "function", "registerGlobalEvent", "(", "$", "event", ",", "$", "callback", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "event", ",", "$", "this", "->", "events", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "\"Analog...
Register event listeners that will be fired regardless the type of the entity. @param string $event @param \Closure $callback @throws \LogicException @return void
[ "Register", "event", "listeners", "that", "will", "be", "fired", "regardless", "the", "type", "of", "the", "entity", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/Manager.php#L712-L720
analogueorm/analogue
src/Relationships/Pivot.php
Pivot.setPivotKeys
public function setPivotKeys($foreignKey, $otherKey) { $this->foreignKey = $foreignKey; $this->otherKey = $otherKey; return $this; }
php
public function setPivotKeys($foreignKey, $otherKey) { $this->foreignKey = $foreignKey; $this->otherKey = $otherKey; return $this; }
[ "public", "function", "setPivotKeys", "(", "$", "foreignKey", ",", "$", "otherKey", ")", "{", "$", "this", "->", "foreignKey", "=", "$", "foreignKey", ";", "$", "this", "->", "otherKey", "=", "$", "otherKey", ";", "return", "$", "this", ";", "}" ]
Set the key names for the pivot model instance. @param string $foreignKey @param string $otherKey @return $this
[ "Set", "the", "key", "names", "for", "the", "pivot", "model", "instance", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/Pivot.php#L129-L136
analogueorm/analogue
src/System/MapperFactory.php
MapperFactory.make
public function make($entityClass, EntityMap $entityMap) { $driver = $entityMap->getDriver(); $connection = $entityMap->getConnection(); $adapter = $this->drivers->getAdapter($driver, $connection); $entityMap->setDateFormat($adapter->getDateFormat()); $mapper = new Mapper...
php
public function make($entityClass, EntityMap $entityMap) { $driver = $entityMap->getDriver(); $connection = $entityMap->getConnection(); $adapter = $this->drivers->getAdapter($driver, $connection); $entityMap->setDateFormat($adapter->getDateFormat()); $mapper = new Mapper...
[ "public", "function", "make", "(", "$", "entityClass", ",", "EntityMap", "$", "entityMap", ")", "{", "$", "driver", "=", "$", "entityMap", "->", "getDriver", "(", ")", ";", "$", "connection", "=", "$", "entityMap", "->", "getConnection", "(", ")", ";", ...
Return a new Mapper instance. @param string $entityClass @param EntityMap $entityMap @return Mapper
[ "Return", "a", "new", "Mapper", "instance", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/System/MapperFactory.php#L61-L91
analogueorm/analogue
src/Drivers/IlluminateDriver.php
IlluminateDriver.getAdapter
public function getAdapter(string $connection = null): DBAdapter { $connection = $this->connectionProvider->connection($connection); return new IlluminateDBAdapter($connection); }
php
public function getAdapter(string $connection = null): DBAdapter { $connection = $this->connectionProvider->connection($connection); return new IlluminateDBAdapter($connection); }
[ "public", "function", "getAdapter", "(", "string", "$", "connection", "=", "null", ")", ":", "DBAdapter", "{", "$", "connection", "=", "$", "this", "->", "connectionProvider", "->", "connection", "(", "$", "connection", ")", ";", "return", "new", "Illuminate...
{@inheritdoc}
[ "{" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Drivers/IlluminateDriver.php#L35-L40
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.buildDictionary
protected function buildDictionary($results) { foreach ($results as $result) { if ($result[$this->morphType]) { $this->dictionary[$result[$this->morphType]][$result[$this->foreignKey]][] = $result; } } }
php
protected function buildDictionary($results) { foreach ($results as $result) { if ($result[$this->morphType]) { $this->dictionary[$result[$this->morphType]][$result[$this->foreignKey]][] = $result; } } }
[ "protected", "function", "buildDictionary", "(", "$", "results", ")", "{", "foreach", "(", "$", "results", "as", "$", "result", ")", "{", "if", "(", "$", "result", "[", "$", "this", "->", "morphType", "]", ")", "{", "$", "this", "->", "dictionary", "...
Build a dictionary with the entities. @param array $results @return void
[ "Build", "a", "dictionary", "with", "the", "entities", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L75-L82
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.match
public function match(array $results, $relation) { foreach (array_keys($this->dictionary) as $type) { $results = $this->matchToMorphParents($type, $this->getResultsByType($type), $results); } return $results; }
php
public function match(array $results, $relation) { foreach (array_keys($this->dictionary) as $type) { $results = $this->matchToMorphParents($type, $this->getResultsByType($type), $results); } return $results; }
[ "public", "function", "match", "(", "array", "$", "results", ",", "$", "relation", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "dictionary", ")", "as", "$", "type", ")", "{", "$", "results", "=", "$", "this", "->", "matchToMorphPare...
Match the eagerly loaded results to their parents. @param array $results @param string $relation @return array
[ "Match", "the", "eagerly", "loaded", "results", "to", "their", "parents", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L92-L99
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.matchToMorphParents
protected function matchToMorphParents($type, EntityCollection $results, array $parents) { $mapper = $this->relatedMapper->getManager()->mapper($type); $keyName = $mapper->getEntityMap()->getKeyName(); $keys = array_map(function ($parent) use ($keyName) { return $parent[$keyName...
php
protected function matchToMorphParents($type, EntityCollection $results, array $parents) { $mapper = $this->relatedMapper->getManager()->mapper($type); $keyName = $mapper->getEntityMap()->getKeyName(); $keys = array_map(function ($parent) use ($keyName) { return $parent[$keyName...
[ "protected", "function", "matchToMorphParents", "(", "$", "type", ",", "EntityCollection", "$", "results", ",", "array", "$", "parents", ")", "{", "$", "mapper", "=", "$", "this", "->", "relatedMapper", "->", "getManager", "(", ")", "->", "mapper", "(", "$...
Match the results for a given type to their parents. @param string $type @param EntityCollection $results @param array $parents @return array
[ "Match", "the", "results", "for", "a", "given", "type", "to", "their", "parents", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L110-L132
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.getResultsByType
protected function getResultsByType($type) { $mapper = $this->relatedMapper->getManager()->mapper($type); $key = $mapper->getEntityMap()->getKeyName(); $query = $mapper->getQuery(); return $query->whereIn($key, array_keys($this->dictionary[$type]))->get(); }
php
protected function getResultsByType($type) { $mapper = $this->relatedMapper->getManager()->mapper($type); $key = $mapper->getEntityMap()->getKeyName(); $query = $mapper->getQuery(); return $query->whereIn($key, array_keys($this->dictionary[$type]))->get(); }
[ "protected", "function", "getResultsByType", "(", "$", "type", ")", "{", "$", "mapper", "=", "$", "this", "->", "relatedMapper", "->", "getManager", "(", ")", "->", "mapper", "(", "$", "type", ")", ";", "$", "key", "=", "$", "mapper", "->", "getEntityM...
Get all of the relation results for a type. @param string $type @throws \Analogue\ORM\Exceptions\MappingException @return \Illuminate\Support\Collection
[ "Get", "all", "of", "the", "relation", "results", "for", "a", "type", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L143-L152
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.gatherKeysByType
protected function gatherKeysByType($type) { $foreign = $this->foreignKey; return BaseCollection::make($this->dictionary[$type])->map(function ($entities) use ($foreign) { return head($entities)[$foreign]; })->unique(); }
php
protected function gatherKeysByType($type) { $foreign = $this->foreignKey; return BaseCollection::make($this->dictionary[$type])->map(function ($entities) use ($foreign) { return head($entities)[$foreign]; })->unique(); }
[ "protected", "function", "gatherKeysByType", "(", "$", "type", ")", "{", "$", "foreign", "=", "$", "this", "->", "foreignKey", ";", "return", "BaseCollection", "::", "make", "(", "$", "this", "->", "dictionary", "[", "$", "type", "]", ")", "->", "map", ...
Gather all of the foreign keys for a given type. @param string $type @return BaseCollection
[ "Gather", "all", "of", "the", "foreign", "keys", "for", "a", "given", "type", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L161-L168
analogueorm/analogue
src/Relationships/MorphTo.php
MorphTo.getForeignKeyValuePair
public function getForeignKeyValuePair($related) { $foreignKey = $this->getForeignKey(); if ($related) { $wrapper = $this->factory->make($related); $relatedKey = $this->relatedMap->getKeyName(); return [ $foreignKey => $wrapper->getEntityAt...
php
public function getForeignKeyValuePair($related) { $foreignKey = $this->getForeignKey(); if ($related) { $wrapper = $this->factory->make($related); $relatedKey = $this->relatedMap->getKeyName(); return [ $foreignKey => $wrapper->getEntityAt...
[ "public", "function", "getForeignKeyValuePair", "(", "$", "related", ")", "{", "$", "foreignKey", "=", "$", "this", "->", "getForeignKey", "(", ")", ";", "if", "(", "$", "related", ")", "{", "$", "wrapper", "=", "$", "this", "->", "factory", "->", "mak...
Get the foreign key value pair for a related object. @param mixed $related @return array
[ "Get", "the", "foreign", "key", "value", "pair", "for", "a", "related", "object", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/Relationships/MorphTo.php#L196-L212
analogueorm/analogue
src/EntityCollection.php
EntityCollection.find
public function find($key, $default = null) { if ($key instanceof Mappable) { $key = $this->getEntityKey($key); } return array_first($this->items, function ($entity, $itemKey) use ($key) { return $this->getEntityKey($entity) == $key; }, $default); }
php
public function find($key, $default = null) { if ($key instanceof Mappable) { $key = $this->getEntityKey($key); } return array_first($this->items, function ($entity, $itemKey) use ($key) { return $this->getEntityKey($entity) == $key; }, $default); }
[ "public", "function", "find", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "key", "instanceof", "Mappable", ")", "{", "$", "key", "=", "$", "this", "->", "getEntityKey", "(", "$", "key", ")", ";", "}", "return", "a...
Find an entity in the collection by key. @param mixed $key @param mixed $default @throws MappingException @return \Analogue\ORM\Entity
[ "Find", "an", "entity", "in", "the", "collection", "by", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L42-L51
analogueorm/analogue
src/EntityCollection.php
EntityCollection.pull
public function pull($key, $default = null) { $this->items = array_filter($this->items, function ($item) use ($key) { $primaryKey = $this->getEntityKey($item); return $primaryKey !== $key; }); }
php
public function pull($key, $default = null) { $this->items = array_filter($this->items, function ($item) use ($key) { $primaryKey = $this->getEntityKey($item); return $primaryKey !== $key; }); }
[ "public", "function", "pull", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "this", "->", "items", "=", "array_filter", "(", "$", "this", "->", "items", ",", "function", "(", "$", "item", ")", "use", "(", "$", "key", ")", "{",...
Get and remove an item from the collection. @param mixed $key @param mixed $default @return mixed
[ "Get", "and", "remove", "an", "item", "from", "the", "collection", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L91-L98
analogueorm/analogue
src/EntityCollection.php
EntityCollection.getEntityHashes
public function getEntityHashes() { return array_map(function ($entity) { $class = get_class($entity); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }...
php
public function getEntityHashes() { return array_map(function ($entity) { $class = get_class($entity); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); return $class.'.'.$entity->getEntityAttribute($keyName); }...
[ "public", "function", "getEntityHashes", "(", ")", "{", "return", "array_map", "(", "function", "(", "$", "entity", ")", "{", "$", "class", "=", "get_class", "(", "$", "entity", ")", ";", "$", "mapper", "=", "Manager", "::", "getMapper", "(", "$", "cla...
Generic function for returning class.key value pairs. @throws MappingException @return string
[ "Generic", "function", "for", "returning", "class", ".", "key", "value", "pairs", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L161-L173
analogueorm/analogue
src/EntityCollection.php
EntityCollection.getSubsetByHashes
public function getSubsetByHashes(array $hashes) { $subset = []; foreach ($this->items as $item) { $class = get_class($item); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); if (in_array($class.'.'.$item->$ke...
php
public function getSubsetByHashes(array $hashes) { $subset = []; foreach ($this->items as $item) { $class = get_class($item); $mapper = Manager::getMapper($class); $keyName = $mapper->getEntityMap()->getKeyName(); if (in_array($class.'.'.$item->$ke...
[ "public", "function", "getSubsetByHashes", "(", "array", "$", "hashes", ")", "{", "$", "subset", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "item", ")", "{", "$", "class", "=", "get_class", "(", "$", "item", ")", ";"...
Get a subset of the collection from entity hashes. @param array $hashes @throws MappingException @return array
[ "Get", "a", "subset", "of", "the", "collection", "from", "entity", "hashes", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L184-L201
analogueorm/analogue
src/EntityCollection.php
EntityCollection.diff
public function diff($items) { $diff = new static(); $dictionary = $this->getDictionary($items); foreach ($this->items as $item) { if (!isset($dictionary[$this->getEntityKey($item)])) { $diff->add($item); } } return $diff; }
php
public function diff($items) { $diff = new static(); $dictionary = $this->getDictionary($items); foreach ($this->items as $item) { if (!isset($dictionary[$this->getEntityKey($item)])) { $diff->add($item); } } return $diff; }
[ "public", "function", "diff", "(", "$", "items", ")", "{", "$", "diff", "=", "new", "static", "(", ")", ";", "$", "dictionary", "=", "$", "this", "->", "getDictionary", "(", "$", "items", ")", ";", "foreach", "(", "$", "this", "->", "items", "as", ...
Diff the collection with the given items. @param \ArrayAccess|array $items @return self
[ "Diff", "the", "collection", "with", "the", "given", "items", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L230-L243
analogueorm/analogue
src/EntityCollection.php
EntityCollection.getEntityKey
protected function getEntityKey($entity) { $keyName = Manager::getMapper($entity)->getEntityMap()->getKeyName(); $wrapper = $this->factory->make($entity); return $wrapper->getEntityAttribute($keyName); }
php
protected function getEntityKey($entity) { $keyName = Manager::getMapper($entity)->getEntityMap()->getKeyName(); $wrapper = $this->factory->make($entity); return $wrapper->getEntityAttribute($keyName); }
[ "protected", "function", "getEntityKey", "(", "$", "entity", ")", "{", "$", "keyName", "=", "Manager", "::", "getMapper", "(", "$", "entity", ")", "->", "getEntityMap", "(", ")", "->", "getKeyName", "(", ")", ";", "$", "wrapper", "=", "$", "this", "->"...
@param $entity @throws MappingException @return mixed
[ "@param", "$entity" ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L336-L343
analogueorm/analogue
src/EntityCollection.php
EntityCollection.max
public function max($key = null) { return $this->reduce(function ($result, $item) use ($key) { $wrapper = $this->factory->make($item); return (is_null($result) || $wrapper->getEntityAttribute($key) > $result) ? $wrapper->getEntityAttribute($key) : $result; })...
php
public function max($key = null) { return $this->reduce(function ($result, $item) use ($key) { $wrapper = $this->factory->make($item); return (is_null($result) || $wrapper->getEntityAttribute($key) > $result) ? $wrapper->getEntityAttribute($key) : $result; })...
[ "public", "function", "max", "(", "$", "key", "=", "null", ")", "{", "return", "$", "this", "->", "reduce", "(", "function", "(", "$", "result", ",", "$", "item", ")", "use", "(", "$", "key", ")", "{", "$", "wrapper", "=", "$", "this", "->", "f...
Get the max value of a given key. @param string|null $key @throws MappingException @return mixed
[ "Get", "the", "max", "value", "of", "a", "given", "key", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L354-L362
analogueorm/analogue
src/EntityCollection.php
EntityCollection.offsetUnset
public function offsetUnset($key) { $this->items = array_filter($this->items, function ($item) use ($key) { $primaryKey = $this->getEntityKey($item); return $primaryKey !== $key; }); }
php
public function offsetUnset($key) { $this->items = array_filter($this->items, function ($item) use ($key) { $primaryKey = $this->getEntityKey($item); return $primaryKey !== $key; }); }
[ "public", "function", "offsetUnset", "(", "$", "key", ")", "{", "$", "this", "->", "items", "=", "array_filter", "(", "$", "this", "->", "items", ",", "function", "(", "$", "item", ")", "use", "(", "$", "key", ")", "{", "$", "primaryKey", "=", "$",...
Unset the item at a given offset. @param string $key @return void
[ "Unset", "the", "item", "at", "a", "given", "offset", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L416-L423
analogueorm/analogue
src/EntityCollection.php
EntityCollection.toJson
public function toJson($options = 0) { $collection = new Collection(array_values($this->items)); return $collection->toJson($options); }
php
public function toJson($options = 0) { $collection = new Collection(array_values($this->items)); return $collection->toJson($options); }
[ "public", "function", "toJson", "(", "$", "options", "=", "0", ")", "{", "$", "collection", "=", "new", "Collection", "(", "array_values", "(", "$", "this", "->", "items", ")", ")", ";", "return", "$", "collection", "->", "toJson", "(", "$", "options",...
Get the collection of items as JSON. @param int $options @return string
[ "Get", "the", "collection", "of", "items", "as", "JSON", "." ]
train
https://github.com/analogueorm/analogue/blob/b12cdea1d78d33923b9986f5413ca6e133302c87/src/EntityCollection.php#L447-L452
c9s/Pux
src/Controller/ExpandableController.php
ExpandableController.expand
public function expand(array $options = array(), $dynamic = false) { $this->mux = $mux = new Mux(); $routes = ControllerRouteBuilder::build($this); foreach ($routes as $route) { if ($dynamic) { $mux->add($route[0], array($this, $route[1]), array_merge($options, $r...
php
public function expand(array $options = array(), $dynamic = false) { $this->mux = $mux = new Mux(); $routes = ControllerRouteBuilder::build($this); foreach ($routes as $route) { if ($dynamic) { $mux->add($route[0], array($this, $route[1]), array_merge($options, $r...
[ "public", "function", "expand", "(", "array", "$", "options", "=", "array", "(", ")", ",", "$", "dynamic", "=", "false", ")", "{", "$", "this", "->", "mux", "=", "$", "mux", "=", "new", "Mux", "(", ")", ";", "$", "routes", "=", "ControllerRouteBuil...
Expand controller actions to Mux object. @return Mux
[ "Expand", "controller", "actions", "to", "Mux", "object", "." ]
train
https://github.com/c9s/Pux/blob/a59bf0c72738859159900990c80e10f533f18109/src/Controller/ExpandableController.php#L30-L43
c9s/Pux
src/Builder/ControllerRouteBuilder.php
ControllerRouteBuilder.parseActionMethods
public static function parseActionMethods($con) { $refClass = new ReflectionClass($con); $methodMap = []; // build up parent class list $parentClasses = []; $parentClasses[] = $parentClassRef = $refClass; while ($parent = $parentClassRef->getParentClass()) { ...
php
public static function parseActionMethods($con) { $refClass = new ReflectionClass($con); $methodMap = []; // build up parent class list $parentClasses = []; $parentClasses[] = $parentClassRef = $refClass; while ($parent = $parentClassRef->getParentClass()) { ...
[ "public", "static", "function", "parseActionMethods", "(", "$", "con", ")", "{", "$", "refClass", "=", "new", "ReflectionClass", "(", "$", "con", ")", ";", "$", "methodMap", "=", "[", "]", ";", "// build up parent class list", "$", "parentClasses", "=", "[",...
parseActionMethods parses the route definition from annotation and return the "method" => "route meta" data structure Should always keep it returns simple array, so that we can cache the data in somewhere... @return array
[ "parseActionMethods", "parses", "the", "route", "definition", "from", "annotation", "and", "return", "the", "method", "=", ">", "route", "meta", "data", "structure" ]
train
https://github.com/c9s/Pux/blob/a59bf0c72738859159900990c80e10f533f18109/src/Builder/ControllerRouteBuilder.php#L38-L78
c9s/Pux
src/Builder/ControllerRouteBuilder.php
ControllerRouteBuilder.translatePath
protected static function translatePath($methodName) { $methodName = preg_replace('/Action$/', '', $methodName); return '/'.preg_replace_callback('/[A-Z]/', function ($matches) { return '/'.strtolower($matches[0]); }, $methodName); }
php
protected static function translatePath($methodName) { $methodName = preg_replace('/Action$/', '', $methodName); return '/'.preg_replace_callback('/[A-Z]/', function ($matches) { return '/'.strtolower($matches[0]); }, $methodName); }
[ "protected", "static", "function", "translatePath", "(", "$", "methodName", ")", "{", "$", "methodName", "=", "preg_replace", "(", "'/Action$/'", ",", "''", ",", "$", "methodName", ")", ";", "return", "'/'", ".", "preg_replace_callback", "(", "'/[A-Z]/'", ",",...
Translate action method name into route path. Upper case letters will be translated into slash + lower letter, e.g. pageUpdateAction => /page/update fooAction => /foo @return string path
[ "Translate", "action", "method", "name", "into", "route", "path", "." ]
train
https://github.com/c9s/Pux/blob/a59bf0c72738859159900990c80e10f533f18109/src/Builder/ControllerRouteBuilder.php#L90-L96
c9s/Pux
src/Builder/ControllerRouteBuilder.php
ControllerRouteBuilder.build
public static function build($controller) { $routes = array(); $actions = self::parseActionMethods($controller); foreach ($actions as $actionName => $actionInfo) { list($annotations, $meta) = $actionInfo; if (isset($annotations['Route'])) { $path = $...
php
public static function build($controller) { $routes = array(); $actions = self::parseActionMethods($controller); foreach ($actions as $actionName => $actionInfo) { list($annotations, $meta) = $actionInfo; if (isset($annotations['Route'])) { $path = $...
[ "public", "static", "function", "build", "(", "$", "controller", ")", "{", "$", "routes", "=", "array", "(", ")", ";", "$", "actions", "=", "self", "::", "parseActionMethods", "(", "$", "controller", ")", ";", "foreach", "(", "$", "actions", "as", "$",...
Return [["/path", "testAction", [ "method" => ... ] ],...]. @return array returns routes array
[ "Return", "[[", "/", "path", "testAction", "[", "method", "=", ">", "...", "]", "]", "...", "]", "." ]
train
https://github.com/c9s/Pux/blob/a59bf0c72738859159900990c80e10f533f18109/src/Builder/ControllerRouteBuilder.php#L103-L132