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 |
|---|---|---|---|---|---|---|---|---|---|---|
overblog/GraphQLBundle | src/Resolver/ResolverMaps.php | ResolverMaps.covered | public function covered(?string $typeName = null)
{
$covered = [];
foreach ($this->resolverMaps as $resolverMap) {
$covered = \array_merge($covered, $resolverMap->covered($typeName));
}
$covered = \array_unique($covered);
return $covered;
} | php | public function covered(?string $typeName = null)
{
$covered = [];
foreach ($this->resolverMaps as $resolverMap) {
$covered = \array_merge($covered, $resolverMap->covered($typeName));
}
$covered = \array_unique($covered);
return $covered;
} | [
"public",
"function",
"covered",
"(",
"?",
"string",
"$",
"typeName",
"=",
"null",
")",
"{",
"$",
"covered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"resolverMaps",
"as",
"$",
"resolverMap",
")",
"{",
"$",
"covered",
"=",
"\\",
"array_... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMaps.php#L48-L57 |
overblog/GraphQLBundle | src/Resolver/TypeResolver.php | TypeResolver.resolve | public function resolve($alias): ?Type
{
if (null === $alias) {
return null;
}
if (!isset($this->cache[$alias])) {
$type = $this->string2Type($alias);
$this->cache[$alias] = $type;
}
return $this->cache[$alias];
} | php | public function resolve($alias): ?Type
{
if (null === $alias) {
return null;
}
if (!isset($this->cache[$alias])) {
$type = $this->string2Type($alias);
$this->cache[$alias] = $type;
}
return $this->cache[$alias];
} | [
"public",
"function",
"resolve",
"(",
"$",
"alias",
")",
":",
"?",
"Type",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"alias",
"]",
")",... | @param string $alias
@return Type | [
"@param",
"string",
"$alias"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/TypeResolver.php#L44-L56 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.preParse | public static function preParse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): void
{
self::proccessFile($file, $container, $configs, true);
} | php | public static function preParse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): void
{
self::proccessFile($file, $container, $configs, true);
} | [
"public",
"static",
"function",
"preParse",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configs",
"=",
"[",
"]",
")",
":",
"void",
"{",
"self",
"::",
"proccessFile",
"(",
"$",
"file",
",",
"$",
... | {@inheritdoc}
@throws \ReflectionException
@throws InvalidArgumentException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L44-L47 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.parse | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
return self::proccessFile($file, $container, $configs);
} | php | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
return self::proccessFile($file, $container, $configs);
} | [
"public",
"static",
"function",
"parse",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configs",
"=",
"[",
"]",
")",
":",
"array",
"{",
"return",
"self",
"::",
"proccessFile",
"(",
"$",
"file",
",",... | {@inheritdoc}
@throws \ReflectionException
@throws InvalidArgumentException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L55-L58 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.proccessFile | public static function proccessFile(\SplFileInfo $file, ContainerBuilder $container, array $configs, bool $resolveClassMap = false): array
{
self::$doctrineMapping = $configs['doctrine']['types_mapping'];
$rootQueryType = $configs['definitions']['schema']['default']['query'] ?? false;
$root... | php | public static function proccessFile(\SplFileInfo $file, ContainerBuilder $container, array $configs, bool $resolveClassMap = false): array
{
self::$doctrineMapping = $configs['doctrine']['types_mapping'];
$rootQueryType = $configs['definitions']['schema']['default']['query'] ?? false;
$root... | [
"public",
"static",
"function",
"proccessFile",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configs",
",",
"bool",
"$",
"resolveClassMap",
"=",
"false",
")",
":",
"array",
"{",
"self",
"::",
"$",
"d... | Process a file.
@param \SplFileInfo $file
@param ContainerBuilder $container
@param bool $resolveClassMap
@throws \ReflectionException
@throws InvalidArgumentException | [
"Process",
"a",
"file",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L80-L235 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getAnnotationReader | private static function getAnnotationReader()
{
if (null === self::$annotationReader) {
if (!\class_exists('\\Doctrine\\Common\\Annotations\\AnnotationReader') ||
!\class_exists('\\Doctrine\\Common\\Annotations\\AnnotationRegistry')) {
throw new \Exception('In ord... | php | private static function getAnnotationReader()
{
if (null === self::$annotationReader) {
if (!\class_exists('\\Doctrine\\Common\\Annotations\\AnnotationReader') ||
!\class_exists('\\Doctrine\\Common\\Annotations\\AnnotationRegistry')) {
throw new \Exception('In ord... | [
"private",
"static",
"function",
"getAnnotationReader",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"annotationReader",
")",
"{",
"if",
"(",
"!",
"\\",
"class_exists",
"(",
"'\\\\Doctrine\\\\Common\\\\Annotations\\\\AnnotationReader'",
")",
"||",
"... | Retrieve annotation reader.
@return AnnotationReader | [
"Retrieve",
"annotation",
"reader",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L242-L255 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlType | private static function getGraphqlType(GQL\Type $typeAnnotation, array $classAnnotations, array $properties, array $methods, string $namespace, string $currentValue)
{
$typeConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties, false, false, $currentValue);
... | php | private static function getGraphqlType(GQL\Type $typeAnnotation, array $classAnnotations, array $properties, array $methods, string $namespace, string $currentValue)
{
$typeConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties, false, false, $currentValue);
... | [
"private",
"static",
"function",
"getGraphqlType",
"(",
"GQL",
"\\",
"Type",
"$",
"typeAnnotation",
",",
"array",
"$",
"classAnnotations",
",",
"array",
"$",
"properties",
",",
"array",
"$",
"methods",
",",
"string",
"$",
"namespace",
",",
"string",
"$",
"cu... | Create a GraphQL Type configuration from annotations on class, properties and methods.
@param GQL\Type $typeAnnotation
@param array $classAnnotations
@param array $properties
@param array $methods
@param string $namespace
@param string $currentValue
@return array | [
"Create",
"a",
"GraphQL",
"Type",
"configuration",
"from",
"annotations",
"on",
"class",
"properties",
"and",
"methods",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L269-L304 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlInterface | private static function getGraphqlInterface(GQL\TypeInterface $interfaceAnnotation, array $classAnnotations, array $properties, array $methods, string $namespace)
{
$interfaceConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties);
$fields = self::getGra... | php | private static function getGraphqlInterface(GQL\TypeInterface $interfaceAnnotation, array $classAnnotations, array $properties, array $methods, string $namespace)
{
$interfaceConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties);
$fields = self::getGra... | [
"private",
"static",
"function",
"getGraphqlInterface",
"(",
"GQL",
"\\",
"TypeInterface",
"$",
"interfaceAnnotation",
",",
"array",
"$",
"classAnnotations",
",",
"array",
"$",
"properties",
",",
"array",
"$",
"methods",
",",
"string",
"$",
"namespace",
")",
"{"... | Create a GraphQL Interface type configuration from annotations on properties.
@param string $shortClassName
@param GQL\Interface $interfaceAnnotation
@param array $properties
@param array $methods
@param string $namespace
@return array | [
"Create",
"a",
"GraphQL",
"Interface",
"type",
"configuration",
"from",
"annotations",
"on",
"properties",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L317-L330 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlInput | private static function getGraphqlInput(GQL\Input $inputAnnotation, array $classAnnotations, array $properties, string $namespace)
{
$inputConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties, true);
$inputConfiguration['fields'] = $fields;
$in... | php | private static function getGraphqlInput(GQL\Input $inputAnnotation, array $classAnnotations, array $properties, string $namespace)
{
$inputConfiguration = [];
$fields = self::getGraphqlFieldsFromAnnotations($namespace, $properties, true);
$inputConfiguration['fields'] = $fields;
$in... | [
"private",
"static",
"function",
"getGraphqlInput",
"(",
"GQL",
"\\",
"Input",
"$",
"inputAnnotation",
",",
"array",
"$",
"classAnnotations",
",",
"array",
"$",
"properties",
",",
"string",
"$",
"namespace",
")",
"{",
"$",
"inputConfiguration",
"=",
"[",
"]",
... | Create a GraphQL Input type configuration from annotations on properties.
@param string $shortClassName
@param GQL\Input $inputAnnotation
@param array $properties
@param string $namespace
@return array | [
"Create",
"a",
"GraphQL",
"Input",
"type",
"configuration",
"from",
"annotations",
"on",
"properties",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L342-L351 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlScalar | private static function getGraphqlScalar(string $className, GQL\Scalar $scalarAnnotation, array $classAnnotations)
{
$scalarConfiguration = [];
if ($scalarAnnotation->scalarType) {
$scalarConfiguration['scalarType'] = self::formatExpression($scalarAnnotation->scalarType);
} else... | php | private static function getGraphqlScalar(string $className, GQL\Scalar $scalarAnnotation, array $classAnnotations)
{
$scalarConfiguration = [];
if ($scalarAnnotation->scalarType) {
$scalarConfiguration['scalarType'] = self::formatExpression($scalarAnnotation->scalarType);
} else... | [
"private",
"static",
"function",
"getGraphqlScalar",
"(",
"string",
"$",
"className",
",",
"GQL",
"\\",
"Scalar",
"$",
"scalarAnnotation",
",",
"array",
"$",
"classAnnotations",
")",
"{",
"$",
"scalarConfiguration",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"scala... | Get a Graphql scalar configuration from given scalar annotation.
@param string $shortClassName
@param string $className
@param GQL\Scalar $scalarAnnotation
@param array $classAnnotations
@return array | [
"Get",
"a",
"Graphql",
"scalar",
"configuration",
"from",
"given",
"scalar",
"annotation",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L363-L380 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlEnum | private static function getGraphqlEnum(GQL\Enum $enumAnnotation, array $classAnnotations, array $constants)
{
$enumValues = $enumAnnotation->values ? $enumAnnotation->values : [];
$values = [];
foreach ($constants as $name => $value) {
$valueAnnotation = \current(\array_filter(... | php | private static function getGraphqlEnum(GQL\Enum $enumAnnotation, array $classAnnotations, array $constants)
{
$enumValues = $enumAnnotation->values ? $enumAnnotation->values : [];
$values = [];
foreach ($constants as $name => $value) {
$valueAnnotation = \current(\array_filter(... | [
"private",
"static",
"function",
"getGraphqlEnum",
"(",
"GQL",
"\\",
"Enum",
"$",
"enumAnnotation",
",",
"array",
"$",
"classAnnotations",
",",
"array",
"$",
"constants",
")",
"{",
"$",
"enumValues",
"=",
"$",
"enumAnnotation",
"->",
"values",
"?",
"$",
"enu... | Get a Graphql Enum configuration from given enum annotation.
@param string $shortClassName
@param GQL\Enum $enumAnnotation
@param array $classAnnotations
@param array $constants
@return array | [
"Get",
"a",
"Graphql",
"Enum",
"configuration",
"from",
"given",
"enum",
"annotation",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L392-L420 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlUnion | private static function getGraphqlUnion(string $className, GQL\Union $unionAnnotation, array $classAnnotations, array $methods): array
{
$unionConfiguration = ['types' => $unionAnnotation->types];
$unionConfiguration = self::getDescriptionConfiguration($classAnnotations) + $unionConfiguration;
... | php | private static function getGraphqlUnion(string $className, GQL\Union $unionAnnotation, array $classAnnotations, array $methods): array
{
$unionConfiguration = ['types' => $unionAnnotation->types];
$unionConfiguration = self::getDescriptionConfiguration($classAnnotations) + $unionConfiguration;
... | [
"private",
"static",
"function",
"getGraphqlUnion",
"(",
"string",
"$",
"className",
",",
"GQL",
"\\",
"Union",
"$",
"unionAnnotation",
",",
"array",
"$",
"classAnnotations",
",",
"array",
"$",
"methods",
")",
":",
"array",
"{",
"$",
"unionConfiguration",
"=",... | Get a Graphql Union configuration from given union annotation.
@param string $className
@param GQL\Union $unionAnnotation
@param array $classAnnotations
@param array $methods
@return array | [
"Get",
"a",
"Graphql",
"Union",
"configuration",
"from",
"given",
"union",
"annotation",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L432-L453 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlFieldsFromAnnotations | private static function getGraphqlFieldsFromAnnotations(string $namespace, array $propertiesOrMethods, bool $isInput = false, bool $isMethod = false, string $currentValue = 'value', string $fieldAnnotationName = 'Field'): array
{
$fields = [];
foreach ($propertiesOrMethods as $target => $config) {
... | php | private static function getGraphqlFieldsFromAnnotations(string $namespace, array $propertiesOrMethods, bool $isInput = false, bool $isMethod = false, string $currentValue = 'value', string $fieldAnnotationName = 'Field'): array
{
$fields = [];
foreach ($propertiesOrMethods as $target => $config) {
... | [
"private",
"static",
"function",
"getGraphqlFieldsFromAnnotations",
"(",
"string",
"$",
"namespace",
",",
"array",
"$",
"propertiesOrMethods",
",",
"bool",
"$",
"isInput",
"=",
"false",
",",
"bool",
"$",
"isMethod",
"=",
"false",
",",
"string",
"$",
"currentValu... | Create Graphql fields configuration based on annotations.
@param string $namespace
@param array $propertiesOrMethods
@param bool $isInput
@param bool $isMethod
@param string $currentValue
@return array | [
"Create",
"Graphql",
"fields",
"configuration",
"based",
"on",
"annotations",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L466-L592 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getGraphqlFieldsFromProviders | private static function getGraphqlFieldsFromProviders(string $namespace, string $className, string $annotationName, string $targetType, bool $isRoot = false)
{
$fields = [];
foreach (self::$providers as $className => $configuration) {
$providerMethods = $configuration['methods'];
... | php | private static function getGraphqlFieldsFromProviders(string $namespace, string $className, string $annotationName, string $targetType, bool $isRoot = false)
{
$fields = [];
foreach (self::$providers as $className => $configuration) {
$providerMethods = $configuration['methods'];
... | [
"private",
"static",
"function",
"getGraphqlFieldsFromProviders",
"(",
"string",
"$",
"namespace",
",",
"string",
"$",
"className",
",",
"string",
"$",
"annotationName",
",",
"string",
"$",
"targetType",
",",
"bool",
"$",
"isRoot",
"=",
"false",
")",
"{",
"$",... | Return fields config from Provider methods.
@param string $className
@param array $methods
@param bool $isMutation
@return array | [
"Return",
"fields",
"config",
"from",
"Provider",
"methods",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L603-L642 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getDescriptionConfiguration | private static function getDescriptionConfiguration(array $annotations, bool $withDeprecation = false)
{
$config = [];
$descriptionAnnotation = self::getFirstAnnotationMatching($annotations, 'Overblog\GraphQLBundle\Annotation\Description');
if ($descriptionAnnotation) {
$config['... | php | private static function getDescriptionConfiguration(array $annotations, bool $withDeprecation = false)
{
$config = [];
$descriptionAnnotation = self::getFirstAnnotationMatching($annotations, 'Overblog\GraphQLBundle\Annotation\Description');
if ($descriptionAnnotation) {
$config['... | [
"private",
"static",
"function",
"getDescriptionConfiguration",
"(",
"array",
"$",
"annotations",
",",
"bool",
"$",
"withDeprecation",
"=",
"false",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"$",
"descriptionAnnotation",
"=",
"self",
"::",
"getFirstAnnotation... | Get the config for description & deprecation reason.
@param array $annotations
@param bool $withDeprecation
@return array | [
"Get",
"the",
"config",
"for",
"description",
"&",
"deprecation",
"reason",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L652-L668 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getArgs | private static function getArgs(array $args = null, \ReflectionMethod $method = null)
{
$config = [];
if ($args && !empty($args)) {
foreach ($args as $arg) {
$config[$arg->name] = ['type' => $arg->type] + ($arg->description ? ['description' => $arg->description] : []);
... | php | private static function getArgs(array $args = null, \ReflectionMethod $method = null)
{
$config = [];
if ($args && !empty($args)) {
foreach ($args as $arg) {
$config[$arg->name] = ['type' => $arg->type] + ($arg->description ? ['description' => $arg->description] : []);
... | [
"private",
"static",
"function",
"getArgs",
"(",
"array",
"$",
"args",
"=",
"null",
",",
"\\",
"ReflectionMethod",
"$",
"method",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"args",
"&&",
"!",
"empty",
"(",
"$",
"args"... | Get args config from an array of @Arg annotation or by auto-guessing if a method is provided.
@param array $args
@param \ReflectionMethod $method
@return array | [
"Get",
"args",
"config",
"from",
"an",
"array",
"of",
"@Arg",
"annotation",
"or",
"by",
"auto",
"-",
"guessing",
"if",
"a",
"method",
"is",
"provided",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L678-L690 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.formatArgsForExpression | private static function formatArgsForExpression(array $args)
{
$mapping = [];
foreach ($args as $name => $config) {
$mapping[] = \sprintf('%s: "%s"', $name, $config['type']);
}
return \sprintf('arguments({%s}, args)', \implode(', ', $mapping));
} | php | private static function formatArgsForExpression(array $args)
{
$mapping = [];
foreach ($args as $name => $config) {
$mapping[] = \sprintf('%s: "%s"', $name, $config['type']);
}
return \sprintf('arguments({%s}, args)', \implode(', ', $mapping));
} | [
"private",
"static",
"function",
"formatArgsForExpression",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"mapping",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"mapping",
"[",
"]",
"=",
"\\",
... | Format an array of args to a list of arguments in an expression.
@param array $args
@return string | [
"Format",
"an",
"array",
"of",
"args",
"to",
"a",
"list",
"of",
"arguments",
"in",
"an",
"expression",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L699-L707 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.getFirstAnnotationMatching | private static function getFirstAnnotationMatching(array $annotations, $annotationClass)
{
if (\is_string($annotationClass)) {
$annotationClass = [$annotationClass];
}
foreach ($annotations as $annotation) {
foreach ($annotationClass as $class) {
if (... | php | private static function getFirstAnnotationMatching(array $annotations, $annotationClass)
{
if (\is_string($annotationClass)) {
$annotationClass = [$annotationClass];
}
foreach ($annotations as $annotation) {
foreach ($annotationClass as $class) {
if (... | [
"private",
"static",
"function",
"getFirstAnnotationMatching",
"(",
"array",
"$",
"annotations",
",",
"$",
"annotationClass",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"annotationClass",
")",
")",
"{",
"$",
"annotationClass",
"=",
"[",
"$",
"annotation... | Get the first annotation matching given class.
@param array $annotations
@param string|array $annotationClass
@return mixed | [
"Get",
"the",
"first",
"annotation",
"matching",
"given",
"class",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L729-L744 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.suffixName | private static function suffixName(string $name, string $suffix)
{
return \substr($name, -\strlen($suffix)) === $suffix ? $name : \sprintf('%s%s', $name, $suffix);
} | php | private static function suffixName(string $name, string $suffix)
{
return \substr($name, -\strlen($suffix)) === $suffix ? $name : \sprintf('%s%s', $name, $suffix);
} | [
"private",
"static",
"function",
"suffixName",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"suffix",
")",
"{",
"return",
"\\",
"substr",
"(",
"$",
"name",
",",
"-",
"\\",
"strlen",
"(",
"$",
"suffix",
")",
")",
"===",
"$",
"suffix",
"?",
"$",
"... | Suffix a name if it is not already.
@param string $name
@param string $suffix
@return string | [
"Suffix",
"a",
"name",
"if",
"it",
"is",
"not",
"already",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L766-L769 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.guessType | private static function guessType(string $namespace, array $annotations)
{
$columnAnnotation = self::getFirstAnnotationMatching($annotations, 'Doctrine\ORM\Mapping\Column');
if ($columnAnnotation) {
$type = self::resolveTypeFromDoctrineType($columnAnnotation->type);
$nullable... | php | private static function guessType(string $namespace, array $annotations)
{
$columnAnnotation = self::getFirstAnnotationMatching($annotations, 'Doctrine\ORM\Mapping\Column');
if ($columnAnnotation) {
$type = self::resolveTypeFromDoctrineType($columnAnnotation->type);
$nullable... | [
"private",
"static",
"function",
"guessType",
"(",
"string",
"$",
"namespace",
",",
"array",
"$",
"annotations",
")",
"{",
"$",
"columnAnnotation",
"=",
"self",
"::",
"getFirstAnnotationMatching",
"(",
"$",
"annotations",
",",
"'Doctrine\\ORM\\Mapping\\Column'",
")"... | Try to guess a field type base on is annotations.
@param string $namespace
@param array $annotations
@return string|false | [
"Try",
"to",
"guess",
"a",
"field",
"type",
"base",
"on",
"is",
"annotations",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L779-L823 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.resolveTypeFromDoctrineType | private static function resolveTypeFromDoctrineType(string $doctrineType)
{
if (isset(self::$doctrineMapping[$doctrineType])) {
return self::$doctrineMapping[$doctrineType];
}
switch ($doctrineType) {
case 'integer':
case 'smallint':
case 'big... | php | private static function resolveTypeFromDoctrineType(string $doctrineType)
{
if (isset(self::$doctrineMapping[$doctrineType])) {
return self::$doctrineMapping[$doctrineType];
}
switch ($doctrineType) {
case 'integer':
case 'smallint':
case 'big... | [
"private",
"static",
"function",
"resolveTypeFromDoctrineType",
"(",
"string",
"$",
"doctrineType",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"doctrineMapping",
"[",
"$",
"doctrineType",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"doctrineM... | Resolve a GraphqlType from a doctrine type.
@param string $doctrineType
@return string|false | [
"Resolve",
"a",
"GraphqlType",
"from",
"a",
"doctrine",
"type",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L849-L876 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.guessArgs | private static function guessArgs(\ReflectionMethod $method)
{
$arguments = [];
foreach ($method->getParameters() as $index => $parameter) {
if (!$parameter->hasType()) {
throw new InvalidArgumentException(\sprintf('Argument n°%s "$%s" on method "%s" cannot be auto-guesse... | php | private static function guessArgs(\ReflectionMethod $method)
{
$arguments = [];
foreach ($method->getParameters() as $index => $parameter) {
if (!$parameter->hasType()) {
throw new InvalidArgumentException(\sprintf('Argument n°%s "$%s" on method "%s" cannot be auto-guesse... | [
"private",
"static",
"function",
"guessArgs",
"(",
"\\",
"ReflectionMethod",
"$",
"method",
")",
"{",
"$",
"arguments",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"method",
"->",
"getParameters",
"(",
")",
"as",
"$",
"index",
"=>",
"$",
"parameter",
")",
... | Transform a method arguments from reflection to a list of GraphQL argument.
@param \ReflectionMethod $method
@return array | [
"Transform",
"a",
"method",
"arguments",
"from",
"reflection",
"to",
"a",
"list",
"of",
"GraphQL",
"argument",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L885-L910 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.resolveGraphqlTypeFromReflectionType | private static function resolveGraphqlTypeFromReflectionType(\ReflectionType $type, array $filterGraphqlTypes = null, bool $isOptionnal = false)
{
$stype = (string) $type;
if ($type->isBuiltin()) {
$gqlType = self::resolveTypeFromPhpType($stype);
if (!$gqlType) {
... | php | private static function resolveGraphqlTypeFromReflectionType(\ReflectionType $type, array $filterGraphqlTypes = null, bool $isOptionnal = false)
{
$stype = (string) $type;
if ($type->isBuiltin()) {
$gqlType = self::resolveTypeFromPhpType($stype);
if (!$gqlType) {
... | [
"private",
"static",
"function",
"resolveGraphqlTypeFromReflectionType",
"(",
"\\",
"ReflectionType",
"$",
"type",
",",
"array",
"$",
"filterGraphqlTypes",
"=",
"null",
",",
"bool",
"$",
"isOptionnal",
"=",
"false",
")",
"{",
"$",
"stype",
"=",
"(",
"string",
... | Try to guess a GraphQL type from a Reflected Type.
@param \ReflectionType $type
@return string | [
"Try",
"to",
"guess",
"a",
"GraphQL",
"type",
"from",
"a",
"Reflected",
"Type",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L919-L935 |
overblog/GraphQLBundle | src/Config/Parser/AnnotationParser.php | AnnotationParser.resolveTypeFromClass | private static function resolveTypeFromClass(string $className, array $wantedTypes = null)
{
foreach (self::$classesMap as $gqlType => $config) {
if ($config['class'] === $className) {
if (!$wantedTypes || \in_array($config['type'], $wantedTypes)) {
return $gq... | php | private static function resolveTypeFromClass(string $className, array $wantedTypes = null)
{
foreach (self::$classesMap as $gqlType => $config) {
if ($config['class'] === $className) {
if (!$wantedTypes || \in_array($config['type'], $wantedTypes)) {
return $gq... | [
"private",
"static",
"function",
"resolveTypeFromClass",
"(",
"string",
"$",
"className",
",",
"array",
"$",
"wantedTypes",
"=",
"null",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"classesMap",
"as",
"$",
"gqlType",
"=>",
"$",
"config",
")",
"{",
"if",
... | Resolve a GraphQL Type from a class name.
@param string $className
@param array $wantedTypes
@return string|false | [
"Resolve",
"a",
"GraphQL",
"Type",
"from",
"a",
"class",
"name",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/AnnotationParser.php#L945-L956 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.connectionFromArray | public function connectionFromArray(array $data, $args = []): ConnectionInterface
{
return $this->connectionFromArraySlice(
$data,
$args,
[
'sliceStart' => 0,
'arrayLength' => \count($data),
]
);
} | php | public function connectionFromArray(array $data, $args = []): ConnectionInterface
{
return $this->connectionFromArraySlice(
$data,
$args,
[
'sliceStart' => 0,
'arrayLength' => \count($data),
]
);
} | [
"public",
"function",
"connectionFromArray",
"(",
"array",
"$",
"data",
",",
"$",
"args",
"=",
"[",
"]",
")",
":",
"ConnectionInterface",
"{",
"return",
"$",
"this",
"->",
"connectionFromArraySlice",
"(",
"$",
"data",
",",
"$",
"args",
",",
"[",
"'sliceSta... | A simple function that accepts an array and connection arguments, and returns
a connection object for use in GraphQL. It uses array offsets as pagination,
so pagination will only work if the array is static.
@param array $data
@param array|Argument $args
@return ConnectionInterface | [
"A",
"simple",
"function",
"that",
"accepts",
"an",
"array",
"and",
"connection",
"arguments",
"and",
"returns",
"a",
"connection",
"object",
"for",
"use",
"in",
"GraphQL",
".",
"It",
"uses",
"array",
"offsets",
"as",
"pagination",
"so",
"pagination",
"will",
... | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L51-L61 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.connectionFromPromisedArray | public function connectionFromPromisedArray($dataPromise, $args = [])
{
$this->checkPromise($dataPromise);
return $dataPromise->then(function ($data) use ($args) {
return $this->connectionFromArray($data, $args);
});
} | php | public function connectionFromPromisedArray($dataPromise, $args = [])
{
$this->checkPromise($dataPromise);
return $dataPromise->then(function ($data) use ($args) {
return $this->connectionFromArray($data, $args);
});
} | [
"public",
"function",
"connectionFromPromisedArray",
"(",
"$",
"dataPromise",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"checkPromise",
"(",
"$",
"dataPromise",
")",
";",
"return",
"$",
"dataPromise",
"->",
"then",
"(",
"function",
"(",... | A version of `connectionFromArray` that takes a promised array, and returns a
promised connection.
@param mixed $dataPromise a promise
@param array|Argument $args
@return mixed a promise | [
"A",
"version",
"of",
"connectionFromArray",
"that",
"takes",
"a",
"promised",
"array",
"and",
"returns",
"a",
"promised",
"connection",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L72-L79 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.connectionFromArraySlice | public function connectionFromArraySlice(array $arraySlice, $args, array $meta): ConnectionInterface
{
$connectionArguments = $this->getOptionsWithDefaults(
$args instanceof Argument ? $args->getRawArguments() : $args,
[
'after' => '',
'before' => '',
... | php | public function connectionFromArraySlice(array $arraySlice, $args, array $meta): ConnectionInterface
{
$connectionArguments = $this->getOptionsWithDefaults(
$args instanceof Argument ? $args->getRawArguments() : $args,
[
'after' => '',
'before' => '',
... | [
"public",
"function",
"connectionFromArraySlice",
"(",
"array",
"$",
"arraySlice",
",",
"$",
"args",
",",
"array",
"$",
"meta",
")",
":",
"ConnectionInterface",
"{",
"$",
"connectionArguments",
"=",
"$",
"this",
"->",
"getOptionsWithDefaults",
"(",
"$",
"args",
... | Given a slice (subset) of an array, returns a connection object for use in
GraphQL.
This function is similar to `connectionFromArray`, but is intended for use
cases where you know the cardinality of the connection, consider it too large
to materialize the entire array, and instead wish pass in a slice of the
total res... | [
"Given",
"a",
"slice",
"(",
"subset",
")",
"of",
"an",
"array",
"returns",
"a",
"connection",
"object",
"for",
"use",
"in",
"GraphQL",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L96-L169 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.connectionFromPromisedArraySlice | public function connectionFromPromisedArraySlice($dataPromise, $args, array $meta)
{
$this->checkPromise($dataPromise);
return $dataPromise->then(function ($arraySlice) use ($args, $meta) {
return $this->connectionFromArraySlice($arraySlice, $args, $meta);
});
} | php | public function connectionFromPromisedArraySlice($dataPromise, $args, array $meta)
{
$this->checkPromise($dataPromise);
return $dataPromise->then(function ($arraySlice) use ($args, $meta) {
return $this->connectionFromArraySlice($arraySlice, $args, $meta);
});
} | [
"public",
"function",
"connectionFromPromisedArraySlice",
"(",
"$",
"dataPromise",
",",
"$",
"args",
",",
"array",
"$",
"meta",
")",
"{",
"$",
"this",
"->",
"checkPromise",
"(",
"$",
"dataPromise",
")",
";",
"return",
"$",
"dataPromise",
"->",
"then",
"(",
... | A version of `connectionFromArraySlice` that takes a promised array slice,
and returns a promised connection.
@param mixed $dataPromise a promise
@param array|Argument $args
@param array $meta
@return mixed a promise | [
"A",
"version",
"of",
"connectionFromArraySlice",
"that",
"takes",
"a",
"promised",
"array",
"slice",
"and",
"returns",
"a",
"promised",
"connection",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L181-L188 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.cursorForObjectInConnection | public function cursorForObjectInConnection(array $data, $object): ? string
{
$offset = null;
foreach ($data as $i => $entry) {
// When using the comparison operator (==), object variables are compared in a simple manner,
// namely: Two object instances are equal if they hav... | php | public function cursorForObjectInConnection(array $data, $object): ? string
{
$offset = null;
foreach ($data as $i => $entry) {
// When using the comparison operator (==), object variables are compared in a simple manner,
// namely: Two object instances are equal if they hav... | [
"public",
"function",
"cursorForObjectInConnection",
"(",
"array",
"$",
"data",
",",
"$",
"object",
")",
":",
"?",
"string",
"{",
"$",
"offset",
"=",
"null",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"i",
"=>",
"$",
"entry",
")",
"{",
"// When using... | Return the cursor associated with an object in an array.
@param array $data
@param mixed $object
@return string|null | [
"Return",
"the",
"cursor",
"associated",
"with",
"an",
"object",
"in",
"an",
"array",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L198-L217 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.getOffsetWithDefault | public function getOffsetWithDefault(?string $cursor, int $defaultOffset): int
{
if (empty($cursor)) {
return $defaultOffset;
}
$offset = $this->cursorToOffset($cursor);
return !\is_numeric($offset) ? $defaultOffset : (int) $offset;
} | php | public function getOffsetWithDefault(?string $cursor, int $defaultOffset): int
{
if (empty($cursor)) {
return $defaultOffset;
}
$offset = $this->cursorToOffset($cursor);
return !\is_numeric($offset) ? $defaultOffset : (int) $offset;
} | [
"public",
"function",
"getOffsetWithDefault",
"(",
"?",
"string",
"$",
"cursor",
",",
"int",
"$",
"defaultOffset",
")",
":",
"int",
"{",
"if",
"(",
"empty",
"(",
"$",
"cursor",
")",
")",
"{",
"return",
"$",
"defaultOffset",
";",
"}",
"$",
"offset",
"="... | Given an optional cursor and a default offset, returns the offset
to use; if the cursor contains a valid offset, that will be used,
otherwise it will be the default.
@param string|null $cursor
@param int $defaultOffset
@return int | [
"Given",
"an",
"optional",
"cursor",
"and",
"a",
"default",
"offset",
"returns",
"the",
"offset",
"to",
"use",
";",
"if",
"the",
"cursor",
"contains",
"a",
"valid",
"offset",
"that",
"will",
"be",
"used",
"otherwise",
"it",
"will",
"be",
"the",
"default",
... | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L229-L237 |
overblog/GraphQLBundle | src/Relay/Connection/ConnectionBuilder.php | ConnectionBuilder.cursorToOffset | public function cursorToOffset($cursor): string
{
if (null === $cursor) {
return '';
}
return \str_replace(static::PREFIX, '', \base64_decode($cursor, true));
} | php | public function cursorToOffset($cursor): string
{
if (null === $cursor) {
return '';
}
return \str_replace(static::PREFIX, '', \base64_decode($cursor, true));
} | [
"public",
"function",
"cursorToOffset",
"(",
"$",
"cursor",
")",
":",
"string",
"{",
"if",
"(",
"null",
"===",
"$",
"cursor",
")",
"{",
"return",
"''",
";",
"}",
"return",
"\\",
"str_replace",
"(",
"static",
"::",
"PREFIX",
",",
"''",
",",
"\\",
"bas... | Redefines the offset from the cursor string.
@param $cursor
@return string | [
"Redefines",
"the",
"offset",
"from",
"the",
"cursor",
"string",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/ConnectionBuilder.php#L258-L265 |
overblog/GraphQLBundle | src/Executor/Promise/Adapter/ReactPromiseAdapter.php | ReactPromiseAdapter.wait | public function wait(Promise $promise, callable $onProgress = null): ?ExecutionResult
{
if (!$this->isThenable($promise)) {
throw new \InvalidArgumentException(\sprintf('The "%s" method must be call with compatible a Promise.', __METHOD__));
}
$wait = true;
$resolvedValue... | php | public function wait(Promise $promise, callable $onProgress = null): ?ExecutionResult
{
if (!$this->isThenable($promise)) {
throw new \InvalidArgumentException(\sprintf('The "%s" method must be call with compatible a Promise.', __METHOD__));
}
$wait = true;
$resolvedValue... | [
"public",
"function",
"wait",
"(",
"Promise",
"$",
"promise",
",",
"callable",
"$",
"onProgress",
"=",
"null",
")",
":",
"?",
"ExecutionResult",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isThenable",
"(",
"$",
"promise",
")",
")",
"{",
"throw",
"new",
... | Synchronously wait when promise completes.
@param Promise $promise
@param callable $onProgress
@return ExecutionResult
@throws \Exception | [
"Synchronously",
"wait",
"when",
"promise",
"completes",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Executor/Promise/Adapter/ReactPromiseAdapter.php#L44-L78 |
overblog/GraphQLBundle | src/Config/Processor/NamedConfigProcessor.php | NamedConfigProcessor.process | public static function process(array $configs): array
{
foreach ($configs as $name => &$config) {
if (empty($config['class_name'])) {
$config['class_name'] = \sprintf('%sType', $name);
}
if (empty($config['config']['name'])) {
$config['conf... | php | public static function process(array $configs): array
{
foreach ($configs as $name => &$config) {
if (empty($config['class_name'])) {
$config['class_name'] = \sprintf('%sType', $name);
}
if (empty($config['config']['name'])) {
$config['conf... | [
"public",
"static",
"function",
"process",
"(",
"array",
"$",
"configs",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"name",
"=>",
"&",
"$",
"config",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"config",
"[",
"'class_name'",
"]",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/NamedConfigProcessor.php#L12-L24 |
overblog/GraphQLBundle | src/Config/Parser/XmlParser.php | XmlParser.parse | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
$typesConfig = [];
$container->addResource(new FileResource($file->getRealPath()));
try {
$xml = XmlUtils::loadFile($file->getRealPath());
foreach ($xml->docume... | php | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
$typesConfig = [];
$container->addResource(new FileResource($file->getRealPath()));
try {
$xml = XmlUtils::loadFile($file->getRealPath());
foreach ($xml->docume... | [
"public",
"static",
"function",
"parse",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configs",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"typesConfig",
"=",
"[",
"]",
";",
"$",
"container",
"-... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/XmlParser.php#L17-L37 |
overblog/GraphQLBundle | src/Config/TypeWithOutputFieldsDefinition.php | TypeWithOutputFieldsDefinition.outputFieldsSelection | protected function outputFieldsSelection(string $name = 'fields')
{
$node = self::createNode($name);
$node
->isRequired()
->requiresAtLeastOneElement();
/* @var ArrayNodeDefinition $prototype */
$prototype = $node->useAttributeAsKey('name', false)->prototype('... | php | protected function outputFieldsSelection(string $name = 'fields')
{
$node = self::createNode($name);
$node
->isRequired()
->requiresAtLeastOneElement();
/* @var ArrayNodeDefinition $prototype */
$prototype = $node->useAttributeAsKey('name', false)->prototype('... | [
"protected",
"function",
"outputFieldsSelection",
"(",
"string",
"$",
"name",
"=",
"'fields'",
")",
"{",
"$",
"node",
"=",
"self",
"::",
"createNode",
"(",
"$",
"name",
")",
";",
"$",
"node",
"->",
"isRequired",
"(",
")",
"->",
"requiresAtLeastOneElement",
... | @param string $name
@return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition | [
"@param",
"string",
"$name"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/TypeWithOutputFieldsDefinition.php#L16-L65 |
overblog/GraphQLBundle | src/Relay/Connection/Paginator.php | Paginator.backward | public function backward($args, $total, array $callableArgs = [])
{
$total = $this->computeTotalCount($total, $callableArgs);
$args = $this->protectArgs($args);
$limit = $args['last'];
$offset = \max(0, $this->connectionBuilder->getOffsetWithDefault($args['before'], $total) - $limit... | php | public function backward($args, $total, array $callableArgs = [])
{
$total = $this->computeTotalCount($total, $callableArgs);
$args = $this->protectArgs($args);
$limit = $args['last'];
$offset = \max(0, $this->connectionBuilder->getOffsetWithDefault($args['before'], $total) - $limit... | [
"public",
"function",
"backward",
"(",
"$",
"args",
",",
"$",
"total",
",",
"array",
"$",
"callableArgs",
"=",
"[",
"]",
")",
"{",
"$",
"total",
"=",
"$",
"this",
"->",
"computeTotalCount",
"(",
"$",
"total",
",",
"$",
"callableArgs",
")",
";",
"$",
... | @param Argument $args
@param int|callable $total
@param array $callableArgs
@return ConnectionInterface|object A connection or a promise | [
"@param",
"Argument",
"$args",
"@param",
"int|callable",
"$total",
"@param",
"array",
"$callableArgs"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/Paginator.php#L44-L60 |
overblog/GraphQLBundle | src/Relay/Connection/Paginator.php | Paginator.forward | public function forward(Argument $args)
{
$args = $this->protectArgs($args);
$limit = $args['first'];
$offset = $this->connectionBuilder->getOffsetWithDefault($args['after'], 0);
// If we don't have a cursor or if it's not valid, then we must not use the slice method
if (!\i... | php | public function forward(Argument $args)
{
$args = $this->protectArgs($args);
$limit = $args['first'];
$offset = $this->connectionBuilder->getOffsetWithDefault($args['after'], 0);
// If we don't have a cursor or if it's not valid, then we must not use the slice method
if (!\i... | [
"public",
"function",
"forward",
"(",
"Argument",
"$",
"args",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"protectArgs",
"(",
"$",
"args",
")",
";",
"$",
"limit",
"=",
"$",
"args",
"[",
"'first'",
"]",
";",
"$",
"offset",
"=",
"$",
"this",
"-... | @param Argument $args
@return ConnectionInterface|object A connection or a promise | [
"@param",
"Argument",
"$args"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/Paginator.php#L67-L90 |
overblog/GraphQLBundle | src/Relay/Connection/Paginator.php | Paginator.auto | public function auto(Argument $args, $total, array $callableArgs = [])
{
$args = $this->protectArgs($args);
if ($args['last']) {
$connection = $this->backward($args, $total, $callableArgs);
} else {
$connection = $this->forward($args);
}
if ($this->p... | php | public function auto(Argument $args, $total, array $callableArgs = [])
{
$args = $this->protectArgs($args);
if ($args['last']) {
$connection = $this->backward($args, $total, $callableArgs);
} else {
$connection = $this->forward($args);
}
if ($this->p... | [
"public",
"function",
"auto",
"(",
"Argument",
"$",
"args",
",",
"$",
"total",
",",
"array",
"$",
"callableArgs",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"protectArgs",
"(",
"$",
"args",
")",
";",
"if",
"(",
"$",
"args",
"["... | @param Argument $args
@param int|callable $total
@param array $callableArgs
@return ConnectionInterface|object A connection or a promise | [
"@param",
"Argument",
"$args",
"@param",
"int|callable",
"$total",
"@param",
"array",
"$callableArgs"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/Paginator.php#L99-L120 |
overblog/GraphQLBundle | src/Relay/Connection/Paginator.php | Paginator.handleEntities | private function handleEntities($entities, callable $callback)
{
if ($this->promise) {
return $entities->then($callback);
}
return \call_user_func($callback, $entities);
} | php | private function handleEntities($entities, callable $callback)
{
if ($this->promise) {
return $entities->then($callback);
}
return \call_user_func($callback, $entities);
} | [
"private",
"function",
"handleEntities",
"(",
"$",
"entities",
",",
"callable",
"$",
"callback",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"promise",
")",
"{",
"return",
"$",
"entities",
"->",
"then",
"(",
"$",
"callback",
")",
";",
"}",
"return",
"\\",
... | @param array|object $entities An array of entities to paginate or a promise
@param callable $callback
@return ConnectionInterface|object A connection or a promise | [
"@param",
"array|object",
"$entities",
"An",
"array",
"of",
"entities",
"to",
"paginate",
"or",
"a",
"promise",
"@param",
"callable",
"$callback"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/Paginator.php#L128-L135 |
overblog/GraphQLBundle | src/Relay/Connection/Paginator.php | Paginator.computeTotalCount | private function computeTotalCount($total, array $callableArgs = [])
{
if (null !== $this->totalCount) {
return $this->totalCount;
}
$this->totalCount = \is_callable($total) ? \call_user_func_array($total, $callableArgs) : $total;
return $this->totalCount;
} | php | private function computeTotalCount($total, array $callableArgs = [])
{
if (null !== $this->totalCount) {
return $this->totalCount;
}
$this->totalCount = \is_callable($total) ? \call_user_func_array($total, $callableArgs) : $total;
return $this->totalCount;
} | [
"private",
"function",
"computeTotalCount",
"(",
"$",
"total",
",",
"array",
"$",
"callableArgs",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"totalCount",
")",
"{",
"return",
"$",
"this",
"->",
"totalCount",
";",
"}",
"$",
... | @param int|callable $total
@param array $callableArgs
@return int|mixed | [
"@param",
"int|callable",
"$total",
"@param",
"array",
"$callableArgs"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Relay/Connection/Paginator.php#L153-L162 |
overblog/GraphQLBundle | src/Resolver/ResolverMap.php | ResolverMap.resolve | public function resolve(string $typeName, string $fieldName)
{
$loadedMap = $this->getLoadedMap();
if (!$this->isResolvable($typeName, $fieldName)) {
throw new UnresolvableException(\sprintf('Field "%s.%s" could not be resolved.', $typeName, $fieldName));
}
return $load... | php | public function resolve(string $typeName, string $fieldName)
{
$loadedMap = $this->getLoadedMap();
if (!$this->isResolvable($typeName, $fieldName)) {
throw new UnresolvableException(\sprintf('Field "%s.%s" could not be resolved.', $typeName, $fieldName));
}
return $load... | [
"public",
"function",
"resolve",
"(",
"string",
"$",
"typeName",
",",
"string",
"$",
"fieldName",
")",
"{",
"$",
"loadedMap",
"=",
"$",
"this",
"->",
"getLoadedMap",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isResolvable",
"(",
"$",
"typeName"... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMap.php#L39-L48 |
overblog/GraphQLBundle | src/Resolver/ResolverMap.php | ResolverMap.isResolvable | public function isResolvable(string $typeName, string $fieldName): bool
{
$key = $typeName.'.'.$fieldName;
if (!isset($this->memorized[$key])) {
$loadedMap = $this->getLoadedMap();
$this->memorized[$key] = isset($loadedMap[$typeName]) && \array_key_exists($fieldName, $loadedM... | php | public function isResolvable(string $typeName, string $fieldName): bool
{
$key = $typeName.'.'.$fieldName;
if (!isset($this->memorized[$key])) {
$loadedMap = $this->getLoadedMap();
$this->memorized[$key] = isset($loadedMap[$typeName]) && \array_key_exists($fieldName, $loadedM... | [
"public",
"function",
"isResolvable",
"(",
"string",
"$",
"typeName",
",",
"string",
"$",
"fieldName",
")",
":",
"bool",
"{",
"$",
"key",
"=",
"$",
"typeName",
".",
"'.'",
".",
"$",
"fieldName",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMap.php#L53-L62 |
overblog/GraphQLBundle | src/Resolver/ResolverMap.php | ResolverMap.covered | public function covered(?string $typeName = null)
{
$loadedMap = $this->getLoadedMap();
$covered = [];
$resolvers = [];
if (null === $typeName) {
$resolvers = $loadedMap;
} elseif (isset($loadedMap[$typeName])) {
$resolvers = $loadedMap[$typeName];
... | php | public function covered(?string $typeName = null)
{
$loadedMap = $this->getLoadedMap();
$covered = [];
$resolvers = [];
if (null === $typeName) {
$resolvers = $loadedMap;
} elseif (isset($loadedMap[$typeName])) {
$resolvers = $loadedMap[$typeName];
... | [
"public",
"function",
"covered",
"(",
"?",
"string",
"$",
"typeName",
"=",
"null",
")",
"{",
"$",
"loadedMap",
"=",
"$",
"this",
"->",
"getLoadedMap",
"(",
")",
";",
"$",
"covered",
"=",
"[",
"]",
";",
"$",
"resolvers",
"=",
"[",
"]",
";",
"if",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/ResolverMap.php#L67-L83 |
overblog/GraphQLBundle | src/ExpressionLanguage/ExpressionFunction/Security/Helper.php | Helper.getToken | private static function getToken(GlobalVariables $globalVariable)
{
if (!$globalVariable->get('container')->has('security.token_storage')) {
return;
}
return $globalVariable->get('container')->get('security.token_storage')->getToken();
} | php | private static function getToken(GlobalVariables $globalVariable)
{
if (!$globalVariable->get('container')->has('security.token_storage')) {
return;
}
return $globalVariable->get('container')->get('security.token_storage')->getToken();
} | [
"private",
"static",
"function",
"getToken",
"(",
"GlobalVariables",
"$",
"globalVariable",
")",
"{",
"if",
"(",
"!",
"$",
"globalVariable",
"->",
"get",
"(",
"'container'",
")",
"->",
"has",
"(",
"'security.token_storage'",
")",
")",
"{",
"return",
";",
"}"... | @param GlobalVariables $globalVariable
@return TokenInterface|null | [
"@param",
"GlobalVariables",
"$globalVariable"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/ExpressionLanguage/ExpressionFunction/Security/Helper.php#L17-L24 |
overblog/GraphQLBundle | src/EventListener/ErrorLoggerListener.php | ErrorLoggerListener.serializeThrowableObject | private static function serializeThrowableObject($throwable): string
{
$message = \sprintf(
'[GraphQL] %s: %s[%d] (caught throwable) at %s line %s.',
\get_class($throwable),
$throwable->getMessage(),
$throwable->getCode(),
$throwable->getFile(),
... | php | private static function serializeThrowableObject($throwable): string
{
$message = \sprintf(
'[GraphQL] %s: %s[%d] (caught throwable) at %s line %s.',
\get_class($throwable),
$throwable->getMessage(),
$throwable->getCode(),
$throwable->getFile(),
... | [
"private",
"static",
"function",
"serializeThrowableObject",
"(",
"$",
"throwable",
")",
":",
"string",
"{",
"$",
"message",
"=",
"\\",
"sprintf",
"(",
"'[GraphQL] %s: %s[%d] (caught throwable) at %s line %s.'",
",",
"\\",
"get_class",
"(",
"$",
"throwable",
")",
",... | @param \Throwable $throwable
@return string | [
"@param",
"\\",
"Throwable",
"$throwable"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/EventListener/ErrorLoggerListener.php#L66-L78 |
overblog/GraphQLBundle | src/DependencyInjection/Compiler/GlobalVariablesPass.php | GlobalVariablesPass.process | public function process(ContainerBuilder $container): void
{
$taggedServices = $container->findTaggedServiceIds('overblog_graphql.global_variable', true);
$globalVariables = ['container' => new Reference('service_container')];
$expressionLanguageDefinition = $container->findDefinition('overb... | php | public function process(ContainerBuilder $container): void
{
$taggedServices = $container->findTaggedServiceIds('overblog_graphql.global_variable', true);
$globalVariables = ['container' => new Reference('service_container')];
$expressionLanguageDefinition = $container->findDefinition('overb... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"$",
"taggedServices",
"=",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
"'overblog_graphql.global_variable'",
",",
"true",
")",
";",
"$",
"globalVariables",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Compiler/GlobalVariablesPass.php#L17-L45 |
overblog/GraphQLBundle | src/Config/Processor/RelayProcessor.php | RelayProcessor.process | public static function process(array $configs): array
{
foreach (static::RELAY_DEFINITION_MAPPING as $typeName => $definitionBuilderClass) {
$configs = self::processRelayConfigs($typeName, $definitionBuilderClass, $configs);
}
return $configs;
} | php | public static function process(array $configs): array
{
foreach (static::RELAY_DEFINITION_MAPPING as $typeName => $definitionBuilderClass) {
$configs = self::processRelayConfigs($typeName, $definitionBuilderClass, $configs);
}
return $configs;
} | [
"public",
"static",
"function",
"process",
"(",
"array",
"$",
"configs",
")",
":",
"array",
"{",
"foreach",
"(",
"static",
"::",
"RELAY_DEFINITION_MAPPING",
"as",
"$",
"typeName",
"=>",
"$",
"definitionBuilderClass",
")",
"{",
"$",
"configs",
"=",
"self",
":... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/RelayProcessor.php#L25-L32 |
overblog/GraphQLBundle | src/Error/UserErrors.php | UserErrors.addError | public function addError($error)
{
if (\is_string($error)) {
$error = new UserError($error);
} elseif (!\is_object($error) || !$error instanceof \GraphQL\Error\UserError) {
throw new \InvalidArgumentException(\sprintf('Error must be string or instance of %s.', \GraphQL\Error\... | php | public function addError($error)
{
if (\is_string($error)) {
$error = new UserError($error);
} elseif (!\is_object($error) || !$error instanceof \GraphQL\Error\UserError) {
throw new \InvalidArgumentException(\sprintf('Error must be string or instance of %s.', \GraphQL\Error\... | [
"public",
"function",
"addError",
"(",
"$",
"error",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"error",
")",
")",
"{",
"$",
"error",
"=",
"new",
"UserError",
"(",
"$",
"error",
")",
";",
"}",
"elseif",
"(",
"!",
"\\",
"is_object",
"(",
"$... | @param string|\GraphQL\Error\UserError $error
@return $this | [
"@param",
"string|",
"\\",
"GraphQL",
"\\",
"Error",
"\\",
"UserError",
"$error"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/UserErrors.php#L36-L47 |
overblog/GraphQLBundle | src/Error/InvalidArgumentsError.php | InvalidArgumentsError.toState | public function toState()
{
$state = [];
foreach ($this->getErrors() as $error) {
$state[$error->getName()] = [];
foreach ($error->getErrors() as $violation) {
$state[$error->getName()][] = [
'path' => $violation->getPropertyPath(),
... | php | public function toState()
{
$state = [];
foreach ($this->getErrors() as $error) {
$state[$error->getName()] = [];
foreach ($error->getErrors() as $violation) {
$state[$error->getName()][] = [
'path' => $violation->getPropertyPath(),
... | [
"public",
"function",
"toState",
"(",
")",
"{",
"$",
"state",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getErrors",
"(",
")",
"as",
"$",
"error",
")",
"{",
"$",
"state",
"[",
"$",
"error",
"->",
"getName",
"(",
")",
"]",
"=",
"[",... | Return a serializable array of validation errors for each argument.
@return array | [
"Return",
"a",
"serializable",
"array",
"of",
"validation",
"errors",
"for",
"each",
"argument",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Error/InvalidArgumentsError.php#L36-L51 |
overblog/GraphQLBundle | src/Resolver/AbstractResolver.php | AbstractResolver.getSolutionOptions | public function getSolutionOptions(string $id)
{
$id = $this->resolveAlias($id);
return isset($this->solutionOptions[$id]) ? $this->solutionOptions[$id] : [];
} | php | public function getSolutionOptions(string $id)
{
$id = $this->resolveAlias($id);
return isset($this->solutionOptions[$id]) ? $this->solutionOptions[$id] : [];
} | [
"public",
"function",
"getSolutionOptions",
"(",
"string",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"resolveAlias",
"(",
"$",
"id",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"solutionOptions",
"[",
"$",
"id",
"]",
")",
"?",
... | @param $id
@return mixed | [
"@param",
"$id"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/AbstractResolver.php#L77-L82 |
overblog/GraphQLBundle | src/Resolver/AbstractResolver.php | AbstractResolver.loadSolution | private function loadSolution(string $id)
{
$id = $this->resolveAlias($id);
if (!$this->hasSolution($id)) {
return null;
}
if ($this->fullyLoadedSolutions[$id]) {
return $this->solutions[$id];
} else {
$loader = $this->solutions[$id];
... | php | private function loadSolution(string $id)
{
$id = $this->resolveAlias($id);
if (!$this->hasSolution($id)) {
return null;
}
if ($this->fullyLoadedSolutions[$id]) {
return $this->solutions[$id];
} else {
$loader = $this->solutions[$id];
... | [
"private",
"function",
"loadSolution",
"(",
"string",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"resolveAlias",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasSolution",
"(",
"$",
"id",
")",
")",
"{",
"return",
"nu... | @param string $id
@return mixed | [
"@param",
"string",
"$id"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/AbstractResolver.php#L93-L110 |
overblog/GraphQLBundle | src/Resolver/AbstractResolver.php | AbstractResolver.supportsSolution | protected function supportsSolution($solution): bool
{
$supportedClass = $this->supportedSolutionClass();
return null === $supportedClass || $solution instanceof $supportedClass;
} | php | protected function supportsSolution($solution): bool
{
$supportedClass = $this->supportedSolutionClass();
return null === $supportedClass || $solution instanceof $supportedClass;
} | [
"protected",
"function",
"supportsSolution",
"(",
"$",
"solution",
")",
":",
"bool",
"{",
"$",
"supportedClass",
"=",
"$",
"this",
"->",
"supportedSolutionClass",
"(",
")",
";",
"return",
"null",
"===",
"$",
"supportedClass",
"||",
"$",
"solution",
"instanceof... | @param mixed $solution
@return bool | [
"@param",
"mixed",
"$solution"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Resolver/AbstractResolver.php#L146-L151 |
overblog/GraphQLBundle | src/Config/Parser/YamlParser.php | YamlParser.parse | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
if (null === self::$yamlParser) {
self::$yamlParser = new Parser();
}
$container->addResource(new FileResource($file->getRealPath()));
try {
$typesConf... | php | public static function parse(\SplFileInfo $file, ContainerBuilder $container, array $configs = []): array
{
if (null === self::$yamlParser) {
self::$yamlParser = new Parser();
}
$container->addResource(new FileResource($file->getRealPath()));
try {
$typesConf... | [
"public",
"static",
"function",
"parse",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"configs",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"yamlParser",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Parser/YamlParser.php#L21-L35 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.endpointAction | public function endpointAction(Request $request, string $schemaName = null)
{
return $this->createResponse($request, $schemaName, false);
} | php | public function endpointAction(Request $request, string $schemaName = null)
{
return $this->createResponse($request, $schemaName, false);
} | [
"public",
"function",
"endpointAction",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createResponse",
"(",
"$",
"request",
",",
"$",
"schemaName",
",",
"false",
")",
";",
"}"
] | @param Request $request
@param string|null $schemaName
@return JsonResponse|Response | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L59-L62 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.batchEndpointAction | public function batchEndpointAction(Request $request, string $schemaName = null)
{
return $this->createResponse($request, $schemaName, true);
} | php | public function batchEndpointAction(Request $request, string $schemaName = null)
{
return $this->createResponse($request, $schemaName, true);
} | [
"public",
"function",
"batchEndpointAction",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createResponse",
"(",
"$",
"request",
",",
"$",
"schemaName",
",",
"true",
")",
";",
"}"
] | @param Request $request
@param string|null $schemaName
@return JsonResponse|Response | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L70-L73 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.createResponse | private function createResponse(Request $request, string $schemaName = null, bool $batched)
{
if ('OPTIONS' === $request->getMethod()) {
$response = new JsonResponse([], 200);
} else {
if (!\in_array($request->getMethod(), ['POST', 'GET'])) {
return new Respon... | php | private function createResponse(Request $request, string $schemaName = null, bool $batched)
{
if ('OPTIONS' === $request->getMethod()) {
$response = new JsonResponse([], 200);
} else {
if (!\in_array($request->getMethod(), ['POST', 'GET'])) {
return new Respon... | [
"private",
"function",
"createResponse",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
",",
"bool",
"$",
"batched",
")",
"{",
"if",
"(",
"'OPTIONS'",
"===",
"$",
"request",
"->",
"getMethod",
"(",
")",
")",
"{",
"$",
"r... | @param Request $request
@param string|null $schemaName
@param bool $batched
@return JsonResponse|Response | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName",
"@param",
"bool",
"$batched"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L82-L96 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.processQuery | private function processQuery(Request $request, string $schemaName = null, bool $batched): array
{
if ($batched) {
$payload = $this->processBatchQuery($request, $schemaName);
} else {
$payload = $this->processNormalQuery($request, $schemaName);
}
return $payl... | php | private function processQuery(Request $request, string $schemaName = null, bool $batched): array
{
if ($batched) {
$payload = $this->processBatchQuery($request, $schemaName);
} else {
$payload = $this->processNormalQuery($request, $schemaName);
}
return $payl... | [
"private",
"function",
"processQuery",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
",",
"bool",
"$",
"batched",
")",
":",
"array",
"{",
"if",
"(",
"$",
"batched",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"p... | @param Request $request
@param string|null $schemaName
@param bool $batched
@return array | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName",
"@param",
"bool",
"$batched"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L116-L125 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.processBatchQuery | private function processBatchQuery(Request $request, string $schemaName = null): array
{
$queries = $this->batchParser->parse($request);
$payloads = [];
foreach ($queries as $query) {
$payload = $this->requestExecutor
->execute($schemaName, ['query' => $query['qu... | php | private function processBatchQuery(Request $request, string $schemaName = null): array
{
$queries = $this->batchParser->parse($request);
$payloads = [];
foreach ($queries as $query) {
$payload = $this->requestExecutor
->execute($schemaName, ['query' => $query['qu... | [
"private",
"function",
"processBatchQuery",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
")",
":",
"array",
"{",
"$",
"queries",
"=",
"$",
"this",
"->",
"batchParser",
"->",
"parse",
"(",
"$",
"request",
")",
";",
"$",
... | @param Request $request
@param string|null $schemaName
@return array | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L133-L149 |
overblog/GraphQLBundle | src/Controller/GraphController.php | GraphController.processNormalQuery | private function processNormalQuery(Request $request, string $schemaName = null): array
{
$params = $this->requestParser->parse($request);
return $this->requestExecutor->execute($schemaName, $params)->toArray();
} | php | private function processNormalQuery(Request $request, string $schemaName = null): array
{
$params = $this->requestParser->parse($request);
return $this->requestExecutor->execute($schemaName, $params)->toArray();
} | [
"private",
"function",
"processNormalQuery",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"schemaName",
"=",
"null",
")",
":",
"array",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"requestParser",
"->",
"parse",
"(",
"$",
"request",
")",
";",
"ret... | @param Request $request
@param string|null $schemaName
@return array | [
"@param",
"Request",
"$request",
"@param",
"string|null",
"$schemaName"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Controller/GraphController.php#L157-L162 |
overblog/GraphQLBundle | src/DependencyInjection/Configuration.php | Configuration.builderSection | private function builderSection($name)
{
$builder = new TreeBuilder($name);
/** @var ArrayNodeDefinition $node */
$node = self::getRootNodeWithoutDeprecation($builder, $name);
$node->beforeNormalization()
->ifTrue(function ($v) {
return \is_array($v) && !e... | php | private function builderSection($name)
{
$builder = new TreeBuilder($name);
/** @var ArrayNodeDefinition $node */
$node = self::getRootNodeWithoutDeprecation($builder, $name);
$node->beforeNormalization()
->ifTrue(function ($v) {
return \is_array($v) && !e... | [
"private",
"function",
"builderSection",
"(",
"$",
"name",
")",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
"$",
"name",
")",
";",
"/** @var ArrayNodeDefinition $node */",
"$",
"node",
"=",
"self",
"::",
"getRootNodeWithoutDeprecation",
"(",
"$",
"build... | @param string $name
@return ArrayNodeDefinition | [
"@param",
"string",
"$name"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Configuration.php#L289-L321 |
overblog/GraphQLBundle | src/DependencyInjection/Configuration.php | Configuration.securityQuerySection | private function securityQuerySection($name, $disabledValue)
{
$builder = new TreeBuilder($name, 'scalar');
/** @var ScalarNodeDefinition $node */
$node = self::getRootNodeWithoutDeprecation($builder, $name, 'scalar');
$node->beforeNormalization()
->ifTrue(function ($... | php | private function securityQuerySection($name, $disabledValue)
{
$builder = new TreeBuilder($name, 'scalar');
/** @var ScalarNodeDefinition $node */
$node = self::getRootNodeWithoutDeprecation($builder, $name, 'scalar');
$node->beforeNormalization()
->ifTrue(function ($... | [
"private",
"function",
"securityQuerySection",
"(",
"$",
"name",
",",
"$",
"disabledValue",
")",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
"$",
"name",
",",
"'scalar'",
")",
";",
"/** @var ScalarNodeDefinition $node */",
"$",
"node",
"=",
"self",
":... | @param string $name
@param bool $disabledValue
@return ScalarNodeDefinition | [
"@param",
"string",
"$name",
"@param",
"bool",
"$disabledValue"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Configuration.php#L329-L363 |
overblog/GraphQLBundle | src/DependencyInjection/Configuration.php | Configuration.getRootNodeWithoutDeprecation | public static function getRootNodeWithoutDeprecation(TreeBuilder $builder, string $name, string $type = 'array')
{
// BC layer for symfony/config 4.1 and older
return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type);
} | php | public static function getRootNodeWithoutDeprecation(TreeBuilder $builder, string $name, string $type = 'array')
{
// BC layer for symfony/config 4.1 and older
return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type);
} | [
"public",
"static",
"function",
"getRootNodeWithoutDeprecation",
"(",
"TreeBuilder",
"$",
"builder",
",",
"string",
"$",
"name",
",",
"string",
"$",
"type",
"=",
"'array'",
")",
"{",
"// BC layer for symfony/config 4.1 and older",
"return",
"\\",
"method_exists",
"(",... | @internal
@param TreeBuilder $builder
@param string|null $name
@param string $type
@return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition | [
"@internal"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/DependencyInjection/Configuration.php#L374-L378 |
overblog/GraphQLBundle | src/OverblogGraphQLBundle.php | OverblogGraphQLBundle.build | public function build(ContainerBuilder $container): void
{
parent::build($container);
//ConfigTypesPass must be before TypeTaggedServiceMappingPass
$container->addCompilerPass(new GlobalVariablesPass());
$container->addCompilerPass(new ExpressionFunctionPass());
$container->... | php | public function build(ContainerBuilder $container): void
{
parent::build($container);
//ConfigTypesPass must be before TypeTaggedServiceMappingPass
$container->addCompilerPass(new GlobalVariablesPass());
$container->addCompilerPass(new ExpressionFunctionPass());
$container->... | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"parent",
"::",
"build",
"(",
"$",
"container",
")",
";",
"//ConfigTypesPass must be before TypeTaggedServiceMappingPass",
"$",
"container",
"->",
"addCompilerPass",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/OverblogGraphQLBundle.php#L26-L40 |
overblog/GraphQLBundle | src/Config/TypeDefinition.php | TypeDefinition.createNode | protected static function createNode(string $name, string $type = 'array')
{
return Configuration::getRootNodeWithoutDeprecation(new TreeBuilder($name, $type), $name, $type);
} | php | protected static function createNode(string $name, string $type = 'array')
{
return Configuration::getRootNodeWithoutDeprecation(new TreeBuilder($name, $type), $name, $type);
} | [
"protected",
"static",
"function",
"createNode",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"type",
"=",
"'array'",
")",
"{",
"return",
"Configuration",
"::",
"getRootNodeWithoutDeprecation",
"(",
"new",
"TreeBuilder",
"(",
"$",
"name",
",",
"$",
"type",
... | @internal
@param string $name
@param string $type
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition | [
"@internal"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/TypeDefinition.php#L91-L94 |
overblog/GraphQLBundle | src/Request/BatchParser.php | BatchParser.parse | public function parse(Request $request): array
{
// Extracts the GraphQL request parameters
$queries = $this->getParsedBody($request);
if (empty($queries)) {
throw new BadRequestHttpException('Must provide at least one valid query.');
}
foreach ($queries as $i =... | php | public function parse(Request $request): array
{
// Extracts the GraphQL request parameters
$queries = $this->getParsedBody($request);
if (empty($queries)) {
throw new BadRequestHttpException('Must provide at least one valid query.');
}
foreach ($queries as $i =... | [
"public",
"function",
"parse",
"(",
"Request",
"$",
"request",
")",
":",
"array",
"{",
"// Extracts the GraphQL request parameters",
"$",
"queries",
"=",
"$",
"this",
"->",
"getParsedBody",
"(",
"$",
"request",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"querie... | @param Request $request
@return array | [
"@param",
"Request",
"$request"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/BatchParser.php#L27-L45 |
overblog/GraphQLBundle | src/Request/BatchParser.php | BatchParser.getParsedBody | private function getParsedBody(Request $request): array
{
$contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0];
// JSON object
switch ($contentType) {
case static::CONTENT_TYPE_JSON:
$parsedBody = \json_decode($request->getContent()... | php | private function getParsedBody(Request $request): array
{
$contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0];
// JSON object
switch ($contentType) {
case static::CONTENT_TYPE_JSON:
$parsedBody = \json_decode($request->getContent()... | [
"private",
"function",
"getParsedBody",
"(",
"Request",
"$",
"request",
")",
":",
"array",
"{",
"$",
"contentType",
"=",
"\\",
"explode",
"(",
"';'",
",",
"(",
"string",
")",
"$",
"request",
"->",
"headers",
"->",
"get",
"(",
"'content-type'",
")",
",",
... | Gets the body from the request.
@param Request $request
@return array | [
"Gets",
"the",
"body",
"from",
"the",
"request",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Request/BatchParser.php#L54-L82 |
overblog/GraphQLBundle | src/Transformer/ArgumentsTransformer.php | ArgumentsTransformer.getTypeClassInstance | private function getTypeClassInstance(string $type)
{
$classname = isset($this->classesMap[$type]) ? $this->classesMap[$type]['class'] : false;
return $classname ? new $classname() : false;
} | php | private function getTypeClassInstance(string $type)
{
$classname = isset($this->classesMap[$type]) ? $this->classesMap[$type]['class'] : false;
return $classname ? new $classname() : false;
} | [
"private",
"function",
"getTypeClassInstance",
"(",
"string",
"$",
"type",
")",
"{",
"$",
"classname",
"=",
"isset",
"(",
"$",
"this",
"->",
"classesMap",
"[",
"$",
"type",
"]",
")",
"?",
"$",
"this",
"->",
"classesMap",
"[",
"$",
"type",
"]",
"[",
"... | Get the PHP class for a given type.
@param string $type
@return object|false | [
"Get",
"the",
"PHP",
"class",
"for",
"a",
"given",
"type",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Transformer/ArgumentsTransformer.php#L49-L54 |
overblog/GraphQLBundle | src/Transformer/ArgumentsTransformer.php | ArgumentsTransformer.getType | private function getType(string $type, ResolveInfo $info): Type
{
return $info->schema->getType($type);
} | php | private function getType(string $type, ResolveInfo $info): Type
{
return $info->schema->getType($type);
} | [
"private",
"function",
"getType",
"(",
"string",
"$",
"type",
",",
"ResolveInfo",
"$",
"info",
")",
":",
"Type",
"{",
"return",
"$",
"info",
"->",
"schema",
"->",
"getType",
"(",
"$",
"type",
")",
";",
"}"
] | Extract given type from Resolve Info.
@param string $type
@param ResolveInfo $info
@return Type | [
"Extract",
"given",
"type",
"from",
"Resolve",
"Info",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Transformer/ArgumentsTransformer.php#L64-L67 |
overblog/GraphQLBundle | src/Transformer/ArgumentsTransformer.php | ArgumentsTransformer.populateObject | private function populateObject(Type $type, $data, $multiple = false, ResolveInfo $info)
{
if (!$data) {
return $data;
}
if ($multiple) {
return \array_map(function ($data) use ($type, $info) {
return $this->populateObject($type, $data, false, $info);... | php | private function populateObject(Type $type, $data, $multiple = false, ResolveInfo $info)
{
if (!$data) {
return $data;
}
if ($multiple) {
return \array_map(function ($data) use ($type, $info) {
return $this->populateObject($type, $data, false, $info);... | [
"private",
"function",
"populateObject",
"(",
"Type",
"$",
"type",
",",
"$",
"data",
",",
"$",
"multiple",
"=",
"false",
",",
"ResolveInfo",
"$",
"info",
")",
"{",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"return",
"$",
"data",
";",
"}",
"if",
"(",
... | Populate an object based on type with given data.
@param Type $type
@param mixed $data
@param bool $multiple
@param ResolveInfo $info
@return mixed | [
"Populate",
"an",
"object",
"based",
"on",
"type",
"with",
"given",
"data",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Transformer/ArgumentsTransformer.php#L79-L124 |
overblog/GraphQLBundle | src/Transformer/ArgumentsTransformer.php | ArgumentsTransformer.getInstanceAndValidate | public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName)
{
$isRequired = '!' === $argType[\strlen($argType) - 1];
$isMultiple = '[' === $argType[0];
$endIndex = ($isRequired ? 1 : 0) + ($isMultiple ? 1 : 0);
$type = \substr($argType, $isMulti... | php | public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName)
{
$isRequired = '!' === $argType[\strlen($argType) - 1];
$isMultiple = '[' === $argType[0];
$endIndex = ($isRequired ? 1 : 0) + ($isMultiple ? 1 : 0);
$type = \substr($argType, $isMulti... | [
"public",
"function",
"getInstanceAndValidate",
"(",
"string",
"$",
"argType",
",",
"$",
"data",
",",
"ResolveInfo",
"$",
"info",
",",
"string",
"$",
"argName",
")",
"{",
"$",
"isRequired",
"=",
"'!'",
"===",
"$",
"argType",
"[",
"\\",
"strlen",
"(",
"$"... | Given a GraphQL type and an array of data, populate corresponding object recursively
using annoted classes.
@param string $argType
@param mixed $data
@param ResolveInfo $info
@return mixed | [
"Given",
"a",
"GraphQL",
"type",
"and",
"an",
"array",
"of",
"data",
"populate",
"corresponding",
"object",
"recursively",
"using",
"annoted",
"classes",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Transformer/ArgumentsTransformer.php#L136-L154 |
overblog/GraphQLBundle | src/Transformer/ArgumentsTransformer.php | ArgumentsTransformer.getArguments | public function getArguments(array $mapping, $data, ResolveInfo $info)
{
$args = [];
$exceptions = [];
foreach ($mapping as $name => $type) {
try {
$value = $this->getInstanceAndValidate($type, $data[$name], $info, $name);
$args[] = $value;
... | php | public function getArguments(array $mapping, $data, ResolveInfo $info)
{
$args = [];
$exceptions = [];
foreach ($mapping as $name => $type) {
try {
$value = $this->getInstanceAndValidate($type, $data[$name], $info, $name);
$args[] = $value;
... | [
"public",
"function",
"getArguments",
"(",
"array",
"$",
"mapping",
",",
"$",
"data",
",",
"ResolveInfo",
"$",
"info",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"$",
"exceptions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"mapping",
"as",
"$",
"nam... | Transform a list of arguments into their corresponding php class and validate them.
@param array $mapping
@param mixed $data
@param ResolveInfo $info
@return array | [
"Transform",
"a",
"list",
"of",
"arguments",
"into",
"their",
"corresponding",
"php",
"class",
"and",
"validate",
"them",
"."
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Transformer/ArgumentsTransformer.php#L165-L184 |
overblog/GraphQLBundle | src/CacheWarmer/CompileCacheWarmer.php | CompileCacheWarmer.warmUp | public function warmUp($cacheDir): void
{
// use warm up cache dir if type generator cache dir not already explicitly declare
$baseCacheDir = $this->typeGenerator->getBaseCacheDir();
if (null === $this->typeGenerator->getCacheDir(false)) {
$this->typeGenerator->setBaseCacheDir($c... | php | public function warmUp($cacheDir): void
{
// use warm up cache dir if type generator cache dir not already explicitly declare
$baseCacheDir = $this->typeGenerator->getBaseCacheDir();
if (null === $this->typeGenerator->getCacheDir(false)) {
$this->typeGenerator->setBaseCacheDir($c... | [
"public",
"function",
"warmUp",
"(",
"$",
"cacheDir",
")",
":",
"void",
"{",
"// use warm up cache dir if type generator cache dir not already explicitly declare",
"$",
"baseCacheDir",
"=",
"$",
"this",
"->",
"typeGenerator",
"->",
"getBaseCacheDir",
"(",
")",
";",
"if"... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/CacheWarmer/CompileCacheWarmer.php#L31-L40 |
overblog/GraphQLBundle | src/Config/Processor/ExpressionProcessor.php | ExpressionProcessor.process | public static function process(array $configs, $expressionLanguageTrigger = self::DEFAULT_EXPRESSION_LANGUAGE_TRIGGER): array
{
return \array_map(function ($v) use ($expressionLanguageTrigger) {
if (\is_array($v)) {
return static::process($v, $expressionLanguageTrigger);
... | php | public static function process(array $configs, $expressionLanguageTrigger = self::DEFAULT_EXPRESSION_LANGUAGE_TRIGGER): array
{
return \array_map(function ($v) use ($expressionLanguageTrigger) {
if (\is_array($v)) {
return static::process($v, $expressionLanguageTrigger);
... | [
"public",
"static",
"function",
"process",
"(",
"array",
"$",
"configs",
",",
"$",
"expressionLanguageTrigger",
"=",
"self",
"::",
"DEFAULT_EXPRESSION_LANGUAGE_TRIGGER",
")",
":",
"array",
"{",
"return",
"\\",
"array_map",
"(",
"function",
"(",
"$",
"v",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/ExpressionProcessor.php#L16-L27 |
overblog/GraphQLBundle | src/Upload/Type/GraphQLUploadType.php | GraphQLUploadType.parseValue | public function parseValue($value)
{
if (null !== $value && !$value instanceof File) {
throw new InvariantViolation(\sprintf(
'Upload should be null or instance of "%s" but %s given.',
File::class,
\is_object($value) ? \get_class($value) : \gettype... | php | public function parseValue($value)
{
if (null !== $value && !$value instanceof File) {
throw new InvariantViolation(\sprintf(
'Upload should be null or instance of "%s" but %s given.',
File::class,
\is_object($value) ? \get_class($value) : \gettype... | [
"public",
"function",
"parseValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"value",
"&&",
"!",
"$",
"value",
"instanceof",
"File",
")",
"{",
"throw",
"new",
"InvariantViolation",
"(",
"\\",
"sprintf",
"(",
"'Upload should be null or inst... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Upload/Type/GraphQLUploadType.php#L30-L41 |
overblog/GraphQLBundle | src/Config/Processor/InheritanceProcessor.php | InheritanceProcessor.process | public static function process(array $configs): array
{
$configs = self::processConfigsHeirs($configs);
$configs = self::processConfigsInherits($configs);
$configs = self::removedDecorators($configs);
return $configs;
} | php | public static function process(array $configs): array
{
$configs = self::processConfigsHeirs($configs);
$configs = self::processConfigsInherits($configs);
$configs = self::removedDecorators($configs);
return $configs;
} | [
"public",
"static",
"function",
"process",
"(",
"array",
"$",
"configs",
")",
":",
"array",
"{",
"$",
"configs",
"=",
"self",
"::",
"processConfigsHeirs",
"(",
"$",
"configs",
")",
";",
"$",
"configs",
"=",
"self",
"::",
"processConfigsInherits",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/overblog/GraphQLBundle/blob/7e56010c4657fbb748a5778effd0a1968a3662ee/src/Config/Processor/InheritanceProcessor.php#L15-L22 |
yansongda/laravel-pay | src/PayServiceProvider.php | PayServiceProvider.register | public function register()
{
$this->mergeConfigFrom(dirname(__DIR__).'/config/pay.php', 'pay');
$this->app->singleton('pay.alipay', function () {
return Pay::alipay(config('pay.alipay'));
});
$this->app->singleton('pay.wechat', function () {
return Pay::wecha... | php | public function register()
{
$this->mergeConfigFrom(dirname(__DIR__).'/config/pay.php', 'pay');
$this->app->singleton('pay.alipay', function () {
return Pay::alipay(config('pay.alipay'));
});
$this->app->singleton('pay.wechat', function () {
return Pay::wecha... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"dirname",
"(",
"__DIR__",
")",
".",
"'/config/pay.php'",
",",
"'pay'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pay.alipay'",
",",
"function",... | Register the service.
@author yansongda <me@yansongda.cn>
@return void | [
"Register",
"the",
"service",
"."
] | train | https://github.com/yansongda/laravel-pay/blob/10f609bbe8f81ab6d6e54fac58ae4918a7923fe4/src/PayServiceProvider.php#L43-L53 |
justinrainbow/json-schema | src/JsonSchema/Constraints/SchemaConstraint.php | SchemaConstraint.check | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
if ($schema !== null) {
// passed schema
$validationSchema = $schema;
} elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
// inline schema... | php | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
if ($schema !== null) {
// passed schema
$validationSchema = $schema;
} elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
// inline schema... | [
"public",
"function",
"check",
"(",
"&",
"$",
"element",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"schema",
"!==",
"null",
")",
"{",
"// passed schema",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/SchemaConstraint.php#L32-L94 |
justinrainbow/json-schema | src/JsonSchema/Constraints/CollectionConstraint.php | CollectionConstraint.check | public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
// Verify minItems
if (isset($schema->minItems) && count($value) < $schema->minItems) {
$this->addError(ConstraintError::MIN_ITEMS(), $path, array('minItems' => $schema->minItems));
}
/... | php | public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
// Verify minItems
if (isset($schema->minItems) && count($value) < $schema->minItems) {
$this->addError(ConstraintError::MIN_ITEMS(), $path, array('minItems' => $schema->minItems));
}
/... | [
"public",
"function",
"check",
"(",
"&",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"// Verify minItems",
"if",
"(",
"isset",
"(",
"$",
"schema",
"->",
"minItems"... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/CollectionConstraint.php#L26-L55 |
justinrainbow/json-schema | src/JsonSchema/Constraints/CollectionConstraint.php | CollectionConstraint.validateItems | protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
if (is_object($schema->items)) {
// just one type definition for the whole array
foreach ($value as $k => &$v) {
$initErrors = $this->getErrors();
// Firs... | php | protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
if (is_object($schema->items)) {
// just one type definition for the whole array
foreach ($value as $k => &$v) {
$initErrors = $this->getErrors();
// Firs... | [
"protected",
"function",
"validateItems",
"(",
"&",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"schema",
"->",
"items",
")",
"... | Validates the items
@param array $value
@param \stdClass $schema
@param JsonPointer|null $path
@param string $i | [
"Validates",
"the",
"items"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/CollectionConstraint.php#L65-L128 |
justinrainbow/json-schema | src/JsonSchema/Constraints/ConstConstraint.php | ConstConstraint.check | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
// Only validate const if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
return;
}
$const = $schema->const;
... | php | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
// Only validate const if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
return;
}
$const = $schema->const;
... | [
"public",
"function",
"check",
"(",
"&",
"$",
"element",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"// Only validate const if the attribute exists",
"if",
"(",
"$",
"element",
"inst... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/ConstConstraint.php#L26-L48 |
justinrainbow/json-schema | src/JsonSchema/Uri/Retrievers/FileGetContents.php | FileGetContents.retrieve | public function retrieve($uri)
{
$errorMessage = null;
set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
$errorMessage = $errstr;
});
$response = file_get_contents($uri);
restore_error_handler();
if ($errorMessage) {
throw ne... | php | public function retrieve($uri)
{
$errorMessage = null;
set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
$errorMessage = $errstr;
});
$response = file_get_contents($uri);
restore_error_handler();
if ($errorMessage) {
throw ne... | [
"public",
"function",
"retrieve",
"(",
"$",
"uri",
")",
"{",
"$",
"errorMessage",
"=",
"null",
";",
"set_error_handler",
"(",
"function",
"(",
"$",
"errno",
",",
"$",
"errstr",
")",
"use",
"(",
"&",
"$",
"errorMessage",
")",
"{",
"$",
"errorMessage",
"... | {@inheritdoc}
@see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Uri/Retrievers/FileGetContents.php#L28-L62 |
justinrainbow/json-schema | src/JsonSchema/Uri/Retrievers/FileGetContents.php | FileGetContents.fetchContentType | private function fetchContentType(array $headers)
{
foreach ($headers as $header) {
if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
return true;
}
}
return false;
} | php | private function fetchContentType(array $headers)
{
foreach ($headers as $header) {
if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
return true;
}
}
return false;
} | [
"private",
"function",
"fetchContentType",
"(",
"array",
"$",
"headers",
")",
"{",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"header",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contentType",
"=",
"self",
"::",
"getContentTypeMatchInHeader",
"(",
"$",
"head... | @param array $headers HTTP Response Headers
@return bool Whether the Content-Type header was found or not | [
"@param",
"array",
"$headers",
"HTTP",
"Response",
"Headers"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Uri/Retrievers/FileGetContents.php#L69-L78 |
justinrainbow/json-schema | src/JsonSchema/Uri/Retrievers/PredefinedArray.php | PredefinedArray.retrieve | public function retrieve($uri)
{
if (!array_key_exists($uri, $this->schemas)) {
throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
'The JSON schema "%s" was not found.',
$uri
));
}
return $this->schemas[$uri];
} | php | public function retrieve($uri)
{
if (!array_key_exists($uri, $this->schemas)) {
throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
'The JSON schema "%s" was not found.',
$uri
));
}
return $this->schemas[$uri];
} | [
"public",
"function",
"retrieve",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"uri",
",",
"$",
"this",
"->",
"schemas",
")",
")",
"{",
"throw",
"new",
"\\",
"JsonSchema",
"\\",
"Exception",
"\\",
"ResourceNotFoundException",
... | {@inheritdoc}
@see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Uri/Retrievers/PredefinedArray.php#L45-L55 |
justinrainbow/json-schema | src/JsonSchema/Constraints/EnumConstraint.php | EnumConstraint.check | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
// Only validate enum if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
return;
}
$type = gettype($element);
... | php | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
{
// Only validate enum if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
return;
}
$type = gettype($element);
... | [
"public",
"function",
"check",
"(",
"&",
"$",
"element",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"// Only validate enum if the attribute exists",
"if",
"(",
"$",
"element",
"insta... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/EnumConstraint.php#L27-L51 |
justinrainbow/json-schema | src/JsonSchema/SchemaStorage.php | SchemaStorage.addSchema | public function addSchema($id, $schema = null)
{
if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
// if the schema was user-provided to Validator and is still null, then assume this is
// what the user intended, as there's no way for us to retrieve anything else.... | php | public function addSchema($id, $schema = null)
{
if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
// if the schema was user-provided to Validator and is still null, then assume this is
// what the user intended, as there's no way for us to retrieve anything else.... | [
"public",
"function",
"addSchema",
"(",
"$",
"id",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"schema",
")",
"&&",
"$",
"id",
"!==",
"self",
"::",
"INTERNAL_PROVIDED_SCHEMA_URI",
")",
"{",
"// if the schema was user-provided t... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/SchemaStorage.php#L46-L75 |
justinrainbow/json-schema | src/JsonSchema/SchemaStorage.php | SchemaStorage.expandRefs | private function expandRefs(&$schema, $base = null)
{
if (!is_object($schema)) {
if (is_array($schema)) {
foreach ($schema as &$member) {
$this->expandRefs($member, $base);
}
}
return;
}
if (property_ex... | php | private function expandRefs(&$schema, $base = null)
{
if (!is_object($schema)) {
if (is_array($schema)) {
foreach ($schema as &$member) {
$this->expandRefs($member, $base);
}
}
return;
}
if (property_ex... | [
"private",
"function",
"expandRefs",
"(",
"&",
"$",
"schema",
",",
"$",
"base",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"schema",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"schema",
")",
")",
"{",
"foreach",
"(",
"$",
... | Recursively resolve all references against the provided base
@param mixed $schema
@param string $base | [
"Recursively",
"resolve",
"all",
"references",
"against",
"the",
"provided",
"base"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/SchemaStorage.php#L83-L107 |
justinrainbow/json-schema | src/JsonSchema/SchemaStorage.php | SchemaStorage.getSchema | public function getSchema($id)
{
if (!array_key_exists($id, $this->schemas)) {
$this->addSchema($id);
}
return $this->schemas[$id];
} | php | public function getSchema($id)
{
if (!array_key_exists($id, $this->schemas)) {
$this->addSchema($id);
}
return $this->schemas[$id];
} | [
"public",
"function",
"getSchema",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"schemas",
")",
")",
"{",
"$",
"this",
"->",
"addSchema",
"(",
"$",
"id",
")",
";",
"}",
"return",
"$",
"this... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/SchemaStorage.php#L112-L119 |
justinrainbow/json-schema | src/JsonSchema/SchemaStorage.php | SchemaStorage.resolveRef | public function resolveRef($ref, $resolveStack = array())
{
$jsonPointer = new JsonPointer($ref);
// resolve filename for pointer
$fileName = $jsonPointer->getFilename();
if (!strlen($fileName)) {
throw new UnresolvableJsonPointerException(sprintf(
"Could... | php | public function resolveRef($ref, $resolveStack = array())
{
$jsonPointer = new JsonPointer($ref);
// resolve filename for pointer
$fileName = $jsonPointer->getFilename();
if (!strlen($fileName)) {
throw new UnresolvableJsonPointerException(sprintf(
"Could... | [
"public",
"function",
"resolveRef",
"(",
"$",
"ref",
",",
"$",
"resolveStack",
"=",
"array",
"(",
")",
")",
"{",
"$",
"jsonPointer",
"=",
"new",
"JsonPointer",
"(",
"$",
"ref",
")",
";",
"// resolve filename for pointer",
"$",
"fileName",
"=",
"$",
"jsonPo... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/SchemaStorage.php#L124-L154 |
justinrainbow/json-schema | src/JsonSchema/SchemaStorage.php | SchemaStorage.resolveRefSchema | public function resolveRefSchema($refSchema, $resolveStack = array())
{
if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
if (in_array($refSchema, $resolveStack, true)) {
throw new UnresolvableJsonPointerException(sprintf(
... | php | public function resolveRefSchema($refSchema, $resolveStack = array())
{
if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
if (in_array($refSchema, $resolveStack, true)) {
throw new UnresolvableJsonPointerException(sprintf(
... | [
"public",
"function",
"resolveRefSchema",
"(",
"$",
"refSchema",
",",
"$",
"resolveStack",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"refSchema",
")",
"&&",
"property_exists",
"(",
"$",
"refSchema",
",",
"'$ref'",
")",
"&&",
"is... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/SchemaStorage.php#L159-L174 |
justinrainbow/json-schema | src/JsonSchema/Uri/Retrievers/Curl.php | Curl.retrieve | public function retrieve($uri)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
$... | php | public function retrieve($uri)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
$... | [
"public",
"function",
"retrieve",
"(",
"$",
"uri",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"uri",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HEADER",
",",
"true",
... | {@inheritdoc}
@see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve() | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Uri/Retrievers/Curl.php#L37-L57 |
justinrainbow/json-schema | src/JsonSchema/Uri/Retrievers/Curl.php | Curl.fetchContentType | protected function fetchContentType($response)
{
if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
$this->contentType = trim($match[1]);
return true;
}
return false;
} | php | protected function fetchContentType($response)
{
if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
$this->contentType = trim($match[1]);
return true;
}
return false;
} | [
"protected",
"function",
"fetchContentType",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"0",
"<",
"preg_match",
"(",
"\"/Content-Type:(\\V*)/ims\"",
",",
"$",
"response",
",",
"$",
"match",
")",
")",
"{",
"$",
"this",
"->",
"contentType",
"=",
"trim",
"(",... | @param string $response cURL HTTP response
@return bool Whether the Content-Type header was found or not | [
"@param",
"string",
"$response",
"cURL",
"HTTP",
"response"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Uri/Retrievers/Curl.php#L73-L82 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Factory.php | Factory.getConfig | public function getConfig($options = null)
{
if ($options === null) {
return $this->checkMode;
}
return $this->checkMode & $options;
} | php | public function getConfig($options = null)
{
if ($options === null) {
return $this->checkMode;
}
return $this->checkMode & $options;
} | [
"public",
"function",
"getConfig",
"(",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"options",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"checkMode",
";",
"}",
"return",
"$",
"this",
"->",
"checkMode",
"&",
"$",
"options",
";",... | Get checkMode option
@param int $options Options to get, if null then return entire bitmask
@return int | [
"Get",
"checkMode",
"option"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Factory.php#L126-L133 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Factory.php | Factory.setConstraintClass | public function setConstraintClass($name, $class)
{
// Ensure class exists
if (!class_exists($class)) {
throw new InvalidArgumentException('Unknown constraint ' . $name);
}
// Ensure class is appropriate
if (!in_array('JsonSchema\Constraints\ConstraintInterface', ... | php | public function setConstraintClass($name, $class)
{
// Ensure class exists
if (!class_exists($class)) {
throw new InvalidArgumentException('Unknown constraint ' . $name);
}
// Ensure class is appropriate
if (!in_array('JsonSchema\Constraints\ConstraintInterface', ... | [
"public",
"function",
"setConstraintClass",
"(",
"$",
"name",
",",
"$",
"class",
")",
"{",
"// Ensure class exists",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Unknown constraint '",
".",
... | @param string $name
@param string $class
@return Factory | [
"@param",
"string",
"$name",
"@param",
"string",
"$class"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Factory.php#L165-L178 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Factory.php | Factory.createInstanceFor | public function createInstanceFor($constraintName)
{
if (!isset($this->constraintMap[$constraintName])) {
throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
}
if (!isset($this->instanceCache[$constraintName])) {
$this->instanceCache[$constra... | php | public function createInstanceFor($constraintName)
{
if (!isset($this->constraintMap[$constraintName])) {
throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
}
if (!isset($this->instanceCache[$constraintName])) {
$this->instanceCache[$constra... | [
"public",
"function",
"createInstanceFor",
"(",
"$",
"constraintName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"constraintMap",
"[",
"$",
"constraintName",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Unknown constr... | Create a constraint instance for the given constraint name.
@param string $constraintName
@throws InvalidArgumentException if is not possible create the constraint instance
@return ConstraintInterface|ObjectConstraint | [
"Create",
"a",
"constraint",
"instance",
"for",
"the",
"given",
"constraint",
"name",
"."
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Factory.php#L189-L200 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Constraint.php | Constraint.incrementPath | protected function incrementPath(JsonPointer $path = null, $i)
{
$path = $path ?: new JsonPointer('');
$path = $path->withPropertyPaths(
array_merge(
$path->getPropertyPaths(),
array_filter(array($i), 'strlen')
)
);
return $pat... | php | protected function incrementPath(JsonPointer $path = null, $i)
{
$path = $path ?: new JsonPointer('');
$path = $path->withPropertyPaths(
array_merge(
$path->getPropertyPaths(),
array_filter(array($i), 'strlen')
)
);
return $pat... | [
"protected",
"function",
"incrementPath",
"(",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
")",
"{",
"$",
"path",
"=",
"$",
"path",
"?",
":",
"new",
"JsonPointer",
"(",
"''",
")",
";",
"$",
"path",
"=",
"$",
"path",
"->",
"withPropertyPat... | Bubble down the path
@param JsonPointer|null $path Current path
@param mixed $i What to append to the path
@return JsonPointer; | [
"Bubble",
"down",
"the",
"path"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Constraint.php#L43-L54 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Constraint.php | Constraint.checkArray | protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('collection');
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
} | php | protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('collection');
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
} | [
"protected",
"function",
"checkArray",
"(",
"&",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"factory",
"->",
"createInst... | Validates an array
@param mixed $value
@param mixed $schema
@param JsonPointer|null $path
@param mixed $i | [
"Validates",
"an",
"array"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Constraint.php#L64-L70 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Constraint.php | Constraint.checkObject | protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
$additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
{
$validator = $this->factory->createInstanceFor('object');
$validator->check($value, $schema, $path, $pr... | php | protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
$additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
{
$validator = $this->factory->createInstanceFor('object');
$validator->check($value, $schema, $path, $pr... | [
"protected",
"function",
"checkObject",
"(",
"&",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"properties",
"=",
"null",
",",
"$",
"additionalProperties",
"=",
"null",
",",
"$",
"patternProperties"... | Validates an object
@param mixed $value
@param mixed $schema
@param JsonPointer|null $path
@param mixed $properties
@param mixed $additionalProperties
@param mixed $patternProperties | [
"Validates",
"an",
"object"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Constraint.php#L82-L89 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Constraint.php | Constraint.checkUndefined | protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
{
$validator = $this->factory->createInstanceFor('undefined');
$validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
... | php | protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
{
$validator = $this->factory->createInstanceFor('undefined');
$validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
... | [
"protected",
"function",
"checkUndefined",
"(",
"&",
"$",
"value",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
",",
"$",
"fromDefault",
"=",
"false",
")",
"{",
"$",
"validator",
"=",
"$",... | Checks a undefined element
@param mixed $value
@param mixed $schema
@param JsonPointer|null $path
@param mixed $i | [
"Checks",
"a",
"undefined",
"element"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Constraint.php#L115-L122 |
justinrainbow/json-schema | src/JsonSchema/Constraints/Constraint.php | Constraint.convertJsonPointerIntoPropertyPath | protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
{
$result = array_map(
function ($path) {
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
},
$pointer->getPropertyPaths()
);
return trim(implode('', $re... | php | protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
{
$result = array_map(
function ($path) {
return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
},
$pointer->getPropertyPaths()
);
return trim(implode('', $re... | [
"protected",
"function",
"convertJsonPointerIntoPropertyPath",
"(",
"JsonPointer",
"$",
"pointer",
")",
"{",
"$",
"result",
"=",
"array_map",
"(",
"function",
"(",
"$",
"path",
")",
"{",
"return",
"sprintf",
"(",
"is_numeric",
"(",
"$",
"path",
")",
"?",
"'[... | @param JsonPointer $pointer
@return string property path | [
"@param",
"JsonPointer",
"$pointer"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/Constraint.php#L219-L229 |
justinrainbow/json-schema | src/JsonSchema/Constraints/TypeConstraint.php | TypeConstraint.check | public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
{
$type = isset($schema->type) ? $schema->type : null;
$isValid = false;
$coerce = $this->factory->getConfig(self::CHECK_MODE_COERCE_TYPES);
$earlyCoerce = $this->factory->getConfig(self::CHECK... | php | public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
{
$type = isset($schema->type) ? $schema->type : null;
$isValid = false;
$coerce = $this->factory->getConfig(self::CHECK_MODE_COERCE_TYPES);
$earlyCoerce = $this->factory->getConfig(self::CHECK... | [
"public",
"function",
"check",
"(",
"&",
"$",
"value",
"=",
"null",
",",
"$",
"schema",
"=",
"null",
",",
"JsonPointer",
"$",
"path",
"=",
"null",
",",
"$",
"i",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"isset",
"(",
"$",
"schema",
"->",
"type",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/justinrainbow/json-schema/blob/775a4f5dc786a43d42f649dad6d84b1ba431895b/src/JsonSchema/Constraints/TypeConstraint.php#L43-L77 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.