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 |
|---|---|---|---|---|---|---|---|---|---|---|
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/IdentityTokenParser.php | IdentityTokenParser.parse | public function parse(Token $token)
{
$value = $this->tokenizer->detokenize($token->getValue());
$realValue = preg_replace('/^<\((.*)\)>$/', '<identity($1)>', $value);
return $this->decoratedTokenParser->parse(
new Token($realValue, new TokenType(TokenType::FUNCTION_TYPE))
... | php | public function parse(Token $token)
{
$value = $this->tokenizer->detokenize($token->getValue());
$realValue = preg_replace('/^<\((.*)\)>$/', '<identity($1)>', $value);
return $this->decoratedTokenParser->parse(
new Token($realValue, new TokenType(TokenType::FUNCTION_TYPE))
... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"tokenizer",
"->",
"detokenize",
"(",
"$",
"token",
"->",
"getValue",
"(",
")",
")",
";",
"$",
"realValue",
"=",
"preg_replace",
"(",
"'/^<\\((.*... | Parses expressions such as '<(something)>'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"<",
"(",
"something",
")",
">",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/IdentityTokenParser.php#L75-L83 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/EscapedValueTokenParser.php | EscapedValueTokenParser.parse | public function parse(Token $token): string
{
$value = $token->getValue();
if ('' === $value) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return $this->tokenizer->detokenize(substr($value, 1));
} | php | public function parse(Token $token): string
{
$value = $token->getValue();
if ('' === $value) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return $this->tokenizer->detokenize(substr($value, 1));
} | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"string",
"{",
"$",
"value",
"=",
"$",
"token",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"''",
"===",
"$",
"value",
")",
"{",
"throw",
"ExpressionLanguageExceptionFactory",
"::",
"... | Parses '<<', '@@'...
{@inheritdoc} | [
"Parses",
"<<",
"@@",
"..."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/EscapedValueTokenParser.php#L53-L61 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/DynamicArrayTokenParser.php | DynamicArrayTokenParser.parse | public function parse(Token $token): DynamicArrayValue
{
parent::parse($token);
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$quantifier = $this->parser->parse($matches['... | php | public function parse(Token $token): DynamicArrayValue
{
parent::parse($token);
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$quantifier = $this->parser->parse($matches['... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"DynamicArrayValue",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"if",
"(",
"1",
"!==",
"preg_match",
"(",
"self",
"::",
"REGEX",
",",
"$",
"token",
"->",
"getValue",
... | Parses "10x @user*", "<randomNumber(0, 10)x @user<{param}>*", etc.
{@inheritdoc}
@throws ParseException | [
"Parses",
"10x",
"@user",
"*",
"<randomNumber",
"(",
"0",
"10",
")",
"x",
"@user<",
"{",
"param",
"}",
">",
"*",
"etc",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/DynamicArrayTokenParser.php#L45-L62 |
nelmio/alice | src/Generator/Resolver/Parameter/Chainable/RecursiveParameterResolver.php | RecursiveParameterResolver.resolve | public function resolve(
Parameter $parameter,
ParameterBag $unresolvedParameters,
ParameterBag $resolvedParameters,
ResolvingContext $context = null,
ParameterBag $previousResult = null,
int $counter = 1
): ParameterBag {
if (null === $previousResult) {
... | php | public function resolve(
Parameter $parameter,
ParameterBag $unresolvedParameters,
ParameterBag $resolvedParameters,
ResolvingContext $context = null,
ParameterBag $previousResult = null,
int $counter = 1
): ParameterBag {
if (null === $previousResult) {
... | [
"public",
"function",
"resolve",
"(",
"Parameter",
"$",
"parameter",
",",
"ParameterBag",
"$",
"unresolvedParameters",
",",
"ParameterBag",
"$",
"resolvedParameters",
",",
"ResolvingContext",
"$",
"context",
"=",
"null",
",",
"ParameterBag",
"$",
"previousResult",
"... | Resolves a parameter two times and if a different result is obtained will resolve the parameter again until two
successive resolution give the same result.
{@inheritdoc}
@throws RecursionLimitReachedException | [
"Resolves",
"a",
"parameter",
"two",
"times",
"and",
"if",
"a",
"different",
"result",
"is",
"obtained",
"will",
"resolve",
"the",
"parameter",
"again",
"until",
"two",
"successive",
"resolution",
"give",
"the",
"same",
"result",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Parameter/Chainable/RecursiveParameterResolver.php#L84-L116 |
nelmio/alice | src/Parser/ParserRegistry.php | ParserRegistry.parse | public function parse(string $file): array
{
foreach ($this->parsers as $parser) {
if ($parser->canParse($file)) {
return $parser->parse($file);
}
}
throw ParseExceptionFactory::createForParserNoFoundForFile($file);
} | php | public function parse(string $file): array
{
foreach ($this->parsers as $parser) {
if ($parser->canParse($file)) {
return $parser->parse($file);
}
}
throw ParseExceptionFactory::createForParserNoFoundForFile($file);
} | [
"public",
"function",
"parse",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"this",
"->",
"parsers",
"as",
"$",
"parser",
")",
"{",
"if",
"(",
"$",
"parser",
"->",
"canParse",
"(",
"$",
"file",
")",
")",
"{",
"return",
... | Looks for the first suitable parser to parse the file.
{@inheritdoc} | [
"Looks",
"for",
"the",
"first",
"suitable",
"parser",
"to",
"parse",
"the",
"file",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Parser/ParserRegistry.php#L44-L53 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FakerFunctionCallValueResolver.php | FakerFunctionCallValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
/**
* @var FakerGenerator $generator
* @var string $formatter... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
/**
* @var FakerGenerator $generator
* @var string $formatter... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param ResolvedFunctionCallValue $value | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FakerFunctionCallValueResolver.php#L55-L72 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php | SubPatternsLexer.lex | public function lex(string $value): array
{
$offset = 0;
$valueLength = strlen($value);
$tokens = [];
while ($offset < $valueLength) {
$valueFragment = substr($value, $offset);
$fragmentTokens = $this->lexFragment($this->referenceLexer, $valueFragment);
... | php | public function lex(string $value): array
{
$offset = 0;
$valueLength = strlen($value);
$tokens = [];
while ($offset < $valueLength) {
$valueFragment = substr($value, $offset);
$fragmentTokens = $this->lexFragment($this->referenceLexer, $valueFragment);
... | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"$",
"offset",
"=",
"0",
";",
"$",
"valueLength",
"=",
"strlen",
"(",
"$",
"value",
")",
";",
"$",
"tokens",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"offset",
"<",
... | {@inheritdoc}
@throws LexException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php#L77-L94 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php | SubPatternsLexer.lexFragment | private function lexFragment(LexerInterface $referenceLexer, string $valueFragment): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $valueFragment, $matches)) {
if (null === $tokenTypeConstant) {
throw Inval... | php | private function lexFragment(LexerInterface $referenceLexer, string $valueFragment): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $valueFragment, $matches)) {
if (null === $tokenTypeConstant) {
throw Inval... | [
"private",
"function",
"lexFragment",
"(",
"LexerInterface",
"$",
"referenceLexer",
",",
"string",
"$",
"valueFragment",
")",
":",
"array",
"{",
"foreach",
"(",
"self",
"::",
"PATTERNS",
"as",
"$",
"pattern",
"=>",
"$",
"tokenTypeConstant",
")",
"{",
"if",
"... | @throws LexException
@return Token[] | [
"@throws",
"LexException"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php#L101-L119 |
nelmio/alice | src/Generator/ObjectGenerator/SimpleObjectGenerator.php | SimpleObjectGenerator.tryToMarkObjectAsComplete | private function tryToMarkObjectAsComplete(FixtureInterface $fixture, ResolvedFixtureSet $set, GenerationContext $context): ResolvedFixtureSet
{
$object = $set->getObjects()->get($fixture);
if ($object instanceof CompleteObject || false === $this->isObjectComplete($fixture, $set, $context)) {
... | php | private function tryToMarkObjectAsComplete(FixtureInterface $fixture, ResolvedFixtureSet $set, GenerationContext $context): ResolvedFixtureSet
{
$object = $set->getObjects()->get($fixture);
if ($object instanceof CompleteObject || false === $this->isObjectComplete($fixture, $set, $context)) {
... | [
"private",
"function",
"tryToMarkObjectAsComplete",
"(",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"set",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedFixtureSet",
"{",
"$",
"object",
"=",
"$",
"set",
"->",
"getObjects",
"... | I however see no way to do that while still complying with the BC break policy, hence for 4.0. | [
"I",
"however",
"see",
"no",
"way",
"to",
"do",
"that",
"while",
"still",
"complying",
"with",
"the",
"BC",
"break",
"policy",
"hence",
"for",
"4",
".",
"0",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/ObjectGenerator/SimpleObjectGenerator.php#L157-L170 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/VariableTokenParser.php | VariableTokenParser.parse | public function parse(Token $token)
{
$variable = substr($token->getValue(), 1);
if ('current' === $variable) {
return new FunctionCallValue(
'current',
[new ValueForCurrentValue()]
);
}
try {
return new VariableVa... | php | public function parse(Token $token)
{
$variable = substr($token->getValue(), 1);
if ('current' === $variable) {
return new FunctionCallValue(
'current',
[new ValueForCurrentValue()]
);
}
try {
return new VariableVa... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"variable",
"=",
"substr",
"(",
"$",
"token",
"->",
"getValue",
"(",
")",
",",
"1",
")",
";",
"if",
"(",
"'current'",
"===",
"$",
"variable",
")",
"{",
"return",
"new",
"Func... | Parses expressions such as '$username'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"$username",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/VariableTokenParser.php#L49-L65 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/ValueForCurrentValueResolver.php | ValueForCurrentValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$valueForCurrent = $fixture->getValueForCurrent();
if ($valueForCurrent instan... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$valueForCurrent = $fixture->getValueForCurrent();
if ($valueForCurrent instan... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param ValueForCurrentValue $value
@throws NoValueForCurrentException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/ValueForCurrentValueResolver.php#L46-L70 |
nelmio/alice | src/ParameterBag.php | ParameterBag.with | public function with(Parameter $parameter): self
{
$key = $parameter->getKey();
$clone = clone $this;
if (false === $clone->has($key)) {
$clone->parameters[$key] = $parameter->getValue();
}
return $clone;
} | php | public function with(Parameter $parameter): self
{
$key = $parameter->getKey();
$clone = clone $this;
if (false === $clone->has($key)) {
$clone->parameters[$key] = $parameter->getValue();
}
return $clone;
} | [
"public",
"function",
"with",
"(",
"Parameter",
"$",
"parameter",
")",
":",
"self",
"{",
"$",
"key",
"=",
"$",
"parameter",
"->",
"getKey",
"(",
")",
";",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"false",
"===",
"$",
"clone",
"->",
... | Returns a new instance which will include the passed parameter. If a parameter with that key already exist, it
WILL NOT be overridden. | [
"Returns",
"a",
"new",
"instance",
"which",
"will",
"include",
"the",
"passed",
"parameter",
".",
"If",
"a",
"parameter",
"with",
"that",
"key",
"already",
"exist",
"it",
"WILL",
"NOT",
"be",
"overridden",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/ParameterBag.php#L41-L51 |
nelmio/alice | src/ParameterBag.php | ParameterBag.get | public function get(string $key)
{
if ($this->has($key)) {
return deep_clone($this->parameters[$key]);
}
throw ParameterNotFoundExceptionFactory::create($key);
} | php | public function get(string $key)
{
if ($this->has($key)) {
return deep_clone($this->parameters[$key]);
}
throw ParameterNotFoundExceptionFactory::create($key);
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return",
"deep_clone",
"(",
"$",
"this",
"->",
"parameters",
"[",
"$",
"key",
"]",
")",
";",
"}",
"throw",
"... | @throws ParameterNotFoundException
@return mixed | [
"@throws",
"ParameterNotFoundException"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/ParameterBag.php#L71-L78 |
nelmio/alice | fixtures/Entity/StdClassFactory.php | StdClassFactory.create | public static function create(array $attributes = []): \stdClass
{
$instance = new \stdClass();
foreach ($attributes as $attribute => $value) {
$instance->$attribute = $value;
}
return $instance;
} | php | public static function create(array $attributes = []): \stdClass
{
$instance = new \stdClass();
foreach ($attributes as $attribute => $value) {
$instance->$attribute = $value;
}
return $instance;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
":",
"\\",
"stdClass",
"{",
"$",
"instance",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
... | Creates an stdClass instance with the given attributes. For example:
$std = $factory->create(['foo' => 'bar', 'ping' => 'pong']);
is equivalent to:
$std = new \stdClass();
$std->foo = 'bar';
$std->ping = 'pong';
@param array $attributes
@return \stdClass | [
"Creates",
"an",
"stdClass",
"instance",
"with",
"the",
"given",
"attributes",
".",
"For",
"example",
":"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/fixtures/Entity/StdClassFactory.php#L33-L41 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/StringArrayTokenParser.php | StringArrayTokenParser.parse | public function parse(Token $token): ValueInterface
{
parent::parse($token);
$value = $token->getValue();
try {
$elements = substr($value, 1, strlen($value) - 2);
return new ArrayValue($this->parseElements($this->parser, $elements));
} catch (\TypeError $err... | php | public function parse(Token $token): ValueInterface
{
parent::parse($token);
$value = $token->getValue();
try {
$elements = substr($value, 1, strlen($value) - 2);
return new ArrayValue($this->parseElements($this->parser, $elements));
} catch (\TypeError $err... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"ValueInterface",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"$",
"value",
"=",
"$",
"token",
"->",
"getValue",
"(",
")",
";",
"try",
"{",
"$",
"elements",
"=",
"s... | Parses '<{paramKey}>', '<{nested_<{param}>}>'.
{@inheritdoc} | [
"Parses",
"<",
"{",
"paramKey",
"}",
">",
"<",
"{",
"nested_<",
"{",
"param",
"}",
">",
"}",
">",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/StringArrayTokenParser.php#L41-L53 |
nelmio/alice | src/Generator/Resolver/Parameter/Chainable/StringParameterResolver.php | StringParameterResolver.resolve | public function resolve(
Parameter $parameter,
ParameterBag $unresolvedParameters,
ParameterBag $resolvedParameters,
ResolvingContext $context = null
): ParameterBag {
$context = ResolvingContext::createFrom($context, $parameter->getKey());
$self = $this;
$va... | php | public function resolve(
Parameter $parameter,
ParameterBag $unresolvedParameters,
ParameterBag $resolvedParameters,
ResolvingContext $context = null
): ParameterBag {
$context = ResolvingContext::createFrom($context, $parameter->getKey());
$self = $this;
$va... | [
"public",
"function",
"resolve",
"(",
"Parameter",
"$",
"parameter",
",",
"ParameterBag",
"$",
"unresolvedParameters",
",",
"ParameterBag",
"$",
"resolvedParameters",
",",
"ResolvingContext",
"$",
"context",
"=",
"null",
")",
":",
"ParameterBag",
"{",
"$",
"contex... | {@inheritdoc}
@throws ParameterNotFoundException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Parameter/Chainable/StringParameterResolver.php#L65-L93 |
nelmio/alice | src/FixtureBag.php | FixtureBag.get | public function get(string $id): FixtureInterface
{
if ($this->has($id)) {
return clone $this->fixtures[$id];
}
throw FixtureNotFoundExceptionFactory::create($id);
} | php | public function get(string $id): FixtureInterface
{
if ($this->has($id)) {
return clone $this->fixtures[$id];
}
throw FixtureNotFoundExceptionFactory::create($id);
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
")",
":",
"FixtureInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"clone",
"$",
"this",
"->",
"fixtures",
"[",
"$",
"id",
"]",
";",
"}",
"throw"... | @param string $id Fixture ID.
@throws FixtureNotFoundException | [
"@param",
"string",
"$id",
"Fixture",
"ID",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBag.php#L77-L84 |
nelmio/alice | src/Generator/Resolver/Parameter/Chainable/StaticParameterResolver.php | StaticParameterResolver.resolve | public function resolve(Parameter $parameter, ParameterBag $unresolvedParameters, ParameterBag $resolvedParameters): ParameterBag
{
return $resolvedParameters->with($parameter);
} | php | public function resolve(Parameter $parameter, ParameterBag $unresolvedParameters, ParameterBag $resolvedParameters): ParameterBag
{
return $resolvedParameters->with($parameter);
} | [
"public",
"function",
"resolve",
"(",
"Parameter",
"$",
"parameter",
",",
"ParameterBag",
"$",
"unresolvedParameters",
",",
"ParameterBag",
"$",
"resolvedParameters",
")",
":",
"ParameterBag",
"{",
"return",
"$",
"resolvedParameters",
"->",
"with",
"(",
"$",
"para... | {@inheritdoc}
@param bool|int|float $parameter | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Parameter/Chainable/StaticParameterResolver.php#L43-L46 |
nelmio/alice | src/Definition/FlagBag.php | FlagBag.withFlag | public function withFlag(FlagInterface $flag): self
{
$clone = clone ($this);
$clone->flags[$flag->__toString()] = deep_clone($flag);
return $clone;
} | php | public function withFlag(FlagInterface $flag): self
{
$clone = clone ($this);
$clone->flags[$flag->__toString()] = deep_clone($flag);
return $clone;
} | [
"public",
"function",
"withFlag",
"(",
"FlagInterface",
"$",
"flag",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"(",
"$",
"this",
")",
";",
"$",
"clone",
"->",
"flags",
"[",
"$",
"flag",
"->",
"__toString",
"(",
")",
"]",
"=",
"deep_clone",
... | Creates a new instance of the bag with the given flag. If a flag with the same identifier already exists, the
existing value will be replaced.
@return FlagBag | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"bag",
"with",
"the",
"given",
"flag",
".",
"If",
"a",
"flag",
"with",
"the",
"same",
"identifier",
"already",
"exists",
"the",
"existing",
"value",
"will",
"be",
"replaced",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Definition/FlagBag.php#L56-L62 |
nelmio/alice | src/Definition/FlagBag.php | FlagBag.mergeWith | public function mergeWith(self $flags, bool $override = true): self
{
if ($override) {
$clone = clone ($this);
foreach ($flags as $stringFlag => $flag) {
/** @var FlagInterface $flag */
$clone->flags[$flag->__toString()] = clone ($flag);
}
... | php | public function mergeWith(self $flags, bool $override = true): self
{
if ($override) {
$clone = clone ($this);
foreach ($flags as $stringFlag => $flag) {
/** @var FlagInterface $flag */
$clone->flags[$flag->__toString()] = clone ($flag);
}
... | [
"public",
"function",
"mergeWith",
"(",
"self",
"$",
"flags",
",",
"bool",
"$",
"override",
"=",
"true",
")",
":",
"self",
"{",
"if",
"(",
"$",
"override",
")",
"{",
"$",
"clone",
"=",
"clone",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"fl... | Creates a new instance with the two bags merged together.
The original key is kept.
@param bool $override If some flags overlaps, the existing one are overridden if the value is true, and left
untouched otherwise. | [
"Creates",
"a",
"new",
"instance",
"with",
"the",
"two",
"bags",
"merged",
"together",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Definition/FlagBag.php#L72-L90 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/MethodReferenceTokenParser.php | MethodReferenceTokenParser.parse | public function parse(Token $token): FixtureMethodCallValue
{
parent::parse($token);
$explodedValue = explode('->', $token->getValue());
if (count($explodedValue) !== 2) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference =... | php | public function parse(Token $token): FixtureMethodCallValue
{
parent::parse($token);
$explodedValue = explode('->', $token->getValue());
if (count($explodedValue) !== 2) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference =... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"FixtureMethodCallValue",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"$",
"explodedValue",
"=",
"explode",
"(",
"'->'",
",",
"$",
"token",
"->",
"getValue",
"(",
")",
... | Parses tokens values like "@user->getUserName()".
{@inheritdoc}
@throws ParseException | [
"Parses",
"tokens",
"values",
"like",
"@user",
"-",
">",
"getUserName",
"()",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/MethodReferenceTokenParser.php#L44-L66 |
nelmio/alice | src/Generator/Hydrator/Property/SymfonyPropertyAccessorHydrator.php | SymfonyPropertyAccessorHydrator.hydrate | public function hydrate(ObjectInterface $object, Property $property, GenerationContext $context): ObjectInterface
{
$instance = $object->getInstance();
try {
$this->propertyAccessor->setValue($instance, $property->getName(), $property->getValue());
} catch (SymfonyNoSuchPropertyE... | php | public function hydrate(ObjectInterface $object, Property $property, GenerationContext $context): ObjectInterface
{
$instance = $object->getInstance();
try {
$this->propertyAccessor->setValue($instance, $property->getName(), $property->getValue());
} catch (SymfonyNoSuchPropertyE... | [
"public",
"function",
"hydrate",
"(",
"ObjectInterface",
"$",
"object",
",",
"Property",
"$",
"property",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ObjectInterface",
"{",
"$",
"instance",
"=",
"$",
"object",
"->",
"getInstance",
"(",
")",
";",
"tr... | {@inheritdoc}
@throws NoSuchPropertyException
@throws InaccessiblePropertyException
@throws InvalidArgumentException When the typehint does not match for example
@throws HydrationException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Hydrator/Property/SymfonyPropertyAccessorHydrator.php#L56-L74 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureListReferenceTokenParser.php | FixtureListReferenceTokenParser.buildReferences | private function buildReferences(Token $token): array
{
$matches = [];
$name = (string) substr($token->getValue(), 1);
if (1 !== preg_match(self::REGEX, $name, $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$listElemen... | php | private function buildReferences(Token $token): array
{
$matches = [];
$name = (string) substr($token->getValue(), 1);
if (1 !== preg_match(self::REGEX, $name, $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$listElemen... | [
"private",
"function",
"buildReferences",
"(",
"Token",
"$",
"token",
")",
":",
"array",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"name",
"=",
"(",
"string",
")",
"substr",
"(",
"$",
"token",
"->",
"getValue",
"(",
")",
",",
"1",
")",
";",
"... | @throws ParseException
@return string[]
@example
"@user_{alice, bob}" => ['user_alice', 'user_bob'] | [
"@throws",
"ParseException"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureListReferenceTokenParser.php#L76-L98 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/ArrayValueResolver.php | ArrayValueResolver.resolve | public function resolve(
ValueInterface $list,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::crea... | php | public function resolve(
ValueInterface $list,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::crea... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"list",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet",... | {@inheritdoc}
@param ArrayValue $list | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/ArrayValueResolver.php#L63-L85 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FunctionCallArgumentResolver.php | FunctionCallArgumentResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->argumentResolver) {
throw ResolverNotFoundExceptionFact... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->argumentResolver) {
throw ResolverNotFoundExceptionFact... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FunctionCallValue $value | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FunctionCallArgumentResolver.php#L73-L101 |
overtrue/laravel-lang | src/FileLoader.php | FileLoader.load | public function load($locale, $group, $namespace = null)
{
$defaults = [];
foreach ($this->paths as $path) {
$defaults = array_replace_recursive($defaults, $this->loadPath($path, $locale, $group));
}
return array_replace_recursive($defaults, parent::load($locale, $group... | php | public function load($locale, $group, $namespace = null)
{
$defaults = [];
foreach ($this->paths as $path) {
$defaults = array_replace_recursive($defaults, $this->loadPath($path, $locale, $group));
}
return array_replace_recursive($defaults, parent::load($locale, $group... | [
"public",
"function",
"load",
"(",
"$",
"locale",
",",
"$",
"group",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"defaults",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"defaults",
"=",... | Load the messages for the given locale.
@param string $locale
@param string $group
@param string $namespace
@return array | [
"Load",
"the",
"messages",
"for",
"the",
"given",
"locale",
"."
] | train | https://github.com/overtrue/laravel-lang/blob/1869fbe837feb5e1c630d2eb731f4ddd2ff1fc7c/src/FileLoader.php#L46-L55 |
overtrue/laravel-lang | src/FileLoader.php | FileLoader.loadPath | protected function loadPath($path, $locale, $group)
{
$result = parent::loadPath($path, $locale, $group);
if (empty($result) && str_contains($locale, '-')) {
return parent::loadPath($path, strstr($locale, '-', true), $group);
}
return $result;
} | php | protected function loadPath($path, $locale, $group)
{
$result = parent::loadPath($path, $locale, $group);
if (empty($result) && str_contains($locale, '-')) {
return parent::loadPath($path, strstr($locale, '-', true), $group);
}
return $result;
} | [
"protected",
"function",
"loadPath",
"(",
"$",
"path",
",",
"$",
"locale",
",",
"$",
"group",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"loadPath",
"(",
"$",
"path",
",",
"$",
"locale",
",",
"$",
"group",
")",
";",
"if",
"(",
"empty",
"(",
"$... | Fall back to base locale (i.e. de) if a countries specific locale (i.e. de-CH) is not available.
@param string $path
@param string $locale
@param string $group
@return array | [
"Fall",
"back",
"to",
"base",
"locale",
"(",
"i",
".",
"e",
".",
"de",
")",
"if",
"a",
"countries",
"specific",
"locale",
"(",
"i",
".",
"e",
".",
"de",
"-",
"CH",
")",
"is",
"not",
"available",
"."
] | train | https://github.com/overtrue/laravel-lang/blob/1869fbe837feb5e1c630d2eb731f4ddd2ff1fc7c/src/FileLoader.php#L66-L75 |
overtrue/laravel-lang | src/Commands/Publish.php | Publish.handle | public function handle()
{
$locale = $this->argument('locales');
$force = $this->option('force') ? 'f' : 'n';
$sourcePath = base_path('vendor/caouecs/laravel-lang/src');
$sourceJsonPath = base_path('vendor/caouecs/laravel-lang/json');
$targetPath = base_path('resources/lang/... | php | public function handle()
{
$locale = $this->argument('locales');
$force = $this->option('force') ? 'f' : 'n';
$sourcePath = base_path('vendor/caouecs/laravel-lang/src');
$sourceJsonPath = base_path('vendor/caouecs/laravel-lang/json');
$targetPath = base_path('resources/lang/... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"argument",
"(",
"'locales'",
")",
";",
"$",
"force",
"=",
"$",
"this",
"->",
"option",
"(",
"'force'",
")",
"?",
"'f'",
":",
"'n'",
";",
"$",
"sourcePath",
"=",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/overtrue/laravel-lang/blob/1869fbe837feb5e1c630d2eb731f4ddd2ff1fc7c/src/Commands/Publish.php#L44-L121 |
overtrue/laravel-lang | src/TranslationServiceProvider.php | TranslationServiceProvider.register | public function register()
{
if ($this->app instanceof \Laravel\Lumen\Application) {
$this->inLumen = true;
$this->app->configure('app');
unset($this->app->availableBindings['translator']);
}
parent::register();
$this->registerCommands();
} | php | public function register()
{
if ($this->app instanceof \Laravel\Lumen\Application) {
$this->inLumen = true;
$this->app->configure('app');
unset($this->app->availableBindings['translator']);
}
parent::register();
$this->registerCommands();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"instanceof",
"\\",
"Laravel",
"\\",
"Lumen",
"\\",
"Application",
")",
"{",
"$",
"this",
"->",
"inLumen",
"=",
"true",
";",
"$",
"this",
"->",
"app",
"->",
"config... | Register the service provider. | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/overtrue/laravel-lang/blob/1869fbe837feb5e1c630d2eb731f4ddd2ff1fc7c/src/TranslationServiceProvider.php#L27-L40 |
overtrue/laravel-lang | src/TranslationServiceProvider.php | TranslationServiceProvider.registerLoader | protected function registerLoader()
{
$this->app->singleton('translation.loader', function ($app) {
$paths = [
base_path('vendor/caouecs/laravel-lang/src/'),
];
if ($this->inLumen) {
$this->app['path.lang'] = base_path('vendor/laravel/lume... | php | protected function registerLoader()
{
$this->app->singleton('translation.loader', function ($app) {
$paths = [
base_path('vendor/caouecs/laravel-lang/src/'),
];
if ($this->inLumen) {
$this->app['path.lang'] = base_path('vendor/laravel/lume... | [
"protected",
"function",
"registerLoader",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'translation.loader'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"paths",
"=",
"[",
"base_path",
"(",
"'vendor/caouecs/laravel-lang/src/'",
")",... | Register the translation line loader. | [
"Register",
"the",
"translation",
"line",
"loader",
"."
] | train | https://github.com/overtrue/laravel-lang/blob/1869fbe837feb5e1c630d2eb731f4ddd2ff1fc7c/src/TranslationServiceProvider.php#L45-L65 |
web-token/jwt-framework | src/Component/Checker/HeaderCheckerManager.php | HeaderCheckerManager.check | public function check(JWT $jwt, int $index, array $mandatoryHeaderParameters = [])
{
foreach ($this->tokenTypes as $tokenType) {
if ($tokenType->supports($jwt)) {
$protected = [];
$unprotected = [];
$tokenType->retrieveTokenHeaders($jwt, $index, $p... | php | public function check(JWT $jwt, int $index, array $mandatoryHeaderParameters = [])
{
foreach ($this->tokenTypes as $tokenType) {
if ($tokenType->supports($jwt)) {
$protected = [];
$unprotected = [];
$tokenType->retrieveTokenHeaders($jwt, $index, $p... | [
"public",
"function",
"check",
"(",
"JWT",
"$",
"jwt",
",",
"int",
"$",
"index",
",",
"array",
"$",
"mandatoryHeaderParameters",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tokenTypes",
"as",
"$",
"tokenType",
")",
"{",
"if",
"(",
"$... | This method checks all the header parameters passed as argument.
All header parameters are checked against the header parameter checkers.
If one fails, the InvalidHeaderException is thrown.
@param string[] $mandatoryHeaderParameters
@throws InvalidHeaderException
@throws MissingMandatoryHeaderParameterException | [
"This",
"method",
"checks",
"all",
"the",
"header",
"parameters",
"passed",
"as",
"argument",
".",
"All",
"header",
"parameters",
"are",
"checked",
"against",
"the",
"header",
"parameter",
"checkers",
".",
"If",
"one",
"fails",
"the",
"InvalidHeaderException",
"... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/HeaderCheckerManager.php#L103-L119 |
web-token/jwt-framework | src/Component/Checker/HeaderCheckerManager.php | HeaderCheckerManager.checkMandatoryHeaderParameters | private function checkMandatoryHeaderParameters(array $mandatoryHeaderParameters, array $protected, array $unprotected)
{
if (empty($mandatoryHeaderParameters)) {
return;
}
$diff = \array_keys(\array_diff_key(\array_flip($mandatoryHeaderParameters), \array_merge($protected, $unpr... | php | private function checkMandatoryHeaderParameters(array $mandatoryHeaderParameters, array $protected, array $unprotected)
{
if (empty($mandatoryHeaderParameters)) {
return;
}
$diff = \array_keys(\array_diff_key(\array_flip($mandatoryHeaderParameters), \array_merge($protected, $unpr... | [
"private",
"function",
"checkMandatoryHeaderParameters",
"(",
"array",
"$",
"mandatoryHeaderParameters",
",",
"array",
"$",
"protected",
",",
"array",
"$",
"unprotected",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"mandatoryHeaderParameters",
")",
")",
"{",
"return",... | @param string[] $mandatoryHeaderParameters
@throws MissingMandatoryHeaderParameterException | [
"@param",
"string",
"[]",
"$mandatoryHeaderParameters"
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/HeaderCheckerManager.php#L134-L144 |
web-token/jwt-framework | src/Component/Encryption/Util/ConcatKDF.php | ConcatKDF.generate | public static function generate(string $Z, string $algorithm, int $encryption_key_size, string $apu = '', string $apv = ''): string
{
$apu = !empty($apu) ? Base64Url::decode($apu) : '';
$apv = !empty($apv) ? Base64Url::decode($apv) : '';
$encryption_segments = [
self::toInt32Bits... | php | public static function generate(string $Z, string $algorithm, int $encryption_key_size, string $apu = '', string $apv = ''): string
{
$apu = !empty($apu) ? Base64Url::decode($apu) : '';
$apv = !empty($apv) ? Base64Url::decode($apv) : '';
$encryption_segments = [
self::toInt32Bits... | [
"public",
"static",
"function",
"generate",
"(",
"string",
"$",
"Z",
",",
"string",
"$",
"algorithm",
",",
"int",
"$",
"encryption_key_size",
",",
"string",
"$",
"apu",
"=",
"''",
",",
"string",
"$",
"apv",
"=",
"''",
")",
":",
"string",
"{",
"$",
"a... | Key Derivation Function.
@param string $Z Shared secret
@param string $algorithm Encryption algorithm
@param int $encryption_key_size Size of the encryption key
@param string $apu Agreement PartyUInfo (information about the producer)
@param string $apv Agr... | [
"Key",
"Derivation",
"Function",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Util/ConcatKDF.php#L34-L53 |
web-token/jwt-framework | src/Component/Encryption/Serializer/JWESerializerManager.php | JWESerializerManager.add | private function add(JWESerializer $serializer): self
{
$this->serializers[$serializer->name()] = $serializer;
return $this;
} | php | private function add(JWESerializer $serializer): self
{
$this->serializers[$serializer->name()] = $serializer;
return $this;
} | [
"private",
"function",
"add",
"(",
"JWESerializer",
"$",
"serializer",
")",
":",
"self",
"{",
"$",
"this",
"->",
"serializers",
"[",
"$",
"serializer",
"->",
"name",
"(",
")",
"]",
"=",
"$",
"serializer",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a serializer to the manager.
@return JWESerializerManager | [
"Adds",
"a",
"serializer",
"to",
"the",
"manager",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Serializer/JWESerializerManager.php#L54-L59 |
web-token/jwt-framework | src/Component/Encryption/Serializer/JWESerializerManager.php | JWESerializerManager.serialize | public function serialize(string $name, JWE $jws, ?int $recipientIndex = null): string
{
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
return ($this->serializers[$name])->serialize($jw... | php | public function serialize(string $name, JWE $jws, ?int $recipientIndex = null): string
{
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
return ($this->serializers[$name])->serialize($jw... | [
"public",
"function",
"serialize",
"(",
"string",
"$",
"name",
",",
"JWE",
"$",
"jws",
",",
"?",
"int",
"$",
"recipientIndex",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
... | Converts a JWE into a string.
Throws an exception if none of the serializer was able to convert the input.
@throws \Exception | [
"Converts",
"a",
"JWE",
"into",
"a",
"string",
".",
"Throws",
"an",
"exception",
"if",
"none",
"of",
"the",
"serializer",
"was",
"able",
"to",
"convert",
"the",
"input",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Serializer/JWESerializerManager.php#L89-L96 |
web-token/jwt-framework | src/Component/Encryption/Serializer/JWESerializerManager.php | JWESerializerManager.unserialize | public function unserialize(string $input, ?string &$name = null): JWE
{
foreach ($this->serializers as $serializer) {
try {
$jws = $serializer->unserialize($input);
$name = $serializer->name();
return $jws;
} catch (\InvalidArgumentEx... | php | public function unserialize(string $input, ?string &$name = null): JWE
{
foreach ($this->serializers as $serializer) {
try {
$jws = $serializer->unserialize($input);
$name = $serializer->name();
return $jws;
} catch (\InvalidArgumentEx... | [
"public",
"function",
"unserialize",
"(",
"string",
"$",
"input",
",",
"?",
"string",
"&",
"$",
"name",
"=",
"null",
")",
":",
"JWE",
"{",
"foreach",
"(",
"$",
"this",
"->",
"serializers",
"as",
"$",
"serializer",
")",
"{",
"try",
"{",
"$",
"jws",
... | Loads data and return a JWE object.
Throws an exception if none of the serializer was able to convert the input.
@param string $input A string that represents a JWE
@param string|null $name the name of the serializer if the input is unserialized
@throws \Exception | [
"Loads",
"data",
"and",
"return",
"a",
"JWE",
"object",
".",
"Throws",
"an",
"exception",
"if",
"none",
"of",
"the",
"serializer",
"was",
"able",
"to",
"convert",
"the",
"input",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Serializer/JWESerializerManager.php#L107-L121 |
web-token/jwt-framework | src/Component/Encryption/Serializer/JWESerializerManagerFactory.php | JWESerializerManagerFactory.create | public function create(array $names): JWESerializerManager
{
$serializers = [];
foreach ($names as $name) {
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
... | php | public function create(array $names): JWESerializerManager
{
$serializers = [];
foreach ($names as $name) {
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
... | [
"public",
"function",
"create",
"(",
"array",
"$",
"names",
")",
":",
"JWESerializerManager",
"{",
"$",
"serializers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
... | Creates a serializer manager factory using the given serializers.
@param string[] $names | [
"Creates",
"a",
"serializer",
"manager",
"factory",
"using",
"the",
"given",
"serializers",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Serializer/JWESerializerManagerFactory.php#L28-L39 |
web-token/jwt-framework | src/Component/Encryption/NestedTokenBuilderFactory.php | NestedTokenBuilderFactory.create | public function create(array $jwe_serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods, array $jws_serializers, array $signatureAlgorithms): NestedTokenBuilder
{
$jweBuilder = $this->jweBuilderFactory->create($keyEncryptionAlgorithms, $contentEncryptionA... | php | public function create(array $jwe_serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods, array $jws_serializers, array $signatureAlgorithms): NestedTokenBuilder
{
$jweBuilder = $this->jweBuilderFactory->create($keyEncryptionAlgorithms, $contentEncryptionA... | [
"public",
"function",
"create",
"(",
"array",
"$",
"jwe_serializers",
",",
"array",
"$",
"keyEncryptionAlgorithms",
",",
"array",
"$",
"contentEncryptionAlgorithms",
",",
"array",
"$",
"compressionMethods",
",",
"array",
"$",
"jws_serializers",
",",
"array",
"$",
... | This method creates a Nested Token Builder with the given encryption/signature algorithms, serializers and compression methods. | [
"This",
"method",
"creates",
"a",
"Nested",
"Token",
"Builder",
"with",
"the",
"given",
"encryption",
"/",
"signature",
"algorithms",
"serializers",
"and",
"compression",
"methods",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/NestedTokenBuilderFactory.php#L56-L64 |
web-token/jwt-framework | src/Component/Core/Util/RSAKey.php | RSAKey.exponentiate | public static function exponentiate(self $key, BigInteger $c): BigInteger
{
if ($c->compare(BigInteger::createFromDecimal(0)) < 0 || $c->compare($key->getModulus()) > 0) {
throw new \RuntimeException();
}
if ($key->isPublic() || empty($key->getPrimes()) || empty($key->getExponent... | php | public static function exponentiate(self $key, BigInteger $c): BigInteger
{
if ($c->compare(BigInteger::createFromDecimal(0)) < 0 || $c->compare($key->getModulus()) > 0) {
throw new \RuntimeException();
}
if ($key->isPublic() || empty($key->getPrimes()) || empty($key->getExponent... | [
"public",
"static",
"function",
"exponentiate",
"(",
"self",
"$",
"key",
",",
"BigInteger",
"$",
"c",
")",
":",
"BigInteger",
"{",
"if",
"(",
"$",
"c",
"->",
"compare",
"(",
"BigInteger",
"::",
"createFromDecimal",
"(",
"0",
")",
")",
"<",
"0",
"||",
... | Exponentiate with or without Chinese Remainder Theorem.
Operation with primes 'p' and 'q' is appox. 2x faster.
@param RSAKey $key | [
"Exponentiate",
"with",
"or",
"without",
"Chinese",
"Remainder",
"Theorem",
".",
"Operation",
"with",
"primes",
"p",
"and",
"q",
"is",
"appox",
".",
"2x",
"faster",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/Util/RSAKey.php#L300-L321 |
web-token/jwt-framework | src/Component/Core/Util/BigInteger.php | BigInteger.subtract | public function subtract(self $y): self
{
$value = \gmp_sub($this->value, $y->value);
return self::createFromGMPResource($value);
} | php | public function subtract(self $y): self
{
$value = \gmp_sub($this->value, $y->value);
return self::createFromGMPResource($value);
} | [
"public",
"function",
"subtract",
"(",
"self",
"$",
"y",
")",
":",
"self",
"{",
"$",
"value",
"=",
"\\",
"gmp_sub",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"y",
"->",
"value",
")",
";",
"return",
"self",
"::",
"createFromGMPResource",
"(",
"$",
... | Subtracts two BigIntegers.
@param BigInteger $y
@return BigInteger | [
"Subtracts",
"two",
"BigIntegers",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/Util/BigInteger.php#L99-L104 |
web-token/jwt-framework | src/Component/Core/Util/BigInteger.php | BigInteger.modInverse | public function modInverse(self $n): self
{
$value = \gmp_invert($this->value, $n->value);
return self::createFromGMPResource($value);
} | php | public function modInverse(self $n): self
{
$value = \gmp_invert($this->value, $n->value);
return self::createFromGMPResource($value);
} | [
"public",
"function",
"modInverse",
"(",
"self",
"$",
"n",
")",
":",
"self",
"{",
"$",
"value",
"=",
"\\",
"gmp_invert",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"n",
"->",
"value",
")",
";",
"return",
"self",
"::",
"createFromGMPResource",
"(",
"$... | Calculates modular inverses.
@param BigInteger $n
@return BigInteger | [
"Calculates",
"modular",
"inverses",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/Util/BigInteger.php#L170-L175 |
web-token/jwt-framework | src/Component/Core/Util/BigInteger.php | BigInteger.random | public static function random(self $y): self
{
$zero = self::createFromDecimal(0);
return self::createFromGMPResource(\gmp_random_range($zero->value, $y->value));
} | php | public static function random(self $y): self
{
$zero = self::createFromDecimal(0);
return self::createFromGMPResource(\gmp_random_range($zero->value, $y->value));
} | [
"public",
"static",
"function",
"random",
"(",
"self",
"$",
"y",
")",
":",
"self",
"{",
"$",
"zero",
"=",
"self",
"::",
"createFromDecimal",
"(",
"0",
")",
";",
"return",
"self",
"::",
"createFromGMPResource",
"(",
"\\",
"gmp_random_range",
"(",
"$",
"ze... | @param BigInteger $y
@return BigInteger | [
"@param",
"BigInteger",
"$y"
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/Util/BigInteger.php#L200-L205 |
web-token/jwt-framework | src/Component/Encryption/JWEDecrypterFactory.php | JWEDecrypterFactory.create | public function create(array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods): JWEDecrypter
{
$keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms);
$contentEncryptionAlgorithmManager = $this->algorithmManagerFactory... | php | public function create(array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods): JWEDecrypter
{
$keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms);
$contentEncryptionAlgorithmManager = $this->algorithmManagerFactory... | [
"public",
"function",
"create",
"(",
"array",
"$",
"keyEncryptionAlgorithms",
",",
"array",
"$",
"contentEncryptionAlgorithms",
",",
"array",
"$",
"compressionMethods",
")",
":",
"JWEDecrypter",
"{",
"$",
"keyEncryptionAlgorithmManager",
"=",
"$",
"this",
"->",
"alg... | Creates a JWE Decrypter object using the given key encryption algorithms, content encryption algorithms and compression methods.
@param string[] $keyEncryptionAlgorithms
@param string[] $contentEncryptionAlgorithms
@param string[] $compressionMethods | [
"Creates",
"a",
"JWE",
"Decrypter",
"object",
"using",
"the",
"given",
"key",
"encryption",
"algorithms",
"content",
"encryption",
"algorithms",
"and",
"compression",
"methods",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWEDecrypterFactory.php#L47-L54 |
web-token/jwt-framework | src/Component/KeyManagement/JWKFactory.php | JWKFactory.createRSAKey | public static function createRSAKey(int $size, array $values = []): JWK
{
if (0 !== $size % 8) {
throw new InvalidArgumentException('Invalid key size.');
}
if (512 > $size) {
throw new InvalidArgumentException('Key length is too short. It needs to be at least 512 bit... | php | public static function createRSAKey(int $size, array $values = []): JWK
{
if (0 !== $size % 8) {
throw new InvalidArgumentException('Invalid key size.');
}
if (512 > $size) {
throw new InvalidArgumentException('Key length is too short. It needs to be at least 512 bit... | [
"public",
"static",
"function",
"createRSAKey",
"(",
"int",
"$",
"size",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"JWK",
"{",
"if",
"(",
"0",
"!==",
"$",
"size",
"%",
"8",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Inva... | Creates a RSA key with the given key size and additional values.
@param int $size The key size in bits
@param array $values values to configure the key | [
"Creates",
"a",
"RSA",
"key",
"with",
"the",
"given",
"key",
"size",
"and",
"additional",
"values",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/JWKFactory.php#L36-L59 |
web-token/jwt-framework | src/Component/KeyManagement/JWKFactory.php | JWKFactory.createOctKey | public static function createOctKey(int $size, array $values = []): JWK
{
if (0 !== $size % 8) {
throw new InvalidArgumentException('Invalid key size.');
}
$values = \array_merge(
$values,
[
'kty' => 'oct',
'k' => Base64Url:... | php | public static function createOctKey(int $size, array $values = []): JWK
{
if (0 !== $size % 8) {
throw new InvalidArgumentException('Invalid key size.');
}
$values = \array_merge(
$values,
[
'kty' => 'oct',
'k' => Base64Url:... | [
"public",
"static",
"function",
"createOctKey",
"(",
"int",
"$",
"size",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"JWK",
"{",
"if",
"(",
"0",
"!==",
"$",
"size",
"%",
"8",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Inva... | Creates a octet key with the given key size and additional values.
@param int $size The key size in bits
@param array $values values to configure the key | [
"Creates",
"a",
"octet",
"key",
"with",
"the",
"given",
"key",
"size",
"and",
"additional",
"values",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/JWKFactory.php#L78-L92 |
web-token/jwt-framework | src/Component/KeyManagement/JWKFactory.php | JWKFactory.createOKPKey | public static function createOKPKey(string $curve, array $values = []): JWK
{
switch ($curve) {
case 'X25519':
$keyPair = \sodium_crypto_box_keypair();
$secret = \sodium_crypto_box_secretkey($keyPair);
$x = \sodium_crypto_box_publickey($keyPair);
... | php | public static function createOKPKey(string $curve, array $values = []): JWK
{
switch ($curve) {
case 'X25519':
$keyPair = \sodium_crypto_box_keypair();
$secret = \sodium_crypto_box_secretkey($keyPair);
$x = \sodium_crypto_box_publickey($keyPair);
... | [
"public",
"static",
"function",
"createOKPKey",
"(",
"string",
"$",
"curve",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"JWK",
"{",
"switch",
"(",
"$",
"curve",
")",
"{",
"case",
"'X25519'",
":",
"$",
"keyPair",
"=",
"\\",
"sodium_crypto_box... | Creates a OKP key with the given curve and additional values.
@param string $curve The curve
@param array $values values to configure the key | [
"Creates",
"a",
"OKP",
"key",
"with",
"the",
"given",
"curve",
"and",
"additional",
"values",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/JWKFactory.php#L100-L132 |
web-token/jwt-framework | src/Component/KeyManagement/JWKFactory.php | JWKFactory.createFromPKCS12CertificateFile | public static function createFromPKCS12CertificateFile(string $file, ?string $secret = '', array $additional_values = []): JWK
{
$res = \openssl_pkcs12_read(\file_get_contents($file), $certs, $secret);
if (false === $res || !\is_array($certs) || !\array_key_exists('pkey', $certs)) {
thro... | php | public static function createFromPKCS12CertificateFile(string $file, ?string $secret = '', array $additional_values = []): JWK
{
$res = \openssl_pkcs12_read(\file_get_contents($file), $certs, $secret);
if (false === $res || !\is_array($certs) || !\array_key_exists('pkey', $certs)) {
thro... | [
"public",
"static",
"function",
"createFromPKCS12CertificateFile",
"(",
"string",
"$",
"file",
",",
"?",
"string",
"$",
"secret",
"=",
"''",
",",
"array",
"$",
"additional_values",
"=",
"[",
"]",
")",
":",
"JWK",
"{",
"$",
"res",
"=",
"\\",
"openssl_pkcs12... | This method will try to load a PKCS#12 file and convert it into a public key.
@throws \Exception | [
"This",
"method",
"will",
"try",
"to",
"load",
"a",
"PKCS#12",
"file",
"and",
"convert",
"it",
"into",
"a",
"public",
"key",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/JWKFactory.php#L226-L234 |
web-token/jwt-framework | src/Ecc/Curve.php | Curve.bnNumBits | private function bnNumBits(\GMP $x): int
{
$zero = \gmp_init(0, 10);
if (Math::equals($x, $zero)) {
return 0;
}
$log2 = 0;
while (false === Math::equals($x, $zero)) {
$x = Math::rightShift($x, 1);
++$log2;
}
return $log2;
... | php | private function bnNumBits(\GMP $x): int
{
$zero = \gmp_init(0, 10);
if (Math::equals($x, $zero)) {
return 0;
}
$log2 = 0;
while (false === Math::equals($x, $zero)) {
$x = Math::rightShift($x, 1);
++$log2;
}
return $log2;
... | [
"private",
"function",
"bnNumBits",
"(",
"\\",
"GMP",
"$",
"x",
")",
":",
"int",
"{",
"$",
"zero",
"=",
"\\",
"gmp_init",
"(",
"0",
",",
"10",
")",
";",
"if",
"(",
"Math",
"::",
"equals",
"(",
"$",
"x",
",",
"$",
"zero",
")",
")",
"{",
"retur... | Returns the number of bits used to store this number. Non-significant upper bits are not counted.
@see https://www.openssl.org/docs/crypto/BN_num_bytes.html | [
"Returns",
"the",
"number",
"of",
"bits",
"used",
"to",
"store",
"this",
"number",
".",
"Non",
"-",
"significant",
"upper",
"bits",
"are",
"not",
"counted",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Ecc/Curve.php#L296-L309 |
web-token/jwt-framework | src/Component/Core/AlgorithmManager.php | AlgorithmManager.get | public function get(string $algorithm): Algorithm
{
if (!$this->has($algorithm)) {
throw new \InvalidArgumentException(\sprintf('The algorithm "%s" is not supported.', $algorithm));
}
return $this->algorithms[$algorithm];
} | php | public function get(string $algorithm): Algorithm
{
if (!$this->has($algorithm)) {
throw new \InvalidArgumentException(\sprintf('The algorithm "%s" is not supported.', $algorithm));
}
return $this->algorithms[$algorithm];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"algorithm",
")",
":",
"Algorithm",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"algorithm",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\\",
"sprintf",
"(",
"'The... | Returns the algorithm if supported, otherwise throw an exception.
@param string $algorithm The algorithm | [
"Returns",
"the",
"algorithm",
"if",
"supported",
"otherwise",
"throw",
"an",
"exception",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/AlgorithmManager.php#L72-L79 |
web-token/jwt-framework | src/Component/Core/AlgorithmManager.php | AlgorithmManager.add | private function add(Algorithm $algorithm): self
{
$name = $algorithm->name();
$this->algorithms[$name] = $algorithm;
return $this;
} | php | private function add(Algorithm $algorithm): self
{
$name = $algorithm->name();
$this->algorithms[$name] = $algorithm;
return $this;
} | [
"private",
"function",
"add",
"(",
"Algorithm",
"$",
"algorithm",
")",
":",
"self",
"{",
"$",
"name",
"=",
"$",
"algorithm",
"->",
"name",
"(",
")",
";",
"$",
"this",
"->",
"algorithms",
"[",
"$",
"name",
"]",
"=",
"$",
"algorithm",
";",
"return",
... | Adds an algorithm to the manager.
@return AlgorithmManager | [
"Adds",
"an",
"algorithm",
"to",
"the",
"manager",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/AlgorithmManager.php#L86-L92 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.getMGF1 | private static function getMGF1(string $mgfSeed, int $maskLen, Hash $mgfHash): string
{
$t = '';
$count = \ceil($maskLen / $mgfHash->getLength());
for ($i = 0; $i < $count; ++$i) {
$c = \pack('N', $i);
$t .= $mgfHash->hash($mgfSeed.$c);
}
return \mb_s... | php | private static function getMGF1(string $mgfSeed, int $maskLen, Hash $mgfHash): string
{
$t = '';
$count = \ceil($maskLen / $mgfHash->getLength());
for ($i = 0; $i < $count; ++$i) {
$c = \pack('N', $i);
$t .= $mgfHash->hash($mgfSeed.$c);
}
return \mb_s... | [
"private",
"static",
"function",
"getMGF1",
"(",
"string",
"$",
"mgfSeed",
",",
"int",
"$",
"maskLen",
",",
"Hash",
"$",
"mgfHash",
")",
":",
"string",
"{",
"$",
"t",
"=",
"''",
";",
"$",
"count",
"=",
"\\",
"ceil",
"(",
"$",
"maskLen",
"/",
"$",
... | MGF1. | [
"MGF1",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L48-L58 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.encodeEMSAPSS | private static function encodeEMSAPSS(string $message, int $modulusLength, Hash $hash): string
{
$emLen = ($modulusLength + 1) >> 3;
$sLen = $hash->getLength();
$mHash = $hash->hash($message);
if ($emLen <= $hash->getLength() + $sLen + 2) {
throw new \RuntimeException();
... | php | private static function encodeEMSAPSS(string $message, int $modulusLength, Hash $hash): string
{
$emLen = ($modulusLength + 1) >> 3;
$sLen = $hash->getLength();
$mHash = $hash->hash($message);
if ($emLen <= $hash->getLength() + $sLen + 2) {
throw new \RuntimeException();
... | [
"private",
"static",
"function",
"encodeEMSAPSS",
"(",
"string",
"$",
"message",
",",
"int",
"$",
"modulusLength",
",",
"Hash",
"$",
"hash",
")",
":",
"string",
"{",
"$",
"emLen",
"=",
"(",
"$",
"modulusLength",
"+",
"1",
")",
">>",
"3",
";",
"$",
"s... | EMSA-PSS-ENCODE. | [
"EMSA",
"-",
"PSS",
"-",
"ENCODE",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L63-L82 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.verifyEMSAPSS | private static function verifyEMSAPSS(string $m, string $em, int $emBits, Hash $hash): bool
{
$emLen = ($emBits + 1) >> 3;
$sLen = $hash->getLength();
$mHash = $hash->hash($m);
if ($emLen < $hash->getLength() + $sLen + 2) {
throw new \InvalidArgumentException();
}... | php | private static function verifyEMSAPSS(string $m, string $em, int $emBits, Hash $hash): bool
{
$emLen = ($emBits + 1) >> 3;
$sLen = $hash->getLength();
$mHash = $hash->hash($m);
if ($emLen < $hash->getLength() + $sLen + 2) {
throw new \InvalidArgumentException();
}... | [
"private",
"static",
"function",
"verifyEMSAPSS",
"(",
"string",
"$",
"m",
",",
"string",
"$",
"em",
",",
"int",
"$",
"emBits",
",",
"Hash",
"$",
"hash",
")",
":",
"bool",
"{",
"$",
"emLen",
"=",
"(",
"$",
"emBits",
"+",
"1",
")",
">>",
"3",
";",... | EMSA-PSS-VERIFY. | [
"EMSA",
"-",
"PSS",
"-",
"VERIFY",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L87-L119 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.signWithPSS | public static function signWithPSS(RSAKey $key, string $message, string $hash): string
{
$em = self::encodeEMSAPSS($message, 8 * $key->getModulusLength() - 1, Hash::$hash());
$message = BigInteger::createFromBinaryString($em);
$signature = RSAKey::exponentiate($key, $message);
retur... | php | public static function signWithPSS(RSAKey $key, string $message, string $hash): string
{
$em = self::encodeEMSAPSS($message, 8 * $key->getModulusLength() - 1, Hash::$hash());
$message = BigInteger::createFromBinaryString($em);
$signature = RSAKey::exponentiate($key, $message);
retur... | [
"public",
"static",
"function",
"signWithPSS",
"(",
"RSAKey",
"$",
"key",
",",
"string",
"$",
"message",
",",
"string",
"$",
"hash",
")",
":",
"string",
"{",
"$",
"em",
"=",
"self",
"::",
"encodeEMSAPSS",
"(",
"$",
"message",
",",
"8",
"*",
"$",
"key... | Create a signature. | [
"Create",
"a",
"signature",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L166-L173 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.signWithPKCS15 | public static function signWithPKCS15(RSAKey $key, string $message, string $hash): string
{
$em = self::encodeEMSA15($message, $key->getModulusLength(), Hash::$hash());
$message = BigInteger::createFromBinaryString($em);
$signature = RSAKey::exponentiate($key, $message);
return self... | php | public static function signWithPKCS15(RSAKey $key, string $message, string $hash): string
{
$em = self::encodeEMSA15($message, $key->getModulusLength(), Hash::$hash());
$message = BigInteger::createFromBinaryString($em);
$signature = RSAKey::exponentiate($key, $message);
return self... | [
"public",
"static",
"function",
"signWithPKCS15",
"(",
"RSAKey",
"$",
"key",
",",
"string",
"$",
"message",
",",
"string",
"$",
"hash",
")",
":",
"string",
"{",
"$",
"em",
"=",
"self",
"::",
"encodeEMSA15",
"(",
"$",
"message",
",",
"$",
"key",
"->",
... | Create a signature. | [
"Create",
"a",
"signature",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L178-L185 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.verifyWithPSS | public static function verifyWithPSS(RSAKey $key, string $message, string $signature, string $hash): bool
{
if (\mb_strlen($signature, '8bit') !== $key->getModulusLength()) {
throw new \InvalidArgumentException();
}
$s2 = BigInteger::createFromBinaryString($signature);
$m... | php | public static function verifyWithPSS(RSAKey $key, string $message, string $signature, string $hash): bool
{
if (\mb_strlen($signature, '8bit') !== $key->getModulusLength()) {
throw new \InvalidArgumentException();
}
$s2 = BigInteger::createFromBinaryString($signature);
$m... | [
"public",
"static",
"function",
"verifyWithPSS",
"(",
"RSAKey",
"$",
"key",
",",
"string",
"$",
"message",
",",
"string",
"$",
"signature",
",",
"string",
"$",
"hash",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"mb_strlen",
"(",
"$",
"signature",
",",
"'8... | Verifies a signature. | [
"Verifies",
"a",
"signature",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L202-L213 |
web-token/jwt-framework | src/Component/Signature/Util/RSA.php | RSA.verifyWithPKCS15 | public static function verifyWithPKCS15(RSAKey $key, string $message, string $signature, string $hash): bool
{
if (\mb_strlen($signature, '8bit') !== $key->getModulusLength()) {
throw new \InvalidArgumentException();
}
$signature = BigInteger::createFromBinaryString($signature);
... | php | public static function verifyWithPKCS15(RSAKey $key, string $message, string $signature, string $hash): bool
{
if (\mb_strlen($signature, '8bit') !== $key->getModulusLength()) {
throw new \InvalidArgumentException();
}
$signature = BigInteger::createFromBinaryString($signature);
... | [
"public",
"static",
"function",
"verifyWithPKCS15",
"(",
"RSAKey",
"$",
"key",
",",
"string",
"$",
"message",
",",
"string",
"$",
"signature",
",",
"string",
"$",
"hash",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"mb_strlen",
"(",
"$",
"signature",
",",
... | Verifies a signature. | [
"Verifies",
"a",
"signature",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Util/RSA.php#L218-L228 |
web-token/jwt-framework | src/Component/KeyManagement/KeyConverter/RSAKey.php | RSAKey.populateCRT | private function populateCRT()
{
if (!\array_key_exists('p', $this->values) && !\array_key_exists('q', $this->values)) {
$d = BigInteger::createFromBinaryString(Base64Url::decode($this->values['d']));
$e = BigInteger::createFromBinaryString(Base64Url::decode($this->values['e']));
... | php | private function populateCRT()
{
if (!\array_key_exists('p', $this->values) && !\array_key_exists('q', $this->values)) {
$d = BigInteger::createFromBinaryString(Base64Url::decode($this->values['d']));
$e = BigInteger::createFromBinaryString(Base64Url::decode($this->values['e']));
... | [
"private",
"function",
"populateCRT",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"'p'",
",",
"$",
"this",
"->",
"values",
")",
"&&",
"!",
"\\",
"array_key_exists",
"(",
"'q'",
",",
"$",
"this",
"->",
"values",
")",
")",
"{",
"$",
... | This method adds Chinese Remainder Theorem (CRT) parameters if primes 'p' and 'q' are available. | [
"This",
"method",
"adds",
"Chinese",
"Remainder",
"Theorem",
"(",
"CRT",
")",
"parameters",
"if",
"primes",
"p",
"and",
"q",
"are",
"available",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/KeyConverter/RSAKey.php#L153-L177 |
web-token/jwt-framework | src/Bundle/JoseFramework/Serializer/JWSEncoder.php | JWSEncoder.getSignatureIndex | protected function getSignatureIndex(array $context): int
{
$signatureIndex = 0;
if (isset($context['signature_index']) && \is_int($context['signature_index'])) {
$signatureIndex = $context['signature_index'];
}
return $signatureIndex;
} | php | protected function getSignatureIndex(array $context): int
{
$signatureIndex = 0;
if (isset($context['signature_index']) && \is_int($context['signature_index'])) {
$signatureIndex = $context['signature_index'];
}
return $signatureIndex;
} | [
"protected",
"function",
"getSignatureIndex",
"(",
"array",
"$",
"context",
")",
":",
"int",
"{",
"$",
"signatureIndex",
"=",
"0",
";",
"if",
"(",
"isset",
"(",
"$",
"context",
"[",
"'signature_index'",
"]",
")",
"&&",
"\\",
"is_int",
"(",
"$",
"context"... | Get JWS signature index from context. | [
"Get",
"JWS",
"signature",
"index",
"from",
"context",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Bundle/JoseFramework/Serializer/JWSEncoder.php#L84-L93 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.createFromKeyData | public static function createFromKeyData(array $data): self
{
if (!isset($data['keys'])) {
throw new InvalidArgumentException('Invalid data.');
}
if (!\is_array($data['keys'])) {
throw new InvalidArgumentException('Invalid data.');
}
$jwkset = new self... | php | public static function createFromKeyData(array $data): self
{
if (!isset($data['keys'])) {
throw new InvalidArgumentException('Invalid data.');
}
if (!\is_array($data['keys'])) {
throw new InvalidArgumentException('Invalid data.');
}
$jwkset = new self... | [
"public",
"static",
"function",
"createFromKeyData",
"(",
"array",
"$",
"data",
")",
":",
"self",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'keys'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid data.'",
")",
... | Creates a JWKSet object using the given values.
@return JWKSet | [
"Creates",
"a",
"JWKSet",
"object",
"using",
"the",
"given",
"values",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L50-L69 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.createFromJson | public static function createFromJson(string $json): self
{
$data = \json_decode($json, true);
if (!\is_array($data)) {
throw new InvalidArgumentException('Invalid argument.');
}
return self::createFromKeyData($data);
} | php | public static function createFromJson(string $json): self
{
$data = \json_decode($json, true);
if (!\is_array($data)) {
throw new InvalidArgumentException('Invalid argument.');
}
return self::createFromKeyData($data);
} | [
"public",
"static",
"function",
"createFromJson",
"(",
"string",
"$",
"json",
")",
":",
"self",
"{",
"$",
"data",
"=",
"\\",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
... | Creates a JWKSet object using the given Json string.
@return JWKSet | [
"Creates",
"a",
"JWKSet",
"object",
"using",
"the",
"given",
"Json",
"string",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L90-L98 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.with | public function with(JWK $jwk): self
{
$clone = clone $this;
if ($jwk->has('kid')) {
$clone->keys[$jwk->get('kid')] = $jwk;
} else {
$clone->keys[] = $jwk;
}
return $clone;
} | php | public function with(JWK $jwk): self
{
$clone = clone $this;
if ($jwk->has('kid')) {
$clone->keys[$jwk->get('kid')] = $jwk;
} else {
$clone->keys[] = $jwk;
}
return $clone;
} | [
"public",
"function",
"with",
"(",
"JWK",
"$",
"jwk",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"$",
"jwk",
"->",
"has",
"(",
"'kid'",
")",
")",
"{",
"$",
"clone",
"->",
"keys",
"[",
"$",
"jwk",
"->",
"ge... | Add key to store in the key set.
This method is immutable and will return a new object.
@return JWKSet | [
"Add",
"key",
"to",
"store",
"in",
"the",
"key",
"set",
".",
"This",
"method",
"is",
"immutable",
"and",
"will",
"return",
"a",
"new",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L116-L127 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.without | public function without($key): self
{
if (!$this->has($key)) {
return $this;
}
$clone = clone $this;
unset($clone->keys[$key]);
return $clone;
} | php | public function without($key): self
{
if (!$this->has($key)) {
return $this;
}
$clone = clone $this;
unset($clone->keys[$key]);
return $clone;
} | [
"public",
"function",
"without",
"(",
"$",
"key",
")",
":",
"self",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"unset",
"(",
"$... | Remove key from the key set.
This method is immutable and will return a new object.
@param int|string $key Key to remove from the key set
@return JWKSet | [
"Remove",
"key",
"from",
"the",
"key",
"set",
".",
"This",
"method",
"is",
"immutable",
"and",
"will",
"return",
"a",
"new",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L137-L147 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.get | public function get($index): JWK
{
if (!$this->has($index)) {
throw new InvalidArgumentException('Undefined index.');
}
return $this->keys[$index];
} | php | public function get($index): JWK
{
if (!$this->has($index)) {
throw new InvalidArgumentException('Undefined index.');
}
return $this->keys[$index];
} | [
"public",
"function",
"get",
"(",
"$",
"index",
")",
":",
"JWK",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"index",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Undefined index.'",
")",
";",
"}",
"return",
"$",
"th... | Returns the key with the given index. Throws an exception if the index is not present in the key store.
@param int|string $index | [
"Returns",
"the",
"key",
"with",
"the",
"given",
"index",
".",
"Throws",
"an",
"exception",
"if",
"the",
"index",
"is",
"not",
"present",
"in",
"the",
"key",
"store",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L164-L171 |
web-token/jwt-framework | src/Component/Core/JWKSet.php | JWKSet.selectKey | public function selectKey(string $type, ?Algorithm $algorithm = null, array $restrictions = []): ?JWK
{
if (!\in_array($type, ['enc', 'sig'], true)) {
throw new InvalidArgumentException('Allowed key types are "sig" or "enc".');
}
$result = [];
foreach ($this->keys as $ke... | php | public function selectKey(string $type, ?Algorithm $algorithm = null, array $restrictions = []): ?JWK
{
if (!\in_array($type, ['enc', 'sig'], true)) {
throw new InvalidArgumentException('Allowed key types are "sig" or "enc".');
}
$result = [];
foreach ($this->keys as $ke... | [
"public",
"function",
"selectKey",
"(",
"string",
"$",
"type",
",",
"?",
"Algorithm",
"$",
"algorithm",
"=",
"null",
",",
"array",
"$",
"restrictions",
"=",
"[",
"]",
")",
":",
"?",
"JWK",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"type",
",... | Try to find a key that fits on the selected requirements.
Returns null if not found.
@param string $type Must be 'sig' (signature) or 'enc' (encryption)
@param Algorithm|null $algorithm Specifies the algorithm to be used
@param array $restrictions More restrictions such as 'kid' or 'kty' | [
"Try",
"to",
"find",
"a",
"key",
"that",
"fits",
"on",
"the",
"selected",
"requirements",
".",
"Returns",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWKSet.php#L199-L235 |
web-token/jwt-framework | src/Component/Signature/JWSVerifier.php | JWSVerifier.verifyWithKey | public function verifyWithKey(JWS $jws, JWK $jwk, int $signature, ?string $detachedPayload = null): bool
{
$jwkset = new JWKSet([$jwk]);
return $this->verifyWithKeySet($jws, $jwkset, $signature, $detachedPayload);
} | php | public function verifyWithKey(JWS $jws, JWK $jwk, int $signature, ?string $detachedPayload = null): bool
{
$jwkset = new JWKSet([$jwk]);
return $this->verifyWithKeySet($jws, $jwkset, $signature, $detachedPayload);
} | [
"public",
"function",
"verifyWithKey",
"(",
"JWS",
"$",
"jws",
",",
"JWK",
"$",
"jwk",
",",
"int",
"$",
"signature",
",",
"?",
"string",
"$",
"detachedPayload",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"jwkset",
"=",
"new",
"JWKSet",
"(",
"[",
"$",
... | This method will try to verify the JWS object using the given key and for the given signature.
It returns true if the signature is verified, otherwise false.
@return bool true if the verification of the signature succeeded, else false | [
"This",
"method",
"will",
"try",
"to",
"verify",
"the",
"JWS",
"object",
"using",
"the",
"given",
"key",
"and",
"for",
"the",
"given",
"signature",
".",
"It",
"returns",
"true",
"if",
"the",
"signature",
"is",
"verified",
"otherwise",
"false",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSVerifier.php#L52-L57 |
web-token/jwt-framework | src/Component/Signature/JWSVerifier.php | JWSVerifier.verifyWithKeySet | public function verifyWithKeySet(JWS $jws, JWKSet $jwkset, int $signature, ?string $detachedPayload = null): bool
{
$this->checkJWKSet($jwkset);
$this->checkSignatures($jws);
$this->checkPayload($jws, $detachedPayload);
$signature = $jws->getSignature($signature);
return $t... | php | public function verifyWithKeySet(JWS $jws, JWKSet $jwkset, int $signature, ?string $detachedPayload = null): bool
{
$this->checkJWKSet($jwkset);
$this->checkSignatures($jws);
$this->checkPayload($jws, $detachedPayload);
$signature = $jws->getSignature($signature);
return $t... | [
"public",
"function",
"verifyWithKeySet",
"(",
"JWS",
"$",
"jws",
",",
"JWKSet",
"$",
"jwkset",
",",
"int",
"$",
"signature",
",",
"?",
"string",
"$",
"detachedPayload",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"checkJWKSet",
"(",
"$",
"j... | This method will try to verify the JWS object using the given key set and for the given signature.
It returns true if the signature is verified, otherwise false.
@param JWS $jws A JWS object
@param JWKSet $jwkset The signature will be verified using keys in the key set
@param string|n... | [
"This",
"method",
"will",
"try",
"to",
"verify",
"the",
"JWS",
"object",
"using",
"the",
"given",
"key",
"set",
"and",
"for",
"the",
"given",
"signature",
".",
"It",
"returns",
"true",
"if",
"the",
"signature",
"is",
"verified",
"otherwise",
"false",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSVerifier.php#L69-L78 |
web-token/jwt-framework | src/Component/Signature/JWSLoaderFactory.php | JWSLoaderFactory.create | public function create(array $serializers, array $algorithms, array $headerCheckers = []): JWSLoader
{
$serializerManager = $this->jwsSerializerManagerFactory->create($serializers);
$jwsVerifier = $this->jwsVerifierFactory->create($algorithms);
if (null !== $this->headerCheckerManagerFactory... | php | public function create(array $serializers, array $algorithms, array $headerCheckers = []): JWSLoader
{
$serializerManager = $this->jwsSerializerManagerFactory->create($serializers);
$jwsVerifier = $this->jwsVerifierFactory->create($algorithms);
if (null !== $this->headerCheckerManagerFactory... | [
"public",
"function",
"create",
"(",
"array",
"$",
"serializers",
",",
"array",
"$",
"algorithms",
",",
"array",
"$",
"headerCheckers",
"=",
"[",
"]",
")",
":",
"JWSLoader",
"{",
"$",
"serializerManager",
"=",
"$",
"this",
"->",
"jwsSerializerManagerFactory",
... | Creates a JWSLoader using the given serializer aliases, signature algorithm aliases and (optionally)
the header checker aliases. | [
"Creates",
"a",
"JWSLoader",
"using",
"the",
"given",
"serializer",
"aliases",
"signature",
"algorithm",
"aliases",
"and",
"(",
"optionally",
")",
"the",
"header",
"checker",
"aliases",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSLoaderFactory.php#L50-L61 |
web-token/jwt-framework | src/Component/Checker/HeaderCheckerManagerFactory.php | HeaderCheckerManagerFactory.create | public function create(array $aliases): HeaderCheckerManager
{
$checkers = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->checkers)) {
$checkers[] = $this->checkers[$alias];
} else {
throw new \InvalidArgumentException(... | php | public function create(array $aliases): HeaderCheckerManager
{
$checkers = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->checkers)) {
$checkers[] = $this->checkers[$alias];
} else {
throw new \InvalidArgumentException(... | [
"public",
"function",
"create",
"(",
"array",
"$",
"aliases",
")",
":",
"HeaderCheckerManager",
"{",
"$",
"checkers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"alia... | This method creates a Header Checker Manager and populate it with the header parameter checkers found based on the alias.
If the alias is not supported, an InvalidArgumentException is thrown.
@param string[] $aliases | [
"This",
"method",
"creates",
"a",
"Header",
"Checker",
"Manager",
"and",
"populate",
"it",
"with",
"the",
"header",
"parameter",
"checkers",
"found",
"based",
"on",
"the",
"alias",
".",
"If",
"the",
"alias",
"is",
"not",
"supported",
"an",
"InvalidArgumentExce... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/HeaderCheckerManagerFactory.php#L34-L46 |
web-token/jwt-framework | src/Component/Checker/HeaderCheckerManagerFactory.php | HeaderCheckerManagerFactory.add | public function add(string $alias, HeaderChecker $checker): self
{
$this->checkers[$alias] = $checker;
return $this;
} | php | public function add(string $alias, HeaderChecker $checker): self
{
$this->checkers[$alias] = $checker;
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"alias",
",",
"HeaderChecker",
"$",
"checker",
")",
":",
"self",
"{",
"$",
"this",
"->",
"checkers",
"[",
"$",
"alias",
"]",
"=",
"$",
"checker",
";",
"return",
"$",
"this",
";",
"}"
] | This method adds a header parameter checker to this factory.
The checker is uniquely identified by an alias. This allows the same header parameter checker to be added twice (or more)
using several configuration options.
@return HeaderCheckerManagerFactory | [
"This",
"method",
"adds",
"a",
"header",
"parameter",
"checker",
"to",
"this",
"factory",
".",
"The",
"checker",
"is",
"uniquely",
"identified",
"by",
"an",
"alias",
".",
"This",
"allows",
"the",
"same",
"header",
"parameter",
"checker",
"to",
"be",
"added",... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/HeaderCheckerManagerFactory.php#L55-L60 |
web-token/jwt-framework | src/Ecc/NistCurve.php | NistCurve.curve256 | public static function curve256(): Curve
{
$p = \gmp_init('ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', 16);
$a = \gmp_init('ffffffff00000001000000000000000000000000fffffffffffffffffffffffc', 16);
$b = \gmp_init('5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e2... | php | public static function curve256(): Curve
{
$p = \gmp_init('ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', 16);
$a = \gmp_init('ffffffff00000001000000000000000000000000fffffffffffffffffffffffc', 16);
$b = \gmp_init('5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e2... | [
"public",
"static",
"function",
"curve256",
"(",
")",
":",
"Curve",
"{",
"$",
"p",
"=",
"\\",
"gmp_init",
"(",
"'ffffffff00000001000000000000000000000000ffffffffffffffffffffffff'",
",",
"16",
")",
";",
"$",
"a",
"=",
"\\",
"gmp_init",
"(",
"'ffffffff00000001000000... | Returns an NIST P-256 curve. | [
"Returns",
"an",
"NIST",
"P",
"-",
"256",
"curve",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Ecc/NistCurve.php#L48-L59 |
web-token/jwt-framework | src/Component/Encryption/JWE.php | JWE.create | public static function create(string $ciphertext, string $iv, string $tag, ?string $aad = null, array $sharedHeader = [], array $sharedProtectedHeader = [], ?string $encodedSharedProtectedHeader = null, array $recipients = []): self
{
return new self($ciphertext, $iv, $tag, $aad, $sharedHeader, $sharedProte... | php | public static function create(string $ciphertext, string $iv, string $tag, ?string $aad = null, array $sharedHeader = [], array $sharedProtectedHeader = [], ?string $encodedSharedProtectedHeader = null, array $recipients = []): self
{
return new self($ciphertext, $iv, $tag, $aad, $sharedHeader, $sharedProte... | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"ciphertext",
",",
"string",
"$",
"iv",
",",
"string",
"$",
"tag",
",",
"?",
"string",
"$",
"aad",
"=",
"null",
",",
"array",
"$",
"sharedHeader",
"=",
"[",
"]",
",",
"array",
"$",
"shared... | Creates a new JWE object.
@return JWE | [
"Creates",
"a",
"new",
"JWE",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWE.php#L85-L88 |
web-token/jwt-framework | src/Component/Encryption/JWE.php | JWE.getRecipient | public function getRecipient(int $id): Recipient
{
if (!\array_key_exists($id, $this->recipients)) {
throw new \InvalidArgumentException('The recipient does not exist.');
}
return $this->recipients[$id];
} | php | public function getRecipient(int $id): Recipient
{
if (!\array_key_exists($id, $this->recipients)) {
throw new \InvalidArgumentException('The recipient does not exist.');
}
return $this->recipients[$id];
} | [
"public",
"function",
"getRecipient",
"(",
"int",
"$",
"id",
")",
":",
"Recipient",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"recipients",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",... | Returns the recipient object at the given index. | [
"Returns",
"the",
"recipient",
"object",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWE.php#L138-L145 |
web-token/jwt-framework | src/Component/Encryption/JWE.php | JWE.getSharedProtectedHeaderParameter | public function getSharedProtectedHeaderParameter(string $key)
{
if ($this->hasSharedProtectedHeaderParameter($key)) {
return $this->sharedProtectedHeader[$key];
}
throw new \InvalidArgumentException(\sprintf('The shared protected header "%s" does not exist.', $key));
} | php | public function getSharedProtectedHeaderParameter(string $key)
{
if ($this->hasSharedProtectedHeaderParameter($key)) {
return $this->sharedProtectedHeader[$key];
}
throw new \InvalidArgumentException(\sprintf('The shared protected header "%s" does not exist.', $key));
} | [
"public",
"function",
"getSharedProtectedHeaderParameter",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasSharedProtectedHeaderParameter",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sharedProtectedHeader",
"[",
"$",
"... | Returns the shared protected header parameter identified by the given key.
Throws an exception is the the parameter is not available.
@param string $key The key
@return mixed|null | [
"Returns",
"the",
"shared",
"protected",
"header",
"parameter",
"identified",
"by",
"the",
"given",
"key",
".",
"Throws",
"an",
"exception",
"is",
"the",
"the",
"parameter",
"is",
"not",
"available",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWE.php#L205-L212 |
web-token/jwt-framework | src/Component/Encryption/JWE.php | JWE.getSharedHeaderParameter | public function getSharedHeaderParameter(string $key)
{
if ($this->hasSharedHeaderParameter($key)) {
return $this->sharedHeader[$key];
}
throw new \InvalidArgumentException(\sprintf('The shared header "%s" does not exist.', $key));
} | php | public function getSharedHeaderParameter(string $key)
{
if ($this->hasSharedHeaderParameter($key)) {
return $this->sharedHeader[$key];
}
throw new \InvalidArgumentException(\sprintf('The shared header "%s" does not exist.', $key));
} | [
"public",
"function",
"getSharedHeaderParameter",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasSharedHeaderParameter",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sharedHeader",
"[",
"$",
"key",
"]",
";",
"}",
... | Returns the shared header parameter identified by the given key.
Throws an exception is the the parameter is not available.
@param string $key The key
@return mixed|null | [
"Returns",
"the",
"shared",
"header",
"parameter",
"identified",
"by",
"the",
"given",
"key",
".",
"Throws",
"an",
"exception",
"is",
"the",
"the",
"parameter",
"is",
"not",
"available",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWE.php#L240-L247 |
web-token/jwt-framework | src/Component/Encryption/JWE.php | JWE.split | public function split(): array
{
$result = [];
foreach ($this->recipients as $recipient) {
$result[] = self::create(
$this->ciphertext,
$this->iv,
$this->tag,
$this->aad,
$this->sharedHeader,
... | php | public function split(): array
{
$result = [];
foreach ($this->recipients as $recipient) {
$result[] = self::create(
$this->ciphertext,
$this->iv,
$this->tag,
$this->aad,
$this->sharedHeader,
... | [
"public",
"function",
"split",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"recipients",
"as",
"$",
"recipient",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"self",
"::",
"create",
"(",
"$",
"thi... | This method splits the JWE into a list of JWEs.
It is only useful when the JWE contains more than one recipient (JSON General Serialization).
@return JWE[] | [
"This",
"method",
"splits",
"the",
"JWE",
"into",
"a",
"list",
"of",
"JWEs",
".",
"It",
"is",
"only",
"useful",
"when",
"the",
"JWE",
"contains",
"more",
"than",
"one",
"recipient",
"(",
"JSON",
"General",
"Serialization",
")",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWE.php#L265-L282 |
web-token/jwt-framework | src/Component/Encryption/JWELoader.php | JWELoader.loadAndDecryptWithKeySet | public function loadAndDecryptWithKeySet(string $token, JWKSet $keyset, ?int &$recipient): JWE
{
try {
$jwe = $this->serializerManager->unserialize($token);
$nbRecipients = $jwe->countRecipients();
for ($i = 0; $i < $nbRecipients; ++$i) {
if ($this->proces... | php | public function loadAndDecryptWithKeySet(string $token, JWKSet $keyset, ?int &$recipient): JWE
{
try {
$jwe = $this->serializerManager->unserialize($token);
$nbRecipients = $jwe->countRecipients();
for ($i = 0; $i < $nbRecipients; ++$i) {
if ($this->proces... | [
"public",
"function",
"loadAndDecryptWithKeySet",
"(",
"string",
"$",
"token",
",",
"JWKSet",
"$",
"keyset",
",",
"?",
"int",
"&",
"$",
"recipient",
")",
":",
"JWE",
"{",
"try",
"{",
"$",
"jwe",
"=",
"$",
"this",
"->",
"serializerManager",
"->",
"unseria... | This method will try to load and decrypt the given token using a JWKSet.
If succeeded, the methods will populate the $recipient variable and returns the JWE.
@throws \Exception | [
"This",
"method",
"will",
"try",
"to",
"load",
"and",
"decrypt",
"the",
"given",
"token",
"using",
"a",
"JWKSet",
".",
"If",
"succeeded",
"the",
"methods",
"will",
"populate",
"the",
"$recipient",
"variable",
"and",
"returns",
"the",
"JWE",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWELoader.php#L91-L108 |
web-token/jwt-framework | src/Component/Signature/JWSLoader.php | JWSLoader.loadAndVerifyWithKeySet | public function loadAndVerifyWithKeySet(string $token, JWKSet $keyset, ?int &$signature, ?string $payload = null): JWS
{
try {
$jws = $this->serializerManager->unserialize($token);
$nbSignatures = $jws->countSignatures();
for ($i = 0; $i < $nbSignatures; ++$i) {
... | php | public function loadAndVerifyWithKeySet(string $token, JWKSet $keyset, ?int &$signature, ?string $payload = null): JWS
{
try {
$jws = $this->serializerManager->unserialize($token);
$nbSignatures = $jws->countSignatures();
for ($i = 0; $i < $nbSignatures; ++$i) {
... | [
"public",
"function",
"loadAndVerifyWithKeySet",
"(",
"string",
"$",
"token",
",",
"JWKSet",
"$",
"keyset",
",",
"?",
"int",
"&",
"$",
"signature",
",",
"?",
"string",
"$",
"payload",
"=",
"null",
")",
":",
"JWS",
"{",
"try",
"{",
"$",
"jws",
"=",
"$... | This method will try to load and verify the token using the given key set.
It returns a JWS and will populate the $signature variable in case of success, otherwise an exception is thrown.
@throws \Exception | [
"This",
"method",
"will",
"try",
"to",
"load",
"and",
"verify",
"the",
"token",
"using",
"the",
"given",
"key",
"set",
".",
"It",
"returns",
"a",
"JWS",
"and",
"will",
"populate",
"the",
"$signature",
"variable",
"in",
"case",
"of",
"success",
"otherwise",... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSLoader.php#L91-L108 |
web-token/jwt-framework | src/Component/Encryption/Compression/CompressionMethodManagerFactory.php | CompressionMethodManagerFactory.add | public function add(string $alias, CompressionMethod $compressionMethod): self
{
if (\array_key_exists($alias, $this->compressionMethods)) {
throw new \InvalidArgumentException(\sprintf('The alias "%s" already exists.', $alias));
}
$this->compressionMethods[$alias] = $compression... | php | public function add(string $alias, CompressionMethod $compressionMethod): self
{
if (\array_key_exists($alias, $this->compressionMethods)) {
throw new \InvalidArgumentException(\sprintf('The alias "%s" already exists.', $alias));
}
$this->compressionMethods[$alias] = $compression... | [
"public",
"function",
"add",
"(",
"string",
"$",
"alias",
",",
"CompressionMethod",
"$",
"compressionMethod",
")",
":",
"self",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"alias",
",",
"$",
"this",
"->",
"compressionMethods",
")",
")",
"{",
"throw... | This method adds a compression method to this factory.
The method is uniquely identified by an alias. This allows the same method to be added twice (or more)
using several configuration options.
@return CompressionMethodManagerFactory | [
"This",
"method",
"adds",
"a",
"compression",
"method",
"to",
"this",
"factory",
".",
"The",
"method",
"is",
"uniquely",
"identified",
"by",
"an",
"alias",
".",
"This",
"allows",
"the",
"same",
"method",
"to",
"be",
"added",
"twice",
"(",
"or",
"more",
"... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Compression/CompressionMethodManagerFactory.php#L30-L38 |
web-token/jwt-framework | src/Component/Encryption/Compression/CompressionMethodManagerFactory.php | CompressionMethodManagerFactory.create | public function create(array $aliases): CompressionMethodManager
{
$compressionMethods = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->compressionMethods)) {
$compressionMethods[] = $this->compressionMethods[$alias];
} else {
... | php | public function create(array $aliases): CompressionMethodManager
{
$compressionMethods = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->compressionMethods)) {
$compressionMethods[] = $this->compressionMethods[$alias];
} else {
... | [
"public",
"function",
"create",
"(",
"array",
"$",
"aliases",
")",
":",
"CompressionMethodManager",
"{",
"$",
"compressionMethods",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
... | Creates a compression method manager using the compression methods identified by the given aliases.
If one of the aliases does not exist, an exception is thrown.
@param string[] $aliases | [
"Creates",
"a",
"compression",
"method",
"manager",
"using",
"the",
"compression",
"methods",
"identified",
"by",
"the",
"given",
"aliases",
".",
"If",
"one",
"of",
"the",
"aliases",
"does",
"not",
"exist",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Compression/CompressionMethodManagerFactory.php#L66-L78 |
web-token/jwt-framework | src/Component/Signature/JWSBuilderFactory.php | JWSBuilderFactory.create | public function create(array $algorithms): JWSBuilder
{
$algorithmManager = $this->signatureAlgorithmManagerFactory->create($algorithms);
return new JWSBuilder($this->jsonConverter, $algorithmManager);
} | php | public function create(array $algorithms): JWSBuilder
{
$algorithmManager = $this->signatureAlgorithmManagerFactory->create($algorithms);
return new JWSBuilder($this->jsonConverter, $algorithmManager);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"algorithms",
")",
":",
"JWSBuilder",
"{",
"$",
"algorithmManager",
"=",
"$",
"this",
"->",
"signatureAlgorithmManagerFactory",
"->",
"create",
"(",
"$",
"algorithms",
")",
";",
"return",
"new",
"JWSBuilder",
... | This method creates a JWSBuilder using the given algorithm aliases.
@param string[] $algorithms | [
"This",
"method",
"creates",
"a",
"JWSBuilder",
"using",
"the",
"given",
"algorithm",
"aliases",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSBuilderFactory.php#L45-L50 |
web-token/jwt-framework | src/Component/Checker/ClaimCheckerManagerFactory.php | ClaimCheckerManagerFactory.create | public function create(array $aliases): ClaimCheckerManager
{
$checkers = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->checkers)) {
$checkers[] = $this->checkers[$alias];
} else {
throw new \InvalidArgumentException(\... | php | public function create(array $aliases): ClaimCheckerManager
{
$checkers = [];
foreach ($aliases as $alias) {
if (\array_key_exists($alias, $this->checkers)) {
$checkers[] = $this->checkers[$alias];
} else {
throw new \InvalidArgumentException(\... | [
"public",
"function",
"create",
"(",
"array",
"$",
"aliases",
")",
":",
"ClaimCheckerManager",
"{",
"$",
"checkers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
")",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"alias... | This method creates a Claim Checker Manager and populate it with the claim checkers found based on the alias.
If the alias is not supported, an InvalidArgumentException is thrown.
@param string[] $aliases | [
"This",
"method",
"creates",
"a",
"Claim",
"Checker",
"Manager",
"and",
"populate",
"it",
"with",
"the",
"claim",
"checkers",
"found",
"based",
"on",
"the",
"alias",
".",
"If",
"the",
"alias",
"is",
"not",
"supported",
"an",
"InvalidArgumentException",
"is",
... | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/ClaimCheckerManagerFactory.php#L29-L41 |
web-token/jwt-framework | src/Component/Checker/ClaimCheckerManagerFactory.php | ClaimCheckerManagerFactory.add | public function add(string $alias, ClaimChecker $checker): self
{
$this->checkers[$alias] = $checker;
return $this;
} | php | public function add(string $alias, ClaimChecker $checker): self
{
$this->checkers[$alias] = $checker;
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"alias",
",",
"ClaimChecker",
"$",
"checker",
")",
":",
"self",
"{",
"$",
"this",
"->",
"checkers",
"[",
"$",
"alias",
"]",
"=",
"$",
"checker",
";",
"return",
"$",
"this",
";",
"}"
] | This method adds a claim checker to this factory.
@return ClaimCheckerManagerFactory | [
"This",
"method",
"adds",
"a",
"claim",
"checker",
"to",
"this",
"factory",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Checker/ClaimCheckerManagerFactory.php#L48-L53 |
web-token/jwt-framework | src/Component/Signature/JWSVerifierFactory.php | JWSVerifierFactory.create | public function create(array $algorithms): JWSVerifier
{
$algorithmManager = $this->algorithmManagerFactory->create($algorithms);
return new JWSVerifier($algorithmManager);
} | php | public function create(array $algorithms): JWSVerifier
{
$algorithmManager = $this->algorithmManagerFactory->create($algorithms);
return new JWSVerifier($algorithmManager);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"algorithms",
")",
":",
"JWSVerifier",
"{",
"$",
"algorithmManager",
"=",
"$",
"this",
"->",
"algorithmManagerFactory",
"->",
"create",
"(",
"$",
"algorithms",
")",
";",
"return",
"new",
"JWSVerifier",
"(",
... | Creates a JWSVerifier using the given signature algorithm aliases.
@param string[] $algorithms | [
"Creates",
"a",
"JWSVerifier",
"using",
"the",
"given",
"signature",
"algorithm",
"aliases",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSVerifierFactory.php#L38-L43 |
web-token/jwt-framework | src/Component/Signature/Serializer/JWSSerializerManager.php | JWSSerializerManager.serialize | public function serialize(string $name, JWS $jws, ?int $signatureIndex = null): string
{
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
return ($this->serializers[$name])->serialize($jw... | php | public function serialize(string $name, JWS $jws, ?int $signatureIndex = null): string
{
if (!\array_key_exists($name, $this->serializers)) {
throw new \InvalidArgumentException(\sprintf('Unsupported serializer "%s".', $name));
}
return ($this->serializers[$name])->serialize($jw... | [
"public",
"function",
"serialize",
"(",
"string",
"$",
"name",
",",
"JWS",
"$",
"jws",
",",
"?",
"int",
"$",
"signatureIndex",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
... | Converts a JWS into a string.
@throws \Exception | [
"Converts",
"a",
"JWS",
"into",
"a",
"string",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Serializer/JWSSerializerManager.php#L70-L77 |
web-token/jwt-framework | src/Component/Core/JWK.php | JWK.get | public function get(string $key)
{
if (!$this->has($key)) {
throw new \InvalidArgumentException(\sprintf('The value identified by "%s" does not exist.', $key));
}
return $this->values[$key];
} | php | public function get(string $key)
{
if (!$this->has($key)) {
throw new \InvalidArgumentException(\sprintf('The value identified by "%s" does not exist.', $key));
}
return $this->values[$key];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\\",
"sprintf",
"(",
"'The value identified by \"%s\" does n... | Get the value with a specific key.
@param string $key The key
@throws \InvalidArgumentException
@return mixed|null | [
"Get",
"the",
"value",
"with",
"a",
"specific",
"key",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWK.php#L82-L89 |
web-token/jwt-framework | src/Component/Core/JWK.php | JWK.thumbprint | public function thumbprint(string $hash_algorithm): string
{
if (!\in_array($hash_algorithm, \hash_algos(), true)) {
throw new \InvalidArgumentException(\sprintf('The hash algorithm "%s" is not supported.', $hash_algorithm));
}
$values = \array_intersect_key($this->values, \arra... | php | public function thumbprint(string $hash_algorithm): string
{
if (!\in_array($hash_algorithm, \hash_algos(), true)) {
throw new \InvalidArgumentException(\sprintf('The hash algorithm "%s" is not supported.', $hash_algorithm));
}
$values = \array_intersect_key($this->values, \arra... | [
"public",
"function",
"thumbprint",
"(",
"string",
"$",
"hash_algorithm",
")",
":",
"string",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"hash_algorithm",
",",
"\\",
"hash_algos",
"(",
")",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"Inval... | Returns the thumbprint of the key.
@see https://tools.ietf.org/html/rfc7638
@throws \InvalidArgumentException | [
"Returns",
"the",
"thumbprint",
"of",
"the",
"key",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Core/JWK.php#L118-L129 |
web-token/jwt-framework | src/Component/Signature/JWSBuilder.php | JWSBuilder.create | public function create(): self
{
$this->payload = null;
$this->isPayloadDetached = false;
$this->signatures = [];
$this->isPayloadEncoded = null;
return $this;
} | php | public function create(): self
{
$this->payload = null;
$this->isPayloadDetached = false;
$this->signatures = [];
$this->isPayloadEncoded = null;
return $this;
} | [
"public",
"function",
"create",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"payload",
"=",
"null",
";",
"$",
"this",
"->",
"isPayloadDetached",
"=",
"false",
";",
"$",
"this",
"->",
"signatures",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"isPayloadE... | Reset the current data.
@return JWSBuilder | [
"Reset",
"the",
"current",
"data",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSBuilder.php#L77-L85 |
web-token/jwt-framework | src/Component/Signature/JWSBuilder.php | JWSBuilder.withPayload | public function withPayload(string $payload, bool $isPayloadDetached = false): self
{
if (false === \mb_detect_encoding($payload, 'UTF-8', true)) {
throw new \InvalidArgumentException('The payload must be encoded in UTF-8');
}
$clone = clone $this;
$clone->payload = $payl... | php | public function withPayload(string $payload, bool $isPayloadDetached = false): self
{
if (false === \mb_detect_encoding($payload, 'UTF-8', true)) {
throw new \InvalidArgumentException('The payload must be encoded in UTF-8');
}
$clone = clone $this;
$clone->payload = $payl... | [
"public",
"function",
"withPayload",
"(",
"string",
"$",
"payload",
",",
"bool",
"$",
"isPayloadDetached",
"=",
"false",
")",
":",
"self",
"{",
"if",
"(",
"false",
"===",
"\\",
"mb_detect_encoding",
"(",
"$",
"payload",
",",
"'UTF-8'",
",",
"true",
")",
... | Set the payload.
This method will return a new JWSBuilder object.
@return JWSBuilder | [
"Set",
"the",
"payload",
".",
"This",
"method",
"will",
"return",
"a",
"new",
"JWSBuilder",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSBuilder.php#L93-L103 |
web-token/jwt-framework | src/Component/Signature/JWSBuilder.php | JWSBuilder.addSignature | public function addSignature(JWK $signatureKey, array $protectedHeader, array $header = []): self
{
$this->checkB64AndCriticalHeader($protectedHeader);
$isPayloadEncoded = $this->checkIfPayloadIsEncoded($protectedHeader);
if (null === $this->isPayloadEncoded) {
$this->isPayloadEn... | php | public function addSignature(JWK $signatureKey, array $protectedHeader, array $header = []): self
{
$this->checkB64AndCriticalHeader($protectedHeader);
$isPayloadEncoded = $this->checkIfPayloadIsEncoded($protectedHeader);
if (null === $this->isPayloadEncoded) {
$this->isPayloadEn... | [
"public",
"function",
"addSignature",
"(",
"JWK",
"$",
"signatureKey",
",",
"array",
"$",
"protectedHeader",
",",
"array",
"$",
"header",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"this",
"->",
"checkB64AndCriticalHeader",
"(",
"$",
"protectedHeader",
")",
... | Adds the information needed to compute the signature.
This method will return a new JWSBuilder object.
@return JWSBuilder | [
"Adds",
"the",
"information",
"needed",
"to",
"compute",
"the",
"signature",
".",
"This",
"method",
"will",
"return",
"a",
"new",
"JWSBuilder",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSBuilder.php#L111-L133 |
web-token/jwt-framework | src/Component/Signature/JWSBuilder.php | JWSBuilder.build | public function build(): JWS
{
if (null === $this->payload) {
throw new \RuntimeException('The payload is not set.');
}
if (0 === \count($this->signatures)) {
throw new \RuntimeException('At least one signature must be set.');
}
$encodedPayload = fals... | php | public function build(): JWS
{
if (null === $this->payload) {
throw new \RuntimeException('The payload is not set.');
}
if (0 === \count($this->signatures)) {
throw new \RuntimeException('At least one signature must be set.');
}
$encodedPayload = fals... | [
"public",
"function",
"build",
"(",
")",
":",
"JWS",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"payload",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The payload is not set.'",
")",
";",
"}",
"if",
"(",
"0",
"===",
"\\",
"count",... | Computes all signatures and return the expected JWS object. | [
"Computes",
"all",
"signatures",
"and",
"return",
"the",
"expected",
"JWS",
"object",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/JWSBuilder.php#L138-L165 |
web-token/jwt-framework | src/Component/Encryption/NestedTokenBuilder.php | NestedTokenBuilder.create | public function create(string $payload, array $signatures, string $jws_serialization_mode, array $jweSharedProtectedHeader, array $jweSharedHeader, array $recipients, string $jwe_serialization_mode, ?string $aad = null): string
{
$jws = $this->jwsBuilder->create()->withPayload($payload);
foreach ($s... | php | public function create(string $payload, array $signatures, string $jws_serialization_mode, array $jweSharedProtectedHeader, array $jweSharedHeader, array $recipients, string $jwe_serialization_mode, ?string $aad = null): string
{
$jws = $this->jwsBuilder->create()->withPayload($payload);
foreach ($s... | [
"public",
"function",
"create",
"(",
"string",
"$",
"payload",
",",
"array",
"$",
"signatures",
",",
"string",
"$",
"jws_serialization_mode",
",",
"array",
"$",
"jweSharedProtectedHeader",
",",
"array",
"$",
"jweSharedHeader",
",",
"array",
"$",
"recipients",
",... | Creates a nested token.
@param array[] $signatures
@param array[] $recipients
@throws \Exception | [
"Creates",
"a",
"nested",
"token",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/NestedTokenBuilder.php#L61-L94 |
web-token/jwt-framework | src/Component/KeyManagement/KeyAnalyzer/KeyAnalyzerManager.php | KeyAnalyzerManager.analyze | public function analyze(JWK $jwk): MessageBag
{
$bag = new MessageBag();
foreach ($this->analyzers as $analyzer) {
$analyzer->analyze($jwk, $bag);
}
return $bag;
} | php | public function analyze(JWK $jwk): MessageBag
{
$bag = new MessageBag();
foreach ($this->analyzers as $analyzer) {
$analyzer->analyze($jwk, $bag);
}
return $bag;
} | [
"public",
"function",
"analyze",
"(",
"JWK",
"$",
"jwk",
")",
":",
"MessageBag",
"{",
"$",
"bag",
"=",
"new",
"MessageBag",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"analyzers",
"as",
"$",
"analyzer",
")",
"{",
"$",
"analyzer",
"->",
"analyz... | This method will analyze the JWK object using all analyzers.
It returns a message bag that may contains messages. | [
"This",
"method",
"will",
"analyze",
"the",
"JWK",
"object",
"using",
"all",
"analyzers",
".",
"It",
"returns",
"a",
"message",
"bag",
"that",
"may",
"contains",
"messages",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/KeyManagement/KeyAnalyzer/KeyAnalyzerManager.php#L41-L49 |
web-token/jwt-framework | src/Component/Encryption/JWELoaderFactory.php | JWELoaderFactory.create | public function create(array $serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods, array $headerCheckers = []): JWELoader
{
$serializerManager = $this->jweSerializerManagerFactory->create($serializers);
$jweDecrypter = $this->jweDecrypterFactory... | php | public function create(array $serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods, array $headerCheckers = []): JWELoader
{
$serializerManager = $this->jweSerializerManagerFactory->create($serializers);
$jweDecrypter = $this->jweDecrypterFactory... | [
"public",
"function",
"create",
"(",
"array",
"$",
"serializers",
",",
"array",
"$",
"keyEncryptionAlgorithms",
",",
"array",
"$",
"contentEncryptionAlgorithms",
",",
"array",
"$",
"compressionMethods",
",",
"array",
"$",
"headerCheckers",
"=",
"[",
"]",
")",
":... | Creates a JWELoader using the given serializer aliases, encryption algorithm aliases, compression method aliases
and header checker aliases. | [
"Creates",
"a",
"JWELoader",
"using",
"the",
"given",
"serializer",
"aliases",
"encryption",
"algorithm",
"aliases",
"compression",
"method",
"aliases",
"and",
"header",
"checker",
"aliases",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/JWELoaderFactory.php#L50-L61 |
web-token/jwt-framework | src/Component/Encryption/Compression/CompressionMethodManager.php | CompressionMethodManager.create | public static function create(array $methods): self
{
$manager = new self();
foreach ($methods as $method) {
$manager->add($method);
}
return $manager;
} | php | public static function create(array $methods): self
{
$manager = new self();
foreach ($methods as $method) {
$manager->add($method);
}
return $manager;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"methods",
")",
":",
"self",
"{",
"$",
"manager",
"=",
"new",
"self",
"(",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"$",
"manager",
"->",
"add",
"(",
"$",
... | This method creates a Compression Manager with the selected compression methods.
@param CompressionMethod[] $methods
@return CompressionMethodManager | [
"This",
"method",
"creates",
"a",
"Compression",
"Manager",
"with",
"the",
"selected",
"compression",
"methods",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Compression/CompressionMethodManager.php#L39-L47 |
web-token/jwt-framework | src/Component/Encryption/Compression/CompressionMethodManager.php | CompressionMethodManager.add | protected function add(CompressionMethod $compressionMethod)
{
$name = $compressionMethod->name();
if ($this->has($name)) {
throw new \InvalidArgumentException(\sprintf('The compression method "%s" is already supported.', $name));
}
$this->compressionMethods[$name] = $co... | php | protected function add(CompressionMethod $compressionMethod)
{
$name = $compressionMethod->name();
if ($this->has($name)) {
throw new \InvalidArgumentException(\sprintf('The compression method "%s" is already supported.', $name));
}
$this->compressionMethods[$name] = $co... | [
"protected",
"function",
"add",
"(",
"CompressionMethod",
"$",
"compressionMethod",
")",
"{",
"$",
"name",
"=",
"$",
"compressionMethod",
"->",
"name",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",... | Add the given compression method to the manager. | [
"Add",
"the",
"given",
"compression",
"method",
"to",
"the",
"manager",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Compression/CompressionMethodManager.php#L52-L60 |
web-token/jwt-framework | src/Component/Encryption/Compression/CompressionMethodManager.php | CompressionMethodManager.get | public function get(string $name): CompressionMethod
{
if (!$this->has($name)) {
throw new \InvalidArgumentException(\sprintf('The compression method "%s" is not supported.', $name));
}
return $this->compressionMethods[$name];
} | php | public function get(string $name): CompressionMethod
{
if (!$this->has($name)) {
throw new \InvalidArgumentException(\sprintf('The compression method "%s" is not supported.', $name));
}
return $this->compressionMethods[$name];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
")",
":",
"CompressionMethod",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\\",
"sprintf",
"(",
"'The c... | This method returns the compression method with the given name.
Throws an exception if the method is not supported.
@param string $name The name of the compression method | [
"This",
"method",
"returns",
"the",
"compression",
"method",
"with",
"the",
"given",
"name",
".",
"Throws",
"an",
"exception",
"if",
"the",
"method",
"is",
"not",
"supported",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Encryption/Compression/CompressionMethodManager.php#L76-L83 |
web-token/jwt-framework | src/Bundle/JoseFramework/Serializer/JWEEncoder.php | JWEEncoder.getRecipientIndex | protected function getRecipientIndex(array $context): int
{
$recipientIndex = 0;
if (isset($context['recipient_index']) && \is_int($context['recipient_index'])) {
$recipientIndex = $context['recipient_index'];
}
return $recipientIndex;
} | php | protected function getRecipientIndex(array $context): int
{
$recipientIndex = 0;
if (isset($context['recipient_index']) && \is_int($context['recipient_index'])) {
$recipientIndex = $context['recipient_index'];
}
return $recipientIndex;
} | [
"protected",
"function",
"getRecipientIndex",
"(",
"array",
"$",
"context",
")",
":",
"int",
"{",
"$",
"recipientIndex",
"=",
"0",
";",
"if",
"(",
"isset",
"(",
"$",
"context",
"[",
"'recipient_index'",
"]",
")",
"&&",
"\\",
"is_int",
"(",
"$",
"context"... | Get JWE recipient index from context. | [
"Get",
"JWE",
"recipient",
"index",
"from",
"context",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Bundle/JoseFramework/Serializer/JWEEncoder.php#L84-L93 |
web-token/jwt-framework | src/Component/Signature/Signature.php | Signature.create | public static function create(string $signature, array $protectedHeader, ?string $encodedProtectedHeader, array $header = []): self
{
return new self($signature, $protectedHeader, $encodedProtectedHeader, $header);
} | php | public static function create(string $signature, array $protectedHeader, ?string $encodedProtectedHeader, array $header = []): self
{
return new self($signature, $protectedHeader, $encodedProtectedHeader, $header);
} | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"signature",
",",
"array",
"$",
"protectedHeader",
",",
"?",
"string",
"$",
"encodedProtectedHeader",
",",
"array",
"$",
"header",
"=",
"[",
"]",
")",
":",
"self",
"{",
"return",
"new",
"self",
... | Creates a new signature.
@internal
@return Signature | [
"Creates",
"a",
"new",
"signature",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Signature.php#L56-L59 |
web-token/jwt-framework | src/Component/Signature/Signature.php | Signature.getProtectedHeaderParameter | public function getProtectedHeaderParameter(string $key)
{
if ($this->hasProtectedHeaderParameter($key)) {
return $this->getProtectedHeader()[$key];
}
throw new \InvalidArgumentException(\sprintf('The protected header "%s" does not exist', $key));
} | php | public function getProtectedHeaderParameter(string $key)
{
if ($this->hasProtectedHeaderParameter($key)) {
return $this->getProtectedHeader()[$key];
}
throw new \InvalidArgumentException(\sprintf('The protected header "%s" does not exist', $key));
} | [
"public",
"function",
"getProtectedHeaderParameter",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasProtectedHeaderParameter",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getProtectedHeader",
"(",
")",
"[",
"$",
"k... | Returns the value of the protected header of the specified key.
@param string $key The key
@return mixed|null Header value | [
"Returns",
"the",
"value",
"of",
"the",
"protected",
"header",
"of",
"the",
"specified",
"key",
"."
] | train | https://github.com/web-token/jwt-framework/blob/b819220dbcb71dc40f3d1ffc076eec0636536fb7/src/Component/Signature/Signature.php#L92-L99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.