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 |
|---|---|---|---|---|---|---|---|---|---|---|
beyondcode/laravel-self-diagnosis | src/Checks/StorageDirectoryIsLinked.php | StorageDirectoryIsLinked.check | public function check(array $config): bool
{
try {
return $this->filesystem->isDirectory(public_path('storage'));
} catch (\Exception $e) {
return false;
}
} | php | public function check(array $config): bool
{
try {
return $this->filesystem->isDirectory(public_path('storage'));
} catch (\Exception $e) {
return false;
}
} | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"filesystem",
"->",
"isDirectory",
"(",
"public_path",
"(",
"'storage'",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/StorageDirectoryIsLinked.php#L45-L52 |
beyondcode/laravel-self-diagnosis | src/Checks/PhpExtensionsAreDisabled.php | PhpExtensionsAreDisabled.check | public function check(array $config): bool
{
$this->extensions = Collection::make(Arr::get($config, 'extensions', []));
$this->extensions = $this->extensions->reject(function ($ext) {
return extension_loaded($ext) === false;
});
return $this->extensions->isEmpty();
} | php | public function check(array $config): bool
{
$this->extensions = Collection::make(Arr::get($config, 'extensions', []));
$this->extensions = $this->extensions->reject(function ($ext) {
return extension_loaded($ext) === false;
});
return $this->extensions->isEmpty();
} | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"extensions",
"=",
"Collection",
"::",
"make",
"(",
"Arr",
"::",
"get",
"(",
"$",
"config",
",",
"'extensions'",
",",
"[",
"]",
")",
")",
";",
"$"... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/PhpExtensionsAreDisabled.php#L31-L39 |
beyondcode/laravel-self-diagnosis | src/SelfDiagnosisServiceProvider.php | SelfDiagnosisServiceProvider.boot | public function boot()
{
if ($this->app->runningInConsole()) {
$this->loadTranslationsFrom(__DIR__.'/../translations', 'self-diagnosis');
$this->publishes([
__DIR__.'/../translations' => resource_path('lang/vendor/self-diagnosis'),
], 'translations');
... | php | public function boot()
{
if ($this->app->runningInConsole()) {
$this->loadTranslationsFrom(__DIR__.'/../translations', 'self-diagnosis');
$this->publishes([
__DIR__.'/../translations' => resource_path('lang/vendor/self-diagnosis'),
], 'translations');
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"$",
"this",
"->",
"loadTranslationsFrom",
"(",
"__DIR__",
".",
"'/../translations'",
",",
"'self-diagnosis'",
")",
";",
"$",
... | Bootstrap the application services. | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/SelfDiagnosisServiceProvider.php#L12-L26 |
beyondcode/laravel-self-diagnosis | src/SelfDiagnosisServiceProvider.php | SelfDiagnosisServiceProvider.register | public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'self-diagnosis');
$this->app->bind('command.selfdiagnosis', SelfDiagnosisCommand::class);
$this->commands([
'command.selfdiagnosis',
]);
} | php | public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'self-diagnosis');
$this->app->bind('command.selfdiagnosis', SelfDiagnosisCommand::class);
$this->commands([
'command.selfdiagnosis',
]);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/config.php'",
",",
"'self-diagnosis'",
")",
";",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'command.selfdiagnosis'",
",",
"SelfDiagnosisC... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/SelfDiagnosisServiceProvider.php#L31-L40 |
beyondcode/laravel-self-diagnosis | src/Checks/ComposerWithoutDevDependenciesIsUpToDate.php | ComposerWithoutDevDependenciesIsUpToDate.check | public function check(array $config): bool
{
$additionalOptions = Arr::get($config, 'additional_options', '');
$this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions);
return str_contains($this->output, 'Nothing to install or update');
} | php | public function check(array $config): bool
{
$additionalOptions = Arr::get($config, 'additional_options', '');
$this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions);
return str_contains($this->output, 'Nothing to install or update');
} | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"$",
"additionalOptions",
"=",
"Arr",
"::",
"get",
"(",
"$",
"config",
",",
"'additional_options'",
",",
"''",
")",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"this",
... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/ComposerWithoutDevDependenciesIsUpToDate.php#L39-L46 |
beyondcode/laravel-self-diagnosis | src/Checks/LocalesAreInstalled.php | LocalesAreInstalled.check | public function check(array $config): bool
{
$this->missingLocales = new Collection(Arr::get($config, 'required_locales', []));
if ($this->missingLocales->isEmpty()) {
return true;
}
if (!$this->systemFunctions->isFunctionAvailable('shell_exec')) {
$this->mes... | php | public function check(array $config): bool
{
$this->missingLocales = new Collection(Arr::get($config, 'required_locales', []));
if ($this->missingLocales->isEmpty()) {
return true;
}
if (!$this->systemFunctions->isFunctionAvailable('shell_exec')) {
$this->mes... | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"missingLocales",
"=",
"new",
"Collection",
"(",
"Arr",
"::",
"get",
"(",
"$",
"config",
",",
"'required_locales'",
",",
"[",
"]",
")",
")",
";",
"i... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/LocalesAreInstalled.php#L47-L77 |
beyondcode/laravel-self-diagnosis | src/Checks/LocalesAreInstalled.php | LocalesAreInstalled.message | public function message(array $config): string
{
if ($this->message) {
return $this->message;
}
return trans('self-diagnosis::checks.locales_are_installed.message.missing_locales', [
'locales' => $this->missingLocales->implode(PHP_EOL),
]);
} | php | public function message(array $config): string
{
if ($this->message) {
return $this->message;
}
return trans('self-diagnosis::checks.locales_are_installed.message.missing_locales', [
'locales' => $this->missingLocales->implode(PHP_EOL),
]);
} | [
"public",
"function",
"message",
"(",
"array",
"$",
"config",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"message",
")",
"{",
"return",
"$",
"this",
"->",
"message",
";",
"}",
"return",
"trans",
"(",
"'self-diagnosis::checks.locales_are_installed... | The error message to display in case the check does not pass.
@param array $config
@return string | [
"The",
"error",
"message",
"to",
"display",
"in",
"case",
"the",
"check",
"does",
"not",
"pass",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/LocalesAreInstalled.php#L85-L94 |
beyondcode/laravel-self-diagnosis | src/Checks/ExampleEnvironmentVariablesAreUpToDate.php | ExampleEnvironmentVariablesAreUpToDate.check | public function check(array $config): bool
{
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
$examples = Dotenv::create(base_path(), '.env.example');
$actual = Dotenv::create(base_path(), '.env');
} else {
$examples = new Dotenv(base_path(), '... | php | public function check(array $config): bool
{
if (interface_exists(\Dotenv\Environment\FactoryInterface::class)) {
$examples = Dotenv::create(base_path(), '.env.example');
$actual = Dotenv::create(base_path(), '.env');
} else {
$examples = new Dotenv(base_path(), '... | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"if",
"(",
"interface_exists",
"(",
"\\",
"Dotenv",
"\\",
"Environment",
"\\",
"FactoryInterface",
"::",
"class",
")",
")",
"{",
"$",
"examples",
"=",
"Dotenv",
"::",
"cre... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/ExampleEnvironmentVariablesAreUpToDate.php#L30-L47 |
beyondcode/laravel-self-diagnosis | src/Checks/DirectoriesHaveCorrectPermissions.php | DirectoriesHaveCorrectPermissions.check | public function check(array $config): bool
{
$this->paths = Collection::make(Arr::get($config, 'directories', []));
$this->paths = $this->paths->reject(function ($path) {
return $this->filesystem->isWritable($path);
});
return $this->paths->isEmpty();
} | php | public function check(array $config): bool
{
$this->paths = Collection::make(Arr::get($config, 'directories', []));
$this->paths = $this->paths->reject(function ($path) {
return $this->filesystem->isWritable($path);
});
return $this->paths->isEmpty();
} | [
"public",
"function",
"check",
"(",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"paths",
"=",
"Collection",
"::",
"make",
"(",
"Arr",
"::",
"get",
"(",
"$",
"config",
",",
"'directories'",
",",
"[",
"]",
")",
")",
";",
"$",
... | Perform the actual verification of this check.
@param array $config
@return bool | [
"Perform",
"the",
"actual",
"verification",
"of",
"this",
"check",
"."
] | train | https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/DirectoriesHaveCorrectPermissions.php#L56-L65 |
thephpleague/period | src/Sequence.php | Sequence.boundaries | public function boundaries(): ?Period
{
$period = reset($this->intervals);
if (false === $period) {
return null;
}
return $period->merge(...$this->intervals);
} | php | public function boundaries(): ?Period
{
$period = reset($this->intervals);
if (false === $period) {
return null;
}
return $period->merge(...$this->intervals);
} | [
"public",
"function",
"boundaries",
"(",
")",
":",
"?",
"Period",
"{",
"$",
"period",
"=",
"reset",
"(",
"$",
"this",
"->",
"intervals",
")",
";",
"if",
"(",
"false",
"===",
"$",
"period",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"perio... | Returns the sequence boundaries as a Period instance.
If the sequence contains no interval null is returned.
@return ?Period | [
"Returns",
"the",
"sequence",
"boundaries",
"as",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L65-L73 |
thephpleague/period | src/Sequence.php | Sequence.gaps | public function gaps(): self
{
$sequence = new self();
$interval = null;
foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
if (null === $interval) {
$interval = $period;
continue;
}
if (!$interval->overlaps($... | php | public function gaps(): self
{
$sequence = new self();
$interval = null;
foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
if (null === $interval) {
$interval = $period;
continue;
}
if (!$interval->overlaps($... | [
"public",
"function",
"gaps",
"(",
")",
":",
"self",
"{",
"$",
"sequence",
"=",
"new",
"self",
"(",
")",
";",
"$",
"interval",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"sorted",
"(",
"[",
"$",
"this",
",",
"'sortByStartDate'",
"]",
")",... | Returns the gaps inside the instance. | [
"Returns",
"the",
"gaps",
"inside",
"the",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L78-L98 |
thephpleague/period | src/Sequence.php | Sequence.sortByStartDate | private function sortByStartDate(Period $interval1, Period $interval2): int
{
return $interval1->getStartDate() <=> $interval2->getStartDate();
} | php | private function sortByStartDate(Period $interval1, Period $interval2): int
{
return $interval1->getStartDate() <=> $interval2->getStartDate();
} | [
"private",
"function",
"sortByStartDate",
"(",
"Period",
"$",
"interval1",
",",
"Period",
"$",
"interval2",
")",
":",
"int",
"{",
"return",
"$",
"interval1",
"->",
"getStartDate",
"(",
")",
"<=>",
"$",
"interval2",
"->",
"getStartDate",
"(",
")",
";",
"}"
... | Sorts two Interval instance using their start datepoint. | [
"Sorts",
"two",
"Interval",
"instance",
"using",
"their",
"start",
"datepoint",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L103-L106 |
thephpleague/period | src/Sequence.php | Sequence.intersections | public function intersections(): self
{
$sequence = new self();
$current = null;
$isPreviouslyContained = false;
foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
if (null === $current) {
$current = $period;
continue;
... | php | public function intersections(): self
{
$sequence = new self();
$current = null;
$isPreviouslyContained = false;
foreach ($this->sorted([$this, 'sortByStartDate']) as $period) {
if (null === $current) {
$current = $period;
continue;
... | [
"public",
"function",
"intersections",
"(",
")",
":",
"self",
"{",
"$",
"sequence",
"=",
"new",
"self",
"(",
")",
";",
"$",
"current",
"=",
"null",
";",
"$",
"isPreviouslyContained",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"sorted",
"(",
... | Returns the intersections inside the instance. | [
"Returns",
"the",
"intersections",
"inside",
"the",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L111-L138 |
thephpleague/period | src/Sequence.php | Sequence.unions | public function unions(): self
{
$sequence = $this
->sorted([$this, 'sortByStartDate'])
->reduce([$this, 'calculateUnion'], new self())
;
if ($sequence->intervals === $this->intervals) {
return $this;
}
return $sequence;
} | php | public function unions(): self
{
$sequence = $this
->sorted([$this, 'sortByStartDate'])
->reduce([$this, 'calculateUnion'], new self())
;
if ($sequence->intervals === $this->intervals) {
return $this;
}
return $sequence;
} | [
"public",
"function",
"unions",
"(",
")",
":",
"self",
"{",
"$",
"sequence",
"=",
"$",
"this",
"->",
"sorted",
"(",
"[",
"$",
"this",
",",
"'sortByStartDate'",
"]",
")",
"->",
"reduce",
"(",
"[",
"$",
"this",
",",
"'calculateUnion'",
"]",
",",
"new",... | Returns the unions inside the instance. | [
"Returns",
"the",
"unions",
"inside",
"the",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L143-L155 |
thephpleague/period | src/Sequence.php | Sequence.calculateUnion | private function calculateUnion(Sequence $sequence, Period $period): Sequence
{
if ($sequence->isEmpty()) {
$sequence->push($period);
return $sequence;
}
$index = $sequence->count() - 1;
$interval = $sequence->get($index);
if ($interval->overlaps($pe... | php | private function calculateUnion(Sequence $sequence, Period $period): Sequence
{
if ($sequence->isEmpty()) {
$sequence->push($period);
return $sequence;
}
$index = $sequence->count() - 1;
$interval = $sequence->get($index);
if ($interval->overlaps($pe... | [
"private",
"function",
"calculateUnion",
"(",
"Sequence",
"$",
"sequence",
",",
"Period",
"$",
"period",
")",
":",
"Sequence",
"{",
"if",
"(",
"$",
"sequence",
"->",
"isEmpty",
"(",
")",
")",
"{",
"$",
"sequence",
"->",
"push",
"(",
"$",
"period",
")",... | Iteratively calculate the union sequence. | [
"Iteratively",
"calculate",
"the",
"union",
"sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L160-L179 |
thephpleague/period | src/Sequence.php | Sequence.substract | public function substract(Sequence $sequence): self
{
if ($this->isEmpty()) {
return $this;
}
$new = $sequence->reduce([$this, 'substractOne'], $this);
if ($new->intervals === $this->intervals) {
return $this;
}
return $new;
} | php | public function substract(Sequence $sequence): self
{
if ($this->isEmpty()) {
return $this;
}
$new = $sequence->reduce([$this, 'substractOne'], $this);
if ($new->intervals === $this->intervals) {
return $this;
}
return $new;
} | [
"public",
"function",
"substract",
"(",
"Sequence",
"$",
"sequence",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"new",
"=",
"$",
"sequence",
"->",
"reduce",
"(",
"[",
... | Substract a Sequence from the current instance.
This method MUST retain the state of the current instance, and return
an instance that contains substracted intervals. | [
"Substract",
"a",
"Sequence",
"from",
"the",
"current",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L187-L199 |
thephpleague/period | src/Sequence.php | Sequence.substractOne | private function substractOne(Sequence $sequence, Period $interval): self
{
if ($sequence->isEmpty()) {
return $sequence;
}
$reducer = function (Sequence $sequence, Period $period) use ($interval) {
$substract = $period->substract($interval);
if (!$substr... | php | private function substractOne(Sequence $sequence, Period $interval): self
{
if ($sequence->isEmpty()) {
return $sequence;
}
$reducer = function (Sequence $sequence, Period $period) use ($interval) {
$substract = $period->substract($interval);
if (!$substr... | [
"private",
"function",
"substractOne",
"(",
"Sequence",
"$",
"sequence",
",",
"Period",
"$",
"interval",
")",
":",
"self",
"{",
"if",
"(",
"$",
"sequence",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"sequence",
";",
"}",
"$",
"reducer",
"=",
... | Substract an Interval from a Sequence. | [
"Substract",
"an",
"Interval",
"from",
"a",
"Sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L204-L220 |
thephpleague/period | src/Sequence.php | Sequence.getTotalTimestampInterval | public function getTotalTimestampInterval(): float
{
$retval = 0;
foreach ($this->intervals as $interval) {
$retval += $interval->getTimestampInterval();
}
return $retval;
} | php | public function getTotalTimestampInterval(): float
{
$retval = 0;
foreach ($this->intervals as $interval) {
$retval += $interval->getTimestampInterval();
}
return $retval;
} | [
"public",
"function",
"getTotalTimestampInterval",
"(",
")",
":",
"float",
"{",
"$",
"retval",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"intervals",
"as",
"$",
"interval",
")",
"{",
"$",
"retval",
"+=",
"$",
"interval",
"->",
"getTimestampInterval... | Returns the sum of all instances durations as expressed in seconds. | [
"Returns",
"the",
"sum",
"of",
"all",
"instances",
"durations",
"as",
"expressed",
"in",
"seconds",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L268-L276 |
thephpleague/period | src/Sequence.php | Sequence.some | public function some(callable $predicate): bool
{
foreach ($this->intervals as $offset => $interval) {
if (true === $predicate($interval, $offset)) {
return true;
}
}
return false;
} | php | public function some(callable $predicate): bool
{
foreach ($this->intervals as $offset => $interval) {
if (true === $predicate($interval, $offset)) {
return true;
}
}
return false;
} | [
"public",
"function",
"some",
"(",
"callable",
"$",
"predicate",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"intervals",
"as",
"$",
"offset",
"=>",
"$",
"interval",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"predicate",
"(",
"$",
"inter... | Tells whether some intervals in the current instance satisfies the predicate. | [
"Tells",
"whether",
"some",
"intervals",
"in",
"the",
"current",
"instance",
"satisfies",
"the",
"predicate",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L281-L290 |
thephpleague/period | src/Sequence.php | Sequence.offsetSet | public function offsetSet($offset, $interval): void
{
if (null !== $offset) {
$this->set($offset, $interval);
return;
}
$this->push($interval);
} | php | public function offsetSet($offset, $interval): void
{
if (null !== $offset) {
$this->set($offset, $interval);
return;
}
$this->push($interval);
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"interval",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"offset",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"offset",
",",
"$",
"interval",
")",
";",
"return",
";",
"}... | @inheritdoc
@see ::set
@see ::push
@param mixed $offset the index of the Period to add or update.
@param mixed $interval the Period instance to add. | [
"@inheritdoc",
"@see",
"::",
"set",
"@see",
"::",
"push"
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L382-L390 |
thephpleague/period | src/Sequence.php | Sequence.contains | public function contains(Period $interval, Period ...$intervals): bool
{
$intervals[] = $interval;
foreach ($intervals as $period) {
if (false === $this->indexOf($period)) {
return false;
}
}
return true;
} | php | public function contains(Period $interval, Period ...$intervals): bool
{
$intervals[] = $interval;
foreach ($intervals as $period) {
if (false === $this->indexOf($period)) {
return false;
}
}
return true;
} | [
"public",
"function",
"contains",
"(",
"Period",
"$",
"interval",
",",
"Period",
"...",
"$",
"intervals",
")",
":",
"bool",
"{",
"$",
"intervals",
"[",
"]",
"=",
"$",
"interval",
";",
"foreach",
"(",
"$",
"intervals",
"as",
"$",
"period",
")",
"{",
"... | Tells whether the given interval is present in the sequence.
@param Period ...$intervals | [
"Tells",
"whether",
"the",
"given",
"interval",
"is",
"present",
"in",
"the",
"sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L405-L415 |
thephpleague/period | src/Sequence.php | Sequence.indexOf | public function indexOf(Period $interval)
{
foreach ($this->intervals as $offset => $period) {
if ($period->equals($interval)) {
return $offset;
}
}
return false;
} | php | public function indexOf(Period $interval)
{
foreach ($this->intervals as $offset => $period) {
if ($period->equals($interval)) {
return $offset;
}
}
return false;
} | [
"public",
"function",
"indexOf",
"(",
"Period",
"$",
"interval",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"intervals",
"as",
"$",
"offset",
"=>",
"$",
"period",
")",
"{",
"if",
"(",
"$",
"period",
"->",
"equals",
"(",
"$",
"interval",
")",
")",
... | Attempts to find the first offset attached to the submitted interval.
If no offset is found the method returns boolean false.
@return int|bool | [
"Attempts",
"to",
"find",
"the",
"first",
"offset",
"attached",
"to",
"the",
"submitted",
"interval",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L424-L433 |
thephpleague/period | src/Sequence.php | Sequence.get | public function get(int $offset): Period
{
$period = $this->intervals[$offset] ?? null;
if (null !== $period) {
return $period;
}
throw new InvalidIndex(sprintf('%s is an invalid offset in the current sequence', $offset));
} | php | public function get(int $offset): Period
{
$period = $this->intervals[$offset] ?? null;
if (null !== $period) {
return $period;
}
throw new InvalidIndex(sprintf('%s is an invalid offset in the current sequence', $offset));
} | [
"public",
"function",
"get",
"(",
"int",
"$",
"offset",
")",
":",
"Period",
"{",
"$",
"period",
"=",
"$",
"this",
"->",
"intervals",
"[",
"$",
"offset",
"]",
"??",
"null",
";",
"if",
"(",
"null",
"!==",
"$",
"period",
")",
"{",
"return",
"$",
"pe... | Returns the interval specified at a given offset.
@throws InvalidIndex If the offset is illegal for the current sequence | [
"Returns",
"the",
"interval",
"specified",
"at",
"a",
"given",
"offset",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L440-L448 |
thephpleague/period | src/Sequence.php | Sequence.unshift | public function unshift(Period $interval, Period ...$intervals): void
{
$this->intervals = array_merge([$interval], $intervals, $this->intervals);
} | php | public function unshift(Period $interval, Period ...$intervals): void
{
$this->intervals = array_merge([$interval], $intervals, $this->intervals);
} | [
"public",
"function",
"unshift",
"(",
"Period",
"$",
"interval",
",",
"Period",
"...",
"$",
"intervals",
")",
":",
"void",
"{",
"$",
"this",
"->",
"intervals",
"=",
"array_merge",
"(",
"[",
"$",
"interval",
"]",
",",
"$",
"intervals",
",",
"$",
"this",... | Adds new intervals at the front of the sequence.
The sequence is re-indexed after addition
@param Period ...$intervals | [
"Adds",
"new",
"intervals",
"at",
"the",
"front",
"of",
"the",
"sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L468-L471 |
thephpleague/period | src/Sequence.php | Sequence.push | public function push(Period $interval, Period ...$intervals): void
{
$this->intervals = array_merge($this->intervals, [$interval], $intervals);
} | php | public function push(Period $interval, Period ...$intervals): void
{
$this->intervals = array_merge($this->intervals, [$interval], $intervals);
} | [
"public",
"function",
"push",
"(",
"Period",
"$",
"interval",
",",
"Period",
"...",
"$",
"intervals",
")",
":",
"void",
"{",
"$",
"this",
"->",
"intervals",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"intervals",
",",
"[",
"$",
"interval",
"]",
",",
... | Adds new intervals at the end of the sequence.
@param Period ...$intervals | [
"Adds",
"new",
"intervals",
"at",
"the",
"end",
"of",
"the",
"sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L478-L481 |
thephpleague/period | src/Sequence.php | Sequence.insert | public function insert(int $offset, Period $interval, Period ...$intervals): void
{
if ($offset < 0 || $offset > count($this->intervals)) {
throw new InvalidIndex(sprintf('%s is an invalid offset in the current sequence', $offset));
}
array_unshift($intervals, $interval);
... | php | public function insert(int $offset, Period $interval, Period ...$intervals): void
{
if ($offset < 0 || $offset > count($this->intervals)) {
throw new InvalidIndex(sprintf('%s is an invalid offset in the current sequence', $offset));
}
array_unshift($intervals, $interval);
... | [
"public",
"function",
"insert",
"(",
"int",
"$",
"offset",
",",
"Period",
"$",
"interval",
",",
"Period",
"...",
"$",
"intervals",
")",
":",
"void",
"{",
"if",
"(",
"$",
"offset",
"<",
"0",
"||",
"$",
"offset",
">",
"count",
"(",
"$",
"this",
"->",... | Inserts new intervals at the specified offset of the sequence.
The sequence is re-indexed after addition
@param Period ...$intervals
@throws InvalidIndex If the offset is illegal for the current sequence. | [
"Inserts",
"new",
"intervals",
"at",
"the",
"specified",
"offset",
"of",
"the",
"sequence",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L492-L500 |
thephpleague/period | src/Sequence.php | Sequence.set | public function set(int $offset, Period $interval): void
{
$this->get($offset);
$this->intervals[$offset] = $interval;
} | php | public function set(int $offset, Period $interval): void
{
$this->get($offset);
$this->intervals[$offset] = $interval;
} | [
"public",
"function",
"set",
"(",
"int",
"$",
"offset",
",",
"Period",
"$",
"interval",
")",
":",
"void",
"{",
"$",
"this",
"->",
"get",
"(",
"$",
"offset",
")",
";",
"$",
"this",
"->",
"intervals",
"[",
"$",
"offset",
"]",
"=",
"$",
"interval",
... | Updates the interval at the specify offset.
@throws InvalidIndex If the offset is illegal for the current sequence. | [
"Updates",
"the",
"interval",
"at",
"the",
"specify",
"offset",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L507-L511 |
thephpleague/period | src/Sequence.php | Sequence.remove | public function remove(int $offset): Period
{
$interval = $this->get($offset);
unset($this->intervals[$offset]);
$this->intervals = array_values($this->intervals);
return $interval;
} | php | public function remove(int $offset): Period
{
$interval = $this->get($offset);
unset($this->intervals[$offset]);
$this->intervals = array_values($this->intervals);
return $interval;
} | [
"public",
"function",
"remove",
"(",
"int",
"$",
"offset",
")",
":",
"Period",
"{",
"$",
"interval",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"offset",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"intervals",
"[",
"$",
"offset",
"]",
")",
";",
"$"... | Removes an interval from the sequence at the given offset and returns it.
The sequence is re-indexed after removal
@throws InvalidIndex If the offset is illegal for the current sequence. | [
"Removes",
"an",
"interval",
"from",
"the",
"sequence",
"at",
"the",
"given",
"offset",
"and",
"returns",
"it",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L520-L528 |
thephpleague/period | src/Sequence.php | Sequence.filter | public function filter(callable $predicate): self
{
$intervals = array_filter($this->intervals, $predicate, ARRAY_FILTER_USE_BOTH);
if ($intervals === $this->intervals) {
return $this;
}
return new self(...$intervals);
} | php | public function filter(callable $predicate): self
{
$intervals = array_filter($this->intervals, $predicate, ARRAY_FILTER_USE_BOTH);
if ($intervals === $this->intervals) {
return $this;
}
return new self(...$intervals);
} | [
"public",
"function",
"filter",
"(",
"callable",
"$",
"predicate",
")",
":",
"self",
"{",
"$",
"intervals",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"intervals",
",",
"$",
"predicate",
",",
"ARRAY_FILTER_USE_BOTH",
")",
";",
"if",
"(",
"$",
"intervals"... | Filters the sequence according to the given predicate.
This method MUST retain the state of the current instance, and return
an instance that contains the interval which validate the predicate. | [
"Filters",
"the",
"sequence",
"according",
"to",
"the",
"given",
"predicate",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L536-L544 |
thephpleague/period | src/Sequence.php | Sequence.sorted | public function sorted(callable $compare): self
{
$intervals = $this->intervals;
usort($intervals, $compare);
if ($intervals === $this->intervals) {
return $this;
}
return new self(...$intervals);
} | php | public function sorted(callable $compare): self
{
$intervals = $this->intervals;
usort($intervals, $compare);
if ($intervals === $this->intervals) {
return $this;
}
return new self(...$intervals);
} | [
"public",
"function",
"sorted",
"(",
"callable",
"$",
"compare",
")",
":",
"self",
"{",
"$",
"intervals",
"=",
"$",
"this",
"->",
"intervals",
";",
"usort",
"(",
"$",
"intervals",
",",
"$",
"compare",
")",
";",
"if",
"(",
"$",
"intervals",
"===",
"$"... | Returns an instance sorted according to the given comparison callable
but does not maintain index association.
This method MUST retain the state of the current instance, and return
an instance that contains the sorted intervals. The key are re-indexed | [
"Returns",
"an",
"instance",
"sorted",
"according",
"to",
"the",
"given",
"comparison",
"callable",
"but",
"does",
"not",
"maintain",
"index",
"association",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L561-L570 |
thephpleague/period | src/Sequence.php | Sequence.map | public function map(callable $func): self
{
$intervals = [];
foreach ($this->intervals as $offset => $interval) {
$intervals[$offset] = $func($interval, $offset);
}
if ($intervals === $this->intervals) {
return $this;
}
$mapped = new self();
... | php | public function map(callable $func): self
{
$intervals = [];
foreach ($this->intervals as $offset => $interval) {
$intervals[$offset] = $func($interval, $offset);
}
if ($intervals === $this->intervals) {
return $this;
}
$mapped = new self();
... | [
"public",
"function",
"map",
"(",
"callable",
"$",
"func",
")",
":",
"self",
"{",
"$",
"intervals",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"intervals",
"as",
"$",
"offset",
"=>",
"$",
"interval",
")",
"{",
"$",
"intervals",
"[",
"$"... | Returns an instance where the given function is applied to each element in
the collection. The callable MUST return a Period object and takes a Period
and its associated key as argument.
This method MUST retain the state of the current instance, and return
an instance that contains the returned intervals. | [
"Returns",
"an",
"instance",
"where",
"the",
"given",
"function",
"is",
"applied",
"to",
"each",
"element",
"in",
"the",
"collection",
".",
"The",
"callable",
"MUST",
"return",
"a",
"Period",
"object",
"and",
"takes",
"a",
"Period",
"and",
"its",
"associated... | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L580-L595 |
thephpleague/period | src/Sequence.php | Sequence.reduce | public function reduce(callable $func, $carry = null)
{
foreach ($this->intervals as $offset => $interval) {
$carry = $func($carry, $interval, $offset);
}
return $carry;
} | php | public function reduce(callable $func, $carry = null)
{
foreach ($this->intervals as $offset => $interval) {
$carry = $func($carry, $interval, $offset);
}
return $carry;
} | [
"public",
"function",
"reduce",
"(",
"callable",
"$",
"func",
",",
"$",
"carry",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"intervals",
"as",
"$",
"offset",
"=>",
"$",
"interval",
")",
"{",
"$",
"carry",
"=",
"$",
"func",
"(",
"$",
... | Iteratively reduces the sequence to a single value using a callback.
@param callable $func Accepts the carry, the current value and the current offset, and
returns an updated carry value.
@param mixed|null $carry Optional initial carry value.
@return mixed The carry value of the final iteration, or the initial
value... | [
"Iteratively",
"reduces",
"the",
"sequence",
"to",
"a",
"single",
"value",
"using",
"a",
"callback",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Sequence.php#L608-L615 |
thephpleague/period | src/Datepoint.php | Datepoint.create | public static function create($datepoint): self
{
if ($datepoint instanceof DateTimeInterface) {
return new self($datepoint->format('Y-m-d H:i:s.u'), $datepoint->getTimezone());
}
if (false !== ($timestamp = filter_var($datepoint, FILTER_VALIDATE_INT))) {
return new ... | php | public static function create($datepoint): self
{
if ($datepoint instanceof DateTimeInterface) {
return new self($datepoint->format('Y-m-d H:i:s.u'), $datepoint->getTimezone());
}
if (false !== ($timestamp = filter_var($datepoint, FILTER_VALIDATE_INT))) {
return new ... | [
"public",
"static",
"function",
"create",
"(",
"$",
"datepoint",
")",
":",
"self",
"{",
"if",
"(",
"$",
"datepoint",
"instanceof",
"DateTimeInterface",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"datepoint",
"->",
"format",
"(",
"'Y-m-d H:i:s.u'",
")",
"... | Returns a position in time expressed as a DateTimeImmutable object.
A datepoint can be
<ul>
<li>a DateTimeInterface object
<li>a integer interpreted as a timestamp
<li>a string parsable by DateTime::__construct
</ul>
@param mixed $datepoint a position in time | [
"Returns",
"a",
"position",
"in",
"time",
"expressed",
"as",
"a",
"DateTimeImmutable",
"object",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L46-L57 |
thephpleague/period | src/Datepoint.php | Datepoint.createFromFormat | public static function createFromFormat($format, $datetime, $timezone = null)
{
$datepoint = parent::createFromFormat($format, $datetime, $timezone);
if (false !== $datepoint) {
return self::create($datepoint);
}
return $datepoint;
} | php | public static function createFromFormat($format, $datetime, $timezone = null)
{
$datepoint = parent::createFromFormat($format, $datetime, $timezone);
if (false !== $datepoint) {
return self::create($datepoint);
}
return $datepoint;
} | [
"public",
"static",
"function",
"createFromFormat",
"(",
"$",
"format",
",",
"$",
"datetime",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"$",
"datepoint",
"=",
"parent",
"::",
"createFromFormat",
"(",
"$",
"format",
",",
"$",
"datetime",
",",
"$",
"tim... | @inheritdoc
@param string $format
@param string $datetime
@param DateTimeZone $timezone
@return static|false | [
"@inheritdoc"
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L68-L76 |
thephpleague/period | src/Datepoint.php | Datepoint.getSecond | public function getSecond(): Period
{
$datepoint = $this->setTime(
(int) $this->format('H'),
(int) $this->format('i'),
(int) $this->format('s')
);
return new Period($datepoint, $datepoint->add(new DateInterval('PT1S')));
} | php | public function getSecond(): Period
{
$datepoint = $this->setTime(
(int) $this->format('H'),
(int) $this->format('i'),
(int) $this->format('s')
);
return new Period($datepoint, $datepoint->add(new DateInterval('PT1S')));
} | [
"public",
"function",
"getSecond",
"(",
")",
":",
"Period",
"{",
"$",
"datepoint",
"=",
"$",
"this",
"->",
"setTime",
"(",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'H'",
")",
",",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'i'... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint second
- the duration is equal to 1 second | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L100-L109 |
thephpleague/period | src/Datepoint.php | Datepoint.getDay | public function getDay(): Period
{
$datepoint = $this->setTime(0, 0);
return new Period($datepoint, $datepoint->add(new DateInterval('P1D')));
} | php | public function getDay(): Period
{
$datepoint = $this->setTime(0, 0);
return new Period($datepoint, $datepoint->add(new DateInterval('P1D')));
} | [
"public",
"function",
"getDay",
"(",
")",
":",
"Period",
"{",
"$",
"datepoint",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
";",
"return",
"new",
"Period",
"(",
"$",
"datepoint",
",",
"$",
"datepoint",
"->",
"add",
"(",
"new",
"Date... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint day
- the duration is equal to 1 day | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L143-L148 |
thephpleague/period | src/Datepoint.php | Datepoint.getIsoWeek | public function getIsoWeek(): Period
{
$startDate = $this
->setTime(0, 0)
->setISODate((int) $this->format('o'), (int) $this->format('W'), 1);
return new Period($startDate, $startDate->add(new DateInterval('P7D')));
} | php | public function getIsoWeek(): Period
{
$startDate = $this
->setTime(0, 0)
->setISODate((int) $this->format('o'), (int) $this->format('W'), 1);
return new Period($startDate, $startDate->add(new DateInterval('P7D')));
} | [
"public",
"function",
"getIsoWeek",
"(",
")",
":",
"Period",
"{",
"$",
"startDate",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
"->",
"setISODate",
"(",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'o'",
")",
",",
"(",
"int... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint iso week
- the duration is equal to 7 days | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L156-L163 |
thephpleague/period | src/Datepoint.php | Datepoint.getMonth | public function getMonth(): Period
{
$startDate = $this
->setTime(0, 0)
->setDate((int) $this->format('Y'), (int) $this->format('n'), 1);
return new Period($startDate, $startDate->add(new DateInterval('P1M')));
} | php | public function getMonth(): Period
{
$startDate = $this
->setTime(0, 0)
->setDate((int) $this->format('Y'), (int) $this->format('n'), 1);
return new Period($startDate, $startDate->add(new DateInterval('P1M')));
} | [
"public",
"function",
"getMonth",
"(",
")",
":",
"Period",
"{",
"$",
"startDate",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
"->",
"setDate",
"(",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'Y'",
")",
",",
"(",
"int",
... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint month
- the duration is equal to 1 month | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L171-L178 |
thephpleague/period | src/Datepoint.php | Datepoint.getQuarter | public function getQuarter(): Period
{
$startDate = $this
->setTime(0, 0)
->setDate((int) $this->format('Y'), (intdiv((int) $this->format('n'), 3) * 3) + 1, 1);
return new Period($startDate, $startDate->add(new DateInterval('P3M')));
} | php | public function getQuarter(): Period
{
$startDate = $this
->setTime(0, 0)
->setDate((int) $this->format('Y'), (intdiv((int) $this->format('n'), 3) * 3) + 1, 1);
return new Period($startDate, $startDate->add(new DateInterval('P3M')));
} | [
"public",
"function",
"getQuarter",
"(",
")",
":",
"Period",
"{",
"$",
"startDate",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
"->",
"setDate",
"(",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'Y'",
")",
",",
"(",
"intdiv... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint quarter
- the duration is equal to 3 months | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L186-L193 |
thephpleague/period | src/Datepoint.php | Datepoint.getYear | public function getYear(): Period
{
$year = (int) $this->format('Y');
$datepoint = $this->setTime(0, 0);
return new Period($datepoint->setDate($year, 1, 1), $datepoint->setDate(++$year, 1, 1));
} | php | public function getYear(): Period
{
$year = (int) $this->format('Y');
$datepoint = $this->setTime(0, 0);
return new Period($datepoint->setDate($year, 1, 1), $datepoint->setDate(++$year, 1, 1));
} | [
"public",
"function",
"getYear",
"(",
")",
":",
"Period",
"{",
"$",
"year",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'Y'",
")",
";",
"$",
"datepoint",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
";",
"return",
"n... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint year
- the duration is equal to 1 year | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L216-L222 |
thephpleague/period | src/Datepoint.php | Datepoint.getIsoYear | public function getIsoYear(): Period
{
$year = (int) $this->format('o');
$datepoint = $this->setTime(0, 0);
return new Period($datepoint->setISODate($year, 1, 1), $datepoint->setISODate(++$year, 1, 1));
} | php | public function getIsoYear(): Period
{
$year = (int) $this->format('o');
$datepoint = $this->setTime(0, 0);
return new Period($datepoint->setISODate($year, 1, 1), $datepoint->setISODate(++$year, 1, 1));
} | [
"public",
"function",
"getIsoYear",
"(",
")",
":",
"Period",
"{",
"$",
"year",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"format",
"(",
"'o'",
")",
";",
"$",
"datepoint",
"=",
"$",
"this",
"->",
"setTime",
"(",
"0",
",",
"0",
")",
";",
"return",
... | Returns a Period instance.
- the starting datepoint represents the beginning of the current datepoint iso year
- the duration is equal to 1 iso year | [
"Returns",
"a",
"Period",
"instance",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L230-L236 |
thephpleague/period | src/Datepoint.php | Datepoint.abuts | public function abuts(Period $interval): bool
{
return $this->bordersOnEnd($interval) || $this->bordersOnStart($interval);
} | php | public function abuts(Period $interval): bool
{
return $this->bordersOnEnd($interval) || $this->bordersOnStart($interval);
} | [
"public",
"function",
"abuts",
"(",
"Period",
"$",
"interval",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"bordersOnEnd",
"(",
"$",
"interval",
")",
"||",
"$",
"this",
"->",
"bordersOnStart",
"(",
"$",
"interval",
")",
";",
"}"
] | Tells whether the datepoint abuts the interval. | [
"Tells",
"whether",
"the",
"datepoint",
"abuts",
"the",
"interval",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Datepoint.php#L293-L296 |
thephpleague/period | src/Duration.php | Duration.create | public static function create($duration): self
{
if ($duration instanceof Period) {
$duration = $duration->getDateInterval();
}
if ($duration instanceof DateInterval) {
$new = new self('PT0S');
foreach ($duration as $name => $value) {
if (... | php | public static function create($duration): self
{
if ($duration instanceof Period) {
$duration = $duration->getDateInterval();
}
if ($duration instanceof DateInterval) {
$new = new self('PT0S');
foreach ($duration as $name => $value) {
if (... | [
"public",
"static",
"function",
"create",
"(",
"$",
"duration",
")",
":",
"self",
"{",
"if",
"(",
"$",
"duration",
"instanceof",
"Period",
")",
"{",
"$",
"duration",
"=",
"$",
"duration",
"->",
"getDateInterval",
"(",
")",
";",
"}",
"if",
"(",
"$",
"... | Returns a continuous portion of time between two datepoints expressed as a DateInterval object.
The duration can be
<ul>
<li>an Period object</li>
<li>a DateInterval object</li>
<li>an integer interpreted as the duration expressed in seconds.</li>
<li>a string parsable by DateInterval::createFromDateString</li>
</ul>
... | [
"Returns",
"a",
"continuous",
"portion",
"of",
"time",
"between",
"two",
"datepoints",
"expressed",
"as",
"a",
"DateInterval",
"object",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Duration.php#L86-L136 |
thephpleague/period | src/Duration.php | Duration.createFromDateString | public static function createFromDateString($duration): self
{
$duration = parent::createFromDateString($duration);
if (false === $duration) {
return $duration;
}
$new = new self('PT0S');
foreach ($duration as $name => $value) {
$new->$name = $value;
... | php | public static function createFromDateString($duration): self
{
$duration = parent::createFromDateString($duration);
if (false === $duration) {
return $duration;
}
$new = new self('PT0S');
foreach ($duration as $name => $value) {
$new->$name = $value;
... | [
"public",
"static",
"function",
"createFromDateString",
"(",
"$",
"duration",
")",
":",
"self",
"{",
"$",
"duration",
"=",
"parent",
"::",
"createFromDateString",
"(",
"$",
"duration",
")",
";",
"if",
"(",
"false",
"===",
"$",
"duration",
")",
"{",
"return... | @inheritdoc
@param mixed $duration a date with relative parts
@return static|false | [
"@inheritdoc"
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Duration.php#L145-L158 |
thephpleague/period | src/Duration.php | Duration.adjustedTo | public function adjustedTo($reference_date): self
{
if (!$reference_date instanceof DateTimeImmutable) {
$reference_date = Datepoint::create($reference_date);
}
$duration = self::create($reference_date->diff($reference_date->add($this)));
if ($duration == $this) {
... | php | public function adjustedTo($reference_date): self
{
if (!$reference_date instanceof DateTimeImmutable) {
$reference_date = Datepoint::create($reference_date);
}
$duration = self::create($reference_date->diff($reference_date->add($this)));
if ($duration == $this) {
... | [
"public",
"function",
"adjustedTo",
"(",
"$",
"reference_date",
")",
":",
"self",
"{",
"if",
"(",
"!",
"$",
"reference_date",
"instanceof",
"DateTimeImmutable",
")",
"{",
"$",
"reference_date",
"=",
"Datepoint",
"::",
"create",
"(",
"$",
"reference_date",
")",... | Returns a new instance with recalculate properties according to a given datepoint.
This method MUST retain the state of the current instance, and return
an instance that contains the time and date segments recalculate to remove
carry over points.
@param mixed $reference_date a reference datepoint {@see \League\Period... | [
"Returns",
"a",
"new",
"instance",
"with",
"recalculate",
"properties",
"according",
"to",
"a",
"given",
"datepoint",
"."
] | train | https://github.com/thephpleague/period/blob/869efabb201dd10e60a6dbbba01cca2d15872a51/src/Duration.php#L242-L254 |
auth0/auth0-PHP | src/JWTVerifier.php | JWTVerifier.verifyAndDecode | public function verifyAndDecode($jwt)
{
$tks = explode('.', $jwt);
if (count($tks) !== 3) {
throw new InvalidTokenException('Wrong number of segments');
}
try {
$head_decoded = $this->decodeTokenSegment($tks[0]);
$body_decoded = $this->decodeToke... | php | public function verifyAndDecode($jwt)
{
$tks = explode('.', $jwt);
if (count($tks) !== 3) {
throw new InvalidTokenException('Wrong number of segments');
}
try {
$head_decoded = $this->decodeTokenSegment($tks[0]);
$body_decoded = $this->decodeToke... | [
"public",
"function",
"verifyAndDecode",
"(",
"$",
"jwt",
")",
"{",
"$",
"tks",
"=",
"explode",
"(",
"'.'",
",",
"$",
"jwt",
")",
";",
"if",
"(",
"count",
"(",
"$",
"tks",
")",
"!==",
"3",
")",
"{",
"throw",
"new",
"InvalidTokenException",
"(",
"'W... | Verify and decode a JWT.
@param string $jwt JWT to verify and decode.
@return mixed
@throws InvalidTokenException If the token does not have 3 sections.
@throws InvalidTokenException If the algorithm used to sign the token is not supported.
@throws InvalidTokenException If the token does not have a valid audience.
@... | [
"Verify",
"and",
"decode",
"a",
"JWT",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/JWTVerifier.php#L171-L228 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.get_authorize_link | public function get_authorize_link(
$response_type,
$redirect_uri,
$connection = null,
$state = null,
array $additional_params = []
)
{
$additional_params['response_type'] = $response_type;
$additional_params['redirect_uri'] = $redirect_uri;
$addi... | php | public function get_authorize_link(
$response_type,
$redirect_uri,
$connection = null,
$state = null,
array $additional_params = []
)
{
$additional_params['response_type'] = $response_type;
$additional_params['redirect_uri'] = $redirect_uri;
$addi... | [
"public",
"function",
"get_authorize_link",
"(",
"$",
"response_type",
",",
"$",
"redirect_uri",
",",
"$",
"connection",
"=",
"null",
",",
"$",
"state",
"=",
"null",
",",
"array",
"$",
"additional_params",
"=",
"[",
"]",
")",
"{",
"$",
"additional_params",
... | Builds and returns the authorization URL.
@param string $response_type Response type requested, typically "code" for web application login.
@param string $redirect_uri Redirect URI for login and consent, must be white-listed.
@param null|string $connection Connection parameter to send with th... | [
"Builds",
"and",
"returns",
"the",
"authorization",
"URL",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L126-L151 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.get_samlp_link | public function get_samlp_link($client_id = null, $connection = '')
{
return sprintf(
'https://%s/samlp/%s?connection=%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id,
$connection
);
} | php | public function get_samlp_link($client_id = null, $connection = '')
{
return sprintf(
'https://%s/samlp/%s?connection=%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id,
$connection
);
} | [
"public",
"function",
"get_samlp_link",
"(",
"$",
"client_id",
"=",
"null",
",",
"$",
"connection",
"=",
"''",
")",
"{",
"return",
"sprintf",
"(",
"'https://%s/samlp/%s?connection=%s'",
",",
"$",
"this",
"->",
"domain",
",",
"empty",
"(",
"$",
"client_id",
"... | Build and return a SAMLP link.
@param null|string $client_id Client ID to use, null to use the value set during class initialization.
@param string $connection Connection parameter to add.
@return string
@link https://auth0.com/docs/connections/enterprise/samlp | [
"Build",
"and",
"return",
"a",
"SAMLP",
"link",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L163-L171 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.get_samlp_metadata_link | public function get_samlp_metadata_link($client_id = null)
{
return sprintf(
'https://%s/samlp/metadata/%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id
);
} | php | public function get_samlp_metadata_link($client_id = null)
{
return sprintf(
'https://%s/samlp/metadata/%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id
);
} | [
"public",
"function",
"get_samlp_metadata_link",
"(",
"$",
"client_id",
"=",
"null",
")",
"{",
"return",
"sprintf",
"(",
"'https://%s/samlp/metadata/%s'",
",",
"$",
"this",
"->",
"domain",
",",
"empty",
"(",
"$",
"client_id",
")",
"?",
"$",
"this",
"->",
"cl... | Build and return a SAMLP metadata link.
@param null|string $client_id Client ID to use, null to use the value set during class initialization.
@return string
@link https://auth0.com/docs/connections/enterprise/samlp | [
"Build",
"and",
"return",
"a",
"SAMLP",
"metadata",
"link",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L182-L189 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.get_wsfed_link | public function get_wsfed_link($client_id = null, array $params = [])
{
return sprintf(
'https://%s/wsfed/%s?%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id,
Psr7\build_query($params)
);
} | php | public function get_wsfed_link($client_id = null, array $params = [])
{
return sprintf(
'https://%s/wsfed/%s?%s',
$this->domain,
empty($client_id) ? $this->client_id : $client_id,
Psr7\build_query($params)
);
} | [
"public",
"function",
"get_wsfed_link",
"(",
"$",
"client_id",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"sprintf",
"(",
"'https://%s/wsfed/%s?%s'",
",",
"$",
"this",
"->",
"domain",
",",
"empty",
"(",
"$",
"client_id",
... | Build and return a WS-Federation link
@param null|string $client_id Client ID to use, null to use the value set during class initialization.
@param array $params Request parameters for the WS-Fed request.
- params.client-id The client-id of your application.
- params.wtrealm Can be used in place of client-i... | [
"Build",
"and",
"return",
"a",
"WS",
"-",
"Federation",
"link"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L206-L214 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.get_logout_link | public function get_logout_link($returnTo = null, $client_id = null, $federated = false)
{
$params = [];
if ($returnTo !== null) {
$params['returnTo'] = $returnTo;
}
if ($client_id !== null) {
$params['client_id'] = $client_id;
}
if ($federa... | php | public function get_logout_link($returnTo = null, $client_id = null, $federated = false)
{
$params = [];
if ($returnTo !== null) {
$params['returnTo'] = $returnTo;
}
if ($client_id !== null) {
$params['client_id'] = $client_id;
}
if ($federa... | [
"public",
"function",
"get_logout_link",
"(",
"$",
"returnTo",
"=",
"null",
",",
"$",
"client_id",
"=",
"null",
",",
"$",
"federated",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"returnTo",
"!==",
"null",
")",
"{",
"... | Builds and returns a logout URL to terminate an SSO session.
@param null|string $returnTo URL to return to after logging in; must be white-listed in Auth0.
@param null|string $client_id Client ID to use Application-specific returnTo URLs.
@param boolean $federated Attempt a federated logout.
@return string
@lin... | [
"Builds",
"and",
"returns",
"a",
"logout",
"URL",
"to",
"terminate",
"an",
"SSO",
"session",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L239-L260 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.email_passwordless_start | public function email_passwordless_start($email, $type, array $authParams = [])
{
$data = [
'client_id' => $this->client_id,
'connection' => 'email',
'send' => $type,
'email' => $email,
];
if (! empty($authParams)) {
$data['authPar... | php | public function email_passwordless_start($email, $type, array $authParams = [])
{
$data = [
'client_id' => $this->client_id,
'connection' => 'email',
'send' => $type,
'email' => $email,
];
if (! empty($authParams)) {
$data['authPar... | [
"public",
"function",
"email_passwordless_start",
"(",
"$",
"email",
",",
"$",
"type",
",",
"array",
"$",
"authParams",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"client_id",
",",
"'connection'",
"=>",
"'emai... | Start passwordless login process for email
@param string $email Email address to use.
@param string $type Use null or "link" to send a link, use "code" to send a verification code.
@param array $authParams Link parameters (like scope, redirect_uri, protocol, response_type) to modify.
@return mixed
@link ... | [
"Start",
"passwordless",
"login",
"process",
"for",
"email"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L273-L292 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.sms_passwordless_start | public function sms_passwordless_start($phone_number)
{
$data = [
'client_id' => $this->client_id,
'connection' => 'sms',
'phone_number' => $phone_number,
];
return $this->apiClient->post()
->passwordless()
->start()
->withHeader(n... | php | public function sms_passwordless_start($phone_number)
{
$data = [
'client_id' => $this->client_id,
'connection' => 'sms',
'phone_number' => $phone_number,
];
return $this->apiClient->post()
->passwordless()
->start()
->withHeader(n... | [
"public",
"function",
"sms_passwordless_start",
"(",
"$",
"phone_number",
")",
"{",
"$",
"data",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"client_id",
",",
"'connection'",
"=>",
"'sms'",
",",
"'phone_number'",
"=>",
"$",
"phone_number",
",",
"]",
";... | Start passwordless login process for SMS.
@param string $phone_number Phone number to use.
@return mixed
@link https://auth0.com/docs/api/authentication#get-code-or-link | [
"Start",
"passwordless",
"login",
"process",
"for",
"SMS",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L303-L317 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.userinfo | public function userinfo($access_token)
{
return $this->apiClient->get()
->userinfo()
->withHeader(new ContentType('application/json'))
->withHeader(new AuthorizationBearer($access_token))
->call();
} | php | public function userinfo($access_token)
{
return $this->apiClient->get()
->userinfo()
->withHeader(new ContentType('application/json'))
->withHeader(new AuthorizationBearer($access_token))
->call();
} | [
"public",
"function",
"userinfo",
"(",
"$",
"access_token",
")",
"{",
"return",
"$",
"this",
"->",
"apiClient",
"->",
"get",
"(",
")",
"->",
"userinfo",
"(",
")",
"->",
"withHeader",
"(",
"new",
"ContentType",
"(",
"'application/json'",
")",
")",
"->",
"... | Make an authenticated request to the /userinfo endpoint.
@param string $access_token Bearer token to use for the request.
@return mixed
@link https://auth0.com/docs/api/authentication#user-profile | [
"Make",
"an",
"authenticated",
"request",
"to",
"the",
"/",
"userinfo",
"endpoint",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L328-L335 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.oauth_token | public function oauth_token(array $options = [])
{
if (! isset($options['client_id'])) {
$options['client_id'] = $this->client_id;
}
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
if (! isset($options['g... | php | public function oauth_token(array $options = [])
{
if (! isset($options['client_id'])) {
$options['client_id'] = $this->client_id;
}
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
if (! isset($options['g... | [
"public",
"function",
"oauth_token",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'client_id'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'client_id'",
"]",
"=",
"$",
"this",
"->",
"clie... | Makes a call to the `oauth/token` endpoint.
@param array $options Options for the token endpoint request.
- options.grant_type Grant type to use; required.
- options.client_id Application Client ID; required.
- options.client_secret Application Client Secret; required if token endpoint requires authentication.
... | [
"Makes",
"a",
"call",
"to",
"the",
"oauth",
"/",
"token",
"endpoint",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L351-L375 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.code_exchange | public function code_exchange($code, $redirect_uri)
{
$options = [];
$options['client_secret'] = $this->client_secret;
$options['redirect_uri'] = $redirect_uri;
$options['code'] = $code;
$options['grant_type'] = 'authorization_code';
return $this->oauth... | php | public function code_exchange($code, $redirect_uri)
{
$options = [];
$options['client_secret'] = $this->client_secret;
$options['redirect_uri'] = $redirect_uri;
$options['code'] = $code;
$options['grant_type'] = 'authorization_code';
return $this->oauth... | [
"public",
"function",
"code_exchange",
"(",
"$",
"code",
",",
"$",
"redirect_uri",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"$",
"options",
"[",
"'client_secret'",
"]",
"=",
"$",
"this",
"->",
"client_secret",
";",
"$",
"options",
"[",
"'redirect_ur... | Makes a call to the `oauth/token` endpoint with `authorization_code` grant type
@param string $code Authorization code received during login.
@param string $redirect_uri Redirect URI sent with authorize request.
@return mixed
@throws ApiException If grant_type is missing. | [
"Makes",
"a",
"call",
"to",
"the",
"oauth",
"/",
"token",
"endpoint",
"with",
"authorization_code",
"grant",
"type"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L387-L397 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.login | public function login(array $options, $ip_address = null)
{
if (! isset($options['username'])) {
throw new ApiException('username is mandatory');
}
if (! isset($options['password'])) {
throw new ApiException('password is mandatory');
}
if (! isset($o... | php | public function login(array $options, $ip_address = null)
{
if (! isset($options['username'])) {
throw new ApiException('username is mandatory');
}
if (! isset($options['password'])) {
throw new ApiException('password is mandatory');
}
if (! isset($o... | [
"public",
"function",
"login",
"(",
"array",
"$",
"options",
",",
"$",
"ip_address",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'username'",
"]",
")",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"'username is mandatory'... | Makes a call to the `oauth/token` endpoint with `password-realm` grant type.
@param array $options Options for this grant.
- options.username Username or email of the user logging in; required.
- options.password Password of the user logging in; required.
- options.realm Database realm to use; required.
- ... | [
"Makes",
"a",
"call",
"to",
"the",
"oauth",
"/",
"token",
"endpoint",
"with",
"password",
"-",
"realm",
"grant",
"type",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L414-L435 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.client_credentials | public function client_credentials(array $options)
{
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
if (empty($options['client_secret'])) {
throw new ApiException('client_secret is mandatory');
}
if (! i... | php | public function client_credentials(array $options)
{
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
if (empty($options['client_secret'])) {
throw new ApiException('client_secret is mandatory');
}
if (! i... | [
"public",
"function",
"client_credentials",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'client_secret'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'client_secret'",
"]",
"=",
"$",
"this",
"->",
"client_sec... | Makes a call to the `oauth/token` endpoint with `client_credentials` grant type.
TODO: MAJOR - Add a new ApiException for missing audience.
@param array $options Information required for this grant.
- options.client_id Application Client ID.
- options.client_secret Application Client Secret.
- options.audience ... | [
"Makes",
"a",
"call",
"to",
"the",
"oauth",
"/",
"token",
"endpoint",
"with",
"client_credentials",
"grant",
"type",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L488-L513 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.refresh_token | public function refresh_token($refresh_token, array $options = [])
{
if (empty($refresh_token)) {
throw new ApiException('Refresh token cannot be blank');
}
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
... | php | public function refresh_token($refresh_token, array $options = [])
{
if (empty($refresh_token)) {
throw new ApiException('Refresh token cannot be blank');
}
if (! isset($options['client_secret'])) {
$options['client_secret'] = $this->client_secret;
}
... | [
"public",
"function",
"refresh_token",
"(",
"$",
"refresh_token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"refresh_token",
")",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"'Refresh token cannot be blank'",
")"... | Use a refresh token grant to get new tokens.
@param string $refresh_token Refresh token to use.
@param array $options Array of options to override defaults.
@return mixed
@throws ApiException If $refresh_token, client_secret, or client_id is blank.
@link https://auth0.com/docs/api/authentication#refresh-toke... | [
"Use",
"a",
"refresh",
"token",
"grant",
"to",
"get",
"new",
"tokens",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L527-L553 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.dbconnections_signup | public function dbconnections_signup($email, $password, $connection)
{
$data = [
'client_id' => $this->client_id,
'email' => $email,
'password' => $password,
'connection' => $connection,
];
return $this->apiClient->post()
->dbconnectio... | php | public function dbconnections_signup($email, $password, $connection)
{
$data = [
'client_id' => $this->client_id,
'email' => $email,
'password' => $password,
'connection' => $connection,
];
return $this->apiClient->post()
->dbconnectio... | [
"public",
"function",
"dbconnections_signup",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"connection",
")",
"{",
"$",
"data",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"client_id",
",",
"'email'",
"=>",
"$",
"email",
",",
"'password'",
"=... | Create a new user using active authentication.
This endpoint only works for database connections.
@param string $email Email for the user signing up.
@param string $password New password for the user signing up.
@param string $connection Database connection to create the user in.
@return mixed
@link https://a... | [
"Create",
"a",
"new",
"user",
"using",
"active",
"authentication",
".",
"This",
"endpoint",
"only",
"works",
"for",
"database",
"connections",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L567-L582 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.dbconnections_change_password | public function dbconnections_change_password(
$email,
$connection,
$password = null
)
{
$data = [
'client_id' => $this->client_id,
'email' => $email,
'connection' => $connection,
];
if ($password !== null) {
$data[... | php | public function dbconnections_change_password(
$email,
$connection,
$password = null
)
{
$data = [
'client_id' => $this->client_id,
'email' => $email,
'connection' => $connection,
];
if ($password !== null) {
$data[... | [
"public",
"function",
"dbconnections_change_password",
"(",
"$",
"email",
",",
"$",
"connection",
",",
"$",
"password",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"client_id",
",",
"'email'",
"=>",
"$",
"email",
... | Send a change password email.
This endpoint only works for database connections.
@param string $email Email for the user changing their password.
@param string $connection The name of the database connection this user is in.
@param null|string $password New password to use.
If this parameter is provid... | [
"Send",
"a",
"change",
"password",
"email",
".",
"This",
"endpoint",
"only",
"works",
"for",
"database",
"connections",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L599-L621 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.setApiClient | protected function setApiClient()
{
$apiDomain = "https://{$this->domain}";
$client = new ApiClient(
[
'domain' => $apiDomain,
'basePath' => '/',
'guzzleOptions' => $this->guzzleOptions
]
);
$this->apiClient = ... | php | protected function setApiClient()
{
$apiDomain = "https://{$this->domain}";
$client = new ApiClient(
[
'domain' => $apiDomain,
'basePath' => '/',
'guzzleOptions' => $this->guzzleOptions
]
);
$this->apiClient = ... | [
"protected",
"function",
"setApiClient",
"(",
")",
"{",
"$",
"apiDomain",
"=",
"\"https://{$this->domain}\"",
";",
"$",
"client",
"=",
"new",
"ApiClient",
"(",
"[",
"'domain'",
"=>",
"$",
"apiDomain",
",",
"'basePath'",
"=>",
"'/'",
",",
"'guzzleOptions'",
"=>... | Set an ApiClient for use in this object
@deprecated 5.4.0, not used.
@return void
@codeCoverageIgnore - Deprecated | [
"Set",
"an",
"ApiClient",
"for",
"use",
"in",
"this",
"object"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L637-L650 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.impersonate | public function impersonate(
$access_token,
$user_id,
$protocol,
$impersonator_id,
$client_id,
array $additionalParameters = []
)
{
$data = [
'protocol' => $protocol,
'impersonator_id' => $impersonator_id,
'client_id' =>... | php | public function impersonate(
$access_token,
$user_id,
$protocol,
$impersonator_id,
$client_id,
array $additionalParameters = []
)
{
$data = [
'protocol' => $protocol,
'impersonator_id' => $impersonator_id,
'client_id' =>... | [
"public",
"function",
"impersonate",
"(",
"$",
"access_token",
",",
"$",
"user_id",
",",
"$",
"protocol",
",",
"$",
"impersonator_id",
",",
"$",
"client_id",
",",
"array",
"$",
"additionalParameters",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'pro... | Obtain an impersonation URL to login as another user.
Impersonation functionality may be disabled by default for your tenant.
@deprecated 5.4.0, legacy authentication pipeline, no alternative provided.
@param string $access_token
@param string $user_id
@param string $protocol
@param string $impersonator_id
@param str... | [
"Obtain",
"an",
"impersonation",
"URL",
"to",
"login",
"as",
"another",
"user",
".",
"Impersonation",
"functionality",
"may",
"be",
"disabled",
"by",
"default",
"for",
"your",
"tenant",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L711-L734 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.authorize_with_accesstoken | public function authorize_with_accesstoken(
$access_token,
$connection,
$scope = 'openid',
array $additional_params = []
)
{
$data = array_merge(
$additional_params,
[
'client_id' => $this->client_id,
'access_token' ... | php | public function authorize_with_accesstoken(
$access_token,
$connection,
$scope = 'openid',
array $additional_params = []
)
{
$data = array_merge(
$additional_params,
[
'client_id' => $this->client_id,
'access_token' ... | [
"public",
"function",
"authorize_with_accesstoken",
"(",
"$",
"access_token",
",",
"$",
"connection",
",",
"$",
"scope",
"=",
"'openid'",
",",
"array",
"$",
"additional_params",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"additional_... | Authorize using an access token
@deprecated - 5.1.1, This feature is disabled by default for new tenants as of 8 June
2017. Open the browser to do social authentication instead, which is
what Google and Facebook are recommending.
@param string $access_token
@param string $connection
@param string $scope
@param array ... | [
"Authorize",
"using",
"an",
"access",
"token"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L756-L779 |
auth0/auth0-PHP | src/API/Authentication.php | Authentication.authorize_with_ro | public function authorize_with_ro(
$username,
$password,
$scope = 'openid',
$connection = null,
$id_token = null,
$device = null
)
{
$data = [
'client_id' => $this->client_id,
'username' => $username,
'password' => $pass... | php | public function authorize_with_ro(
$username,
$password,
$scope = 'openid',
$connection = null,
$id_token = null,
$device = null
)
{
$data = [
'client_id' => $this->client_id,
'username' => $username,
'password' => $pass... | [
"public",
"function",
"authorize_with_ro",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"scope",
"=",
"'openid'",
",",
"$",
"connection",
"=",
"null",
",",
"$",
"id_token",
"=",
"null",
",",
"$",
"device",
"=",
"null",
")",
"{",
"$",
"data",
... | DEPRECATED - This endpoint is part of the legacy authentication pipeline and
has been replaced in favor of the Password Grant. For more information on the
latest authentication pipeline refer to Introducing OIDC Conformant
Authentication.
@deprecated 5.0.0, use `login` instead. Use only for passwordless verify
@param... | [
"DEPRECATED",
"-",
"This",
"endpoint",
"is",
"part",
"of",
"the",
"legacy",
"authentication",
"pipeline",
"and",
"has",
"been",
"replaced",
"in",
"favor",
"of",
"the",
"Password",
"Grant",
".",
"For",
"more",
"information",
"on",
"the",
"latest",
"authenticati... | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Authentication.php#L805-L844 |
auth0/auth0-PHP | src/API/Management/ClientGrants.php | ClientGrants.getAll | public function getAll(array $params = [], $page = null, $per_page = null)
{
if (null !== $page) {
$params['page'] = abs((int) $page);
}
if (null !== $per_page) {
$params['per_page'] = abs((int) $per_page);
}
return $this->apiClient->method('get')
... | php | public function getAll(array $params = [], $page = null, $per_page = null)
{
if (null !== $page) {
$params['page'] = abs((int) $page);
}
if (null !== $per_page) {
$params['per_page'] = abs((int) $per_page);
}
return $this->apiClient->method('get')
... | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"page",
"=",
"null",
",",
"$",
"per_page",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"page",
")",
"{",
"$",
"params",
"[",
"'page'",
"]",
"=",
"ab... | Get all Client Grants, by page if desired.
Required scope: "read:client_grants"
@param array $params Additional URL parameters to send:
- "audience" to filter be a specific API audience identifier.
- "client_id" to return an object.
- "include_totals" to return an object.
@param null|integer $page The pag... | [
"Get",
"all",
"Client",
"Grants",
"by",
"page",
"if",
"desired",
".",
"Required",
"scope",
":",
"read",
":",
"client_grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/ClientGrants.php#L33-L47 |
auth0/auth0-PHP | src/API/Management/ClientGrants.php | ClientGrants.getByAudience | public function getByAudience($audience, $page = null, $per_page = null)
{
if (empty($audience) || ! is_string($audience)) {
throw new CoreException('Empty or invalid "audience" parameter.');
}
return $this->getAll(['audience' => $audience], $page, $per_page);
} | php | public function getByAudience($audience, $page = null, $per_page = null)
{
if (empty($audience) || ! is_string($audience)) {
throw new CoreException('Empty or invalid "audience" parameter.');
}
return $this->getAll(['audience' => $audience], $page, $per_page);
} | [
"public",
"function",
"getByAudience",
"(",
"$",
"audience",
",",
"$",
"page",
"=",
"null",
",",
"$",
"per_page",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"audience",
")",
"||",
"!",
"is_string",
"(",
"$",
"audience",
")",
")",
"{",
"th... | Get Client Grants by audience.
Required scope: "read:client_grants"
@param string $audience API Audience to filter by.
@param null|integer $page The page number, zero based.
@param null|integer $per_page The amount of entries per page.
@return mixed
@throws CoreException Thrown when $audience is empty or n... | [
"Get",
"Client",
"Grants",
"by",
"audience",
".",
"Required",
"scope",
":",
"read",
":",
"client_grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/ClientGrants.php#L64-L71 |
auth0/auth0-PHP | src/API/Management/ClientGrants.php | ClientGrants.create | public function create($client_id, $audience, array $scope = [])
{
if (empty($client_id) || ! is_string($client_id)) {
throw new CoreException('Empty or invalid "client_id" parameter.');
}
if (empty($audience) || ! is_string($audience)) {
throw new CoreException('Emp... | php | public function create($client_id, $audience, array $scope = [])
{
if (empty($client_id) || ! is_string($client_id)) {
throw new CoreException('Empty or invalid "client_id" parameter.');
}
if (empty($audience) || ! is_string($audience)) {
throw new CoreException('Emp... | [
"public",
"function",
"create",
"(",
"$",
"client_id",
",",
"$",
"audience",
",",
"array",
"$",
"scope",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"client_id",
")",
"||",
"!",
"is_string",
"(",
"$",
"client_id",
")",
")",
"{",
"throw",... | Create a new Client Grant.
Required scope: "create:client_grants"
@param string $client_id Client ID to receive the grant.
@param string $audience Audience identifier for the API being granted.
@param array $scope Array of scopes for the grant.
@return mixed
@throws CoreException Thrown when $client_id or $aud... | [
"Create",
"a",
"new",
"Client",
"Grant",
".",
"Required",
"scope",
":",
"create",
":",
"client_grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/ClientGrants.php#L112-L130 |
auth0/auth0-PHP | src/API/Management/ClientGrants.php | ClientGrants.get | public function get($id, $audience = null)
{
$request = $this->apiClient->get()
->addPath('client-grants');
if ($audience !== null) {
$request = $request->withParam('audience', $audience);
}
return $request->call();
} | php | public function get($id, $audience = null)
{
$request = $this->apiClient->get()
->addPath('client-grants');
if ($audience !== null) {
$request = $request->withParam('audience', $audience);
}
return $request->call();
} | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"audience",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"apiClient",
"->",
"get",
"(",
")",
"->",
"addPath",
"(",
"'client-grants'",
")",
";",
"if",
"(",
"$",
"audience",
"!=... | Get a Client Grant.
@deprecated 5.4.0, no such endpoint.
@param string $id Client Grant ID.
@param null|string $audience Client Grant audience to filter by.
@return mixed
@throws \Exception Thrown by the HTTP client when there is a problem with the API call.
@codeCoverageIgnore - Deprecated. | [
"Get",
"a",
"Client",
"Grant",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/ClientGrants.php#L192-L202 |
auth0/auth0-PHP | src/Store/SessionStore.php | SessionStore.set | public function set($key, $value)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
$_SESSION[$key_name] = $value;
} | php | public function set($key, $value)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
$_SESSION[$key_name] = $value;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"initSession",
"(",
")",
";",
"$",
"key_name",
"=",
"$",
"this",
"->",
"getSessionKeyName",
"(",
"$",
"key",
")",
";",
"$",
"_SESSION",
"[",
"$",
"key_nam... | Persists $value on $_SESSION, identified by $key.
@param string $key Session key to set.
@param mixed $value Value to use.
@return void | [
"Persists",
"$value",
"on",
"$_SESSION",
"identified",
"by",
"$key",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/Store/SessionStore.php#L73-L78 |
auth0/auth0-PHP | src/Store/SessionStore.php | SessionStore.get | public function get($key, $default = null)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
if (isset($_SESSION[$key_name])) {
return $_SESSION[$key_name];
} else {
return $default;
}
} | php | public function get($key, $default = null)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
if (isset($_SESSION[$key_name])) {
return $_SESSION[$key_name];
} else {
return $default;
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"initSession",
"(",
")",
";",
"$",
"key_name",
"=",
"$",
"this",
"->",
"getSessionKeyName",
"(",
"$",
"key",
")",
";",
"if",
"(",
"isset",
... | Gets persisted values identified by $key.
If the value is not set, returns $default.
@param string $key Session key to set.
@param mixed $default Default to return if nothing was found.
@return mixed | [
"Gets",
"persisted",
"values",
"identified",
"by",
"$key",
".",
"If",
"the",
"value",
"is",
"not",
"set",
"returns",
"$default",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/Store/SessionStore.php#L89-L99 |
auth0/auth0-PHP | src/Store/SessionStore.php | SessionStore.delete | public function delete($key)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
unset($_SESSION[$key_name]);
} | php | public function delete($key)
{
$this->initSession();
$key_name = $this->getSessionKeyName($key);
unset($_SESSION[$key_name]);
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"initSession",
"(",
")",
";",
"$",
"key_name",
"=",
"$",
"this",
"->",
"getSessionKeyName",
"(",
"$",
"key",
")",
";",
"unset",
"(",
"$",
"_SESSION",
"[",
"$",
"key_name",
... | Removes a persisted value identified by $key.
@param string $key Session key to delete.
@return void | [
"Removes",
"a",
"persisted",
"value",
"identified",
"by",
"$key",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/Store/SessionStore.php#L108-L113 |
auth0/auth0-PHP | src/Store/SessionStore.php | SessionStore.getSessionKeyName | public function getSessionKeyName($key)
{
$key_name = $key;
if (! empty( $this->session_base_name )) {
$key_name = $this->session_base_name.'_'.$key_name;
}
return $key_name;
} | php | public function getSessionKeyName($key)
{
$key_name = $key;
if (! empty( $this->session_base_name )) {
$key_name = $this->session_base_name.'_'.$key_name;
}
return $key_name;
} | [
"public",
"function",
"getSessionKeyName",
"(",
"$",
"key",
")",
"{",
"$",
"key_name",
"=",
"$",
"key",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"session_base_name",
")",
")",
"{",
"$",
"key_name",
"=",
"$",
"this",
"->",
"session_base_nam... | Constructs a session key name.
@param string $key Session key name to prefix and return.
@return string | [
"Constructs",
"a",
"session",
"key",
"name",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/Store/SessionStore.php#L122-L130 |
auth0/auth0-PHP | src/API/Helpers/RequestBuilder.php | RequestBuilder.addPath | public function addPath($name, $argument = null)
{
$this->path[] = $name;
if ($argument !== null) {
$this->path[] = $argument;
}
return $this;
} | php | public function addPath($name, $argument = null)
{
$this->path[] = $name;
if ($argument !== null) {
$this->path[] = $argument;
}
return $this;
} | [
"public",
"function",
"addPath",
"(",
"$",
"name",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"path",
"[",
"]",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"argument",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"path",
"[",
"]"... | Add a path and an optional argument to this request.
@param string $name Path to add.
@param string|null $argument Optional argument to add.
@return RequestBuilder | [
"Add",
"a",
"path",
"and",
"an",
"optional",
"argument",
"to",
"this",
"request",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/RequestBuilder.php#L154-L162 |
auth0/auth0-PHP | src/API/Helpers/RequestBuilder.php | RequestBuilder.getParams | public function getParams()
{
if (empty($this->params)) {
return '';
}
$params = array_map(function ($key, $value) {
return "$key=$value";
}, array_keys($this->params), $this->params);
return '?'.implode('&', $params);
} | php | public function getParams()
{
if (empty($this->params)) {
return '';
}
$params = array_map(function ($key, $value) {
return "$key=$value";
}, array_keys($this->params), $this->params);
return '?'.implode('&', $params);
} | [
"public",
"function",
"getParams",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"params",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"params",
"=",
"array_map",
"(",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"retu... | Output a URL
@return string | [
"Output",
"a",
"URL"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/RequestBuilder.php#L192-L203 |
auth0/auth0-PHP | src/API/Helpers/RequestBuilder.php | RequestBuilder.withDictParams | public function withDictParams($params)
{
foreach ($params as $key => $value) {
$this->withParam($key, $value);
}
return $this;
} | php | public function withDictParams($params)
{
foreach ($params as $key => $value) {
$this->withParam($key, $value);
}
return $this;
} | [
"public",
"function",
"withDictParams",
"(",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"withParam",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
... | Add URL parameters using $key => $value array.
@param array $params - URL parameters to add.
@return RequestBuilder | [
"Add",
"URL",
"parameters",
"using",
"$key",
"=",
">",
"$value",
"array",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/RequestBuilder.php#L387-L394 |
auth0/auth0-PHP | src/API/Management/Connections.php | Connections.getAll | public function getAll(
$strategy = null,
$fields = null,
$include_fields = null,
$page = null,
$per_page = null,
array $add_params = []
)
{
// Set additional parameters first so they are over-written by function parameters.
$params = is_array($add... | php | public function getAll(
$strategy = null,
$fields = null,
$include_fields = null,
$page = null,
$per_page = null,
array $add_params = []
)
{
// Set additional parameters first so they are over-written by function parameters.
$params = is_array($add... | [
"public",
"function",
"getAll",
"(",
"$",
"strategy",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"include_fields",
"=",
"null",
",",
"$",
"page",
"=",
"null",
",",
"$",
"per_page",
"=",
"null",
",",
"array",
"$",
"add_params",
"=",
"[",
... | Get all Connections by page.
Required scope: "read:connections"
@param null|string $strategy Connection strategy to retrieve.
@param null|string|array $fields Fields to include or exclude from the result.
- Including only the fields required can speed up API calls significantly.
- Arrays will be co... | [
"Get",
"all",
"Connections",
"by",
"page",
".",
"Required",
"scope",
":",
"read",
":",
"connections"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Connections.php#L32-L69 |
auth0/auth0-PHP | src/API/Management/Connections.php | Connections.deleteUser | public function deleteUser($id, $email)
{
return $this->apiClient->method('delete')
->addPath('connections', $id)
->addPath('users')
->withParam('email', $email)
->call();
} | php | public function deleteUser($id, $email)
{
return $this->apiClient->method('delete')
->addPath('connections', $id)
->addPath('users')
->withParam('email', $email)
->call();
} | [
"public",
"function",
"deleteUser",
"(",
"$",
"id",
",",
"$",
"email",
")",
"{",
"return",
"$",
"this",
"->",
"apiClient",
"->",
"method",
"(",
"'delete'",
")",
"->",
"addPath",
"(",
"'connections'",
",",
"$",
"id",
")",
"->",
"addPath",
"(",
"'users'"... | Delete a specific User for a Connection.
Required scope: "delete:users"
@param string $id Auth0 database Connection ID (user_id with strategy of "auth0").
@param string $email Email of the user to delete.
@return mixed|string
@throws \Exception Thrown by the HTTP client when there is a problem with the API call.
... | [
"Delete",
"a",
"specific",
"User",
"for",
"a",
"Connection",
".",
"Required",
"scope",
":",
"delete",
":",
"users"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Connections.php#L137-L144 |
auth0/auth0-PHP | src/API/Management/Connections.php | Connections.create | public function create(array $data)
{
if (empty($data['name'])) {
throw new \Exception('Missing required "name" field.');
}
if (empty($data['strategy'])) {
throw new \Exception('Missing required "strategy" field.');
}
return $this->apiClient->method(... | php | public function create(array $data)
{
if (empty($data['name'])) {
throw new \Exception('Missing required "name" field.');
}
if (empty($data['strategy'])) {
throw new \Exception('Missing required "strategy" field.');
}
return $this->apiClient->method(... | [
"public",
"function",
"create",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"[",
"'name'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Missing required \"name\" field.'",
")",
";",
"}",
"if",
"(",
"empty... | Create a new Connection.
Required scope: "create:connections"
@param array $data Connection create data; "name" and "strategy" fields are required.
@return mixed|string
@throws \Exception Thrown by the HTTP client when there is a problem with the API call.
@link https://auth0.com/docs/api/management/v2#!/Connection... | [
"Create",
"a",
"new",
"Connection",
".",
"Required",
"scope",
":",
"create",
":",
"connections"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Connections.php#L158-L172 |
auth0/auth0-PHP | src/API/Management/Rules.php | Rules.get | public function get($id, $fields = null, $include_fields = null)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
$params = [];
// Fields to include or exclude from results.
if (! empty($fields)) {
$params... | php | public function get($id, $fields = null, $include_fields = null)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
$params = [];
// Fields to include or exclude from results.
if (! empty($fields)) {
$params... | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"include_fields",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"!",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"Co... | Get a single rule by ID.
Required scope: "read:rules"
@param string $id Rule ID to get.
@param null|string|array $fields Fields to include or exclude from the result.
@param null|boolean $include_fields True to include $fields, false to exclude $fields.
@return mixed
@throws CoreE... | [
"Get",
"a",
"single",
"rule",
"by",
"ID",
".",
"Required",
"scope",
":",
"read",
":",
"rules"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Rules.php#L78-L98 |
auth0/auth0-PHP | src/API/Management/Rules.php | Rules.delete | public function delete($id)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
return $this->apiClient->method('delete')
->addPath('rules', $id)
->call();
} | php | public function delete($id)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
return $this->apiClient->method('delete')
->addPath('rules', $id)
->call();
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"!",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"'Invalid \"id\" parameter.'",
")",
";",
"}",
"return",
"$... | Delete a rule by ID.
Required scope: "delete:rules"
@param string $id Rule ID to delete.
@return mixed
@throws CoreException Thrown when $id is empty or not a string.
@throws \Exception Thrown by the HTTP client when there is a problem with the API call.
@link https://auth0.com/docs/api/management/v2#!/Rules/delete... | [
"Delete",
"a",
"rule",
"by",
"ID",
".",
"Required",
"scope",
":",
"delete",
":",
"rules"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Rules.php#L113-L122 |
auth0/auth0-PHP | src/API/Management/ResourceServers.php | ResourceServers.update | public function update($id, array $data)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
return $this->apiClient->method('patch')
->addPath('resource-servers', $id)
->withBody(json_encode($data))
-... | php | public function update($id, array $data)
{
if (empty($id) || ! is_string($id)) {
throw new CoreException('Invalid "id" parameter.');
}
return $this->apiClient->method('patch')
->addPath('resource-servers', $id)
->withBody(json_encode($data))
-... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"!",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"'Invalid \"id\" parameter.'",
... | Update a Resource Server by ID.
Required scope: "update:resource_servers"
@param string $id Resource Server ID or identifier to update.
@param array $data Data to update.
@return mixed
@throws CoreException Thrown if the id parameter is empty or is not a string.
@throws \Exception Thrown by the HTTP client when t... | [
"Update",
"a",
"Resource",
"Server",
"by",
"ID",
".",
"Required",
"scope",
":",
"update",
":",
"resource_servers"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/ResourceServers.php#L140-L150 |
auth0/auth0-PHP | src/API/Helpers/TokenGenerator.php | TokenGenerator.generate | public function generate(array $scopes, $lifetime = self::DEFAULT_LIFETIME, $secret_encoded = true)
{
$time = time();
$payload = [
'iat' => $time,
'scopes' => $scopes,
'exp' => $time + $lifetime,
'aud' => $this->audience,
];
... | php | public function generate(array $scopes, $lifetime = self::DEFAULT_LIFETIME, $secret_encoded = true)
{
$time = time();
$payload = [
'iat' => $time,
'scopes' => $scopes,
'exp' => $time + $lifetime,
'aud' => $this->audience,
];
... | [
"public",
"function",
"generate",
"(",
"array",
"$",
"scopes",
",",
"$",
"lifetime",
"=",
"self",
"::",
"DEFAULT_LIFETIME",
",",
"$",
"secret_encoded",
"=",
"true",
")",
"{",
"$",
"time",
"=",
"time",
"(",
")",
";",
"$",
"payload",
"=",
"[",
"'iat'",
... | Create the ID token.
@param array $scopes Array of scopes to include.
@param integer $lifetime Lifetime of the token, in seconds.
@param boolean $secret_encoded True to base64 decode the client secret.
@return string | [
"Create",
"the",
"ID",
"token",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/TokenGenerator.php#L54-L68 |
auth0/auth0-PHP | src/API/Management/EmailTemplates.php | EmailTemplates.patch | public function patch($templateName, $data)
{
return $this->apiClient->method('patch')
->addPath('email-templates', $templateName)
->withBody(json_encode($data))
->call();
} | php | public function patch($templateName, $data)
{
return $this->apiClient->method('patch')
->addPath('email-templates', $templateName)
->withBody(json_encode($data))
->call();
} | [
"public",
"function",
"patch",
"(",
"$",
"templateName",
",",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"apiClient",
"->",
"method",
"(",
"'patch'",
")",
"->",
"addPath",
"(",
"'email-templates'",
",",
"$",
"templateName",
")",
"->",
"withBody",
... | Patch an email template by name.
This will update only the email template data fields provided (see HTTP PATCH).
See docs @link below for valid names, fields, and possible responses.
Required scope: "update:email_templates"
@param string $templateName - the email template name to patch (see constants defined for this ... | [
"Patch",
"an",
"email",
"template",
"by",
"name",
".",
"This",
"will",
"update",
"only",
"the",
"email",
"template",
"data",
"fields",
"provided",
"(",
"see",
"HTTP",
"PATCH",
")",
".",
"See",
"docs",
"@link",
"below",
"for",
"valid",
"names",
"fields",
... | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/EmailTemplates.php#L107-L113 |
auth0/auth0-PHP | src/API/Management/EmailTemplates.php | EmailTemplates.create | public function create(
$template,
$enabled,
$from,
$subject,
$body,
$syntax = 'liquid',
$resultUrl = '',
$urlLifetime = 0
)
{
// Required fields
$data = [
'template' => (string) $template,
'enabled' => (bool... | php | public function create(
$template,
$enabled,
$from,
$subject,
$body,
$syntax = 'liquid',
$resultUrl = '',
$urlLifetime = 0
)
{
// Required fields
$data = [
'template' => (string) $template,
'enabled' => (bool... | [
"public",
"function",
"create",
"(",
"$",
"template",
",",
"$",
"enabled",
",",
"$",
"from",
",",
"$",
"subject",
",",
"$",
"body",
",",
"$",
"syntax",
"=",
"'liquid'",
",",
"$",
"resultUrl",
"=",
"''",
",",
"$",
"urlLifetime",
"=",
"0",
")",
"{",
... | Create an email template by name.
See docs @link below for valid names and fields.
Required scope: "create:email_templates"
@param string $template - the template name to create (see constants defined for this class).
@param boolean $enabled - is the email template enabled?
@param string $from - the em... | [
"Create",
"an",
"email",
"template",
"by",
"name",
".",
"See",
"docs",
"@link",
"below",
"for",
"valid",
"names",
"and",
"fields",
".",
"Required",
"scope",
":",
"create",
":",
"email_templates"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/EmailTemplates.php#L135-L165 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.dontPersist | private function dontPersist($name)
{
$key = array_search($name, $this->persistantMap);
if ($key !== false) {
unset($this->persistantMap[$key]);
}
} | php | private function dontPersist($name)
{
$key = array_search($name, $this->persistantMap);
if ($key !== false) {
unset($this->persistantMap[$key]);
}
} | [
"private",
"function",
"dontPersist",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"persistantMap",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->"... | Removes $name from the persistantMap, thus not persisting it when we set the value
@param string $name The value to remove | [
"Removes",
"$name",
"from",
"the",
"persistantMap",
"thus",
"not",
"persisting",
"it",
"when",
"we",
"set",
"the",
"value"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L242-L248 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.exchangeCode | public function exchangeCode()
{
$code = isset($_GET['code']) ? $_GET['code'] : (isset($_POST['code']) ? $_POST['code'] : null);
if (! isset($code)) {
$this->debugInfo('No code found in _GET or _POST params.');
return false;
}
$this->debugInfo('Code: '.$code... | php | public function exchangeCode()
{
$code = isset($_GET['code']) ? $_GET['code'] : (isset($_POST['code']) ? $_POST['code'] : null);
if (! isset($code)) {
$this->debugInfo('No code found in _GET or _POST params.');
return false;
}
$this->debugInfo('Code: '.$code... | [
"public",
"function",
"exchangeCode",
"(",
")",
"{",
"$",
"code",
"=",
"isset",
"(",
"$",
"_GET",
"[",
"'code'",
"]",
")",
"?",
"$",
"_GET",
"[",
"'code'",
"]",
":",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'code'",
"]",
")",
"?",
"$",
"_POST",
"... | Exchanges the code from the URI parameters for an access token, id token and user info
@return boolean Whether it exchanged the code or not correctly
@throws ApiException | [
"Exchanges",
"the",
"code",
"from",
"the",
"URI",
"parameters",
"for",
"an",
"access",
"token",
"id",
"token",
"and",
"user",
"info"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L256-L316 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.getUser | public function getUser()
{
// Ensure we have the user info
if ($this->user === null) {
$this->exchangeCode();
}
if (! is_array($this->user)) {
return null;
}
return $this->user;
} | php | public function getUser()
{
// Ensure we have the user info
if ($this->user === null) {
$this->exchangeCode();
}
if (! is_array($this->user)) {
return null;
}
return $this->user;
} | [
"public",
"function",
"getUser",
"(",
")",
"{",
"// Ensure we have the user info",
"if",
"(",
"$",
"this",
"->",
"user",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"exchangeCode",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",... | Requests user info to Auth0 server.
@return array
@throws ApiException | [
"Requests",
"user",
"info",
"to",
"Auth0",
"server",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L325-L337 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.updateUserMetadata | public function updateUserMetadata($metadata)
{
$auth0Api = new Auth0Api($this->getIdToken(), $this->domain);
$user = $auth0Api->users->update($this->user['user_id'], ['user_metadata' => $metadata]);
$this->setUser($user);
} | php | public function updateUserMetadata($metadata)
{
$auth0Api = new Auth0Api($this->getIdToken(), $this->domain);
$user = $auth0Api->users->update($this->user['user_id'], ['user_metadata' => $metadata]);
$this->setUser($user);
} | [
"public",
"function",
"updateUserMetadata",
"(",
"$",
"metadata",
")",
"{",
"$",
"auth0Api",
"=",
"new",
"Auth0Api",
"(",
"$",
"this",
"->",
"getIdToken",
"(",
")",
",",
"$",
"this",
"->",
"domain",
")",
";",
"$",
"user",
"=",
"$",
"auth0Api",
"->",
... | Updates the user metadata. This end up calling the path /users/{id_user}
To delete an attribute, just set it null. ie: [ 'old_attr' => null ]
It will only update the existing attrs and keep the others untouched
@see https://auth0.com/docs/apiv2#!/users/patch_users_by_id
@param array $metadata
@throws ApiException | [
"Updates",
"the",
"user",
"metadata",
".",
"This",
"end",
"up",
"calling",
"the",
"path",
"/",
"users",
"/",
"{",
"id_user",
"}",
"To",
"delete",
"an",
"attribute",
"just",
"set",
"it",
"null",
".",
"ie",
":",
"[",
"old_attr",
"=",
">",
"null",
"]",
... | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L350-L357 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.setAccessToken | public function setAccessToken($access_token)
{
$key = array_search('access_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('access_token', $access_token);
}
$this->access_token = $access_token;
return $this;
} | php | public function setAccessToken($access_token)
{
$key = array_search('access_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('access_token', $access_token);
}
$this->access_token = $access_token;
return $this;
} | [
"public",
"function",
"setAccessToken",
"(",
"$",
"access_token",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"'access_token'",
",",
"$",
"this",
"->",
"persistantMap",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"... | Sets and persists $access_token.
@param string $access_token
@return Oauth2Client | [
"Sets",
"and",
"persists",
"$access_token",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L401-L411 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.setRefreshToken | public function setRefreshToken($refresh_token)
{
$key = array_search('refresh_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('refresh_token', $refresh_token);
}
$this->refresh_token = $refresh_token;
return $this;
} | php | public function setRefreshToken($refresh_token)
{
$key = array_search('refresh_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('refresh_token', $refresh_token);
}
$this->refresh_token = $refresh_token;
return $this;
} | [
"public",
"function",
"setRefreshToken",
"(",
"$",
"refresh_token",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"'refresh_token'",
",",
"$",
"this",
"->",
"persistantMap",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
... | Sets and persists $refresh_token.
@param string $refresh_token
@return Oauth2Client | [
"Sets",
"and",
"persists",
"$refresh_token",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L420-L430 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.setIdToken | public function setIdToken($id_token)
{
$key = array_search('id_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('id_token', $id_token);
}
$this->id_token = $id_token;
return $this;
} | php | public function setIdToken($id_token)
{
$key = array_search('id_token', $this->persistantMap);
if ($key !== false) {
$this->store->set('id_token', $id_token);
}
$this->id_token = $id_token;
return $this;
} | [
"public",
"function",
"setIdToken",
"(",
"$",
"id_token",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"'id_token'",
",",
"$",
"this",
"->",
"persistantMap",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"store",
"-... | Sets and persists $id_token.
@param string $id_token
@return Oauth2Client | [
"Sets",
"and",
"persists",
"$id_token",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L465-L475 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.logout | final public function logout()
{
$this->deleteAllPersistentData();
$this->access_token = null;
$this->user = null;
$this->id_token = null;
$this->refresh_token = null;
} | php | final public function logout()
{
$this->deleteAllPersistentData();
$this->access_token = null;
$this->user = null;
$this->id_token = null;
$this->refresh_token = null;
} | [
"final",
"public",
"function",
"logout",
"(",
")",
"{",
"$",
"this",
"->",
"deleteAllPersistentData",
"(",
")",
";",
"$",
"this",
"->",
"access_token",
"=",
"null",
";",
"$",
"this",
"->",
"user",
"=",
"null",
";",
"$",
"this",
"->",
"id_token",
"=",
... | Logout (removes all persistent data) | [
"Logout",
"(",
"removes",
"all",
"persistent",
"data",
")"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L496-L503 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.generateUrl | final protected function generateUrl($domain_key, $path = '/')
{
$base_domain = self::$URL_MAP[$domain_key];
$base_domain = str_replace('{domain}', $this->domain, $base_domain);
if ($path[0] === '/') {
$path = substr($path, 1);
}
return $base_domain.$path;
} | php | final protected function generateUrl($domain_key, $path = '/')
{
$base_domain = self::$URL_MAP[$domain_key];
$base_domain = str_replace('{domain}', $this->domain, $base_domain);
if ($path[0] === '/') {
$path = substr($path, 1);
}
return $base_domain.$path;
} | [
"final",
"protected",
"function",
"generateUrl",
"(",
"$",
"domain_key",
",",
"$",
"path",
"=",
"'/'",
")",
"{",
"$",
"base_domain",
"=",
"self",
"::",
"$",
"URL_MAP",
"[",
"$",
"domain_key",
"]",
";",
"$",
"base_domain",
"=",
"str_replace",
"(",
"'{doma... | Constructs an API URL.
@param string $domain_key
@param string $path
@return string | [
"Constructs",
"an",
"API",
"URL",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L514-L524 |
auth0/auth0-PHP | src/API/Oauth2Client.php | Oauth2Client.debugInfo | public function debugInfo($info)
{
if ($this->debug_mode && (is_object($this->debugger) && ($this->debugger instanceof \Closure))) {
list(, $caller) = debug_backtrace(false);
$caller_function = $caller['function'];
$caller_class = $caller['class'];
$this-... | php | public function debugInfo($info)
{
if ($this->debug_mode && (is_object($this->debugger) && ($this->debugger instanceof \Closure))) {
list(, $caller) = debug_backtrace(false);
$caller_function = $caller['function'];
$caller_class = $caller['class'];
$this-... | [
"public",
"function",
"debugInfo",
"(",
"$",
"info",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"debug_mode",
"&&",
"(",
"is_object",
"(",
"$",
"this",
"->",
"debugger",
")",
"&&",
"(",
"$",
"this",
"->",
"debugger",
"instanceof",
"\\",
"Closure",
")",
... | If debug mode is set, sends $info to debugger \Closure.
@param mixed $info Info to debug. It will be converted to string. | [
"If",
"debug",
"mode",
"is",
"set",
"sends",
"$info",
"to",
"debugger",
"\\",
"Closure",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Oauth2Client.php#L548-L558 |
auth0/auth0-PHP | src/API/Management/Grants.php | Grants.getAll | public function getAll($page = 0, $per_page = null, array $params = [])
{
if (! empty($page)) {
$params['page'] = abs(intval($page));
}
if (! empty($per_page)) {
$params['per_page'] = abs(intval($per_page));
}
return $this->apiClient->method('get')
... | php | public function getAll($page = 0, $per_page = null, array $params = [])
{
if (! empty($page)) {
$params['page'] = abs(intval($page));
}
if (! empty($per_page)) {
$params['per_page'] = abs(intval($per_page));
}
return $this->apiClient->method('get')
... | [
"public",
"function",
"getAll",
"(",
"$",
"page",
"=",
"0",
",",
"$",
"per_page",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"page",
")",
")",
"{",
"$",
"params",
"[",
"'page'",
"]",
... | Get all Grants with pagination.
Required scope: "read:grants"
@param integer $page Page number to return, zero-based.
@param null|integer $per_page Number of results per page, null to return all.
@param array $params Additional URL parameters to send.
@return mixed
@throws \Exception Thrown by the ... | [
"Get",
"all",
"Grants",
"with",
"pagination",
".",
"Required",
"scope",
":",
"read",
":",
"grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Grants.php#L27-L41 |
auth0/auth0-PHP | src/API/Management/Grants.php | Grants.getByClientId | public function getByClientId($client_id, $page = 0, $per_page = null)
{
if (empty($client_id) || ! is_string($client_id)) {
throw new CoreException('Empty or invalid "client_id" parameter.');
}
return $this->getAll($page, $per_page, ['client_id' => $client_id]);
} | php | public function getByClientId($client_id, $page = 0, $per_page = null)
{
if (empty($client_id) || ! is_string($client_id)) {
throw new CoreException('Empty or invalid "client_id" parameter.');
}
return $this->getAll($page, $per_page, ['client_id' => $client_id]);
} | [
"public",
"function",
"getByClientId",
"(",
"$",
"client_id",
",",
"$",
"page",
"=",
"0",
",",
"$",
"per_page",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"client_id",
")",
"||",
"!",
"is_string",
"(",
"$",
"client_id",
")",
")",
"{",
"th... | Get Grants by Client ID with pagination.
Required scope: "read:grants"
@param string $client_id Client ID to filter Grants.
@param integer $page Page number to return, zero-based.
@param null|integer $per_page Number of results per page, null to return all.
@return mixed
@throws CoreException If $cl... | [
"Get",
"Grants",
"by",
"Client",
"ID",
"with",
"pagination",
".",
"Required",
"scope",
":",
"read",
":",
"grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Grants.php#L58-L65 |
auth0/auth0-PHP | src/API/Management/Grants.php | Grants.getByUserId | public function getByUserId($user_id, $page = 0, $per_page = null)
{
if (empty($user_id) || ! is_string($user_id)) {
throw new CoreException('Empty or invalid "user_id" parameter.');
}
return $this->getAll($page, $per_page, ['user_id' => $user_id]);
} | php | public function getByUserId($user_id, $page = 0, $per_page = null)
{
if (empty($user_id) || ! is_string($user_id)) {
throw new CoreException('Empty or invalid "user_id" parameter.');
}
return $this->getAll($page, $per_page, ['user_id' => $user_id]);
} | [
"public",
"function",
"getByUserId",
"(",
"$",
"user_id",
",",
"$",
"page",
"=",
"0",
",",
"$",
"per_page",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"user_id",
")",
"||",
"!",
"is_string",
"(",
"$",
"user_id",
")",
")",
"{",
"throw",
... | Get Grants by User ID with pagination.
Required scope: "read:grants"
@param string $user_id User ID to filter Grants.
@param integer $page Page number to return, zero-based.
@param null|integer $per_page Number of results per page, null to return all.
@return mixed
@throws CoreException If $user_id i... | [
"Get",
"Grants",
"by",
"User",
"ID",
"with",
"pagination",
".",
"Required",
"scope",
":",
"read",
":",
"grants"
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Management/Grants.php#L106-L113 |
auth0/auth0-PHP | src/API/Helpers/ApiClient.php | ApiClient.method | public function method($method)
{
$method = strtolower($method);
$builder = new RequestBuilder([
'domain' => $this->domain,
'basePath' => $this->basePath,
'method' => $method,
'guzzleOptions' => $this->guzzleOptions,
'returnType' => $this-... | php | public function method($method)
{
$method = strtolower($method);
$builder = new RequestBuilder([
'domain' => $this->domain,
'basePath' => $this->basePath,
'method' => $method,
'guzzleOptions' => $this->guzzleOptions,
'returnType' => $this-... | [
"public",
"function",
"method",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"$",
"builder",
"=",
"new",
"RequestBuilder",
"(",
"[",
"'domain'",
"=>",
"$",
"this",
"->",
"domain",
",",
"'basePath'",
"=>"... | Create a new RequestBuilder.
Similar to the above but does not use a magic method.
@param string $method - HTTP method to use (GET, POST, PATCH, etc).
@return RequestBuilder | [
"Create",
"a",
"new",
"RequestBuilder",
".",
"Similar",
"to",
"the",
"above",
"but",
"does",
"not",
"use",
"a",
"magic",
"method",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/ApiClient.php#L88-L105 |
auth0/auth0-PHP | src/API/Helpers/InformationHeaders.php | InformationHeaders.setEnvProperty | public function setEnvProperty($name, $version)
{
if (! isset($this->data['env']) || ! is_array($this->data['env'])) {
$this->data['env'] = [];
}
$this->data['env'][$name] = $version;
} | php | public function setEnvProperty($name, $version)
{
if (! isset($this->data['env']) || ! is_array($this->data['env'])) {
$this->data['env'] = [];
}
$this->data['env'][$name] = $version;
} | [
"public",
"function",
"setEnvProperty",
"(",
"$",
"name",
",",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'env'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"data",
"[",
"'env'",
"]",
")... | Add an optional env property for SDK telemetry.
@param string $name Property name to set, name of dependency or platform.
@param string $version Version number of dependency or platform.
@return void | [
"Add",
"an",
"optional",
"env",
"property",
"for",
"SDK",
"telemetry",
"."
] | train | https://github.com/auth0/auth0-PHP/blob/a5d0d173885c13cb5ce1758de33df68a0d539ffd/src/API/Helpers/InformationHeaders.php#L54-L61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.