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
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.map
public function map(callable $function) { $function = Functions::allowExcessiveArguments($function); $clone = clone $this; foreach ($clone->keyIdentityPositionMap as $position) { $keyCopy = $this->keys[$position]; $valueCopy = $this->...
php
public function map(callable $function) { $function = Functions::allowExcessiveArguments($function); $clone = clone $this; foreach ($clone->keyIdentityPositionMap as $position) { $keyCopy = $this->keys[$position]; $valueCopy = $this->...
[ "public", "function", "map", "(", "callable", "$", "function", ")", "{", "$", "function", "=", "Functions", "::", "allowExcessiveArguments", "(", "$", "function", ")", ";", "$", "clone", "=", "clone", "$", "this", ";", "foreach", "(", "$", "clone", "->",...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L56-L69
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.walk
public function walk(callable $function) { $function = Functions::allowExcessiveArguments($function); foreach ($this->keys as $position => $key) { $function($this->values[$position], $key); } }
php
public function walk(callable $function) { $function = Functions::allowExcessiveArguments($function); foreach ($this->keys as $position => $key) { $function($this->values[$position], $key); } }
[ "public", "function", "walk", "(", "callable", "$", "function", ")", "{", "$", "function", "=", "Functions", "::", "allowExcessiveArguments", "(", "$", "function", ")", ";", "foreach", "(", "$", "this", "->", "keys", "as", "$", "position", "=>", "$", "ke...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L74-L81
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.groupBy
public function groupBy(callable $groupKeyFunction) { $groupedMap = new self(); foreach ($this->keyIdentityPositionMap as $identityHash => $position) { $keyCopy = $key = $this->keys[$position]; $valueCopy = $value =& $this->values[$position]; $groupKey = $grou...
php
public function groupBy(callable $groupKeyFunction) { $groupedMap = new self(); foreach ($this->keyIdentityPositionMap as $identityHash => $position) { $keyCopy = $key = $this->keys[$position]; $valueCopy = $value =& $this->values[$position]; $groupKey = $grou...
[ "public", "function", "groupBy", "(", "callable", "$", "groupKeyFunction", ")", "{", "$", "groupedMap", "=", "new", "self", "(", ")", ";", "foreach", "(", "$", "this", "->", "keyIdentityPositionMap", "as", "$", "identityHash", "=>", "$", "position", ")", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L86-L107
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.multisort
public function multisort(array $orderByFunctions, array $isAscending) { $positionKeyIdentityMap = []; $multisortArguments = []; foreach ($this->keyIdentityPositionMap as $keyIdentityHash => $position) { $positionKeyIdentityMap['0' . $position] = $keyIdentityHash; } ...
php
public function multisort(array $orderByFunctions, array $isAscending) { $positionKeyIdentityMap = []; $multisortArguments = []; foreach ($this->keyIdentityPositionMap as $keyIdentityHash => $position) { $positionKeyIdentityMap['0' . $position] = $keyIdentityHash; } ...
[ "public", "function", "multisort", "(", "array", "$", "orderByFunctions", ",", "array", "$", "isAscending", ")", "{", "$", "positionKeyIdentityMap", "=", "[", "]", ";", "$", "multisortArguments", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "keyI...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L112-L153
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.&
public function &get($key) { $identityHash = Identity::hash($key); if (isset($this->keyIdentityPositionMap[$identityHash])) { return $this->values[$this->keyIdentityPositionMap[$identityHash]]; } else { $null = null; return $null; } }
php
public function &get($key) { $identityHash = Identity::hash($key); if (isset($this->keyIdentityPositionMap[$identityHash])) { return $this->values[$this->keyIdentityPositionMap[$identityHash]]; } else { $null = null; return $null; } }
[ "public", "function", "&", "get", "(", "$", "key", ")", "{", "$", "identityHash", "=", "Identity", "::", "hash", "(", "$", "key", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "keyIdentityPositionMap", "[", "$", "identityHash", "]", ")", ")",...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L173-L184
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.set
public function set($key, $value) { $this->setInternal($key, $value, Identity::hash($key)); }
php
public function set($key, $value) { $this->setInternal($key, $value, Identity::hash($key)); }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "setInternal", "(", "$", "key", ",", "$", "value", ",", "Identity", "::", "hash", "(", "$", "key", ")", ")", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L197-L200
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.setRef
public function setRef($key, &$value) { $this->setInternal($key, $value, Identity::hash($key), true); }
php
public function setRef($key, &$value) { $this->setInternal($key, $value, Identity::hash($key), true); }
[ "public", "function", "setRef", "(", "$", "key", ",", "&", "$", "value", ")", "{", "$", "this", "->", "setInternal", "(", "$", "key", ",", "$", "value", ",", "Identity", "::", "hash", "(", "$", "key", ")", ",", "true", ")", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L205-L208
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.remove
public function remove($key) { $identityHash = Identity::hash($key); if (isset($this->keyIdentityPositionMap[$identityHash])) { $position = $this->keyIdentityPositionMap[$identityHash]; unset($this->keys[$position], $this->values[$position], $this->k...
php
public function remove($key) { $identityHash = Identity::hash($key); if (isset($this->keyIdentityPositionMap[$identityHash])) { $position = $this->keyIdentityPositionMap[$identityHash]; unset($this->keys[$position], $this->values[$position], $this->k...
[ "public", "function", "remove", "(", "$", "key", ")", "{", "$", "identityHash", "=", "Identity", "::", "hash", "(", "$", "key", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "keyIdentityPositionMap", "[", "$", "identityHash", "]", ")", ")", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L233-L258
TimeToogo/Pinq
Source/Iterators/Common/OrderedMap.php
OrderedMap.clear
public function clear() { $this->keyIdentityPositionMap = []; $this->keys = []; $this->values = []; $this->length = 0; $this->largestIntKey = -1; }
php
public function clear() { $this->keyIdentityPositionMap = []; $this->keys = []; $this->values = []; $this->length = 0; $this->largestIntKey = -1; }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "keyIdentityPositionMap", "=", "[", "]", ";", "$", "this", "->", "keys", "=", "[", "]", ";", "$", "this", "->", "values", "=", "[", "]", ";", "$", "this", "->", "length", "=", "0", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Iterators/Common/OrderedMap.php#L263-L270
TimeToogo/Pinq
Source/Expressions/CastExpression.php
CastExpression.update
public function update($castType, Expression $castValue) { if ($this->castType === $castType && $this->castValue === $castValue) { return $this; } return new self($castType, $castValue); }
php
public function update($castType, Expression $castValue) { if ($this->castType === $castType && $this->castValue === $castValue) { return $this; } return new self($castType, $castValue); }
[ "public", "function", "update", "(", "$", "castType", ",", "Expression", "$", "castValue", ")", "{", "if", "(", "$", "this", "->", "castType", "===", "$", "castType", "&&", "$", "this", "->", "castValue", "===", "$", "castValue", ")", "{", "return", "$...
@param string $castType @param Expression $castValue @return self
[ "@param", "string", "$castType", "@param", "Expression", "$castValue" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Expressions/CastExpression.php#L57-L64
TimeToogo/Pinq
Source/QueryBuilder.php
QueryBuilder.newMethod
protected function newMethod($name, array $arguments = []) { return O\Expression::methodCall( $this->expression, O\Expression::value($name), array_map([O\Expression::getType(), 'argument'], array_map([O\Expression::getType(), 'value'], $arguments)) ); ...
php
protected function newMethod($name, array $arguments = []) { return O\Expression::methodCall( $this->expression, O\Expression::value($name), array_map([O\Expression::getType(), 'argument'], array_map([O\Expression::getType(), 'value'], $arguments)) ); ...
[ "protected", "function", "newMethod", "(", "$", "name", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "return", "O", "\\", "Expression", "::", "methodCall", "(", "$", "this", "->", "expression", ",", "O", "\\", "Expression", "::", "value", "...
@param string $name @param mixed[] $arguments @return O\MethodCallExpression
[ "@param", "string", "$name", "@param", "mixed", "[]", "$arguments" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/QueryBuilder.php#L40-L47
TimeToogo/Pinq
Source/QueryBuilder.php
QueryBuilder.newMethodSegment
protected function newMethodSegment($name, array $arguments = []) { return $this->provider->createQueryable($this->newMethod($name, $arguments)); }
php
protected function newMethodSegment($name, array $arguments = []) { return $this->provider->createQueryable($this->newMethod($name, $arguments)); }
[ "protected", "function", "newMethodSegment", "(", "$", "name", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "return", "$", "this", "->", "provider", "->", "createQueryable", "(", "$", "this", "->", "newMethod", "(", "$", "name", ",", "$", "...
Returns a new queryable instance with the supplied query segment appended to the current scope @param string $name @param mixed[] $arguments @return IQueryable
[ "Returns", "a", "new", "queryable", "instance", "with", "the", "supplied", "query", "segment", "appended", "to", "the", "current", "scope" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/QueryBuilder.php#L58-L61
TimeToogo/Pinq
Source/Expressions/ValueExpression.php
ValueExpression.isValueType
public static function isValueType($value) { if (is_scalar($value) || $value === null) { return true; } elseif (is_array($value)) { $isScalar = true; array_walk_recursive($value, function ($value) use (&$isScalar) { if (...
php
public static function isValueType($value) { if (is_scalar($value) || $value === null) { return true; } elseif (is_array($value)) { $isScalar = true; array_walk_recursive($value, function ($value) use (&$isScalar) { if (...
[ "public", "static", "function", "isValueType", "(", "$", "value", ")", "{", "if", "(", "is_scalar", "(", "$", "value", ")", "||", "$", "value", "===", "null", ")", "{", "return", "true", ";", "}", "elseif", "(", "is_array", "(", "$", "value", ")", ...
Returns whether the supplied value is a value type. @param mixed $value @return bool
[ "Returns", "whether", "the", "supplied", "value", "is", "a", "value", "type", "." ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Expressions/ValueExpression.php#L88-L105
TimeToogo/Pinq
Source/Expressions/TernaryExpression.php
TernaryExpression.update
public function update(Expression $condition, Expression $ifTrue = null, Expression $ifFalse) { if ($this->condition === $condition && $this->ifTrue === $ifTrue && $this->ifFalse === $ifFalse ) { return $this; } return new self($condition,...
php
public function update(Expression $condition, Expression $ifTrue = null, Expression $ifFalse) { if ($this->condition === $condition && $this->ifTrue === $ifTrue && $this->ifFalse === $ifFalse ) { return $this; } return new self($condition,...
[ "public", "function", "update", "(", "Expression", "$", "condition", ",", "Expression", "$", "ifTrue", "=", "null", ",", "Expression", "$", "ifFalse", ")", "{", "if", "(", "$", "this", "->", "condition", "===", "$", "condition", "&&", "$", "this", "->", ...
@param Expression $condition @param Expression|null $ifTrue @param Expression $ifFalse @return self
[ "@param", "Expression", "$condition", "@param", "Expression|null", "$ifTrue", "@param", "Expression", "$ifFalse" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Expressions/TernaryExpression.php#L79-L89
TimeToogo/Pinq
Source/Expressions/BinaryOperationExpression.php
BinaryOperationExpression.update
public function update(Expression $leftOperand, $operator, Expression $rightOperand) { if ($this->leftOperand === $leftOperand && $this->operator === $operator && $this->rightOperand === $rightOperand ) { return $this; } return new self($l...
php
public function update(Expression $leftOperand, $operator, Expression $rightOperand) { if ($this->leftOperand === $leftOperand && $this->operator === $operator && $this->rightOperand === $rightOperand ) { return $this; } return new self($l...
[ "public", "function", "update", "(", "Expression", "$", "leftOperand", ",", "$", "operator", ",", "Expression", "$", "rightOperand", ")", "{", "if", "(", "$", "this", "->", "leftOperand", "===", "$", "leftOperand", "&&", "$", "this", "->", "operator", "===...
@param Expression $leftOperand @param int $operator @param Expression $rightOperand @return self
[ "@param", "Expression", "$leftOperand", "@param", "int", "$operator", "@param", "Expression", "$rightOperand" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Expressions/BinaryOperationExpression.php#L73-L83
TimeToogo/Pinq
Source/Parsing/FunctionReflection.php
FunctionReflection.fromCallable
public static function fromCallable(callable $callable) { $reflection = Reflection::fromCallable($callable); return new self( $callable, $reflection, FunctionSignature::fromReflection($reflection), FunctionLocation::fromReflection($ref...
php
public static function fromCallable(callable $callable) { $reflection = Reflection::fromCallable($callable); return new self( $callable, $reflection, FunctionSignature::fromReflection($reflection), FunctionLocation::fromReflection($ref...
[ "public", "static", "function", "fromCallable", "(", "callable", "$", "callable", ")", "{", "$", "reflection", "=", "Reflection", "::", "fromCallable", "(", "$", "callable", ")", ";", "return", "new", "self", "(", "$", "callable", ",", "$", "reflection", "...
Creates a new function reflection instance from the supplied callable. @param callable $callable @return self
[ "Creates", "a", "new", "function", "reflection", "instance", "from", "the", "supplied", "callable", "." ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Parsing/FunctionReflection.php#L66-L76
TimeToogo/Pinq
Source/Expressions/ClosureUsedVariableExpression.php
ClosureUsedVariableExpression.update
public function update($name, $isReference) { if ($this->name === $name && $this->isReference === $isReference) { return $this; } return new self($name, $isReference); }
php
public function update($name, $isReference) { if ($this->name === $name && $this->isReference === $isReference) { return $this; } return new self($name, $isReference); }
[ "public", "function", "update", "(", "$", "name", ",", "$", "isReference", ")", "{", "if", "(", "$", "this", "->", "name", "===", "$", "name", "&&", "$", "this", "->", "isReference", "===", "$", "isReference", ")", "{", "return", "$", "this", ";", ...
@param string $name @param boolean $isReference @return ClosureUsedVariableExpression
[ "@param", "string", "$name", "@param", "boolean", "$isReference" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Expressions/ClosureUsedVariableExpression.php#L44-L51
TimeToogo/Pinq
Source/Queries/Segments/Ordering.php
Ordering.update
public function update(Functions\ElementProjection $projectionFunction) { if ($this->projectionFunction === $projectionFunction) { return $this; } return new self($projectionFunction, $this->isAscendingId); }
php
public function update(Functions\ElementProjection $projectionFunction) { if ($this->projectionFunction === $projectionFunction) { return $this; } return new self($projectionFunction, $this->isAscendingId); }
[ "public", "function", "update", "(", "Functions", "\\", "ElementProjection", "$", "projectionFunction", ")", "{", "if", "(", "$", "this", "->", "projectionFunction", "===", "$", "projectionFunction", ")", "{", "return", "$", "this", ";", "}", "return", "new", ...
@param Functions\ElementProjection $projectionFunction @return Ordering
[ "@param", "Functions", "\\", "ElementProjection", "$projectionFunction" ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Queries/Segments/Ordering.php#L61-L68
TimeToogo/Pinq
Source/Parsing/Resolvers/FunctionMagicResolver.php
FunctionMagicResolver.resolve
public static function resolve(IFunctionMagic $functionMagic, array $expressions) { $self = new self($functionMagic); return $self->walkAll($expressions); }
php
public static function resolve(IFunctionMagic $functionMagic, array $expressions) { $self = new self($functionMagic); return $self->walkAll($expressions); }
[ "public", "static", "function", "resolve", "(", "IFunctionMagic", "$", "functionMagic", ",", "array", "$", "expressions", ")", "{", "$", "self", "=", "new", "self", "(", "$", "functionMagic", ")", ";", "return", "$", "self", "->", "walkAll", "(", "$", "e...
Resolves any magic constants / scopes with the supplied resolved values. @param IFunctionMagic $functionMagic @param O\Expression[] $expressions @return O\Expression[]
[ "Resolves", "any", "magic", "constants", "/", "scopes", "with", "the", "supplied", "resolved", "values", "." ]
train
https://github.com/TimeToogo/Pinq/blob/fa55da968d063c5aca384b5298665348da248c08/Source/Parsing/Resolvers/FunctionMagicResolver.php#L48-L53
bearsunday/BEAR.Sunday
src/Module/Constant/NamedModule.php
NamedModule.configure
protected function configure() { foreach ($this->names as $annotatedWith => $instance) { $this->bind()->annotatedWith($annotatedWith)->toInstance($instance); } }
php
protected function configure() { foreach ($this->names as $annotatedWith => $instance) { $this->bind()->annotatedWith($annotatedWith)->toInstance($instance); } }
[ "protected", "function", "configure", "(", ")", "{", "foreach", "(", "$", "this", "->", "names", "as", "$", "annotatedWith", "=>", "$", "instance", ")", "{", "$", "this", "->", "bind", "(", ")", "->", "annotatedWith", "(", "$", "annotatedWith", ")", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Module/Constant/NamedModule.php#L25-L30
sebastiaanluca/laravel-helpers
src/Collections/CollectionMacrosServiceProvider.php
CollectionMacrosServiceProvider.boot
public function boot() { /** * Create Carbon instances from items in a collection. */ Collection::macro('carbonize', function () { return collect($this->items)->map(function ($time) { return new Carbon($time); }); }); /** ...
php
public function boot() { /** * Create Carbon instances from items in a collection. */ Collection::macro('carbonize', function () { return collect($this->items)->map(function ($time) { return new Carbon($time); }); }); /** ...
[ "public", "function", "boot", "(", ")", "{", "/**\n * Create Carbon instances from items in a collection.\n */", "Collection", "::", "macro", "(", "'carbonize'", ",", "function", "(", ")", "{", "return", "collect", "(", "$", "this", "->", "items", ")",...
Boot the service provider.
[ "Boot", "the", "service", "provider", "." ]
train
https://github.com/sebastiaanluca/laravel-helpers/blob/e695d71e3e13afff4b6e18a5ffb0813f49cbb883/src/Collections/CollectionMacrosServiceProvider.php#L14-L104
bearsunday/BEAR.Sunday
src/Module/Resource/ResourceModule.php
ResourceModule.configure
protected function configure() { $this->bind()->annotatedWith(AppName::class)->toInstance(self::DEFAULT_APP_NAME); $this->install(new ResourceClientModule); $this->install(new EmbedResourceModule); }
php
protected function configure() { $this->bind()->annotatedWith(AppName::class)->toInstance(self::DEFAULT_APP_NAME); $this->install(new ResourceClientModule); $this->install(new EmbedResourceModule); }
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "bind", "(", ")", "->", "annotatedWith", "(", "AppName", "::", "class", ")", "->", "toInstance", "(", "self", "::", "DEFAULT_APP_NAME", ")", ";", "$", "this", "->", "install", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Module/Resource/ResourceModule.php#L19-L24
bearsunday/BEAR.Sunday
src/Provide/Router/RouterModule.php
RouterModule.configure
protected function configure() { $this->bind(RouterInterface::class)->to(WebRouter::class); $this->bind()->annotatedWith(DefaultSchemeHost::class)->toInstance('page://self'); }
php
protected function configure() { $this->bind(RouterInterface::class)->to(WebRouter::class); $this->bind()->annotatedWith(DefaultSchemeHost::class)->toInstance('page://self'); }
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "bind", "(", "RouterInterface", "::", "class", ")", "->", "to", "(", "WebRouter", "::", "class", ")", ";", "$", "this", "->", "bind", "(", ")", "->", "annotatedWith", "(", "Default...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Provide/Router/RouterModule.php#L16-L20
bearsunday/BEAR.Sunday
src/Module/SundayModule.php
SundayModule.configure
protected function configure() { $this->install(new AppModule); $this->install(new HttpCacheModule); $this->install(new DoctrineCacheModule); $this->install(new DoctrineAnnotationModule); $this->install(new ResourceModule); $this->install(new RouterModule); $t...
php
protected function configure() { $this->install(new AppModule); $this->install(new HttpCacheModule); $this->install(new DoctrineCacheModule); $this->install(new DoctrineAnnotationModule); $this->install(new ResourceModule); $this->install(new RouterModule); $t...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "install", "(", "new", "AppModule", ")", ";", "$", "this", "->", "install", "(", "new", "HttpCacheModule", ")", ";", "$", "this", "->", "install", "(", "new", "DoctrineCacheModule", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Module/SundayModule.php#L22-L32
bearsunday/BEAR.Sunday
src/Module/Annotation/DoctrineAnnotationModule.php
DoctrineAnnotationModule.configure
protected function configure() { $this->bind(Cache::class)->annotatedWith('annotation_cache')->to(ArrayCache::class)->in(Scope::SINGLETON); $this->bind(Reader::class)->annotatedWith('annotation_reader')->to(AnnotationReader::class)->in(Scope::SINGLETON); $this->bind(Reader::class)->toConstru...
php
protected function configure() { $this->bind(Cache::class)->annotatedWith('annotation_cache')->to(ArrayCache::class)->in(Scope::SINGLETON); $this->bind(Reader::class)->annotatedWith('annotation_reader')->to(AnnotationReader::class)->in(Scope::SINGLETON); $this->bind(Reader::class)->toConstru...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "bind", "(", "Cache", "::", "class", ")", "->", "annotatedWith", "(", "'annotation_cache'", ")", "->", "to", "(", "ArrayCache", "::", "class", ")", "->", "in", "(", "Scope", "::", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Module/Annotation/DoctrineAnnotationModule.php#L20-L25
bearsunday/BEAR.Sunday
src/Provide/Application/AppModule.php
AppModule.configure
protected function configure() { $this->bind(AppInterface::class)->to(App::class); $this->bind()->annotatedWith(AppName::class)->toInstance('BEAR\Sunday'); }
php
protected function configure() { $this->bind(AppInterface::class)->to(App::class); $this->bind()->annotatedWith(AppName::class)->toInstance('BEAR\Sunday'); }
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "bind", "(", "AppInterface", "::", "class", ")", "->", "to", "(", "App", "::", "class", ")", ";", "$", "this", "->", "bind", "(", ")", "->", "annotatedWith", "(", "AppName", "::"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Provide/Application/AppModule.php#L16-L20
bearsunday/BEAR.Sunday
src/Provide/Error/VndError.php
VndError.handle
public function handle(\Exception $e, Request $request) { if ($this->isCodeExists($e)) { $this->errorPage->code = (int) $e->getCode(); $this->errorPage->body = ['message' => (new Code)->statusText[$this->errorPage->code]]; return $this; } $this->errorPage...
php
public function handle(\Exception $e, Request $request) { if ($this->isCodeExists($e)) { $this->errorPage->code = (int) $e->getCode(); $this->errorPage->body = ['message' => (new Code)->statusText[$this->errorPage->code]]; return $this; } $this->errorPage...
[ "public", "function", "handle", "(", "\\", "Exception", "$", "e", ",", "Request", "$", "request", ")", "{", "if", "(", "$", "this", "->", "isCodeExists", "(", "$", "e", ")", ")", "{", "$", "this", "->", "errorPage", "->", "code", "=", "(", "int", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Provide/Error/VndError.php#L46-L60
bearsunday/BEAR.Sunday
src/Provide/Error/VndError.php
VndError.transfer
public function transfer() { $this->errorPage->headers['content-type'] = self::CONTENT_TYPE; $this->transfer->__invoke($this->errorPage, []); }
php
public function transfer() { $this->errorPage->headers['content-type'] = self::CONTENT_TYPE; $this->transfer->__invoke($this->errorPage, []); }
[ "public", "function", "transfer", "(", ")", "{", "$", "this", "->", "errorPage", "->", "headers", "[", "'content-type'", "]", "=", "self", "::", "CONTENT_TYPE", ";", "$", "this", "->", "transfer", "->", "__invoke", "(", "$", "this", "->", "errorPage", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bearsunday/BEAR.Sunday/blob/4c7e5d735ba0902bf8cceb2d6cebe192521bd80a/src/Provide/Error/VndError.php#L65-L69
ilya-dev/belt
src/Belt/Arrays.php
Arrays.first
public function first(array $elements, $amount = 1) { $elements = array_slice($elements, 0, $amount); return count($elements) == 1 ? reset($elements) : $elements; }
php
public function first(array $elements, $amount = 1) { $elements = array_slice($elements, 0, $amount); return count($elements) == 1 ? reset($elements) : $elements; }
[ "public", "function", "first", "(", "array", "$", "elements", ",", "$", "amount", "=", "1", ")", "{", "$", "elements", "=", "array_slice", "(", "$", "elements", ",", "0", ",", "$", "amount", ")", ";", "return", "count", "(", "$", "elements", ")", "...
Get the first n elements. @param array $elements @param integer $amount @return mixed|array
[ "Get", "the", "first", "n", "elements", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Arrays.php#L14-L19
ilya-dev/belt
src/Belt/Arrays.php
Arrays.last
public function last(array $elements, $amount = 1) { $elements = array_slice($elements, count($elements) - $amount); return count($elements) == 1 ? reset($elements) : $elements; }
php
public function last(array $elements, $amount = 1) { $elements = array_slice($elements, count($elements) - $amount); return count($elements) == 1 ? reset($elements) : $elements; }
[ "public", "function", "last", "(", "array", "$", "elements", ",", "$", "amount", "=", "1", ")", "{", "$", "elements", "=", "array_slice", "(", "$", "elements", ",", "count", "(", "$", "elements", ")", "-", "$", "amount", ")", ";", "return", "count", ...
Get the last n elements. @param array $elements @param integer $amount @return mixed|array
[ "Get", "the", "last", "n", "elements", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Arrays.php#L52-L57
ilya-dev/belt
src/Belt/Arrays.php
Arrays.flatten
public function flatten(array $elements) { $level = []; foreach ($elements as $node) { if (is_array($node)) { $level = array_merge($level, $this->flatten($node)); } else { $level[] = $node; ...
php
public function flatten(array $elements) { $level = []; foreach ($elements as $node) { if (is_array($node)) { $level = array_merge($level, $this->flatten($node)); } else { $level[] = $node; ...
[ "public", "function", "flatten", "(", "array", "$", "elements", ")", "{", "$", "level", "=", "[", "]", ";", "foreach", "(", "$", "elements", "as", "$", "node", ")", "{", "if", "(", "is_array", "(", "$", "node", ")", ")", "{", "$", "level", "=", ...
"Flatten" an array. @param array $elements @return array
[ "Flatten", "an", "array", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Arrays.php#L76-L93
ilya-dev/belt
src/Belt/Arrays.php
Arrays.unique
public function unique(array $elements, Closure $iterator = null) { if ( ! is_null($iterator)) { $elements = array_filter($elements, $iterator); } else { $elements = array_unique($elements); } return array_values($elements); }
php
public function unique(array $elements, Closure $iterator = null) { if ( ! is_null($iterator)) { $elements = array_filter($elements, $iterator); } else { $elements = array_unique($elements); } return array_values($elements); }
[ "public", "function", "unique", "(", "array", "$", "elements", ",", "Closure", "$", "iterator", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "iterator", ")", ")", "{", "$", "elements", "=", "array_filter", "(", "$", "elements", ",", "$...
Remove duplicated values. @param array $elements @param Closure|null $iterator @return array
[ "Remove", "duplicated", "values", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Arrays.php#L127-L139
ilya-dev/belt
src/Belt/Functions.php
Functions.cache
public function cache(Closure $closure) { $hash = spl_object_hash((object) $closure); if ( ! isset ($this->cached[$hash])) { $this->cached[$hash] = $closure(); } return $this->cached[$hash]; }
php
public function cache(Closure $closure) { $hash = spl_object_hash((object) $closure); if ( ! isset ($this->cached[$hash])) { $this->cached[$hash] = $closure(); } return $this->cached[$hash]; }
[ "public", "function", "cache", "(", "Closure", "$", "closure", ")", "{", "$", "hash", "=", "spl_object_hash", "(", "(", "object", ")", "$", "closure", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "cached", "[", "$", "hash", "]", ")", ...
Execute $closure and cache its output. @param Closure $closure @return mixed
[ "Execute", "$closure", "and", "cache", "its", "output", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Functions.php#L34-L44
ilya-dev/belt
src/Belt/Functions.php
Functions.compose
public function compose(array $closures, array $arguments = []) { $result = call_user_func_array(array_shift($closures), $arguments); foreach ($closures as $closure) { $result = $closure($result); } return $result; }
php
public function compose(array $closures, array $arguments = []) { $result = call_user_func_array(array_shift($closures), $arguments); foreach ($closures as $closure) { $result = $closure($result); } return $result; }
[ "public", "function", "compose", "(", "array", "$", "closures", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "result", "=", "call_user_func_array", "(", "array_shift", "(", "$", "closures", ")", ",", "$", "arguments", ")", ";", "foreach"...
Compose $closures. @param array $closures @param array $arguments @return mixed
[ "Compose", "$closures", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Functions.php#L65-L75
ilya-dev/belt
src/Belt/Functions.php
Functions.once
public function once(Closure $closure) { $hash = spl_object_hash((object) $closure); if ( ! isset ($this->called[$hash])) { $closure(); $this->called[$hash] = true; } }
php
public function once(Closure $closure) { $hash = spl_object_hash((object) $closure); if ( ! isset ($this->called[$hash])) { $closure(); $this->called[$hash] = true; } }
[ "public", "function", "once", "(", "Closure", "$", "closure", ")", "{", "$", "hash", "=", "spl_object_hash", "(", "(", "object", ")", "$", "closure", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "called", "[", "$", "hash", "]", ")", ...
Execute $closure only once and ignore future calls. @param Closure $closure @return void
[ "Execute", "$closure", "only", "once", "and", "ignore", "future", "calls", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Functions.php#L83-L93
ilya-dev/belt
src/Belt/Functions.php
Functions.after
public function after($number, Closure $closure) { $hash = spl_object_hash((object) $closure); if (isset ($this->delayed[$hash])) { $closure = $this->delayed[$hash]; return $closure(); } $this->delayed[$hash] = function() use($number, $closure) ...
php
public function after($number, Closure $closure) { $hash = spl_object_hash((object) $closure); if (isset ($this->delayed[$hash])) { $closure = $this->delayed[$hash]; return $closure(); } $this->delayed[$hash] = function() use($number, $closure) ...
[ "public", "function", "after", "(", "$", "number", ",", "Closure", "$", "closure", ")", "{", "$", "hash", "=", "spl_object_hash", "(", "(", "object", ")", "$", "closure", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "delayed", "[", "$", "h...
Only execute $closure after the exact $number of failed tries. @param integer $number @param Closure $closure @return mixed
[ "Only", "execute", "$closure", "after", "the", "exact", "$number", "of", "failed", "tries", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Functions.php#L102-L124
ilya-dev/belt
src/Belt/Belt.php
Belt.load
public function load($module, $instance = null) { if ( ! is_null($instance)) { if ( ! $this->hasModule($module)) { $this->addModule($module); } return ($this->instances[$module] = $instance); } if ($this->hasModule($mo...
php
public function load($module, $instance = null) { if ( ! is_null($instance)) { if ( ! $this->hasModule($module)) { $this->addModule($module); } return ($this->instances[$module] = $instance); } if ($this->hasModule($mo...
[ "public", "function", "load", "(", "$", "module", ",", "$", "instance", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "instance", ")", ")", "{", "if", "(", "!", "$", "this", "->", "hasModule", "(", "$", "module", ")", ")", "{", "$...
Load a module. @throws UnexpectedValueException @param string $module @param mixed|null $instance @return mixed
[ "Load", "a", "module", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Belt.php#L43-L61
ilya-dev/belt
src/Belt/Belt.php
Belt.getInstance
public function getInstance($module) { if ( ! $this->isLoaded($module)) { $this->load($module); } return $this->instances[$module]; }
php
public function getInstance($module) { if ( ! $this->isLoaded($module)) { $this->load($module); } return $this->instances[$module]; }
[ "public", "function", "getInstance", "(", "$", "module", ")", "{", "if", "(", "!", "$", "this", "->", "isLoaded", "(", "$", "module", ")", ")", "{", "$", "this", "->", "load", "(", "$", "module", ")", ";", "}", "return", "$", "this", "->", "insta...
Load a module (if not yet) and return its instance. @param string $module @return mixed
[ "Load", "a", "module", "(", "if", "not", "yet", ")", "and", "return", "its", "instance", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Belt.php#L112-L120
ilya-dev/belt
src/Belt/Belt.php
Belt.run
public function run($name, array $arguments = []) { foreach ($this->getModules() as $module) { $instance = $this->getInstance($module); if ($this->hasMethod($instance, $name)) { return call_user_func_array([$instance, $name], $arguments); ...
php
public function run($name, array $arguments = []) { foreach ($this->getModules() as $module) { $instance = $this->getInstance($module); if ($this->hasMethod($instance, $name)) { return call_user_func_array([$instance, $name], $arguments); ...
[ "public", "function", "run", "(", "$", "name", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "foreach", "(", "$", "this", "->", "getModules", "(", ")", "as", "$", "module", ")", "{", "$", "instance", "=", "$", "this", "->", "getInstance"...
Run a method and return its output. @throws BadMethodCallException @param string $name @param array $arguments @return mixed
[ "Run", "a", "method", "and", "return", "its", "output", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Belt.php#L142-L155
ilya-dev/belt
src/Belt/Collections.php
Collections.each
public function each(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { $iterator($key, $node); } }
php
public function each(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { $iterator($key, $node); } }
[ "public", "function", "each", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "node", ")", "{", "$", "iterator", "(", "$", "key", ",", "$", "node", ")", ";"...
Iterate through $collection using $iterator. @param array $collection @param Closure $iterator @return void
[ "Iterate", "through", "$collection", "using", "$iterator", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L15-L21
ilya-dev/belt
src/Belt/Collections.php
Collections.map
public function map(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { $collection[$key] = $iterator($key, $node); } return $collection; }
php
public function map(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { $collection[$key] = $iterator($key, $node); } return $collection; }
[ "public", "function", "map", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "node", ")", "{", "$", "collection", "[", "$", "key", "]", "=", "$", "iterator", ...
"Map" through $collection using $iterator. @param array $collection @param Closure $iterator @return array
[ "Map", "through", "$collection", "using", "$iterator", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L30-L38
ilya-dev/belt
src/Belt/Collections.php
Collections.any
public function any(array $collection, Closure $iterator) { foreach ($collection as $node) { if ($iterator($node)) { return true; } } return false; }
php
public function any(array $collection, Closure $iterator) { foreach ($collection as $node) { if ($iterator($node)) { return true; } } return false; }
[ "public", "function", "any", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "foreach", "(", "$", "collection", "as", "$", "node", ")", "{", "if", "(", "$", "iterator", "(", "$", "node", ")", ")", "{", "return", "true", ...
Check whether any values in $collection pass $iterator. @param array $collection @param Closure $iterator @return boolean
[ "Check", "whether", "any", "values", "in", "$collection", "pass", "$iterator", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L87-L98
ilya-dev/belt
src/Belt/Collections.php
Collections.all
public function all(array $collection, Closure $iterator) { foreach ($collection as $node) { if ( ! $iterator($node)) { return false; } } return true; }
php
public function all(array $collection, Closure $iterator) { foreach ($collection as $node) { if ( ! $iterator($node)) { return false; } } return true; }
[ "public", "function", "all", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "foreach", "(", "$", "collection", "as", "$", "node", ")", "{", "if", "(", "!", "$", "iterator", "(", "$", "node", ")", ")", "{", "return", "fa...
Check whether all values in $collection pass $iterator. @param array $collection @param Closure $iterator @return boolean
[ "Check", "whether", "all", "values", "in", "$collection", "pass", "$iterator", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L107-L118
ilya-dev/belt
src/Belt/Collections.php
Collections.reject
public function reject(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { if ( ! $iterator($node)) { unset($collection[$key]); } } return array_values($collection); }
php
public function reject(array $collection, Closure $iterator) { foreach ($collection as $key => $node) { if ( ! $iterator($node)) { unset($collection[$key]); } } return array_values($collection); }
[ "public", "function", "reject", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "node", ")", "{", "if", "(", "!", "$", "iterator", "(", "$", "node", ")", ")...
Run $iterator and remove all failing items in $collection. @param array $collection @param Closure $iterator @return array
[ "Run", "$iterator", "and", "remove", "all", "failing", "items", "in", "$collection", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L127-L138
ilya-dev/belt
src/Belt/Collections.php
Collections.pluck
public function pluck(array $collection, $key) { $values = []; foreach ($collection as $node) { if ( ! isset($node[$key])) { continue; } $values[] = $node[$key]; } return $values; }
php
public function pluck(array $collection, $key) { $values = []; foreach ($collection as $node) { if ( ! isset($node[$key])) { continue; } $values[] = $node[$key]; } return $values; }
[ "public", "function", "pluck", "(", "array", "$", "collection", ",", "$", "key", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "collection", "as", "$", "node", ")", "{", "if", "(", "!", "isset", "(", "$", "node", "[", "$", "...
Extract an array of values associated with $key from $collection. @param array $collection @param string $key @return array
[ "Extract", "an", "array", "of", "values", "associated", "with", "$key", "from", "$collection", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L147-L162
ilya-dev/belt
src/Belt/Collections.php
Collections.sortBy
public function sortBy(array $collection, Closure $iterator) { $collection = array_map($iterator, $collection); sort($collection); return array_values($collection); }
php
public function sortBy(array $collection, Closure $iterator) { $collection = array_map($iterator, $collection); sort($collection); return array_values($collection); }
[ "public", "function", "sortBy", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "$", "collection", "=", "array_map", "(", "$", "iterator", ",", "$", "collection", ")", ";", "sort", "(", "$", "collection", ")", ";", "return", ...
Return $collection sorted in ascending order based on $iterator results. @param array $collection @param Closure $iterator @return array
[ "Return", "$collection", "sorted", "in", "ascending", "order", "based", "on", "$iterator", "results", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L208-L215
ilya-dev/belt
src/Belt/Collections.php
Collections.groupBy
public function groupBy(array $collection, Closure $iterator) { $groups = []; foreach ($collection as $node) { $groups[$iterator($node)][] = $node; } sort($groups); return $groups; }
php
public function groupBy(array $collection, Closure $iterator) { $groups = []; foreach ($collection as $node) { $groups[$iterator($node)][] = $node; } sort($groups); return $groups; }
[ "public", "function", "groupBy", "(", "array", "$", "collection", ",", "Closure", "$", "iterator", ")", "{", "$", "groups", "=", "[", "]", ";", "foreach", "(", "$", "collection", "as", "$", "node", ")", "{", "$", "groups", "[", "$", "iterator", "(", ...
Group values in $collection by $iterator's return value. @param array $collection @param Closure $iterator @return array
[ "Group", "values", "in", "$collection", "by", "$iterator", "s", "return", "value", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Collections.php#L224-L236
ilya-dev/belt
src/Belt/Objects.php
Objects.extend
public function extend($source, $destination) { foreach($source as $key => $value) { $destination->{$key} = $value; } return $destination; }
php
public function extend($source, $destination) { foreach($source as $key => $value) { $destination->{$key} = $value; } return $destination; }
[ "public", "function", "extend", "(", "$", "source", ",", "$", "destination", ")", "{", "foreach", "(", "$", "source", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "destination", "->", "{", "$", "key", "}", "=", "$", "value", ";", "}", "re...
Copy all properties from $source to $destination. @param mixed $source @param mixed $destination @return mixed
[ "Copy", "all", "properties", "from", "$source", "to", "$destination", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Objects.php#L65-L73
ilya-dev/belt
src/Belt/Objects.php
Objects.defaults
public function defaults($object, $defaults) { if (is_array($defaults)) { foreach ($defaults as $default) { $this->defaults($object, $default); } return $object; } foreach ($defaults as $key => $value) { ...
php
public function defaults($object, $defaults) { if (is_array($defaults)) { foreach ($defaults as $default) { $this->defaults($object, $default); } return $object; } foreach ($defaults as $key => $value) { ...
[ "public", "function", "defaults", "(", "$", "object", ",", "$", "defaults", ")", "{", "if", "(", "is_array", "(", "$", "defaults", ")", ")", "{", "foreach", "(", "$", "defaults", "as", "$", "default", ")", "{", "$", "this", "->", "defaults", "(", "...
Fill in any missing values using $defaults. @param mixed $object @param mixed $defaults @return mixed
[ "Fill", "in", "any", "missing", "values", "using", "$defaults", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Objects.php#L82-L103
ilya-dev/belt
src/Belt/Objects.php
Objects.methods
public function methods($object) { $methods = (new ReflectionClass($object))->getMethods(ReflectionMethod::IS_PUBLIC); $iterator = function(ReflectionMethod $method) { return $method->getName(); }; return array_map($iterator, $methods); }
php
public function methods($object) { $methods = (new ReflectionClass($object))->getMethods(ReflectionMethod::IS_PUBLIC); $iterator = function(ReflectionMethod $method) { return $method->getName(); }; return array_map($iterator, $methods); }
[ "public", "function", "methods", "(", "$", "object", ")", "{", "$", "methods", "=", "(", "new", "ReflectionClass", "(", "$", "object", ")", ")", "->", "getMethods", "(", "ReflectionMethod", "::", "IS_PUBLIC", ")", ";", "$", "iterator", "=", "function", "...
Get the names of all public methods. @param mixed $object @return array
[ "Get", "the", "names", "of", "all", "public", "methods", "." ]
train
https://github.com/ilya-dev/belt/blob/1c1efc075c3a71de86427a1b5cbbff1a9ee4ae49/src/Belt/Objects.php#L122-L132
neos/neos-seo
Classes/Fusion/XmlSitemapUrlsImplementation.php
XmlSitemapUrlsImplementation.isDocumentNodeToBeIndexed
protected function isDocumentNodeToBeIndexed(NodeInterface $node): bool { return !$node->getNodeType()->isOfType('Neos.Seo:NoindexMixin') && $node->isVisible() && ($this->getRenderHiddenInIndex() || !$node->isHiddenInIndex()) && $node->isAccessible() && $node->getProperty('metaRobots...
php
protected function isDocumentNodeToBeIndexed(NodeInterface $node): bool { return !$node->getNodeType()->isOfType('Neos.Seo:NoindexMixin') && $node->isVisible() && ($this->getRenderHiddenInIndex() || !$node->isHiddenInIndex()) && $node->isAccessible() && $node->getProperty('metaRobots...
[ "protected", "function", "isDocumentNodeToBeIndexed", "(", "NodeInterface", "$", "node", ")", ":", "bool", "{", "return", "!", "$", "node", "->", "getNodeType", "(", ")", "->", "isOfType", "(", "'Neos.Seo:NoindexMixin'", ")", "&&", "$", "node", "->", "isVisibl...
Return TRUE/FALSE if the node is currently hidden; taking the "renderHiddenInIndex" configuration of the Menu Fusion object into account. @param NodeInterface $node @return bool @throws NodeException
[ "Return", "TRUE", "/", "FALSE", "if", "the", "node", "is", "currently", "hidden", ";", "taking", "the", "renderHiddenInIndex", "configuration", "of", "the", "Menu", "Fusion", "object", "into", "account", "." ]
train
https://github.com/neos/neos-seo/blob/dc494526e0c216bf19fcf7f52c73f6da496e30a1/Classes/Fusion/XmlSitemapUrlsImplementation.php#L186-L191
neos/neos-seo
Classes/Fusion/XmlSitemapUrlsImplementation.php
XmlSitemapUrlsImplementation.evaluate
public function evaluate(): array { if ($this->items === null) { $items = []; try { $this->appendItems($items, $this->getStartingPoint()); } catch (NodeException $e) { } $this->items = $items; } return $this->items...
php
public function evaluate(): array { if ($this->items === null) { $items = []; try { $this->appendItems($items, $this->getStartingPoint()); } catch (NodeException $e) { } $this->items = $items; } return $this->items...
[ "public", "function", "evaluate", "(", ")", ":", "array", "{", "if", "(", "$", "this", "->", "items", "===", "null", ")", "{", "$", "items", "=", "[", "]", ";", "try", "{", "$", "this", "->", "appendItems", "(", "$", "items", ",", "$", "this", ...
Evaluate this Fusion object and return the result @return array
[ "Evaluate", "this", "Fusion", "object", "and", "return", "the", "result" ]
train
https://github.com/neos/neos-seo/blob/dc494526e0c216bf19fcf7f52c73f6da496e30a1/Classes/Fusion/XmlSitemapUrlsImplementation.php#L198-L211
johnbillion/extended-template-parts
src/extended-template-part.php
Extended_Template_Part.get_output
public function get_output() : string { $output = ( false !== $this->args['cache'] ) ? $this->get_cache() : ''; if ( $output ) { return $output; } ob_start(); if ( $this->has_template() ) { $this->load_template( $this->locate_template() ); } $output = ob_get_clean(); if ( false !== $this->args[...
php
public function get_output() : string { $output = ( false !== $this->args['cache'] ) ? $this->get_cache() : ''; if ( $output ) { return $output; } ob_start(); if ( $this->has_template() ) { $this->load_template( $this->locate_template() ); } $output = ob_get_clean(); if ( false !== $this->args[...
[ "public", "function", "get_output", "(", ")", ":", "string", "{", "$", "output", "=", "(", "false", "!==", "$", "this", "->", "args", "[", "'cache'", "]", ")", "?", "$", "this", "->", "get_cache", "(", ")", ":", "''", ";", "if", "(", "$", "output...
Gets the output of the template part. @return string The template part output.
[ "Gets", "the", "output", "of", "the", "template", "part", "." ]
train
https://github.com/johnbillion/extended-template-parts/blob/c61293355847b1f9d18f9a6e1d047df85bae8049/src/extended-template-part.php#L75-L94
johnbillion/extended-template-parts
src/extended-template-part.php
Extended_Template_Part.locate_template
protected function locate_template() : string { if ( isset( $this->template ) ) { return $this->template; } $templates = []; if ( ! empty( $this->name ) ) { $templates[] = "{$this->args['dir']}/{$this->slug}-{$this->name}.php"; } $templates[] = "{$this->args['dir']}/{$this->slug}.php"; $this->t...
php
protected function locate_template() : string { if ( isset( $this->template ) ) { return $this->template; } $templates = []; if ( ! empty( $this->name ) ) { $templates[] = "{$this->args['dir']}/{$this->slug}-{$this->name}.php"; } $templates[] = "{$this->args['dir']}/{$this->slug}.php"; $this->t...
[ "protected", "function", "locate_template", "(", ")", ":", "string", "{", "if", "(", "isset", "(", "$", "this", "->", "template", ")", ")", "{", "return", "$", "this", "->", "template", ";", "}", "$", "templates", "=", "[", "]", ";", "if", "(", "!"...
Locate the template part file according to the slug and name. @return string The template part file name. Empty string if none is found.
[ "Locate", "the", "template", "part", "file", "according", "to", "the", "slug", "and", "name", "." ]
train
https://github.com/johnbillion/extended-template-parts/blob/c61293355847b1f9d18f9a6e1d047df85bae8049/src/extended-template-part.php#L119-L140
johnbillion/extended-template-parts
src/extended-template-part.php
Extended_Template_Part.load_template
protected function load_template( string $template_file ) { global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; if ( 0 !== validate_file( $template_file ) ) { return; } require $template_file; }
php
protected function load_template( string $template_file ) { global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; if ( 0 !== validate_file( $template_file ) ) { return; } require $template_file; }
[ "protected", "function", "load_template", "(", "string", "$", "template_file", ")", "{", "global", "$", "posts", ",", "$", "post", ",", "$", "wp_did_header", ",", "$", "wp_query", ",", "$", "wp_rewrite", ",", "$", "wpdb", ",", "$", "wp_version", ",", "$"...
Load the template part. @param string $template_file The template part file path.
[ "Load", "the", "template", "part", "." ]
train
https://github.com/johnbillion/extended-template-parts/blob/c61293355847b1f9d18f9a6e1d047df85bae8049/src/extended-template-part.php#L147-L153
johnbillion/extended-template-parts
src/extended-template-part.php
Extended_Template_Part.set_cache
protected function set_cache( string $output ) : bool { return set_transient( $this->cache_key(), $output, $this->args['cache'] ); }
php
protected function set_cache( string $output ) : bool { return set_transient( $this->cache_key(), $output, $this->args['cache'] ); }
[ "protected", "function", "set_cache", "(", "string", "$", "output", ")", ":", "bool", "{", "return", "set_transient", "(", "$", "this", "->", "cache_key", "(", ")", ",", "$", "output", ",", "$", "this", "->", "args", "[", "'cache'", "]", ")", ";", "}...
Cache the template part output. @param string $output The template part output. @return bool Whether the transient data was successfully stored.
[ "Cache", "the", "template", "part", "output", "." ]
train
https://github.com/johnbillion/extended-template-parts/blob/c61293355847b1f9d18f9a6e1d047df85bae8049/src/extended-template-part.php#L170-L172
Nohac/laravel-graphiql
src/GraphiqlServiceProvider.php
GraphiqlServiceProvider.boot
public function boot() { $viewPath = __DIR__.'/../resources/views'; $this->loadViewsFrom($viewPath, 'graphiql'); // Publish a config file $configPath = __DIR__.'/../config/graphiql.php'; $this->publishes([ $configPath => config_path('graphiql.php'), ], 'c...
php
public function boot() { $viewPath = __DIR__.'/../resources/views'; $this->loadViewsFrom($viewPath, 'graphiql'); // Publish a config file $configPath = __DIR__.'/../config/graphiql.php'; $this->publishes([ $configPath => config_path('graphiql.php'), ], 'c...
[ "public", "function", "boot", "(", ")", "{", "$", "viewPath", "=", "__DIR__", ".", "'/../resources/views'", ";", "$", "this", "->", "loadViewsFrom", "(", "$", "viewPath", ",", "'graphiql'", ")", ";", "// Publish a config file", "$", "configPath", "=", "__DIR__...
Bootstrap the application events. @return void
[ "Bootstrap", "the", "application", "events", "." ]
train
https://github.com/Nohac/laravel-graphiql/blob/c2a3ce1f7a577de839bc3df642d3517a90702106/src/GraphiqlServiceProvider.php#L15-L44
Nohac/laravel-graphiql
src/GraphiqlServiceProvider.php
GraphiqlServiceProvider.register
public function register() { $configPath = __DIR__.'/../config/graphiql.php'; $this->mergeConfigFrom($configPath, 'graphiql'); if ($this->app->runningInConsole()) { $this->commands([ PublishCommand::class ]); } }
php
public function register() { $configPath = __DIR__.'/../config/graphiql.php'; $this->mergeConfigFrom($configPath, 'graphiql'); if ($this->app->runningInConsole()) { $this->commands([ PublishCommand::class ]); } }
[ "public", "function", "register", "(", ")", "{", "$", "configPath", "=", "__DIR__", ".", "'/../config/graphiql.php'", ";", "$", "this", "->", "mergeConfigFrom", "(", "$", "configPath", ",", "'graphiql'", ")", ";", "if", "(", "$", "this", "->", "app", "->",...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/Nohac/laravel-graphiql/blob/c2a3ce1f7a577de839bc3df642d3517a90702106/src/GraphiqlServiceProvider.php#L51-L60
ray-di/Ray.Di
src/AbstractModule.php
AbstractModule.override
public function override(self $module) { $module->getContainer()->merge($this->container); $this->container = $module->getContainer(); }
php
public function override(self $module) { $module->getContainer()->merge($this->container); $this->container = $module->getContainer(); }
[ "public", "function", "override", "(", "self", "$", "module", ")", "{", "$", "module", "->", "getContainer", "(", ")", "->", "merge", "(", "$", "this", "->", "container", ")", ";", "$", "this", "->", "container", "=", "$", "module", "->", "getContainer...
Override module
[ "Override", "module" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AbstractModule.php#L54-L58
ray-di/Ray.Di
src/AbstractModule.php
AbstractModule.bindInterceptor
public function bindInterceptor(AbstractMatcher $classMatcher, AbstractMatcher $methodMatcher, array $interceptors) { $pointcut = new Pointcut($classMatcher, $methodMatcher, $interceptors); $this->container->addPointcut($pointcut); foreach ($interceptors as $interceptor) { (new B...
php
public function bindInterceptor(AbstractMatcher $classMatcher, AbstractMatcher $methodMatcher, array $interceptors) { $pointcut = new Pointcut($classMatcher, $methodMatcher, $interceptors); $this->container->addPointcut($pointcut); foreach ($interceptors as $interceptor) { (new B...
[ "public", "function", "bindInterceptor", "(", "AbstractMatcher", "$", "classMatcher", ",", "AbstractMatcher", "$", "methodMatcher", ",", "array", "$", "interceptors", ")", "{", "$", "pointcut", "=", "new", "Pointcut", "(", "$", "classMatcher", ",", "$", "methodM...
Bind interceptor @param string[] $interceptors
[ "Bind", "interceptor" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AbstractModule.php#L77-L84
ray-di/Ray.Di
src/AbstractModule.php
AbstractModule.bindPriorityInterceptor
public function bindPriorityInterceptor(AbstractMatcher $classMatcher, AbstractMatcher $methodMatcher, array $interceptors) { $pointcut = new PriorityPointcut($classMatcher, $methodMatcher, $interceptors); $this->container->addPointcut($pointcut); foreach ($interceptors as $interceptor) { ...
php
public function bindPriorityInterceptor(AbstractMatcher $classMatcher, AbstractMatcher $methodMatcher, array $interceptors) { $pointcut = new PriorityPointcut($classMatcher, $methodMatcher, $interceptors); $this->container->addPointcut($pointcut); foreach ($interceptors as $interceptor) { ...
[ "public", "function", "bindPriorityInterceptor", "(", "AbstractMatcher", "$", "classMatcher", ",", "AbstractMatcher", "$", "methodMatcher", ",", "array", "$", "interceptors", ")", "{", "$", "pointcut", "=", "new", "PriorityPointcut", "(", "$", "classMatcher", ",", ...
Bind interceptor early
[ "Bind", "interceptor", "early" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AbstractModule.php#L89-L96
ray-di/Ray.Di
src/AbstractModule.php
AbstractModule.rename
public function rename(string $interface, string $newName, string $sourceName = Name::ANY, string $targetInterface = '') { $targetInterface = $targetInterface ?: $interface; if ($this->lastModule instanceof self) { $this->lastModule->getContainer()->move($interface, $sourceName, $targetI...
php
public function rename(string $interface, string $newName, string $sourceName = Name::ANY, string $targetInterface = '') { $targetInterface = $targetInterface ?: $interface; if ($this->lastModule instanceof self) { $this->lastModule->getContainer()->move($interface, $sourceName, $targetI...
[ "public", "function", "rename", "(", "string", "$", "interface", ",", "string", "$", "newName", ",", "string", "$", "sourceName", "=", "Name", "::", "ANY", ",", "string", "$", "targetInterface", "=", "''", ")", "{", "$", "targetInterface", "=", "$", "tar...
Rename binding name @param string $interface Interface @param string $newName New binding name @param string $sourceName Original binding name @param string $targetInterface Original interface
[ "Rename", "binding", "name" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AbstractModule.php#L106-L112
ray-di/Ray.Di
src/AnnotatedClass.php
AnnotatedClass.getNewInstance
public function getNewInstance(\ReflectionClass $class) : NewInstance { $setterMethods = new SetterMethods([]); $methods = $class->getMethods(); foreach ($methods as $method) { if ($method->name === '__construct') { continue; } $setterMetho...
php
public function getNewInstance(\ReflectionClass $class) : NewInstance { $setterMethods = new SetterMethods([]); $methods = $class->getMethods(); foreach ($methods as $method) { if ($method->name === '__construct') { continue; } $setterMetho...
[ "public", "function", "getNewInstance", "(", "\\", "ReflectionClass", "$", "class", ")", ":", "NewInstance", "{", "$", "setterMethods", "=", "new", "SetterMethods", "(", "[", "]", ")", ";", "$", "methods", "=", "$", "class", "->", "getMethods", "(", ")", ...
Return factory instance @param \ReflectionClass $class Target class reflection
[ "Return", "factory", "instance" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AnnotatedClass.php#L33-L46
ray-di/Ray.Di
src/AnnotatedClass.php
AnnotatedClass.getPostConstruct
public function getPostConstruct(\ReflectionClass $class) { $methods = $class->getMethods(); foreach ($methods as $method) { /* @var $annotation PostConstruct|null */ $annotation = $this->reader->getMethodAnnotation($method, PostConstruct::class); if ($annotation ...
php
public function getPostConstruct(\ReflectionClass $class) { $methods = $class->getMethods(); foreach ($methods as $method) { /* @var $annotation PostConstruct|null */ $annotation = $this->reader->getMethodAnnotation($method, PostConstruct::class); if ($annotation ...
[ "public", "function", "getPostConstruct", "(", "\\", "ReflectionClass", "$", "class", ")", "{", "$", "methods", "=", "$", "class", "->", "getMethods", "(", ")", ";", "foreach", "(", "$", "methods", "as", "$", "method", ")", "{", "/* @var $annotation PostCons...
Return @-PostConstruct method reflection @return null|\ReflectionMethod
[ "Return", "@", "-", "PostConstruct", "method", "reflection" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AnnotatedClass.php#L53-L63
ray-di/Ray.Di
src/AssistedInterceptor.php
AssistedInterceptor.invoke
public function invoke(MethodInvocation $invocation) { /** @var ReflectionMethod $method */ $method = $invocation->getMethod(); $assisted = $method->getAnnotation(Assisted::class); /* @var \Ray\Di\Di\Assisted $assisted */ $parameters = $method->getParameters(); $argum...
php
public function invoke(MethodInvocation $invocation) { /** @var ReflectionMethod $method */ $method = $invocation->getMethod(); $assisted = $method->getAnnotation(Assisted::class); /* @var \Ray\Di\Di\Assisted $assisted */ $parameters = $method->getParameters(); $argum...
[ "public", "function", "invoke", "(", "MethodInvocation", "$", "invocation", ")", "{", "/** @var ReflectionMethod $method */", "$", "method", "=", "$", "invocation", "->", "getMethod", "(", ")", ";", "$", "assisted", "=", "$", "method", "->", "getAnnotation", "("...
Intercepts any method and injects instances of the missing arguments when they are type hinted @return object
[ "Intercepts", "any", "method", "and", "injects", "instances", "of", "the", "missing", "arguments", "when", "they", "are", "type", "hinted" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AssistedInterceptor.php#L37-L52
ray-di/Ray.Di
src/AssistedInterceptor.php
AssistedInterceptor.getName
private function getName(ReflectionMethod $method, \ReflectionParameter $parameter) : string { $named = $method->getAnnotation(Named::class); if (! $named instanceof Named) { return Name::ANY; } parse_str($named->value, $names); $paramName = $parameter->getName();...
php
private function getName(ReflectionMethod $method, \ReflectionParameter $parameter) : string { $named = $method->getAnnotation(Named::class); if (! $named instanceof Named) { return Name::ANY; } parse_str($named->value, $names); $paramName = $parameter->getName();...
[ "private", "function", "getName", "(", "ReflectionMethod", "$", "method", ",", "\\", "ReflectionParameter", "$", "parameter", ")", ":", "string", "{", "$", "named", "=", "$", "method", "->", "getAnnotation", "(", "Named", "::", "class", ")", ";", "if", "("...
Return dependency "name"
[ "Return", "dependency", "name" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AssistedInterceptor.php#L77-L90
ray-di/Ray.Di
src/Dependency.php
Dependency.register
public function register(array &$container, Bind $bind) { $this->index = $index = (string) $bind; $container[$index] = $bind->getBound(); }
php
public function register(array &$container, Bind $bind) { $this->index = $index = (string) $bind; $container[$index] = $bind->getBound(); }
[ "public", "function", "register", "(", "array", "&", "$", "container", ",", "Bind", "$", "bind", ")", "{", "$", "this", "->", "index", "=", "$", "index", "=", "(", "string", ")", "$", "bind", ";", "$", "container", "[", "$", "index", "]", "=", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Dependency.php#L63-L67
ray-di/Ray.Di
src/Dependency.php
Dependency.inject
public function inject(Container $container) { // singleton ? if ($this->isSingleton === true && $this->instance) { return $this->instance; } // create dependency injected instance $this->instance = ($this->newInstance)($container); // @PostConstruct ...
php
public function inject(Container $container) { // singleton ? if ($this->isSingleton === true && $this->instance) { return $this->instance; } // create dependency injected instance $this->instance = ($this->newInstance)($container); // @PostConstruct ...
[ "public", "function", "inject", "(", "Container", "$", "container", ")", "{", "// singleton ?", "if", "(", "$", "this", "->", "isSingleton", "===", "true", "&&", "$", "this", "->", "instance", ")", "{", "return", "$", "this", "->", "instance", ";", "}", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Dependency.php#L72-L88
ray-di/Ray.Di
src/BindValidator.php
BindValidator.to
public function to(string $interface, string $class) { if (! class_exists($class)) { throw new NotFound($class); } if (interface_exists($interface) && ! (new \ReflectionClass($class))->implementsInterface($interface)) { $msg = "[{$class}] is no implemented [{$interfac...
php
public function to(string $interface, string $class) { if (! class_exists($class)) { throw new NotFound($class); } if (interface_exists($interface) && ! (new \ReflectionClass($class))->implementsInterface($interface)) { $msg = "[{$class}] is no implemented [{$interfac...
[ "public", "function", "to", "(", "string", "$", "interface", ",", "string", "$", "class", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw", "new", "NotFound", "(", "$", "class", ")", ";", "}", "if", "(", "interfac...
To validator
[ "To", "validator" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/BindValidator.php#L23-L33
ray-di/Ray.Di
src/BindValidator.php
BindValidator.toProvider
public function toProvider(string $provider) { if (! class_exists($provider)) { throw new NotFound($provider); } if (! (new \ReflectionClass($provider))->implementsInterface(ProviderInterface::class)) { throw new InvalidProvider($provider); } }
php
public function toProvider(string $provider) { if (! class_exists($provider)) { throw new NotFound($provider); } if (! (new \ReflectionClass($provider))->implementsInterface(ProviderInterface::class)) { throw new InvalidProvider($provider); } }
[ "public", "function", "toProvider", "(", "string", "$", "provider", ")", "{", "if", "(", "!", "class_exists", "(", "$", "provider", ")", ")", "{", "throw", "new", "NotFound", "(", "$", "provider", ")", ";", "}", "if", "(", "!", "(", "new", "\\", "R...
toProvider validator @throws NotFound
[ "toProvider", "validator" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/BindValidator.php#L40-L48
ray-di/Ray.Di
src/Container.php
Container.add
public function add(Bind $bind) { $dependency = $bind->getBound(); $dependency->register($this->container, $bind); }
php
public function add(Bind $bind) { $dependency = $bind->getBound(); $dependency->register($this->container, $bind); }
[ "public", "function", "add", "(", "Bind", "$", "bind", ")", "{", "$", "dependency", "=", "$", "bind", "->", "getBound", "(", ")", ";", "$", "dependency", "->", "register", "(", "$", "this", "->", "container", ",", "$", "bind", ")", ";", "}" ]
Add binding to container
[ "Add", "binding", "to", "container" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L33-L37
ray-di/Ray.Di
src/Container.php
Container.getDependency
public function getDependency(string $index) { if (! isset($this->container[$index])) { throw $this->unbound($index); } $dependency = $this->container[$index]; return $dependency->inject($this); }
php
public function getDependency(string $index) { if (! isset($this->container[$index])) { throw $this->unbound($index); } $dependency = $this->container[$index]; return $dependency->inject($this); }
[ "public", "function", "getDependency", "(", "string", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "container", "[", "$", "index", "]", ")", ")", "{", "throw", "$", "this", "->", "unbound", "(", "$", "index", ")", ";", ...
Return dependency injected instance @throws Unbound
[ "Return", "dependency", "injected", "instance" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L60-L68
ray-di/Ray.Di
src/Container.php
Container.move
public function move(string $sourceInterface, string $sourceName, string $targetInterface, string $targetName) { $sourceIndex = $sourceInterface . '-' . $sourceName; if (! isset($this->container[$sourceIndex])) { throw $this->unbound($sourceIndex); } $targetIndex = $targe...
php
public function move(string $sourceInterface, string $sourceName, string $targetInterface, string $targetName) { $sourceIndex = $sourceInterface . '-' . $sourceName; if (! isset($this->container[$sourceIndex])) { throw $this->unbound($sourceIndex); } $targetIndex = $targe...
[ "public", "function", "move", "(", "string", "$", "sourceInterface", ",", "string", "$", "sourceName", ",", "string", "$", "targetInterface", ",", "string", "$", "targetName", ")", "{", "$", "sourceIndex", "=", "$", "sourceInterface", ".", "'-'", ".", "$", ...
Rename existing dependency interface + name
[ "Rename", "existing", "dependency", "interface", "+", "name" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L73-L82
ray-di/Ray.Di
src/Container.php
Container.unbound
public function unbound(string $index) { list($class, $name) = explode('-', $index); if (class_exists($class) && ! (new \ReflectionClass($class))->isAbstract()) { return new Untargeted($class); } return new Unbound("{$class}-{$name}"); }
php
public function unbound(string $index) { list($class, $name) = explode('-', $index); if (class_exists($class) && ! (new \ReflectionClass($class))->isAbstract()) { return new Untargeted($class); } return new Unbound("{$class}-{$name}"); }
[ "public", "function", "unbound", "(", "string", "$", "index", ")", "{", "list", "(", "$", "class", ",", "$", "name", ")", "=", "explode", "(", "'-'", ",", "$", "index", ")", ";", "if", "(", "class_exists", "(", "$", "class", ")", "&&", "!", "(", ...
Return Unbound exception @param string $index {interface}-{bind name} @return Unbound|Untargeted
[ "Return", "Unbound", "exception" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L91-L99
ray-di/Ray.Di
src/Container.php
Container.merge
public function merge(self $container) { $this->container += $container->getContainer(); $this->pointcuts = array_merge($this->pointcuts, $container->getPointcuts()); }
php
public function merge(self $container) { $this->container += $container->getContainer(); $this->pointcuts = array_merge($this->pointcuts, $container->getPointcuts()); }
[ "public", "function", "merge", "(", "self", "$", "container", ")", "{", "$", "this", "->", "container", "+=", "$", "container", "->", "getContainer", "(", ")", ";", "$", "this", "->", "pointcuts", "=", "array_merge", "(", "$", "this", "->", "pointcuts", ...
Merge container
[ "Merge", "container" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L124-L128
ray-di/Ray.Di
src/Container.php
Container.weaveAspects
public function weaveAspects(CompilerInterface $compiler) { foreach ($this->container as $dependency) { if (! $dependency instanceof Dependency) { continue; } $dependency->weaveAspects($compiler, $this->pointcuts); } }
php
public function weaveAspects(CompilerInterface $compiler) { foreach ($this->container as $dependency) { if (! $dependency instanceof Dependency) { continue; } $dependency->weaveAspects($compiler, $this->pointcuts); } }
[ "public", "function", "weaveAspects", "(", "CompilerInterface", "$", "compiler", ")", "{", "foreach", "(", "$", "this", "->", "container", "as", "$", "dependency", ")", "{", "if", "(", "!", "$", "dependency", "instanceof", "Dependency", ")", "{", "continue",...
Weave aspects to all dependency in container
[ "Weave", "aspects", "to", "all", "dependency", "in", "container" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L133-L141
ray-di/Ray.Di
src/Container.php
Container.weaveAspect
public function weaveAspect(Compiler $compiler, Dependency $dependency) : self { $dependency->weaveAspects($compiler, $this->pointcuts); return $this; }
php
public function weaveAspect(Compiler $compiler, Dependency $dependency) : self { $dependency->weaveAspects($compiler, $this->pointcuts); return $this; }
[ "public", "function", "weaveAspect", "(", "Compiler", "$", "compiler", ",", "Dependency", "$", "dependency", ")", ":", "self", "{", "$", "dependency", "->", "weaveAspects", "(", "$", "compiler", ",", "$", "this", "->", "pointcuts", ")", ";", "return", "$",...
Weave aspect to single dependency
[ "Weave", "aspect", "to", "single", "dependency" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Container.php#L146-L151
ray-di/Ray.Di
src/Bind.php
Bind.to
public function to(string $class) : self { $this->untarget = null; $this->validate->to($this->interface, $class); $this->bound = (new DependencyFactory)->newAnnotatedDependency(new \ReflectionClass($class)); $this->container->add($this); return $this; }
php
public function to(string $class) : self { $this->untarget = null; $this->validate->to($this->interface, $class); $this->bound = (new DependencyFactory)->newAnnotatedDependency(new \ReflectionClass($class)); $this->container->add($this); return $this; }
[ "public", "function", "to", "(", "string", "$", "class", ")", ":", "self", "{", "$", "this", "->", "untarget", "=", "null", ";", "$", "this", "->", "validate", "->", "to", "(", "$", "this", "->", "interface", ",", "$", "class", ")", ";", "$", "th...
Bind to class
[ "Bind", "to", "class" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L83-L91
ray-di/Ray.Di
src/Bind.php
Bind.toConstructor
public function toConstructor(string $class, $name, InjectionPoints $injectionPoints = null, string $postConstruct = null) : self { if (\is_array($name)) { $name = $this->getStringName($name); } $this->untarget = null; $postConstructRef = $postConstruct ? new \ReflectionM...
php
public function toConstructor(string $class, $name, InjectionPoints $injectionPoints = null, string $postConstruct = null) : self { if (\is_array($name)) { $name = $this->getStringName($name); } $this->untarget = null; $postConstructRef = $postConstruct ? new \ReflectionM...
[ "public", "function", "toConstructor", "(", "string", "$", "class", ",", "$", "name", ",", "InjectionPoints", "$", "injectionPoints", "=", "null", ",", "string", "$", "postConstruct", "=", "null", ")", ":", "self", "{", "if", "(", "\\", "is_array", "(", ...
Bind to constructor @param string $class class name @param string | array $name "varName=bindName,..." or [[$varName => $bindName],[$varName => $bindName]...] @param InjectionPoints $injectionPoints injection points @param string $postConstruct method name of initialization af...
[ "Bind", "to", "constructor" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L101-L112
ray-di/Ray.Di
src/Bind.php
Bind.toProvider
public function toProvider(string $provider, string $context = '') : self { $this->untarget = null; $this->validate->toProvider($provider); $this->bound = (new DependencyFactory)->newProvider(new \ReflectionClass($provider), $context); $this->container->add($this); return $t...
php
public function toProvider(string $provider, string $context = '') : self { $this->untarget = null; $this->validate->toProvider($provider); $this->bound = (new DependencyFactory)->newProvider(new \ReflectionClass($provider), $context); $this->container->add($this); return $t...
[ "public", "function", "toProvider", "(", "string", "$", "provider", ",", "string", "$", "context", "=", "''", ")", ":", "self", "{", "$", "this", "->", "untarget", "=", "null", ";", "$", "this", "->", "validate", "->", "toProvider", "(", "$", "provider...
Bind to provider
[ "Bind", "to", "provider" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L117-L125
ray-di/Ray.Di
src/Bind.php
Bind.toInstance
public function toInstance($instance) : self { $this->untarget = null; $this->bound = new Instance($instance); $this->container->add($this); return $this; }
php
public function toInstance($instance) : self { $this->untarget = null; $this->bound = new Instance($instance); $this->container->add($this); return $this; }
[ "public", "function", "toInstance", "(", "$", "instance", ")", ":", "self", "{", "$", "this", "->", "untarget", "=", "null", ";", "$", "this", "->", "bound", "=", "new", "Instance", "(", "$", "instance", ")", ";", "$", "this", "->", "container", "->"...
Bind to instance
[ "Bind", "to", "instance" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L130-L137
ray-di/Ray.Di
src/Bind.php
Bind.in
public function in(string $scope) : self { if ($this->bound instanceof Dependency || $this->bound instanceof DependencyProvider) { $this->bound->setScope($scope); } if ($this->untarget) { $this->untarget->setScope($scope); } return $this; }
php
public function in(string $scope) : self { if ($this->bound instanceof Dependency || $this->bound instanceof DependencyProvider) { $this->bound->setScope($scope); } if ($this->untarget) { $this->untarget->setScope($scope); } return $this; }
[ "public", "function", "in", "(", "string", "$", "scope", ")", ":", "self", "{", "if", "(", "$", "this", "->", "bound", "instanceof", "Dependency", "||", "$", "this", "->", "bound", "instanceof", "DependencyProvider", ")", "{", "$", "this", "->", "bound",...
Set scope
[ "Set", "scope" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L142-L152
ray-di/Ray.Di
src/Bind.php
Bind.getStringName
private function getStringName(array $name) : string { $names = array_reduce(array_keys($name), function (array $carry, $key) use ($name) : array { $carry[] .= $key . '=' . $name[(string) $key]; return $carry; }, []); return implode(',', $names); }
php
private function getStringName(array $name) : string { $names = array_reduce(array_keys($name), function (array $carry, $key) use ($name) : array { $carry[] .= $key . '=' . $name[(string) $key]; return $carry; }, []); return implode(',', $names); }
[ "private", "function", "getStringName", "(", "array", "$", "name", ")", ":", "string", "{", "$", "names", "=", "array_reduce", "(", "array_keys", "(", "$", "name", ")", ",", "function", "(", "array", "$", "carry", ",", "$", "key", ")", "use", "(", "$...
Return string input: [['varA' => 'nameA'], ['varB' => 'nameB']] output: "varA=nameA,varB=nameB"
[ "Return", "string" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Bind.php#L175-L184
ray-di/Ray.Di
src/AspectBind.php
AspectBind.inject
public function inject(Container $container) : array { $bindings = $this->bind->getBindings(); foreach ($bindings as &$interceptors) { /* @var string[] $interceptors */ foreach ($interceptors as &$interceptor) { if (\is_string($interceptor)) { ...
php
public function inject(Container $container) : array { $bindings = $this->bind->getBindings(); foreach ($bindings as &$interceptors) { /* @var string[] $interceptors */ foreach ($interceptors as &$interceptor) { if (\is_string($interceptor)) { ...
[ "public", "function", "inject", "(", "Container", "$", "container", ")", ":", "array", "{", "$", "bindings", "=", "$", "this", "->", "bind", "->", "getBindings", "(", ")", ";", "foreach", "(", "$", "bindings", "as", "&", "$", "interceptors", ")", "{", ...
Instantiate interceptors
[ "Instantiate", "interceptors" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/AspectBind.php#L24-L37
ray-di/Ray.Di
src/DependencyFactory.php
DependencyFactory.newAnnotatedDependency
public function newAnnotatedDependency(\ReflectionClass $class) : Dependency { $annotateClass = new AnnotatedClass(new AnnotationReader); $newInstance = $annotateClass->getNewInstance($class); $postConstruct = $annotateClass->getPostConstruct($class); return new Dependency($newInsta...
php
public function newAnnotatedDependency(\ReflectionClass $class) : Dependency { $annotateClass = new AnnotatedClass(new AnnotationReader); $newInstance = $annotateClass->getNewInstance($class); $postConstruct = $annotateClass->getPostConstruct($class); return new Dependency($newInsta...
[ "public", "function", "newAnnotatedDependency", "(", "\\", "ReflectionClass", "$", "class", ")", ":", "Dependency", "{", "$", "annotateClass", "=", "new", "AnnotatedClass", "(", "new", "AnnotationReader", ")", ";", "$", "newInstance", "=", "$", "annotateClass", ...
Create dependency object
[ "Create", "dependency", "object" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/DependencyFactory.php#L14-L21
ray-di/Ray.Di
src/DependencyFactory.php
DependencyFactory.newProvider
public function newProvider(\ReflectionClass $provider, string $context) : DependencyProvider { $dependency = $this->newAnnotatedDependency($provider); return new DependencyProvider($dependency, $context); }
php
public function newProvider(\ReflectionClass $provider, string $context) : DependencyProvider { $dependency = $this->newAnnotatedDependency($provider); return new DependencyProvider($dependency, $context); }
[ "public", "function", "newProvider", "(", "\\", "ReflectionClass", "$", "provider", ",", "string", "$", "context", ")", ":", "DependencyProvider", "{", "$", "dependency", "=", "$", "this", "->", "newAnnotatedDependency", "(", "$", "provider", ")", ";", "return...
Create Provider binding
[ "Create", "Provider", "binding" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/DependencyFactory.php#L26-L31
ray-di/Ray.Di
src/DependencyFactory.php
DependencyFactory.newToConstructor
public function newToConstructor( \ReflectionClass $class, string $name, InjectionPoints $injectionPoints = null, \ReflectionMethod $postConstruct = null ) : Dependency { $setterMethods = $injectionPoints ? $injectionPoints($class->name) : new SetterMethods([]); $newI...
php
public function newToConstructor( \ReflectionClass $class, string $name, InjectionPoints $injectionPoints = null, \ReflectionMethod $postConstruct = null ) : Dependency { $setterMethods = $injectionPoints ? $injectionPoints($class->name) : new SetterMethods([]); $newI...
[ "public", "function", "newToConstructor", "(", "\\", "ReflectionClass", "$", "class", ",", "string", "$", "name", ",", "InjectionPoints", "$", "injectionPoints", "=", "null", ",", "\\", "ReflectionMethod", "$", "postConstruct", "=", "null", ")", ":", "Dependency...
Create ToConstructor binding
[ "Create", "ToConstructor", "binding" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/DependencyFactory.php#L36-L46
ray-di/Ray.Di
src/DependencyProvider.php
DependencyProvider.inject
public function inject(Container $container) { if ($this->isSingleton && $this->instance) { return $this->instance; } $provider = $this->dependency->inject($container); if ($provider instanceof SetContextInterface) { $this->setContext($provider); } ...
php
public function inject(Container $container) { if ($this->isSingleton && $this->instance) { return $this->instance; } $provider = $this->dependency->inject($container); if ($provider instanceof SetContextInterface) { $this->setContext($provider); } ...
[ "public", "function", "inject", "(", "Container", "$", "container", ")", "{", "if", "(", "$", "this", "->", "isSingleton", "&&", "$", "this", "->", "instance", ")", "{", "return", "$", "this", "->", "instance", ";", "}", "$", "provider", "=", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/DependencyProvider.php#L61-L73
ray-di/Ray.Di
src/SpyCompiler.php
SpyCompiler.compile
public function compile(string $class, BindInterface $bind) : string { if ($this->hasNoBinding($class, $bind)) { return $class; } return $class . $this->getInterceptors($bind); }
php
public function compile(string $class, BindInterface $bind) : string { if ($this->hasNoBinding($class, $bind)) { return $class; } return $class . $this->getInterceptors($bind); }
[ "public", "function", "compile", "(", "string", "$", "class", ",", "BindInterface", "$", "bind", ")", ":", "string", "{", "if", "(", "$", "this", "->", "hasNoBinding", "(", "$", "class", ",", "$", "bind", ")", ")", "{", "return", "$", "class", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/SpyCompiler.php#L22-L29
ray-di/Ray.Di
src/InjectionPoint.php
InjectionPoint.getMethod
public function getMethod() : \ReflectionMethod { $class = $this->parameter->getDeclaringClass(); if (! $class instanceof \ReflectionClass) { throw new \LogicException($this->parameter->getName()); } $method = $this->parameter->getDeclaringFunction()->getShortName(); ...
php
public function getMethod() : \ReflectionMethod { $class = $this->parameter->getDeclaringClass(); if (! $class instanceof \ReflectionClass) { throw new \LogicException($this->parameter->getName()); } $method = $this->parameter->getDeclaringFunction()->getShortName(); ...
[ "public", "function", "getMethod", "(", ")", ":", "\\", "ReflectionMethod", "{", "$", "class", "=", "$", "this", "->", "parameter", "->", "getDeclaringClass", "(", ")", ";", "if", "(", "!", "$", "class", "instanceof", "\\", "ReflectionClass", ")", "{", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/InjectionPoint.php#L39-L48
ray-di/Ray.Di
src/InjectionPoint.php
InjectionPoint.getClass
public function getClass() : \ReflectionClass { $class = $this->parameter->getDeclaringClass(); if ($class instanceof \ReflectionClass) { return $class; } throw new \LogicException($this->parameter->getName()); }
php
public function getClass() : \ReflectionClass { $class = $this->parameter->getDeclaringClass(); if ($class instanceof \ReflectionClass) { return $class; } throw new \LogicException($this->parameter->getName()); }
[ "public", "function", "getClass", "(", ")", ":", "\\", "ReflectionClass", "{", "$", "class", "=", "$", "this", "->", "parameter", "->", "getDeclaringClass", "(", ")", ";", "if", "(", "$", "class", "instanceof", "\\", "ReflectionClass", ")", "{", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/InjectionPoint.php#L53-L61
ray-di/Ray.Di
src/InjectionPoint.php
InjectionPoint.getQualifiers
public function getQualifiers() : array { $qualifiers = []; $annotations = $this->reader->getMethodAnnotations($this->getMethod()); foreach ($annotations as $annotation) { $qualifier = $this->reader->getClassAnnotation( new \ReflectionClass($annotation), ...
php
public function getQualifiers() : array { $qualifiers = []; $annotations = $this->reader->getMethodAnnotations($this->getMethod()); foreach ($annotations as $annotation) { $qualifier = $this->reader->getClassAnnotation( new \ReflectionClass($annotation), ...
[ "public", "function", "getQualifiers", "(", ")", ":", "array", "{", "$", "qualifiers", "=", "[", "]", ";", "$", "annotations", "=", "$", "this", "->", "reader", "->", "getMethodAnnotations", "(", "$", "this", "->", "getMethod", "(", ")", ")", ";", "for...
{@inheritdoc}
[ "{" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/InjectionPoint.php#L66-L81
ray-di/Ray.Di
src/Arguments.php
Arguments.inject
public function inject(Container $container) : array { $parameters = $this->arguments; foreach ($parameters as &$parameter) { $parameter = $this->getParameter($container, $parameter); } return $parameters; }
php
public function inject(Container $container) : array { $parameters = $this->arguments; foreach ($parameters as &$parameter) { $parameter = $this->getParameter($container, $parameter); } return $parameters; }
[ "public", "function", "inject", "(", "Container", "$", "container", ")", ":", "array", "{", "$", "parameters", "=", "$", "this", "->", "arguments", ";", "foreach", "(", "$", "parameters", "as", "&", "$", "parameter", ")", "{", "$", "parameter", "=", "$...
Return arguments @throws Exception\Unbound @return Argument[]
[ "Return", "arguments" ]
train
https://github.com/ray-di/Ray.Di/blob/80f8d57949b97942365a71ce94f756816b32eb90/src/Arguments.php#L32-L40
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.parse
public function parse($input = null) { if (null !== $input) { $this->reader->load($input); } return $this->readGeometry(); }
php
public function parse($input = null) { if (null !== $input) { $this->reader->load($input); } return $this->readGeometry(); }
[ "public", "function", "parse", "(", "$", "input", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "input", ")", "{", "$", "this", "->", "reader", "->", "load", "(", "$", "input", ")", ";", "}", "return", "$", "this", "->", "readGeometry", "...
Parse input data @param string $input @return array @throws UnexpectedValueException
[ "Parse", "input", "data" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L129-L136
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.readGeometry
private function readGeometry() { $this->srid = null; try { $this->byteOrder = $this->readByteOrder(); $this->type = $this->readType(); if ($this->hasFlag($this->type, self::WKB_FLAG_SRID)) { $this->srid = $this->readSrid(); ...
php
private function readGeometry() { $this->srid = null; try { $this->byteOrder = $this->readByteOrder(); $this->type = $this->readType(); if ($this->hasFlag($this->type, self::WKB_FLAG_SRID)) { $this->srid = $this->readSrid(); ...
[ "private", "function", "readGeometry", "(", ")", "{", "$", "this", "->", "srid", "=", "null", ";", "try", "{", "$", "this", "->", "byteOrder", "=", "$", "this", "->", "readByteOrder", "(", ")", ";", "$", "this", "->", "type", "=", "$", "this", "->"...
Parse geometry data @return array @throws UnexpectedValueException
[ "Parse", "geometry", "data" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L144-L170
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.getDimensions
private function getDimensions($type) { if ($this->is2D($type)) { return null; } if ($type & (self::WKB_FLAG_SRID | self::WKB_FLAG_M | self::WKB_FLAG_Z)) { return $type & (self::WKB_FLAG_M | self::WKB_FLAG_Z); } return $type - ($type % 1000); }
php
private function getDimensions($type) { if ($this->is2D($type)) { return null; } if ($type & (self::WKB_FLAG_SRID | self::WKB_FLAG_M | self::WKB_FLAG_Z)) { return $type & (self::WKB_FLAG_M | self::WKB_FLAG_Z); } return $type - ($type % 1000); }
[ "private", "function", "getDimensions", "(", "$", "type", ")", "{", "if", "(", "$", "this", "->", "is2D", "(", "$", "type", ")", ")", "{", "return", "null", ";", "}", "if", "(", "$", "type", "&", "(", "self", "::", "WKB_FLAG_SRID", "|", "self", "...
@param int $type @return int|null
[ "@param", "int", "$type" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L200-L211
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.getDimensionType
private function getDimensionType($dimensions) { if ($this->is2D($dimensions)) { return null; } switch ($dimensions) { case (1000): //no break case (self::WKB_FLAG_Z): return 'Z'; case (2000): //...
php
private function getDimensionType($dimensions) { if ($this->is2D($dimensions)) { return null; } switch ($dimensions) { case (1000): //no break case (self::WKB_FLAG_Z): return 'Z'; case (2000): //...
[ "private", "function", "getDimensionType", "(", "$", "dimensions", ")", "{", "if", "(", "$", "this", "->", "is2D", "(", "$", "dimensions", ")", ")", "{", "return", "null", ";", "}", "switch", "(", "$", "dimensions", ")", "{", "case", "(", "1000", ")"...
@param int $dimensions @return string @throws UnexpectedValueException
[ "@param", "int", "$dimensions" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L219-L241
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.getDimensionedPrimitive
private function getDimensionedPrimitive($type) { if (null === $this->dimensions) { return $type; } if ($this->dimensions & (self::WKB_FLAG_Z | self::WKB_FLAG_M)) { return $type | $this->dimensions; } return $type + $this->dimensions; }
php
private function getDimensionedPrimitive($type) { if (null === $this->dimensions) { return $type; } if ($this->dimensions & (self::WKB_FLAG_Z | self::WKB_FLAG_M)) { return $type | $this->dimensions; } return $type + $this->dimensions; }
[ "private", "function", "getDimensionedPrimitive", "(", "$", "type", ")", "{", "if", "(", "null", "===", "$", "this", "->", "dimensions", ")", "{", "return", "$", "type", ";", "}", "if", "(", "$", "this", "->", "dimensions", "&", "(", "self", "::", "W...
@param int $type @return int
[ "@param", "int", "$type" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L248-L259
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.getTypeName
private function getTypeName($type) { switch ($this->getTypePrimitive($type)) { case (self::WKB_TYPE_POINT): $typeName = self::TYPE_POINT; break; case (self::WKB_TYPE_LINESTRING): $typeName = self::TYPE_LINESTRING; break...
php
private function getTypeName($type) { switch ($this->getTypePrimitive($type)) { case (self::WKB_TYPE_POINT): $typeName = self::TYPE_POINT; break; case (self::WKB_TYPE_LINESTRING): $typeName = self::TYPE_LINESTRING; break...
[ "private", "function", "getTypeName", "(", "$", "type", ")", "{", "switch", "(", "$", "this", "->", "getTypePrimitive", "(", "$", "type", ")", ")", "{", "case", "(", "self", "::", "WKB_TYPE_POINT", ")", ":", "$", "typeName", "=", "self", "::", "TYPE_PO...
Get name of data type @param int $type @return string @throws UnexpectedValueException
[ "Get", "name", "of", "data", "type" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L287-L334
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.readPoints
private function readPoints($count) { $points = array(); for ($i = 0; $i < $count; $i++) { $points[] = $this->point(); } return $points; }
php
private function readPoints($count) { $points = array(); for ($i = 0; $i < $count; $i++) { $points[] = $this->point(); } return $points; }
[ "private", "function", "readPoints", "(", "$", "count", ")", "{", "$", "points", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "$", "points", "[", "]", "=", "$"...
@param int $count @return array @throws UnexpectedValueException
[ "@param", "int", "$count" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L381-L390