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
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.readLinearRings
private function readLinearRings($count) { $rings = array(); for ($i = 0; $i < $count; $i++) { $rings[] = $this->readPoints($this->readCount()); } return $rings; }
php
private function readLinearRings($count) { $rings = array(); for ($i = 0; $i < $count; $i++) { $rings[] = $this->readPoints($this->readCount()); } return $rings; }
[ "private", "function", "readLinearRings", "(", "$", "count", ")", "{", "$", "rings", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "$", "rings", "[", "]", "=", ...
@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#L398-L407
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.multiPoint
private function multiPoint() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_POINT) !== $type) { t...
php
private function multiPoint() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_POINT) !== $type) { t...
[ "private", "function", "multiPoint", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i",...
Parse MULTIPOINT value @return array[] @throws UnexpectedValueException
[ "Parse", "MULTIPOINT", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L459-L477
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.multiLineString
private function multiLineString() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_LINESTRING) !== $type) { ...
php
private function multiLineString() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_LINESTRING) !== $type) { ...
[ "private", "function", "multiLineString", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", ...
Parse MULTILINESTRING value @return array[] @throws UnexpectedValueException
[ "Parse", "MULTILINESTRING", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L485-L503
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.multiPolygon
private function multiPolygon() { $count = $this->readCount(); $values = array(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_POLYGON) !== $type) { ...
php
private function multiPolygon() { $count = $this->readCount(); $values = array(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); if ($this->getDimensionedPrimitive(self::WKB_TYPE_POLYGON) !== $type) { ...
[ "private", "function", "multiPolygon", "(", ")", "{", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "$", "values", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i...
Parse MULTIPOLYGON value @return array[] @throws UnexpectedValueException
[ "Parse", "MULTIPOLYGON", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L511-L529
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.compoundCurve
private function compoundCurve() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_TYPE...
php
private function compoundCurve() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_TYPE...
[ "private", "function", "compoundCurve", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "...
Parse COMPOUNDCURVE value @return array @throws UnexpectedValueException
[ "Parse", "COMPOUNDCURVE", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L537-L564
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.multiSurface
private function multiSurface() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_TYPE_...
php
private function multiSurface() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_TYPE_...
[ "private", "function", "multiSurface", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i...
Parse MULTISURFACE value @return array @throws UnexpectedValueException
[ "Parse", "MULTISURFACE", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L648-L676
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.polyhedralSurface
private function polyhedralSurface() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_...
php
private function polyhedralSurface() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); switch ($type) { case ($this->getDimensionedPrimitive(self::WKB_...
[ "private", "function", "polyhedralSurface", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$",...
Parse POLYHEDRALSURFACE value @return array @throws UnexpectedValueException
[ "Parse", "POLYHEDRALSURFACE", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L684-L710
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.geometryCollection
private function geometryCollection() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); $typeName = $this->getTypeName($type); $values[] = array( ...
php
private function geometryCollection() { $values = array(); $count = $this->readCount(); for ($i = 0; $i < $count; $i++) { $this->readByteOrder(); $type = $this->readType(); $typeName = $this->getTypeName($type); $values[] = array( ...
[ "private", "function", "geometryCollection", "(", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "count", "=", "$", "this", "->", "readCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$"...
Parse GEOMETRYCOLLECTION value @return array[] @throws UnexpectedValueException
[ "Parse", "GEOMETRYCOLLECTION", "value" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L718-L736
creof/wkb-parser
lib/CrEOF/Geo/WKB/Parser.php
Parser.getBadTypeInTypeMessage
private function getBadTypeInTypeMessage($childType, $parentType, array $expectedTypes) { if ($this->type !== $parentType) { $parentType = $this->type; } $message = sprintf( ' %s with dimensions 0x%X (%2$d) in %3$s, expected ', $this->getTypeName($childTy...
php
private function getBadTypeInTypeMessage($childType, $parentType, array $expectedTypes) { if ($this->type !== $parentType) { $parentType = $this->type; } $message = sprintf( ' %s with dimensions 0x%X (%2$d) in %3$s, expected ', $this->getTypeName($childTy...
[ "private", "function", "getBadTypeInTypeMessage", "(", "$", "childType", ",", "$", "parentType", ",", "array", "$", "expectedTypes", ")", "{", "if", "(", "$", "this", "->", "type", "!==", "$", "parentType", ")", "{", "$", "parentType", "=", "$", "this", ...
@param int $childType @param int $parentType @param int[] $expectedTypes @return string
[ "@param", "int", "$childType", "@param", "int", "$parentType", "@param", "int", "[]", "$expectedTypes" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Parser.php#L745-L772
creof/wkb-parser
lib/CrEOF/Geo/WKB/Reader.php
Reader.load
public function load($input) { $this->position = 0; $this->previous = 0; if (ord($input) < 32) { $this->input = $input; $this->length = strlen($input); return; } $position = stripos($input, 'x'); if (false !== $position) { ...
php
public function load($input) { $this->position = 0; $this->previous = 0; if (ord($input) < 32) { $this->input = $input; $this->length = strlen($input); return; } $position = stripos($input, 'x'); if (false !== $position) { ...
[ "public", "function", "load", "(", "$", "input", ")", "{", "$", "this", "->", "position", "=", "0", ";", "$", "this", "->", "previous", "=", "0", ";", "if", "(", "ord", "(", "$", "input", ")", "<", "32", ")", "{", "$", "this", "->", "input", ...
@param string $input @throws UnexpectedValueException
[ "@param", "string", "$input" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Reader.php#L87-L107
creof/wkb-parser
lib/CrEOF/Geo/WKB/Reader.php
Reader.readFloats
public function readFloats($count) { $floats = array(); for ($i = 0; $i < $count; $i++) { $float = $this->readFloat(); if (! is_nan($float)) { $floats[] = $float; } } return $floats; }
php
public function readFloats($count) { $floats = array(); for ($i = 0; $i < $count; $i++) { $float = $this->readFloat(); if (! is_nan($float)) { $floats[] = $float; } } return $floats; }
[ "public", "function", "readFloats", "(", "$", "count", ")", "{", "$", "floats", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "$", "float", "=", "$", "this", "-...
@param int $count @return float[] @throws RangeException @throws UnexpectedValueException
[ "@param", "int", "$count" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Reader.php#L175-L188
creof/wkb-parser
lib/CrEOF/Geo/WKB/Reader.php
Reader.unpackInput
private function unpackInput($format) { $code = version_compare(PHP_VERSION, '5.5.0-dev', '>=') ? 'a' : 'A'; try { $result = unpack($format . 'result/' . $code . '*input', $this->input); } catch (\Exception $e) { throw new RangeException($e->getMessage(), $e->getCode...
php
private function unpackInput($format) { $code = version_compare(PHP_VERSION, '5.5.0-dev', '>=') ? 'a' : 'A'; try { $result = unpack($format . 'result/' . $code . '*input', $this->input); } catch (\Exception $e) { throw new RangeException($e->getMessage(), $e->getCode...
[ "private", "function", "unpackInput", "(", "$", "format", ")", "{", "$", "code", "=", "version_compare", "(", "PHP_VERSION", ",", "'5.5.0-dev'", ",", "'>='", ")", "?", "'a'", ":", "'A'", ";", "try", "{", "$", "result", "=", "unpack", "(", "$", "format"...
@param string $format @return array @throws RangeException
[ "@param", "string", "$format" ]
train
https://github.com/creof/wkb-parser/blob/1ddb69da8cc90607dd528fd9992ef1fc10cc8839/lib/CrEOF/Geo/WKB/Reader.php#L244-L257
msgphp/domain
Infrastructure/Doctrine/MappingConfig.php
MappingConfig.interpolate
public function interpolate(string $contents): string { return str_replace('{{ key_max_length }}', (string) ($this->keyMaxLength ?? self::DEFAULT_KEY_MAX_LENGTH), $contents); }
php
public function interpolate(string $contents): string { return str_replace('{{ key_max_length }}', (string) ($this->keyMaxLength ?? self::DEFAULT_KEY_MAX_LENGTH), $contents); }
[ "public", "function", "interpolate", "(", "string", "$", "contents", ")", ":", "string", "{", "return", "str_replace", "(", "'{{ key_max_length }}'", ",", "(", "string", ")", "(", "$", "this", "->", "keyMaxLength", "??", "self", "::", "DEFAULT_KEY_MAX_LENGTH", ...
Replaces config values in template and returns it.
[ "Replaces", "config", "values", "in", "template", "and", "returns", "it", "." ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/Doctrine/MappingConfig.php#L47-L50
msgphp/domain
Infrastructure/Console/Context/ClassContextFactory.php
ClassContextFactory.askRequiredValue
private static function askRequiredValue(StyleInterface $io, ContextElement $element, $emptyValue) { if (null === $emptyValue) { return $element->askString($io); } if (false === $emptyValue) { return $element->askBool($io); } if ([] === $emptyValue) ...
php
private static function askRequiredValue(StyleInterface $io, ContextElement $element, $emptyValue) { if (null === $emptyValue) { return $element->askString($io); } if (false === $emptyValue) { return $element->askBool($io); } if ([] === $emptyValue) ...
[ "private", "static", "function", "askRequiredValue", "(", "StyleInterface", "$", "io", ",", "ContextElement", "$", "element", ",", "$", "emptyValue", ")", "{", "if", "(", "null", "===", "$", "emptyValue", ")", "{", "return", "$", "element", "->", "askString"...
@param mixed $emptyValue @return mixed
[ "@param", "mixed", "$emptyValue" ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/Console/Context/ClassContextFactory.php#L227-L242
msgphp/domain
Infrastructure/ApiPlatform/ProjectionDataProvider.php
ProjectionDataProvider.getCollection
public function getCollection(string $resourceClass, string $operationName = null): iterable { $collection = $this->repository->findAll($resourceClass); return new Paginator(new GenericPaginatedDomainCollection((static function () use ($collection): iterable { foreach ($collection as $d...
php
public function getCollection(string $resourceClass, string $operationName = null): iterable { $collection = $this->repository->findAll($resourceClass); return new Paginator(new GenericPaginatedDomainCollection((static function () use ($collection): iterable { foreach ($collection as $d...
[ "public", "function", "getCollection", "(", "string", "$", "resourceClass", ",", "string", "$", "operationName", "=", "null", ")", ":", "iterable", "{", "$", "collection", "=", "$", "this", "->", "repository", "->", "findAll", "(", "$", "resourceClass", ")",...
@psalm-suppress ImplementedReturnTypeMismatch @return iterable|Projection[]
[ "@psalm", "-", "suppress", "ImplementedReturnTypeMismatch" ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/ApiPlatform/ProjectionDataProvider.php#L46-L55
msgphp/domain
Infrastructure/Doctrine/DomainIdType.php
DomainIdType.resolveName
final public static function resolveName($value): ?string { if ($value instanceof DomainId) { $class = \get_class($value); /** @var string $type */ foreach (self::$mapping as $type => $mapping) { if ($class === $mapping['class']) { ret...
php
final public static function resolveName($value): ?string { if ($value instanceof DomainId) { $class = \get_class($value); /** @var string $type */ foreach (self::$mapping as $type => $mapping) { if ($class === $mapping['class']) { ret...
[ "final", "public", "static", "function", "resolveName", "(", "$", "value", ")", ":", "?", "string", "{", "if", "(", "$", "value", "instanceof", "DomainId", ")", "{", "$", "class", "=", "\\", "get_class", "(", "$", "value", ")", ";", "/** @var string $typ...
@param mixed $value @internal
[ "@param", "mixed", "$value" ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/Doctrine/DomainIdType.php#L71-L87
msgphp/domain
Infrastructure/Doctrine/DomainIdType.php
DomainIdType.resolveValue
final public static function resolveValue($value, AbstractPlatform $platform) { if ($value instanceof DomainId) { $class = \get_class($value); $type = Type::INTEGER; foreach (self::$mapping as $mapping) { if ($class === $mapping['class']) { ...
php
final public static function resolveValue($value, AbstractPlatform $platform) { if ($value instanceof DomainId) { $class = \get_class($value); $type = Type::INTEGER; foreach (self::$mapping as $mapping) { if ($class === $mapping['class']) { ...
[ "final", "public", "static", "function", "resolveValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "$", "value", "instanceof", "DomainId", ")", "{", "$", "class", "=", "\\", "get_class", "(", "$", "value", ")", ";"...
@param mixed $value @return mixed @internal
[ "@param", "mixed", "$value" ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/Doctrine/DomainIdType.php#L96-L113
msgphp/domain
Infrastructure/Doctrine/DomainEntityRepositoryTrait.php
DomainEntityRepositoryTrait.doFind
private function doFind($id) { $id = $this->toIdentity($id); $entity = null === $id ? null : $this->em->find($this->class, $id); if (null === $entity) { throw EntityNotFoundException::createForId($this->class, $id); } return $entity; }
php
private function doFind($id) { $id = $this->toIdentity($id); $entity = null === $id ? null : $this->em->find($this->class, $id); if (null === $entity) { throw EntityNotFoundException::createForId($this->class, $id); } return $entity; }
[ "private", "function", "doFind", "(", "$", "id", ")", "{", "$", "id", "=", "$", "this", "->", "toIdentity", "(", "$", "id", ")", ";", "$", "entity", "=", "null", "===", "$", "id", "?", "null", ":", "$", "this", "->", "em", "->", "find", "(", ...
@param mixed $id @return object
[ "@param", "mixed", "$id" ]
train
https://github.com/msgphp/domain/blob/e95012b6ea6667bcc5aabe38fa886c52aa13d4f7/Infrastructure/Doctrine/DomainEntityRepositoryTrait.php#L76-L86
Sylius/SyliusFixturesBundle
src/Listener/LoggerListener.php
LoggerListener.beforeSuite
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { $this->logger->notice(sprintf('Running suite "%s"...', $suiteEvent->suite()->getName())); }
php
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { $this->logger->notice(sprintf('Running suite "%s"...', $suiteEvent->suite()->getName())); }
[ "public", "function", "beforeSuite", "(", "SuiteEvent", "$", "suiteEvent", ",", "array", "$", "options", ")", ":", "void", "{", "$", "this", "->", "logger", "->", "notice", "(", "sprintf", "(", "'Running suite \"%s\"...'", ",", "$", "suiteEvent", "->", "suit...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/LoggerListener.php#L31-L34
Sylius/SyliusFixturesBundle
src/Listener/LoggerListener.php
LoggerListener.beforeFixture
public function beforeFixture(FixtureEvent $fixtureEvent, array $options): void { $this->logger->notice(sprintf('Running fixture "%s"...', $fixtureEvent->fixture()->getName())); }
php
public function beforeFixture(FixtureEvent $fixtureEvent, array $options): void { $this->logger->notice(sprintf('Running fixture "%s"...', $fixtureEvent->fixture()->getName())); }
[ "public", "function", "beforeFixture", "(", "FixtureEvent", "$", "fixtureEvent", ",", "array", "$", "options", ")", ":", "void", "{", "$", "this", "->", "logger", "->", "notice", "(", "sprintf", "(", "'Running fixture \"%s\"...'", ",", "$", "fixtureEvent", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/LoggerListener.php#L39-L42
Sylius/SyliusFixturesBundle
src/DependencyInjection/Compiler/FixtureRegistryPass.php
FixtureRegistryPass.process
public function process(ContainerBuilder $container): void { if (!$container->has('sylius_fixtures.fixture_registry')) { return; } $fixtureRegistry = $container->findDefinition('sylius_fixtures.fixture_registry'); $taggedServices = $container->findTaggedServiceIds(self:...
php
public function process(ContainerBuilder $container): void { if (!$container->has('sylius_fixtures.fixture_registry')) { return; } $fixtureRegistry = $container->findDefinition('sylius_fixtures.fixture_registry'); $taggedServices = $container->findTaggedServiceIds(self:...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "if", "(", "!", "$", "container", "->", "has", "(", "'sylius_fixtures.fixture_registry'", ")", ")", "{", "return", ";", "}", "$", "fixtureRegistry", "=", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/DependencyInjection/Compiler/FixtureRegistryPass.php#L27-L39
Sylius/SyliusFixturesBundle
src/Listener/PHPCRPurgerListener.php
PHPCRPurgerListener.configureOptionsNode
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { $optionsNode ->children() ->arrayNode('managers') ->defaultValue([null]) ->scalarPrototype() ; }
php
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { $optionsNode ->children() ->arrayNode('managers') ->defaultValue([null]) ->scalarPrototype() ; }
[ "protected", "function", "configureOptionsNode", "(", "ArrayNodeDefinition", "$", "optionsNode", ")", ":", "void", "{", "$", "optionsNode", "->", "children", "(", ")", "->", "arrayNode", "(", "'managers'", ")", "->", "defaultValue", "(", "[", "null", "]", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/PHPCRPurgerListener.php#L56-L64
Sylius/SyliusFixturesBundle
src/Listener/MongoDBPurgerListener.php
MongoDBPurgerListener.beforeSuite
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { foreach ($options['managers'] as $managerName) { /** @var DocumentManager $manager */ $manager = $this->managerRegistry->getManager($managerName); $purger = new MongoDBPurger($manager); ...
php
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { foreach ($options['managers'] as $managerName) { /** @var DocumentManager $manager */ $manager = $this->managerRegistry->getManager($managerName); $purger = new MongoDBPurger($manager); ...
[ "public", "function", "beforeSuite", "(", "SuiteEvent", "$", "suiteEvent", ",", "array", "$", "options", ")", ":", "void", "{", "foreach", "(", "$", "options", "[", "'managers'", "]", "as", "$", "managerName", ")", "{", "/** @var DocumentManager $manager */", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/MongoDBPurgerListener.php#L34-L43
Sylius/SyliusFixturesBundle
src/Suite/Suite.php
Suite.getFixtures
public function getFixtures(): iterable { $fixtures = clone $this->fixtures; foreach ($fixtures as $fixture) { yield $fixture['fixture'] => $fixture['options']; } }
php
public function getFixtures(): iterable { $fixtures = clone $this->fixtures; foreach ($fixtures as $fixture) { yield $fixture['fixture'] => $fixture['options']; } }
[ "public", "function", "getFixtures", "(", ")", ":", "iterable", "{", "$", "fixtures", "=", "clone", "$", "this", "->", "fixtures", ";", "foreach", "(", "$", "fixtures", "as", "$", "fixture", ")", "{", "yield", "$", "fixture", "[", "'fixture'", "]", "=>...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Suite/Suite.php#L59-L65
Sylius/SyliusFixturesBundle
src/Suite/Suite.php
Suite.getListeners
public function getListeners(): iterable { $listeners = clone $this->listeners; foreach ($listeners as $listener) { yield $listener['listener'] => $listener['options']; } }
php
public function getListeners(): iterable { $listeners = clone $this->listeners; foreach ($listeners as $listener) { yield $listener['listener'] => $listener['options']; } }
[ "public", "function", "getListeners", "(", ")", ":", "iterable", "{", "$", "listeners", "=", "clone", "$", "this", "->", "listeners", ";", "foreach", "(", "$", "listeners", "as", "$", "listener", ")", "{", "yield", "$", "listener", "[", "'listener'", "]"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Suite/Suite.php#L70-L76
Sylius/SyliusFixturesBundle
src/Command/FixturesListCommand.php
FixturesListCommand.execute
protected function execute(InputInterface $input, OutputInterface $output): void { $this->listSuites($output); $this->listFixtures($output); }
php
protected function execute(InputInterface $input, OutputInterface $output): void { $this->listSuites($output); $this->listFixtures($output); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", ":", "void", "{", "$", "this", "->", "listSuites", "(", "$", "output", ")", ";", "$", "this", "->", "listFixtures", "(", "$", "output", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Command/FixturesListCommand.php#L38-L42
Sylius/SyliusFixturesBundle
src/Listener/AbstractListener.php
AbstractListener.getConfigTreeBuilder
final public function getConfigTreeBuilder(): TreeBuilder { if (method_exists(TreeBuilder::class, 'getRootNode')) { $treeBuilder = new TreeBuilder($this->getName()); /** @var ArrayNodeDefinition $optionsNode */ $optionsNode = $treeBuilder->getRootNode(); } else {...
php
final public function getConfigTreeBuilder(): TreeBuilder { if (method_exists(TreeBuilder::class, 'getRootNode')) { $treeBuilder = new TreeBuilder($this->getName()); /** @var ArrayNodeDefinition $optionsNode */ $optionsNode = $treeBuilder->getRootNode(); } else {...
[ "final", "public", "function", "getConfigTreeBuilder", "(", ")", ":", "TreeBuilder", "{", "if", "(", "method_exists", "(", "TreeBuilder", "::", "class", ",", "'getRootNode'", ")", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/AbstractListener.php#L24-L42
Sylius/SyliusFixturesBundle
src/Suite/SuiteFactory.php
SuiteFactory.createSuite
public function createSuite(string $name, array $configuration): SuiteInterface { Assert::keyExists($configuration, 'fixtures'); Assert::keyExists($configuration, 'listeners'); $suite = new Suite($name); foreach ($configuration['fixtures'] as $fixtureAlias => $fixtureAttributes) { ...
php
public function createSuite(string $name, array $configuration): SuiteInterface { Assert::keyExists($configuration, 'fixtures'); Assert::keyExists($configuration, 'listeners'); $suite = new Suite($name); foreach ($configuration['fixtures'] as $fixtureAlias => $fixtureAttributes) { ...
[ "public", "function", "createSuite", "(", "string", "$", "name", ",", "array", "$", "configuration", ")", ":", "SuiteInterface", "{", "Assert", "::", "keyExists", "(", "$", "configuration", ",", "'fixtures'", ")", ";", "Assert", "::", "keyExists", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Suite/SuiteFactory.php#L45-L61
Sylius/SyliusFixturesBundle
src/SyliusFixturesBundle.php
SyliusFixturesBundle.build
public function build(ContainerBuilder $container): void { parent::build($container); $container->addCompilerPass(new FixtureRegistryPass()); $container->addCompilerPass(new ListenerRegistryPass()); }
php
public function build(ContainerBuilder $container): void { parent::build($container); $container->addCompilerPass(new FixtureRegistryPass()); $container->addCompilerPass(new ListenerRegistryPass()); }
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "parent", "::", "build", "(", "$", "container", ")", ";", "$", "container", "->", "addCompilerPass", "(", "new", "FixtureRegistryPass", "(", ")", ")", ";", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/SyliusFixturesBundle.php#L26-L32
Sylius/SyliusFixturesBundle
src/Loader/FixtureLoader.php
FixtureLoader.load
public function load(SuiteInterface $suite, FixtureInterface $fixture, array $options): void { $fixture->load($options); }
php
public function load(SuiteInterface $suite, FixtureInterface $fixture, array $options): void { $fixture->load($options); }
[ "public", "function", "load", "(", "SuiteInterface", "$", "suite", ",", "FixtureInterface", "$", "fixture", ",", "array", "$", "options", ")", ":", "void", "{", "$", "fixture", "->", "load", "(", "$", "options", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Loader/FixtureLoader.php#L24-L27
Sylius/SyliusFixturesBundle
src/Command/FixturesLoadCommand.php
FixturesLoadCommand.execute
protected function execute(InputInterface $input, OutputInterface $output): void { if ($input->isInteractive()) { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); $output->writeln(sprintf( "\n<error>Warning! Loadi...
php
protected function execute(InputInterface $input, OutputInterface $output): void { if ($input->isInteractive()) { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelper('question'); $output->writeln(sprintf( "\n<error>Warning! Loadi...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", ":", "void", "{", "if", "(", "$", "input", "->", "isInteractive", "(", ")", ")", "{", "/** @var QuestionHelper $questionHelper */", "$", "questio...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Command/FixturesLoadCommand.php#L42-L59
Sylius/SyliusFixturesBundle
src/Listener/ORMPurgerListener.php
ORMPurgerListener.beforeSuite
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { foreach ($options['managers'] as $managerName) { /** @var EntityManagerInterface $manager */ $manager = $this->managerRegistry->getManager($managerName); $purger = new ORMPurger($manager, $option...
php
public function beforeSuite(SuiteEvent $suiteEvent, array $options): void { foreach ($options['managers'] as $managerName) { /** @var EntityManagerInterface $manager */ $manager = $this->managerRegistry->getManager($managerName); $purger = new ORMPurger($manager, $option...
[ "public", "function", "beforeSuite", "(", "SuiteEvent", "$", "suiteEvent", ",", "array", "$", "options", ")", ":", "void", "{", "foreach", "(", "$", "options", "[", "'managers'", "]", "as", "$", "managerName", ")", "{", "/** @var EntityManagerInterface $manager ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/ORMPurgerListener.php#L40-L50
Sylius/SyliusFixturesBundle
src/Listener/ORMPurgerListener.php
ORMPurgerListener.configureOptionsNode
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { $optionsNodeBuilder = $optionsNode->children(); $optionsNodeBuilder ->enumNode('mode') ->values(['delete', 'truncate']) ->defaultValue('delete') ; $optionsN...
php
protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { $optionsNodeBuilder = $optionsNode->children(); $optionsNodeBuilder ->enumNode('mode') ->values(['delete', 'truncate']) ->defaultValue('delete') ; $optionsN...
[ "protected", "function", "configureOptionsNode", "(", "ArrayNodeDefinition", "$", "optionsNode", ")", ":", "void", "{", "$", "optionsNodeBuilder", "=", "$", "optionsNode", "->", "children", "(", ")", ";", "$", "optionsNodeBuilder", "->", "enumNode", "(", "'mode'",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/ORMPurgerListener.php#L63-L84
Sylius/SyliusFixturesBundle
src/DependencyInjection/Compiler/ListenerRegistryPass.php
ListenerRegistryPass.process
public function process(ContainerBuilder $container): void { if (!$container->has('sylius_fixtures.listener_registry')) { return; } $listenerRegistry = $container->findDefinition('sylius_fixtures.listener_registry'); $taggedServices = $container->findTaggedServiceIds(se...
php
public function process(ContainerBuilder $container): void { if (!$container->has('sylius_fixtures.listener_registry')) { return; } $listenerRegistry = $container->findDefinition('sylius_fixtures.listener_registry'); $taggedServices = $container->findTaggedServiceIds(se...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "if", "(", "!", "$", "container", "->", "has", "(", "'sylius_fixtures.listener_registry'", ")", ")", "{", "return", ";", "}", "$", "listenerRegistry", "=", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/DependencyInjection/Compiler/ListenerRegistryPass.php#L27-L39
Sylius/SyliusFixturesBundle
src/Loader/HookableSuiteLoader.php
HookableSuiteLoader.load
public function load(SuiteInterface $suite): void { $suiteEvent = new SuiteEvent($suite); $this->executeBeforeSuiteListeners($suite, $suiteEvent); $this->decoratedSuiteLoader->load($suite); $this->executeAfterSuiteListeners($suite, $suiteEvent); }
php
public function load(SuiteInterface $suite): void { $suiteEvent = new SuiteEvent($suite); $this->executeBeforeSuiteListeners($suite, $suiteEvent); $this->decoratedSuiteLoader->load($suite); $this->executeAfterSuiteListeners($suite, $suiteEvent); }
[ "public", "function", "load", "(", "SuiteInterface", "$", "suite", ")", ":", "void", "{", "$", "suiteEvent", "=", "new", "SuiteEvent", "(", "$", "suite", ")", ";", "$", "this", "->", "executeBeforeSuiteListeners", "(", "$", "suite", ",", "$", "suiteEvent",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Loader/HookableSuiteLoader.php#L34-L43
Sylius/SyliusFixturesBundle
src/Loader/SuiteLoader.php
SuiteLoader.load
public function load(SuiteInterface $suite): void { /** @var FixtureInterface $fixture */ /** @var array $fixtureOptions */ foreach ($suite->getFixtures() as $fixture => $fixtureOptions) { $this->fixtureLoader->load($suite, $fixture, $fixtureOptions); } }
php
public function load(SuiteInterface $suite): void { /** @var FixtureInterface $fixture */ /** @var array $fixtureOptions */ foreach ($suite->getFixtures() as $fixture => $fixtureOptions) { $this->fixtureLoader->load($suite, $fixture, $fixtureOptions); } }
[ "public", "function", "load", "(", "SuiteInterface", "$", "suite", ")", ":", "void", "{", "/** @var FixtureInterface $fixture */", "/** @var array $fixtureOptions */", "foreach", "(", "$", "suite", "->", "getFixtures", "(", ")", "as", "$", "fixture", "=>", "$", "f...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Loader/SuiteLoader.php#L32-L39
Sylius/SyliusFixturesBundle
src/DependencyInjection/SyliusFixturesExtension.php
SyliusFixturesExtension.load
public function load(array $config, ContainerBuilder $container): void { $config = $this->processConfiguration($this->getConfiguration([], $container), $config); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.xml'); ...
php
public function load(array $config, ContainerBuilder $container): void { $config = $this->processConfiguration($this->getConfiguration([], $container), $config); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.xml'); ...
[ "public", "function", "load", "(", "array", "$", "config", ",", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "this", "->", "getConfiguration", "(", "[", "]", ",", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/DependencyInjection/SyliusFixturesExtension.php#L40-L57
Sylius/SyliusFixturesBundle
src/DependencyInjection/SyliusFixturesExtension.php
SyliusFixturesExtension.prepend
public function prepend(ContainerBuilder $container): void { $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $extensionsNamesToConfigurationFiles = [ 'doctrine' => 'doctrine/orm.xml', 'doctrine_mongodb' => 'doctrine/mongodb-odm.xml...
php
public function prepend(ContainerBuilder $container): void { $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $extensionsNamesToConfigurationFiles = [ 'doctrine' => 'doctrine/orm.xml', 'doctrine_mongodb' => 'doctrine/mongodb-odm.xml...
[ "public", "function", "prepend", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "$", "loader", "=", "new", "XmlFileLoader", "(", "$", "container", ",", "new", "FileLocator", "(", "__DIR__", ".", "'/../Resources/config'", ")", ")", ";", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/DependencyInjection/SyliusFixturesExtension.php#L62-L79
Sylius/SyliusFixturesBundle
src/Listener/ListenerRegistry.php
ListenerRegistry.getListener
public function getListener(string $name): ListenerInterface { if (!isset($this->listeners[$name])) { throw new ListenerNotFoundException($name); } return $this->listeners[$name]; }
php
public function getListener(string $name): ListenerInterface { if (!isset($this->listeners[$name])) { throw new ListenerNotFoundException($name); } return $this->listeners[$name]; }
[ "public", "function", "getListener", "(", "string", "$", "name", ")", ":", "ListenerInterface", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "listeners", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "ListenerNotFoundException", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Listener/ListenerRegistry.php#L33-L40
Sylius/SyliusFixturesBundle
src/Fixture/FixtureRegistry.php
FixtureRegistry.getFixture
public function getFixture(string $name): FixtureInterface { if (!isset($this->fixtures[$name])) { throw new FixtureNotFoundException($name); } return $this->fixtures[$name]; }
php
public function getFixture(string $name): FixtureInterface { if (!isset($this->fixtures[$name])) { throw new FixtureNotFoundException($name); } return $this->fixtures[$name]; }
[ "public", "function", "getFixture", "(", "string", "$", "name", ")", ":", "FixtureInterface", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fixtures", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "FixtureNotFoundException", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Fixture/FixtureRegistry.php#L33-L40
Sylius/SyliusFixturesBundle
src/Suite/LazySuiteRegistry.php
LazySuiteRegistry.getSuite
public function getSuite(string $name): SuiteInterface { if (isset($this->suites[$name])) { return $this->suites[$name]; } if (!isset($this->suiteDefinitions[$name])) { throw new SuiteNotFoundException($name); } return $this->suites[$name] = $this->s...
php
public function getSuite(string $name): SuiteInterface { if (isset($this->suites[$name])) { return $this->suites[$name]; } if (!isset($this->suiteDefinitions[$name])) { throw new SuiteNotFoundException($name); } return $this->suites[$name] = $this->s...
[ "public", "function", "getSuite", "(", "string", "$", "name", ")", ":", "SuiteInterface", "{", "if", "(", "isset", "(", "$", "this", "->", "suites", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "suites", "[", "$", "name", "]",...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Suite/LazySuiteRegistry.php#L40-L51
Sylius/SyliusFixturesBundle
src/Suite/LazySuiteRegistry.php
LazySuiteRegistry.getSuites
public function getSuites(): array { $suites = []; foreach (array_keys($this->suiteDefinitions) as $name) { $suites[$name] = $this->getSuite($name); } return $suites; }
php
public function getSuites(): array { $suites = []; foreach (array_keys($this->suiteDefinitions) as $name) { $suites[$name] = $this->getSuite($name); } return $suites; }
[ "public", "function", "getSuites", "(", ")", ":", "array", "{", "$", "suites", "=", "[", "]", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "suiteDefinitions", ")", "as", "$", "name", ")", "{", "$", "suites", "[", "$", "name", "]", "="...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Suite/LazySuiteRegistry.php#L56-L64
Sylius/SyliusFixturesBundle
src/Loader/HookableFixtureLoader.php
HookableFixtureLoader.load
public function load(SuiteInterface $suite, FixtureInterface $fixture, array $options): void { $fixtureEvent = new FixtureEvent($suite, $fixture, $options); $this->executeBeforeFixtureListeners($suite, $fixtureEvent); $this->decoratedFixtureLoader->load($suite, $fixture, $options); ...
php
public function load(SuiteInterface $suite, FixtureInterface $fixture, array $options): void { $fixtureEvent = new FixtureEvent($suite, $fixture, $options); $this->executeBeforeFixtureListeners($suite, $fixtureEvent); $this->decoratedFixtureLoader->load($suite, $fixture, $options); ...
[ "public", "function", "load", "(", "SuiteInterface", "$", "suite", ",", "FixtureInterface", "$", "fixture", ",", "array", "$", "options", ")", ":", "void", "{", "$", "fixtureEvent", "=", "new", "FixtureEvent", "(", "$", "suite", ",", "$", "fixture", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/Loader/HookableFixtureLoader.php#L35-L44
Sylius/SyliusFixturesBundle
src/DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder(): TreeBuilder { if (method_exists(TreeBuilder::class, 'getRootNode')) { $treeBuilder = new TreeBuilder('sylius_fixtures'); /** @var ArrayNodeDefinition $rootNode */ $rootNode = $treeBuilder->getRootNode(); } else { ...
php
public function getConfigTreeBuilder(): TreeBuilder { if (method_exists(TreeBuilder::class, 'getRootNode')) { $treeBuilder = new TreeBuilder('sylius_fixtures'); /** @var ArrayNodeDefinition $rootNode */ $rootNode = $treeBuilder->getRootNode(); } else { ...
[ "public", "function", "getConfigTreeBuilder", "(", ")", ":", "TreeBuilder", "{", "if", "(", "method_exists", "(", "TreeBuilder", "::", "class", ",", "'getRootNode'", ")", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'sylius_fixtures'", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/Sylius/SyliusFixturesBundle/blob/f7543ea10ac5bb0dce93129dcd12a7996d1beac1/src/DependencyInjection/Configuration.php#L25-L43
contributte/di
src/Extension/NewExtensionsExtension.php
NewExtensionsExtension.loadConfiguration
public function loadConfiguration(): void { $extensions = []; // Collect all extensions foreach ($this->getConfig() as $name => $extension) { if (is_int($name)) { $name = null; } if (is_array($extension)) { $extension = array_merge([ 'priority' => 10, ], $extension); if (!array_k...
php
public function loadConfiguration(): void { $extensions = []; // Collect all extensions foreach ($this->getConfig() as $name => $extension) { if (is_int($name)) { $name = null; } if (is_array($extension)) { $extension = array_merge([ 'priority' => 10, ], $extension); if (!array_k...
[ "public", "function", "loadConfiguration", "(", ")", ":", "void", "{", "$", "extensions", "=", "[", "]", ";", "// Collect all extensions", "foreach", "(", "$", "this", "->", "getConfig", "(", ")", "as", "$", "name", "=>", "$", "extension", ")", "{", "if"...
Register other extensions with pleasure.
[ "Register", "other", "extensions", "with", "pleasure", "." ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/NewExtensionsExtension.php#L15-L76
contributte/di
src/Extension/ContainerAwareExtension.php
ContainerAwareExtension.beforeCompile
public function beforeCompile(): void { $builder = $this->getContainerBuilder(); // Register as services foreach ($builder->findByType(IContainerAware::class) as $service) { $service->addSetup('setContainer'); } }
php
public function beforeCompile(): void { $builder = $this->getContainerBuilder(); // Register as services foreach ($builder->findByType(IContainerAware::class) as $service) { $service->addSetup('setContainer'); } }
[ "public", "function", "beforeCompile", "(", ")", ":", "void", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "// Register as services", "foreach", "(", "$", "builder", "->", "findByType", "(", "IContainerAware", "::", "class...
Tweak DI container
[ "Tweak", "DI", "container" ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/ContainerAwareExtension.php#L14-L22
contributte/di
src/Extension/ResourceExtension.php
ResourceExtension.loadConfiguration
public function loadConfiguration(): void { $builder = $this->getContainerBuilder(); // Expand config (cause %appDir% etc..) $config = $this->validateConfig($this->defaults); $config = $this->config = Helpers::expand($config, $builder->parameters); foreach ($config['resources'] as $namespace => $resource) ...
php
public function loadConfiguration(): void { $builder = $this->getContainerBuilder(); // Expand config (cause %appDir% etc..) $config = $this->validateConfig($this->defaults); $config = $this->config = Helpers::expand($config, $builder->parameters); foreach ($config['resources'] as $namespace => $resource) ...
[ "public", "function", "loadConfiguration", "(", ")", ":", "void", "{", "$", "builder", "=", "$", "this", "->", "getContainerBuilder", "(", ")", ";", "// Expand config (cause %appDir% etc..)", "$", "config", "=", "$", "this", "->", "validateConfig", "(", "$", "...
Register services
[ "Register", "services" ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/ResourceExtension.php#L42-L100
contributte/di
src/Extension/ResourceExtension.php
ResourceExtension.findClasses
protected function findClasses(string $namespace, array $dirs, array $excludes = []): array { $loader = $this->createLoader(); $loader->addDirectory($dirs); $loader->rebuild(); $indexed = $loader->getIndexedClasses(); $classes = []; foreach ($indexed as $class => $file) { // Different namespace if (...
php
protected function findClasses(string $namespace, array $dirs, array $excludes = []): array { $loader = $this->createLoader(); $loader->addDirectory($dirs); $loader->rebuild(); $indexed = $loader->getIndexedClasses(); $classes = []; foreach ($indexed as $class => $file) { // Different namespace if (...
[ "protected", "function", "findClasses", "(", "string", "$", "namespace", ",", "array", "$", "dirs", ",", "array", "$", "excludes", "=", "[", "]", ")", ":", "array", "{", "$", "loader", "=", "$", "this", "->", "createLoader", "(", ")", ";", "$", "load...
Find classes by given arguments @param string[] $dirs @param string[] $excludes @return string[]
[ "Find", "classes", "by", "given", "arguments" ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/ResourceExtension.php#L109-L140
contributte/di
src/Extension/InjectValueExtension.php
InjectValueExtension.beforeCompile
public function beforeCompile(): void { $config = $this->validateConfig($this->defaults); $definitions = $config['all'] === true ? $this->getContainerBuilder()->getDefinitions() : array_map( [$this->getContainerBuilder(), 'getDefinition'], array_keys($this->getContainerBuilder()->findByTag(self::TAG...
php
public function beforeCompile(): void { $config = $this->validateConfig($this->defaults); $definitions = $config['all'] === true ? $this->getContainerBuilder()->getDefinitions() : array_map( [$this->getContainerBuilder(), 'getDefinition'], array_keys($this->getContainerBuilder()->findByTag(self::TAG...
[ "public", "function", "beforeCompile", "(", ")", ":", "void", "{", "$", "config", "=", "$", "this", "->", "validateConfig", "(", "$", "this", "->", "defaults", ")", ";", "$", "definitions", "=", "$", "config", "[", "'all'", "]", "===", "true", "?", "...
Find all definitions and inject into @value
[ "Find", "all", "definitions", "and", "inject", "into" ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/InjectValueExtension.php#L24-L42
contributte/di
src/Extension/InjectValueExtension.php
InjectValueExtension.inject
protected function inject(ServiceDefinition $def): void { $class = $def->getType(); if ($class === null) return; foreach (get_class_vars($class) as $name => $var) { $rp = new ReflectionProperty($def->getType(), $name); // Try to match property by regex // https://regex101.com/r/D6gc21/1 $match = S...
php
protected function inject(ServiceDefinition $def): void { $class = $def->getType(); if ($class === null) return; foreach (get_class_vars($class) as $name => $var) { $rp = new ReflectionProperty($def->getType(), $name); // Try to match property by regex // https://regex101.com/r/D6gc21/1 $match = S...
[ "protected", "function", "inject", "(", "ServiceDefinition", "$", "def", ")", ":", "void", "{", "$", "class", "=", "$", "def", "->", "getType", "(", ")", ";", "if", "(", "$", "class", "===", "null", ")", "return", ";", "foreach", "(", "get_class_vars",...
Inject into @value property
[ "Inject", "into" ]
train
https://github.com/contributte/di/blob/de531e26ba4b70d570b59a28cfd81cc17de6800a/src/Extension/InjectValueExtension.php#L47-L70
ircmaxell/SecurityLib
lib/SecurityLib/AbstractFactory.php
AbstractFactory.registerType
protected function registerType( $type, $implements, $name, $class, $instantiate = false ) { $name = strtolower($name); $refl = new \ReflectionClass($class); if (!$refl->implementsInterface($implements)) { $message = sprintf('Class must imp...
php
protected function registerType( $type, $implements, $name, $class, $instantiate = false ) { $name = strtolower($name); $refl = new \ReflectionClass($class); if (!$refl->implementsInterface($implements)) { $message = sprintf('Class must imp...
[ "protected", "function", "registerType", "(", "$", "type", ",", "$", "implements", ",", "$", "name", ",", "$", "class", ",", "$", "instantiate", "=", "false", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "$", "refl", "=", "...
Register a type with the factory by name This is an internal method to check if a provided class name implements an interface, and if it does to append that class to an internal array by name. @param string $type The name of the variable to store the class @param string $implements The interface to validate...
[ "Register", "a", "type", "with", "the", "factory", "by", "name" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/AbstractFactory.php#L42-L60
ircmaxell/SecurityLib
lib/SecurityLib/AbstractFactory.php
AbstractFactory.loadFiles
protected function loadFiles($directory, $namespace, $callback) { foreach (new \DirectoryIterator($directory) as $file) { $filename = $file->getBasename(); if ($file->isFile() && substr($filename, -4) == '.php') { $name = substr($filename, 0, -4); $class ...
php
protected function loadFiles($directory, $namespace, $callback) { foreach (new \DirectoryIterator($directory) as $file) { $filename = $file->getBasename(); if ($file->isFile() && substr($filename, -4) == '.php') { $name = substr($filename, 0, -4); $class ...
[ "protected", "function", "loadFiles", "(", "$", "directory", ",", "$", "namespace", ",", "$", "callback", ")", "{", "foreach", "(", "new", "\\", "DirectoryIterator", "(", "$", "directory", ")", "as", "$", "file", ")", "{", "$", "filename", "=", "$", "f...
Load a set of classes from a directory into the factory @param string $directory The directory to search for classes in @param string $namespace The namespace prefix for any found classes @param callable $callback The callback with which to register the class @return void
[ "Load", "a", "set", "of", "classes", "from", "a", "directory", "into", "the", "factory" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/AbstractFactory.php#L71-L80
ircmaxell/SecurityLib
lib/SecurityLib/BigMath.php
BigMath.createFromServerConfiguration
public static function createFromServerConfiguration() { //@codeCoverageIgnoreStart if (extension_loaded('gmp')) { return new \SecurityLib\BigMath\GMP(); } elseif (extension_loaded('bcmath')) { return new \SecurityLib\BigMath\BCMath(); } else { return ...
php
public static function createFromServerConfiguration() { //@codeCoverageIgnoreStart if (extension_loaded('gmp')) { return new \SecurityLib\BigMath\GMP(); } elseif (extension_loaded('bcmath')) { return new \SecurityLib\BigMath\BCMath(); } else { return ...
[ "public", "static", "function", "createFromServerConfiguration", "(", ")", "{", "//@codeCoverageIgnoreStart", "if", "(", "extension_loaded", "(", "'gmp'", ")", ")", "{", "return", "new", "\\", "SecurityLib", "\\", "BigMath", "\\", "GMP", "(", ")", ";", "}", "e...
Get an instance of the big math class This is NOT a singleton. It simply loads the proper strategy given the current server configuration @return \SecurityLib\BigMath A big math instance
[ "Get", "an", "instance", "of", "the", "big", "math", "class" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath.php#L33-L43
ircmaxell/SecurityLib
lib/SecurityLib/BigMath/PHPMath.php
PHPMath.add
public function add($left, $right) { if (empty($left)) { return $right; } elseif (empty($right)) { return $left; } $negative = ''; if ($left[0] == '-' && $right[0] == '-') { $negative = '-'; $left = substr($left, 1); ...
php
public function add($left, $right) { if (empty($left)) { return $right; } elseif (empty($right)) { return $left; } $negative = ''; if ($left[0] == '-' && $right[0] == '-') { $negative = '-'; $left = substr($left, 1); ...
[ "public", "function", "add", "(", "$", "left", ",", "$", "right", ")", "{", "if", "(", "empty", "(", "$", "left", ")", ")", "{", "return", "$", "right", ";", "}", "elseif", "(", "empty", "(", "$", "right", ")", ")", "{", "return", "$", "left", ...
Add two numbers together @param string $left The left argument @param string $right The right argument @return string A base-10 string of the sum of the two arguments
[ "Add", "two", "numbers", "together" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath/PHPMath.php#L36-L59
ircmaxell/SecurityLib
lib/SecurityLib/BigMath/PHPMath.php
PHPMath.subtract
public function subtract($left, $right) { if (empty($left)) { return $right; } elseif (empty($right)) { return $left; } elseif ($right[0] == '-') { return $this->add($left, substr($right, 1)); } elseif ($left[0] == '-') { return '-' . $this...
php
public function subtract($left, $right) { if (empty($left)) { return $right; } elseif (empty($right)) { return $left; } elseif ($right[0] == '-') { return $this->add($left, substr($right, 1)); } elseif ($left[0] == '-') { return '-' . $this...
[ "public", "function", "subtract", "(", "$", "left", ",", "$", "right", ")", "{", "if", "(", "empty", "(", "$", "left", ")", ")", "{", "return", "$", "right", ";", "}", "elseif", "(", "empty", "(", "$", "right", ")", ")", "{", "return", "$", "le...
Subtract two numbers @param string $left The left argument @param string $right The right argument @return string A base-10 string of the difference of the two arguments
[ "Subtract", "two", "numbers" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath/PHPMath.php#L69-L84
ircmaxell/SecurityLib
lib/SecurityLib/BigMath/PHPMath.php
PHPMath.addBinary
protected function addBinary($left, $right) { $len = max(strlen($left), strlen($right)); $left = str_pad($left, $len, chr(0), STR_PAD_LEFT); $right = str_pad($right, $len, chr(0), STR_PAD_LEFT); $result = ''; $carry = 0; for ($i = 0; $i < $len; $i++) { ...
php
protected function addBinary($left, $right) { $len = max(strlen($left), strlen($right)); $left = str_pad($left, $len, chr(0), STR_PAD_LEFT); $right = str_pad($right, $len, chr(0), STR_PAD_LEFT); $result = ''; $carry = 0; for ($i = 0; $i < $len; $i++) { ...
[ "protected", "function", "addBinary", "(", "$", "left", ",", "$", "right", ")", "{", "$", "len", "=", "max", "(", "strlen", "(", "$", "left", ")", ",", "strlen", "(", "$", "right", ")", ")", ";", "$", "left", "=", "str_pad", "(", "$", "left", "...
Add two binary strings together @param string $left The left argument @param string $right The right argument @return string The binary result
[ "Add", "two", "binary", "strings", "together" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath/PHPMath.php#L94-L112
ircmaxell/SecurityLib
lib/SecurityLib/BigMath/PHPMath.php
PHPMath.subtractBinary
protected function subtractBinary($left, $right) { $len = max(strlen($left), strlen($right)); $left = str_pad($left, $len, chr(0), STR_PAD_LEFT); $right = str_pad($right, $len, chr(0), STR_PAD_LEFT); $right = $this->compliment($right); $result = $this->addBinary($left, $ri...
php
protected function subtractBinary($left, $right) { $len = max(strlen($left), strlen($right)); $left = str_pad($left, $len, chr(0), STR_PAD_LEFT); $right = str_pad($right, $len, chr(0), STR_PAD_LEFT); $right = $this->compliment($right); $result = $this->addBinary($left, $ri...
[ "protected", "function", "subtractBinary", "(", "$", "left", ",", "$", "right", ")", "{", "$", "len", "=", "max", "(", "strlen", "(", "$", "left", ")", ",", "strlen", "(", "$", "right", ")", ")", ";", "$", "left", "=", "str_pad", "(", "$", "left"...
Subtract two binary strings using 256's compliment @param string $left The left argument @param string $right The right argument @return string The binary result
[ "Subtract", "two", "binary", "strings", "using", "256", "s", "compliment" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath/PHPMath.php#L122-L138
ircmaxell/SecurityLib
lib/SecurityLib/BigMath/PHPMath.php
PHPMath.compliment
protected function compliment($string) { $result = ''; $len = strlen($string); for ($i = 0; $i < $len; $i++) { $result .= chr(255 - ord($string[$i])); } return $result; }
php
protected function compliment($string) { $result = ''; $len = strlen($string); for ($i = 0; $i < $len; $i++) { $result .= chr(255 - ord($string[$i])); } return $result; }
[ "protected", "function", "compliment", "(", "$", "string", ")", "{", "$", "result", "=", "''", ";", "$", "len", "=", "strlen", "(", "$", "string", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "len", ";", "$", "i", "++", ...
Take the 256 base compliment @param string $string The binary string to compliment @return string The complimented string
[ "Take", "the", "256", "base", "compliment" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BigMath/PHPMath.php#L147-L154
ircmaxell/SecurityLib
lib/SecurityLib/BaseConverter.php
BaseConverter.convertFromBinary
public static function convertFromBinary($string, $characters) { if ($string === '' || empty($characters)) { return ''; } $string = str_split($string); $callback = function($str) { return ord($str); }; $string = array_map($callback, $s...
php
public static function convertFromBinary($string, $characters) { if ($string === '' || empty($characters)) { return ''; } $string = str_split($string); $callback = function($str) { return ord($str); }; $string = array_map($callback, $s...
[ "public", "static", "function", "convertFromBinary", "(", "$", "string", ",", "$", "characters", ")", "{", "if", "(", "$", "string", "===", "''", "||", "empty", "(", "$", "characters", ")", ")", "{", "return", "''", ";", "}", "$", "string", "=", "str...
Convert from a raw binary string to a string of characters @param string $string The string to convert from @param string $characters The list of characters to convert to @return string The converted string
[ "Convert", "from", "a", "raw", "binary", "string", "to", "a", "string", "of", "characters" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BaseConverter.php#L37-L52
ircmaxell/SecurityLib
lib/SecurityLib/BaseConverter.php
BaseConverter.convertToBinary
public static function convertToBinary($string, $characters) { if (empty($string) || empty($characters)) { return ''; } $string = str_split($string); $callback = function($str) use ($characters) { return strpos($characters, $str); }; $str...
php
public static function convertToBinary($string, $characters) { if (empty($string) || empty($characters)) { return ''; } $string = str_split($string); $callback = function($str) use ($characters) { return strpos($characters, $str); }; $str...
[ "public", "static", "function", "convertToBinary", "(", "$", "string", ",", "$", "characters", ")", "{", "if", "(", "empty", "(", "$", "string", ")", "||", "empty", "(", "$", "characters", ")", ")", "{", "return", "''", ";", "}", "$", "string", "=", ...
Convert to a raw binary string from a string of characters @param string $string The string to convert from @param string $characters The list of characters to convert to @return string The converted string
[ "Convert", "to", "a", "raw", "binary", "string", "from", "a", "string", "of", "characters" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BaseConverter.php#L62-L76
ircmaxell/SecurityLib
lib/SecurityLib/BaseConverter.php
BaseConverter.baseConvert
public static function baseConvert(array $source, $srcBase, $dstBase) { if ($dstBase < 2) { $message = sprintf('Invalid Destination Base: %d', $dstBase); throw new \InvalidArgumentException($message); } $result = array(); $count = count($source); while ($...
php
public static function baseConvert(array $source, $srcBase, $dstBase) { if ($dstBase < 2) { $message = sprintf('Invalid Destination Base: %d', $dstBase); throw new \InvalidArgumentException($message); } $result = array(); $count = count($source); while ($...
[ "public", "static", "function", "baseConvert", "(", "array", "$", "source", ",", "$", "srcBase", ",", "$", "dstBase", ")", "{", "if", "(", "$", "dstBase", "<", "2", ")", "{", "$", "message", "=", "sprintf", "(", "'Invalid Destination Base: %d'", ",", "$"...
Convert an array of input blocks to another numeric base This function was modified from an implementation found on StackOverflow. Special Thanks to @KeithRandall for supplying the implementation. @param int[] $source The source number, as an array @param int $srcBase The source base as an integer @param int $ds...
[ "Convert", "an", "array", "of", "input", "blocks", "to", "another", "numeric", "base" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/BaseConverter.php#L91-L112
ircmaxell/SecurityLib
lib/SecurityLib/Enum.php
Enum.compare
public function compare(Enum $arg) { if ($this->value == $arg->value) { return 0; } elseif ($this->value > $arg->value) { return -1; } else { return 1; } }
php
public function compare(Enum $arg) { if ($this->value == $arg->value) { return 0; } elseif ($this->value > $arg->value) { return -1; } else { return 1; } }
[ "public", "function", "compare", "(", "Enum", "$", "arg", ")", "{", "if", "(", "$", "this", "->", "value", "==", "$", "arg", "->", "value", ")", "{", "return", "0", ";", "}", "elseif", "(", "$", "this", "->", "value", ">", "$", "arg", "->", "va...
Compare two enums using numeric comparison @param Enum $arg The enum to compare this instance to @return int 0 if same, 1 if the argument is greater, -1 else
[ "Compare", "two", "enums", "using", "numeric", "comparison" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/Enum.php#L84-L92
ircmaxell/SecurityLib
lib/SecurityLib/Enum.php
Enum.getConstList
public function getConstList($include_default = false) { static $constCache = array(); $class = get_class($this); if (!isset($constCache[$class])) { $reflector = new ReflectionObject($this); $constCache[$class] = $reflector->getConstants(); } ...
php
public function getConstList($include_default = false) { static $constCache = array(); $class = get_class($this); if (!isset($constCache[$class])) { $reflector = new ReflectionObject($this); $constCache[$class] = $reflector->getConstants(); } ...
[ "public", "function", "getConstList", "(", "$", "include_default", "=", "false", ")", "{", "static", "$", "constCache", "=", "array", "(", ")", ";", "$", "class", "=", "get_class", "(", "$", "this", ")", ";", "if", "(", "!", "isset", "(", "$", "const...
Returns all constants (including values) as an associative array @param boolean $include_default Include the __default magic value? @return array All of the constants found against this instance
[ "Returns", "all", "constants", "(", "including", "values", ")", "as", "an", "associative", "array" ]
train
https://github.com/ircmaxell/SecurityLib/blob/d337741719027c14c9fefafc9cd918251831e3e9/lib/SecurityLib/Enum.php#L101-L114
inhere/php-srouter
src/ServerRouter.php
ServerRouter.match
public function match(string $path, string $method = 'GET'): array { // For HEAD requests, attempt fallback to GET $method = \strtoupper($method); if ($method === 'HEAD') { $method = 'GET'; } $path = RouteHelper::formatPath($path, $this->ignoreLastSlash); ...
php
public function match(string $path, string $method = 'GET'): array { // For HEAD requests, attempt fallback to GET $method = \strtoupper($method); if ($method === 'HEAD') { $method = 'GET'; } $path = RouteHelper::formatPath($path, $this->ignoreLastSlash); ...
[ "public", "function", "match", "(", "string", "$", "path", ",", "string", "$", "method", "=", "'GET'", ")", ":", "array", "{", "// For HEAD requests, attempt fallback to GET", "$", "method", "=", "\\", "strtoupper", "(", "$", "method", ")", ";", "if", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/ServerRouter.php#L61-L105
inhere/php-srouter
src/RouterConfigTrait.php
RouterConfigTrait.config
public function config(array $config): void { if ($this->routeCounter > 0) { throw new \LogicException('Routing has been added, and configuration is not allowed!'); } $props = [ 'name' => 1, 'chains' => 1, // ...
php
public function config(array $config): void { if ($this->routeCounter > 0) { throw new \LogicException('Routing has been added, and configuration is not allowed!'); } $props = [ 'name' => 1, 'chains' => 1, // ...
[ "public", "function", "config", "(", "array", "$", "config", ")", ":", "void", "{", "if", "(", "$", "this", "->", "routeCounter", ">", "0", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Routing has been added, and configuration is not allowed!'", ")",...
config the router @param array $config @throws \LogicException
[ "config", "the", "router" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/RouterConfigTrait.php#L86-L109
inhere/php-srouter
src/Router.php
Router.middleware
public function middleware(...$middleware): Router { foreach ($middleware as $handler) { $this->chains[] = $handler; } return $this; }
php
public function middleware(...$middleware): Router { foreach ($middleware as $handler) { $this->chains[] = $handler; } return $this; }
[ "public", "function", "middleware", "(", "...", "$", "middleware", ")", ":", "Router", "{", "foreach", "(", "$", "middleware", "as", "$", "handler", ")", "{", "$", "this", "->", "chains", "[", "]", "=", "$", "handler", ";", "}", "return", "$", "this"...
push middleware(s) for the route @param mixed ...$middleware @return Router
[ "push", "middleware", "(", "s", ")", "for", "the", "route" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L141-L148
inhere/php-srouter
src/Router.php
Router.get
public function get(string $path, $handler, array $pathParams = [], array $opts = []): Route { return $this->add('GET', $path, $handler, $pathParams, $opts); // return $this->map(['GET', 'HEAD'], $path, $handler, $pathParams, $opts); }
php
public function get(string $path, $handler, array $pathParams = [], array $opts = []): Route { return $this->add('GET', $path, $handler, $pathParams, $opts); // return $this->map(['GET', 'HEAD'], $path, $handler, $pathParams, $opts); }
[ "public", "function", "get", "(", "string", "$", "path", ",", "$", "handler", ",", "array", "$", "pathParams", "=", "[", "]", ",", "array", "$", "opts", "=", "[", "]", ")", ":", "Route", "{", "return", "$", "this", "->", "add", "(", "'GET'", ",",...
register a route, allow GET request method. {@inheritdoc}
[ "register", "a", "route", "allow", "GET", "request", "method", ".", "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L158-L162
inhere/php-srouter
src/Router.php
Router.any
public function any(string $path, $handler, array $pathParams = [], array $opts = []): void { $this->map(self::METHODS_ARRAY, $path, $handler, $pathParams, $opts); }
php
public function any(string $path, $handler, array $pathParams = [], array $opts = []): void { $this->map(self::METHODS_ARRAY, $path, $handler, $pathParams, $opts); }
[ "public", "function", "any", "(", "string", "$", "path", ",", "$", "handler", ",", "array", "$", "pathParams", "=", "[", "]", ",", "array", "$", "opts", "=", "[", "]", ")", ":", "void", "{", "$", "this", "->", "map", "(", "self", "::", "METHODS_A...
register a route, allow any request METHOD. {@inheritdoc}
[ "register", "a", "route", "allow", "any", "request", "METHOD", ".", "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L231-L234
inhere/php-srouter
src/Router.php
Router.group
public function group(string $prefix, \Closure $callback, array $middleware = [], array $opts = []): void { // Backups $previousGroupPrefix = $this->currentGroupPrefix; $previousGroupOption = $this->currentGroupOption; $previousGroupChains = $this->currentGroupChains; $this-...
php
public function group(string $prefix, \Closure $callback, array $middleware = [], array $opts = []): void { // Backups $previousGroupPrefix = $this->currentGroupPrefix; $previousGroupOption = $this->currentGroupOption; $previousGroupChains = $this->currentGroupChains; $this-...
[ "public", "function", "group", "(", "string", "$", "prefix", ",", "\\", "Closure", "$", "callback", ",", "array", "$", "middleware", "=", "[", "]", ",", "array", "$", "opts", "=", "[", "]", ")", ":", "void", "{", "// Backups", "$", "previousGroupPrefix...
Create a route group with a common prefix. All routes created in the passed callback will have the given group prefix prepended. @param string $prefix @param \Closure $callback @param array $middleware @param array $opts
[ "Create", "a", "route", "group", "with", "a", "common", "prefix", ".", "All", "routes", "created", "in", "the", "passed", "callback", "will", "have", "the", "given", "group", "prefix", "prepended", "." ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L326-L344
inhere/php-srouter
src/Router.php
Router.appendGroupInfo
protected function appendGroupInfo(Route $route): void { $path = $bak = $route->getPath(); // Always add '/' prefix. $path = \strpos($path, '/') === 0 ? $path : '/' . $path; $path = $this->currentGroupPrefix . $path; // Has setting 'ignoreLastSlash' if ($path !== '/...
php
protected function appendGroupInfo(Route $route): void { $path = $bak = $route->getPath(); // Always add '/' prefix. $path = \strpos($path, '/') === 0 ? $path : '/' . $path; $path = $this->currentGroupPrefix . $path; // Has setting 'ignoreLastSlash' if ($path !== '/...
[ "protected", "function", "appendGroupInfo", "(", "Route", "$", "route", ")", ":", "void", "{", "$", "path", "=", "$", "bak", "=", "$", "route", "->", "getPath", "(", ")", ";", "// Always add '/' prefix.", "$", "path", "=", "\\", "strpos", "(", "$", "pa...
prepare for add @param Route $route @return void
[ "prepare", "for", "add" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L351-L384
inhere/php-srouter
src/Router.php
Router.matchDynamicRoute
protected function matchDynamicRoute(string $path, string $method): array { $first = \strstr(\ltrim($path, '/'), '/', true); $fKey = $first ? $method . ' ' . $first : ''; // It is a regular dynamic route(the first node is 1th level index key). if ($fKey && isset($this->regularRoute...
php
protected function matchDynamicRoute(string $path, string $method): array { $first = \strstr(\ltrim($path, '/'), '/', true); $fKey = $first ? $method . ' ' . $first : ''; // It is a regular dynamic route(the first node is 1th level index key). if ($fKey && isset($this->regularRoute...
[ "protected", "function", "matchDynamicRoute", "(", "string", "$", "path", ",", "string", "$", "method", ")", ":", "array", "{", "$", "first", "=", "\\", "strstr", "(", "\\", "ltrim", "(", "$", "path", ",", "'/'", ")", ",", "'/'", ",", "true", ")", ...
is a dynamic route, match by regexp @param string $path @param string $method @return array [ status, path, Route(object) -> it's a raw Route clone. ]
[ "is", "a", "dynamic", "route", "match", "by", "regexp" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L452-L486
inhere/php-srouter
src/Router.php
Router.matchAutoRoute
public function matchAutoRoute(string $path) { if (!$cnp = \trim($this->controllerNamespace)) { return false; } $sfx = \trim($this->controllerSuffix); return RouteHelper::parseAutoRoute($path, $cnp, $sfx); }
php
public function matchAutoRoute(string $path) { if (!$cnp = \trim($this->controllerNamespace)) { return false; } $sfx = \trim($this->controllerSuffix); return RouteHelper::parseAutoRoute($path, $cnp, $sfx); }
[ "public", "function", "matchAutoRoute", "(", "string", "$", "path", ")", "{", "if", "(", "!", "$", "cnp", "=", "\\", "trim", "(", "$", "this", "->", "controllerNamespace", ")", ")", "{", "return", "false", ";", "}", "$", "sfx", "=", "\\", "trim", "...
handle auto route match, when config `'autoRoute' => true` @param string $path The route path @return bool|callable
[ "handle", "auto", "route", "match", "when", "config", "autoRoute", "=", ">", "true" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L493-L502
inhere/php-srouter
src/Router.php
Router.dispatch
public function dispatch($dispatcher = null, $path = null, $method = null) { if (!$dispatcher) { $dispatcher = new Dispatcher; } elseif (\is_array($dispatcher)) { $dispatcher = new Dispatcher($dispatcher); } if (!$dispatcher instanceof DispatcherInterface) { ...
php
public function dispatch($dispatcher = null, $path = null, $method = null) { if (!$dispatcher) { $dispatcher = new Dispatcher; } elseif (\is_array($dispatcher)) { $dispatcher = new Dispatcher($dispatcher); } if (!$dispatcher instanceof DispatcherInterface) { ...
[ "public", "function", "dispatch", "(", "$", "dispatcher", "=", "null", ",", "$", "path", "=", "null", ",", "$", "method", "=", "null", ")", "{", "if", "(", "!", "$", "dispatcher", ")", "{", "$", "dispatcher", "=", "new", "Dispatcher", ";", "}", "el...
Runs the callback for the given request @param DispatcherInterface|array $dispatcher @param null|string $path @param null|string $method @return mixed @throws \LogicException @throws \Throwable
[ "Runs", "the", "callback", "for", "the", "given", "request" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L548-L567
inhere/php-srouter
src/Router.php
Router.getRoutes
public function getRoutes(): array { $routes = []; $this->each(function (Route $route) use (&$routes) { $routes[] = $route; }); return $routes; }
php
public function getRoutes(): array { $routes = []; $this->each(function (Route $route) use (&$routes) { $routes[] = $route; }); return $routes; }
[ "public", "function", "getRoutes", "(", ")", ":", "array", "{", "$", "routes", "=", "[", "]", ";", "$", "this", "->", "each", "(", "function", "(", "Route", "$", "route", ")", "use", "(", "&", "$", "routes", ")", "{", "$", "routes", "[", "]", "...
get all routes @return array
[ "get", "all", "routes" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Router.php#L643-L651
inhere/php-srouter
src/RouterManager.php
RouterManager.get
public function get($condition = null): Router { if (!$condition) { return $this->getDefault(); } // alias of getByName() if (\is_string($condition)) { return $this->getByName($condition); } $useName = self::DEFAULT_ROUTER; foreach (...
php
public function get($condition = null): Router { if (!$condition) { return $this->getDefault(); } // alias of getByName() if (\is_string($condition)) { return $this->getByName($condition); } $useName = self::DEFAULT_ROUTER; foreach (...
[ "public", "function", "get", "(", "$", "condition", "=", "null", ")", ":", "Router", "{", "if", "(", "!", "$", "condition", ")", "{", "return", "$", "this", "->", "getDefault", "(", ")", ";", "}", "// alias of getByName()", "if", "(", "\\", "is_string"...
get router by condition @param array|string $condition array: [ 'domain' => 'abc.com', 'scheme' => 'https', ] string: get by name. same of call getByName() @return Router |RouterInterface @throws \InvalidArgumentException
[ "get", "router", "by", "condition" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/RouterManager.php#L142-L163
inhere/php-srouter
src/CachedRouter.php
CachedRouter.add
public function add(string $method, string $path, $handler, array $binds = [], array $opts = []): Route { // file cache exists check. if ($this->cacheLoaded) { return Route::createFromArray(); } return parent::add($method, $path, $handler, $binds, $opts); }
php
public function add(string $method, string $path, $handler, array $binds = [], array $opts = []): Route { // file cache exists check. if ($this->cacheLoaded) { return Route::createFromArray(); } return parent::add($method, $path, $handler, $binds, $opts); }
[ "public", "function", "add", "(", "string", "$", "method", ",", "string", "$", "path", ",", "$", "handler", ",", "array", "$", "binds", "=", "[", "]", ",", "array", "$", "opts", "=", "[", "]", ")", ":", "Route", "{", "// file cache exists check.", "i...
{@inheritdoc}
[ "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/CachedRouter.php#L71-L79
inhere/php-srouter
src/CachedRouter.php
CachedRouter.addRoute
public function addRoute(Route $route): Route { // file cache exists check. if ($this->cacheLoaded) { return $route; } return parent::addRoute($route); }
php
public function addRoute(Route $route): Route { // file cache exists check. if ($this->cacheLoaded) { return $route; } return parent::addRoute($route); }
[ "public", "function", "addRoute", "(", "Route", "$", "route", ")", ":", "Route", "{", "// file cache exists check.", "if", "(", "$", "this", "->", "cacheLoaded", ")", "{", "return", "$", "route", ";", "}", "return", "parent", "::", "addRoute", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/CachedRouter.php#L84-L92
inhere/php-srouter
src/CachedRouter.php
CachedRouter.loadRoutesCache
public function loadRoutesCache(): bool { if (!$this->isCacheEnable()) { return false; } $file = $this->cacheFile; if (!$file || !\file_exists($file)) { return false; } // load routes $map = require $file; $this->routeCounter ...
php
public function loadRoutesCache(): bool { if (!$this->isCacheEnable()) { return false; } $file = $this->cacheFile; if (!$file || !\file_exists($file)) { return false; } // load routes $map = require $file; $this->routeCounter ...
[ "public", "function", "loadRoutesCache", "(", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "isCacheEnable", "(", ")", ")", "{", "return", "false", ";", "}", "$", "file", "=", "$", "this", "->", "cacheFile", ";", "if", "(", "!", "$", ...
load route caches from the cache file @return bool
[ "load", "route", "caches", "from", "the", "cache", "file" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/CachedRouter.php#L102-L143
inhere/php-srouter
src/CachedRouter.php
CachedRouter.dumpRoutesCache
protected function dumpRoutesCache(): int { if (!$file = $this->cacheFile) { return 0; } if ($this->isCacheEnable() && \file_exists($file)) { return 1; } $date = \date('Y-m-d H:i:s'); $class = static::class; $count = $this->count(); ...
php
protected function dumpRoutesCache(): int { if (!$file = $this->cacheFile) { return 0; } if ($this->isCacheEnable() && \file_exists($file)) { return 1; } $date = \date('Y-m-d H:i:s'); $class = static::class; $count = $this->count(); ...
[ "protected", "function", "dumpRoutesCache", "(", ")", ":", "int", "{", "if", "(", "!", "$", "file", "=", "$", "this", "->", "cacheFile", ")", "{", "return", "0", ";", "}", "if", "(", "$", "this", "->", "isCacheEnable", "(", ")", "&&", "\\", "file_e...
dump routes to cache file @return int
[ "dump", "routes", "to", "cache", "file" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/CachedRouter.php#L149-L190
inhere/php-srouter
src/Route.php
Route.namedTo
public function namedTo(string $name, Router $router, bool $register = false): void { // not empty if ($name = $this->setName($name)->name) { if ($register) { $router->addRoute($this); } else { $router->nameRoute($name, $this); } ...
php
public function namedTo(string $name, Router $router, bool $register = false): void { // not empty if ($name = $this->setName($name)->name) { if ($register) { $router->addRoute($this); } else { $router->nameRoute($name, $this); } ...
[ "public", "function", "namedTo", "(", "string", "$", "name", ",", "Router", "$", "router", ",", "bool", "$", "register", "=", "false", ")", ":", "void", "{", "// not empty", "if", "(", "$", "name", "=", "$", "this", "->", "setName", "(", "$", "name",...
name the route and bind name to router. @param string $name @param Router $router @param bool $register
[ "name", "the", "route", "and", "bind", "name", "to", "router", "." ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Route.php#L170-L180
inhere/php-srouter
src/Route.php
Route.parseParam
public function parseParam(array $bindParams = []): string { $argPos = \strpos($this->path, '{'); $optPos = \strpos($this->path, '['); return $this->quickParseParams($argPos, $optPos, $bindParams); }
php
public function parseParam(array $bindParams = []): string { $argPos = \strpos($this->path, '{'); $optPos = \strpos($this->path, '['); return $this->quickParseParams($argPos, $optPos, $bindParams); }
[ "public", "function", "parseParam", "(", "array", "$", "bindParams", "=", "[", "]", ")", ":", "string", "{", "$", "argPos", "=", "\\", "strpos", "(", "$", "this", "->", "path", ",", "'{'", ")", ";", "$", "optPos", "=", "\\", "strpos", "(", "$", "...
parse route path string. fetch route params @param array $bindParams @return string returns the first node string.
[ "parse", "route", "path", "string", ".", "fetch", "route", "params" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Route.php#L191-L197
inhere/php-srouter
src/Route.php
Route.middleware
public function middleware(...$middleware): self { foreach ($middleware as $handler) { $this->chains[] = $handler; } return $this; }
php
public function middleware(...$middleware): self { foreach ($middleware as $handler) { $this->chains[] = $handler; } return $this; }
[ "public", "function", "middleware", "(", "...", "$", "middleware", ")", ":", "self", "{", "foreach", "(", "$", "middleware", "as", "$", "handler", ")", "{", "$", "this", "->", "chains", "[", "]", "=", "$", "handler", ";", "}", "return", "$", "this", ...
push middleware(s) to the route @param array ...$middleware @return Route
[ "push", "middleware", "(", "s", ")", "to", "the", "route" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Route.php#L334-L341
inhere/php-srouter
src/Route.php
Route.toUri
public function toUri(array $pathVars = []): string { if ($pathVars) { return \strtr($this->path, $pathVars); } return $this->path; }
php
public function toUri(array $pathVars = []): string { if ($pathVars) { return \strtr($this->path, $pathVars); } return $this->path; }
[ "public", "function", "toUri", "(", "array", "$", "pathVars", "=", "[", "]", ")", ":", "string", "{", "if", "(", "$", "pathVars", ")", "{", "return", "\\", "strtr", "(", "$", "this", "->", "path", ",", "$", "pathVars", ")", ";", "}", "return", "$...
build uri string. @param array $pathVars @return string
[ "build", "uri", "string", "." ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Route.php#L368-L375
inhere/php-srouter
src/Route.php
Route.toArray
public function toArray(): array { return [ 'name' => $this->name, 'path' => $this->path, 'method' => $this->method, 'handler' => $this->handler, 'binds' => $this->bindVars, 'params' => $this->params, '...
php
public function toArray(): array { return [ 'name' => $this->name, 'path' => $this->path, 'method' => $this->method, 'handler' => $this->handler, 'binds' => $this->bindVars, 'params' => $this->params, '...
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "return", "[", "'name'", "=>", "$", "this", "->", "name", ",", "'path'", "=>", "$", "this", "->", "path", ",", "'method'", "=>", "$", "this", "->", "method", ",", "'handler'", "=>", "$", ...
get all info data @return array
[ "get", "all", "info", "data" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Route.php#L394-L411
inhere/php-srouter
src/Helper/RouteHelper.php
RouteHelper.isStaticRoute
public static function isStaticRoute(string $route): bool { return \strpos($route, '{') === false && \strpos($route, '[') === false; }
php
public static function isStaticRoute(string $route): bool { return \strpos($route, '{') === false && \strpos($route, '[') === false; }
[ "public", "static", "function", "isStaticRoute", "(", "string", "$", "route", ")", ":", "bool", "{", "return", "\\", "strpos", "(", "$", "route", ",", "'{'", ")", "===", "false", "&&", "\\", "strpos", "(", "$", "route", ",", "'['", ")", "===", "false...
is Static Route @param string $route @return bool
[ "is", "Static", "Route" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Helper/RouteHelper.php#L22-L25
inhere/php-srouter
src/Helper/RouteHelper.php
RouteHelper.formatPath
public static function formatPath(string $path, bool $ignoreLastSlash = true): string { if ($path === '/') { return '/'; } // Clear '//', '///' => '/' if (false !== \strpos($path, '//')) { $path = \preg_replace('#\/\/+#', '/', $path); } // Mu...
php
public static function formatPath(string $path, bool $ignoreLastSlash = true): string { if ($path === '/') { return '/'; } // Clear '//', '///' => '/' if (false !== \strpos($path, '//')) { $path = \preg_replace('#\/\/+#', '/', $path); } // Mu...
[ "public", "static", "function", "formatPath", "(", "string", "$", "path", ",", "bool", "$", "ignoreLastSlash", "=", "true", ")", ":", "string", "{", "if", "(", "$", "path", "===", "'/'", ")", "{", "return", "'/'", ";", "}", "// Clear '//', '///' => '/'", ...
format URI path @param string $path @param bool $ignoreLastSlash @return string
[ "format", "URI", "path" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Helper/RouteHelper.php#L33-L53
inhere/php-srouter
src/Helper/RouteHelper.php
RouteHelper.parseAutoRoute
public static function parseAutoRoute(string $path, string $cnp, string $sfx) { $tmp = \trim($path, '/- '); // one node. eg: 'home' if (!\strpos($tmp, '/')) { $tmp = self::str2Camel($tmp); $class = "$cnp\\" . \ucfirst($tmp) . $sfx; return \class_exists...
php
public static function parseAutoRoute(string $path, string $cnp, string $sfx) { $tmp = \trim($path, '/- '); // one node. eg: 'home' if (!\strpos($tmp, '/')) { $tmp = self::str2Camel($tmp); $class = "$cnp\\" . \ucfirst($tmp) . $sfx; return \class_exists...
[ "public", "static", "function", "parseAutoRoute", "(", "string", "$", "path", ",", "string", "$", "cnp", ",", "string", "$", "sfx", ")", "{", "$", "tmp", "=", "\\", "trim", "(", "$", "path", ",", "'/- '", ")", ";", "// one node. eg: 'home'", "if", "(",...
handle auto route match, when config `'autoRoute' => true` @param string $path The route path @param string $cnp controller namespace. eg: 'app\\controllers' @param string $sfx controller suffix. eg: 'Controller' @return bool|callable
[ "handle", "auto", "route", "match", "when", "config", "autoRoute", "=", ">", "true" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Helper/RouteHelper.php#L80-L130
inhere/php-srouter
src/Helper/RouteHelper.php
RouteHelper.call
public static function call($cb, array $args = []) { if (!$cb) { return true; } if (\is_array($cb)) { [$obj, $mhd] = $cb; return \is_object($obj) ? $obj->$mhd(...$args) : $obj::$mhd(...$args); } if (\is_string($cb)) { if (\fu...
php
public static function call($cb, array $args = []) { if (!$cb) { return true; } if (\is_array($cb)) { [$obj, $mhd] = $cb; return \is_object($obj) ? $obj->$mhd(...$args) : $obj::$mhd(...$args); } if (\is_string($cb)) { if (\fu...
[ "public", "static", "function", "call", "(", "$", "cb", ",", "array", "$", "args", "=", "[", "]", ")", "{", "if", "(", "!", "$", "cb", ")", "{", "return", "true", ";", "}", "if", "(", "\\", "is_array", "(", "$", "cb", ")", ")", "{", "[", "$...
@param callable|mixed $cb string - func name, class name array - [class, method] object - Closure, Object @param array $args @return mixed @throws \InvalidArgumentException
[ "@param", "callable|mixed", "$cb", "string", "-", "func", "name", "class", "name", "array", "-", "[", "class", "method", "]", "object", "-", "Closure", "Object" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Helper/RouteHelper.php#L142-L171
inhere/php-srouter
src/PreMatchRouter.php
PreMatchRouter.match
public function match(string $path, string $method = 'GET'): array { // If has been pre-matched. if ($this->preFounded) { return [self::FOUND, $path, $this->preFounded]; } return parent::match($path, $method); }
php
public function match(string $path, string $method = 'GET'): array { // If has been pre-matched. if ($this->preFounded) { return [self::FOUND, $path, $this->preFounded]; } return parent::match($path, $method); }
[ "public", "function", "match", "(", "string", "$", "path", ",", "string", "$", "method", "=", "'GET'", ")", ":", "array", "{", "// If has been pre-matched.", "if", "(", "$", "this", "->", "preFounded", ")", "{", "return", "[", "self", "::", "FOUND", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/PreMatchRouter.php#L100-L108
inhere/php-srouter
src/Dispatcher/SimpleDispatcher.php
SimpleDispatcher.dispatchUri
public function dispatchUri(string $path = null, string $method = null) { $path = (string)($path ?: $_SERVER['REQUEST_URI']); if (\strpos($path, '?')) { $path = \parse_url($path, \PHP_URL_PATH); } // if 'filterFavicon' setting is TRUE if ($path === self::FAV_ICO...
php
public function dispatchUri(string $path = null, string $method = null) { $path = (string)($path ?: $_SERVER['REQUEST_URI']); if (\strpos($path, '?')) { $path = \parse_url($path, \PHP_URL_PATH); } // if 'filterFavicon' setting is TRUE if ($path === self::FAV_ICO...
[ "public", "function", "dispatchUri", "(", "string", "$", "path", "=", "null", ",", "string", "$", "method", "=", "null", ")", "{", "$", "path", "=", "(", "string", ")", "(", "$", "path", "?", ":", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ";"...
Runs the callback for the given path and method. @param string $path @param null|string $method @return mixed @throws \Throwable @throws \RuntimeException @throws \InvalidArgumentException
[ "Runs", "the", "callback", "for", "the", "given", "path", "and", "method", "." ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Dispatcher/SimpleDispatcher.php#L119-L139
inhere/php-srouter
src/Dispatcher/SimpleDispatcher.php
SimpleDispatcher.callHandler
protected function callHandler(string $path, string $method, $handler, array $args = []) { // is a \Closure or a callable object if (\is_object($handler)) { return $handler($args); } //// $handler is string // is array ['controller', 'action'] if (\is_ar...
php
protected function callHandler(string $path, string $method, $handler, array $args = []) { // is a \Closure or a callable object if (\is_object($handler)) { return $handler($args); } //// $handler is string // is array ['controller', 'action'] if (\is_ar...
[ "protected", "function", "callHandler", "(", "string", "$", "path", ",", "string", "$", "method", ",", "$", "handler", ",", "array", "$", "args", "=", "[", "]", ")", "{", "// is a \\Closure or a callable object", "if", "(", "\\", "is_object", "(", "$", "ha...
execute the matched Route Handler @param string $path The route path @param string $method The request method @param callable|mixed $handler The route path handler @param array $args Matched param from path [ 'name' => value ] @return mixed @throws \RuntimeException @throws \InvalidArgumentException @throws \Throwable
[ "execute", "the", "matched", "Route", "Handler" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Dispatcher/SimpleDispatcher.php#L196-L251
inhere/php-srouter
src/Dispatcher/SimpleDispatcher.php
SimpleDispatcher.on
public function on(string $event, $handler) { if (self::isSupportedEvent($event)) { $this->options[$event] = $handler; } }
php
public function on(string $event, $handler) { if (self::isSupportedEvent($event)) { $this->options[$event] = $handler; } }
[ "public", "function", "on", "(", "string", "$", "event", ",", "$", "handler", ")", "{", "if", "(", "self", "::", "isSupportedEvent", "(", "$", "event", ")", ")", "{", "$", "this", "->", "options", "[", "$", "event", "]", "=", "$", "handler", ";", ...
Defines callback on happen event @param $event @param callable $handler
[ "Defines", "callback", "on", "happen", "event" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Dispatcher/SimpleDispatcher.php#L357-L362
inhere/php-srouter
src/Dispatcher/SimpleDispatcher.php
SimpleDispatcher.fire
protected function fire(string $event, array $args = []) { if (!$cb = $this->getOption($event)) { return null; } return RouteHelper::call($cb, $args); }
php
protected function fire(string $event, array $args = []) { if (!$cb = $this->getOption($event)) { return null; } return RouteHelper::call($cb, $args); }
[ "protected", "function", "fire", "(", "string", "$", "event", ",", "array", "$", "args", "=", "[", "]", ")", "{", "if", "(", "!", "$", "cb", "=", "$", "this", "->", "getOption", "(", "$", "event", ")", ")", "{", "return", "null", ";", "}", "ret...
Trigger event @param string $event @param array $args @return mixed @throws \InvalidArgumentException
[ "Trigger", "event" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Dispatcher/SimpleDispatcher.php#L371-L378
inhere/php-srouter
src/Dispatcher/Psr15Dispatcher.php
Psr15Dispatcher.dispatch
public function dispatch(int $status, string $path, string $method, $route) { // not found if ($status === RouterInterface::NOT_FOUND) { return $this->handleNotFound($path, $method); } // method not allowed if ($status === RouterInterface::METHOD_NOT_ALLOWED) { ...
php
public function dispatch(int $status, string $path, string $method, $route) { // not found if ($status === RouterInterface::NOT_FOUND) { return $this->handleNotFound($path, $method); } // method not allowed if ($status === RouterInterface::METHOD_NOT_ALLOWED) { ...
[ "public", "function", "dispatch", "(", "int", "$", "status", ",", "string", "$", "path", ",", "string", "$", "method", ",", "$", "route", ")", "{", "// not found", "if", "(", "$", "status", "===", "RouterInterface", "::", "NOT_FOUND", ")", "{", "return",...
Dispatch route handler for the given route info. {@inheritdoc} @throws \Exception @throws \Throwable
[ "Dispatch", "route", "handler", "for", "the", "given", "route", "info", ".", "{" ]
train
https://github.com/inhere/php-srouter/blob/b869feb27e4d41db39ad3603e19a16768a4efe62/src/Dispatcher/Psr15Dispatcher.php#L60-L113
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.setRepositoryReference
public function setRepositoryReference(RepositoryReference $repositoryReference) { parent::setRepositoryReference($repositoryReference); $this ->repository ->setRepositoryReference($repositoryReference); }
php
public function setRepositoryReference(RepositoryReference $repositoryReference) { parent::setRepositoryReference($repositoryReference); $this ->repository ->setRepositoryReference($repositoryReference); }
[ "public", "function", "setRepositoryReference", "(", "RepositoryReference", "$", "repositoryReference", ")", "{", "parent", "::", "setRepositoryReference", "(", "$", "repositoryReference", ")", ";", "$", "this", "->", "repository", "->", "setRepositoryReference", "(", ...
Set repository reference. @param RepositoryReference $repositoryReference
[ "Set", "repository", "reference", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L67-L73
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.setCredentials
public function setCredentials( RepositoryReference $repositoryReference, TokenUUID $tokenUUID ) { parent::setCredentials($repositoryReference, $tokenUUID); $this ->repository ->setCredentials($repositoryReference, $tokenUUID); }
php
public function setCredentials( RepositoryReference $repositoryReference, TokenUUID $tokenUUID ) { parent::setCredentials($repositoryReference, $tokenUUID); $this ->repository ->setCredentials($repositoryReference, $tokenUUID); }
[ "public", "function", "setCredentials", "(", "RepositoryReference", "$", "repositoryReference", ",", "TokenUUID", "$", "tokenUUID", ")", "{", "parent", "::", "setCredentials", "(", "$", "repositoryReference", ",", "$", "tokenUUID", ")", ";", "$", "this", "->", "...
Set credentials. @param RepositoryReference $repositoryReference @param TokenUUID $tokenUUID
[ "Set", "credentials", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L81-L89
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.query
public function query( Query $query, array $parameters = [] ): Result { $result = $this ->repository ->query($query, $parameters); return $this->applyTransformersToResult($result); }
php
public function query( Query $query, array $parameters = [] ): Result { $result = $this ->repository ->query($query, $parameters); return $this->applyTransformersToResult($result); }
[ "public", "function", "query", "(", "Query", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ")", ":", "Result", "{", "$", "result", "=", "$", "this", "->", "repository", "->", "query", "(", "$", "query", ",", "$", "parameters", ")", ...
Search across the index types. @param Query $query @param array $parameters @return Result @throws ResourceNotAvailableException
[ "Search", "across", "the", "index", "types", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L129-L138
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.applyTransformersToResult
private function applyTransformersToResult(Result $result): Result { return empty($result->getSubresults()) ? Result::create( $result->getQueryUUID(), $result->getTotalItems(), $result->getTotalHits(), $result->getAggregations(), ...
php
private function applyTransformersToResult(Result $result): Result { return empty($result->getSubresults()) ? Result::create( $result->getQueryUUID(), $result->getTotalItems(), $result->getTotalHits(), $result->getAggregations(), ...
[ "private", "function", "applyTransformersToResult", "(", "Result", "$", "result", ")", ":", "Result", "{", "return", "empty", "(", "$", "result", "->", "getSubresults", "(", ")", ")", "?", "Result", "::", "create", "(", "$", "result", "->", "getQueryUUID", ...
Apply transformers on Result. @param Result $result @return Result
[ "Apply", "transformers", "on", "Result", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L147-L167
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.updateItems
public function updateItems( Query $query, Changes $changes ) { $this ->repository ->updateItems( $query, $changes ); }
php
public function updateItems( Query $query, Changes $changes ) { $this ->repository ->updateItems( $query, $changes ); }
[ "public", "function", "updateItems", "(", "Query", "$", "query", ",", "Changes", "$", "changes", ")", "{", "$", "this", "->", "repository", "->", "updateItems", "(", "$", "query", ",", "$", "changes", ")", ";", "}" ]
Update items. @param Query $query @param Changes $changes
[ "Update", "items", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L175-L185
apisearch-io/php-client
Repository/TransformableRepository.php
TransformableRepository.addObject
public function addObject($object) { $item = $this ->transformer ->toItem($object); if ($item instanceof Item) { $this->addItem($item); } }
php
public function addObject($object) { $item = $this ->transformer ->toItem($object); if ($item instanceof Item) { $this->addItem($item); } }
[ "public", "function", "addObject", "(", "$", "object", ")", "{", "$", "item", "=", "$", "this", "->", "transformer", "->", "toItem", "(", "$", "object", ")", ";", "if", "(", "$", "item", "instanceof", "Item", ")", "{", "$", "this", "->", "addItem", ...
Generate item document by a simple object. @param mixed $object
[ "Generate", "item", "document", "by", "a", "simple", "object", "." ]
train
https://github.com/apisearch-io/php-client/blob/a6ecdd6dcd80cf1d28f58f2a23cdab618addb37a/Repository/TransformableRepository.php#L192-L201