id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
207,100 | symfony/symfony | src/Symfony/Component/Routing/RouteCollectionBuilder.php | RouteCollectionBuilder.load | private function load($resource, string $type = null): array
{
if (null === $this->loader) {
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
}
if ($this->loader->supports($reso... | php | private function load($resource, string $type = null): array
{
if (null === $this->loader) {
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
}
if ($this->loader->supports($reso... | [
"private",
"function",
"load",
"(",
"$",
"resource",
",",
"string",
"$",
"type",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"loader",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'Cannot import ot... | Finds a loader able to load an imported resource and loads it.
@param mixed $resource A resource
@param string|null $type The resource type or null if unknown
@return RouteCollection[]
@throws LoaderLoadException If no loader is found | [
"Finds",
"a",
"loader",
"able",
"to",
"load",
"an",
"imported",
"resource",
"and",
"loads",
"it",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L352-L375 |
207,101 | symfony/symfony | src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php | KernelBrowser.getProfile | public function getProfile()
{
if (!$this->kernel->getContainer()->has('profiler')) {
return false;
}
return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->response);
} | php | public function getProfile()
{
if (!$this->kernel->getContainer()->has('profiler')) {
return false;
}
return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->response);
} | [
"public",
"function",
"getProfile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"kernel",
"->",
"getContainer",
"(",
")",
"->",
"has",
"(",
"'profiler'",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"kernel",
"->",
... | Gets the profile associated with the current Response.
@return HttpProfile|false A Profile instance | [
"Gets",
"the",
"profile",
"associated",
"with",
"the",
"current",
"Response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php#L67-L74 |
207,102 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.setDefaultLogger | public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
{
$loggers = [];
if (\is_array($levels)) {
foreach ($levels as $type => $logLevel) {
if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootst... | php | public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
{
$loggers = [];
if (\is_array($levels)) {
foreach ($levels as $type => $logLevel) {
if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootst... | [
"public",
"function",
"setDefaultLogger",
"(",
"LoggerInterface",
"$",
"logger",
",",
"$",
"levels",
"=",
"E_ALL",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"$",
"loggers",
"=",
"[",
"]",
";",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"levels",
")",
... | Sets a logger to non assigned errors levels.
@param LoggerInterface $logger A PSR-3 logger to put as default for the given levels
@param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
@param bool $replace Whether to replace or not any existing logger | [
"Sets",
"a",
"logger",
"to",
"non",
"assigned",
"errors",
"levels",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L179-L202 |
207,103 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.setLoggers | public function setLoggers(array $loggers)
{
$prevLogged = $this->loggedErrors;
$prev = $this->loggers;
$flush = [];
foreach ($loggers as $type => $log) {
if (!isset($prev[$type])) {
throw new \InvalidArgumentException('Unknown error type: '.$type);
... | php | public function setLoggers(array $loggers)
{
$prevLogged = $this->loggedErrors;
$prev = $this->loggers;
$flush = [];
foreach ($loggers as $type => $log) {
if (!isset($prev[$type])) {
throw new \InvalidArgumentException('Unknown error type: '.$type);
... | [
"public",
"function",
"setLoggers",
"(",
"array",
"$",
"loggers",
")",
"{",
"$",
"prevLogged",
"=",
"$",
"this",
"->",
"loggedErrors",
";",
"$",
"prev",
"=",
"$",
"this",
"->",
"loggers",
";",
"$",
"flush",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
... | Sets a logger for each error level.
@param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map
@return array The previous map
@throws \InvalidArgumentException | [
"Sets",
"a",
"logger",
"for",
"each",
"error",
"level",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L213-L255 |
207,104 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.throwAt | public function throwAt($levels, $replace = false)
{
$prev = $this->thrownErrors;
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
if (!$replace) {
$this->thrownErrors |= $prev;
}
$this->reRegister($prev | ... | php | public function throwAt($levels, $replace = false)
{
$prev = $this->thrownErrors;
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
if (!$replace) {
$this->thrownErrors |= $prev;
}
$this->reRegister($prev | ... | [
"public",
"function",
"throwAt",
"(",
"$",
"levels",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"thrownErrors",
";",
"$",
"this",
"->",
"thrownErrors",
"=",
"(",
"$",
"levels",
"|",
"E_RECOVERABLE_ERROR",
"|",
"E_... | Sets the PHP error levels that throw an exception when a PHP error occurs.
@param int $levels A bit field of E_* constants for thrown errors
@param bool $replace Replace or amend the previous value
@return int The previous value | [
"Sets",
"the",
"PHP",
"error",
"levels",
"that",
"throw",
"an",
"exception",
"when",
"a",
"PHP",
"error",
"occurs",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L280-L290 |
207,105 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.scopeAt | public function scopeAt($levels, $replace = false)
{
$prev = $this->scopedErrors;
$this->scopedErrors = (int) $levels;
if (!$replace) {
$this->scopedErrors |= $prev;
}
return $prev;
} | php | public function scopeAt($levels, $replace = false)
{
$prev = $this->scopedErrors;
$this->scopedErrors = (int) $levels;
if (!$replace) {
$this->scopedErrors |= $prev;
}
return $prev;
} | [
"public",
"function",
"scopeAt",
"(",
"$",
"levels",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"scopedErrors",
";",
"$",
"this",
"->",
"scopedErrors",
"=",
"(",
"int",
")",
"$",
"levels",
";",
"if",
"(",
"!",... | Sets the PHP error levels for which local variables are preserved.
@param int $levels A bit field of E_* constants for scoped errors
@param bool $replace Replace or amend the previous value
@return int The previous value | [
"Sets",
"the",
"PHP",
"error",
"levels",
"for",
"which",
"local",
"variables",
"are",
"preserved",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L300-L309 |
207,106 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.traceAt | public function traceAt($levels, $replace = false)
{
$prev = $this->tracedErrors;
$this->tracedErrors = (int) $levels;
if (!$replace) {
$this->tracedErrors |= $prev;
}
return $prev;
} | php | public function traceAt($levels, $replace = false)
{
$prev = $this->tracedErrors;
$this->tracedErrors = (int) $levels;
if (!$replace) {
$this->tracedErrors |= $prev;
}
return $prev;
} | [
"public",
"function",
"traceAt",
"(",
"$",
"levels",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"tracedErrors",
";",
"$",
"this",
"->",
"tracedErrors",
"=",
"(",
"int",
")",
"$",
"levels",
";",
"if",
"(",
"!",... | Sets the PHP error levels for which the stack trace is preserved.
@param int $levels A bit field of E_* constants for traced errors
@param bool $replace Replace or amend the previous value
@return int The previous value | [
"Sets",
"the",
"PHP",
"error",
"levels",
"for",
"which",
"the",
"stack",
"trace",
"is",
"preserved",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L319-L328 |
207,107 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.reRegister | private function reRegister($prev)
{
if ($prev !== $this->thrownErrors | $this->loggedErrors) {
$handler = set_error_handler('var_dump');
$handler = \is_array($handler) ? $handler[0] : null;
restore_error_handler();
if ($handler === $this) {
re... | php | private function reRegister($prev)
{
if ($prev !== $this->thrownErrors | $this->loggedErrors) {
$handler = set_error_handler('var_dump');
$handler = \is_array($handler) ? $handler[0] : null;
restore_error_handler();
if ($handler === $this) {
re... | [
"private",
"function",
"reRegister",
"(",
"$",
"prev",
")",
"{",
"if",
"(",
"$",
"prev",
"!==",
"$",
"this",
"->",
"thrownErrors",
"|",
"$",
"this",
"->",
"loggedErrors",
")",
"{",
"$",
"handler",
"=",
"set_error_handler",
"(",
"'var_dump'",
")",
";",
... | Re-registers as a PHP error handler if levels changed. | [
"Re",
"-",
"registers",
"as",
"a",
"PHP",
"error",
"handler",
"if",
"levels",
"changed",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L352-L367 |
207,108 | symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.cleanTrace | private function cleanTrace($backtrace, $type, $file, $line, $throw)
{
$lightTrace = $backtrace;
for ($i = 0; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
... | php | private function cleanTrace($backtrace, $type, $file, $line, $throw)
{
$lightTrace = $backtrace;
for ($i = 0; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
... | [
"private",
"function",
"cleanTrace",
"(",
"$",
"backtrace",
",",
"$",
"type",
",",
"$",
"file",
",",
"$",
"line",
",",
"$",
"throw",
")",
"{",
"$",
"lightTrace",
"=",
"$",
"backtrace",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"isset",
"(",
"$",
... | Cleans the trace by removing function arguments and the frames added by the error handler and DebugClassLoader. | [
"Cleans",
"the",
"trace",
"by",
"removing",
"function",
"arguments",
"and",
"the",
"frames",
"added",
"by",
"the",
"error",
"handler",
"and",
"DebugClassLoader",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L685-L709 |
207,109 | symfony/symfony | src/Symfony/Component/Validator/Constraints/TimeValidator.php | TimeValidator.checkTime | public static function checkTime($hour, $minute, $second)
{
return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60;
} | php | public static function checkTime($hour, $minute, $second)
{
return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60;
} | [
"public",
"static",
"function",
"checkTime",
"(",
"$",
"hour",
",",
"$",
"minute",
",",
"$",
"second",
")",
"{",
"return",
"$",
"hour",
">=",
"0",
"&&",
"$",
"hour",
"<",
"24",
"&&",
"$",
"minute",
">=",
"0",
"&&",
"$",
"minute",
"<",
"60",
"&&",... | Checks whether a time is valid.
@param int $hour The hour
@param int $minute The minute
@param int $second The second
@return bool Whether the time is valid
@internal | [
"Checks",
"whether",
"a",
"time",
"is",
"valid",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/TimeValidator.php#L37-L40 |
207,110 | symfony/symfony | src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php | Transformer.padLeft | protected function padLeft(string $value, int $length): string
{
return str_pad($value, $length, '0', STR_PAD_LEFT);
} | php | protected function padLeft(string $value, int $length): string
{
return str_pad($value, $length, '0', STR_PAD_LEFT);
} | [
"protected",
"function",
"padLeft",
"(",
"string",
"$",
"value",
",",
"int",
"$",
"length",
")",
":",
"string",
"{",
"return",
"str_pad",
"(",
"$",
"value",
",",
"$",
"length",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
";",
"}"
] | Pad a string with zeros to the left.
@param string $value The string to be padded
@param int $length The length to pad
@return string The padded string | [
"Pad",
"a",
"string",
"with",
"zeros",
"to",
"the",
"left",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php#L62-L65 |
207,111 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpKernelBrowser.php | HttpKernelBrowser.getScript | protected function getScript($request)
{
$kernel = var_export(serialize($this->kernel), true);
$request = var_export(serialize($request), true);
$errorReporting = error_reporting();
$requires = '';
foreach (get_declared_classes() as $class) {
if (0 === strpos($c... | php | protected function getScript($request)
{
$kernel = var_export(serialize($this->kernel), true);
$request = var_export(serialize($request), true);
$errorReporting = error_reporting();
$requires = '';
foreach (get_declared_classes() as $class) {
if (0 === strpos($c... | [
"protected",
"function",
"getScript",
"(",
"$",
"request",
")",
"{",
"$",
"kernel",
"=",
"var_export",
"(",
"serialize",
"(",
"$",
"this",
"->",
"kernel",
")",
",",
"true",
")",
";",
"$",
"request",
"=",
"var_export",
"(",
"serialize",
"(",
"$",
"reque... | Returns the script to execute when the request must be insulated.
@return string | [
"Returns",
"the",
"script",
"to",
"execute",
"when",
"the",
"request",
"must",
"be",
"insulated",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php#L82-L116 |
207,112 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpKernelBrowser.php | HttpKernelBrowser.filterFiles | protected function filterFiles(array $files)
{
$filtered = [];
foreach ($files as $key => $value) {
if (\is_array($value)) {
$filtered[$key] = $this->filterFiles($value);
} elseif ($value instanceof UploadedFile) {
if ($value->isValid() && $val... | php | protected function filterFiles(array $files)
{
$filtered = [];
foreach ($files as $key => $value) {
if (\is_array($value)) {
$filtered[$key] = $this->filterFiles($value);
} elseif ($value instanceof UploadedFile) {
if ($value->isValid() && $val... | [
"protected",
"function",
"filterFiles",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"value",
")",
... | Filters an array of files.
This method created test instances of UploadedFile so that the move()
method can be called on those instances.
If the size of a file is greater than the allowed size (from php.ini) then
an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
@see UploadedFile
@return... | [
"Filters",
"an",
"array",
"of",
"files",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php#L160-L188 |
207,113 | symfony/symfony | src/Symfony/Component/HttpKernel/HttpKernelBrowser.php | HttpKernelBrowser.filterResponse | protected function filterResponse($response)
{
// this is needed to support StreamedResponse
ob_start();
$response->sendContent();
$content = ob_get_clean();
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
} | php | protected function filterResponse($response)
{
// this is needed to support StreamedResponse
ob_start();
$response->sendContent();
$content = ob_get_clean();
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
} | [
"protected",
"function",
"filterResponse",
"(",
"$",
"response",
")",
"{",
"// this is needed to support StreamedResponse",
"ob_start",
"(",
")",
";",
"$",
"response",
"->",
"sendContent",
"(",
")",
";",
"$",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"retur... | Converts the HttpKernel response to a BrowserKit response.
@return DomResponse A DomResponse instance | [
"Converts",
"the",
"HttpKernel",
"response",
"to",
"a",
"BrowserKit",
"response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php#L195-L203 |
207,114 | symfony/symfony | src/Symfony/Component/HttpKernel/Kernel.php | Kernel.initializeBundles | protected function initializeBundles()
{
// init bundles
$this->bundles = [];
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bund... | php | protected function initializeBundles()
{
// init bundles
$this->bundles = [];
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bund... | [
"protected",
"function",
"initializeBundles",
"(",
")",
"{",
"// init bundles",
"$",
"this",
"->",
"bundles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"registerBundles",
"(",
")",
"as",
"$",
"bundle",
")",
"{",
"$",
"name",
"=",
"$",
"bun... | Initializes bundles.
@throws \LogicException if two bundles share a common name | [
"Initializes",
"bundles",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L420-L431 |
207,115 | symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php | CheckCircularReferencesPass.process | public function process(ContainerBuilder $container)
{
$graph = $container->getCompiler()->getServiceReferenceGraph();
$this->checkedNodes = [];
foreach ($graph->getNodes() as $id => $node) {
$this->currentPath = [$id];
$this->checkOutEdges($node->getOutEdges());
... | php | public function process(ContainerBuilder $container)
{
$graph = $container->getCompiler()->getServiceReferenceGraph();
$this->checkedNodes = [];
foreach ($graph->getNodes() as $id => $node) {
$this->currentPath = [$id];
$this->checkOutEdges($node->getOutEdges());
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"graph",
"=",
"$",
"container",
"->",
"getCompiler",
"(",
")",
"->",
"getServiceReferenceGraph",
"(",
")",
";",
"$",
"this",
"->",
"checkedNodes",
"=",
"[",
"]",
";"... | Checks the ContainerBuilder object for circular references. | [
"Checks",
"the",
"ContainerBuilder",
"object",
"for",
"circular",
"references",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php#L35-L45 |
207,116 | symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php | CheckCircularReferencesPass.checkOutEdges | private function checkOutEdges(array $edges)
{
foreach ($edges as $edge) {
$node = $edge->getDestNode();
$id = $node->getId();
if (empty($this->checkedNodes[$id])) {
// Don't check circular references for lazy edges
if (!$node->getValue() ... | php | private function checkOutEdges(array $edges)
{
foreach ($edges as $edge) {
$node = $edge->getDestNode();
$id = $node->getId();
if (empty($this->checkedNodes[$id])) {
// Don't check circular references for lazy edges
if (!$node->getValue() ... | [
"private",
"function",
"checkOutEdges",
"(",
"array",
"$",
"edges",
")",
"{",
"foreach",
"(",
"$",
"edges",
"as",
"$",
"edge",
")",
"{",
"$",
"node",
"=",
"$",
"edge",
"->",
"getDestNode",
"(",
")",
";",
"$",
"id",
"=",
"$",
"node",
"->",
"getId",
... | Checks for circular references.
@param ServiceReferenceGraphEdge[] $edges An array of Edges
@throws ServiceCircularReferenceException when a circular reference is found | [
"Checks",
"for",
"circular",
"references",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php#L54-L77 |
207,117 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getExtension | public function getExtension($name)
{
if (isset($this->extensions[$name])) {
return $this->extensions[$name];
}
if (isset($this->extensionsByNs[$name])) {
return $this->extensionsByNs[$name];
}
throw new LogicException(sprintf('Container extension "%... | php | public function getExtension($name)
{
if (isset($this->extensions[$name])) {
return $this->extensions[$name];
}
if (isset($this->extensionsByNs[$name])) {
return $this->extensionsByNs[$name];
}
throw new LogicException(sprintf('Container extension "%... | [
"public",
"function",
"getExtension",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"extensions",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"extensions",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"(... | Returns an extension by alias or namespace.
@param string $name An alias or a namespace
@return ExtensionInterface An extension instance
@throws LogicException if the extension is not registered | [
"Returns",
"an",
"extension",
"by",
"alias",
"or",
"namespace",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L207-L218 |
207,118 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.hasExtension | public function hasExtension($name)
{
return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]);
} | php | public function hasExtension($name)
{
return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]);
} | [
"public",
"function",
"hasExtension",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"extensions",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"extensionsByNs",
"[",
"$",
"name",
"]",
")",
";",
"}"
] | Checks if we have an extension.
@param string $name The name of the extension
@return bool If the extension exists | [
"Checks",
"if",
"we",
"have",
"an",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L237-L240 |
207,119 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.addObjectResource | public function addObjectResource($object)
{
if ($this->trackResources) {
if (\is_object($object)) {
$object = \get_class($object);
}
if (!isset($this->classReflectors[$object])) {
$this->classReflectors[$object] = new \ReflectionClass($obj... | php | public function addObjectResource($object)
{
if ($this->trackResources) {
if (\is_object($object)) {
$object = \get_class($object);
}
if (!isset($this->classReflectors[$object])) {
$this->classReflectors[$object] = new \ReflectionClass($obj... | [
"public",
"function",
"addObjectResource",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"trackResources",
")",
"{",
"if",
"(",
"\\",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"$",
"object",
"=",
"\\",
"get_class",
"(",
"$",
"obje... | Adds the object class hierarchy as resources.
@param object|string $object An object instance or class name
@return $this | [
"Adds",
"the",
"object",
"class",
"hierarchy",
"as",
"resources",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L295-L327 |
207,120 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getExtensionConfig | public function getExtensionConfig($name)
{
if (!isset($this->extensionConfigs[$name])) {
$this->extensionConfigs[$name] = [];
}
return $this->extensionConfigs[$name];
} | php | public function getExtensionConfig($name)
{
if (!isset($this->extensionConfigs[$name])) {
$this->extensionConfigs[$name] = [];
}
return $this->extensionConfigs[$name];
} | [
"public",
"function",
"getExtensionConfig",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"extensionConfigs",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"extensionConfigs",
"[",
"$",
"name",
"]",
"=",
"[",... | Returns the configuration array for the given extension.
@param string $name The name of the extension
@return array An array of configuration | [
"Returns",
"the",
"configuration",
"array",
"for",
"the",
"given",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L698-L705 |
207,121 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.prependExtensionConfig | public function prependExtensionConfig($name, array $config)
{
if (!isset($this->extensionConfigs[$name])) {
$this->extensionConfigs[$name] = [];
}
array_unshift($this->extensionConfigs[$name], $config);
} | php | public function prependExtensionConfig($name, array $config)
{
if (!isset($this->extensionConfigs[$name])) {
$this->extensionConfigs[$name] = [];
}
array_unshift($this->extensionConfigs[$name], $config);
} | [
"public",
"function",
"prependExtensionConfig",
"(",
"$",
"name",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"extensionConfigs",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"extensionConfigs",
"... | Prepends a config array to the configs of the given extension.
@param string $name The name of the extension
@param array $config The config to set | [
"Prepends",
"a",
"config",
"array",
"to",
"the",
"configs",
"of",
"the",
"given",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L713-L720 |
207,122 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.addAliases | public function addAliases(array $aliases)
{
foreach ($aliases as $alias => $id) {
$this->setAlias($alias, $id);
}
} | php | public function addAliases(array $aliases)
{
foreach ($aliases as $alias => $id) {
$this->setAlias($alias, $id);
}
} | [
"public",
"function",
"addAliases",
"(",
"array",
"$",
"aliases",
")",
"{",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
"=>",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"setAlias",
"(",
"$",
"alias",
",",
"$",
"id",
")",
";",
"}",
"}"
] | Adds the service aliases. | [
"Adds",
"the",
"service",
"aliases",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L806-L811 |
207,123 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.addDefinitions | public function addDefinitions(array $definitions)
{
foreach ($definitions as $id => $definition) {
$this->setDefinition($id, $definition);
}
} | php | public function addDefinitions(array $definitions)
{
foreach ($definitions as $id => $definition) {
$this->setDefinition($id, $definition);
}
} | [
"public",
"function",
"addDefinitions",
"(",
"array",
"$",
"definitions",
")",
"{",
"foreach",
"(",
"$",
"definitions",
"as",
"$",
"id",
"=>",
"$",
"definition",
")",
"{",
"$",
"this",
"->",
"setDefinition",
"(",
"$",
"id",
",",
"$",
"definition",
")",
... | Adds the service definitions.
@param Definition[] $definitions An array of service definitions | [
"Adds",
"the",
"service",
"definitions",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L948-L953 |
207,124 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.findTags | public function findTags()
{
$tags = [];
foreach ($this->getDefinitions() as $id => $definition) {
$tags = array_merge(array_keys($definition->getTags()), $tags);
}
return array_unique($tags);
} | php | public function findTags()
{
$tags = [];
foreach ($this->getDefinitions() as $id => $definition) {
$tags = array_merge(array_keys($definition->getTags()), $tags);
}
return array_unique($tags);
} | [
"public",
"function",
"findTags",
"(",
")",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDefinitions",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"definition",
")",
"{",
"$",
"tags",
"=",
"array_merge",
"(",
"array_keys",
... | Returns all tags the defined services use.
@return array An array of tags | [
"Returns",
"all",
"tags",
"the",
"defined",
"services",
"use",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1320-L1328 |
207,125 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.registerAliasForArgument | public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
{
$name = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $name ?? $id))));
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $name)) {
throw new InvalidArgumentExce... | php | public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
{
$name = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $name ?? $id))));
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $name)) {
throw new InvalidArgumentExce... | [
"public",
"function",
"registerAliasForArgument",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"type",
",",
"string",
"$",
"name",
"=",
"null",
")",
":",
"Alias",
"{",
"$",
"name",
"=",
"lcfirst",
"(",
"str_replace",
"(",
"' '",
",",
"''",
",",
"ucwor... | Registers an autowiring alias that only binds to a specific argument name.
The argument name is derived from $name if provided (from $id otherwise)
using camel case: "foo.bar" or "foo_bar" creates an alias bound to
"$fooBar"-named arguments with $type as type-hint. Such arguments will
receive the service $id when auto... | [
"Registers",
"an",
"autowiring",
"alias",
"that",
"only",
"binds",
"to",
"a",
"specific",
"argument",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1377-L1386 |
207,126 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getEnvCounters | public function getEnvCounters()
{
$bag = $this->getParameterBag();
$envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
foreach ($envPlaceholders as $env => $placeholders) {
if (!isset($this->envCounters[$env])) {
... | php | public function getEnvCounters()
{
$bag = $this->getParameterBag();
$envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
foreach ($envPlaceholders as $env => $placeholders) {
if (!isset($this->envCounters[$env])) {
... | [
"public",
"function",
"getEnvCounters",
"(",
")",
"{",
"$",
"bag",
"=",
"$",
"this",
"->",
"getParameterBag",
"(",
")",
";",
"$",
"envPlaceholders",
"=",
"$",
"bag",
"instanceof",
"EnvPlaceholderParameterBag",
"?",
"$",
"bag",
"->",
"getEnvPlaceholders",
"(",
... | Get statistics about env usage.
@return int[] The number of time each env vars has been resolved | [
"Get",
"statistics",
"about",
"env",
"usage",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1474-L1486 |
207,127 | symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.removeBindings | public function removeBindings($id)
{
if ($this->hasDefinition($id)) {
foreach ($this->getDefinition($id)->getBindings() as $key => $binding) {
list(, $bindingId) = $binding->getValues();
$this->removedBindingIds[(int) $bindingId] = true;
}
}
... | php | public function removeBindings($id)
{
if ($this->hasDefinition($id)) {
foreach ($this->getDefinition($id)->getBindings() as $key => $binding) {
list(, $bindingId) = $binding->getValues();
$this->removedBindingIds[(int) $bindingId] = true;
}
}
... | [
"public",
"function",
"removeBindings",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasDefinition",
"(",
"$",
"id",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getDefinition",
"(",
"$",
"id",
")",
"->",
"getBindings",
"(",
")",
... | Removes bindings for a service.
@param string $id The service identifier
@internal | [
"Removes",
"bindings",
"for",
"a",
"service",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1515-L1523 |
207,128 | symfony/symfony | src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php | BasePasswordEncoder.mergePasswordAndSalt | protected function mergePasswordAndSalt($password, $salt)
{
if (empty($salt)) {
return $password;
}
if (false !== strrpos($salt, '{') || false !== strrpos($salt, '}')) {
throw new \InvalidArgumentException('Cannot use { or } in salt.');
}
return $pas... | php | protected function mergePasswordAndSalt($password, $salt)
{
if (empty($salt)) {
return $password;
}
if (false !== strrpos($salt, '{') || false !== strrpos($salt, '}')) {
throw new \InvalidArgumentException('Cannot use { or } in salt.');
}
return $pas... | [
"protected",
"function",
"mergePasswordAndSalt",
"(",
"$",
"password",
",",
"$",
"salt",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"salt",
")",
")",
"{",
"return",
"$",
"password",
";",
"}",
"if",
"(",
"false",
"!==",
"strrpos",
"(",
"$",
"salt",
",",
... | Merges a password and a salt.
@param string $password The password to be used
@param string $salt The salt to be used
@return string a merged password and salt
@throws \InvalidArgumentException | [
"Merges",
"a",
"password",
"and",
"a",
"salt",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php#L58-L69 |
207,129 | symfony/symfony | src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php | UserAuthenticationProvider.getRoles | private function getRoles(UserInterface $user, TokenInterface $token)
{
$roles = $user->getRoles();
foreach ($token->getRoles(false) as $role) {
if ($role instanceof SwitchUserRole) {
$roles[] = $role;
break;
}
}
return $role... | php | private function getRoles(UserInterface $user, TokenInterface $token)
{
$roles = $user->getRoles();
foreach ($token->getRoles(false) as $role) {
if ($role instanceof SwitchUserRole) {
$roles[] = $role;
break;
}
}
return $role... | [
"private",
"function",
"getRoles",
"(",
"UserInterface",
"$",
"user",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"$",
"roles",
"=",
"$",
"user",
"->",
"getRoles",
"(",
")",
";",
"foreach",
"(",
"$",
"token",
"->",
"getRoles",
"(",
"false",
")",
"as... | Retrieves roles from user and appends SwitchUserRole if original token contained one.
@return array The user roles | [
"Retrieves",
"roles",
"from",
"user",
"and",
"appends",
"SwitchUserRole",
"if",
"original",
"token",
"contained",
"one",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php#L115-L128 |
207,130 | symfony/symfony | src/Symfony/Component/Dotenv/Dotenv.php | Dotenv.overload | public function overload(string $path, string ...$extraPaths): void
{
$this->doLoad(true, \func_get_args());
} | php | public function overload(string $path, string ...$extraPaths): void
{
$this->doLoad(true, \func_get_args());
} | [
"public",
"function",
"overload",
"(",
"string",
"$",
"path",
",",
"string",
"...",
"$",
"extraPaths",
")",
":",
"void",
"{",
"$",
"this",
"->",
"doLoad",
"(",
"true",
",",
"\\",
"func_get_args",
"(",
")",
")",
";",
"}"
] | Loads one or several .env files and enables override existing vars.
@param string $path A file to load
@param ...string $extraPaths A list of additional files to load
@throws FormatException when a file has a syntax error
@throws PathException when a file does not exist or is not readable | [
"Loads",
"one",
"or",
"several",
".",
"env",
"files",
"and",
"enables",
"override",
"existing",
"vars",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Dotenv/Dotenv.php#L121-L124 |
207,131 | symfony/symfony | src/Symfony/Component/Dotenv/Dotenv.php | Dotenv.parse | public function parse(string $data, string $path = '.env'): array
{
$this->path = $path;
$this->data = str_replace(["\r\n", "\r"], "\n", $data);
$this->lineno = 1;
$this->cursor = 0;
$this->end = \strlen($this->data);
$state = self::STATE_VARNAME;
$this->value... | php | public function parse(string $data, string $path = '.env'): array
{
$this->path = $path;
$this->data = str_replace(["\r\n", "\r"], "\n", $data);
$this->lineno = 1;
$this->cursor = 0;
$this->end = \strlen($this->data);
$state = self::STATE_VARNAME;
$this->value... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"data",
",",
"string",
"$",
"path",
"=",
"'.env'",
")",
":",
"array",
"{",
"$",
"this",
"->",
"path",
"=",
"$",
"path",
";",
"$",
"this",
"->",
"data",
"=",
"str_replace",
"(",
"[",
"\"\\r\\n\"",
"... | Parses the contents of an .env file.
@param string $data The data to be parsed
@param string $path The original file name where data where stored (used for more meaningful error messages)
@return array An array of env variables
@throws FormatException when a file has a syntax error | [
"Parses",
"the",
"contents",
"of",
"an",
".",
"env",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Dotenv/Dotenv.php#L179-L217 |
207,132 | symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.get | public function get($id)
{
foreach ($this->children as $child) {
if ($id === $child->getId()) {
return $child;
}
}
} | php | public function get($id)
{
foreach ($this->children as $child) {
if ($id === $child->getId()) {
return $child;
}
}
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"$",
"child",
"->",
"getId",
"(",
")",
")",
"{",
"return",
"$",
"child",
";",
"}",
... | Returns the child section.
@param string $id The child section identifier
@return self|null The child section or null when none found | [
"Returns",
"the",
"child",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L63-L70 |
207,133 | symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.open | public function open($id)
{
if (null === $session = $this->get($id)) {
$session = $this->children[] = new self(microtime(true) * 1000, $this->morePrecision);
}
return $session;
} | php | public function open($id)
{
if (null === $session = $this->get($id)) {
$session = $this->children[] = new self(microtime(true) * 1000, $this->morePrecision);
}
return $session;
} | [
"public",
"function",
"open",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"session",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"children",
"[",
"]",
"=",
"new",
"self",
... | Creates or re-opens a child section.
@param string|null $id Null to create a new section, the identifier to re-open an existing one
@return self | [
"Creates",
"or",
"re",
"-",
"opens",
"a",
"child",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L79-L86 |
207,134 | symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.isEventStarted | public function isEventStarted($name)
{
return isset($this->events[$name]) && $this->events[$name]->isStarted();
} | php | public function isEventStarted($name)
{
return isset($this->events[$name]) && $this->events[$name]->isStarted();
} | [
"public",
"function",
"isEventStarted",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
")",
"&&",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
"->",
"isStarted",
"(",
")",
";",
"}"
] | Checks if the event was started.
@param string $name The event name
@return bool | [
"Checks",
"if",
"the",
"event",
"was",
"started",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L134-L137 |
207,135 | symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.stopEvent | public function stopEvent($name)
{
if (!isset($this->events[$name])) {
throw new \LogicException(sprintf('Event "%s" is not started.', $name));
}
return $this->events[$name]->stop();
} | php | public function stopEvent($name)
{
if (!isset($this->events[$name])) {
throw new \LogicException(sprintf('Event "%s" is not started.', $name));
}
return $this->events[$name]->stop();
} | [
"public",
"function",
"stopEvent",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Event \"%s\" is not started.'",... | Stops an event.
@param string $name The event name
@return StopwatchEvent The event
@throws \LogicException When the event has not been started | [
"Stops",
"an",
"event",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L148-L155 |
207,136 | symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.getEvent | public function getEvent($name)
{
if (!isset($this->events[$name])) {
throw new \LogicException(sprintf('Event "%s" is not known.', $name));
}
return $this->events[$name];
} | php | public function getEvent($name)
{
if (!isset($this->events[$name])) {
throw new \LogicException(sprintf('Event "%s" is not known.', $name));
}
return $this->events[$name];
} | [
"public",
"function",
"getEvent",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Event \"%s\" is not known.'",
... | Returns a specific event by name.
@param string $name The event name
@return StopwatchEvent The event
@throws \LogicException When the event is not known | [
"Returns",
"a",
"specific",
"event",
"by",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L180-L187 |
207,137 | symfony/symfony | src/Symfony/Component/HttpFoundation/JsonResponse.php | JsonResponse.setData | public function setData($data = [])
{
try {
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
... | php | public function setData($data = [])
{
try {
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
... | [
"public",
"function",
"setData",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"encodingOptions",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"... | Sets the data to be sent as JSON.
@param mixed $data
@return $this
@throws \InvalidArgumentException | [
"Sets",
"the",
"data",
"to",
"be",
"sent",
"as",
"JSON",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/JsonResponse.php#L140-L156 |
207,138 | symfony/symfony | src/Symfony/Component/Form/Form.php | Form.getClickedButton | public function getClickedButton()
{
if ($this->clickedButton) {
return $this->clickedButton;
}
if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
return $this->parent->getClickedButton();
}
} | php | public function getClickedButton()
{
if ($this->clickedButton) {
return $this->clickedButton;
}
if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
return $this->parent->getClickedButton();
}
} | [
"public",
"function",
"getClickedButton",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"clickedButton",
")",
"{",
"return",
"$",
"this",
"->",
"clickedButton",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"parent",
"&&",
"method_exists",
"(",
"$",
"this",
"... | Returns the button that was used to submit the form.
@return ClickableInterface|null | [
"Returns",
"the",
"button",
"that",
"was",
"used",
"to",
"submit",
"the",
"form",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L758-L767 |
207,139 | symfony/symfony | src/Symfony/Component/Form/Form.php | Form.normToModel | private function normToModel($value)
{
try {
$transformers = $this->config->getModelTransformers();
for ($i = \count($transformers) - 1; $i >= 0; --$i) {
$value = $transformers[$i]->reverseTransform($value);
}
} catch (TransformationFailedExceptio... | php | private function normToModel($value)
{
try {
$transformers = $this->config->getModelTransformers();
for ($i = \count($transformers) - 1; $i >= 0; --$i) {
$value = $transformers[$i]->reverseTransform($value);
}
} catch (TransformationFailedExceptio... | [
"private",
"function",
"normToModel",
"(",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"transformers",
"=",
"$",
"this",
"->",
"config",
"->",
"getModelTransformers",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"\\",
"count",
"(",
"$",
"transformers",
")",
... | Reverse transforms a value if a model transformer is set.
@param string $value The value to reverse transform
@return mixed
@throws TransformationFailedException If the value cannot be transformed to "model" format | [
"Reverse",
"transforms",
"a",
"value",
"if",
"a",
"model",
"transformer",
"is",
"set",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L1074-L1087 |
207,140 | symfony/symfony | src/Symfony/Component/Form/Form.php | Form.normToView | private function normToView($value)
{
// Scalar values should be converted to strings to
// facilitate differentiation between empty ("") and zero (0).
// Only do this for simple forms, as the resulting value in
// compound forms is passed to the data mapper and thus should
... | php | private function normToView($value)
{
// Scalar values should be converted to strings to
// facilitate differentiation between empty ("") and zero (0).
// Only do this for simple forms, as the resulting value in
// compound forms is passed to the data mapper and thus should
... | [
"private",
"function",
"normToView",
"(",
"$",
"value",
")",
"{",
"// Scalar values should be converted to strings to",
"// facilitate differentiation between empty (\"\") and zero (0).",
"// Only do this for simple forms, as the resulting value in",
"// compound forms is passed to the data m... | Transforms the value if a view transformer is set.
@param mixed $value The value to transform
@return mixed
@throws TransformationFailedException If the normalized value cannot be transformed to "view" format | [
"Transforms",
"the",
"value",
"if",
"a",
"view",
"transformer",
"is",
"set",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L1098-L1118 |
207,141 | symfony/symfony | src/Symfony/Component/Form/Form.php | Form.viewToNorm | private function viewToNorm($value)
{
if (!$transformers = $this->config->getViewTransformers()) {
return '' === $value ? null : $value;
}
try {
for ($i = \count($transformers) - 1; $i >= 0; --$i) {
$value = $transformers[$i]->reverseTransform($value)... | php | private function viewToNorm($value)
{
if (!$transformers = $this->config->getViewTransformers()) {
return '' === $value ? null : $value;
}
try {
for ($i = \count($transformers) - 1; $i >= 0; --$i) {
$value = $transformers[$i]->reverseTransform($value)... | [
"private",
"function",
"viewToNorm",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"transformers",
"=",
"$",
"this",
"->",
"config",
"->",
"getViewTransformers",
"(",
")",
")",
"{",
"return",
"''",
"===",
"$",
"value",
"?",
"null",
":",
"$",
"val... | Reverse transforms a value if a view transformer is set.
@param string $value The value to reverse transform
@return mixed
@throws TransformationFailedException If the submitted value cannot be transformed to "normalized" format | [
"Reverse",
"transforms",
"a",
"value",
"if",
"a",
"view",
"transformer",
"is",
"set",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L1129-L1144 |
207,142 | symfony/symfony | src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php | UserPasswordEncoderCommand.createPasswordQuestion | private function createPasswordQuestion(): Question
{
$passwordQuestion = new Question('Type in your password to be encoded');
return $passwordQuestion->setValidator(function ($value) {
if ('' === trim($value)) {
throw new InvalidArgumentException('The password must not ... | php | private function createPasswordQuestion(): Question
{
$passwordQuestion = new Question('Type in your password to be encoded');
return $passwordQuestion->setValidator(function ($value) {
if ('' === trim($value)) {
throw new InvalidArgumentException('The password must not ... | [
"private",
"function",
"createPasswordQuestion",
"(",
")",
":",
"Question",
"{",
"$",
"passwordQuestion",
"=",
"new",
"Question",
"(",
"'Type in your password to be encoded'",
")",
";",
"return",
"$",
"passwordQuestion",
"->",
"setValidator",
"(",
"function",
"(",
"... | Create the password question to ask the user for the password to be encoded. | [
"Create",
"the",
"password",
"question",
"to",
"ask",
"the",
"user",
"for",
"the",
"password",
"to",
"be",
"encoded",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php#L170-L181 |
207,143 | symfony/symfony | src/Symfony/Component/DomCrawler/FormFieldRegistry.php | FormFieldRegistry.add | public function add(FormField $field)
{
$segments = $this->getSegments($field->getName());
$target = &$this->fields;
while ($segments) {
if (!\is_array($target)) {
$target = [];
}
$path = array_shift($segments);
if ('' === $pat... | php | public function add(FormField $field)
{
$segments = $this->getSegments($field->getName());
$target = &$this->fields;
while ($segments) {
if (!\is_array($target)) {
$target = [];
}
$path = array_shift($segments);
if ('' === $pat... | [
"public",
"function",
"add",
"(",
"FormField",
"$",
"field",
")",
"{",
"$",
"segments",
"=",
"$",
"this",
"->",
"getSegments",
"(",
"$",
"field",
"->",
"getName",
"(",
")",
")",
";",
"$",
"target",
"=",
"&",
"$",
"this",
"->",
"fields",
";",
"while... | Adds a field to the registry. | [
"Adds",
"a",
"field",
"to",
"the",
"registry",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/FormFieldRegistry.php#L30-L47 |
207,144 | symfony/symfony | src/Symfony/Component/DomCrawler/FormFieldRegistry.php | FormFieldRegistry.create | private static function create($base, array $values)
{
$registry = new static();
$registry->base = $base;
$registry->fields = $values;
return $registry;
} | php | private static function create($base, array $values)
{
$registry = new static();
$registry->base = $base;
$registry->fields = $values;
return $registry;
} | [
"private",
"static",
"function",
"create",
"(",
"$",
"base",
",",
"array",
"$",
"values",
")",
"{",
"$",
"registry",
"=",
"new",
"static",
"(",
")",
";",
"$",
"registry",
"->",
"base",
"=",
"$",
"base",
";",
"$",
"registry",
"->",
"fields",
"=",
"$... | Creates an instance of the class.
This function is made private because it allows overriding the $base and
the $values properties without any type checking.
@param string $base The fully qualified name of the base field
@param array $values The values of the fields
@return static | [
"Creates",
"an",
"instance",
"of",
"the",
"class",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/FormFieldRegistry.php#L154-L161 |
207,145 | symfony/symfony | src/Symfony/Component/DomCrawler/FormFieldRegistry.php | FormFieldRegistry.getSegments | private function getSegments($name)
{
if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/', $name, $m)) {
$segments = [$m['base']];
while (!empty($m['extra'])) {
$extra = $m['extra'];
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $extra, $m... | php | private function getSegments($name)
{
if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/', $name, $m)) {
$segments = [$m['base']];
while (!empty($m['extra'])) {
$extra = $m['extra'];
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $extra, $m... | [
"private",
"function",
"getSegments",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(?P<base>[^[]+)(?P<extra>(\\[.*)|$)/'",
",",
"$",
"name",
",",
"$",
"m",
")",
")",
"{",
"$",
"segments",
"=",
"[",
"$",
"m",
"[",
"'base'",
"]",
"]",
";... | Splits a field name into segments as a web browser would do.
getSegments('base[foo][3][]') = ['base', 'foo, '3', ''];
@param string $name The name of the field
@return string[] The list of segments | [
"Splits",
"a",
"field",
"name",
"into",
"segments",
"as",
"a",
"web",
"browser",
"would",
"do",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/FormFieldRegistry.php#L195-L212 |
207,146 | symfony/symfony | src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php | AbstractCloner.addCasters | public function addCasters(array $casters)
{
foreach ($casters as $type => $callback) {
$closure = &$this->casters[$type][];
$closure = $callback instanceof \Closure ? $callback : static function (...$args) use ($callback, &$closure) {
return ($closure = \Closure::fro... | php | public function addCasters(array $casters)
{
foreach ($casters as $type => $callback) {
$closure = &$this->casters[$type][];
$closure = $callback instanceof \Closure ? $callback : static function (...$args) use ($callback, &$closure) {
return ($closure = \Closure::fro... | [
"public",
"function",
"addCasters",
"(",
"array",
"$",
"casters",
")",
"{",
"foreach",
"(",
"$",
"casters",
"as",
"$",
"type",
"=>",
"$",
"callback",
")",
"{",
"$",
"closure",
"=",
"&",
"$",
"this",
"->",
"casters",
"[",
"$",
"type",
"]",
"[",
"]",... | Adds casters for resources and objects.
Maps resources or objects types to a callback.
Types are in the key, with a callable caster for value.
Resource types are to be prefixed with a `:`,
see e.g. static::$defaultCasters.
@param callable[] $casters A map of casters | [
"Adds",
"casters",
"for",
"resources",
"and",
"objects",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php#L188-L196 |
207,147 | symfony/symfony | src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php | AbstractCloner.cloneVar | public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $... | php | public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $... | [
"public",
"function",
"cloneVar",
"(",
"$",
"var",
",",
"$",
"filter",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"prevErrorHandler",
"=",
"set_error_handler",
"(",
"function",
"(",
"$",
"type",
",",
"$",
"msg",
",",
"$",
"file",
",",
"$",
"line",
",",
... | Clones a PHP variable.
@param mixed $var Any PHP variable
@param int $filter A bit field of Caster::EXCLUDE_* constants
@return Data The cloned variable represented by a Data object | [
"Clones",
"a",
"PHP",
"variable",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php#L237-L265 |
207,148 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php | NativeSessionStorage.loadSession | protected function loadSession(array &$session = null)
{
if (null === $session) {
$session = &$_SESSION;
}
$bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
$session[$key] = isset($ses... | php | protected function loadSession(array &$session = null)
{
if (null === $session) {
$session = &$_SESSION;
}
$bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
$session[$key] = isset($ses... | [
"protected",
"function",
"loadSession",
"(",
"array",
"&",
"$",
"session",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"session",
")",
"{",
"$",
"session",
"=",
"&",
"$",
"_SESSION",
";",
"}",
"$",
"bags",
"=",
"array_merge",
"(",
"$",
"t... | Load the session with attributes.
After starting the session, PHP retrieves the session from whatever handlers
are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()).
PHP takes the return value from the read() handler, unserializes it
and populates $_SESSION with the result au... | [
"Load",
"the",
"session",
"with",
"attributes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L442-L458 |
207,149 | symfony/symfony | src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php | ChoiceListView.hasPlaceholder | public function hasPlaceholder()
{
if ($this->preferredChoices) {
$firstChoice = reset($this->preferredChoices);
return $firstChoice instanceof ChoiceView && '' === $firstChoice->value;
}
$firstChoice = reset($this->choices);
return $firstChoice instanceof ... | php | public function hasPlaceholder()
{
if ($this->preferredChoices) {
$firstChoice = reset($this->preferredChoices);
return $firstChoice instanceof ChoiceView && '' === $firstChoice->value;
}
$firstChoice = reset($this->choices);
return $firstChoice instanceof ... | [
"public",
"function",
"hasPlaceholder",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"preferredChoices",
")",
"{",
"$",
"firstChoice",
"=",
"reset",
"(",
"$",
"this",
"->",
"preferredChoices",
")",
";",
"return",
"$",
"firstChoice",
"instanceof",
"ChoiceView... | Returns whether a placeholder is in the choices.
A placeholder must be the first child element, not be in a group and have an empty value.
@return bool | [
"Returns",
"whether",
"a",
"placeholder",
"is",
"in",
"the",
"choices",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php#L47-L58 |
207,150 | symfony/symfony | src/Symfony/Component/HttpFoundation/Response.php | Response.getTtl | public function getTtl(): ?int
{
$maxAge = $this->getMaxAge();
return null !== $maxAge ? $maxAge - $this->getAge() : null;
} | php | public function getTtl(): ?int
{
$maxAge = $this->getMaxAge();
return null !== $maxAge ? $maxAge - $this->getAge() : null;
} | [
"public",
"function",
"getTtl",
"(",
")",
":",
"?",
"int",
"{",
"$",
"maxAge",
"=",
"$",
"this",
"->",
"getMaxAge",
"(",
")",
";",
"return",
"null",
"!==",
"$",
"maxAge",
"?",
"$",
"maxAge",
"-",
"$",
"this",
"->",
"getAge",
"(",
")",
":",
"null"... | Returns the response's time-to-live in seconds.
It returns null when no freshness information is present in the response.
When the responses TTL is <= 0, the response may not be served from cache without first
revalidating with the origin.
@final | [
"Returns",
"the",
"response",
"s",
"time",
"-",
"to",
"-",
"live",
"in",
"seconds",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Response.php#L816-L821 |
207,151 | symfony/symfony | src/Symfony/Component/Lock/Store/ZookeeperStore.php | ZookeeperStore.createNewLock | private function createNewLock(string $node, string $value)
{
// Default Node Permissions
$acl = [['perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone']];
// This ensures that the nodes are deleted when the client session to zookeeper server ends.
$type = \Zookeeper... | php | private function createNewLock(string $node, string $value)
{
// Default Node Permissions
$acl = [['perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone']];
// This ensures that the nodes are deleted when the client session to zookeeper server ends.
$type = \Zookeeper... | [
"private",
"function",
"createNewLock",
"(",
"string",
"$",
"node",
",",
"string",
"$",
"value",
")",
"{",
"// Default Node Permissions",
"$",
"acl",
"=",
"[",
"[",
"'perms'",
"=>",
"\\",
"Zookeeper",
"::",
"PERM_ALL",
",",
"'scheme'",
"=>",
"'world'",
",",
... | Creates a zookeeper node.
@param string $node The node which needs to be created
@param string $value The value to be assigned to a zookeeper node
@throws LockConflictedException
@throws LockAcquiringException | [
"Creates",
"a",
"zookeeper",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/ZookeeperStore.php#L106-L122 |
207,152 | symfony/symfony | src/Symfony/Component/Cache/Adapter/AbstractAdapter.php | AbstractAdapter.createSystemCache | public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
{
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
if (null !== $logger) {
$opcache->setLogger($logger);
}
if (!sel... | php | public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
{
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
if (null !== $logger) {
$opcache->setLogger($logger);
}
if (!sel... | [
"public",
"static",
"function",
"createSystemCache",
"(",
"$",
"namespace",
",",
"$",
"defaultLifetime",
",",
"$",
"version",
",",
"$",
"directory",
",",
"LoggerInterface",
"$",
"logger",
"=",
"null",
")",
"{",
"$",
"opcache",
"=",
"new",
"PhpFilesAdapter",
... | Returns the best possible adapter that your runtime supports.
Using ApcuAdapter makes system caches compatible with read-only filesystems.
@param string $namespace
@param int $defaultLifetime
@param string $version
@param string $directory
@param LoggerInterf... | [
"Returns",
"the",
"best",
"possible",
"adapter",
"that",
"your",
"runtime",
"supports",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php#L105-L124 |
207,153 | symfony/symfony | src/Symfony/Component/Validator/Constraints/LuhnValidator.php | LuhnValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Luhn) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Luhn');
}
if (null === $value || '' === $value) {
return;
}
// Work with strings only, becau... | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Luhn) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Luhn');
}
if (null === $value || '' === $value) {
return;
}
// Work with strings only, becau... | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Luhn",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
"... | Validates a credit card number with the Luhn algorithm.
@param mixed $value
@param Constraint $constraint
@throws UnexpectedTypeException when the given credit card number is no string | [
"Validates",
"a",
"credit",
"card",
"number",
"with",
"the",
"Luhn",
"algorithm",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/LuhnValidator.php#L41-L96 |
207,154 | symfony/symfony | src/Symfony/Component/Lock/Store/PdoStore.php | PdoStore.createTable | public function createTable(): void
{
// connect if we are not yet
$conn = $this->getConnection();
$driver = $this->getDriver();
if ($conn instanceof Connection) {
$schema = new Schema();
$table = $schema->createTable($this->table);
$table->addCol... | php | public function createTable(): void
{
// connect if we are not yet
$conn = $this->getConnection();
$driver = $this->getDriver();
if ($conn instanceof Connection) {
$schema = new Schema();
$table = $schema->createTable($this->table);
$table->addCol... | [
"public",
"function",
"createTable",
"(",
")",
":",
"void",
"{",
"// connect if we are not yet",
"$",
"conn",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",
";",
"$",
"driver",
"=",
"$",
"this",
"->",
"getDriver",
"(",
")",
";",
"if",
"(",
"$",
"co... | Creates the table to store lock keys which can be called once for setup.
@throws \PDOException When the table already exists
@throws DBALException When the table already exists
@throws \DomainException When an unsupported PDO driver is used | [
"Creates",
"the",
"table",
"to",
"store",
"lock",
"keys",
"which",
"can",
"be",
"called",
"once",
"for",
"setup",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/PdoStore.php#L252-L294 |
207,155 | symfony/symfony | src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php | WebLinkExtension.link | public function link($uri, $rel, array $attributes = [])
{
if (!$request = $this->requestStack->getMasterRequest()) {
return $uri;
}
$link = new Link($rel, $uri);
foreach ($attributes as $key => $value) {
$link = $link->withAttribute($key, $value);
}
... | php | public function link($uri, $rel, array $attributes = [])
{
if (!$request = $this->requestStack->getMasterRequest()) {
return $uri;
}
$link = new Link($rel, $uri);
foreach ($attributes as $key => $value) {
$link = $link->withAttribute($key, $value);
}
... | [
"public",
"function",
"link",
"(",
"$",
"uri",
",",
"$",
"rel",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
")",
")",
"{",
"return"... | Adds a "Link" HTTP header.
@param string $uri The relation URI
@param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")
@param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
@return string The relation URI | [
"Adds",
"a",
"Link",
"HTTP",
"header",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php#L58-L73 |
207,156 | symfony/symfony | src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php | Deprecation.isIndirect | public function isIndirect()
{
$erroringFile = $erroringPackage = null;
foreach ($this->trace as $line) {
if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
continue;
}
if (!isset($line['file'])) {
... | php | public function isIndirect()
{
$erroringFile = $erroringPackage = null;
foreach ($this->trace as $line) {
if (\in_array($line['function'], ['require', 'require_once', 'include', 'include_once'], true)) {
continue;
}
if (!isset($line['file'])) {
... | [
"public",
"function",
"isIndirect",
"(",
")",
"{",
"$",
"erroringFile",
"=",
"$",
"erroringPackage",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"trace",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"line",
"[",
"'func... | Tells whether both the calling package and the called package are vendor
packages.
@return bool | [
"Tells",
"whether",
"both",
"the",
"calling",
"package",
"and",
"the",
"called",
"package",
"are",
"vendor",
"packages",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php#L165-L194 |
207,157 | symfony/symfony | src/Symfony/Component/Templating/Helper/SlotsHelper.php | SlotsHelper.start | public function start($name)
{
if (\in_array($name, $this->openSlots)) {
throw new \InvalidArgumentException(sprintf('A slot named "%s" is already started.', $name));
}
$this->openSlots[] = $name;
$this->slots[$name] = '';
ob_start();
ob_implicit_flush(0... | php | public function start($name)
{
if (\in_array($name, $this->openSlots)) {
throw new \InvalidArgumentException(sprintf('A slot named "%s" is already started.', $name));
}
$this->openSlots[] = $name;
$this->slots[$name] = '';
ob_start();
ob_implicit_flush(0... | [
"public",
"function",
"start",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"openSlots",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'A slot named \"%s\" is al... | Starts a new slot.
This method starts an output buffer that will be
closed when the stop() method is called.
@param string $name The slot name
@throws \InvalidArgumentException if a slot with the same name is already started | [
"Starts",
"a",
"new",
"slot",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L34-L45 |
207,158 | symfony/symfony | src/Symfony/Component/Templating/Helper/SlotsHelper.php | SlotsHelper.stop | public function stop()
{
if (!$this->openSlots) {
throw new \LogicException('No slot started.');
}
$name = array_pop($this->openSlots);
$this->slots[$name] = ob_get_clean();
} | php | public function stop()
{
if (!$this->openSlots) {
throw new \LogicException('No slot started.');
}
$name = array_pop($this->openSlots);
$this->slots[$name] = ob_get_clean();
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"openSlots",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'No slot started.'",
")",
";",
"}",
"$",
"name",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"openSlots",... | Stops a slot.
@throws \LogicException if no slot has been started | [
"Stops",
"a",
"slot",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L52-L61 |
207,159 | symfony/symfony | src/Symfony/Component/Templating/Helper/SlotsHelper.php | SlotsHelper.get | public function get($name, $default = false)
{
return isset($this->slots[$name]) ? $this->slots[$name] : $default;
} | php | public function get($name, $default = false)
{
return isset($this->slots[$name]) ? $this->slots[$name] : $default;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"slots",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"slots",
"[",
"$",
"name",
"]",
":",
"$",
"defau... | Gets the slot value.
@param string $name The slot name
@param bool|string $default The default slot content
@return string The slot content | [
"Gets",
"the",
"slot",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L83-L86 |
207,160 | symfony/symfony | src/Symfony/Component/Templating/Helper/SlotsHelper.php | SlotsHelper.output | public function output($name, $default = false)
{
if (!isset($this->slots[$name])) {
if (false !== $default) {
echo $default;
return true;
}
return false;
}
echo $this->slots[$name];
return true;
} | php | public function output($name, $default = false)
{
if (!isset($this->slots[$name])) {
if (false !== $default) {
echo $default;
return true;
}
return false;
}
echo $this->slots[$name];
return true;
} | [
"public",
"function",
"output",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"slots",
"[",
"$",
"name",
"]",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"default",
")",
"{",
... | Outputs a slot.
@param string $name The slot name
@param bool|string $default The default slot content
@return bool true if the slot is defined or if a default content has been provided, false otherwise | [
"Outputs",
"a",
"slot",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L107-L122 |
207,161 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php | ValidatorTypeGuesser.guessMaxLengthForConstraint | public function guessMaxLengthForConstraint(Constraint $constraint)
{
switch (\get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\Length':
if (is_numeric($constraint->max)) {
return new ValueGuess($constraint->max, Guess::HIGH_CONFIDENCE);... | php | public function guessMaxLengthForConstraint(Constraint $constraint)
{
switch (\get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\Length':
if (is_numeric($constraint->max)) {
return new ValueGuess($constraint->max, Guess::HIGH_CONFIDENCE);... | [
"public",
"function",
"guessMaxLengthForConstraint",
"(",
"Constraint",
"$",
"constraint",
")",
"{",
"switch",
"(",
"\\",
"get_class",
"(",
"$",
"constraint",
")",
")",
"{",
"case",
"'Symfony\\Component\\Validator\\Constraints\\Length'",
":",
"if",
"(",
"is_numeric",
... | Guesses a field's maximum length based on the given constraint.
@return ValueGuess|null The guess for the maximum length | [
"Guesses",
"a",
"field",
"s",
"maximum",
"length",
"based",
"on",
"the",
"given",
"constraint",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php#L178-L199 |
207,162 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php | ValidatorTypeGuesser.guessPatternForConstraint | public function guessPatternForConstraint(Constraint $constraint)
{
switch (\get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\Length':
if (is_numeric($constraint->min)) {
return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min)... | php | public function guessPatternForConstraint(Constraint $constraint)
{
switch (\get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\Length':
if (is_numeric($constraint->min)) {
return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min)... | [
"public",
"function",
"guessPatternForConstraint",
"(",
"Constraint",
"$",
"constraint",
")",
"{",
"switch",
"(",
"\\",
"get_class",
"(",
"$",
"constraint",
")",
")",
"{",
"case",
"'Symfony\\Component\\Validator\\Constraints\\Length'",
":",
"if",
"(",
"is_numeric",
... | Guesses a field's pattern based on the given constraint.
@return ValueGuess|null The guess for the pattern | [
"Guesses",
"a",
"field",
"s",
"pattern",
"based",
"on",
"the",
"given",
"constraint",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php#L206-L235 |
207,163 | symfony/symfony | src/Symfony/Component/Security/Http/Firewall/ContextListener.php | ContextListener.onKernelResponse | public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
if (!$request->hasSession()) {
return;
}
$this->dispatcher->removeListener(KernelEvents::RESPONSE, [$... | php | public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
if (!$request->hasSession()) {
return;
}
$this->dispatcher->removeListener(KernelEvents::RESPONSE, [$... | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
... | Writes the security token into the session. | [
"Writes",
"the",
"security",
"token",
"into",
"the",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L126-L153 |
207,164 | symfony/symfony | src/Symfony/Component/Security/Http/Firewall/ContextListener.php | ContextListener.refreshUser | protected function refreshUser(TokenInterface $token)
{
$user = $token->getUser();
if (!$user instanceof UserInterface) {
return $token;
}
$userNotFoundByProvider = false;
$userDeauthenticated = false;
foreach ($this->userProviders as $provider) {
... | php | protected function refreshUser(TokenInterface $token)
{
$user = $token->getUser();
if (!$user instanceof UserInterface) {
return $token;
}
$userNotFoundByProvider = false;
$userDeauthenticated = false;
foreach ($this->userProviders as $provider) {
... | [
"protected",
"function",
"refreshUser",
"(",
"TokenInterface",
"$",
"token",
")",
"{",
"$",
"user",
"=",
"$",
"token",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"!",
"$",
"user",
"instanceof",
"UserInterface",
")",
"{",
"return",
"$",
"token",
";",
"}... | Refreshes the user by reloading it from the user provider.
@return TokenInterface|null
@throws \RuntimeException | [
"Refreshes",
"the",
"user",
"by",
"reloading",
"it",
"from",
"the",
"user",
"provider",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L162-L241 |
207,165 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.addHelpers | public function addHelpers(array $helpers)
{
foreach ($helpers as $alias => $helper) {
$this->set($helper, \is_int($alias) ? null : $alias);
}
} | php | public function addHelpers(array $helpers)
{
foreach ($helpers as $alias => $helper) {
$this->set($helper, \is_int($alias) ? null : $alias);
}
} | [
"public",
"function",
"addHelpers",
"(",
"array",
"$",
"helpers",
")",
"{",
"foreach",
"(",
"$",
"helpers",
"as",
"$",
"alias",
"=>",
"$",
"helper",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"helper",
",",
"\\",
"is_int",
"(",
"$",
"alias",
")"... | Adds some helpers.
@param HelperInterface[] $helpers An array of helper | [
"Adds",
"some",
"helpers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L224-L229 |
207,166 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.escape | public function escape($value, $context = 'html')
{
if (is_numeric($value)) {
return $value;
}
// If we deal with a scalar value, we can cache the result to increase
// the performance when the same value is escaped multiple times (e.g. loops)
if (is_scalar($valu... | php | public function escape($value, $context = 'html')
{
if (is_numeric($value)) {
return $value;
}
// If we deal with a scalar value, we can cache the result to increase
// the performance when the same value is escaped multiple times (e.g. loops)
if (is_scalar($valu... | [
"public",
"function",
"escape",
"(",
"$",
"value",
",",
"$",
"context",
"=",
"'html'",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"// If we deal with a scalar value, we can cache the result to increase"... | Escapes a string by using the current charset.
@param mixed $value A variable to escape
@param string $context The context name
@return string The escaped value | [
"Escapes",
"a",
"string",
"by",
"using",
"the",
"current",
"charset",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L306-L323 |
207,167 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.setCharset | public function setCharset($charset)
{
if ('UTF8' === $charset = strtoupper($charset)) {
$charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8"
}
$this->charset = $charset;
foreach ($this->helpers as $helper) {
$helper->setCharset($this->c... | php | public function setCharset($charset)
{
if ('UTF8' === $charset = strtoupper($charset)) {
$charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8"
}
$this->charset = $charset;
foreach ($this->helpers as $helper) {
$helper->setCharset($this->c... | [
"public",
"function",
"setCharset",
"(",
"$",
"charset",
")",
"{",
"if",
"(",
"'UTF8'",
"===",
"$",
"charset",
"=",
"strtoupper",
"(",
"$",
"charset",
")",
")",
"{",
"$",
"charset",
"=",
"'UTF-8'",
";",
"// iconv on Windows requires \"UTF-8\" instead of \"UTF8\"... | Sets the charset to use.
@param string $charset The charset | [
"Sets",
"the",
"charset",
"to",
"use",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L330-L340 |
207,168 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.setEscaper | public function setEscaper($context, callable $escaper)
{
$this->escapers[$context] = $escaper;
self::$escaperCache[$context] = [];
} | php | public function setEscaper($context, callable $escaper)
{
$this->escapers[$context] = $escaper;
self::$escaperCache[$context] = [];
} | [
"public",
"function",
"setEscaper",
"(",
"$",
"context",
",",
"callable",
"$",
"escaper",
")",
"{",
"$",
"this",
"->",
"escapers",
"[",
"$",
"context",
"]",
"=",
"$",
"escaper",
";",
"self",
"::",
"$",
"escaperCache",
"[",
"$",
"context",
"]",
"=",
"... | Adds an escaper for the given context.
@param string $context The escaper context (html, js, ...)
@param callable $escaper A PHP callable | [
"Adds",
"an",
"escaper",
"for",
"the",
"given",
"context",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L358-L362 |
207,169 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.getEscaper | public function getEscaper($context)
{
if (!isset($this->escapers[$context])) {
throw new \InvalidArgumentException(sprintf('No registered escaper for context "%s".', $context));
}
return $this->escapers[$context];
} | php | public function getEscaper($context)
{
if (!isset($this->escapers[$context])) {
throw new \InvalidArgumentException(sprintf('No registered escaper for context "%s".', $context));
}
return $this->escapers[$context];
} | [
"public",
"function",
"getEscaper",
"(",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"escapers",
"[",
"$",
"context",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'No registere... | Gets an escaper for a given context.
@param string $context The context name
@return callable A PHP callable
@throws \InvalidArgumentException | [
"Gets",
"an",
"escaper",
"for",
"a",
"given",
"context",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L373-L380 |
207,170 | symfony/symfony | src/Symfony/Component/Templating/PhpEngine.php | PhpEngine.initializeEscapers | protected function initializeEscapers()
{
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
$this->escapers = [
'html' =>
/**
* Runs the PHP function htmlspecialchars on the value passed.
*
* @param string $value The value to escape... | php | protected function initializeEscapers()
{
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
$this->escapers = [
'html' =>
/**
* Runs the PHP function htmlspecialchars on the value passed.
*
* @param string $value The value to escape... | [
"protected",
"function",
"initializeEscapers",
"(",
")",
"{",
"$",
"flags",
"=",
"ENT_QUOTES",
"|",
"ENT_SUBSTITUTE",
";",
"$",
"this",
"->",
"escapers",
"=",
"[",
"'html'",
"=>",
"/**\n * Runs the PHP function htmlspecialchars on the value passed.\n ... | Initializes the built-in escapers.
Each function specifies a way for applying a transformation to a string
passed to it. The purpose is for the string to be "escaped" so it is
suitable for the format it is being displayed in.
For example, the string: "It's required that you enter a username & password.\n"
If this wer... | [
"Initializes",
"the",
"built",
"-",
"in",
"escapers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L418-L478 |
207,171 | symfony/symfony | src/Symfony/Component/Console/Input/InputDefinition.php | InputDefinition.setArguments | public function setArguments($arguments = [])
{
$this->arguments = [];
$this->requiredCount = 0;
$this->hasOptional = false;
$this->hasAnArrayArgument = false;
$this->addArguments($arguments);
} | php | public function setArguments($arguments = [])
{
$this->arguments = [];
$this->requiredCount = 0;
$this->hasOptional = false;
$this->hasAnArrayArgument = false;
$this->addArguments($arguments);
} | [
"public",
"function",
"setArguments",
"(",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"arguments",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"requiredCount",
"=",
"0",
";",
"$",
"this",
"->",
"hasOptional",
"=",
"false",
";",
"$",
"... | Sets the InputArgument objects.
@param InputArgument[] $arguments An array of InputArgument objects | [
"Sets",
"the",
"InputArgument",
"objects",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/InputDefinition.php#L70-L77 |
207,172 | symfony/symfony | src/Symfony/Component/Console/Input/InputDefinition.php | InputDefinition.addArguments | public function addArguments($arguments = [])
{
if (null !== $arguments) {
foreach ($arguments as $argument) {
$this->addArgument($argument);
}
}
} | php | public function addArguments($arguments = [])
{
if (null !== $arguments) {
foreach ($arguments as $argument) {
$this->addArgument($argument);
}
}
} | [
"public",
"function",
"addArguments",
"(",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"arguments",
")",
"{",
"foreach",
"(",
"$",
"arguments",
"as",
"$",
"argument",
")",
"{",
"$",
"this",
"->",
"addArgument",
"(",
"$",... | Adds an array of InputArgument objects.
@param InputArgument[] $arguments An array of InputArgument objects | [
"Adds",
"an",
"array",
"of",
"InputArgument",
"objects",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/InputDefinition.php#L84-L91 |
207,173 | symfony/symfony | src/Symfony/Component/Console/Input/InputDefinition.php | InputDefinition.getArgument | public function getArgument($name)
{
if (!$this->hasArgument($name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
return $arguments[$name];
... | php | public function getArgument($name)
{
if (!$this->hasArgument($name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
return $arguments[$name];
... | [
"public",
"function",
"getArgument",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasArgument",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The \"%s\" argument does not exist.'",
",",
... | Returns an InputArgument by name or by position.
@param string|int $name The InputArgument name or position
@return InputArgument An InputArgument object
@throws InvalidArgumentException When argument given doesn't exist | [
"Returns",
"an",
"InputArgument",
"by",
"name",
"or",
"by",
"position",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/InputDefinition.php#L132-L141 |
207,174 | symfony/symfony | src/Symfony/Component/Console/Input/InputDefinition.php | InputDefinition.getArgumentDefaults | public function getArgumentDefaults()
{
$values = [];
foreach ($this->arguments as $argument) {
$values[$argument->getName()] = $argument->getDefault();
}
return $values;
} | php | public function getArgumentDefaults()
{
$values = [];
foreach ($this->arguments as $argument) {
$values[$argument->getName()] = $argument->getDefault();
}
return $values;
} | [
"public",
"function",
"getArgumentDefaults",
"(",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"arguments",
"as",
"$",
"argument",
")",
"{",
"$",
"values",
"[",
"$",
"argument",
"->",
"getName",
"(",
")",
"]",
"=",
... | Gets the default values.
@return array An array of default values | [
"Gets",
"the",
"default",
"values",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/InputDefinition.php#L192-L200 |
207,175 | symfony/symfony | src/Symfony/Component/Console/Input/InputDefinition.php | InputDefinition.shortcutToName | public function shortcutToName($shortcut)
{
if (!isset($this->shortcuts[$shortcut])) {
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}
return $this->shortcuts[$shortcut];
} | php | public function shortcutToName($shortcut)
{
if (!isset($this->shortcuts[$shortcut])) {
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}
return $this->shortcuts[$shortcut];
} | [
"public",
"function",
"shortcutToName",
"(",
"$",
"shortcut",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shortcuts",
"[",
"$",
"shortcut",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The \"-%s\" o... | Returns the InputOption name given a shortcut.
@param string $shortcut The shortcut
@return string The InputOption name
@throws InvalidArgumentException When option given does not exist
@internal | [
"Returns",
"the",
"InputOption",
"name",
"given",
"a",
"shortcut",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/InputDefinition.php#L344-L351 |
207,176 | symfony/symfony | src/Symfony/Component/HttpFoundation/HeaderBag.php | HeaderBag.contains | public function contains($key, $value)
{
return \in_array($value, $this->get($key, null, false));
} | php | public function contains($key, $value)
{
return \in_array($value, $this->get($key, null, false));
} | [
"public",
"function",
"contains",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"\\",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
",",
"null",
",",
"false",
")",
")",
";",
"}"
] | Returns true if the given HTTP header contains the given value.
@param string $key The HTTP header name
@param string $value The HTTP value
@return bool true if the value is contained in the header, false otherwise | [
"Returns",
"true",
"if",
"the",
"given",
"HTTP",
"header",
"contains",
"the",
"given",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderBag.php#L182-L185 |
207,177 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.getAttributes | protected function getAttributes($object, $format = null, array $context)
{
$class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
$key = $class.'-'.$context['cache_key'];
if (isset($this->attributesCache[$key])) {
return $this->attrib... | php | protected function getAttributes($object, $format = null, array $context)
{
$class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
$key = $class.'-'.$context['cache_key'];
if (isset($this->attributesCache[$key])) {
return $this->attrib... | [
"protected",
"function",
"getAttributes",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"objectClassResolver",
"?",
"(",
"$",
"this",
"->",
"objectClassResolver",
")",
"... | Gets and caches attributes for the given object, format and context.
@param object $object
@param string|null $format
@param array $context
@return string[] | [
"Gets",
"and",
"caches",
"attributes",
"for",
"the",
"given",
"object",
"format",
"and",
"context",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L243-L273 |
207,178 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.setMaxDepthHandler | public function setMaxDepthHandler(?callable $handler): void
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "max_depth_handler" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->maxDepthHandler = $handler;
} | php | public function setMaxDepthHandler(?callable $handler): void
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "max_depth_handler" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->maxDepthHandler = $handler;
} | [
"public",
"function",
"setMaxDepthHandler",
"(",
"?",
"callable",
"$",
"handler",
")",
":",
"void",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the \"max_depth_handler\" key of the context instead.'",
",",
"__METHOD... | Sets a handler function that will be called when the max depth is reached.
@deprecated since Symfony 4.2 | [
"Sets",
"a",
"handler",
"function",
"that",
"will",
"be",
"called",
"when",
"the",
"max",
"depth",
"is",
"reached",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L303-L308 |
207,179 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.validateAndDenormalize | private function validateAndDenormalize(string $currentClass, string $attribute, $data, ?string $format, array $context)
{
if (null === $types = $this->getTypes($currentClass, $attribute)) {
return $data;
}
$expectedTypes = [];
foreach ($types as $type) {
if ... | php | private function validateAndDenormalize(string $currentClass, string $attribute, $data, ?string $format, array $context)
{
if (null === $types = $this->getTypes($currentClass, $attribute)) {
return $data;
}
$expectedTypes = [];
foreach ($types as $type) {
if ... | [
"private",
"function",
"validateAndDenormalize",
"(",
"string",
"$",
"currentClass",
",",
"string",
"$",
"attribute",
",",
"$",
"data",
",",
"?",
"string",
"$",
"format",
",",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"types",
"="... | Validates the submitted data and denormalizes it.
@param mixed $data
@return mixed
@throws NotNormalizableValueException
@throws LogicException | [
"Validates",
"the",
"submitted",
"data",
"and",
"denormalizes",
"it",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L390-L453 |
207,180 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.isMaxDepthReached | private function isMaxDepthReached(array $attributesMetadata, string $class, string $attribute, array &$context): bool
{
$enableMaxDepth = $context[self::ENABLE_MAX_DEPTH] ?? $this->defaultContext[self::ENABLE_MAX_DEPTH] ?? false;
if (
!$enableMaxDepth ||
!isset($attributesMe... | php | private function isMaxDepthReached(array $attributesMetadata, string $class, string $attribute, array &$context): bool
{
$enableMaxDepth = $context[self::ENABLE_MAX_DEPTH] ?? $this->defaultContext[self::ENABLE_MAX_DEPTH] ?? false;
if (
!$enableMaxDepth ||
!isset($attributesMe... | [
"private",
"function",
"isMaxDepthReached",
"(",
"array",
"$",
"attributesMetadata",
",",
"string",
"$",
"class",
",",
"string",
"$",
"attribute",
",",
"array",
"&",
"$",
"context",
")",
":",
"bool",
"{",
"$",
"enableMaxDepth",
"=",
"$",
"context",
"[",
"s... | Is the max depth reached for the given attribute?
@param AttributeMetadataInterface[] $attributesMetadata | [
"Is",
"the",
"max",
"depth",
"reached",
"for",
"the",
"given",
"attribute?"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L529-L554 |
207,181 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.createChildContext | protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
{
if (\func_num_args() >= 3) {
$format = \func_get_arg(2);
} else {
// will be deprecated in version 4
$format = null;
}
$context = parent::createC... | php | protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
{
if (\func_num_args() >= 3) {
$format = \func_get_arg(2);
} else {
// will be deprecated in version 4
$format = null;
}
$context = parent::createC... | [
"protected",
"function",
"createChildContext",
"(",
"array",
"$",
"parentContext",
",",
"$",
"attribute",
"/*, string $format = null */",
")",
"{",
"if",
"(",
"\\",
"func_num_args",
"(",
")",
">=",
"3",
")",
"{",
"$",
"format",
"=",
"\\",
"func_get_arg",
"(",
... | Overwritten to update the cache key for the child.
We must not mix up the attribute cache between parent and children.
{@inheritdoc} | [
"Overwritten",
"to",
"update",
"the",
"cache",
"key",
"for",
"the",
"child",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L563-L577 |
207,182 | symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php | AbstractObjectNormalizer.getCacheKey | private function getCacheKey(?string $format, array $context)
{
foreach ($context[self::EXCLUDE_FROM_CACHE_KEY] ?? $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] as $key) {
unset($context[$key]);
}
unset($context[self::EXCLUDE_FROM_CACHE_KEY]);
unset($context['cache_... | php | private function getCacheKey(?string $format, array $context)
{
foreach ($context[self::EXCLUDE_FROM_CACHE_KEY] ?? $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] as $key) {
unset($context[$key]);
}
unset($context[self::EXCLUDE_FROM_CACHE_KEY]);
unset($context['cache_... | [
"private",
"function",
"getCacheKey",
"(",
"?",
"string",
"$",
"format",
",",
"array",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"context",
"[",
"self",
"::",
"EXCLUDE_FROM_CACHE_KEY",
"]",
"??",
"$",
"this",
"->",
"defaultContext",
"[",
"self",
"::",... | Builds the cache key for the attributes cache.
The key must be different for every option in the context that could change which attributes should be handled.
@return bool|string | [
"Builds",
"the",
"cache",
"key",
"for",
"the",
"attributes",
"cache",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php#L586-L604 |
207,183 | symfony/symfony | src/Symfony/Component/Asset/Packages.php | Packages.getPackage | public function getPackage($name = null)
{
if (null === $name) {
if (null === $this->defaultPackage) {
throw new LogicException('There is no default asset package, configure one first.');
}
return $this->defaultPackage;
}
if (!isset($this... | php | public function getPackage($name = null)
{
if (null === $name) {
if (null === $this->defaultPackage) {
throw new LogicException('There is no default asset package, configure one first.');
}
return $this->defaultPackage;
}
if (!isset($this... | [
"public",
"function",
"getPackage",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"defaultPackage",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'There is no ... | Returns an asset package.
@param string $name The name of the package or null for the default package
@return PackageInterface An asset package
@throws InvalidArgumentException If there is no package by that name
@throws LogicException If no default package is defined | [
"Returns",
"an",
"asset",
"package",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Asset/Packages.php#L67-L82 |
207,184 | symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php | DateTimeToStringTransformer.transform | public function transform($dateTime)
{
if (null === $dateTime) {
return '';
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expected a \DateTimeInterface.');
}
if (!$dateTime instanceof \DateTimeImmutable) {... | php | public function transform($dateTime)
{
if (null === $dateTime) {
return '';
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expected a \DateTimeInterface.');
}
if (!$dateTime instanceof \DateTimeImmutable) {... | [
"public",
"function",
"transform",
"(",
"$",
"dateTime",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"dateTime",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"$",
"dateTime",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"throw",
"new",
"Trans... | Transforms a DateTime object into a date string with the configured format
and timezone.
@param \DateTimeInterface $dateTime A DateTimeInterface object
@return string A value as produced by PHP's date() function
@throws TransformationFailedException If the given value is not a \DateTimeInterface | [
"Transforms",
"a",
"DateTime",
"object",
"into",
"a",
"date",
"string",
"with",
"the",
"configured",
"format",
"and",
"timezone",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php#L80-L97 |
207,185 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php | ViolationMapper.matchChild | private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
{
$target = null;
$chunk = '';
$foundAtIndex = null;
// Construct mapping rules for the given form
$rules = [];
foreach ($form->getConfig()->getOption('error_mapping') as $propertyPa... | php | private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
{
$target = null;
$chunk = '';
$foundAtIndex = null;
// Construct mapping rules for the given form
$rules = [];
foreach ($form->getConfig()->getOption('error_mapping') as $propertyPa... | [
"private",
"function",
"matchChild",
"(",
"FormInterface",
"$",
"form",
",",
"PropertyPathIteratorInterface",
"$",
"it",
")",
"{",
"$",
"target",
"=",
"null",
";",
"$",
"chunk",
"=",
"''",
";",
"$",
"foundAtIndex",
"=",
"null",
";",
"// Construct mapping rules... | Tries to match the beginning of the property path at the
current position against the children of the scope.
If a matching child is found, it is returned. Otherwise
null is returned.
@param FormInterface $form The form to search
@param PropertyPathIteratorInterface $it The iterator at its current po... | [
"Tries",
"to",
"match",
"the",
"beginning",
"of",
"the",
"property",
"path",
"at",
"the",
"current",
"position",
"against",
"the",
"children",
"of",
"the",
"scope",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php#L149-L210 |
207,186 | symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php | ViolationMapper.reconstructPath | private function reconstructPath(ViolationPath $violationPath, FormInterface $origin)
{
$propertyPathBuilder = new PropertyPathBuilder($violationPath);
$it = $violationPath->getIterator();
$scope = $origin;
// Remember the current index in the builder
$i = 0;
// Exp... | php | private function reconstructPath(ViolationPath $violationPath, FormInterface $origin)
{
$propertyPathBuilder = new PropertyPathBuilder($violationPath);
$it = $violationPath->getIterator();
$scope = $origin;
// Remember the current index in the builder
$i = 0;
// Exp... | [
"private",
"function",
"reconstructPath",
"(",
"ViolationPath",
"$",
"violationPath",
",",
"FormInterface",
"$",
"origin",
")",
"{",
"$",
"propertyPathBuilder",
"=",
"new",
"PropertyPathBuilder",
"(",
"$",
"violationPath",
")",
";",
"$",
"it",
"=",
"$",
"violati... | Reconstructs a property path from a violation path and a form tree.
@param ViolationPath $violationPath The violation path
@param FormInterface $origin The root form of the tree
@return RelativePath The reconstructed path | [
"Reconstructs",
"a",
"property",
"path",
"from",
"a",
"violation",
"path",
"and",
"a",
"form",
"tree",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php#L220-L269 |
207,187 | symfony/symfony | src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php | CookieClearingLogoutHandler.logout | public function logout(Request $request, Response $response, TokenInterface $token)
{
foreach ($this->cookies as $cookieName => $cookieData) {
$response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain']);
}
} | php | public function logout(Request $request, Response $response, TokenInterface $token)
{
foreach ($this->cookies as $cookieName => $cookieData) {
$response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain']);
}
} | [
"public",
"function",
"logout",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"cookies",
"as",
"$",
"cookieName",
"=>",
"$",
"cookieData",
")",
"{",
"$"... | Implementation for the LogoutHandlerInterface. Deletes all requested cookies. | [
"Implementation",
"for",
"the",
"LogoutHandlerInterface",
".",
"Deletes",
"all",
"requested",
"cookies",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Logout/CookieClearingLogoutHandler.php#L38-L43 |
207,188 | symfony/symfony | src/Symfony/Component/Console/Helper/ProgressIndicator.php | ProgressIndicator.start | public function start($message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
}
$this->message = $message;
$this->started = true;
$this->startTime = time();
$this->indicatorUpdateTime = $this->getCurrentTimeInMil... | php | public function start($message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
}
$this->message = $message;
$this->started = true;
$this->startTime = time();
$this->indicatorUpdateTime = $this->getCurrentTimeInMil... | [
"public",
"function",
"start",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Progress indicator already started.'",
")",
";",
"}",
"$",
"this",
"->",
"message",
"=",
"$",
"message... | Starts the indicator output.
@param $message | [
"Starts",
"the",
"indicator",
"output",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProgressIndicator.php#L83-L96 |
207,189 | symfony/symfony | src/Symfony/Component/Console/Helper/ProgressIndicator.php | ProgressIndicator.advance | public function advance()
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}
if (!$this->output->isDecorated()) {
return;
}
$currentTime = $this->getCurrentTimeInMilliseconds();
if ($currentT... | php | public function advance()
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}
if (!$this->output->isDecorated()) {
return;
}
$currentTime = $this->getCurrentTimeInMilliseconds();
if ($currentT... | [
"public",
"function",
"advance",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Progress indicator has not yet been started.'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"output",
"->... | Advances the indicator. | [
"Advances",
"the",
"indicator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProgressIndicator.php#L101-L121 |
207,190 | symfony/symfony | src/Symfony/Component/Console/Helper/ProgressIndicator.php | ProgressIndicator.finish | public function finish($message)
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}
$this->message = $message;
$this->display();
$this->output->writeln('');
$this->started = false;
} | php | public function finish($message)
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}
$this->message = $message;
$this->display();
$this->output->writeln('');
$this->started = false;
} | [
"public",
"function",
"finish",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Progress indicator has not yet been started.'",
")",
";",
"}",
"$",
"this",
"->",
"message",
"=",
... | Finish the indicator with message.
@param $message | [
"Finish",
"the",
"indicator",
"with",
"message",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProgressIndicator.php#L128-L138 |
207,191 | symfony/symfony | src/Symfony/Component/HttpFoundation/Session/SessionUtils.php | SessionUtils.popSessionCookie | public static function popSessionCookie(string $sessionName, string $sessionId): ?string
{
$sessionCookie = null;
$sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName));
$sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
$otherCookies = [];... | php | public static function popSessionCookie(string $sessionName, string $sessionId): ?string
{
$sessionCookie = null;
$sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName));
$sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
$otherCookies = [];... | [
"public",
"static",
"function",
"popSessionCookie",
"(",
"string",
"$",
"sessionName",
",",
"string",
"$",
"sessionId",
")",
":",
"?",
"string",
"{",
"$",
"sessionCookie",
"=",
"null",
";",
"$",
"sessionCookiePrefix",
"=",
"sprintf",
"(",
"' %s='",
",",
"url... | Finds the session header amongst the headers that are to be sent, removes it, and returns
it so the caller can process it further. | [
"Finds",
"the",
"session",
"header",
"amongst",
"the",
"headers",
"that",
"are",
"to",
"be",
"sent",
"removes",
"it",
"and",
"returns",
"it",
"so",
"the",
"caller",
"can",
"process",
"it",
"further",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/SessionUtils.php#L28-L58 |
207,192 | symfony/symfony | src/Symfony/Component/DependencyInjection/Container.php | Container.make | private function make(string $id, int $invalidBehavior)
{
if (isset($this->loading[$id])) {
throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), [$id]));
}
$this->loading[$id] = true;
try {
if (isset($this->fileMap[$id])) ... | php | private function make(string $id, int $invalidBehavior)
{
if (isset($this->loading[$id])) {
throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), [$id]));
}
$this->loading[$id] = true;
try {
if (isset($this->fileMap[$id])) ... | [
"private",
"function",
"make",
"(",
"string",
"$",
"id",
",",
"int",
"$",
"invalidBehavior",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"loading",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"ServiceCircularReferenceException",
"(",
... | Creates a service.
As a separate method to allow "get()" to use the really fast `??` operator. | [
"Creates",
"a",
"service",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Container.php#L233-L279 |
207,193 | symfony/symfony | src/Symfony/Component/Inflector/Inflector.php | Inflector.singularize | public static function singularize(string $plural)
{
$pluralRev = strrev($plural);
$lowerPluralRev = strtolower($pluralRev);
$pluralLength = \strlen($lowerPluralRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerPluralRev, self::... | php | public static function singularize(string $plural)
{
$pluralRev = strrev($plural);
$lowerPluralRev = strtolower($pluralRev);
$pluralLength = \strlen($lowerPluralRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerPluralRev, self::... | [
"public",
"static",
"function",
"singularize",
"(",
"string",
"$",
"plural",
")",
"{",
"$",
"pluralRev",
"=",
"strrev",
"(",
"$",
"plural",
")",
";",
"$",
"lowerPluralRev",
"=",
"strtolower",
"(",
"$",
"pluralRev",
")",
";",
"$",
"pluralLength",
"=",
"\\... | Returns the singular form of a word.
If the method can't determine the form with certainty, an array of the
possible singulars is returned.
@param string $plural A word in plural form
@return string|array The singular form or an array of possible singular forms | [
"Returns",
"the",
"singular",
"form",
"of",
"a",
"word",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Inflector/Inflector.php#L331-L405 |
207,194 | symfony/symfony | src/Symfony/Component/Inflector/Inflector.php | Inflector.pluralize | public static function pluralize(string $singular)
{
$singularRev = strrev($singular);
$lowerSingularRev = strtolower($singularRev);
$singularLength = \strlen($lowerSingularRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerSingu... | php | public static function pluralize(string $singular)
{
$singularRev = strrev($singular);
$lowerSingularRev = strtolower($singularRev);
$singularLength = \strlen($lowerSingularRev);
// Check if the word is one which is not inflected, return early if so
if (\in_array($lowerSingu... | [
"public",
"static",
"function",
"pluralize",
"(",
"string",
"$",
"singular",
")",
"{",
"$",
"singularRev",
"=",
"strrev",
"(",
"$",
"singular",
")",
";",
"$",
"lowerSingularRev",
"=",
"strtolower",
"(",
"$",
"singularRev",
")",
";",
"$",
"singularLength",
... | Returns the plural form of a word.
If the method can't determine the form with certainty, an array of the
possible plurals is returned.
@param string $singular A word in plural form
@return string|array The plural form or an array of possible plural forms | [
"Returns",
"the",
"plural",
"form",
"of",
"a",
"word",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Inflector/Inflector.php#L417-L492 |
207,195 | symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php | ConfigDataCollector.determineSymfonyState | private function determineSymfonyState()
{
$now = new \DateTime();
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
if ($now > $e... | php | private function determineSymfonyState()
{
$now = new \DateTime();
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
if ($now > $e... | [
"private",
"function",
"determineSymfonyState",
"(",
")",
"{",
"$",
"now",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"eom",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"'m/Y'",
",",
"Kernel",
"::",
"END_OF_MAINTENANCE",
")",
"->",
"modify... | Tries to retrieve information about the current Symfony version.
@return string One of: dev, stable, eom, eol | [
"Tries",
"to",
"retrieve",
"information",
"about",
"the",
"current",
"Symfony",
"version",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php#L330-L347 |
207,196 | symfony/symfony | src/Symfony/Component/Translation/Loader/XliffFileLoader.php | XliffFileLoader.extractXliff1 | private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{
$xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding);
$namespace = 'urn:oasis:names:tc:xliff:document:1.2';
$xml->registerXPathNamespace('xliff', $namespace);
... | php | private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{
$xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding);
$namespace = 'urn:oasis:names:tc:xliff:document:1.2';
$xml->registerXPathNamespace('xliff', $namespace);
... | [
"private",
"function",
"extractXliff1",
"(",
"\\",
"DOMDocument",
"$",
"dom",
",",
"MessageCatalogue",
"$",
"catalogue",
",",
"string",
"$",
"domain",
")",
"{",
"$",
"xml",
"=",
"simplexml_import_dom",
"(",
"$",
"dom",
")",
";",
"$",
"encoding",
"=",
"strt... | Extract messages and metadata from DOMDocument into a MessageCatalogue.
@param \DOMDocument $dom Source to extract messages and metadata
@param MessageCatalogue $catalogue Catalogue where we'll collect messages and metadata
@param string $domain The domain | [
"Extract",
"messages",
"and",
"metadata",
"from",
"DOMDocument",
"into",
"a",
"MessageCatalogue",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/XliffFileLoader.php#L80-L131 |
207,197 | symfony/symfony | src/Symfony/Component/HttpFoundation/BinaryFileResponse.php | BinaryFileResponse.setAutoEtag | public function setAutoEtag()
{
$this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true)));
return $this;
} | php | public function setAutoEtag()
{
$this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true)));
return $this;
} | [
"public",
"function",
"setAutoEtag",
"(",
")",
"{",
"$",
"this",
"->",
"setEtag",
"(",
"base64_encode",
"(",
"hash_file",
"(",
"'sha256'",
",",
"$",
"this",
"->",
"file",
"->",
"getPathname",
"(",
")",
",",
"true",
")",
")",
")",
";",
"return",
"$",
... | Automatically sets the ETag header according to the checksum of the file. | [
"Automatically",
"sets",
"the",
"ETag",
"header",
"according",
"to",
"the",
"checksum",
"of",
"the",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php#L140-L145 |
207,198 | symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php | AbstractRecursivePass.processValue | protected function processValue($value, $isRoot = false)
{
if (\is_array($value)) {
foreach ($value as $k => $v) {
if ($isRoot) {
$this->currentId = $k;
}
if ($v !== $processedValue = $this->processValue($v, $isRoot)) {
... | php | protected function processValue($value, $isRoot = false)
{
if (\is_array($value)) {
foreach ($value as $k => $v) {
if ($isRoot) {
$this->currentId = $k;
}
if ($v !== $processedValue = $this->processValue($v, $isRoot)) {
... | [
"protected",
"function",
"processValue",
"(",
"$",
"value",
",",
"$",
"isRoot",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
... | Processes a value found in a definition tree.
@param mixed $value
@param bool $isRoot
@return mixed The processed value | [
"Processes",
"a",
"value",
"found",
"in",
"a",
"definition",
"tree",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php#L75-L105 |
207,199 | symfony/symfony | src/Symfony/Bridge/Twig/AppVariable.php | AppVariable.getSession | public function getSession()
{
if (null === $this->requestStack) {
throw new \RuntimeException('The "app.session" variable is not available.');
}
if ($request = $this->getRequest()) {
return $request->getSession();
}
} | php | public function getSession()
{
if (null === $this->requestStack) {
throw new \RuntimeException('The "app.session" variable is not available.');
}
if ($request = $this->getRequest()) {
return $request->getSession();
}
} | [
"public",
"function",
"getSession",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"requestStack",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The \"app.session\" variable is not available.'",
")",
";",
"}",
"if",
"(",
"$",
"request... | Returns the current session.
@return Session|null The session | [
"Returns",
"the",
"current",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/AppVariable.php#L110-L119 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.